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

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

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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/output_surface.h ('k') | cc/output/output_surface_client.h » ('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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/output/managed_memory_policy.h"
11 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
12 #include "gpu/GLES2/gl2extchromium.h" 11 #include "gpu/GLES2/gl2extchromium.h"
13 #include "gpu/command_buffer/client/gles2_interface.h" 12 #include "gpu/command_buffer/client/gles2_interface.h"
14 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
16 15
17 16
18 namespace cc { 17 namespace cc {
19 18
20 OutputSurface::OutputSurface( 19 OutputSurface::OutputSurface(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 DCHECK(!context_provider_.get()); 171 DCHECK(!context_provider_.get());
173 } 172 }
174 173
175 void OutputSurface::SetUpContext3d() { 174 void OutputSurface::SetUpContext3d() {
176 DCHECK(context_provider_.get()); 175 DCHECK(context_provider_.get());
177 DCHECK(client_); 176 DCHECK(client_);
178 177
179 context_provider_->SetLostContextCallback( 178 context_provider_->SetLostContextCallback(
180 base::Bind(&OutputSurface::DidLoseOutputSurface, 179 base::Bind(&OutputSurface::DidLoseOutputSurface,
181 base::Unretained(this))); 180 base::Unretained(this)));
182 context_provider_->SetMemoryPolicyChangedCallback(
183 base::Bind(&OutputSurface::SetMemoryPolicy,
184 base::Unretained(this)));
185 } 181 }
186 182
187 void OutputSurface::ReleaseContextProvider() { 183 void OutputSurface::ReleaseContextProvider() {
188 DCHECK(client_); 184 DCHECK(client_);
189 DCHECK(context_provider_.get()); 185 DCHECK(context_provider_.get());
190 ResetContext3d(); 186 ResetContext3d();
191 } 187 }
192 188
193 void OutputSurface::ResetContext3d() { 189 void OutputSurface::ResetContext3d() {
194 if (context_provider_.get()) { 190 if (context_provider_.get()) {
195 context_provider_->SetLostContextCallback( 191 context_provider_->SetLostContextCallback(
196 ContextProvider::LostContextCallback()); 192 ContextProvider::LostContextCallback());
197 context_provider_->SetMemoryPolicyChangedCallback(
198 ContextProvider::MemoryPolicyChangedCallback());
199 } 193 }
200 if (worker_context_provider_.get()) { 194 if (worker_context_provider_.get()) {
201 worker_context_provider_->SetLostContextCallback( 195 worker_context_provider_->SetLostContextCallback(
202 ContextProvider::LostContextCallback()); 196 ContextProvider::LostContextCallback());
203 } 197 }
204 context_provider_ = NULL; 198 context_provider_ = NULL;
205 worker_context_provider_ = NULL; 199 worker_context_provider_ = NULL;
206 } 200 }
207 201
208 void OutputSurface::EnsureBackbuffer() { 202 void OutputSurface::EnsureBackbuffer() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 base::Bind(&OutputSurface::OnSwapBuffersComplete, 240 base::Bind(&OutputSurface::OnSwapBuffersComplete,
247 weak_ptr_factory_.GetWeakPtr())); 241 weak_ptr_factory_.GetWeakPtr()));
248 } 242 }
249 243
250 // We don't post tasks bound to the client directly since they might run 244 // We don't post tasks bound to the client directly since they might run
251 // after the OutputSurface has been destroyed. 245 // after the OutputSurface has been destroyed.
252 void OutputSurface::OnSwapBuffersComplete() { 246 void OutputSurface::OnSwapBuffersComplete() {
253 client_->DidSwapBuffersComplete(); 247 client_->DidSwapBuffersComplete();
254 } 248 }
255 249
256 void OutputSurface::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
257 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy",
258 "bytes_limit_when_visible", policy.bytes_limit_when_visible);
259 // Just ignore the memory manager when it says to set the limit to zero
260 // bytes. This will happen when the memory manager thinks that the renderer
261 // is not visible (which the renderer knows better).
262 if (policy.bytes_limit_when_visible)
263 client_->SetMemoryPolicy(policy);
264 }
265
266 } // namespace cc 250 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/output/output_surface_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698