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

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

Issue 7762013: Added GPU process "echo" IPC message. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppb_graphics_3d_impl.h ('k') | webkit/plugins/ppapi/ppb_surface_3d_impl.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_graphics_3d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "gpu/command_buffer/client/gles2_implementation.h" 8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "webkit/plugins/ppapi/plugin_module.h" 9 #include "webkit/plugins/ppapi/plugin_module.h"
10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 10 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 s.generation 47 s.generation
48 }; 48 };
49 return state; 49 return state;
50 } 50 }
51 } // namespace. 51 } // namespace.
52 52
53 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance) 53 PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance)
54 : Resource(instance), 54 : Resource(instance),
55 bound_to_instance_(false), 55 bound_to_instance_(false),
56 commit_pending_(false), 56 commit_pending_(false),
57 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 57 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
58 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
58 } 59 }
59 60
60 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { 61 PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {
61 DestroyGLES2Impl(); 62 DestroyGLES2Impl();
62 } 63 }
63 64
64 // static 65 // static
65 PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance, 66 PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance,
66 PP_Resource share_context, 67 PP_Resource share_context,
67 const int32_t* attrib_list) { 68 const int32_t* attrib_list) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return platform_context_->GetCommandBuffer(); 158 return platform_context_->GetCommandBuffer();
158 } 159 }
159 160
160 int32 PPB_Graphics3D_Impl::DoSwapBuffers() { 161 int32 PPB_Graphics3D_Impl::DoSwapBuffers() {
161 // We do not have a GLES2 implementation when using an OOP proxy. 162 // We do not have a GLES2 implementation when using an OOP proxy.
162 // The plugin-side proxy is responsible for adding the SwapBuffers command 163 // The plugin-side proxy is responsible for adding the SwapBuffers command
163 // to the command buffer in that case. 164 // to the command buffer in that case.
164 if (gles2_impl()) 165 if (gles2_impl())
165 gles2_impl()->SwapBuffers(); 166 gles2_impl()->SwapBuffers();
166 167
168 platform_context_->Echo(method_factory_.NewRunnableMethod(
169 &PPB_Graphics3D_Impl::OnSwapBuffers));
170
167 return PP_OK_COMPLETIONPENDING; 171 return PP_OK_COMPLETIONPENDING;
168 } 172 }
169 173
170 bool PPB_Graphics3D_Impl::Init(PP_Resource share_context, 174 bool PPB_Graphics3D_Impl::Init(PP_Resource share_context,
171 const int32_t* attrib_list) { 175 const int32_t* attrib_list) {
172 if (!InitRaw(share_context, attrib_list)) 176 if (!InitRaw(share_context, attrib_list))
173 return false; 177 return false;
174 178
175 gpu::CommandBuffer* command_buffer = GetCommandBuffer(); 179 gpu::CommandBuffer* command_buffer = GetCommandBuffer();
176 if (!command_buffer->Initialize(kCommandBufferSize)) 180 if (!command_buffer->Initialize(kCommandBufferSize))
(...skipping 15 matching lines...) Expand all
192 196
193 platform_context_.reset(plugin_instance->CreateContext3D()); 197 platform_context_.reset(plugin_instance->CreateContext3D());
194 if (!platform_context_.get()) 198 if (!platform_context_.get())
195 return false; 199 return false;
196 200
197 if (!platform_context_->Init(attrib_list)) 201 if (!platform_context_->Init(attrib_list))
198 return false; 202 return false;
199 203
200 platform_context_->SetContextLostCallback( 204 platform_context_->SetContextLostCallback(
201 callback_factory_.NewCallback(&PPB_Graphics3D_Impl::OnContextLost)); 205 callback_factory_.NewCallback(&PPB_Graphics3D_Impl::OnContextLost));
202 platform_context_->SetSwapBuffersCallback(
203 callback_factory_.NewCallback(&PPB_Graphics3D_Impl::OnSwapBuffers));
204 return true; 206 return true;
205 } 207 }
206 208
207 void PPB_Graphics3D_Impl::OnSwapBuffers() { 209 void PPB_Graphics3D_Impl::OnSwapBuffers() {
208 if (bound_to_instance_) { 210 if (bound_to_instance_) {
209 // If we are bound to the instance, we need to ask the compositor 211 // If we are bound to the instance, we need to ask the compositor
210 // to commit our backing texture so that the graphics appears on the page. 212 // to commit our backing texture so that the graphics appears on the page.
211 // When the backing texture will be committed we get notified via 213 // When the backing texture will be committed we get notified via
212 // ViewFlushedPaint(). 214 // ViewFlushedPaint().
213 // 215 //
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 const PPP_Graphics3D_Dev* ppp_graphics_3d = 248 const PPP_Graphics3D_Dev* ppp_graphics_3d =
247 static_cast<const PPP_Graphics3D_Dev*>( 249 static_cast<const PPP_Graphics3D_Dev*>(
248 instance->module()->GetPluginInterface( 250 instance->module()->GetPluginInterface(
249 PPP_GRAPHICS_3D_DEV_INTERFACE)); 251 PPP_GRAPHICS_3D_DEV_INTERFACE));
250 if (ppp_graphics_3d) 252 if (ppp_graphics_3d)
251 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); 253 ppp_graphics_3d->Graphics3DContextLost(pp_instance());
252 } 254 }
253 255
254 } // namespace ppapi 256 } // namespace ppapi
255 } // namespace webkit 257 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_graphics_3d_impl.h ('k') | webkit/plugins/ppapi/ppb_surface_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698