OLD | NEW |
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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ppapi/shared_impl/resource.h" |
10 #include "ppapi/thunk/ppb_context_3d_api.h" | 11 #include "ppapi/thunk/ppb_context_3d_api.h" |
11 #include "webkit/plugins/ppapi/plugin_delegate.h" | 12 #include "webkit/plugins/ppapi/plugin_delegate.h" |
12 #include "webkit/plugins/ppapi/resource.h" | |
13 | 13 |
14 struct PPB_Context3DTrusted_Dev; | 14 struct PPB_Context3DTrusted_Dev; |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 class CommandBuffer; | 17 class CommandBuffer; |
18 namespace gles2 { | 18 namespace gles2 { |
19 class GLES2CmdHelper; | 19 class GLES2CmdHelper; |
20 class GLES2Implementation; | 20 class GLES2Implementation; |
21 } // namespace gles2 | 21 } // namespace gles2 |
22 } // namespace gpu | 22 } // namespace gpu |
23 | 23 |
24 namespace webkit { | 24 namespace webkit { |
25 namespace ppapi { | 25 namespace ppapi { |
26 | 26 |
27 class PPB_Surface3D_Impl; | 27 class PPB_Surface3D_Impl; |
28 | 28 |
29 class PPB_Context3D_Impl : public Resource, | 29 class PPB_Context3D_Impl : public ::ppapi::Resource, |
30 public ::ppapi::thunk::PPB_Context3D_API { | 30 public ::ppapi::thunk::PPB_Context3D_API { |
31 public: | 31 public: |
32 virtual ~PPB_Context3D_Impl(); | 32 virtual ~PPB_Context3D_Impl(); |
33 | 33 |
34 static PP_Resource Create(PP_Instance instance, | 34 static PP_Resource Create(PP_Instance instance, |
35 PP_Config3D_Dev config, | 35 PP_Config3D_Dev config, |
36 PP_Resource share_context, | 36 PP_Resource share_context, |
37 const int32_t* attrib_list); | 37 const int32_t* attrib_list); |
38 static PP_Resource CreateRaw(PP_Instance instance, | 38 static PP_Resource CreateRaw(PP_Instance instance, |
39 PP_Config3D_Dev config, | 39 PP_Config3D_Dev config, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 gpu::gles2::GLES2Implementation* gles2_impl() { | 79 gpu::gles2::GLES2Implementation* gles2_impl() { |
80 return gles2_impl_.get(); | 80 return gles2_impl_.get(); |
81 } | 81 } |
82 | 82 |
83 // Possibly NULL if initialization fails. | 83 // Possibly NULL if initialization fails. |
84 PluginDelegate::PlatformContext3D* platform_context() { | 84 PluginDelegate::PlatformContext3D* platform_context() { |
85 return platform_context_.get(); | 85 return platform_context_.get(); |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 explicit PPB_Context3D_Impl(PluginInstance* instance); | 89 explicit PPB_Context3D_Impl(PP_Instance instance); |
90 | 90 |
91 bool Init(PP_Config3D_Dev config, | 91 bool Init(PP_Config3D_Dev config, |
92 PP_Resource share_context, | 92 PP_Resource share_context, |
93 const int32_t* attrib_list); | 93 const int32_t* attrib_list); |
94 bool InitRaw(PP_Config3D_Dev config, | 94 bool InitRaw(PP_Config3D_Dev config, |
95 PP_Resource share_context, | 95 PP_Resource share_context, |
96 const int32_t* attrib_list); | 96 const int32_t* attrib_list); |
97 | 97 |
98 bool CreateImplementation(); | 98 bool CreateImplementation(); |
99 void Destroy(); | 99 void Destroy(); |
100 void OnContextLost(); | 100 void OnContextLost(); |
101 | 101 |
102 // Plugin instance this context is associated with. | |
103 PluginInstance* instance_; | |
104 | |
105 // PluginDelegate's 3D Context. Responsible for providing the command buffer. | 102 // PluginDelegate's 3D Context. Responsible for providing the command buffer. |
106 // Possibly NULL. | 103 // Possibly NULL. |
107 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; | 104 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; |
108 | 105 |
109 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; | 106 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; |
110 int32 transfer_buffer_id_; | 107 int32 transfer_buffer_id_; |
111 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 108 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
112 | 109 |
113 PPB_Surface3D_Impl* draw_surface_; | 110 PPB_Surface3D_Impl* draw_surface_; |
114 PPB_Surface3D_Impl* read_surface_; | 111 PPB_Surface3D_Impl* read_surface_; |
115 | 112 |
116 base::ScopedCallbackFactory<PPB_Context3D_Impl> callback_factory_; | 113 base::ScopedCallbackFactory<PPB_Context3D_Impl> callback_factory_; |
117 | 114 |
118 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); | 115 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); |
119 }; | 116 }; |
120 | 117 |
121 } // namespace ppapi | 118 } // namespace ppapi |
122 } // namespace webkit | 119 } // namespace webkit |
123 | 120 |
124 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ | 121 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ |
OLD | NEW |