| 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_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/basictypes.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "gfx/size.h" | |
| 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | |
| 13 #include "gpu/command_buffer/client/gles2_implementation.h" | |
| 14 #include "ppapi/c/pp_instance.h" | |
| 15 #include "webkit/plugins/ppapi/plugin_delegate.h" | |
| 16 #include "webkit/plugins/ppapi/resource.h" | |
| 17 | |
| 18 namespace gpu { | |
| 19 namespace gles2 { | |
| 20 class GLES2Implementation; | |
| 21 } // namespace gles2 | |
| 22 } // namespace gpu | |
| 23 | |
| 24 struct PPB_Graphics3D_Dev; | 8 struct PPB_Graphics3D_Dev; |
| 25 struct PPB_OpenGLES2_Dev; | |
| 26 | 9 |
| 27 namespace webkit { | 10 namespace webkit { |
| 28 namespace ppapi { | 11 namespace ppapi { |
| 29 | 12 |
| 30 class PPB_Graphics3D_Impl : public Resource { | 13 class PPB_Graphics3D_Impl { |
| 31 public: | 14 public: |
| 32 explicit PPB_Graphics3D_Impl(PluginModule* module); | |
| 33 | |
| 34 virtual ~PPB_Graphics3D_Impl(); | |
| 35 | |
| 36 static const PPB_Graphics3D_Dev* GetInterface(); | 15 static const PPB_Graphics3D_Dev* GetInterface(); |
| 37 static const PPB_OpenGLES2_Dev* GetOpenGLES2Interface(); | |
| 38 | |
| 39 static bool Shutdown(); | |
| 40 | |
| 41 // Resource override. | |
| 42 virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl(); | |
| 43 | |
| 44 bool Init(PP_Instance instance_id, int32_t config, | |
| 45 const int32_t* attrib_list); | |
| 46 | |
| 47 // Associates this PPB_Graphics3D_Impl with the given plugin instance. You can
pass | |
| 48 // NULL to clear the existing device. Returns true on success. In this case, | |
| 49 // the last rendered frame is displayed. | |
| 50 // TODO(apatrick): Figure out the best semantics here. | |
| 51 bool BindToInstance(PluginInstance* new_instance); | |
| 52 | |
| 53 bool SwapBuffers(); | |
| 54 | |
| 55 unsigned GetError(); | |
| 56 | |
| 57 void ResizeBackingTexture(const gfx::Size& size); | |
| 58 | |
| 59 void SetSwapBuffersCallback(Callback0::Type* callback); | |
| 60 | |
| 61 unsigned GetBackingTextureId(); | |
| 62 | |
| 63 gpu::gles2::GLES2Implementation* impl() { | |
| 64 return gles2_implementation_; | |
| 65 } | |
| 66 | |
| 67 private: | |
| 68 void Destroy(); | |
| 69 | |
| 70 // Non-owning pointer to the plugin instance this context is currently bound | |
| 71 // to, if any. If the context is currently unbound, this will be NULL. | |
| 72 PluginInstance* bound_instance_; | |
| 73 | |
| 74 // PluginDelegate's 3D Context. Responsible for providing the command buffer. | |
| 75 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; | |
| 76 | |
| 77 // GLES2 Implementation instance. Owned by the platform context's GGL context. | |
| 78 gpu::gles2::GLES2Implementation* gles2_implementation_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | |
| 81 }; | 16 }; |
| 82 | 17 |
| 83 } // namespace ppapi | 18 } // namespace ppapi |
| 84 } // namespace webkit | 19 } // namespace webkit |
| 85 | 20 |
| 86 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ | 21 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| 87 | 22 |
| OLD | NEW |