diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-18 21:18:27 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-18 21:18:27 +0000 |
commit | e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1 (patch) | |
tree | 981d68c305778f15a3dd4a821fd69b359e148450 /ppapi/proxy/ppb_graphics_3d_proxy.h | |
parent | 764b80591d30619821b3c6c78bad6cae8ece82d2 (diff) | |
download | chromium_src-e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1.zip chromium_src-e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1.tar.gz chromium_src-e5eb5c46fa4a9b3412f6dc41cbbc636fe23490f1.tar.bz2 |
Revert 92885 - Completed the implementation for PPB_Graphics3D interface.
- Mostly copied from the implementations for PPB_Surface3D and PPB_Context3D.
- Added the proxy implementation
- Refactored common code between host and plugin side into a common class.
I will send the changes to bind Graphics3D with Instance and OpenGLES2 interface in a separate patch.
BUG=86370,78087
Review URL: http://codereview.chromium.org/6824006
TBR=alokp@chromium.org
Review URL: http://codereview.chromium.org/7398033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_graphics_3d_proxy.h')
-rw-r--r-- | ppapi/proxy/ppb_graphics_3d_proxy.h | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h deleted file mode 100644 index 6ff3a10..0000000 --- a/ppapi/proxy/ppb_graphics_3d_proxy.h +++ /dev/null @@ -1,125 +0,0 @@ -// 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 PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ -#define PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ - -#include <vector> - -#include "base/shared_memory.h" -#include "gpu/command_buffer/common/command_buffer.h" -#include "ppapi/c/dev/pp_graphics_3d_dev.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/proxy/interface_proxy.h" -#include "ppapi/proxy/plugin_resource.h" -#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" -#include "ppapi/shared_impl/graphics_3d_impl.h" - -namespace pp { -namespace proxy { - -class HostResource; - -class Graphics3D : public PluginResource, - public ppapi::Graphics3DImpl { - public: - explicit Graphics3D(const HostResource& resource); - virtual ~Graphics3D(); - - bool Init(); - - // PluginResource overrides. - virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE { - return this; - } - - // Graphics3DTrusted API. These are not implemented in the proxy. - virtual PP_Bool InitCommandBuffer(int32_t size) OVERRIDE; - virtual PP_Bool GetRingBuffer(int* shm_handle, uint32_t* shm_size) OVERRIDE; - virtual PP_Graphics3DTrustedState GetState() OVERRIDE; - virtual PP_Bool Flush(int32_t put_offset) OVERRIDE; - virtual PP_Graphics3DTrustedState FlushSync(int32_t put_offset) OVERRIDE; - virtual int32_t CreateTransferBuffer(uint32_t size) 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_Graphics3DTrustedState FlushSyncFast( - int32_t put_offset, - int32_t last_known_get) OVERRIDE; - - protected: - // ppapi::Graphics3DImpl overrides. - virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; - virtual int32 DoSwapBuffers() OVERRIDE; - - private: - scoped_ptr<gpu::CommandBuffer> command_buffer_; - - DISALLOW_COPY_AND_ASSIGN(Graphics3D); -}; - -class PPB_Graphics3D_Proxy : public InterfaceProxy { - public: - PPB_Graphics3D_Proxy(Dispatcher* dispatcher, const void* target_interface); - virtual ~PPB_Graphics3D_Proxy(); - - static const Info* GetInfo(); - - static PP_Resource CreateProxyResource(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list); - - const PPB_Graphics3D_Dev* ppb_graphics_3d_target() const { - return static_cast<const PPB_Graphics3D_Dev*>(target_interface()); - } - - // InterfaceProxy implementation. - virtual bool OnMessageReceived(const IPC::Message& msg); - - private: - void OnMsgCreate(PP_Instance instance, - PP_Config3D_Dev config, - const std::vector<int32_t>& attribs, - HostResource* result); - void OnMsgInitCommandBuffer(const HostResource& context, - int32 size, - base::SharedMemoryHandle* ring_buffer); - void OnMsgGetState(const HostResource& context, - gpu::CommandBuffer::State* state); - void OnMsgFlush(const HostResource& context, - int32 put_offset, - int32 last_known_get, - gpu::CommandBuffer::State* state); - void OnMsgAsyncFlush(const HostResource& context, - int32 put_offset); - void OnMsgCreateTransferBuffer(const HostResource& context, - int32 size, - int32* id); - void OnMsgDestroyTransferBuffer(const HostResource& context, - int32 id); - void OnMsgGetTransferBuffer(const HostResource& context, - int32 id, - base::SharedMemoryHandle* transfer_buffer, - uint32* size); - void OnMsgSwapBuffers(const HostResource& context); - // Renderer->plugin message handlers. - void OnMsgSwapBuffersACK(const HostResource& context, int32_t pp_error); - - void SendSwapBuffersACKToPlugin(int32_t result, - const HostResource& context); - - CompletionCallbackFactory<PPB_Graphics3D_Proxy, - ProxyNonThreadSafeRefCount> callback_factory_; - - DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); -}; - -} // namespace proxy -} // namespace pp - -#endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ - |