| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/android/synchronous_compositor_frame_sink.h" | 5 #include "content/renderer/android/synchronous_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void SynchronousCompositorFrameSink::DetachFromClient() { | 194 void SynchronousCompositorFrameSink::DetachFromClient() { |
| 195 DCHECK(CalledOnValidThread()); | 195 DCHECK(CalledOnValidThread()); |
| 196 client_->SetBeginFrameSource(nullptr); | 196 client_->SetBeginFrameSource(nullptr); |
| 197 // Destroy the begin frame source on the same thread it was bound on. | 197 // Destroy the begin frame source on the same thread it was bound on. |
| 198 begin_frame_source_ = nullptr; | 198 begin_frame_source_ = nullptr; |
| 199 registry_->UnregisterCompositorFrameSink(routing_id_, this); | 199 registry_->UnregisterCompositorFrameSink(routing_id_, this); |
| 200 client_->SetTreeActivationCallback(base::Closure()); | 200 client_->SetTreeActivationCallback(base::Closure()); |
| 201 if (!root_local_frame_id_.is_null()) { | 201 if (root_local_frame_id_.is_valid()) { |
| 202 surface_factory_->Destroy(root_local_frame_id_); | 202 surface_factory_->Destroy(root_local_frame_id_); |
| 203 surface_factory_->Destroy(child_local_frame_id_); | 203 surface_factory_->Destroy(child_local_frame_id_); |
| 204 } | 204 } |
| 205 surface_manager_->UnregisterSurfaceFactoryClient(kFrameSinkId); | 205 surface_manager_->UnregisterSurfaceFactoryClient(kFrameSinkId); |
| 206 surface_manager_->InvalidateFrameSinkId(kFrameSinkId); | 206 surface_manager_->InvalidateFrameSinkId(kFrameSinkId); |
| 207 software_output_surface_ = nullptr; | 207 software_output_surface_ = nullptr; |
| 208 display_ = nullptr; | 208 display_ = nullptr; |
| 209 surface_factory_ = nullptr; | 209 surface_factory_ = nullptr; |
| 210 surface_id_allocator_ = nullptr; | 210 surface_id_allocator_ = nullptr; |
| 211 surface_manager_ = nullptr; | 211 surface_manager_ = nullptr; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 cc::CompositorFrame submit_frame; | 231 cc::CompositorFrame submit_frame; |
| 232 | 232 |
| 233 if (in_software_draw_) { | 233 if (in_software_draw_) { |
| 234 // The frame we send to the client is actually just the metadata. Preserve | 234 // The frame we send to the client is actually just the metadata. Preserve |
| 235 // the |frame| for the software path below. | 235 // the |frame| for the software path below. |
| 236 submit_frame.metadata = frame.metadata.Clone(); | 236 submit_frame.metadata = frame.metadata.Clone(); |
| 237 | 237 |
| 238 if (root_local_frame_id_.is_null()) { | 238 if (!root_local_frame_id_.is_valid()) { |
| 239 root_local_frame_id_ = surface_id_allocator_->GenerateId(); | 239 root_local_frame_id_ = surface_id_allocator_->GenerateId(); |
| 240 surface_factory_->Create(root_local_frame_id_); | 240 surface_factory_->Create(root_local_frame_id_); |
| 241 child_local_frame_id_ = surface_id_allocator_->GenerateId(); | 241 child_local_frame_id_ = surface_id_allocator_->GenerateId(); |
| 242 surface_factory_->Create(child_local_frame_id_); | 242 surface_factory_->Create(child_local_frame_id_); |
| 243 } | 243 } |
| 244 | 244 |
| 245 display_->SetSurfaceId(cc::SurfaceId(kFrameSinkId, root_local_frame_id_), | 245 display_->SetSurfaceId(cc::SurfaceId(kFrameSinkId, root_local_frame_id_), |
| 246 frame.metadata.device_scale_factor); | 246 frame.metadata.device_scale_factor); |
| 247 | 247 |
| 248 // The layer compositor should be giving a frame that covers the | 248 // The layer compositor should be giving a frame that covers the |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 client_->ReclaimResources(resources); | 462 client_->ReclaimResources(resources); |
| 463 } | 463 } |
| 464 | 464 |
| 465 void SynchronousCompositorFrameSink::SetBeginFrameSource( | 465 void SynchronousCompositorFrameSink::SetBeginFrameSource( |
| 466 cc::BeginFrameSource* begin_frame_source) { | 466 cc::BeginFrameSource* begin_frame_source) { |
| 467 // Software output is synchronous and doesn't use a BeginFrameSource. | 467 // Software output is synchronous and doesn't use a BeginFrameSource. |
| 468 NOTREACHED(); | 468 NOTREACHED(); |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace content | 471 } // namespace content |
| OLD | NEW |