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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 context_provider_->Context3d()->deleteTexture( 46 context_provider_->Context3d()->deleteTexture(
47 pending_textures_.front().texture_id); 47 pending_textures_.front().texture_id);
48 } 48 }
49 pending_textures_.pop_front(); 49 pending_textures_.pop_front();
50 } 50 }
51 } 51 }
52 52
53 void MailboxOutputSurface::EnsureBackbuffer() { 53 void MailboxOutputSurface::EnsureBackbuffer() {
54 is_backbuffer_discarded_ = false; 54 is_backbuffer_discarded_ = false;
55 55
56 WebKit::WebGraphicsContext3D* context3d = context_provider_->Context3d(); 56 blink::WebGraphicsContext3D* context3d = context_provider_->Context3d();
57 57
58 if (!current_backing_.texture_id) { 58 if (!current_backing_.texture_id) {
59 // Find a texture of matching size to recycle. 59 // Find a texture of matching size to recycle.
60 while (!returned_textures_.empty()) { 60 while (!returned_textures_.empty()) {
61 TransferableFrame& texture = returned_textures_.front(); 61 TransferableFrame& texture = returned_textures_.front();
62 if (texture.size == surface_size_) { 62 if (texture.size == surface_size_) {
63 current_backing_ = texture; 63 current_backing_ = texture;
64 if (current_backing_.sync_point) 64 if (current_backing_.sync_point)
65 context3d->waitSyncPoint(current_backing_.sync_point); 65 context3d->waitSyncPoint(current_backing_.sync_point);
66 returned_textures_.pop(); 66 returned_textures_.pop();
(...skipping 29 matching lines...) Expand all
96 context3d->genMailboxCHROMIUM(current_backing_.mailbox.name); 96 context3d->genMailboxCHROMIUM(current_backing_.mailbox.name);
97 context3d->produceTextureCHROMIUM( 97 context3d->produceTextureCHROMIUM(
98 GL_TEXTURE_2D, current_backing_.mailbox.name); 98 GL_TEXTURE_2D, current_backing_.mailbox.name);
99 } 99 }
100 } 100 }
101 } 101 }
102 102
103 void MailboxOutputSurface::DiscardBackbuffer() { 103 void MailboxOutputSurface::DiscardBackbuffer() {
104 is_backbuffer_discarded_ = true; 104 is_backbuffer_discarded_ = true;
105 105
106 WebKit::WebGraphicsContext3D* context3d = context_provider_->Context3d(); 106 blink::WebGraphicsContext3D* context3d = context_provider_->Context3d();
107 107
108 if (current_backing_.texture_id) { 108 if (current_backing_.texture_id) {
109 context3d->deleteTexture(current_backing_.texture_id); 109 context3d->deleteTexture(current_backing_.texture_id);
110 current_backing_ = TransferableFrame(); 110 current_backing_ = TransferableFrame();
111 } 111 }
112 112
113 while (!returned_textures_.empty()) { 113 while (!returned_textures_.empty()) {
114 const TransferableFrame& frame = returned_textures_.front(); 114 const TransferableFrame& frame = returned_textures_.front();
115 context3d->deleteTexture(frame.texture_id); 115 context3d->deleteTexture(frame.texture_id);
116 returned_textures_.pop(); 116 returned_textures_.pop();
(...skipping 13 matching lines...) Expand all
130 surface_size_ = size; 130 surface_size_ = size;
131 device_scale_factor_ = scale_factor; 131 device_scale_factor_ = scale_factor;
132 DiscardBackbuffer(); 132 DiscardBackbuffer();
133 EnsureBackbuffer(); 133 EnsureBackbuffer();
134 } 134 }
135 135
136 void MailboxOutputSurface::BindFramebuffer() { 136 void MailboxOutputSurface::BindFramebuffer() {
137 EnsureBackbuffer(); 137 EnsureBackbuffer();
138 DCHECK(current_backing_.texture_id); 138 DCHECK(current_backing_.texture_id);
139 139
140 WebKit::WebGraphicsContext3D* context3d = context_provider_->Context3d(); 140 blink::WebGraphicsContext3D* context3d = context_provider_->Context3d();
141 141
142 if (!fbo_) 142 if (!fbo_)
143 fbo_ = context3d->createFramebuffer(); 143 fbo_ = context3d->createFramebuffer();
144 context3d->bindFramebuffer(GL_FRAMEBUFFER, fbo_); 144 context3d->bindFramebuffer(GL_FRAMEBUFFER, fbo_);
145 context3d->framebufferTexture2D( 145 context3d->framebufferTexture2D(
146 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 146 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
147 current_backing_.texture_id, 0); 147 current_backing_.texture_id, 0);
148 } 148 }
149 149
150 void MailboxOutputSurface::OnSwapAck(uint32 output_surface_id, 150 void MailboxOutputSurface::OnSwapAck(uint32 output_surface_id,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 pending_textures_.push_back(current_backing_); 209 pending_textures_.push_back(current_backing_);
210 current_backing_ = TransferableFrame(); 210 current_backing_ = TransferableFrame();
211 } 211 }
212 212
213 size_t MailboxOutputSurface::GetNumAcksPending() { 213 size_t MailboxOutputSurface::GetNumAcksPending() {
214 DCHECK(pending_textures_.size()); 214 DCHECK(pending_textures_.size());
215 return pending_textures_.size() - 1; 215 return pending_textures_.size() - 1;
216 } 216 }
217 217
218 } // namespace content 218 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/input_handler_wrapper.cc ('k') | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698