Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: cc/output/output_surface.cc

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits and use best_resource_format for now Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 OverlayCandidateValidator* OutputSurface::GetOverlayCandidateValidator() const { 210 OverlayCandidateValidator* OutputSurface::GetOverlayCandidateValidator() const {
211 return nullptr; 211 return nullptr;
212 } 212 }
213 213
214 void OutputSurface::SetWorkerContextShouldAggressivelyFreeResources( 214 void OutputSurface::SetWorkerContextShouldAggressivelyFreeResources(
215 bool aggressively_free_resources) { 215 bool aggressively_free_resources) {
216 TRACE_EVENT1("cc", 216 TRACE_EVENT1("cc",
217 "OutputSurface::SetWorkerContextShouldAggressivelyFreeResources", 217 "OutputSurface::SetWorkerContextShouldAggressivelyFreeResources",
218 "aggressively_free_resources", aggressively_free_resources); 218 "aggressively_free_resources", aggressively_free_resources);
219 if (auto* context_provider = worker_context_provider()) { 219 if (auto* context_provider = worker_context_provider()) {
220 // The context lock must be held while accessing the worker context. 220 ContextProvider::ScopedContextGL scoped_context(context_provider);
221 base::AutoLock context_lock(*context_provider->GetLock());
222
223 // Allow context to bind to current thread.
224 context_provider->DetachFromThread();
225 221
226 if (aggressively_free_resources) { 222 if (aggressively_free_resources) {
227 context_provider->DeleteCachedResources(); 223 context_provider->DeleteCachedResources();
228 } 224 }
229 225
230 if (auto* context_support = context_provider->ContextSupport()) { 226 if (auto* context_support = context_provider->ContextSupport()) {
231 context_support->SetAggressivelyFreeResources( 227 context_support->SetAggressivelyFreeResources(
232 aggressively_free_resources); 228 aggressively_free_resources);
233 } 229 }
234
235 // Allow context to bind to other threads.
236 context_provider->DetachFromThread();
237 } 230 }
238 } 231 }
239 232
240 bool OutputSurface::SurfaceIsSuspendForRecycle() const { 233 bool OutputSurface::SurfaceIsSuspendForRecycle() const {
241 return false; 234 return false;
242 } 235 }
243 236
244 } // namespace cc 237 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698