Chromium Code Reviews| 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/feature/compositor/blimp_compositor.h" | 5 #include "blimp/client/feature/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" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/threading/thread_local.h" | 13 #include "base/threading/thread_local.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | |
| 16 #include "blimp/client/core/compositor/delegated_output_surface.h" | 17 #include "blimp/client/core/compositor/delegated_output_surface.h" |
| 17 #include "blimp/client/feature/compositor/blimp_context_provider.h" | 18 #include "blimp/client/public/compositor/compositor_dependencies.h" |
| 18 #include "blimp/net/blimp_stats.h" | 19 #include "blimp/net/blimp_stats.h" |
| 19 #include "cc/animation/animation_host.h" | 20 #include "cc/animation/animation_host.h" |
| 20 #include "cc/layers/layer.h" | 21 #include "cc/layers/layer.h" |
| 21 #include "cc/layers/surface_layer.h" | 22 #include "cc/layers/surface_layer.h" |
| 22 #include "cc/output/output_surface.h" | 23 #include "cc/output/output_surface.h" |
| 23 #include "cc/proto/compositor_message.pb.h" | 24 #include "cc/proto/compositor_message.pb.h" |
| 24 #include "cc/surfaces/surface.h" | 25 #include "cc/surfaces/surface.h" |
| 25 #include "cc/surfaces/surface_factory.h" | 26 #include "cc/surfaces/surface_factory.h" |
| 26 #include "cc/surfaces/surface_id_allocator.h" | 27 #include "cc/surfaces/surface_id_allocator.h" |
| 27 #include "cc/surfaces/surface_manager.h" | 28 #include "cc/surfaces/surface_manager.h" |
| 28 #include "cc/trees/layer_tree_host.h" | 29 #include "cc/trees/layer_tree_host.h" |
| 30 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | |
| 29 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
| 30 #include "ui/gl/gl_surface.h" | 32 #include "ui/gl/gl_surface.h" |
| 31 | 33 |
| 32 namespace blimp { | 34 namespace blimp { |
| 33 namespace client { | 35 namespace client { |
| 34 | 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 void SatisfyCallback(cc::SurfaceManager* manager, | 39 void SatisfyCallback(cc::SurfaceManager* manager, |
| 38 const cc::SurfaceSequence& sequence) { | 40 const cc::SurfaceSequence& sequence) { |
| 39 std::vector<uint32_t> sequences; | 41 std::vector<uint32_t> sequences; |
| 40 sequences.push_back(sequence.sequence); | 42 sequences.push_back(sequence.sequence); |
| 41 manager->DidSatisfySequences(sequence.client_id, &sequences); | 43 manager->DidSatisfySequences(sequence.client_id, &sequences); |
| 42 } | 44 } |
| 43 | 45 |
| 44 void RequireCallback(cc::SurfaceManager* manager, | 46 void RequireCallback(cc::SurfaceManager* manager, |
| 45 const cc::SurfaceId& id, | 47 const cc::SurfaceId& id, |
| 46 const cc::SurfaceSequence& sequence) { | 48 const cc::SurfaceSequence& sequence) { |
| 47 cc::Surface* surface = manager->GetSurfaceForId(id); | 49 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 48 if (!surface) { | 50 if (!surface) { |
| 49 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 51 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 50 return; | 52 return; |
| 51 } | 53 } |
| 52 surface->AddDestructionDependency(sequence); | 54 surface->AddDestructionDependency(sequence); |
| 53 } | 55 } |
| 54 | 56 |
| 55 } // namespace | 57 } // namespace |
| 56 | 58 |
| 57 BlimpCompositor::BlimpCompositor(int render_widget_id, | 59 BlimpCompositor::BlimpCompositor( |
| 58 cc::SurfaceManager* surface_manager, | 60 int render_widget_id, |
| 59 uint32_t surface_client_id, | 61 BlimpCompositorDependencies* compositor_dependencies, |
| 60 BlimpCompositorClient* client) | 62 BlimpCompositorClient* client) |
| 61 : render_widget_id_(render_widget_id), | 63 : render_widget_id_(render_widget_id), |
| 62 client_(client), | 64 client_(client), |
| 65 compositor_dependencies_(compositor_dependencies), | |
| 63 host_should_be_visible_(false), | 66 host_should_be_visible_(false), |
| 64 surface_manager_(surface_manager), | |
| 65 surface_id_allocator_( | |
| 66 base::MakeUnique<cc::SurfaceIdAllocator>(surface_client_id)), | |
| 67 layer_(cc::Layer::Create()), | 67 layer_(cc::Layer::Create()), |
| 68 remote_proto_channel_receiver_(nullptr), | 68 remote_proto_channel_receiver_(nullptr), |
| 69 weak_ptr_factory_(this) { | 69 weak_ptr_factory_(this) { |
| 70 DCHECK(thread_checker_.CalledOnValidThread()); | 70 DCHECK(thread_checker_.CalledOnValidThread()); |
| 71 surface_manager_->RegisterSurfaceClientId(surface_id_allocator_->client_id()); | 71 |
| 72 surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>( | |
| 73 GetEmbedderDeps()->AllocateSurfaceId()); | |
| 74 GetEmbedderDeps()->GetSurfaceManager()->RegisterSurfaceClientId( | |
| 75 surface_id_allocator_->client_id()); | |
| 72 } | 76 } |
| 73 | 77 |
| 74 BlimpCompositor::~BlimpCompositor() { | 78 BlimpCompositor::~BlimpCompositor() { |
| 75 DCHECK(thread_checker_.CalledOnValidThread()); | 79 DCHECK(thread_checker_.CalledOnValidThread()); |
| 76 | 80 |
| 77 if (host_) | 81 if (host_) |
| 78 DestroyLayerTreeHost(); | 82 DestroyLayerTreeHost(); |
| 79 surface_manager_->InvalidateSurfaceClientId( | 83 |
| 84 GetEmbedderDeps()->GetSurfaceManager()->InvalidateSurfaceClientId( | |
| 80 surface_id_allocator_->client_id()); | 85 surface_id_allocator_->client_id()); |
| 81 } | 86 } |
| 82 | 87 |
| 83 void BlimpCompositor::SetVisible(bool visible) { | 88 void BlimpCompositor::SetVisible(bool visible) { |
| 84 host_should_be_visible_ = visible; | 89 host_should_be_visible_ = visible; |
| 85 if (host_) | 90 if (host_) |
| 86 host_->SetVisible(host_should_be_visible_); | 91 host_->SetVisible(host_should_be_visible_); |
| 87 } | 92 } |
| 88 | 93 |
| 89 bool BlimpCompositor::OnTouchEvent(const ui::MotionEvent& motion_event) { | 94 bool BlimpCompositor::OnTouchEvent(const ui::MotionEvent& motion_event) { |
| 90 if (input_manager_) | 95 if (input_manager_) |
| 91 return input_manager_->OnTouchEvent(motion_event); | 96 return input_manager_->OnTouchEvent(motion_event); |
| 92 return false; | 97 return false; |
| 93 } | 98 } |
| 94 | 99 |
| 95 void BlimpCompositor::RequestNewOutputSurface() { | 100 void BlimpCompositor::RequestNewOutputSurface() { |
| 96 DCHECK(!surface_factory_) | 101 GetEmbedderDeps()->GetContextProvider( |
|
Khushal
2016/08/24 23:22:46
Can we keep the DCHECK here itself. The compositor
David Trainor- moved to gerrit
2016/08/26 17:15:54
Done.
| |
| 97 << "Any connection to the old output surface should have been destroyed"; | 102 base::Bind(&BlimpCompositor::OnContextProviderCreated, |
| 98 | 103 weak_ptr_factory_.GetWeakPtr())); |
| 99 scoped_refptr<BlimpContextProvider> compositor_context_provider = | |
| 100 BlimpContextProvider::Create(gfx::kNullAcceleratedWidget, | |
| 101 client_->GetGpuMemoryBufferManager()); | |
| 102 | |
| 103 // TODO(khushalsagar): Make a worker context and bind it to the current | |
| 104 // thread: | |
| 105 // Worker context is bound to the main thread in RenderThreadImpl. One day | |
| 106 // that will change and then this will have to be removed. | |
| 107 // worker_context_provider->BindToCurrentThread(); | |
| 108 | |
| 109 std::unique_ptr<DelegatedOutputSurface> delegated_output_surface = | |
| 110 base::MakeUnique<DelegatedOutputSurface>( | |
| 111 std::move(compositor_context_provider), nullptr, | |
| 112 base::ThreadTaskRunnerHandle::Get(), weak_ptr_factory_.GetWeakPtr()); | |
| 113 | |
| 114 host_->SetOutputSurface(std::move(delegated_output_surface)); | |
| 115 } | 104 } |
| 116 | 105 |
| 117 void BlimpCompositor::DidCommitAndDrawFrame() { | 106 void BlimpCompositor::DidCommitAndDrawFrame() { |
| 118 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); | 107 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); |
| 119 } | 108 } |
| 120 | 109 |
| 121 void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) { | 110 void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) { |
| 122 remote_proto_channel_receiver_ = receiver; | 111 remote_proto_channel_receiver_ = receiver; |
| 123 } | 112 } |
| 124 | 113 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 152 DestroyLayerTreeHost(); | 141 DestroyLayerTreeHost(); |
| 153 break; | 142 break; |
| 154 default: | 143 default: |
| 155 // We should have a receiver if we're getting compositor messages that | 144 // We should have a receiver if we're getting compositor messages that |
| 156 // are not INITIALIZE_IMPL or CLOSE_IMPL. | 145 // are not INITIALIZE_IMPL or CLOSE_IMPL. |
| 157 DCHECK(remote_proto_channel_receiver_); | 146 DCHECK(remote_proto_channel_receiver_); |
| 158 remote_proto_channel_receiver_->OnProtoReceived(std::move(message)); | 147 remote_proto_channel_receiver_->OnProtoReceived(std::move(message)); |
| 159 } | 148 } |
| 160 } | 149 } |
| 161 | 150 |
| 151 void BlimpCompositor::OnContextProviderCreated( | |
| 152 scoped_refptr<cc::ContextProvider> provider) { | |
| 153 DCHECK(!surface_factory_) | |
| 154 << "Any connection to the old output surface should have been destroyed"; | |
| 155 | |
| 156 // Make sure we still have a host. If not, bail out. | |
| 157 if (!host_) | |
|
Khushal
2016/08/24 23:22:45
I was thinking about the case where the host goes
David Trainor- moved to gerrit
2016/08/26 17:15:54
Done.
| |
| 158 return; | |
| 159 | |
| 160 // TODO(khushalsagar): Make a worker context and bind it to the current | |
| 161 // thread: | |
| 162 // Worker context is bound to the main thread in RenderThreadImpl. One day | |
| 163 // that will change and then this will have to be removed. | |
| 164 // worker_context_provider->BindToCurrentThread(); | |
| 165 std::unique_ptr<DelegatedOutputSurface> delegated_output_surface = | |
| 166 base::MakeUnique<DelegatedOutputSurface>( | |
| 167 provider, nullptr, base::ThreadTaskRunnerHandle::Get(), | |
| 168 weak_ptr_factory_.GetWeakPtr()); | |
| 169 | |
| 170 host_->SetOutputSurface(std::move(delegated_output_surface)); | |
| 171 } | |
| 172 | |
| 162 void BlimpCompositor::SendWebGestureEvent( | 173 void BlimpCompositor::SendWebGestureEvent( |
| 163 const blink::WebGestureEvent& gesture_event) { | 174 const blink::WebGestureEvent& gesture_event) { |
| 164 client_->SendWebGestureEvent(render_widget_id_, gesture_event); | 175 client_->SendWebGestureEvent(render_widget_id_, gesture_event); |
| 165 } | 176 } |
| 166 | 177 |
| 167 void BlimpCompositor::BindToClient( | 178 void BlimpCompositor::BindToClient( |
| 168 base::WeakPtr<OutputSurfaceProxyClient> client) { | 179 base::WeakPtr<OutputSurfaceProxyClient> client) { |
| 169 DCHECK(thread_checker_.CalledOnValidThread()); | 180 DCHECK(thread_checker_.CalledOnValidThread()); |
| 170 DCHECK(!surface_factory_); | 181 DCHECK(!surface_factory_); |
| 171 | 182 |
| 172 output_surface_proxy_client_ = client; | 183 output_surface_proxy_client_ = client; |
| 173 surface_factory_ = | 184 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 174 base::MakeUnique<cc::SurfaceFactory>(surface_manager_, this); | 185 GetEmbedderDeps()->GetSurfaceManager(), this); |
| 175 } | 186 } |
| 176 | 187 |
| 177 void BlimpCompositor::SwapCompositorFrame(cc::CompositorFrame frame) { | 188 void BlimpCompositor::SwapCompositorFrame(cc::CompositorFrame frame) { |
| 178 DCHECK(thread_checker_.CalledOnValidThread()); | 189 DCHECK(thread_checker_.CalledOnValidThread()); |
| 179 DCHECK(surface_factory_); | 190 DCHECK(surface_factory_); |
| 180 | 191 |
| 181 cc::RenderPass* root_pass = | 192 cc::RenderPass* root_pass = |
| 182 frame.delegated_frame_data->render_pass_list.back().get(); | 193 frame.delegated_frame_data->render_pass_list.back().get(); |
| 183 gfx::Size surface_size = root_pass->output_rect.size(); | 194 gfx::Size surface_size = root_pass->output_rect.size(); |
| 184 | 195 |
| 185 if (surface_id_.is_null() || current_surface_size_ != surface_size) { | 196 if (surface_id_.is_null() || current_surface_size_ != surface_size) { |
| 186 DestroyDelegatedContent(); | 197 DestroyDelegatedContent(); |
| 187 DCHECK(layer_->children().empty()); | 198 DCHECK(layer_->children().empty()); |
| 188 | 199 |
| 189 surface_id_ = surface_id_allocator_->GenerateId(); | 200 surface_id_ = surface_id_allocator_->GenerateId(); |
| 190 surface_factory_->Create(surface_id_); | 201 surface_factory_->Create(surface_id_); |
| 191 current_surface_size_ = surface_size; | 202 current_surface_size_ = surface_size; |
| 192 | 203 |
| 193 // manager must outlive compositors using it. | 204 // manager must outlive compositors using it. |
| 205 cc::SurfaceManager* surface_manager = | |
| 206 GetEmbedderDeps()->GetSurfaceManager(); | |
| 194 scoped_refptr<cc::SurfaceLayer> content_layer = cc::SurfaceLayer::Create( | 207 scoped_refptr<cc::SurfaceLayer> content_layer = cc::SurfaceLayer::Create( |
| 195 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), | 208 base::Bind(&SatisfyCallback, base::Unretained(surface_manager)), |
| 196 base::Bind(&RequireCallback, base::Unretained(surface_manager_))); | 209 base::Bind(&RequireCallback, base::Unretained(surface_manager))); |
| 197 content_layer->SetSurfaceId(surface_id_, 1.f, surface_size); | 210 content_layer->SetSurfaceId(surface_id_, 1.f, surface_size); |
| 198 content_layer->SetBounds(current_surface_size_); | 211 content_layer->SetBounds(current_surface_size_); |
| 199 content_layer->SetIsDrawable(true); | 212 content_layer->SetIsDrawable(true); |
| 200 content_layer->SetContentsOpaque(true); | 213 content_layer->SetContentsOpaque(true); |
| 201 | 214 |
| 202 layer_->AddChild(content_layer); | 215 layer_->AddChild(content_layer); |
| 203 } | 216 } |
| 204 | 217 |
| 205 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), | 218 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), |
| 206 base::Closure()); | 219 base::Closure()); |
| 207 } | 220 } |
| 208 | 221 |
| 209 void BlimpCompositor::DetachFromClient() { | 222 void BlimpCompositor::DetachFromClient() { |
| 210 DCHECK(thread_checker_.CalledOnValidThread()); | 223 DCHECK(thread_checker_.CalledOnValidThread()); |
| 211 DCHECK(surface_factory_); | 224 DCHECK(surface_factory_); |
| 212 | 225 |
| 213 DestroyDelegatedContent(); | 226 DestroyDelegatedContent(); |
| 214 surface_factory_.reset(); | 227 surface_factory_.reset(); |
| 215 output_surface_proxy_client_ = nullptr; | 228 output_surface_proxy_client_ = nullptr; |
| 216 } | 229 } |
| 217 | 230 |
| 218 void BlimpCompositor::ReturnResources( | 231 void BlimpCompositor::ReturnResources( |
| 219 const cc::ReturnedResourceArray& resources) { | 232 const cc::ReturnedResourceArray& resources) { |
| 220 DCHECK(surface_factory_); | 233 DCHECK(surface_factory_); |
| 221 compositor_task_runner_->PostTask( | 234 compositor_dependencies_->GetCompositorTaskRunner()->PostTask( |
| 222 FROM_HERE, | 235 FROM_HERE, |
| 223 base::Bind(&OutputSurfaceProxyClient::ReclaimCompositorResources, | 236 base::Bind(&OutputSurfaceProxyClient::ReclaimCompositorResources, |
| 224 output_surface_proxy_client_, resources)); | 237 output_surface_proxy_client_, resources)); |
| 225 } | 238 } |
| 226 | 239 |
| 240 CompositorDependencies* BlimpCompositor::GetEmbedderDeps() { | |
| 241 return compositor_dependencies_->GetEmbedderDependencies(); | |
| 242 } | |
| 243 | |
| 227 void BlimpCompositor::DestroyDelegatedContent() { | 244 void BlimpCompositor::DestroyDelegatedContent() { |
| 228 if (surface_id_.is_null()) | 245 if (surface_id_.is_null()) |
| 229 return; | 246 return; |
| 230 | 247 |
| 231 // Remove any references for the surface layer that uses this |surface_id_|. | 248 // Remove any references for the surface layer that uses this |surface_id_|. |
| 232 layer_->RemoveAllChildren(); | 249 layer_->RemoveAllChildren(); |
| 233 surface_factory_->Destroy(surface_id_); | 250 surface_factory_->Destroy(surface_id_); |
| 234 surface_id_ = cc::SurfaceId(); | 251 surface_id_ = cc::SurfaceId(); |
| 235 } | 252 } |
| 236 | 253 |
| 237 void BlimpCompositor::CreateLayerTreeHost( | 254 void BlimpCompositor::CreateLayerTreeHost( |
| 238 const cc::proto::InitializeImpl& initialize_message) { | 255 const cc::proto::InitializeImpl& initialize_message) { |
| 239 DCHECK(!host_); | 256 DCHECK(!host_); |
| 240 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; | 257 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; |
| 241 | 258 |
| 259 if (!settings_) | |
| 260 settings_ = GetEmbedderDeps()->GetLayerTreeSettings(); | |
| 261 | |
| 242 // Create the LayerTreeHost | 262 // Create the LayerTreeHost |
| 243 cc::LayerTreeHost::InitParams params; | 263 cc::LayerTreeHost::InitParams params; |
| 244 params.client = this; | 264 params.client = this; |
| 245 params.task_graph_runner = client_->GetTaskGraphRunner(); | 265 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); |
| 246 params.gpu_memory_buffer_manager = client_->GetGpuMemoryBufferManager(); | 266 params.gpu_memory_buffer_manager = |
| 267 GetEmbedderDeps()->GetGpuMemoryBufferManager(); | |
| 247 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 268 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 248 params.image_serialization_processor = | 269 params.image_serialization_processor = |
| 249 client_->GetImageSerializationProcessor(); | 270 compositor_dependencies_->GetImageSerializationProcessor(); |
| 250 params.settings = client_->GetLayerTreeSettings(); | 271 params.settings = settings_.get(); |
| 251 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 272 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| 252 | 273 |
| 253 compositor_task_runner_ = client_->GetCompositorTaskRunner(); | 274 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
| 275 compositor_dependencies_->GetCompositorTaskRunner(); | |
| 254 | 276 |
| 255 host_ = cc::LayerTreeHost::CreateRemoteClient( | 277 host_ = cc::LayerTreeHost::CreateRemoteClient( |
| 256 this /* remote_proto_channel */, compositor_task_runner_, ¶ms); | 278 this /* remote_proto_channel */, compositor_task_runner, ¶ms); |
| 257 host_->SetVisible(host_should_be_visible_); | 279 host_->SetVisible(host_should_be_visible_); |
| 258 | 280 |
| 259 DCHECK(!input_manager_); | 281 DCHECK(!input_manager_); |
| 260 input_manager_ = BlimpInputManager::Create( | 282 input_manager_ = BlimpInputManager::Create( |
| 261 this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner_, | 283 this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner, |
| 262 host_->GetInputHandler()); | 284 host_->GetInputHandler()); |
| 263 } | 285 } |
| 264 | 286 |
| 265 void BlimpCompositor::DestroyLayerTreeHost() { | 287 void BlimpCompositor::DestroyLayerTreeHost() { |
| 266 DCHECK(host_); | 288 DCHECK(host_); |
| 267 VLOG(1) << "Destroying LayerTreeHost for render widget: " | 289 VLOG(1) << "Destroying LayerTreeHost for render widget: " |
| 268 << render_widget_id_; | 290 << render_widget_id_; |
| 269 // Tear down the output surface connection with the old LayerTreeHost | 291 // Tear down the output surface connection with the old LayerTreeHost |
| 270 // instance. | 292 // instance. |
| 271 DestroyDelegatedContent(); | 293 DestroyDelegatedContent(); |
| 272 surface_factory_.reset(); | 294 surface_factory_.reset(); |
| 273 | 295 |
| 274 // Destroy the old LayerTreeHost state. | 296 // Destroy the old LayerTreeHost state. |
| 275 host_.reset(); | 297 host_.reset(); |
| 276 | 298 |
| 277 // Destroy the old input manager state. | 299 // Destroy the old input manager state. |
| 278 // It is important to destroy the LayerTreeHost before destroying the input | 300 // It is important to destroy the LayerTreeHost before destroying the input |
| 279 // manager as it has a reference to the cc::InputHandlerClient owned by the | 301 // manager as it has a reference to the cc::InputHandlerClient owned by the |
| 280 // BlimpInputManager. | 302 // BlimpInputManager. |
| 281 input_manager_.reset(); | 303 input_manager_.reset(); |
| 282 | 304 |
| 305 // Destroy the LayerTreeHostSettings after the LayerTreeHost is gone, as it | |
| 306 // holds a reference to the settings. | |
| 307 settings_.reset(); | |
|
Khushal
2016/08/24 23:22:46
I think they keep a copy, so you can cache this va
David Trainor- moved to gerrit
2016/08/26 17:15:54
Done.
| |
| 308 | |
| 283 // Make sure we don't have a receiver at this point. | 309 // Make sure we don't have a receiver at this point. |
| 284 DCHECK(!remote_proto_channel_receiver_); | 310 DCHECK(!remote_proto_channel_receiver_); |
| 285 } | 311 } |
| 286 | 312 |
| 287 } // namespace client | 313 } // namespace client |
| 288 } // namespace blimp | 314 } // namespace blimp |
| OLD | NEW |