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

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

Issue 1317743002: cc: Implement shared worker contexts. (v1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tear down Created 5 years, 3 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
« no previous file with comments | « cc/output/context_provider.h ('k') | cc/raster/gpu_tile_task_worker_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (context_provider_.get()) { 121 if (context_provider_.get()) {
122 success = context_provider_->BindToCurrentThread(); 122 success = context_provider_->BindToCurrentThread();
123 if (success) { 123 if (success) {
124 context_provider_->SetLostContextCallback(base::Bind( 124 context_provider_->SetLostContextCallback(base::Bind(
125 &OutputSurface::DidLoseOutputSurface, base::Unretained(this))); 125 &OutputSurface::DidLoseOutputSurface, base::Unretained(this)));
126 context_provider_->SetMemoryPolicyChangedCallback( 126 context_provider_->SetMemoryPolicyChangedCallback(
127 base::Bind(&OutputSurface::SetMemoryPolicy, base::Unretained(this))); 127 base::Bind(&OutputSurface::SetMemoryPolicy, base::Unretained(this)));
128 } 128 }
129 } 129 }
130 130
131 if (success && worker_context_provider_.get()) {
132 success = worker_context_provider_->BindToCurrentThread();
133 if (success)
134 worker_context_provider_->SetupLock();
135 }
136
137 if (!success) 131 if (!success)
138 client_ = NULL; 132 client_ = NULL;
139 133
140 return success; 134 return success;
141 } 135 }
142 136
143 void OutputSurface::EnsureBackbuffer() { 137 void OutputSurface::EnsureBackbuffer() {
144 if (software_device_) 138 if (software_device_)
145 software_device_->EnsureBackbuffer(); 139 software_device_->EnsureBackbuffer();
146 } 140 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 196 }
203 197
204 void OutputSurface::SetWorkerContextShouldAggressivelyFreeResources( 198 void OutputSurface::SetWorkerContextShouldAggressivelyFreeResources(
205 bool aggressively_free_resources) { 199 bool aggressively_free_resources) {
206 TRACE_EVENT1("cc", 200 TRACE_EVENT1("cc",
207 "OutputSurface::SetWorkerContextShouldAggressivelyFreeResources", 201 "OutputSurface::SetWorkerContextShouldAggressivelyFreeResources",
208 "aggressively_free_resources", aggressively_free_resources); 202 "aggressively_free_resources", aggressively_free_resources);
209 if (auto* context_provider = worker_context_provider()) { 203 if (auto* context_provider = worker_context_provider()) {
210 ContextProvider::ScopedContextLock scoped_context(context_provider); 204 ContextProvider::ScopedContextLock scoped_context(context_provider);
211 205
212 if (aggressively_free_resources) { 206 if (!context_provider->HasBeenDestroyed()) {
213 context_provider->DeleteCachedResources(); 207 if (aggressively_free_resources) {
214 } 208 context_provider->DeleteCachedResources();
209 }
215 210
216 if (auto* context_support = context_provider->ContextSupport()) { 211 if (auto* context_support = context_provider->ContextSupport()) {
217 context_support->SetAggressivelyFreeResources( 212 context_support->SetAggressivelyFreeResources(
218 aggressively_free_resources); 213 aggressively_free_resources);
214 }
219 } 215 }
220 } 216 }
221 } 217 }
222 218
223 bool OutputSurface::SurfaceIsSuspendForRecycle() const { 219 bool OutputSurface::SurfaceIsSuspendForRecycle() const {
224 return false; 220 return false;
225 } 221 }
226 222
227 } // namespace cc 223 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/context_provider.h ('k') | cc/raster/gpu_tile_task_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698