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

Side by Side Diff: webkit/plugins/ppapi/ppb_surface_3d_impl.cc

Issue 6241015: Make Pepper resize the buffer through the command buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/plugins/ppapi/ppb_surface_3d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h"
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h"
7 #include "gpu/command_buffer/common/command_buffer.h" 8 #include "gpu/command_buffer/common/command_buffer.h"
8 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" 9 #include "ppapi/c/dev/ppb_graphics_3d_dev.h"
9 #include "webkit/plugins/ppapi/common.h" 10 #include "webkit/plugins/ppapi/common.h"
10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 11 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
11 12
12 namespace webkit { 13 namespace webkit {
13 namespace ppapi { 14 namespace ppapi {
14 15
15 namespace { 16 namespace {
16 17
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (context == context_) 99 if (context == context_)
99 return true; 100 return true;
100 101
101 // Unbind from the current context. 102 // Unbind from the current context.
102 if (context_) { 103 if (context_) {
103 context_->SetSwapBuffersCallback(NULL); 104 context_->SetSwapBuffersCallback(NULL);
104 } 105 }
105 if (context) { 106 if (context) {
106 // Resize the backing texture to the size of the instance when it is bound. 107 // Resize the backing texture to the size of the instance when it is bound.
107 // TODO(alokp): This should be the responsibility of plugins. 108 // TODO(alokp): This should be the responsibility of plugins.
108 context->ResizeBackingTexture(instance()->position().size()); 109 const gfx::Size& size = instance()->position().size();
neb 2011/01/25 19:16:06 I'm wondering if we can split this right now into
Antoine Labour 2011/01/25 19:32:24 Right, I have a follow up CL where the command buf
109 110 context->GetGLES2Implementation()->ResizeCHROMIUM(
apatrick 2011/01/25 18:22:48 The issue with calling this concurrently with GL c
Antoine Labour 2011/01/25 19:32:24 In truth, none of the pepper calls are thread-safe
110 // This is a temporary hack. The SwapBuffers is issued to force the resize 111 size.width(), size.height());
111 // to take place before any subsequent rendering. This might lead to a
112 // partially rendered frame being displayed. It is also not thread safe
113 // since the SwapBuffers is written to the command buffer and that command
114 // buffer might be written to by another thread.
115 // TODO(apatrick): Figure out the semantics of binding and resizing.
116 context->SwapBuffers();
117 112
118 context->SetSwapBuffersCallback( 113 context->SetSwapBuffersCallback(
119 NewCallback(this, &PPB_Surface3D_Impl::OnSwapBuffers)); 114 NewCallback(this, &PPB_Surface3D_Impl::OnSwapBuffers));
120 } 115 }
121 context_ = context; 116 context_ = context;
122 return true; 117 return true;
123 } 118 }
124 119
125 bool PPB_Surface3D_Impl::SwapBuffers(PP_CompletionCallback callback) { 120 bool PPB_Surface3D_Impl::SwapBuffers(PP_CompletionCallback callback) {
126 if (!context_) 121 if (!context_)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 153 }
159 154
160 void PPB_Surface3D_Impl::OnSwapBuffers() { 155 void PPB_Surface3D_Impl::OnSwapBuffers() {
161 if (bound_to_instance_) 156 if (bound_to_instance_)
162 instance()->CommitBackingTexture(); 157 instance()->CommitBackingTexture();
163 } 158 }
164 159
165 } // namespace ppapi 160 } // namespace ppapi
166 } // namespace webkit 161 } // namespace webkit
167 162
OLDNEW
« chrome/gpu/gpu_command_buffer_stub.cc ('K') | « webkit/plugins/ppapi/plugin_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698