| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 719 |
| 720 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { | 720 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 721 #if DCHECK_IS_ON() | 721 #if DCHECK_IS_ON() |
| 722 DCHECK(!inside_impl_frame_) | 722 DCHECK(!inside_impl_frame_) |
| 723 << "WillBeginImplFrame called while already inside an impl frame!"; | 723 << "WillBeginImplFrame called while already inside an impl frame!"; |
| 724 inside_impl_frame_ = true; | 724 inside_impl_frame_ = true; |
| 725 #endif | 725 #endif |
| 726 layer_tree_host_impl_->WillBeginImplFrame(args); | 726 layer_tree_host_impl_->WillBeginImplFrame(args); |
| 727 } | 727 } |
| 728 | 728 |
| 729 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { | 729 void SingleThreadProxy::ScheduledActionSendBeginMainFrame( |
| 730 const BeginFrameArgs& begin_frame_args) { |
| 730 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); | 731 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); |
| 731 // Although this proxy is single-threaded, it's problematic to synchronously | 732 // Although this proxy is single-threaded, it's problematic to synchronously |
| 732 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This | 733 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This |
| 733 // could cause a commit to occur in between a series of SetNeedsCommit calls | 734 // could cause a commit to occur in between a series of SetNeedsCommit calls |
| 734 // (i.e. property modifications) causing some to fall on one frame and some to | 735 // (i.e. property modifications) causing some to fall on one frame and some to |
| 735 // fall on the next. Doing it asynchronously instead matches the semantics of | 736 // fall on the next. Doing it asynchronously instead matches the semantics of |
| 736 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a | 737 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a |
| 737 // synchronous commit. | 738 // synchronous commit. |
| 738 #if DCHECK_IS_ON() | 739 #if DCHECK_IS_ON() |
| 739 DCHECK(inside_impl_frame_) | 740 DCHECK(inside_impl_frame_) |
| 740 << "BeginMainFrame should only be sent inside a BeginImplFrame"; | 741 << "BeginMainFrame should only be sent inside a BeginImplFrame"; |
| 741 #endif | 742 #endif |
| 742 const BeginFrameArgs& begin_frame_args = | |
| 743 layer_tree_host_impl_->CurrentBeginFrameArgs(); | |
| 744 | 743 |
| 745 MainThreadTaskRunner()->PostTask( | 744 MainThreadTaskRunner()->PostTask( |
| 746 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame, | 745 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame, |
| 747 weak_factory_.GetWeakPtr(), begin_frame_args)); | 746 weak_factory_.GetWeakPtr(), begin_frame_args)); |
| 748 } | 747 } |
| 749 | 748 |
| 750 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { | 749 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { |
| 751 layer_tree_host_->BeginMainFrameNotExpectedSoon(); | 750 layer_tree_host_->BeginMainFrameNotExpectedSoon(); |
| 752 } | 751 } |
| 753 | 752 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 << "DidFinishImplFrame called while not inside an impl frame!"; | 887 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 889 inside_impl_frame_ = false; | 888 inside_impl_frame_ = false; |
| 890 #endif | 889 #endif |
| 891 } | 890 } |
| 892 | 891 |
| 893 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 892 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 894 layer_tree_host_->SendBeginFramesToChildren(args); | 893 layer_tree_host_->SendBeginFramesToChildren(args); |
| 895 } | 894 } |
| 896 | 895 |
| 897 } // namespace cc | 896 } // namespace cc |
| OLD | NEW |