| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/core/compositor/blimp_compositor.h" | 5 #include "blimp/client/core/compositor/blimp_compositor.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 DCHECK(message->has_to_impl()); | 131 DCHECK(message->has_to_impl()); |
| 132 const cc::proto::CompositorMessageToImpl& to_impl_proto = message->to_impl(); | 132 const cc::proto::CompositorMessageToImpl& to_impl_proto = message->to_impl(); |
| 133 | 133 |
| 134 DCHECK(to_impl_proto.has_message_type()); | 134 DCHECK(to_impl_proto.has_message_type()); |
| 135 switch (to_impl_proto.message_type()) { | 135 switch (to_impl_proto.message_type()) { |
| 136 case cc::proto::CompositorMessageToImpl::UNKNOWN: | 136 case cc::proto::CompositorMessageToImpl::UNKNOWN: |
| 137 NOTIMPLEMENTED() << "Ignoring message of UNKNOWN type"; | 137 NOTIMPLEMENTED() << "Ignoring message of UNKNOWN type"; |
| 138 break; | 138 break; |
| 139 case cc::proto::CompositorMessageToImpl::INITIALIZE_IMPL: | 139 case cc::proto::CompositorMessageToImpl::INITIALIZE_IMPL: |
| 140 DCHECK(!host_); | 140 DCHECK(!host_); |
| 141 DCHECK(to_impl_proto.has_initialize_impl_message()); | |
| 142 | 141 |
| 143 // Create the remote client LayerTreeHost for the compositor. | 142 // Create the remote client LayerTreeHost for the compositor. |
| 144 CreateLayerTreeHost(to_impl_proto.initialize_impl_message()); | 143 CreateLayerTreeHost(); |
| 145 break; | 144 break; |
| 146 case cc::proto::CompositorMessageToImpl::CLOSE_IMPL: | 145 case cc::proto::CompositorMessageToImpl::CLOSE_IMPL: |
| 147 DCHECK(host_); | 146 DCHECK(host_); |
| 148 | 147 |
| 149 // Destroy the remote client LayerTreeHost for the compositor. | 148 // Destroy the remote client LayerTreeHost for the compositor. |
| 150 DestroyLayerTreeHost(); | 149 DestroyLayerTreeHost(); |
| 151 break; | 150 break; |
| 152 default: | 151 default: |
| 153 // We should have a receiver if we're getting compositor messages that | 152 // We should have a receiver if we're getting compositor messages that |
| 154 // are not INITIALIZE_IMPL or CLOSE_IMPL. | 153 // are not INITIALIZE_IMPL or CLOSE_IMPL. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void BlimpCompositor::DestroyDelegatedContent() { | 258 void BlimpCompositor::DestroyDelegatedContent() { |
| 260 if (surface_id_.is_null()) | 259 if (surface_id_.is_null()) |
| 261 return; | 260 return; |
| 262 | 261 |
| 263 // Remove any references for the surface layer that uses this |surface_id_|. | 262 // Remove any references for the surface layer that uses this |surface_id_|. |
| 264 layer_->RemoveAllChildren(); | 263 layer_->RemoveAllChildren(); |
| 265 surface_factory_->Destroy(surface_id_); | 264 surface_factory_->Destroy(surface_id_); |
| 266 surface_id_ = cc::SurfaceId(); | 265 surface_id_ = cc::SurfaceId(); |
| 267 } | 266 } |
| 268 | 267 |
| 269 void BlimpCompositor::CreateLayerTreeHost( | 268 void BlimpCompositor::CreateLayerTreeHost() { |
| 270 const cc::proto::InitializeImpl& initialize_message) { | |
| 271 DCHECK(!host_); | 269 DCHECK(!host_); |
| 272 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; | 270 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; |
| 273 | 271 |
| 274 // Create the LayerTreeHost | 272 // Create the LayerTreeHost |
| 275 cc::LayerTreeHost::InitParams params; | 273 cc::LayerTreeHost::InitParams params; |
| 276 params.client = this; | 274 params.client = this; |
| 277 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); | 275 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); |
| 278 params.gpu_memory_buffer_manager = | 276 params.gpu_memory_buffer_manager = |
| 279 GetEmbedderDeps()->GetGpuMemoryBufferManager(); | 277 GetEmbedderDeps()->GetGpuMemoryBufferManager(); |
| 280 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 278 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // Cancel any outstanding OutputSurface requests. That way if we get an async | 322 // Cancel any outstanding OutputSurface requests. That way if we get an async |
| 325 // callback related to the old request we know to drop it. | 323 // callback related to the old request we know to drop it. |
| 326 output_surface_request_pending_ = false; | 324 output_surface_request_pending_ = false; |
| 327 | 325 |
| 328 // Make sure we don't have a receiver at this point. | 326 // Make sure we don't have a receiver at this point. |
| 329 DCHECK(!remote_proto_channel_receiver_); | 327 DCHECK(!remote_proto_channel_receiver_); |
| 330 } | 328 } |
| 331 | 329 |
| 332 } // namespace client | 330 } // namespace client |
| 333 } // namespace blimp | 331 } // namespace blimp |
| OLD | NEW |