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

Side by Side Diff: content/renderer/gpu/mailbox_output_surface.cc

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add in_process context support 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/gpu/mailbox_output_surface.h" 5 #include "content/renderer/gpu/mailbox_output_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_ack.h" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/gl_frame_data.h" 10 #include "cc/output/gl_frame_data.h"
(...skipping 26 matching lines...) Expand all
37 software_device.Pass(), 37 software_device.Pass(),
38 swap_frame_message_queue, 38 swap_frame_message_queue,
39 true), 39 true),
40 fbo_(0), 40 fbo_(0),
41 is_backbuffer_discarded_(false), 41 is_backbuffer_discarded_(false),
42 format_(format) { 42 format_(format) {
43 pending_textures_.push_back(TransferableFrame()); 43 pending_textures_.push_back(TransferableFrame());
44 capabilities_.uses_default_gl_framebuffer = false; 44 capabilities_.uses_default_gl_framebuffer = false;
45 } 45 }
46 46
47 MailboxOutputSurface::~MailboxOutputSurface() { 47 MailboxOutputSurface::~MailboxOutputSurface() {}
48
49 void MailboxOutputSurface::DetachFromClient() {
48 DiscardBackbuffer(); 50 DiscardBackbuffer();
49 while (!pending_textures_.empty()) { 51 while (!pending_textures_.empty()) {
50 if (pending_textures_.front().texture_id) { 52 if (pending_textures_.front().texture_id) {
51 context_provider_->ContextGL()->DeleteTextures( 53 context_provider_->ContextGL()->DeleteTextures(
52 1, &pending_textures_.front().texture_id); 54 1, &pending_textures_.front().texture_id);
53 } 55 }
54 pending_textures_.pop_front(); 56 pending_textures_.pop_front();
55 } 57 }
58 cc::OutputSurface::DetachFromClient();
56 } 59 }
57 60
58 void MailboxOutputSurface::EnsureBackbuffer() { 61 void MailboxOutputSurface::EnsureBackbuffer() {
59 is_backbuffer_discarded_ = false; 62 is_backbuffer_discarded_ = false;
60 63
61 GLES2Interface* gl = context_provider_->ContextGL(); 64 GLES2Interface* gl = context_provider_->ContextGL();
62 65
63 if (!current_backing_.texture_id) { 66 if (!current_backing_.texture_id) {
64 // Find a texture of matching size to recycle. 67 // Find a texture of matching size to recycle.
65 while (!returned_textures_.empty()) { 68 while (!returned_textures_.empty()) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 pending_textures_.push_back(current_backing_); 214 pending_textures_.push_back(current_backing_);
212 current_backing_ = TransferableFrame(); 215 current_backing_ = TransferableFrame();
213 } 216 }
214 217
215 size_t MailboxOutputSurface::GetNumAcksPending() { 218 size_t MailboxOutputSurface::GetNumAcksPending() {
216 DCHECK(pending_textures_.size()); 219 DCHECK(pending_textures_.size());
217 return pending_textures_.size() - 1; 220 return pending_textures_.size() - 1;
218 } 221 }
219 222
220 } // namespace content 223 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698