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

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

Issue 10386145: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the <browser> tag, whic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments; remove createOffscreenGraphicsContext3D Created 8 years, 7 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" 9 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
10 #include "ppapi/shared_impl/resource.h" 10 #include "ppapi/shared_impl/resource.h"
11 #include "webkit/plugins/ppapi/plugin_delegate.h" 11 #include "webkit/plugins/ppapi/plugin_delegate.h"
12 12
13 namespace webkit { 13 namespace webkit {
14 namespace ppapi { 14 namespace ppapi {
15 15
16 class PPB_Graphics3D_Impl : public ::ppapi::PPB_Graphics3D_Shared { 16 class PPB_Graphics3D_Impl : public ::ppapi::PPB_Graphics3D_Shared {
17 public: 17 public:
18 virtual ~PPB_Graphics3D_Impl(); 18 virtual ~PPB_Graphics3D_Impl();
19 19
20 static PP_Resource Create(PP_Instance instance, 20 static PP_Resource Create(PP_Instance instance,
21 PP_Resource share_context, 21 PPB_Graphics3D_API* share_context,
22 const int32_t* attrib_list); 22 const int32_t* attrib_list);
23 static PP_Resource CreateRaw(PP_Instance instance, 23 static PP_Resource CreateRaw(PP_Instance instance,
24 PP_Resource share_context, 24 PPB_Graphics3D_API* share_context,
25 const int32_t* attrib_list); 25 const int32_t* attrib_list);
26 26
27 // PPB_Graphics3D_API trusted implementation. 27 // PPB_Graphics3D_API trusted implementation.
28 virtual PP_Bool InitCommandBuffer() OVERRIDE; 28 virtual PP_Bool InitCommandBuffer() OVERRIDE;
29 virtual PP_Bool SetGetBuffer(int32_t transfer_buffer_id) OVERRIDE; 29 virtual PP_Bool SetGetBuffer(int32_t transfer_buffer_id) OVERRIDE;
30 virtual PP_Graphics3DTrustedState GetState() OVERRIDE; 30 virtual PP_Graphics3DTrustedState GetState() OVERRIDE;
31 virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE; 31 virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
32 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE; 32 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
33 virtual PP_Bool GetTransferBuffer(int32_t id, 33 virtual PP_Bool GetTransferBuffer(int32_t id,
34 int* shm_handle, 34 int* shm_handle,
(...skipping 25 matching lines...) Expand all
60 } 60 }
61 61
62 protected: 62 protected:
63 // ppapi::PPB_Graphics3D_Shared overrides. 63 // ppapi::PPB_Graphics3D_Shared overrides.
64 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; 64 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
65 virtual int32 DoSwapBuffers() OVERRIDE; 65 virtual int32 DoSwapBuffers() OVERRIDE;
66 66
67 private: 67 private:
68 explicit PPB_Graphics3D_Impl(PP_Instance instance); 68 explicit PPB_Graphics3D_Impl(PP_Instance instance);
69 69
70 bool Init(PP_Resource share_context, 70 bool Init(PPB_Graphics3D_API* share_context,
71 const int32_t* attrib_list); 71 const int32_t* attrib_list);
72 bool InitRaw(PP_Resource share_context, 72 bool InitRaw(PPB_Graphics3D_API* share_context,
73 const int32_t* attrib_list); 73 const int32_t* attrib_list);
74 74
75 // Notifications received from the GPU process. 75 // Notifications received from the GPU process.
76 void OnSwapBuffers(); 76 void OnSwapBuffers();
77 void OnContextLost(); 77 void OnContextLost();
78 void OnConsoleMessage(const std::string& msg, int id); 78 void OnConsoleMessage(const std::string& msg, int id);
79 // Notifications sent to plugin. 79 // Notifications sent to plugin.
80 void SendContextLost(); 80 void SendContextLost();
81 81
82 // True if context is bound to instance. 82 // True if context is bound to instance.
83 bool bound_to_instance_; 83 bool bound_to_instance_;
84 // True when waiting for compositor to commit our backing texture. 84 // True when waiting for compositor to commit our backing texture.
85 bool commit_pending_; 85 bool commit_pending_;
86 // PluginDelegate's 3D Context. Responsible for providing the command buffer. 86 // PluginDelegate's 3D Context. Responsible for providing the command buffer.
87 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; 87 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_;
88 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; 88 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_;
89 89
90 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); 90 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);
91 }; 91 };
92 92
93 } // namespace ppapi 93 } // namespace ppapi
94 } // namespace webkit 94 } // namespace webkit
95 95
96 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ 96 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698