OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 surface_size_ = size; | 159 surface_size_ = size; |
160 device_scale_factor_ = scale_factor; | 160 device_scale_factor_ = scale_factor; |
161 if (context_provider_.get()) { | 161 if (context_provider_.get()) { |
162 context_provider_->ContextGL()->ResizeCHROMIUM( | 162 context_provider_->ContextGL()->ResizeCHROMIUM( |
163 size.width(), size.height(), scale_factor); | 163 size.width(), size.height(), scale_factor); |
164 } | 164 } |
165 if (software_device_) | 165 if (software_device_) |
166 software_device_->Resize(size, scale_factor); | 166 software_device_->Resize(size, scale_factor); |
167 } | 167 } |
168 | 168 |
169 gfx::Size OutputSurface::SurfaceSize() const { | |
170 return surface_size_; | |
171 } | |
172 | |
173 void OutputSurface::BindFramebuffer() { | 169 void OutputSurface::BindFramebuffer() { |
174 DCHECK(context_provider_.get()); | 170 DCHECK(context_provider_.get()); |
175 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); | 171 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); |
176 } | 172 } |
177 | 173 |
178 void OutputSurface::PostSwapBuffersComplete() { | 174 void OutputSurface::PostSwapBuffersComplete() { |
179 base::ThreadTaskRunnerHandle::Get()->PostTask( | 175 base::ThreadTaskRunnerHandle::Get()->PostTask( |
180 FROM_HERE, base::Bind(&OutputSurface::OnSwapBuffersComplete, | 176 FROM_HERE, base::Bind(&OutputSurface::OnSwapBuffersComplete, |
181 weak_ptr_factory_.GetWeakPtr())); | 177 weak_ptr_factory_.GetWeakPtr())); |
182 } | 178 } |
(...skipping 11 matching lines...) Expand all Loading... |
194 // bytes. This will happen when the memory manager thinks that the renderer | 190 // bytes. This will happen when the memory manager thinks that the renderer |
195 // is not visible (which the renderer knows better). | 191 // is not visible (which the renderer knows better). |
196 if (policy.bytes_limit_when_visible) | 192 if (policy.bytes_limit_when_visible) |
197 client_->SetMemoryPolicy(policy); | 193 client_->SetMemoryPolicy(policy); |
198 } | 194 } |
199 | 195 |
200 OverlayCandidateValidator* OutputSurface::GetOverlayCandidateValidator() const { | 196 OverlayCandidateValidator* OutputSurface::GetOverlayCandidateValidator() const { |
201 return nullptr; | 197 return nullptr; |
202 } | 198 } |
203 | 199 |
| 200 unsigned OutputSurface::GetOverlayTextureId() const { |
| 201 return 0; |
| 202 } |
| 203 |
204 void OutputSurface::SetWorkerContextShouldAggressivelyFreeResources( | 204 void OutputSurface::SetWorkerContextShouldAggressivelyFreeResources( |
205 bool aggressively_free_resources) { | 205 bool aggressively_free_resources) { |
206 TRACE_EVENT1("cc", | 206 TRACE_EVENT1("cc", |
207 "OutputSurface::SetWorkerContextShouldAggressivelyFreeResources", | 207 "OutputSurface::SetWorkerContextShouldAggressivelyFreeResources", |
208 "aggressively_free_resources", aggressively_free_resources); | 208 "aggressively_free_resources", aggressively_free_resources); |
209 if (auto* context_provider = worker_context_provider()) { | 209 if (auto* context_provider = worker_context_provider()) { |
210 ContextProvider::ScopedContextLock scoped_context(context_provider); | 210 ContextProvider::ScopedContextLock scoped_context(context_provider); |
211 | 211 |
212 if (aggressively_free_resources) { | 212 if (aggressively_free_resources) { |
213 context_provider->DeleteCachedResources(); | 213 context_provider->DeleteCachedResources(); |
214 } | 214 } |
215 | 215 |
216 if (auto* context_support = context_provider->ContextSupport()) { | 216 if (auto* context_support = context_provider->ContextSupport()) { |
217 context_support->SetAggressivelyFreeResources( | 217 context_support->SetAggressivelyFreeResources( |
218 aggressively_free_resources); | 218 aggressively_free_resources); |
219 } | 219 } |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 bool OutputSurface::SurfaceIsSuspendForRecycle() const { | 223 bool OutputSurface::SurfaceIsSuspendForRecycle() const { |
224 return false; | 224 return false; |
225 } | 225 } |
226 | 226 |
227 } // namespace cc | 227 } // namespace cc |
OLD | NEW |