Index: webkit/plugins/ppapi/ppb_graphics_3d_impl.h |
=================================================================== |
--- webkit/plugins/ppapi/ppb_graphics_3d_impl.h (revision 80830) |
+++ webkit/plugins/ppapi/ppb_graphics_3d_impl.h (working copy) |
@@ -1,13 +1,26 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
#define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
+#include "base/memory/scoped_callback_factory.h" |
+#include "base/memory/scoped_ptr.h" |
#include "ppapi/c/dev/ppb_graphics_3d_dev.h" |
+#include "webkit/plugins/ppapi/plugin_delegate.h" |
#include "webkit/plugins/ppapi/resource.h" |
+struct PPB_Context3DTrusted_Dev; |
+ |
+namespace gpu { |
+class CommandBuffer; |
+namespace gles2 { |
+class GLES2CmdHelper; |
+class GLES2Implementation; |
+} // namespace gles2 |
+} // namespace gpu |
+ |
namespace webkit { |
namespace ppapi { |
@@ -17,6 +30,8 @@ |
virtual ~PPB_Graphics3D_Impl(); |
static const PPB_Graphics3D_Dev* GetInterface(); |
+ // TODO(alokp): Rename PPB_Context3DTrusted_Dev to PPB_Graphics3DTrusted_Dev. |
+ static const PPB_Context3DTrusted_Dev* GetTrustedInterface(); |
// Resource override. |
virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl(); |
@@ -24,8 +39,53 @@ |
bool Init(PP_Config3D_Dev config, |
PP_Resource share_context, |
const int32_t* attrib_list); |
+ bool InitRaw(PP_Config3D_Dev config, |
+ PP_Resource share_context, |
+ const int32_t* attrib_list); |
+ PluginDelegate::PlatformContext3D* platform_context() { |
+ return platform_context_.get(); |
+ } |
+ gpu::gles2::GLES2Implementation* gles2_impl() { |
+ return gles2_impl_.get(); |
+ } |
+ gpu::CommandBuffer* GetCommandBuffer(); |
+ unsigned int GetBackingTextureId(); |
+ |
+ // Binds/unbinds the graphics of this surface with the associated instance. |
+ // If the surface is bound, anything drawn on the surface appears on instance |
+ // window. Returns true if binding/unbinding is successful. |
+ bool BindToInstance(bool bind); |
+ |
+ void ViewInitiatedPaint(); |
+ void ViewFlushedPaint(); |
+ int32_t SwapBuffers(PP_CompletionCallback callback); |
+ |
private: |
+ bool CreateImplementation(); |
+ void OnSwapBuffers(); |
+ void OnContextLost(); |
+ void SendSwapBuffers(); |
+ void SendContextLost(); |
+ |
+ // True if the context is bound to plugin instance. |
+ bool bound_to_instance_; |
+ |
+ // PluginDelegate's 3D Context. Responsible for providing the command buffer. |
+ scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; |
+ |
+ int32 transfer_buffer_id_; |
+ scoped_ptr<gpu::gles2::GLES2CmdHelper> command_buffer_helper_; |
+ scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
+ |
+ // True when the compositor has been asked to commit texture but has |
+ // not returned yet. |
+ bool commit_initiated_; |
+ // Callback provided by the plugin that needs to be called at the |
+ // completion of swap buffers. |
+ PP_CompletionCallback swap_callback_; |
+ base::ScopedCallbackFactory<PPB_Graphics3D_Impl> callback_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
}; |