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

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

Issue 1324413003: Move gpu memory calculations to Compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment + android_arm64_dbg_recipe bot issue. Created 5 years, 2 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/output/output_surface_unittest.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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DCHECK(client); 203 DCHECK(client);
204 DCHECK(!client_); 204 DCHECK(!client_);
205 client_ = client; 205 client_ = client;
206 bool success = true; 206 bool success = true;
207 207
208 if (context_provider_.get()) { 208 if (context_provider_.get()) {
209 success = context_provider_->BindToCurrentThread(); 209 success = context_provider_->BindToCurrentThread();
210 if (success) { 210 if (success) {
211 context_provider_->SetLostContextCallback(base::Bind( 211 context_provider_->SetLostContextCallback(base::Bind(
212 &OutputSurface::DidLoseOutputSurface, base::Unretained(this))); 212 &OutputSurface::DidLoseOutputSurface, base::Unretained(this)));
213 context_provider_->SetMemoryPolicyChangedCallback(
214 base::Bind(&OutputSurface::SetMemoryPolicy, base::Unretained(this)));
215 } 213 }
216 } 214 }
217 215
218 if (!success) 216 if (!success)
219 client_ = NULL; 217 client_ = NULL;
220 218
221 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). 219 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
222 // Don't register a dump provider in these cases. 220 // Don't register a dump provider in these cases.
223 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 221 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
224 if (client_ && base::ThreadTaskRunnerHandle::IsSet()) { 222 if (client_ && base::ThreadTaskRunnerHandle::IsSet()) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 DCHECK(client_); 346 DCHECK(client_);
349 347
350 // Unregister any dump provider. Safe to call (no-op) if we have not yet 348 // Unregister any dump provider. Safe to call (no-op) if we have not yet
351 // registered. 349 // registered.
352 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 350 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
353 this); 351 this);
354 352
355 if (context_provider_.get()) { 353 if (context_provider_.get()) {
356 context_provider_->SetLostContextCallback( 354 context_provider_->SetLostContextCallback(
357 ContextProvider::LostContextCallback()); 355 ContextProvider::LostContextCallback());
358 context_provider_->SetMemoryPolicyChangedCallback(
359 ContextProvider::MemoryPolicyChangedCallback());
360 } 356 }
361 context_provider_ = nullptr; 357 context_provider_ = nullptr;
362 client_ = nullptr; 358 client_ = nullptr;
363 weak_ptr_factory_.InvalidateWeakPtrs(); 359 weak_ptr_factory_.InvalidateWeakPtrs();
364 } 360 }
365 361
366 } // namespace cc 362 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/context_provider.h ('k') | cc/output/output_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698