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_output_surface.h" | 5 #include "content/renderer/android/synchronous_compositor_output_surface.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 surface_manager_(new cc::SurfaceManager), | 99 surface_manager_(new cc::SurfaceManager), |
100 surface_id_allocator_(new cc::SurfaceIdAllocator(kCompositorClientId)), | 100 surface_id_allocator_(new cc::SurfaceIdAllocator(kCompositorClientId)), |
101 surface_factory_(new cc::SurfaceFactory(surface_manager_.get(), this)) { | 101 surface_factory_(new cc::SurfaceFactory(surface_manager_.get(), this)) { |
102 DCHECK(registry_); | 102 DCHECK(registry_); |
103 DCHECK(sender_); | 103 DCHECK(sender_); |
104 thread_checker_.DetachFromThread(); | 104 thread_checker_.DetachFromThread(); |
105 capabilities_.adjust_deadline_for_parent = false; | 105 capabilities_.adjust_deadline_for_parent = false; |
106 capabilities_.delegated_rendering = true; | 106 capabilities_.delegated_rendering = true; |
107 memory_policy_.priority_cutoff_when_visible = | 107 memory_policy_.priority_cutoff_when_visible = |
108 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; | 108 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; |
109 surface_id_allocator_->RegisterSurfaceClientId(surface_manager_.get()); | |
110 } | 109 } |
111 | 110 |
112 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {} | 111 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {} |
danakj
2016/07/22 19:01:59
nit: = default
Fady Samuel
2016/07/22 19:08:40
Done.
| |
113 | 112 |
114 void SynchronousCompositorOutputSurface::SetSyncClient( | 113 void SynchronousCompositorOutputSurface::SetSyncClient( |
115 SynchronousCompositorOutputSurfaceClient* compositor) { | 114 SynchronousCompositorOutputSurfaceClient* compositor) { |
116 DCHECK(CalledOnValidThread()); | 115 DCHECK(CalledOnValidThread()); |
117 sync_client_ = compositor; | 116 sync_client_ = compositor; |
118 if (sync_client_) | 117 if (sync_client_) |
119 Send(new SyncCompositorHostMsg_OutputSurfaceCreated(routing_id_)); | 118 Send(new SyncCompositorHostMsg_OutputSurfaceCreated(routing_id_)); |
120 } | 119 } |
121 | 120 |
122 bool SynchronousCompositorOutputSurface::OnMessageReceived( | 121 bool SynchronousCompositorOutputSurface::OnMessageReceived( |
(...skipping 13 matching lines...) Expand all Loading... | |
136 if (!cc::OutputSurface::BindToClient(surface_client)) | 135 if (!cc::OutputSurface::BindToClient(surface_client)) |
137 return false; | 136 return false; |
138 | 137 |
139 client_->SetMemoryPolicy(memory_policy_); | 138 client_->SetMemoryPolicy(memory_policy_); |
140 client_->SetTreeActivationCallback( | 139 client_->SetTreeActivationCallback( |
141 base::Bind(&SynchronousCompositorOutputSurface::DidActivatePendingTree, | 140 base::Bind(&SynchronousCompositorOutputSurface::DidActivatePendingTree, |
142 base::Unretained(this))); | 141 base::Unretained(this))); |
143 registry_->RegisterOutputSurface(routing_id_, this); | 142 registry_->RegisterOutputSurface(routing_id_, this); |
144 registered_ = true; | 143 registered_ = true; |
145 | 144 |
145 surface_manager_->RegisterSurfaceClientId(surface_id_allocator_->client_id()); | |
146 surface_manager_->RegisterSurfaceFactoryClient( | 146 surface_manager_->RegisterSurfaceFactoryClient( |
147 surface_id_allocator_->client_id(), this); | 147 surface_id_allocator_->client_id(), this); |
148 | 148 |
149 cc::RendererSettings software_renderer_settings; | 149 cc::RendererSettings software_renderer_settings; |
150 | 150 |
151 // The shared_bitmap_manager and gpu_memory_buffer_manager here are null as | 151 // The shared_bitmap_manager and gpu_memory_buffer_manager here are null as |
152 // this Display is only used for resourcesless software draws, where no | 152 // this Display is only used for resourcesless software draws, where no |
153 // resources are included in the frame swapped from the compositor. So there | 153 // resources are included in the frame swapped from the compositor. So there |
154 // is no need for these. | 154 // is no need for these. |
155 display_.reset(new cc::Display( | 155 display_.reset(new cc::Display( |
(...skipping 11 matching lines...) Expand all Loading... | |
167 void SynchronousCompositorOutputSurface::DetachFromClient() { | 167 void SynchronousCompositorOutputSurface::DetachFromClient() { |
168 DCHECK(CalledOnValidThread()); | 168 DCHECK(CalledOnValidThread()); |
169 if (registered_) { | 169 if (registered_) { |
170 registry_->UnregisterOutputSurface(routing_id_, this); | 170 registry_->UnregisterOutputSurface(routing_id_, this); |
171 } | 171 } |
172 client_->SetTreeActivationCallback(base::Closure()); | 172 client_->SetTreeActivationCallback(base::Closure()); |
173 if (!delegated_surface_id_.is_null()) | 173 if (!delegated_surface_id_.is_null()) |
174 surface_factory_->Destroy(delegated_surface_id_); | 174 surface_factory_->Destroy(delegated_surface_id_); |
175 surface_manager_->UnregisterSurfaceFactoryClient( | 175 surface_manager_->UnregisterSurfaceFactoryClient( |
176 surface_id_allocator_->client_id()); | 176 surface_id_allocator_->client_id()); |
177 surface_manager_->InvalidateSurfaceClientId( | |
178 surface_id_allocator_->client_id()); | |
177 display_ = nullptr; | 179 display_ = nullptr; |
178 surface_factory_ = nullptr; | 180 surface_factory_ = nullptr; |
179 surface_id_allocator_ = nullptr; | 181 surface_id_allocator_ = nullptr; |
180 surface_manager_ = nullptr; | 182 surface_manager_ = nullptr; |
181 cc::OutputSurface::DetachFromClient(); | 183 cc::OutputSurface::DetachFromClient(); |
182 CancelFallbackTick(); | 184 CancelFallbackTick(); |
183 } | 185 } |
184 | 186 |
185 void SynchronousCompositorOutputSurface::Reshape( | 187 void SynchronousCompositorOutputSurface::Reshape( |
186 const gfx::Size& size, | 188 const gfx::Size& size, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 client_->ReclaimResources(resources); | 405 client_->ReclaimResources(resources); |
404 } | 406 } |
405 | 407 |
406 void SynchronousCompositorOutputSurface::SetBeginFrameSource( | 408 void SynchronousCompositorOutputSurface::SetBeginFrameSource( |
407 cc::BeginFrameSource* begin_frame_source) { | 409 cc::BeginFrameSource* begin_frame_source) { |
408 // Software output is synchronous and doesn't use a BeginFrameSource. | 410 // Software output is synchronous and doesn't use a BeginFrameSource. |
409 NOTREACHED(); | 411 NOTREACHED(); |
410 } | 412 } |
411 | 413 |
412 } // namespace content | 414 } // namespace content |
OLD | NEW |