summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorpowei@chromium.org <powei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 22:19:17 +0000
committerpowei@chromium.org <powei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 22:19:17 +0000
commit6485a3054403d7b61584585c48cfc2615b7b1253 (patch)
tree4f65acabd3b30614c4ec5499f93032e27bf2e0bb /cc
parentfba8d672f45504757e26eb2eeaada80d729c4984 (diff)
downloadchromium_src-6485a3054403d7b61584585c48cfc2615b7b1253.zip
chromium_src-6485a3054403d7b61584585c48cfc2615b7b1253.tar.gz
chromium_src-6485a3054403d7b61584585c48cfc2615b7b1253.tar.bz2
cc: Fix cc_perftests DenseBrowerUI
Continuation of https://codereview.chromium.org/77453012 EndTest() is called before TextureMailbox gets cleaned up, which causes the test to crash in Debug. This patch adds a clean-up stage to the test where additional commits are queued to clean up the TextureMailbox. Also moved TextureMailbox creation to the main thread. BUG=310218 Review URL: https://codereview.chromium.org/107243002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/layer_tree_host_perftest.cc40
1 files changed, 31 insertions, 9 deletions
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc
index 5f15ca6..4fd2436 100644
--- a/cc/trees/layer_tree_host_perftest.cc
+++ b/cc/trees/layer_tree_host_perftest.cc
@@ -70,12 +70,11 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- if (TestEnded()) {
+ if (TestEnded() || CleanUpStarted())
return;
- }
draw_timer_.NextLap();
if (draw_timer_.HasTimeLimitExpired()) {
- EndTest();
+ CleanUpAndEndTest(impl);
return;
}
if (!animation_driven_drawing_)
@@ -84,6 +83,10 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
impl->SetFullRootLayerDamage();
}
+ virtual void CleanUpAndEndTest(LayerTreeHostImpl* host_impl) { EndTest(); }
+
+ virtual bool CleanUpStarted() { return false; }
+
virtual void BuildTree() {}
virtual void AfterTest() OVERRIDE {
@@ -250,8 +253,7 @@ class BrowserCompositorInvalidateLayerTreePerfTest
: public LayerTreeHostPerfTestJsonReader {
public:
BrowserCompositorInvalidateLayerTreePerfTest()
- : next_sync_point_(1) {
- }
+ : next_sync_point_(1), clean_up_started_(false) {}
virtual void BuildTree() OVERRIDE {
LayerTreeHostPerfTestJsonReader::BuildTree();
@@ -262,14 +264,12 @@ class BrowserCompositorInvalidateLayerTreePerfTest
children()[0]->
children()[0].get());
ASSERT_TRUE(tab_contents_.get());
- }
- virtual void Layout() OVERRIDE {
gpu::Mailbox gpu_mailbox;
std::ostringstream name_stream;
name_stream << "name" << next_sync_point_;
- const char* name = name_stream.str().c_str();
- memcpy(gpu_mailbox.name, name, strlen(name) + 1);
+ gpu_mailbox.SetName(
+ reinterpret_cast<const int8*>(name_stream.str().c_str()));
scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
base::Bind(&EmptyReleaseCallback));
TextureMailbox mailbox(gpu_mailbox, next_sync_point_);
@@ -278,9 +278,31 @@ class BrowserCompositorInvalidateLayerTreePerfTest
tab_contents_->SetTextureMailbox(mailbox, callback.Pass());
}
+ virtual void DidCommitAndDrawFrame() OVERRIDE {
+ if (CleanUpStarted())
+ EndTest();
+ }
+
+ virtual void CleanUpAndEndTest(LayerTreeHostImpl* host_impl) OVERRIDE {
+ clean_up_started_ = true;
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&BrowserCompositorInvalidateLayerTreePerfTest::
+ CleanUpAndEndTestOnMainThread,
+ base::Unretained(this)));
+ }
+
+ void CleanUpAndEndTestOnMainThread() {
+ tab_contents_->SetTextureMailbox(TextureMailbox(),
+ scoped_ptr<SingleReleaseCallback>());
+ }
+
+ virtual bool CleanUpStarted() OVERRIDE { return clean_up_started_; }
+
private:
scoped_refptr<TextureLayer> tab_contents_;
unsigned next_sync_point_;
+ bool clean_up_started_;
};
TEST_F(BrowserCompositorInvalidateLayerTreePerfTest, DenseBrowserUI) {