#define CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
#include "base/memory/weak_ptr.h"
+#include "gpu/command_buffer/common/mailbox.h"
#include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
#include "ppapi/shared_impl/resource.h"
namespace content {
-class PlatformContext3D;
+class CommandBufferProxyImpl;
+class GpuChannelHost;
class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared {
public:
// PPB_Graphics3D_API trusted implementation.
virtual PP_Bool SetGetBuffer(int32_t transfer_buffer_id) OVERRIDE;
- virtual gpu::CommandBuffer::State GetState() OVERRIDE;
- virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
+ virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size,
+ int32* id) OVERRIDE;
virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
- virtual PP_Bool GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) OVERRIDE;
virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start,
int32_t end) OVERRIDE;
void ViewInitiatedPaint();
void ViewFlushedPaint();
- PlatformContext3D* platform_context() { return platform_context_.get(); }
+ void GetBackingMailbox(gpu::Mailbox* mailbox, uint32* sync_point) {
+ *mailbox = mailbox_;
+ *sync_point = sync_point_;
+ }
+
+ int GetCommandBufferRouteId();
+
+ GpuChannelHost* channel() { return channel_; }
protected:
virtual ~PPB_Graphics3D_Impl();
private:
explicit PPB_Graphics3D_Impl(PP_Instance instance);
- bool Init(PPB_Graphics3D_API* share_context,
- const int32_t* attrib_list);
- bool InitRaw(PPB_Graphics3D_API* share_context,
- const int32_t* attrib_list);
+ bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list);
+ bool InitRaw(PPB_Graphics3D_API* share_context, const int32_t* attrib_list);
// Notifications received from the GPU process.
void OnSwapBuffers();
bool bound_to_instance_;
// True when waiting for compositor to commit our backing texture.
bool commit_pending_;
- // The 3D Context. Responsible for providing the command buffer.
- scoped_ptr<PlatformContext3D> platform_context_;
+
+ gpu::Mailbox mailbox_;
+ uint32 sync_point_;
+ bool has_alpha_;
+ scoped_refptr<GpuChannelHost> channel_;
+ CommandBufferProxyImpl* command_buffer_;
+
base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);