OLD | NEW |
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 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_GRAPHICS_3D_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_GRAPHICS_3D_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/callback.h" | 9 #include "base/callback.h" |
9 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
10 #include "gfx/size.h" | 11 #include "gfx/size.h" |
11 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
12 #include "gpu/command_buffer/client/gles2_implementation.h" | 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
13 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
14 #include "webkit/glue/plugins/pepper_plugin_delegate.h" | 15 #include "webkit/plugins/ppapi/plugin_delegate.h" |
15 #include "webkit/glue/plugins/pepper_resource.h" | 16 #include "webkit/plugins/ppapi/resource.h" |
16 | 17 |
17 namespace gpu { | 18 namespace gpu { |
18 namespace gles2 { | 19 namespace gles2 { |
19 class GLES2Implementation; | 20 class GLES2Implementation; |
20 } | 21 } // namespace gles2 |
21 } // namespace gpu | 22 } // namespace gpu |
22 | 23 |
23 struct PPB_Graphics3D_Dev; | 24 struct PPB_Graphics3D_Dev; |
24 struct PPB_OpenGLES_Dev; | 25 struct PPB_OpenGLES_Dev; |
25 | 26 |
26 namespace pepper { | 27 namespace webkit { |
| 28 namespace plugins { |
| 29 namespace ppapi { |
27 | 30 |
28 class Graphics3D : public Resource { | 31 class PPB_Graphics3D_Impl : public Resource { |
29 public: | 32 public: |
30 explicit Graphics3D(PluginModule* module); | 33 explicit PPB_Graphics3D_Impl(PluginModule* module); |
31 | 34 |
32 virtual ~Graphics3D(); | 35 virtual ~PPB_Graphics3D_Impl(); |
33 | 36 |
34 static const PPB_Graphics3D_Dev* GetInterface(); | 37 static const PPB_Graphics3D_Dev* GetInterface(); |
35 static const PPB_OpenGLES_Dev* GetOpenGLESInterface(); | 38 static const PPB_OpenGLES_Dev* GetOpenGLESInterface(); |
36 | 39 |
37 static bool Shutdown(); | 40 static bool Shutdown(); |
38 | 41 |
39 static Graphics3D* GetCurrent(); | 42 static PPB_Graphics3D_Impl* GetCurrent(); |
40 | 43 |
41 static void ResetCurrent(); | 44 static void ResetCurrent(); |
42 | 45 |
43 // Resource override. | 46 // Resource override. |
44 virtual Graphics3D* AsGraphics3D() { | 47 virtual PPB_Graphics3D_Impl* AsGraphics3D(); |
45 return this; | |
46 } | |
47 | 48 |
48 bool Init(PP_Instance instance_id, int32_t config, | 49 bool Init(PP_Instance instance_id, int32_t config, |
49 const int32_t* attrib_list); | 50 const int32_t* attrib_list); |
50 | 51 |
51 // Associates this Graphics3D with the given plugin instance. You can pass | 52 // Associates this PPB_Graphics3D_Impl with the given plugin instance. You can
pass |
52 // NULL to clear the existing device. Returns true on success. In this case, | 53 // NULL to clear the existing device. Returns true on success. In this case, |
53 // the last rendered frame is displayed. | 54 // the last rendered frame is displayed. |
54 // TODO(apatrick): Figure out the best semantics here. | 55 // TODO(apatrick): Figure out the best semantics here. |
55 bool BindToInstance(PluginInstance* new_instance); | 56 bool BindToInstance(PluginInstance* new_instance); |
56 | 57 |
57 bool MakeCurrent(); | 58 bool MakeCurrent(); |
58 | 59 |
59 bool SwapBuffers(); | 60 bool SwapBuffers(); |
60 | 61 |
61 unsigned GetError(); | 62 unsigned GetError(); |
(...skipping 13 matching lines...) Expand all Loading... |
75 | 76 |
76 // Non-owning pointer to the plugin instance this context is currently bound | 77 // Non-owning pointer to the plugin instance this context is currently bound |
77 // to, if any. If the context is currently unbound, this will be NULL. | 78 // to, if any. If the context is currently unbound, this will be NULL. |
78 PluginInstance* bound_instance_; | 79 PluginInstance* bound_instance_; |
79 | 80 |
80 // PluginDelegate's 3D Context. Responsible for providing the command buffer. | 81 // PluginDelegate's 3D Context. Responsible for providing the command buffer. |
81 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; | 82 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; |
82 | 83 |
83 // GLES2 Implementation instance. Owned by the platform context's GGL context. | 84 // GLES2 Implementation instance. Owned by the platform context's GGL context. |
84 gpu::gles2::GLES2Implementation* gles2_implementation_; | 85 gpu::gles2::GLES2Implementation* gles2_implementation_; |
| 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
85 }; | 88 }; |
86 | 89 |
87 } // namespace pepper | 90 } // namespace ppapi |
| 91 } // namespace plugins |
| 92 } // namespace webkit |
88 | 93 |
89 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_GRAPHICS_3D_H_ | 94 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
90 | 95 |
OLD | NEW |