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