| 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/trees/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 layer_tree_host_->WillCommit(); | 185 layer_tree_host_->WillCommit(); |
| 186 | 186 |
| 187 // Commit immediately. | 187 // Commit immediately. |
| 188 { | 188 { |
| 189 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 189 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 190 DebugScopedSetImplThread impl(this); | 190 DebugScopedSetImplThread impl(this); |
| 191 | 191 |
| 192 // This CapturePostTasks should be destroyed before CommitComplete() is | 192 // This CapturePostTasks should be destroyed before CommitComplete() is |
| 193 // called since that goes out to the embedder, and we want the embedder | 193 // called since that goes out to the embedder, and we want the embedder |
| 194 // to receive its callbacks before that. | 194 // to receive its callbacks before that. |
| 195 BlockingTaskRunner::CapturePostTasks blocked; | 195 BlockingTaskRunner::CapturePostTasks blocked( |
| 196 blocking_main_thread_task_runner()); |
| 196 | 197 |
| 197 layer_tree_host_impl_->BeginCommit(); | 198 layer_tree_host_impl_->BeginCommit(); |
| 198 | 199 |
| 199 if (PrioritizedResourceManager* contents_texture_manager = | 200 if (PrioritizedResourceManager* contents_texture_manager = |
| 200 layer_tree_host_->contents_texture_manager()) { | 201 layer_tree_host_->contents_texture_manager()) { |
| 201 contents_texture_manager->PushTexturePrioritiesToBackings(); | 202 contents_texture_manager->PushTexturePrioritiesToBackings(); |
| 202 } | 203 } |
| 203 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 204 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
| 204 | 205 |
| 205 scoped_ptr<ResourceUpdateController> update_controller = | 206 scoped_ptr<ResourceUpdateController> update_controller = |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return std::numeric_limits<size_t>::max(); | 302 return std::numeric_limits<size_t>::max(); |
| 302 } | 303 } |
| 303 | 304 |
| 304 void SingleThreadProxy::Stop() { | 305 void SingleThreadProxy::Stop() { |
| 305 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); | 306 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); |
| 306 DCHECK(Proxy::IsMainThread()); | 307 DCHECK(Proxy::IsMainThread()); |
| 307 { | 308 { |
| 308 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 309 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 309 DebugScopedSetImplThread impl(this); | 310 DebugScopedSetImplThread impl(this); |
| 310 | 311 |
| 311 BlockingTaskRunner::CapturePostTasks blocked; | 312 BlockingTaskRunner::CapturePostTasks blocked( |
| 313 blocking_main_thread_task_runner()); |
| 312 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 314 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
| 313 layer_tree_host_impl_->resource_provider()); | 315 layer_tree_host_impl_->resource_provider()); |
| 314 scheduler_on_impl_thread_.reset(); | 316 scheduler_on_impl_thread_.reset(); |
| 315 layer_tree_host_impl_.reset(); | 317 layer_tree_host_impl_.reset(); |
| 316 } | 318 } |
| 317 layer_tree_host_ = NULL; | 319 layer_tree_host_ = NULL; |
| 318 } | 320 } |
| 319 | 321 |
| 320 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 322 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 321 TRACE_EVENT1( | 323 TRACE_EVENT1( |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // This CapturePostTasks should be destroyed before | 529 // This CapturePostTasks should be destroyed before |
| 528 // DidCommitAndDrawFrame() is called since that goes out to the | 530 // DidCommitAndDrawFrame() is called since that goes out to the |
| 529 // embedder, | 531 // embedder, |
| 530 // and we want the embedder to receive its callbacks before that. | 532 // and we want the embedder to receive its callbacks before that. |
| 531 // NOTE: This maintains consistent ordering with the ThreadProxy since | 533 // NOTE: This maintains consistent ordering with the ThreadProxy since |
| 532 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread | 534 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread |
| 533 // there as the main thread is not blocked, so any posted tasks inside | 535 // there as the main thread is not blocked, so any posted tasks inside |
| 534 // the swap buffers will execute first. | 536 // the swap buffers will execute first. |
| 535 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 537 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 536 | 538 |
| 537 BlockingTaskRunner::CapturePostTasks blocked; | 539 BlockingTaskRunner::CapturePostTasks blocked( |
| 540 blocking_main_thread_task_runner()); |
| 538 layer_tree_host_impl_->SwapBuffers(*frame); | 541 layer_tree_host_impl_->SwapBuffers(*frame); |
| 539 } | 542 } |
| 540 DidCommitAndDrawFrame(); | 543 DidCommitAndDrawFrame(); |
| 541 | 544 |
| 542 return DRAW_SUCCESS; | 545 return DRAW_SUCCESS; |
| 543 } | 546 } |
| 544 | 547 |
| 545 void SingleThreadProxy::DidCommitAndDrawFrame() { | 548 void SingleThreadProxy::DidCommitAndDrawFrame() { |
| 546 if (next_frame_is_newly_committed_frame_) { | 549 if (next_frame_is_newly_committed_frame_) { |
| 547 DebugScopedSetMainThread main(this); | 550 DebugScopedSetMainThread main(this); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 689 |
| 687 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 690 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
| 688 return timing_history_.CommitToActivateDurationEstimate(); | 691 return timing_history_.CommitToActivateDurationEstimate(); |
| 689 } | 692 } |
| 690 | 693 |
| 691 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 694 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 692 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 695 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 693 } | 696 } |
| 694 | 697 |
| 695 } // namespace cc | 698 } // namespace cc |
| OLD | NEW |