 Chromium Code Reviews
 Chromium Code Reviews Issue 2337913003:
  Fork cc::OutputSurface into cc::CompositorFrameSink.  (Closed)
    
  
    Issue 2337913003:
  Fork cc::OutputSurface into cc::CompositorFrameSink.  (Closed) 
  | Index: cc/trees/remote_channel_impl.cc | 
| diff --git a/cc/trees/remote_channel_impl.cc b/cc/trees/remote_channel_impl.cc | 
| index b4b4d97ea3e2eeac34501d8ba750d570eedca60e..afc902f215cfd78909b5d7fa4f20e01c9ecfbcaf 100644 | 
| --- a/cc/trees/remote_channel_impl.cc | 
| +++ b/cc/trees/remote_channel_impl.cc | 
| @@ -54,10 +54,11 @@ void RemoteChannelImpl::OnProtoReceived( | 
| DCHECK(main().started); | 
| DCHECK(proto->has_to_impl()); | 
| - // If we don't have an output surface, queue the message and defer processing | 
| - // it till we initialize a new output surface. | 
| - if (main().waiting_for_output_surface_initialization) { | 
| - VLOG(1) << "Queueing message proto since output surface was released."; | 
| + // If we don't have an CompositorFrameSink, queue the message and defer | 
| + // processing | 
| 
enne (OOO)
2016/09/14 00:35:45
@_@
 | 
| + // it till we initialize a new CompositorFrameSink. | 
| + if (main().waiting_for_compositor_frame_sink_initialization) { | 
| + VLOG(1) << "Queueing message proto since CompositorFrameSink was released."; | 
| main().pending_messages.push(proto->to_impl()); | 
| } else { | 
| HandleProto(proto->to_impl()); | 
| @@ -68,7 +69,7 @@ void RemoteChannelImpl::HandleProto( | 
| const proto::CompositorMessageToImpl& proto) { | 
| DCHECK(task_runner_provider_->IsMainThread()); | 
| DCHECK(proto.has_message_type()); | 
| - DCHECK(!main().waiting_for_output_surface_initialization); | 
| + DCHECK(!main().waiting_for_compositor_frame_sink_initialization); | 
| switch (proto.message_type()) { | 
| case proto::CompositorMessageToImpl::UNKNOWN: | 
| @@ -147,29 +148,30 @@ bool RemoteChannelImpl::CommitToActiveTree() const { | 
| return false; | 
| } | 
| -void RemoteChannelImpl::SetOutputSurface(OutputSurface* output_surface) { | 
| +void RemoteChannelImpl::SetCompositorFrameSink( | 
| + CompositorFrameSink* compositor_frame_sink) { | 
| DCHECK(task_runner_provider_->IsMainThread()); | 
| ImplThreadTaskRunner()->PostTask( | 
| - FROM_HERE, base::Bind(&ProxyImpl::InitializeOutputSurfaceOnImpl, | 
| - proxy_impl_weak_ptr_, output_surface)); | 
| + FROM_HERE, base::Bind(&ProxyImpl::InitializeCompositorFrameSinkOnImpl, | 
| + proxy_impl_weak_ptr_, compositor_frame_sink)); | 
| } | 
| -void RemoteChannelImpl::ReleaseOutputSurface() { | 
| +void RemoteChannelImpl::ReleaseCompositorFrameSink() { | 
| DCHECK(task_runner_provider_->IsMainThread()); | 
| - DCHECK(!main().waiting_for_output_surface_initialization); | 
| - VLOG(1) << "Releasing Output Surface"; | 
| + DCHECK(!main().waiting_for_compositor_frame_sink_initialization); | 
| + VLOG(1) << "Releasing CompositorFrameSink"; | 
| { | 
| CompletionEvent completion; | 
| DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 
| ImplThreadTaskRunner()->PostTask( | 
| - FROM_HERE, base::Bind(&ProxyImpl::ReleaseOutputSurfaceOnImpl, | 
| + FROM_HERE, base::Bind(&ProxyImpl::ReleaseCompositorFrameSinkOnImpl, | 
| proxy_impl_weak_ptr_, &completion)); | 
| completion.Wait(); | 
| } | 
| - main().waiting_for_output_surface_initialization = true; | 
| + main().waiting_for_compositor_frame_sink_initialization = true; | 
| } | 
| void RemoteChannelImpl::SetVisible(bool visible) { | 
| @@ -194,7 +196,7 @@ void RemoteChannelImpl::SetNeedsCommit() { | 
| // allow this call since the LayerTreeHost will currently ask for a commit in | 
| // 2 cases: | 
| // 1) When it is being initialized from a protobuf for a commit. | 
| - // 2) When it loses the output surface. | 
| + // 2) When it loses the CompositorFrameSink. | 
| NOTIMPLEMENTED() << "Commits should not be requested on the client"; | 
| } | 
| @@ -319,28 +321,30 @@ void RemoteChannelImpl::DidCommitAndDrawFrame() { | 
| void RemoteChannelImpl::SetAnimationEvents( | 
| std::unique_ptr<AnimationEvents> queue) {} | 
| -void RemoteChannelImpl::DidLoseOutputSurface() { | 
| +void RemoteChannelImpl::DidLoseCompositorFrameSink() { | 
| DCHECK(task_runner_provider_->IsImplThread()); | 
| MainThreadTaskRunner()->PostTask( | 
| - FROM_HERE, base::Bind(&RemoteChannelImpl::DidLoseOutputSurfaceOnMain, | 
| - impl().remote_channel_weak_ptr)); | 
| + FROM_HERE, | 
| + base::Bind(&RemoteChannelImpl::DidLoseCompositorFrameSinkOnMain, | 
| + impl().remote_channel_weak_ptr)); | 
| } | 
| -void RemoteChannelImpl::RequestNewOutputSurface() { | 
| +void RemoteChannelImpl::RequestNewCompositorFrameSink() { | 
| DCHECK(task_runner_provider_->IsImplThread()); | 
| MainThreadTaskRunner()->PostTask( | 
| - FROM_HERE, base::Bind(&RemoteChannelImpl::RequestNewOutputSurfaceOnMain, | 
| - impl().remote_channel_weak_ptr)); | 
| + FROM_HERE, | 
| + base::Bind(&RemoteChannelImpl::RequestNewCompositorFrameSinkOnMain, | 
| + impl().remote_channel_weak_ptr)); | 
| } | 
| -void RemoteChannelImpl::DidInitializeOutputSurface(bool success) { | 
| +void RemoteChannelImpl::DidInitializeCompositorFrameSink(bool success) { | 
| DCHECK(task_runner_provider_->IsImplThread()); | 
| MainThreadTaskRunner()->PostTask( | 
| FROM_HERE, | 
| - base::Bind(&RemoteChannelImpl::DidInitializeOutputSurfaceOnMain, | 
| + base::Bind(&RemoteChannelImpl::DidInitializeCompositorFrameSinkOnMain, | 
| impl().remote_channel_weak_ptr, success)); | 
| } | 
| @@ -382,40 +386,42 @@ void RemoteChannelImpl::DidCommitAndDrawFrameOnMain() { | 
| main().layer_tree_host->DidCommitAndDrawFrame(); | 
| } | 
| -void RemoteChannelImpl::DidLoseOutputSurfaceOnMain() { | 
| +void RemoteChannelImpl::DidLoseCompositorFrameSinkOnMain() { | 
| DCHECK(task_runner_provider_->IsMainThread()); | 
| - main().layer_tree_host->DidLoseOutputSurface(); | 
| + main().layer_tree_host->DidLoseCompositorFrameSink(); | 
| } | 
| -void RemoteChannelImpl::RequestNewOutputSurfaceOnMain() { | 
| +void RemoteChannelImpl::RequestNewCompositorFrameSinkOnMain() { | 
| DCHECK(task_runner_provider_->IsMainThread()); | 
| - main().layer_tree_host->RequestNewOutputSurface(); | 
| + main().layer_tree_host->RequestNewCompositorFrameSink(); | 
| } | 
| -void RemoteChannelImpl::DidInitializeOutputSurfaceOnMain(bool success) { | 
| +void RemoteChannelImpl::DidInitializeCompositorFrameSinkOnMain(bool success) { | 
| DCHECK(task_runner_provider_->IsMainThread()); | 
| if (!success) { | 
| - main().layer_tree_host->DidFailToInitializeOutputSurface(); | 
| + main().layer_tree_host->DidFailToInitializeCompositorFrameSink(); | 
| return; | 
| } | 
| - VLOG(1) << "OutputSurface initialized successfully"; | 
| - main().layer_tree_host->DidInitializeOutputSurface(); | 
| + VLOG(1) << "CompositorFrameSink initialized successfully"; | 
| + main().layer_tree_host->DidInitializeCompositorFrameSink(); | 
| - // If we were waiting for output surface initialization, we might have queued | 
| - // some messages. Relay them now that a new output surface has been | 
| + // If we were waiting for CompositorFrameSink initialization, we might have | 
| + // queued | 
| 
enne (OOO)
2016/09/14 00:35:45
@_@
 | 
| + // some messages. Relay them now that a new CompositorFrameSink has been | 
| // initialized. | 
| - main().waiting_for_output_surface_initialization = false; | 
| + main().waiting_for_compositor_frame_sink_initialization = false; | 
| while (!main().pending_messages.empty()) { | 
| VLOG(1) << "Handling queued message"; | 
| HandleProto(main().pending_messages.front()); | 
| main().pending_messages.pop(); | 
| } | 
| - // The commit after a new output surface can early out, in which case we will | 
| + // The commit after a new CompositorFrameSink can early out, in which case we | 
| + // will | 
| 
enne (OOO)
2016/09/14 00:35:45
@_@
 | 
| // never redraw. Schedule one just to be safe. | 
| PostSetNeedsRedrawToImpl(gfx::Rect( | 
| main().layer_tree_host->GetLayerTree()->device_viewport_size())); | 
| @@ -500,7 +506,7 @@ RemoteChannelImpl::MainThreadOnly::MainThreadOnly( | 
| : layer_tree_host(layer_tree_host), | 
| remote_proto_channel(remote_proto_channel), | 
| started(false), | 
| - waiting_for_output_surface_initialization(false), | 
| + waiting_for_compositor_frame_sink_initialization(false), | 
| remote_channel_weak_factory(remote_channel_impl) { | 
| DCHECK(layer_tree_host); | 
| DCHECK(remote_proto_channel); |