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

Side by Side Diff: cc/trees/single_thread_proxy.cc

Issue 303543004: MacViews: views_examples_with_content_exe working! Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add files Created 6 years, 6 months 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
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/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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 DebugScopedSetImplThread impl(this); 401 DebugScopedSetImplThread impl(this);
402 if (layer_tree_host_impl_->renderer()) { 402 if (layer_tree_host_impl_->renderer()) {
403 DCHECK(!layer_tree_host_->output_surface_lost()); 403 DCHECK(!layer_tree_host_->output_surface_lost());
404 layer_tree_host_impl_->renderer()->DoNoOp(); 404 layer_tree_host_impl_->renderer()->DoNoOp();
405 } 405 }
406 } 406 }
407 } 407 }
408 408
409 bool SingleThreadProxy::ShouldComposite() const { 409 bool SingleThreadProxy::ShouldComposite() const {
410 DCHECK(Proxy::IsImplThread()); 410 DCHECK(Proxy::IsImplThread());
411 DLOG(INFO) << layer_tree_host_impl_->visible() << ", " << layer_tree_host_impl _->CanDraw();
411 return layer_tree_host_impl_->visible() && 412 return layer_tree_host_impl_->visible() &&
412 layer_tree_host_impl_->CanDraw(); 413 layer_tree_host_impl_->CanDraw();
413 } 414 }
414 415
415 void SingleThreadProxy::UpdateBackgroundAnimateTicking() { 416 void SingleThreadProxy::UpdateBackgroundAnimateTicking() {
416 DCHECK(Proxy::IsImplThread()); 417 DCHECK(Proxy::IsImplThread());
417 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( 418 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(
418 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer()); 419 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer());
419 } 420 }
420 421
421 bool SingleThreadProxy::DoComposite( 422 bool SingleThreadProxy::DoComposite(
422 base::TimeTicks frame_begin_time, 423 base::TimeTicks frame_begin_time,
423 LayerTreeHostImpl::FrameData* frame) { 424 LayerTreeHostImpl::FrameData* frame) {
425 DLOG(INFO) << "DoComposite";
424 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); 426 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite");
425 DCHECK(!layer_tree_host_->output_surface_lost()); 427 DCHECK(!layer_tree_host_->output_surface_lost());
426 428
427 bool lost_output_surface = false; 429 bool lost_output_surface = false;
428 { 430 {
429 DebugScopedSetImplThread impl(this); 431 DebugScopedSetImplThread impl(this);
430 base::AutoReset<bool> mark_inside(&inside_draw_, true); 432 base::AutoReset<bool> mark_inside(&inside_draw_, true);
431 433
432 // We guard PrepareToDraw() with CanDraw() because it always returns a valid 434 // We guard PrepareToDraw() with CanDraw() because it always returns a valid
433 // frame, so can only be used when such a frame is possible. Since 435 // frame, so can only be used when such a frame is possible. Since
434 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on 436 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
435 // CanDraw() as well. 437 // CanDraw() as well.
436 if (!ShouldComposite()) { 438 if (!ShouldComposite()) {
437 UpdateBackgroundAnimateTicking(); 439 UpdateBackgroundAnimateTicking();
440 DLOG(INFO) << "ShouldComposite = false";
438 return false; 441 return false;
439 } 442 }
440 443
441 layer_tree_host_impl_->Animate( 444 layer_tree_host_impl_->Animate(
442 layer_tree_host_impl_->CurrentFrameTimeTicks()); 445 layer_tree_host_impl_->CurrentFrameTimeTicks());
443 UpdateBackgroundAnimateTicking(); 446 UpdateBackgroundAnimateTicking();
444 447
445 if (!layer_tree_host_impl_->IsContextLost()) { 448 if (!layer_tree_host_impl_->IsContextLost()) {
446 layer_tree_host_impl_->PrepareToDraw(frame); 449 layer_tree_host_impl_->PrepareToDraw(frame);
447 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); 450 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
(...skipping 18 matching lines...) Expand all
466 void SingleThreadProxy::DidSwapFrame() { 469 void SingleThreadProxy::DidSwapFrame() {
467 if (next_frame_is_newly_committed_frame_) { 470 if (next_frame_is_newly_committed_frame_) {
468 next_frame_is_newly_committed_frame_ = false; 471 next_frame_is_newly_committed_frame_ = false;
469 layer_tree_host_->DidCommitAndDrawFrame(); 472 layer_tree_host_->DidCommitAndDrawFrame();
470 } 473 }
471 } 474 }
472 475
473 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 476 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
474 477
475 } // namespace cc 478 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | chrome/browser/ui/app_list/app_list_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698