Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl.cc |
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
| index e158759cc21ef7ac575b6bec2ffeb86aa9490a65..f87a59d0e6cda8c6fd7590236f5e6cb58cbbc3f9 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -127,77 +127,6 @@ unsigned GetMapImageTextureTarget(cc::ContextProvider* context_provider) { |
| namespace cc { |
| -class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { |
| - public: |
| - static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> Create( |
| - LayerTreeHostImpl* layer_tree_host_impl, |
| - scoped_refptr<DelayBasedTimeSource> time_source) { |
| - return make_scoped_ptr( |
| - new LayerTreeHostImplTimeSourceAdapter(layer_tree_host_impl, |
| - time_source)); |
| - } |
| - virtual ~LayerTreeHostImplTimeSourceAdapter() { |
| - time_source_->SetClient(NULL); |
| - time_source_->SetActive(false); |
| - } |
| - |
| - virtual void OnTimerTick() OVERRIDE { |
| - // In single threaded mode we attempt to simulate changing the current |
| - // thread by maintaining a fake thread id. When we switch from one |
| - // thread to another, we construct DebugScopedSetXXXThread objects that |
| - // update the thread id. This lets DCHECKS that ensure we're on the |
| - // right thread to work correctly in single threaded mode. The problem |
| - // here is that the timer tasks are run via the message loop, and when |
| - // they run, we've had no chance to construct a DebugScopedSetXXXThread |
| - // object. The result is that we report that we're running on the main |
| - // thread. In multi-threaded mode, this timer is run on the compositor |
| - // thread, so to keep this consistent in single-threaded mode, we'll |
| - // construct a DebugScopedSetImplThread object. There is no need to do |
| - // this in multi-threaded mode since the real thread id's will be |
| - // correct. In fact, setting fake thread id's interferes with the real |
| - // thread id's and causes breakage. |
| - scoped_ptr<DebugScopedSetImplThread> set_impl_thread; |
| - if (!layer_tree_host_impl_->proxy()->HasImplThread()) { |
| - set_impl_thread.reset( |
| - new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); |
| - } |
| - |
| - // TODO(enne): This should probably happen post-animate. |
| - if (layer_tree_host_impl_->pending_tree()) { |
| - layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); |
| - layer_tree_host_impl_->ManageTiles(); |
| - } |
| - |
| - layer_tree_host_impl_->Animate( |
| - layer_tree_host_impl_->CurrentFrameTimeTicks()); |
| - layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true); |
| - bool start_ready_animations = true; |
| - layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
| - layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); |
| - } |
| - |
| - void SetActive(bool active) { |
| - if (active != time_source_->Active()) |
| - time_source_->SetActive(active); |
| - } |
| - |
| - bool Active() const { return time_source_->Active(); } |
| - |
| - private: |
| - LayerTreeHostImplTimeSourceAdapter( |
| - LayerTreeHostImpl* layer_tree_host_impl, |
| - scoped_refptr<DelayBasedTimeSource> time_source) |
| - : layer_tree_host_impl_(layer_tree_host_impl), |
| - time_source_(time_source) { |
| - time_source_->SetClient(this); |
| - } |
| - |
| - LayerTreeHostImpl* layer_tree_host_impl_; |
| - scoped_refptr<DelayBasedTimeSource> time_source_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTimeSourceAdapter); |
| -}; |
| - |
| LayerTreeHostImpl::FrameData::FrameData() |
| : contains_incomplete_tile(false), has_no_damage(false) {} |
| @@ -221,7 +150,8 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
| RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| SharedBitmapManager* manager, |
| int id) |
| - : client_(client), |
| + : BaseFrameSource(0), |
| + client_(client), |
| proxy_(proxy), |
| input_handler_client_(NULL), |
| did_lock_scrolling_layer_(false), |
| @@ -344,8 +274,6 @@ void LayerTreeHostImpl::CommitComplete() { |
| ManageTiles(); |
| } else { |
| active_tree_->set_needs_update_draw_properties(); |
| - if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
| - DCHECK(active_tree_->root_layer()); |
| } |
| client_->SendManagedMemoryStats(); |
| @@ -960,28 +888,6 @@ void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { |
| input_handler_client_->MainThreadHasStoppedFlinging(); |
| } |
| -void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( |
| - bool should_background_tick) { |
| - DCHECK(proxy_->IsImplThread()); |
| - if (should_background_tick) |
| - DCHECK(active_tree_->root_layer()); |
| - |
| - bool enabled = should_background_tick && needs_animate_layers(); |
|
brianderson
2014/05/07 18:09:59
Do we need to communicate the needs_animate_layer(
mithro-old
2014/05/07 22:02:32
The needs_animate_layer is part of the question if
brianderson
2014/05/08 00:55:58
Yes.
|
| - |
| - // Lazily create the time_source adapter so that we can vary the interval for |
| - // testing. |
| - if (!time_source_client_adapter_) { |
| - time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( |
| - this, |
| - DelayBasedTimeSource::Create( |
| - LowFrequencyAnimationInterval(), |
| - proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() |
| - : proxy_->MainThreadTaskRunner())); |
| - } |
| - |
| - time_source_client_adapter_->SetActive(enabled); |
| -} |
| - |
| void LayerTreeHostImpl::DidAnimateScrollOffset() { |
| client_->SetNeedsCommitOnImplThread(); |
| client_->RenewTreePriority(); |
| @@ -1341,7 +1247,7 @@ void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| } |
| void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { |
| - client_->BeginFrame(args); |
| + SendBeginFrame(args); |
| } |
| void LayerTreeHostImpl::DidSwapBuffers() { |
| @@ -1554,11 +1460,30 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
| return true; |
| } |
| -void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { |
| +void LayerTreeHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) { |
| if (output_surface_) |
| - output_surface_->SetNeedsBeginFrame(enable); |
| + output_surface_->SetNeedsBeginFrame(needs_begin_frame); |
| else |
| - DCHECK(!enable); |
| + DCHECK(!needs_begin_frame); |
| +} |
| + |
| +void LayerTreeHostImpl::SetSink(FrameSink* sink) { |
|
brianderson
2014/05/07 18:09:59
Missing?
mithro-old
2014/05/07 23:42:28
Done.
|
| +} |
| +void LayerTreeHostImpl::SetTimeBaseAndInterval(base::TimeTicks timebase, |
| + base::TimeDelta interval) { |
| +} |
| + |
| +scoped_ptr<base::Value> LayerTreeHostImpl::FrameSourceAsValue() const { |
| + scoped_ptr<base::DictionaryValue> state = |
| + BaseFrameSource::BaseFrameSourceAsValue(); |
| + state->SetString("type", "LayerTreeHostImpl"); |
| + state->SetInteger("this", reinterpret_cast<size_t>(this)); |
| + state->SetInteger("output_surface", |
| + reinterpret_cast<size_t>(output_surface_.get())); |
| + return state.PassAs<base::Value>(); |
| +} |
| +std::string LayerTreeHostImpl::FrameSourceType() const { |
| + return "LayerTreeHostImpl"; |
| } |
| void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| @@ -1742,8 +1667,6 @@ void LayerTreeHostImpl::ActivatePendingTree() { |
| if (!tree_activation_callback_.is_null()) |
| tree_activation_callback_.Run(); |
| - if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
| - DCHECK(active_tree_->root_layer()); |
| devtools_instrumentation::DidActivateLayerTree( |
| id_, active_tree_->source_frame_number()); |
| } |
| @@ -2014,7 +1937,7 @@ bool LayerTreeHostImpl::InitializeRenderer( |
| void LayerTreeHostImpl::CommitVSyncParameters(base::TimeTicks timebase, |
| base::TimeDelta interval) { |
| - client_->CommitVSyncParameters(timebase, interval); |
| + // fsink_->UpdateTimebaseAndInterval(timebase, interval); |
| } |
| void LayerTreeHostImpl::DeferredInitialize() { |