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

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: remove more memory alloc codes. 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 clip, 97 clip,
98 viewport_rect_for_tile_priority, 98 viewport_rect_for_tile_priority,
99 transform_for_tile_priority, 99 transform_for_tile_priority,
100 resourceless_software_draw); 100 resourceless_software_draw);
101 } 101 }
102 102
103 OutputSurface::~OutputSurface() { 103 OutputSurface::~OutputSurface() {
104 if (context_provider_.get()) { 104 if (context_provider_.get()) {
105 context_provider_->SetLostContextCallback( 105 context_provider_->SetLostContextCallback(
106 ContextProvider::LostContextCallback()); 106 ContextProvider::LostContextCallback());
107 context_provider_->SetMemoryPolicyChangedCallback(
108 ContextProvider::MemoryPolicyChangedCallback());
109 } 107 }
110 } 108 }
111 109
112 bool OutputSurface::HasExternalStencilTest() const { 110 bool OutputSurface::HasExternalStencilTest() const {
113 return external_stencil_test_enabled_; 111 return external_stencil_test_enabled_;
114 } 112 }
115 113
116 bool OutputSurface::BindToClient(OutputSurfaceClient* client) { 114 bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
117 DCHECK(client); 115 DCHECK(client);
118 client_ = client; 116 client_ = client;
119 bool success = true; 117 bool success = true;
120 118
121 if (context_provider_.get()) { 119 if (context_provider_.get()) {
122 success = context_provider_->BindToCurrentThread(); 120 success = context_provider_->BindToCurrentThread();
123 if (success) { 121 if (success) {
124 context_provider_->SetLostContextCallback(base::Bind( 122 context_provider_->SetLostContextCallback(base::Bind(
125 &OutputSurface::DidLoseOutputSurface, base::Unretained(this))); 123 &OutputSurface::DidLoseOutputSurface, base::Unretained(this)));
126 context_provider_->SetMemoryPolicyChangedCallback(
127 base::Bind(&OutputSurface::SetMemoryPolicy, base::Unretained(this)));
128 } 124 }
129 } 125 }
130 126
131 if (success && worker_context_provider_.get()) { 127 if (success && worker_context_provider_.get()) {
132 success = worker_context_provider_->BindToCurrentThread(); 128 success = worker_context_provider_->BindToCurrentThread();
133 if (success) 129 if (success)
134 worker_context_provider_->SetupLock(); 130 worker_context_provider_->SetupLock();
135 } 131 }
136 132
137 if (!success) 133 if (!success)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 aggressively_free_resources); 214 aggressively_free_resources);
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

Powered by Google App Engine
This is Rietveld 408576698