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

Side by Side Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 1548443002: Introducing gpu::CommandBufferId as a distinct, IdType<...>-based type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-save-package-id-self-contained
Patch Set: Rebasing... Created 4 years, 10 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/pepper/ppb_graphics_3d_impl.h" 5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return graphics_3d->GetReference(); 73 return graphics_3d->GetReference();
74 } 74 }
75 75
76 // static 76 // static
77 PP_Resource PPB_Graphics3D_Impl::CreateRaw( 77 PP_Resource PPB_Graphics3D_Impl::CreateRaw(
78 PP_Instance instance, 78 PP_Instance instance,
79 PP_Resource share_context, 79 PP_Resource share_context,
80 const int32_t* attrib_list, 80 const int32_t* attrib_list,
81 gpu::Capabilities* capabilities, 81 gpu::Capabilities* capabilities,
82 base::SharedMemoryHandle* shared_state_handle, 82 base::SharedMemoryHandle* shared_state_handle,
83 uint64_t* command_buffer_id) { 83 gpu::CommandBufferId* command_buffer_id) {
84 PPB_Graphics3D_API* share_api = NULL; 84 PPB_Graphics3D_API* share_api = NULL;
85 if (share_context) { 85 if (share_context) {
86 EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true); 86 EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true);
87 if (enter.failed()) 87 if (enter.failed())
88 return 0; 88 return 0;
89 share_api = enter.object(); 89 share_api = enter.object();
90 } 90 }
91 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( 91 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d(
92 new PPB_Graphics3D_Impl(instance)); 92 new PPB_Graphics3D_Impl(instance));
93 if (!graphics_3d->InitRaw(share_api, attrib_list, capabilities, 93 if (!graphics_3d->InitRaw(share_api, attrib_list, capabilities,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 gpu::gles2::GLES2Implementation* share_gles2 = NULL; 209 gpu::gles2::GLES2Implementation* share_gles2 = NULL;
210 if (share_context) { 210 if (share_context) {
211 share_gles2 = 211 share_gles2 =
212 static_cast<PPB_Graphics3D_Shared*>(share_context)->gles2_impl(); 212 static_cast<PPB_Graphics3D_Shared*>(share_context)->gles2_impl();
213 } 213 }
214 214
215 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, share_gles2); 215 return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, share_gles2);
216 } 216 }
217 217
218 bool PPB_Graphics3D_Impl::InitRaw( 218 bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context,
219 PPB_Graphics3D_API* share_context, 219 const int32_t* attrib_list,
220 const int32_t* attrib_list, 220 gpu::Capabilities* capabilities,
221 gpu::Capabilities* capabilities, 221 base::SharedMemoryHandle* shared_state_handle,
222 base::SharedMemoryHandle* shared_state_handle, 222 gpu::CommandBufferId* command_buffer_id) {
223 uint64_t* command_buffer_id) {
224 PepperPluginInstanceImpl* plugin_instance = 223 PepperPluginInstanceImpl* plugin_instance =
225 HostGlobals::Get()->GetInstance(pp_instance()); 224 HostGlobals::Get()->GetInstance(pp_instance());
226 if (!plugin_instance) 225 if (!plugin_instance)
227 return false; 226 return false;
228 227
229 RenderView* render_view = plugin_instance->GetRenderView(); 228 RenderView* render_view = plugin_instance->GetRenderView();
230 if (!render_view) 229 if (!render_view)
231 return false; 230 return false;
232 231
233 const WebPreferences& prefs = render_view->GetWebkitPreferences(); 232 const WebPreferences& prefs = render_view->GetWebkitPreferences();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE)); 373 instance->module()->GetPluginInterface(PPP_GRAPHICS_3D_INTERFACE));
375 // We have to check *again* that the instance exists, because it could have 374 // We have to check *again* that the instance exists, because it could have
376 // been deleted during GetPluginInterface(). Even the PluginModule could be 375 // been deleted during GetPluginInterface(). Even the PluginModule could be
377 // deleted, but in that case, the instance should also be gone, so the 376 // deleted, but in that case, the instance should also be gone, so the
378 // GetInstance check covers both cases. 377 // GetInstance check covers both cases.
379 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance)) 378 if (ppp_graphics_3d && HostGlobals::Get()->GetInstance(this_pp_instance))
380 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance); 379 ppp_graphics_3d->Graphics3DContextLost(this_pp_instance);
381 } 380 }
382 381
383 } // namespace content 382 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | content/renderer/pepper/resource_creation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698