Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: cc/test/layer_tree_test_common.cc

Issue 11491003: Revert 171714 - Use an auxiliary list of animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/layer_tree_test_common.h ('k') | cc/thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/layer_tree_test_common.h" 5 #include "cc/test/layer_tree_test_common.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "cc/active_animation.h" 8 #include "cc/active_animation.h"
9 #include "cc/content_layer.h" 9 #include "cc/content_layer.h"
10 #include "cc/font_atlas.h" 10 #include "cc/font_atlas.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks); 149 layerTreeHost->rootLayer()->setLayerAnimationDelegate(testHooks);
150 150
151 return layerTreeHost.Pass(); 151 return layerTreeHost.Pass();
152 } 152 }
153 153
154 virtual scoped_ptr<cc::LayerTreeHostImpl> createLayerTreeHostImpl(cc::LayerT reeHostImplClient* client) 154 virtual scoped_ptr<cc::LayerTreeHostImpl> createLayerTreeHostImpl(cc::LayerT reeHostImplClient* client)
155 { 155 {
156 return MockLayerTreeHostImpl::create(m_testHooks, settings(), client, pr oxy()).PassAs<cc::LayerTreeHostImpl>(); 156 return MockLayerTreeHostImpl::create(m_testHooks, settings(), client, pr oxy()).PassAs<cc::LayerTreeHostImpl>();
157 } 157 }
158 158
159 virtual void didAddAnimation() OVERRIDE
160 {
161 LayerTreeHost::didAddAnimation();
162 m_testHooks->didAddAnimation();
163 }
164
159 virtual void setNeedsCommit() OVERRIDE 165 virtual void setNeedsCommit() OVERRIDE
160 { 166 {
161 if (!m_testStarted) 167 if (!m_testStarted)
162 return; 168 return;
163 LayerTreeHost::setNeedsCommit(); 169 LayerTreeHost::setNeedsCommit();
164 } 170 }
165 171
166 virtual void DidActivateAnimationController(cc::LayerAnimationController* co ntroller) OVERRIDE
167 {
168 LayerTreeHost::DidActivateAnimationController(controller);
169 m_testHooks->didAddAnimation();
170 }
171
172 void setTestStarted(bool started) { m_testStarted = started; } 172 void setTestStarted(bool started) { m_testStarted = started; }
173 173
174 virtual void didDeferCommit() OVERRIDE 174 virtual void didDeferCommit() OVERRIDE
175 { 175 {
176 m_testHooks->didDeferCommit(); 176 m_testHooks->didDeferCommit();
177 } 177 }
178 178
179 private: 179 private:
180 MockLayerTreeHost(TestHooks* testHooks, cc::LayerTreeHostClient* client, con st cc::LayerTreeSettings& settings) 180 MockLayerTreeHost(TestHooks* testHooks, cc::LayerTreeHostClient* client, con st cc::LayerTreeSettings& settings)
181 : LayerTreeHost(client, settings) 181 : LayerTreeHost(client, settings)
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 void ThreadedTest::postSetNeedsRedrawToMainThread() 328 void ThreadedTest::postSetNeedsRedrawToMainThread()
329 { 329 {
330 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchSet NeedsRedraw, base::Unretained(this))); 330 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchSet NeedsRedraw, base::Unretained(this)));
331 } 331 }
332 332
333 void ThreadedTest::postSetVisibleToMainThread(bool visible) 333 void ThreadedTest::postSetVisibleToMainThread(bool visible)
334 { 334 {
335 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchSet Visible, base::Unretained(this), visible)); 335 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchSet Visible, base::Unretained(this), visible));
336 } 336 }
337 337
338 void ThreadedTest::postDidAddAnimationToMainThread()
339 {
340 m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchDid AddAnimation, base::Unretained(this)));
341 }
342
338 void ThreadedTest::doBeginTest() 343 void ThreadedTest::doBeginTest()
339 { 344 {
340 m_client = ThreadedMockLayerTreeHostClient::create(this); 345 m_client = ThreadedMockLayerTreeHostClient::create(this);
341 346
342 scoped_refptr<Layer> rootLayer = Layer::create(); 347 scoped_refptr<Layer> rootLayer = Layer::create();
343 scoped_ptr<cc::Thread> implCCThread(NULL); 348 scoped_ptr<cc::Thread> implCCThread(NULL);
344 if (m_implThread) 349 if (m_implThread)
345 implCCThread = cc::ThreadImpl::createForDifferentThread(m_implThread->me ssage_loop_proxy()); 350 implCCThread = cc::ThreadImpl::createForDifferentThread(m_implThread->me ssage_loop_proxy());
346 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings, implCCThread.Pass()); 351 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings, implCCThread.Pass());
347 ASSERT_TRUE(m_layerTreeHost.get()); 352 ASSERT_TRUE(m_layerTreeHost.get());
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 m_layerTreeHost->setVisible(visible); 462 m_layerTreeHost->setVisible(visible);
458 } 463 }
459 464
460 void ThreadedTest::dispatchComposite() 465 void ThreadedTest::dispatchComposite()
461 { 466 {
462 m_scheduled = false; 467 m_scheduled = false;
463 if (m_layerTreeHost.get() && !m_finished) 468 if (m_layerTreeHost.get() && !m_finished)
464 m_layerTreeHost->composite(); 469 m_layerTreeHost->composite();
465 } 470 }
466 471
472 void ThreadedTest::dispatchDidAddAnimation()
473 {
474 DCHECK(!proxy() || proxy()->isMainThread());
475
476 if (m_finished)
477 return;
478
479 if (m_layerTreeHost.get())
480 m_layerTreeHost->didAddAnimation();
481 }
482
467 void ThreadedTest::runTest(bool threaded) 483 void ThreadedTest::runTest(bool threaded)
468 { 484 {
469 if (threaded) { 485 if (threaded) {
470 m_implThread.reset(new base::Thread("ThreadedTest")); 486 m_implThread.reset(new base::Thread("ThreadedTest"));
471 ASSERT_TRUE(m_implThread->Start()); 487 ASSERT_TRUE(m_implThread->Start());
472 } 488 }
473 489
474 m_mainCCThread = cc::ThreadImpl::createForCurrentThread(); 490 m_mainCCThread = cc::ThreadImpl::createForCurrentThread();
475 m_mainThreadProxy = ScopedThreadProxy::create(m_mainCCThread.get()); 491 m_mainThreadProxy = ScopedThreadProxy::create(m_mainCCThread.get());
476 492
(...skipping 12 matching lines...) Expand all
489 ASSERT_FALSE(m_layerTreeHost.get()); 505 ASSERT_FALSE(m_layerTreeHost.get());
490 m_client.reset(); 506 m_client.reset();
491 if (m_timedOut) { 507 if (m_timedOut) {
492 FAIL() << "Test timed out"; 508 FAIL() << "Test timed out";
493 return; 509 return;
494 } 510 }
495 afterTest(); 511 afterTest();
496 } 512 }
497 513
498 } // namespace cc 514 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test_common.h ('k') | cc/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698