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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 commit_requested_ = true; | 242 commit_requested_ = true; |
243 DebugScopedSetImplThread impl(task_runner_provider_); | 243 DebugScopedSetImplThread impl(task_runner_provider_); |
244 if (scheduler_on_impl_thread_) | 244 if (scheduler_on_impl_thread_) |
245 scheduler_on_impl_thread_->SetNeedsBeginMainFrame(); | 245 scheduler_on_impl_thread_->SetNeedsBeginMainFrame(); |
246 } | 246 } |
247 | 247 |
248 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { | 248 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
249 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); | 249 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); |
250 DCHECK(task_runner_provider_->IsMainThread()); | 250 DCHECK(task_runner_provider_->IsMainThread()); |
251 DebugScopedSetImplThread impl(task_runner_provider_); | 251 DebugScopedSetImplThread impl(task_runner_provider_); |
252 client_->RequestScheduleComposite(); | 252 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
253 SetNeedsRedrawRectOnImplThread(damage_rect); | 253 SetNeedsRedrawOnImplThread(); |
254 } | 254 } |
255 | 255 |
256 void SingleThreadProxy::SetNextCommitWaitsForActivation() { | 256 void SingleThreadProxy::SetNextCommitWaitsForActivation() { |
257 // Activation always forced in commit, so nothing to do. | 257 // Activation always forced in commit, so nothing to do. |
258 DCHECK(task_runner_provider_->IsMainThread()); | 258 DCHECK(task_runner_provider_->IsMainThread()); |
259 } | 259 } |
260 | 260 |
261 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { | 261 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { |
262 DCHECK(task_runner_provider_->IsMainThread()); | 262 DCHECK(task_runner_provider_->IsMainThread()); |
263 // Deferring commits only makes sense if there's a scheduler. | 263 // Deferring commits only makes sense if there's a scheduler. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 if (scheduler_on_impl_thread_) | 349 if (scheduler_on_impl_thread_) |
350 scheduler_on_impl_thread_->SetNeedsOneBeginImplFrame(); | 350 scheduler_on_impl_thread_->SetNeedsOneBeginImplFrame(); |
351 } | 351 } |
352 | 352 |
353 void SingleThreadProxy::SetNeedsPrepareTilesOnImplThread() { | 353 void SingleThreadProxy::SetNeedsPrepareTilesOnImplThread() { |
354 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsPrepareTilesOnImplThread"); | 354 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsPrepareTilesOnImplThread"); |
355 if (scheduler_on_impl_thread_) | 355 if (scheduler_on_impl_thread_) |
356 scheduler_on_impl_thread_->SetNeedsPrepareTiles(); | 356 scheduler_on_impl_thread_->SetNeedsPrepareTiles(); |
357 } | 357 } |
358 | 358 |
359 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( | |
360 const gfx::Rect& damage_rect) { | |
361 layer_tree_host_impl_->SetViewportDamage(damage_rect); | |
362 SetNeedsRedrawOnImplThread(); | |
363 } | |
364 | |
365 void SingleThreadProxy::SetNeedsCommitOnImplThread() { | 359 void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
366 client_->RequestScheduleComposite(); | 360 client_->RequestScheduleComposite(); |
367 if (scheduler_on_impl_thread_) | 361 if (scheduler_on_impl_thread_) |
368 scheduler_on_impl_thread_->SetNeedsBeginMainFrame(); | 362 scheduler_on_impl_thread_->SetNeedsBeginMainFrame(); |
369 } | 363 } |
370 | 364 |
371 void SingleThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { | 365 void SingleThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { |
372 TRACE_EVENT1("cc", "SingleThreadProxy::SetVideoNeedsBeginFrames", | 366 TRACE_EVENT1("cc", "SingleThreadProxy::SetVideoNeedsBeginFrames", |
373 "needs_begin_frames", needs_begin_frames); | 367 "needs_begin_frames", needs_begin_frames); |
374 // In tests the layer tree is destroyed after the scheduler is. | 368 // In tests the layer tree is destroyed after the scheduler is. |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 void SingleThreadProxy::DidFinishImplFrame() { | 759 void SingleThreadProxy::DidFinishImplFrame() { |
766 layer_tree_host_impl_->DidFinishImplFrame(); | 760 layer_tree_host_impl_->DidFinishImplFrame(); |
767 #if DCHECK_IS_ON() | 761 #if DCHECK_IS_ON() |
768 DCHECK(inside_impl_frame_) | 762 DCHECK(inside_impl_frame_) |
769 << "DidFinishImplFrame called while not inside an impl frame!"; | 763 << "DidFinishImplFrame called while not inside an impl frame!"; |
770 inside_impl_frame_ = false; | 764 inside_impl_frame_ = false; |
771 #endif | 765 #endif |
772 } | 766 } |
773 | 767 |
774 } // namespace cc | 768 } // namespace cc |
OLD | NEW |