| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void SynchronousCompositorFrameSink::DetachFromClient() { | 190 void SynchronousCompositorFrameSink::DetachFromClient() { |
| 191 DCHECK(CalledOnValidThread()); | 191 DCHECK(CalledOnValidThread()); |
| 192 client_->SetBeginFrameSource(nullptr); | 192 client_->SetBeginFrameSource(nullptr); |
| 193 // Destroy the begin frame source on the same thread it was bound on. | 193 // Destroy the begin frame source on the same thread it was bound on. |
| 194 begin_frame_source_ = nullptr; | 194 begin_frame_source_ = nullptr; |
| 195 registry_->UnregisterCompositorFrameSink(routing_id_, this); | 195 registry_->UnregisterCompositorFrameSink(routing_id_, this); |
| 196 client_->SetTreeActivationCallback(base::Closure()); | 196 client_->SetTreeActivationCallback(base::Closure()); |
| 197 if (!root_local_frame_id_.is_null()) { | 197 if (root_local_frame_id_.is_valid()) { |
| 198 surface_factory_->Destroy(root_local_frame_id_); | 198 surface_factory_->Destroy(root_local_frame_id_); |
| 199 surface_factory_->Destroy(child_local_frame_id_); | 199 surface_factory_->Destroy(child_local_frame_id_); |
| 200 } | 200 } |
| 201 surface_manager_->UnregisterSurfaceFactoryClient(kFrameSinkId); | 201 surface_manager_->UnregisterSurfaceFactoryClient(kFrameSinkId); |
| 202 surface_manager_->InvalidateFrameSinkId(kFrameSinkId); | 202 surface_manager_->InvalidateFrameSinkId(kFrameSinkId); |
| 203 software_output_surface_ = nullptr; | 203 software_output_surface_ = nullptr; |
| 204 display_ = nullptr; | 204 display_ = nullptr; |
| 205 surface_factory_ = nullptr; | 205 surface_factory_ = nullptr; |
| 206 surface_id_allocator_ = nullptr; | 206 surface_id_allocator_ = nullptr; |
| 207 surface_manager_ = nullptr; | 207 surface_manager_ = nullptr; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 224 return; | 224 return; |
| 225 } | 225 } |
| 226 | 226 |
| 227 cc::CompositorFrame submit_frame; | 227 cc::CompositorFrame submit_frame; |
| 228 | 228 |
| 229 if (in_software_draw_) { | 229 if (in_software_draw_) { |
| 230 // The frame we send to the client is actually just the metadata. Preserve | 230 // The frame we send to the client is actually just the metadata. Preserve |
| 231 // the |frame| for the software path below. | 231 // the |frame| for the software path below. |
| 232 submit_frame.metadata = frame.metadata.Clone(); | 232 submit_frame.metadata = frame.metadata.Clone(); |
| 233 | 233 |
| 234 if (root_local_frame_id_.is_null()) { | 234 if (!root_local_frame_id_.is_valid()) { |
| 235 root_local_frame_id_ = surface_id_allocator_->GenerateId(); | 235 root_local_frame_id_ = surface_id_allocator_->GenerateId(); |
| 236 surface_factory_->Create(root_local_frame_id_); | 236 surface_factory_->Create(root_local_frame_id_); |
| 237 child_local_frame_id_ = surface_id_allocator_->GenerateId(); | 237 child_local_frame_id_ = surface_id_allocator_->GenerateId(); |
| 238 surface_factory_->Create(child_local_frame_id_); | 238 surface_factory_->Create(child_local_frame_id_); |
| 239 } | 239 } |
| 240 | 240 |
| 241 display_->SetSurfaceId(cc::SurfaceId(kFrameSinkId, root_local_frame_id_), | 241 display_->SetSurfaceId(cc::SurfaceId(kFrameSinkId, root_local_frame_id_), |
| 242 frame.metadata.device_scale_factor); | 242 frame.metadata.device_scale_factor); |
| 243 | 243 |
| 244 // The layer compositor should be giving a frame that covers the | 244 // The layer compositor should be giving a frame that covers the |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 client_->ReclaimResources(resources); | 463 client_->ReclaimResources(resources); |
| 464 } | 464 } |
| 465 | 465 |
| 466 void SynchronousCompositorFrameSink::SetBeginFrameSource( | 466 void SynchronousCompositorFrameSink::SetBeginFrameSource( |
| 467 cc::BeginFrameSource* begin_frame_source) { | 467 cc::BeginFrameSource* begin_frame_source) { |
| 468 // Software output is synchronous and doesn't use a BeginFrameSource. | 468 // Software output is synchronous and doesn't use a BeginFrameSource. |
| 469 NOTREACHED(); | 469 NOTREACHED(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace content | 472 } // namespace content |
| OLD | NEW |