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 output_surface_(nullptr), | 67 output_surface_(nullptr), |
| 65 surface_manager_(surface_manager), | 68 output_surface_request_pending_(false), |
| 66 surface_id_allocator_( | |
| 67 base::MakeUnique<cc::SurfaceIdAllocator>(surface_client_id)), | |
| 68 layer_(cc::Layer::Create()), | 69 layer_(cc::Layer::Create()), |
| 69 remote_proto_channel_receiver_(nullptr), | 70 remote_proto_channel_receiver_(nullptr), |
| 70 weak_factory_(this) { | 71 weak_ptr_factory_(this) { |
| 71 DCHECK(thread_checker_.CalledOnValidThread()); | 72 DCHECK(thread_checker_.CalledOnValidThread()); |
| 72 surface_manager_->RegisterSurfaceClientId(surface_id_allocator_->client_id()); | 73 |
| 74 surface_id_allocator_ = base::MakeUnique<cc::SurfaceIdAllocator>( | |
| 75 GetEmbedderDeps()->AllocateSurfaceId()); | |
| 76 GetEmbedderDeps()->GetSurfaceManager()->RegisterSurfaceClientId( | |
| 77 surface_id_allocator_->client_id()); | |
| 73 } | 78 } |
| 74 | 79 |
| 75 BlimpCompositor::~BlimpCompositor() { | 80 BlimpCompositor::~BlimpCompositor() { |
| 76 DCHECK(thread_checker_.CalledOnValidThread()); | 81 DCHECK(thread_checker_.CalledOnValidThread()); |
| 77 | 82 |
| 78 if (host_) | 83 if (host_) |
| 79 DestroyLayerTreeHost(); | 84 DestroyLayerTreeHost(); |
| 80 surface_manager_->InvalidateSurfaceClientId( | 85 |
| 86 GetEmbedderDeps()->GetSurfaceManager()->InvalidateSurfaceClientId( | |
| 81 surface_id_allocator_->client_id()); | 87 surface_id_allocator_->client_id()); |
| 82 } | 88 } |
| 83 | 89 |
| 84 void BlimpCompositor::SetVisible(bool visible) { | 90 void BlimpCompositor::SetVisible(bool visible) { |
| 85 host_should_be_visible_ = visible; | 91 host_should_be_visible_ = visible; |
| 86 if (host_) | 92 if (host_) |
| 87 host_->SetVisible(host_should_be_visible_); | 93 host_->SetVisible(host_should_be_visible_); |
| 88 } | 94 } |
| 89 | 95 |
| 90 bool BlimpCompositor::OnTouchEvent(const ui::MotionEvent& motion_event) { | 96 bool BlimpCompositor::OnTouchEvent(const ui::MotionEvent& motion_event) { |
| 91 if (input_manager_) | 97 if (input_manager_) |
| 92 return input_manager_->OnTouchEvent(motion_event); | 98 return input_manager_->OnTouchEvent(motion_event); |
| 93 return false; | 99 return false; |
| 94 } | 100 } |
| 95 | 101 |
| 96 void BlimpCompositor::RequestNewOutputSurface() { | 102 void BlimpCompositor::RequestNewOutputSurface() { |
| 97 DCHECK(!surface_factory_) | 103 DCHECK(!surface_factory_); |
| 98 << "Any connection to the old output surface should have been destroyed"; | 104 DCHECK(!output_surface_request_pending_); |
| 99 | 105 |
| 100 scoped_refptr<BlimpContextProvider> compositor_context_provider = | 106 output_surface_request_pending_ = true; |
| 101 BlimpContextProvider::Create(gfx::kNullAcceleratedWidget, | 107 GetEmbedderDeps()->GetContextProvider( |
| 102 client_->GetGpuMemoryBufferManager()); | 108 base::Bind(&BlimpCompositor::OnContextProviderCreated, |
| 109 weak_ptr_factory_.GetWeakPtr())); | |
| 110 } | |
| 103 | 111 |
| 104 // TODO(khushalsagar): Make a worker context and bind it to the current | 112 void BlimpCompositor::DidInitializeOutputSurface() { |
| 105 // thread: | 113 output_surface_request_pending_ = false; |
| 106 // Worker context is bound to the main thread in RenderThreadImpl. One day | |
| 107 // that will change and then this will have to be removed. | |
| 108 // worker_context_provider->BindToCurrentThread(); | |
| 109 | |
| 110 std::unique_ptr<DelegatedOutputSurface> delegated_output_surface = | |
| 111 base::MakeUnique<DelegatedOutputSurface>( | |
| 112 std::move(compositor_context_provider), nullptr, | |
| 113 base::ThreadTaskRunnerHandle::Get(), weak_factory_.GetWeakPtr()); | |
| 114 | |
| 115 host_->SetOutputSurface(std::move(delegated_output_surface)); | |
| 116 } | 114 } |
| 117 | 115 |
| 118 void BlimpCompositor::DidCommitAndDrawFrame() { | 116 void BlimpCompositor::DidCommitAndDrawFrame() { |
| 119 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); | 117 BlimpStats::GetInstance()->Add(BlimpStats::COMMIT, 1); |
| 120 } | 118 } |
| 121 | 119 |
| 122 void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) { | 120 void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) { |
| 123 remote_proto_channel_receiver_ = receiver; | 121 remote_proto_channel_receiver_ = receiver; |
| 124 } | 122 } |
| 125 | 123 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 153 DestroyLayerTreeHost(); | 151 DestroyLayerTreeHost(); |
| 154 break; | 152 break; |
| 155 default: | 153 default: |
| 156 // We should have a receiver if we're getting compositor messages that | 154 // We should have a receiver if we're getting compositor messages that |
| 157 // are not INITIALIZE_IMPL or CLOSE_IMPL. | 155 // are not INITIALIZE_IMPL or CLOSE_IMPL. |
| 158 DCHECK(remote_proto_channel_receiver_); | 156 DCHECK(remote_proto_channel_receiver_); |
| 159 remote_proto_channel_receiver_->OnProtoReceived(std::move(message)); | 157 remote_proto_channel_receiver_->OnProtoReceived(std::move(message)); |
| 160 } | 158 } |
| 161 } | 159 } |
| 162 | 160 |
| 161 void BlimpCompositor::OnContextProviderCreated( | |
| 162 const scoped_refptr<cc::ContextProvider>& provider) { | |
| 163 DCHECK(!surface_factory_) | |
| 164 << "Any connection to the old output surface should have been destroyed"; | |
| 165 | |
| 166 // Make sure we still have a host and we're still expecting an output surface. | |
| 167 // This can happen if the host dies while the request is outstanding and we | |
| 168 // build a new one that hasn't asked for a surface yet. | |
| 169 if (!output_surface_request_pending_) | |
| 170 return; | |
| 171 | |
| 172 // TODO(khushalsagar): Make a worker context and bind it to the current | |
| 173 // thread: | |
| 174 // Worker context is bound to the main thread in RenderThreadImpl. One day | |
| 175 // that will change and then this will have to be removed. | |
| 176 // worker_context_provider->BindToCurrentThread(); | |
| 177 std::unique_ptr<DelegatedOutputSurface> delegated_output_surface = | |
| 178 base::MakeUnique<DelegatedOutputSurface>( | |
| 179 provider, nullptr, base::ThreadTaskRunnerHandle::Get(), | |
| 180 weak_ptr_factory_.GetWeakPtr()); | |
| 181 | |
| 182 host_->SetOutputSurface(std::move(delegated_output_surface)); | |
| 183 } | |
| 184 | |
| 163 void BlimpCompositor::SendWebGestureEvent( | 185 void BlimpCompositor::SendWebGestureEvent( |
| 164 const blink::WebGestureEvent& gesture_event) { | 186 const blink::WebGestureEvent& gesture_event) { |
| 165 client_->SendWebGestureEvent(render_widget_id_, gesture_event); | 187 client_->SendWebGestureEvent(render_widget_id_, gesture_event); |
| 166 } | 188 } |
| 167 | 189 |
| 168 void BlimpCompositor::BindToOutputSurface( | 190 void BlimpCompositor::BindToOutputSurface( |
| 169 base::WeakPtr<BlimpOutputSurface> output_surface) { | 191 base::WeakPtr<BlimpOutputSurface> output_surface) { |
| 170 DCHECK(thread_checker_.CalledOnValidThread()); | 192 DCHECK(thread_checker_.CalledOnValidThread()); |
| 171 DCHECK(!output_surface_); | 193 DCHECK(!output_surface_); |
|
Khushal
2016/08/26 19:34:25
Now that I look at it, this DCHECK will fail even
David Trainor- moved to gerrit
2016/08/29 15:55:24
Done.
| |
| 172 DCHECK(!surface_factory_); | 194 DCHECK(!surface_factory_); |
| 173 | 195 |
| 174 output_surface_ = output_surface; | 196 output_surface_ = output_surface; |
| 175 surface_factory_ = | 197 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 176 base::MakeUnique<cc::SurfaceFactory>(surface_manager_, this); | 198 GetEmbedderDeps()->GetSurfaceManager(), this); |
| 177 } | 199 } |
| 178 | 200 |
| 179 void BlimpCompositor::SwapCompositorFrame(cc::CompositorFrame frame) { | 201 void BlimpCompositor::SwapCompositorFrame(cc::CompositorFrame frame) { |
| 180 DCHECK(thread_checker_.CalledOnValidThread()); | 202 DCHECK(thread_checker_.CalledOnValidThread()); |
| 181 DCHECK(surface_factory_); | 203 DCHECK(surface_factory_); |
| 182 | 204 |
| 183 cc::RenderPass* root_pass = | 205 cc::RenderPass* root_pass = |
| 184 frame.delegated_frame_data->render_pass_list.back().get(); | 206 frame.delegated_frame_data->render_pass_list.back().get(); |
| 185 gfx::Size surface_size = root_pass->output_rect.size(); | 207 gfx::Size surface_size = root_pass->output_rect.size(); |
| 186 | 208 |
| 187 if (surface_id_.is_null() || current_surface_size_ != surface_size) { | 209 if (surface_id_.is_null() || current_surface_size_ != surface_size) { |
| 188 DestroyDelegatedContent(); | 210 DestroyDelegatedContent(); |
| 189 DCHECK(layer_->children().empty()); | 211 DCHECK(layer_->children().empty()); |
| 190 | 212 |
| 191 surface_id_ = surface_id_allocator_->GenerateId(); | 213 surface_id_ = surface_id_allocator_->GenerateId(); |
| 192 surface_factory_->Create(surface_id_); | 214 surface_factory_->Create(surface_id_); |
| 193 current_surface_size_ = surface_size; | 215 current_surface_size_ = surface_size; |
| 194 | 216 |
| 195 // Manager must outlive compositors using it. | 217 // manager must outlive compositors using it. |
| 218 cc::SurfaceManager* surface_manager = | |
| 219 GetEmbedderDeps()->GetSurfaceManager(); | |
| 196 scoped_refptr<cc::SurfaceLayer> content_layer = cc::SurfaceLayer::Create( | 220 scoped_refptr<cc::SurfaceLayer> content_layer = cc::SurfaceLayer::Create( |
| 197 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), | 221 base::Bind(&SatisfyCallback, base::Unretained(surface_manager)), |
| 198 base::Bind(&RequireCallback, base::Unretained(surface_manager_))); | 222 base::Bind(&RequireCallback, base::Unretained(surface_manager))); |
| 199 content_layer->SetSurfaceId(surface_id_, 1.f, surface_size); | 223 content_layer->SetSurfaceId(surface_id_, 1.f, surface_size); |
| 200 content_layer->SetBounds(current_surface_size_); | 224 content_layer->SetBounds(current_surface_size_); |
| 201 content_layer->SetIsDrawable(true); | 225 content_layer->SetIsDrawable(true); |
| 202 content_layer->SetContentsOpaque(true); | 226 content_layer->SetContentsOpaque(true); |
| 203 | 227 |
| 204 layer_->AddChild(content_layer); | 228 layer_->AddChild(content_layer); |
| 205 } | 229 } |
| 206 | 230 |
| 207 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), | 231 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), |
| 208 base::Closure()); | 232 base::Closure()); |
| 209 } | 233 } |
| 210 | 234 |
| 211 void BlimpCompositor::UnbindOutputSurface() { | 235 void BlimpCompositor::UnbindOutputSurface() { |
| 212 DCHECK(thread_checker_.CalledOnValidThread()); | 236 DCHECK(thread_checker_.CalledOnValidThread()); |
| 213 DCHECK(surface_factory_); | 237 DCHECK(surface_factory_); |
| 214 | 238 |
| 215 DestroyDelegatedContent(); | 239 DestroyDelegatedContent(); |
| 216 surface_factory_.reset(); | 240 surface_factory_.reset(); |
| 217 output_surface_ = nullptr; | 241 output_surface_ = nullptr; |
| 218 } | 242 } |
| 219 | 243 |
| 220 void BlimpCompositor::ReturnResources( | 244 void BlimpCompositor::ReturnResources( |
| 221 const cc::ReturnedResourceArray& resources) { | 245 const cc::ReturnedResourceArray& resources) { |
| 222 DCHECK(surface_factory_); | 246 DCHECK(surface_factory_); |
| 223 compositor_task_runner_->PostTask( | 247 compositor_dependencies_->GetCompositorTaskRunner()->PostTask( |
| 224 FROM_HERE, base::Bind(&BlimpOutputSurface::ReclaimCompositorResources, | 248 FROM_HERE, base::Bind(&BlimpOutputSurface::ReclaimCompositorResources, |
| 225 output_surface_, resources)); | 249 output_surface_, resources)); |
| 226 } | 250 } |
| 227 | 251 |
| 252 CompositorDependencies* BlimpCompositor::GetEmbedderDeps() { | |
| 253 return compositor_dependencies_->GetEmbedderDependencies(); | |
| 254 } | |
| 255 | |
| 228 void BlimpCompositor::DestroyDelegatedContent() { | 256 void BlimpCompositor::DestroyDelegatedContent() { |
| 229 if (surface_id_.is_null()) | 257 if (surface_id_.is_null()) |
| 230 return; | 258 return; |
| 231 | 259 |
| 232 // Remove any references for the surface layer that uses this |surface_id_|. | 260 // Remove any references for the surface layer that uses this |surface_id_|. |
| 233 layer_->RemoveAllChildren(); | 261 layer_->RemoveAllChildren(); |
| 234 surface_factory_->Destroy(surface_id_); | 262 surface_factory_->Destroy(surface_id_); |
| 235 surface_id_ = cc::SurfaceId(); | 263 surface_id_ = cc::SurfaceId(); |
| 236 } | 264 } |
| 237 | 265 |
| 238 void BlimpCompositor::CreateLayerTreeHost( | 266 void BlimpCompositor::CreateLayerTreeHost( |
| 239 const cc::proto::InitializeImpl& initialize_message) { | 267 const cc::proto::InitializeImpl& initialize_message) { |
| 240 DCHECK(!host_); | 268 DCHECK(!host_); |
| 241 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; | 269 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; |
| 242 | 270 |
| 271 | |
| 243 // Create the LayerTreeHost | 272 // Create the LayerTreeHost |
| 244 cc::LayerTreeHost::InitParams params; | 273 cc::LayerTreeHost::InitParams params; |
| 245 params.client = this; | 274 params.client = this; |
| 246 params.task_graph_runner = client_->GetTaskGraphRunner(); | 275 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); |
| 247 params.gpu_memory_buffer_manager = client_->GetGpuMemoryBufferManager(); | 276 params.gpu_memory_buffer_manager = |
| 277 GetEmbedderDeps()->GetGpuMemoryBufferManager(); | |
| 248 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 278 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 249 params.image_serialization_processor = | 279 params.image_serialization_processor = |
| 250 client_->GetImageSerializationProcessor(); | 280 compositor_dependencies_->GetImageSerializationProcessor(); |
| 251 params.settings = client_->GetLayerTreeSettings(); | 281 params.settings = GetEmbedderDeps()->GetLayerTreeSettings(); |
| 252 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 282 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| 253 | 283 |
| 254 compositor_task_runner_ = client_->GetCompositorTaskRunner(); | 284 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
| 285 compositor_dependencies_->GetCompositorTaskRunner(); | |
| 255 | 286 |
| 256 host_ = cc::LayerTreeHost::CreateRemoteClient( | 287 host_ = cc::LayerTreeHost::CreateRemoteClient( |
| 257 this /* remote_proto_channel */, compositor_task_runner_, ¶ms); | 288 this /* remote_proto_channel */, compositor_task_runner, ¶ms); |
| 258 host_->SetVisible(host_should_be_visible_); | 289 host_->SetVisible(host_should_be_visible_); |
| 259 | 290 |
| 260 DCHECK(!input_manager_); | 291 DCHECK(!input_manager_); |
| 261 input_manager_ = BlimpInputManager::Create( | 292 input_manager_ = BlimpInputManager::Create( |
| 262 this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner_, | 293 this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner, |
| 263 host_->GetInputHandler()); | 294 host_->GetInputHandler()); |
| 264 } | 295 } |
| 265 | 296 |
| 266 void BlimpCompositor::DestroyLayerTreeHost() { | 297 void BlimpCompositor::DestroyLayerTreeHost() { |
| 267 DCHECK(host_); | 298 DCHECK(host_); |
| 268 VLOG(1) << "Destroying LayerTreeHost for render widget: " | 299 VLOG(1) << "Destroying LayerTreeHost for render widget: " |
| 269 << render_widget_id_; | 300 << render_widget_id_; |
| 270 // Tear down the output surface connection with the old LayerTreeHost | 301 // Tear down the output surface connection with the old LayerTreeHost |
| 271 // instance. | 302 // instance. |
| 272 DestroyDelegatedContent(); | 303 DestroyDelegatedContent(); |
| 273 surface_factory_.reset(); | 304 surface_factory_.reset(); |
| 274 | 305 |
| 275 // Destroy the old LayerTreeHost state. | 306 // Destroy the old LayerTreeHost state. |
| 276 host_.reset(); | 307 host_.reset(); |
| 277 | 308 |
| 278 // Destroy the old input manager state. | 309 // Destroy the old input manager state. |
| 279 // It is important to destroy the LayerTreeHost before destroying the input | 310 // It is important to destroy the LayerTreeHost before destroying the input |
| 280 // manager as it has a reference to the cc::InputHandlerClient owned by the | 311 // manager as it has a reference to the cc::InputHandlerClient owned by the |
| 281 // BlimpInputManager. | 312 // BlimpInputManager. |
| 282 input_manager_.reset(); | 313 input_manager_.reset(); |
| 283 | 314 |
| 315 // Cancel any outstanding OutputSurface requests. That way if we get an async | |
| 316 // callback related to the old request we know to drop it. | |
| 317 output_surface_request_pending_ = false; | |
| 318 | |
| 284 // Make sure we don't have a receiver at this point. | 319 // Make sure we don't have a receiver at this point. |
| 285 DCHECK(!remote_proto_channel_receiver_); | 320 DCHECK(!remote_proto_channel_receiver_); |
| 286 } | 321 } |
| 287 | 322 |
| 288 } // namespace client | 323 } // namespace client |
| 289 } // namespace blimp | 324 } // namespace blimp |
| OLD | NEW |