This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add onUnregistered callback in 'Texture' and 'FlutterTexture' #12695
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7418e7e
wait for platform view appear
ab43f55
Merge branch 'master' of github.com:flutter/engine
6236792
prototype adding unregistered callback
9de6e23
remove import
ef340fb
add documentation
e360c9d
Merge branch 'master' of github.com:flutter/engine
91d023a
Merge branch 'master' into texture_race
2417658
Revert "wait for platform view appear"
1c2fa91
lisence golden fix, make onUnregistered optional
2ab9edd
rename method
fceb313
Merge branch 'master' of github.com:flutter/engine into texture_race
1e0a9c5
review fixes
11e3847
change texture test to mm
01d6d09
add texture testing in shell_unittest
04059b3
formatting
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "flutter/flow/texture.h" | ||
#include "gtest/gtest.h" | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
class MockTexture : public Texture { | ||
public: | ||
MockTexture(int64_t textureId) : Texture(textureId) {} | ||
|
||
~MockTexture() override = default; | ||
|
||
// Called from GPU thread. | ||
void Paint(SkCanvas& canvas, | ||
const SkRect& bounds, | ||
bool freeze, | ||
GrContext* context) override {} | ||
|
||
void OnGrContextCreated() override {} | ||
|
||
void OnGrContextDestroyed() override {} | ||
|
||
void MarkNewFrameAvailable() override {} | ||
|
||
void OnTextureUnregistered() override { unregistered_ = true; } | ||
|
||
bool unregistered() { return unregistered_; } | ||
|
||
private: | ||
bool unregistered_ = false; | ||
}; | ||
|
||
TEST(TextureRegistry, UnregisterTextureCallbackTriggered) { | ||
TextureRegistry textureRegistry; | ||
std::shared_ptr<MockTexture> mockTexture = std::make_shared<MockTexture>(0); | ||
textureRegistry.RegisterTexture(mockTexture); | ||
textureRegistry.UnregisterTexture(0); | ||
ASSERT_TRUE(mockTexture->unregistered()); | ||
} | ||
|
||
} // namespace testing | ||
} // namespace flutter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per convention, we note the class that declares the prototype for the method being overridden. So
// |flutter::testing::Texture|
.