| OLD | NEW |
| 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.h" | 5 #include "cc/test/layer_tree_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 LayerTreeTest::LayerTreeTest() | 289 LayerTreeTest::LayerTreeTest() |
| 290 : beginning_(false), | 290 : beginning_(false), |
| 291 end_when_begin_returns_(false), | 291 end_when_begin_returns_(false), |
| 292 timed_out_(false), | 292 timed_out_(false), |
| 293 scheduled_(false), | 293 scheduled_(false), |
| 294 schedule_when_set_visible_true_(false), | 294 schedule_when_set_visible_true_(false), |
| 295 started_(false), | 295 started_(false), |
| 296 ended_(false), | 296 ended_(false), |
| 297 delegating_renderer_(false), | 297 delegating_renderer_(false), |
| 298 timeout_seconds_(0), | 298 timeout_seconds_(0), |
| 299 impl_thread_(NULL), | |
| 300 weak_factory_(this) { | 299 weak_factory_(this) { |
| 301 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); | 300 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); |
| 302 | 301 |
| 303 // Tests should timeout quickly unless --cc-layer-tree-test-no-timeout was | 302 // Tests should timeout quickly unless --cc-layer-tree-test-no-timeout was |
| 304 // specified (for running in a debugger). | 303 // specified (for running in a debugger). |
| 305 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 304 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 306 if (!command_line->HasSwitch(switches::kCCLayerTreeTestNoTimeout)) | 305 if (!command_line->HasSwitch(switches::kCCLayerTreeTestNoTimeout)) |
| 307 timeout_seconds_ = 5; | 306 timeout_seconds_ = 5; |
| 308 } | 307 } |
| 309 | 308 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) { | 369 void LayerTreeTest::PostSetVisibleToMainThread(bool visible) { |
| 371 proxy()->MainThread()->PostTask( | 370 proxy()->MainThread()->PostTask( |
| 372 base::Bind(&LayerTreeTest::DispatchSetVisible, | 371 base::Bind(&LayerTreeTest::DispatchSetVisible, |
| 373 main_thread_weak_ptr_, | 372 main_thread_weak_ptr_, |
| 374 visible)); | 373 visible)); |
| 375 } | 374 } |
| 376 | 375 |
| 377 void LayerTreeTest::DoBeginTest() { | 376 void LayerTreeTest::DoBeginTest() { |
| 378 client_ = LayerTreeHostClientForTesting::Create(this); | 377 client_ = LayerTreeHostClientForTesting::Create(this); |
| 379 | 378 |
| 380 scoped_ptr<cc::Thread> impl_ccthread(NULL); | 379 scoped_ptr<cc::Thread> impl_ccthread; |
| 381 if (impl_thread_) { | 380 if (impl_thread_) { |
| 382 impl_ccthread = cc::ThreadImpl::CreateForDifferentThread( | 381 impl_ccthread = cc::ThreadImpl::CreateForDifferentThread( |
| 383 impl_thread_->message_loop_proxy()); | 382 impl_thread_->message_loop_proxy()); |
| 384 } | 383 } |
| 385 layer_tree_host_ = LayerTreeHostForTesting::Create(this, | 384 layer_tree_host_ = LayerTreeHostForTesting::Create(this, |
| 386 client_.get(), | 385 client_.get(), |
| 387 settings_, | 386 settings_, |
| 388 impl_ccthread.Pass()); | 387 impl_ccthread.Pass()); |
| 389 ASSERT_TRUE(layer_tree_host_); | 388 ASSERT_TRUE(layer_tree_host_); |
| 390 | 389 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 | 598 |
| 600 scoped_refptr<cc::ContextProvider> LayerTreeTest:: | 599 scoped_refptr<cc::ContextProvider> LayerTreeTest:: |
| 601 OffscreenContextProviderForCompositorThread() { | 600 OffscreenContextProviderForCompositorThread() { |
| 602 if (!compositor_thread_contexts_.get() || | 601 if (!compositor_thread_contexts_.get() || |
| 603 compositor_thread_contexts_->DestroyedOnMainThread()) | 602 compositor_thread_contexts_->DestroyedOnMainThread()) |
| 604 compositor_thread_contexts_ = FakeContextProvider::Create(); | 603 compositor_thread_contexts_ = FakeContextProvider::Create(); |
| 605 return compositor_thread_contexts_; | 604 return compositor_thread_contexts_; |
| 606 } | 605 } |
| 607 | 606 |
| 608 } // namespace cc | 607 } // namespace cc |
| OLD | NEW |