| 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/base/thread.h" | 9 #include "cc/base/thread.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 252 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
| 253 DebugScopedSetImplThread impl(this); | 253 DebugScopedSetImplThread impl(this); |
| 254 | 254 |
| 255 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 255 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
| 256 layer_tree_host_impl_->resource_provider()); | 256 layer_tree_host_impl_->resource_provider()); |
| 257 layer_tree_host_impl_.reset(); | 257 layer_tree_host_impl_.reset(); |
| 258 } | 258 } |
| 259 layer_tree_host_ = NULL; | 259 layer_tree_host_ = NULL; |
| 260 } | 260 } |
| 261 | 261 |
| 262 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 263 DCHECK(Proxy::IsImplThread()); |
| 264 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(); |
| 265 } |
| 266 |
| 262 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { | 267 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { |
| 263 layer_tree_host_->ScheduleComposite(); | 268 layer_tree_host_->ScheduleComposite(); |
| 264 } | 269 } |
| 265 | 270 |
| 266 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { | 271 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { |
| 267 // Impl-side painting only. | 272 // Impl-side painting only. |
| 268 NOTREACHED(); | 273 NOTREACHED(); |
| 269 } | 274 } |
| 270 | 275 |
| 271 void SingleThreadProxy::SetNeedsCommitOnImplThread() { | 276 void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 scoped_refptr<cc::ContextProvider> offscreen_context_provider, | 393 scoped_refptr<cc::ContextProvider> offscreen_context_provider, |
| 389 base::TimeTicks frame_begin_time) { | 394 base::TimeTicks frame_begin_time) { |
| 390 DCHECK(!output_surface_lost_); | 395 DCHECK(!output_surface_lost_); |
| 391 { | 396 { |
| 392 DebugScopedSetImplThread impl(this); | 397 DebugScopedSetImplThread impl(this); |
| 393 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 398 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
| 394 | 399 |
| 395 layer_tree_host_impl_->resource_provider()-> | 400 layer_tree_host_impl_->resource_provider()-> |
| 396 set_offscreen_context_provider(offscreen_context_provider); | 401 set_offscreen_context_provider(offscreen_context_provider); |
| 397 | 402 |
| 398 if (!layer_tree_host_impl_->visible()) | 403 if (!layer_tree_host_impl_->visible()) { |
| 404 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(); |
| 399 return false; | 405 return false; |
| 406 } |
| 407 |
| 408 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
| 409 // frame, so can only be used when such a frame is possible. Since |
| 410 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
| 411 // CanDraw() as well. |
| 412 if (!layer_tree_host_impl_->CanDraw()) { |
| 413 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(); |
| 414 return false; |
| 415 } |
| 400 | 416 |
| 401 layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now()); | 417 layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now()); |
| 402 | 418 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(); |
| 403 // We guard prepareToDraw() with canDraw() because it always returns a valid | |
| 404 // frame, so can only be used when such a frame is possible. Since | |
| 405 // drawLayers() depends on the result of prepareToDraw(), it is guarded on | |
| 406 // canDraw() as well. | |
| 407 if (!layer_tree_host_impl_->CanDraw()) | |
| 408 return false; | |
| 409 | 419 |
| 410 LayerTreeHostImpl::FrameData frame; | 420 LayerTreeHostImpl::FrameData frame; |
| 411 layer_tree_host_impl_->PrepareToDraw(&frame); | 421 layer_tree_host_impl_->PrepareToDraw(&frame); |
| 412 layer_tree_host_impl_->DrawLayers(&frame, frame_begin_time); | 422 layer_tree_host_impl_->DrawLayers(&frame, frame_begin_time); |
| 413 layer_tree_host_impl_->DidDrawAllLayers(frame); | 423 layer_tree_host_impl_->DidDrawAllLayers(frame); |
| 414 output_surface_lost_ = layer_tree_host_impl_->IsContextLost(); | 424 output_surface_lost_ = layer_tree_host_impl_->IsContextLost(); |
| 415 | 425 |
| 426 bool start_ready_animations = true; |
| 427 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
| 428 |
| 416 layer_tree_host_impl_->BeginNextFrame(); | 429 layer_tree_host_impl_->BeginNextFrame(); |
| 417 } | 430 } |
| 418 | 431 |
| 419 if (output_surface_lost_) { | 432 if (output_surface_lost_) { |
| 420 cc::ContextProvider* offscreen_contexts = layer_tree_host_impl_-> | 433 cc::ContextProvider* offscreen_contexts = layer_tree_host_impl_-> |
| 421 resource_provider()->offscreen_context_provider(); | 434 resource_provider()->offscreen_context_provider(); |
| 422 if (offscreen_contexts) | 435 if (offscreen_contexts) |
| 423 offscreen_contexts->VerifyContexts(); | 436 offscreen_contexts->VerifyContexts(); |
| 424 layer_tree_host_->DidLoseOutputSurface(); | 437 layer_tree_host_->DidLoseOutputSurface(); |
| 425 return false; | 438 return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 437 | 450 |
| 438 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 451 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
| 439 | 452 |
| 440 skia::RefPtr<SkPicture> SingleThreadProxy::CapturePicture() { | 453 skia::RefPtr<SkPicture> SingleThreadProxy::CapturePicture() { |
| 441 // Impl-side painting only. | 454 // Impl-side painting only. |
| 442 NOTREACHED(); | 455 NOTREACHED(); |
| 443 return skia::RefPtr<SkPicture>(); | 456 return skia::RefPtr<SkPicture>(); |
| 444 } | 457 } |
| 445 | 458 |
| 446 } // namespace cc | 459 } // namespace cc |
| OLD | NEW |