summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 06:47:09 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 06:47:09 +0000
commit88cc7818c81afdcb418f8fd0486b2c8f57457525 (patch)
treee31e7bc875da0d45ecdf8db3bb703f80a354d861 /ppapi/proxy
parent62df0a016209f927a61b76cf85f98c68aeea141f (diff)
downloadchromium_src-88cc7818c81afdcb418f8fd0486b2c8f57457525.zip
chromium_src-88cc7818c81afdcb418f8fd0486b2c8f57457525.tar.gz
chromium_src-88cc7818c81afdcb418f8fd0486b2c8f57457525.tar.bz2
Remove Context3D/Surface3D
Graphics3D is the new black. BUG=None TEST=None Review URL: http://codereview.chromium.org/8676042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112412 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/interface_list.cc4
-rw-r--r--ppapi/proxy/ppapi_messages.h61
-rw-r--r--ppapi/proxy/ppb_context_3d_proxy.cc701
-rw-r--r--ppapi/proxy/ppb_context_3d_proxy.h141
-rw-r--r--ppapi/proxy/ppb_surface_3d_proxy.cc194
-rw-r--r--ppapi/proxy/ppb_surface_3d_proxy.h99
-rw-r--r--ppapi/proxy/ppb_video_decoder_proxy.cc29
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc30
-rw-r--r--ppapi/proxy/resource_creation_proxy.h11
9 files changed, 8 insertions, 1262 deletions
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 8893168..4e126a9 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -9,7 +9,6 @@
#include "ppapi/c/dev/ppb_buffer_dev.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
#include "ppapi/c/dev/ppb_console_dev.h"
-#include "ppapi/c/dev/ppb_context_3d_dev.h"
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
@@ -17,7 +16,6 @@
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_ime_input_event_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_surface_3d_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
@@ -61,7 +59,6 @@
#include "ppapi/proxy/ppb_audio_proxy.h"
#include "ppapi/proxy/ppb_broker_proxy.h"
#include "ppapi/proxy/ppb_buffer_proxy.h"
-#include "ppapi/proxy/ppb_context_3d_proxy.h"
#include "ppapi/proxy/ppb_core_proxy.h"
#include "ppapi/proxy/ppb_cursor_control_proxy.h"
#include "ppapi/proxy/ppb_file_chooser_proxy.h"
@@ -78,7 +75,6 @@
#include "ppapi/proxy/ppb_image_data_proxy.h"
#include "ppapi/proxy/ppb_instance_proxy.h"
#include "ppapi/proxy/ppb_pdf_proxy.h"
-#include "ppapi/proxy/ppb_surface_3d_proxy.h"
#include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_testing_proxy.h"
#include "ppapi/proxy/ppb_text_input_proxy.h"
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 01c8d50..c78cf26 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -313,11 +313,6 @@ IPC_MESSAGE_ROUTED2(PpapiMsg_PPBInstance_MouseLockComplete,
PP_Instance /* instance */,
int32_t /* result */)
-// PPB_Surface3D.
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPBSurface3D_SwapBuffersACK,
- ppapi::HostResource /* surface_3d */,
- int32_t /* pp_error */)
-
// PPP_Class.
IPC_SYNC_MESSAGE_ROUTED3_2(PpapiMsg_PPPClass_HasProperty,
int64 /* ppp_class */,
@@ -522,53 +517,6 @@ IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBBuffer_Create,
ppapi::HostResource /* result_resource */,
base::SharedMemoryHandle /* result_shm_handle */)
-// PPB_Context3D.
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBContext3D_Create,
- PP_Instance /* instance */,
- int32_t /* config */,
- std::vector<int32_t> /* attrib_list */,
- ppapi::HostResource /* result */)
-
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBContext3D_BindSurfaces,
- ppapi::HostResource /* context */,
- ppapi::HostResource /* draw */,
- ppapi::HostResource /* read */,
- int32_t /* result */)
-
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBContext3D_Initialize,
- ppapi::HostResource /* context */,
- int32 /* size */,
- base::SharedMemoryHandle /* ring_buffer */)
-
-IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBContext3D_GetState,
- ppapi::HostResource /* context */,
- gpu::CommandBuffer::State /* state */)
-
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBContext3D_Flush,
- ppapi::HostResource /* context */,
- int32 /* put_offset */,
- int32 /* last_known_get */,
- gpu::CommandBuffer::State /* state */)
-
-IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBContext3D_AsyncFlush,
- ppapi::HostResource /* context */,
- int32 /* put_offset */)
-
-IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBContext3D_CreateTransferBuffer,
- ppapi::HostResource /* context */,
- int32 /* size */,
- int32 /* id */)
-
-IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBContext3D_DestroyTransferBuffer,
- ppapi::HostResource /* context */,
- int32 /* id */)
-
-IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBContext3D_GetTransferBuffer,
- ppapi::HostResource /* context */,
- int32 /* id */,
- base::SharedMemoryHandle /* transfer_buffer */,
- uint32 /* size */)
-
// PPB_Core.
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBCore_AddRefResource,
ppapi::HostResource)
@@ -958,15 +906,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(
uint32_t /* table */,
std::string /* result */)
-// PPB_Surface3D.
-IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBSurface3D_Create,
- PP_Instance /* instance */,
- int32_t /* config */,
- std::vector<int32_t> /* attrib_list */,
- ppapi::HostResource /* result */)
-IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBSurface3D_SwapBuffers,
- ppapi::HostResource /* surface_3d */)
-
// PPB_Testing.
IPC_SYNC_MESSAGE_ROUTED3_1(
PpapiHostMsg_PPBTesting_ReadImageData,
diff --git a/ppapi/proxy/ppb_context_3d_proxy.cc b/ppapi/proxy/ppb_context_3d_proxy.cc
deleted file mode 100644
index dd8b030..0000000
--- a/ppapi/proxy/ppb_context_3d_proxy.cc
+++ /dev/null
@@ -1,701 +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.
-
-#include "ppapi/proxy/ppb_context_3d_proxy.h"
-
-#include "base/hash_tables.h"
-#include "gpu/command_buffer/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/dev/ppb_context_3d_dev.h"
-#include "ppapi/c/dev/ppb_context_3d_trusted_dev.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_surface_3d_proxy.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::EnterFunctionNoLock;
-using ppapi::thunk::EnterResourceNoLock;
-using ppapi::thunk::PPB_Context3D_API;
-using ppapi::thunk::PPB_Surface3D_API;
-using ppapi::thunk::ResourceCreationAPI;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-base::SharedMemoryHandle TransportSHMHandleFromInt(Dispatcher* dispatcher,
- int shm_handle) {
- // TODO(piman): Change trusted interface to return a PP_FileHandle, those
- // casts are ugly.
- base::PlatformFile source =
-#if defined(OS_WIN)
- reinterpret_cast<HANDLE>(static_cast<intptr_t>(shm_handle));
-#elif defined(OS_POSIX)
- shm_handle;
-#else
- #error Not implemented.
-#endif
- // Don't close the handle, it doesn't belong to us.
- return dispatcher->ShareHandleWithRemote(source, false);
-}
-
-PP_Context3DTrustedState GetErrorState() {
- PP_Context3DTrustedState error_state = { 0 };
- error_state.error = kGenericError;
- return error_state;
-}
-
-gpu::CommandBuffer::State GPUStateFromPPState(
- const PP_Context3DTrustedState& s) {
- gpu::CommandBuffer::State state;
- state.num_entries = s.num_entries;
- state.get_offset = s.get_offset;
- state.put_offset = s.put_offset;
- state.token = s.token;
- state.error = static_cast<gpu::error::Error>(s.error);
- state.generation = s.generation;
- return state;
-}
-
-// Size of the transfer buffer.
-const int32 kCommandBufferSize = 1024 * 1024;
-const int32 kTransferBufferSize = 1024 * 1024;
-
-} // namespace
-
-class PepperCommandBuffer : public gpu::CommandBuffer {
- public:
- PepperCommandBuffer(const HostResource& resource,
- PluginDispatcher* dispatcher);
- virtual ~PepperCommandBuffer();
-
- // CommandBuffer implementation:
- virtual bool Initialize(int32 size);
- virtual bool Initialize(base::SharedMemory* buffer, int32 size);
- virtual gpu::Buffer GetRingBuffer();
- virtual State GetState();
- virtual State GetLastState();
- virtual void Flush(int32 put_offset);
- virtual State FlushSync(int32 put_offset, int32 last_known_get);
- virtual void SetGetOffset(int32 get_offset);
- virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
- virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
- size_t size,
- int32 id_request);
- virtual void DestroyTransferBuffer(int32 id);
- virtual gpu::Buffer GetTransferBuffer(int32 handle);
- virtual void SetToken(int32 token);
- virtual void SetParseError(gpu::error::Error error);
- virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
-
- private:
- bool Send(IPC::Message* msg);
- void UpdateState(const gpu::CommandBuffer::State& state);
-
- int32 num_entries_;
- scoped_ptr<base::SharedMemory> ring_buffer_;
-
- typedef base::hash_map<int32, gpu::Buffer> TransferBufferMap;
- TransferBufferMap transfer_buffers_;
-
- State last_state_;
-
- HostResource resource_;
- PluginDispatcher* dispatcher_;
-
- DISALLOW_COPY_AND_ASSIGN(PepperCommandBuffer);
-};
-
-PepperCommandBuffer::PepperCommandBuffer(
- const HostResource& resource,
- PluginDispatcher* dispatcher)
- : num_entries_(0),
- resource_(resource),
- dispatcher_(dispatcher) {
-}
-
-PepperCommandBuffer::~PepperCommandBuffer() {
- // Delete all the locally cached shared memory objects, closing the handle
- // in this process.
- for (TransferBufferMap::iterator it = transfer_buffers_.begin();
- it != transfer_buffers_.end();
- ++it) {
- delete it->second.shared_memory;
- it->second.shared_memory = NULL;
- }
-}
-
-bool PepperCommandBuffer::Initialize(int32 size) {
- DCHECK(!ring_buffer_.get());
-
- // Initialize the service. Assuming we are sandboxed, the GPU
- // process is responsible for duplicating the handle. This might not be true
- // for NaCl.
- base::SharedMemoryHandle handle;
- if (Send(new PpapiHostMsg_PPBContext3D_Initialize(
- API_ID_PPB_CONTEXT_3D, resource_, size, &handle)) &&
- base::SharedMemory::IsHandleValid(handle)) {
- ring_buffer_.reset(new base::SharedMemory(handle, false));
- if (ring_buffer_->Map(size)) {
- num_entries_ = size / sizeof(gpu::CommandBufferEntry);
- return true;
- }
-
- ring_buffer_.reset();
- }
-
- return false;
-}
-
-bool PepperCommandBuffer::Initialize(base::SharedMemory* buffer, int32 size) {
- // Not implemented in proxy.
- NOTREACHED();
- return false;
-}
-
-gpu::Buffer PepperCommandBuffer::GetRingBuffer() {
- // Return locally cached ring buffer.
- gpu::Buffer buffer;
- buffer.ptr = ring_buffer_->memory();
- buffer.size = num_entries_ * sizeof(gpu::CommandBufferEntry);
- buffer.shared_memory = ring_buffer_.get();
- return buffer;
-}
-
-gpu::CommandBuffer::State PepperCommandBuffer::GetState() {
- // Send will flag state with lost context if IPC fails.
- if (last_state_.error == gpu::error::kNoError) {
- gpu::CommandBuffer::State state;
- if (Send(new PpapiHostMsg_PPBContext3D_GetState(
- API_ID_PPB_CONTEXT_3D, resource_, &state)))
- UpdateState(state);
- }
-
- return last_state_;
-}
-
-gpu::CommandBuffer::State PepperCommandBuffer::GetLastState() {
- return last_state_;
-}
-
-void PepperCommandBuffer::Flush(int32 put_offset) {
- if (last_state_.error != gpu::error::kNoError)
- return;
-
- IPC::Message* message = new PpapiHostMsg_PPBContext3D_AsyncFlush(
- API_ID_PPB_CONTEXT_3D, resource_, put_offset);
-
- // Do not let a synchronous flush hold up this message. If this handler is
- // deferred until after the synchronous flush completes, it will overwrite the
- // cached last_state_ with out-of-date data.
- message->set_unblock(true);
- Send(message);
-}
-
-gpu::CommandBuffer::State PepperCommandBuffer::FlushSync(
- int32 put_offset, int32 last_known_get) {
- if (last_known_get == last_state_.get_offset) {
- // Send will flag state with lost context if IPC fails.
- if (last_state_.error == gpu::error::kNoError) {
- gpu::CommandBuffer::State state;
- if (Send(new PpapiHostMsg_PPBContext3D_Flush(
- API_ID_PPB_CONTEXT_3D, resource_, put_offset,
- last_known_get, &state)))
- UpdateState(state);
- }
- } else {
- Flush(put_offset);
- }
-
- return last_state_;
-}
-
-void PepperCommandBuffer::SetGetOffset(int32 get_offset) {
- // Not implemented in proxy.
- NOTREACHED();
-}
-
-int32 PepperCommandBuffer::CreateTransferBuffer(size_t size, int32 id_request) {
- if (last_state_.error == gpu::error::kNoError) {
- int32 id;
- if (Send(new PpapiHostMsg_PPBContext3D_CreateTransferBuffer(
- API_ID_PPB_CONTEXT_3D, resource_, size, &id))) {
- return id;
- }
- }
-
- return -1;
-}
-
-int32 PepperCommandBuffer::RegisterTransferBuffer(
- base::SharedMemory* shared_memory,
- size_t size,
- int32 id_request) {
- // Not implemented in proxy.
- NOTREACHED();
- return -1;
-}
-
-void PepperCommandBuffer::DestroyTransferBuffer(int32 id) {
- if (last_state_.error != gpu::error::kNoError)
- return;
-
- // Remove the transfer buffer from the client side4 cache.
- TransferBufferMap::iterator it = transfer_buffers_.find(id);
- DCHECK(it != transfer_buffers_.end());
-
- // Delete the shared memory object, closing the handle in this process.
- delete it->second.shared_memory;
-
- transfer_buffers_.erase(it);
-
- Send(new PpapiHostMsg_PPBContext3D_DestroyTransferBuffer(
- API_ID_PPB_CONTEXT_3D, resource_, id));
-}
-
-gpu::Buffer PepperCommandBuffer::GetTransferBuffer(int32 id) {
- if (last_state_.error != gpu::error::kNoError)
- return gpu::Buffer();
-
- // Check local cache to see if there is already a client side shared memory
- // object for this id.
- TransferBufferMap::iterator it = transfer_buffers_.find(id);
- if (it != transfer_buffers_.end()) {
- return it->second;
- }
-
- // Assuming we are in the renderer process, the service is responsible for
- // duplicating the handle. This might not be true for NaCl.
- base::SharedMemoryHandle handle;
- uint32 size;
- if (!Send(new PpapiHostMsg_PPBContext3D_GetTransferBuffer(
- API_ID_PPB_CONTEXT_3D, resource_, id, &handle, &size))) {
- return gpu::Buffer();
- }
-
- // Cache the transfer buffer shared memory object client side.
- scoped_ptr<base::SharedMemory> shared_memory(
- new base::SharedMemory(handle, false));
-
- // Map the shared memory on demand.
- if (!shared_memory->memory()) {
- if (!shared_memory->Map(size)) {
- return gpu::Buffer();
- }
- }
-
- gpu::Buffer buffer;
- buffer.ptr = shared_memory->memory();
- buffer.size = size;
- buffer.shared_memory = shared_memory.release();
- transfer_buffers_[id] = buffer;
-
- return buffer;
-}
-
-void PepperCommandBuffer::SetToken(int32 token) {
- NOTREACHED();
-}
-
-void PepperCommandBuffer::SetParseError(gpu::error::Error error) {
- NOTREACHED();
-}
-
-void PepperCommandBuffer::SetContextLostReason(
- gpu::error::ContextLostReason reason) {
- NOTREACHED();
-}
-
-bool PepperCommandBuffer::Send(IPC::Message* msg) {
- DCHECK(last_state_.error == gpu::error::kNoError);
-
- if (dispatcher_->Send(msg))
- return true;
-
- last_state_.error = gpu::error::kLostContext;
- return false;
-}
-
-void PepperCommandBuffer::UpdateState(const gpu::CommandBuffer::State& state) {
- // Handle wraparound. It works as long as we don't have more than 2B state
- // updates in flight across which reordering occurs.
- if (state.generation - last_state_.generation < 0x80000000U)
- last_state_ = state;
-}
-
-// Context3D -------------------------------------------------------------------
-
-Context3D::Context3D(const HostResource& resource)
- : Resource(resource),
- draw_(NULL),
- read_(NULL),
- transfer_buffer_id_(0) {
-}
-
-Context3D::~Context3D() {
- if (draw_)
- draw_->set_context(NULL);
-}
-
-PPB_Context3D_API* Context3D::AsPPB_Context3D_API() {
- return this;
-}
-
-bool Context3D::CreateImplementation() {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this);
- if (!dispatcher)
- return false;
-
- command_buffer_.reset(new PepperCommandBuffer(host_resource(), dispatcher));
-
- if (!command_buffer_->Initialize(kCommandBufferSize))
- return false;
-
- helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get()));
- if (!helper_->Initialize(kCommandBufferSize))
- return false;
-
- transfer_buffer_id_ =
- command_buffer_->CreateTransferBuffer(kTransferBufferSize, -1);
- if (transfer_buffer_id_ < 0)
- return false;
-
- gpu::Buffer transfer_buffer =
- command_buffer_->GetTransferBuffer(transfer_buffer_id_);
- if (!transfer_buffer.ptr)
- return false;
-
- gles2_impl_.reset(new gpu::gles2::GLES2Implementation(
- helper_.get(),
- transfer_buffer.size,
- transfer_buffer.ptr,
- transfer_buffer_id_,
- false,
- true));
-
- return true;
-}
-
-int32_t Context3D::GetAttrib(int32_t attribute, int32_t* value) {
- // TODO(alokp): Implement me.
- return 0;
-}
-
-int32_t Context3D::BindSurfaces(PP_Resource pp_draw, PP_Resource pp_read) {
- // TODO(alokp): Support separate draw-read surfaces.
- DCHECK_EQ(pp_draw, pp_read);
- if (pp_draw != pp_read)
- return PP_ERROR_BADARGUMENT;
-
- EnterResourceNoLock<PPB_Surface3D_API> enter_draw(pp_draw, false);
- EnterResourceNoLock<PPB_Surface3D_API> enter_read(pp_read, false);
- Surface3D* draw_surface = enter_draw.succeeded() ?
- static_cast<Surface3D*>(enter_draw.object()) : NULL;
- Surface3D* read_surface = enter_read.succeeded() ?
- static_cast<Surface3D*>(enter_read.object()) : NULL;
-
- if (pp_draw && !draw_surface)
- return PP_ERROR_BADRESOURCE;
- if (pp_read && !read_surface)
- return PP_ERROR_BADRESOURCE;
- HostResource host_draw =
- draw_surface ? draw_surface->host_resource() : HostResource();
- HostResource host_read =
- read_surface ? read_surface->host_resource() : HostResource();
-
- int32_t result;
- PluginDispatcher::GetForResource(this)->Send(
- new PpapiHostMsg_PPBContext3D_BindSurfaces(
- API_ID_PPB_CONTEXT_3D,
- host_resource(), host_draw, host_read, &result));
- if (result != PP_OK)
- return result;
-
- if (draw_surface != draw_) {
- if (draw_)
- draw_->set_context(NULL);
- if (draw_surface) {
- draw_surface->set_context(this);
- // Resize the backing texture to the size of the instance when it is
- // bound.
- // TODO(alokp): This should be the responsibility of plugins.
- InstanceData* data =
- PluginDispatcher::GetForResource(this)->GetInstanceData(
- pp_instance());
- gles2_impl()->ResizeCHROMIUM(data->position.size.width,
- data->position.size.height);
- }
- draw_ = draw_surface;
- }
- read_ = read_surface;
- return PP_OK;
-}
-
-int32_t Context3D::GetBoundSurfaces(PP_Resource* draw, PP_Resource* read) {
- *draw = draw_ ? draw_->pp_resource() : 0;
- *read = read_ ? read_->pp_resource() : 0;
- return PP_OK;
-}
-
-PP_Bool Context3D::InitializeTrusted(int32_t size) {
- // Trusted interface not implemented in the proxy.
- return PP_FALSE;
-}
-
-PP_Bool Context3D::GetRingBuffer(int* shm_handle,
- uint32_t* shm_size) {
- // Trusted interface not implemented in the proxy.
- return PP_FALSE;
-}
-
-PP_Context3DTrustedState Context3D::GetState() {
- // Trusted interface not implemented in the proxy.
- return GetErrorState();
-}
-
-PP_Bool Context3D::Flush(int32_t put_offset) {
- // Trusted interface not implemented in the proxy.
- return PP_FALSE;
-}
-
-PP_Context3DTrustedState Context3D::FlushSync(int32_t put_offset) {
- // Trusted interface not implemented in the proxy.
- return GetErrorState();
-}
-
-int32_t Context3D::CreateTransferBuffer(uint32_t size) {
- // Trusted interface not implemented in the proxy.
- return 0;
-}
-
-PP_Bool Context3D::DestroyTransferBuffer(int32_t id) {
- // Trusted interface not implemented in the proxy.
- return PP_FALSE;
-}
-
-PP_Bool Context3D::GetTransferBuffer(int32_t id,
- int* shm_handle,
- uint32_t* shm_size) {
- // Trusted interface not implemented in the proxy.
- return PP_FALSE;
-}
-
-PP_Context3DTrustedState Context3D::FlushSyncFast(int32_t put_offset,
- int32_t last_known_get) {
- // Trusted interface not implemented in the proxy.
- return GetErrorState();
-}
-
-void* Context3D::MapTexSubImage2DCHROMIUM(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLenum access) {
- return gles2_impl_->MapTexSubImage2DCHROMIUM(
- target, level, xoffset, yoffset, width, height, format, type, access);
-}
-
-void Context3D::UnmapTexSubImage2DCHROMIUM(const void* mem) {
- gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem);
-}
-
-gpu::gles2::GLES2Implementation* Context3D::GetGLES2Impl() {
- return gles2_impl();
-}
-
-// PPB_Context3D_Proxy ---------------------------------------------------------
-
-PPB_Context3D_Proxy::PPB_Context3D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher) {
-}
-
-PPB_Context3D_Proxy::~PPB_Context3D_Proxy() {
-}
-
-// static
-PP_Resource PPB_Context3D_Proxy::Create(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
- if (!dispatcher)
- return PP_ERROR_BADARGUMENT;
-
- // TODO(alokp): Support shared context.
- DCHECK_EQ(0, share_context);
- if (share_context != 0)
- return 0;
-
- std::vector<int32_t> attribs;
- if (attrib_list) {
- for (const int32_t* attr = attrib_list; attr; ++attr)
- attribs.push_back(*attr);
- } else {
- attribs.push_back(0);
- }
-
- HostResource result;
- dispatcher->Send(new PpapiHostMsg_PPBContext3D_Create(
- API_ID_PPB_CONTEXT_3D, instance, config, attribs, &result));
-
- if (result.is_null())
- return 0;
- scoped_refptr<Context3D> context_3d(new Context3D(result));
- if (!context_3d->CreateImplementation())
- return 0;
- return context_3d->GetReference();
-}
-
-bool PPB_Context3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PPB_Context3D_Proxy, msg)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Create,
- OnMsgCreate)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_BindSurfaces,
- OnMsgBindSurfaces)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Initialize,
- OnMsgInitialize)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_GetState,
- OnMsgGetState)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_Flush,
- OnMsgFlush)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_AsyncFlush,
- OnMsgAsyncFlush)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_CreateTransferBuffer,
- OnMsgCreateTransferBuffer)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_DestroyTransferBuffer,
- OnMsgDestroyTransferBuffer)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBContext3D_GetTransferBuffer,
- OnMsgGetTransferBuffer)
- IPC_MESSAGE_UNHANDLED(handled = false)
-
- IPC_END_MESSAGE_MAP()
- // FIXME(brettw) handle bad messages!
- return handled;
-}
-
-void PPB_Context3D_Proxy::OnMsgCreate(PP_Instance instance,
- PP_Config3D_Dev config,
- const std::vector<int32_t>& attribs,
- HostResource* result) {
- if (attribs.empty() || attribs.back() != 0)
- return; // Bad message.
- thunk::EnterResourceCreation enter(instance);
- if (enter.succeeded()) {
- result->SetHostResource(
- instance,
- enter.functions()->CreateContext3DRaw(instance, config, 0,
- &attribs.front()));
- }
-}
-
-void PPB_Context3D_Proxy::OnMsgBindSurfaces(const HostResource& context,
- const HostResource& draw,
- const HostResource& read,
- int32_t* result) {
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.succeeded()) {
- *result = enter.object()->BindSurfaces(draw.host_resource(),
- read.host_resource());
- } else {
- *result = PP_ERROR_BADRESOURCE;
- }
-}
-
-void PPB_Context3D_Proxy::OnMsgInitialize(
- const HostResource& context,
- int32 size,
- base::SharedMemoryHandle* ring_buffer) {
- *ring_buffer = base::SharedMemory::NULLHandle();
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.failed())
- return;
-
- if (!enter.object()->InitializeTrusted(size))
- return;
-
- int shm_handle;
- uint32_t shm_size;
- if (!enter.object()->GetRingBuffer(&shm_handle, &shm_size))
- return;
- *ring_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle);
-}
-
-void PPB_Context3D_Proxy::OnMsgGetState(const HostResource& context,
- gpu::CommandBuffer::State* state) {
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.failed())
- return;
- PP_Context3DTrustedState pp_state = enter.object()->GetState();
- *state = GPUStateFromPPState(pp_state);
-}
-
-void PPB_Context3D_Proxy::OnMsgFlush(const HostResource& context,
- int32 put_offset,
- int32 last_known_get,
- gpu::CommandBuffer::State* state) {
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.failed())
- return;
- PP_Context3DTrustedState pp_state = enter.object()->FlushSyncFast(
- put_offset, last_known_get);
- *state = GPUStateFromPPState(pp_state);
-}
-
-void PPB_Context3D_Proxy::OnMsgAsyncFlush(const HostResource& context,
- int32 put_offset) {
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.succeeded())
- enter.object()->Flush(put_offset);
-}
-
-void PPB_Context3D_Proxy::OnMsgCreateTransferBuffer(
- const HostResource& context,
- int32 size,
- int32* id) {
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.succeeded())
- *id = enter.object()->CreateTransferBuffer(size);
- else
- *id = 0;
-}
-
-void PPB_Context3D_Proxy::OnMsgDestroyTransferBuffer(
- const HostResource& context,
- int32 id) {
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- if (enter.succeeded())
- enter.object()->DestroyTransferBuffer(id);
-}
-
-void PPB_Context3D_Proxy::OnMsgGetTransferBuffer(
- const HostResource& context,
- int32 id,
- base::SharedMemoryHandle* transfer_buffer,
- uint32* size) {
- *transfer_buffer = base::SharedMemory::NULLHandle();
- *size = 0;
-
- EnterHostFromHostResource<PPB_Context3D_API> enter(context);
- int shm_handle = 0;
- uint32_t shm_size = 0;
- if (enter.succeeded() &&
- enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) {
- *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle);
- *size = shm_size;
- }
-}
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/ppb_context_3d_proxy.h b/ppapi/proxy/ppb_context_3d_proxy.h
deleted file mode 100644
index 4747b4b..0000000
--- a/ppapi/proxy/ppb_context_3d_proxy.h
+++ /dev/null
@@ -1,141 +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_CONTEXT_3D_PROXY_H_
-#define PPAPI_PROXY_PPB_CONTEXT_3D_PROXY_H_
-
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/shared_memory.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "ppapi/c/pp_graphics_3d.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_context_3d_api.h"
-
-namespace gpu {
-class CommandBuffer;
-
-namespace gles2 {
-class GLES2CmdHelper;
-class GLES2Implementation;
-} // namespace gles2
-
-} // namespace gpu
-
-namespace ppapi {
-namespace proxy {
-
-class Surface3D;
-
-class Context3D : public Resource, public thunk::PPB_Context3D_API {
- public:
- explicit Context3D(const HostResource& resource);
- virtual ~Context3D();
-
- // Resource overrides.
- virtual thunk::PPB_Context3D_API* AsPPB_Context3D_API() OVERRIDE;
-
- gpu::gles2::GLES2Implementation* gles2_impl() const {
- return gles2_impl_.get();
- }
-
- // PPB_Context3D_API implementation.
- virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE;
- virtual int32_t BindSurfaces(PP_Resource draw, PP_Resource read) OVERRIDE;
- virtual int32_t GetBoundSurfaces(PP_Resource* draw,
- PP_Resource* read) OVERRIDE;
- virtual PP_Bool InitializeTrusted(int32_t size) OVERRIDE;
- virtual PP_Bool GetRingBuffer(int* shm_handle,
- uint32_t* shm_size) OVERRIDE;
- virtual PP_Context3DTrustedState GetState() OVERRIDE;
- virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
- virtual PP_Context3DTrustedState 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_Context3DTrustedState FlushSyncFast(
- int32_t put_offset,
- int32_t last_known_get) OVERRIDE;
- virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLenum access) OVERRIDE;
- virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE;
- virtual gpu::gles2::GLES2Implementation* GetGLES2Impl() OVERRIDE;
-
- bool CreateImplementation();
-
- private:
- Surface3D* draw_;
- Surface3D* read_;
-
- scoped_ptr<gpu::CommandBuffer> command_buffer_;
- scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_;
- int32 transfer_buffer_id_;
- scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
-
- DISALLOW_COPY_AND_ASSIGN(Context3D);
-};
-
-class PPB_Context3D_Proxy : public InterfaceProxy {
- public:
- explicit PPB_Context3D_Proxy(Dispatcher* dispatcher);
- virtual ~PPB_Context3D_Proxy();
-
- static PP_Resource Create(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list);
-
- // InterfaceProxy implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
-
- static const ApiID kApiID = API_ID_PPB_CONTEXT_3D;
-
- private:
- void OnMsgCreate(PP_Instance instance,
- PP_Config3D_Dev config,
- const std::vector<int32_t>& attribs,
- HostResource* result);
- void OnMsgBindSurfaces(const HostResource& context,
- const HostResource& draw,
- const HostResource& read,
- int32_t* result);
- void OnMsgInitialize(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);
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_PPB_CONTEXT_3D_PROXY_H_
diff --git a/ppapi/proxy/ppb_surface_3d_proxy.cc b/ppapi/proxy/ppb_surface_3d_proxy.cc
deleted file mode 100644
index b61ae6c..0000000
--- a/ppapi/proxy/ppb_surface_3d_proxy.cc
+++ /dev/null
@@ -1,194 +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.
-
-#include "ppapi/proxy/ppb_surface_3d_proxy.h"
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/dev/ppb_surface_3d_dev.h"
-#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_context_3d_proxy.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/resource_creation_api.h"
-#include "ppapi/thunk/thunk.h"
-
-using ppapi::thunk::EnterFunctionNoLock;
-using ppapi::thunk::PPB_Surface3D_API;
-using ppapi::thunk::ResourceCreationAPI;
-
-namespace ppapi {
-namespace proxy {
-
-namespace {
-
-InterfaceProxy* CreateSurface3DProxy(Dispatcher* dispatcher) {
- return new PPB_Surface3D_Proxy(dispatcher);
-}
-
-} // namespace
-
-// Surface3D -------------------------------------------------------------------
-
-Surface3D::Surface3D(const HostResource& host_resource)
- : Resource(host_resource),
- context_(NULL),
- current_flush_callback_(PP_BlockUntilComplete()) {
-}
-
-Surface3D::~Surface3D() {
- if (context_)
- context_->BindSurfaces(0, 0);
-}
-
-PPB_Surface3D_API* Surface3D::AsPPB_Surface3D_API() {
- return this;
-}
-
-int32_t Surface3D::SetAttrib(int32_t attribute, int32_t value) {
- // TODO(alokp): Implement me.
- return 0;
-}
-
-int32_t Surface3D::GetAttrib(int32_t attribute, int32_t* value) {
- // TODO(alokp): Implement me.
- return 0;
-}
-
-int32_t Surface3D::SwapBuffers(PP_CompletionCallback callback) {
- // For now, disallow blocking calls. We'll need to add support for other
- // threads to this later.
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
-
- if (is_flush_pending())
- return PP_ERROR_INPROGRESS; // Can't have >1 flush pending.
-
- if (!context_)
- return PP_ERROR_FAILED;
-
- current_flush_callback_ = callback;
-
- IPC::Message* msg = new PpapiHostMsg_PPBSurface3D_SwapBuffers(
- API_ID_PPB_SURFACE_3D, host_resource());
- msg->set_unblock(true);
- PluginDispatcher::GetForResource(this)->Send(msg);
-
- context_->gles2_impl()->SwapBuffers();
- return PP_OK_COMPLETIONPENDING;
-}
-
-void Surface3D::SwapBuffersACK(int32_t pp_error) {
- PP_RunAndClearCompletionCallback(&current_flush_callback_, pp_error);
-}
-
-// PPB_Surface3D_Proxy ---------------------------------------------------------
-
-PPB_Surface3D_Proxy::PPB_Surface3D_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
-}
-
-PPB_Surface3D_Proxy::~PPB_Surface3D_Proxy() {
-}
-
-// static
-const InterfaceProxy::Info* PPB_Surface3D_Proxy::GetInfo() {
- static const Info info = {
- thunk::GetPPB_Surface3D_Dev_Thunk(),
- PPB_SURFACE_3D_DEV_INTERFACE,
- API_ID_PPB_SURFACE_3D,
- false,
- &CreateSurface3DProxy,
- };
- return &info;
-}
-
-// static
-PP_Resource PPB_Surface3D_Proxy::CreateProxyResource(
- PP_Instance instance,
- PP_Config3D_Dev config,
- const int32_t* attrib_list) {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
- if (!dispatcher)
- return PP_ERROR_BADARGUMENT;
-
- std::vector<int32_t> attribs;
- if (attrib_list) {
- const int32_t* attr = attrib_list;
- while(*attr != PP_GRAPHICS3DATTRIB_NONE) {
- attribs.push_back(*(attr++)); // Attribute.
- attribs.push_back(*(attr++)); // Value.
- }
- }
- attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); // Always terminate.
-
- HostResource result;
- dispatcher->Send(new PpapiHostMsg_PPBSurface3D_Create(
- API_ID_PPB_SURFACE_3D, instance, config, attribs, &result));
-
- if (result.is_null())
- return 0;
- return (new Surface3D(result))->GetReference();
-}
-
-bool PPB_Surface3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PPB_Surface3D_Proxy, msg)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBSurface3D_Create,
- OnMsgCreate)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBSurface3D_SwapBuffers,
- OnMsgSwapBuffers)
-
- IPC_MESSAGE_HANDLER(PpapiMsg_PPBSurface3D_SwapBuffersACK,
- OnMsgSwapBuffersACK)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- // FIXME(brettw) handle bad messages!
- return handled;
-}
-
-void PPB_Surface3D_Proxy::OnMsgCreate(PP_Instance instance,
- PP_Config3D_Dev config,
- const std::vector<int32_t>& attribs,
- HostResource* result) {
- if (attribs.empty() ||
- attribs.size() % 2 != 1 ||
- attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
- return; // Bad message.
-
- thunk::EnterResourceCreation enter(instance);
- if (enter.succeeded()) {
- result->SetHostResource(
- instance,
- enter.functions()->CreateSurface3D(instance, config, &attribs.front()));
- }
-}
-
-void PPB_Surface3D_Proxy::OnMsgSwapBuffers(const HostResource& surface_3d) {
- EnterHostFromHostResourceForceCallback<PPB_Surface3D_API> enter(
- surface_3d, callback_factory_,
- &PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin, surface_3d);
- if (enter.succeeded())
- enter.SetResult(enter.object()->SwapBuffers(enter.callback()));
-}
-
-void PPB_Surface3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource,
- int32_t pp_error) {
- EnterPluginFromHostResource<PPB_Surface3D_API> enter(resource);
- if (enter.succeeded())
- static_cast<Surface3D*>(enter.object())->SwapBuffersACK(pp_error);
-}
-
-void PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin(
- int32_t result,
- const HostResource& surface_3d) {
- dispatcher()->Send(new PpapiMsg_PPBSurface3D_SwapBuffersACK(
- API_ID_PPB_SURFACE_3D, surface_3d, result));
-}
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/ppapi/proxy/ppb_surface_3d_proxy.h b/ppapi/proxy/ppb_surface_3d_proxy.h
deleted file mode 100644
index b9d053d..0000000
--- a/ppapi/proxy/ppb_surface_3d_proxy.h
+++ /dev/null
@@ -1,99 +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_SURFACE_3D_PROXY_H_
-#define PPAPI_PROXY_PPB_SURFACE_3D_PROXY_H_
-
-#include <vector>
-
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_graphics_3d.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/proxy/interface_proxy.h"
-#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_surface_3d_api.h"
-
-namespace ppapi {
-namespace proxy {
-
-class Context3D;
-
-class Surface3D : public ppapi::Resource,
- public ppapi::thunk::PPB_Surface3D_API {
- public:
- explicit Surface3D(const ppapi::HostResource& host_resource);
- virtual ~Surface3D();
-
- // Resource overrides.
- virtual PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE;
-
- // PPB_Surface3D_API implementation.
- virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE;
- virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE;
- virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE;
-
- void SwapBuffersACK(int32_t pp_error);
-
- bool is_flush_pending() const { return !!current_flush_callback_.func; }
-
- PP_CompletionCallback current_flush_callback() const {
- return current_flush_callback_;
- }
-
- void set_context(Context3D* context) {
- context_ = context;
- }
-
- Context3D* context() const { return context_; }
-
- private:
- Context3D* context_;
-
- // In the plugin, this is the current callback set for Flushes. When the
- // callback function pointer is non-NULL, we're waiting for a flush ACK.
- PP_CompletionCallback current_flush_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(Surface3D);
-};
-
-class PPB_Surface3D_Proxy : public InterfaceProxy {
- public:
- explicit PPB_Surface3D_Proxy(Dispatcher* dispatcher);
- virtual ~PPB_Surface3D_Proxy();
-
- static const Info* GetInfo();
-
- static PP_Resource CreateProxyResource(PP_Instance instance,
- PP_Config3D_Dev config,
- const int32_t* attrib_list);
-
- // InterfaceProxy implementation.
- virtual bool OnMessageReceived(const IPC::Message& msg);
-
- static const ApiID kApiID = API_ID_PPB_SURFACE_3D;
-
- private:
- // Message handlers.
- void OnMsgCreate(PP_Instance instance,
- PP_Config3D_Dev config,
- const std::vector<int32_t>& attribs,
- ppapi::HostResource* result);
- void OnMsgSwapBuffers(const ppapi::HostResource& surface);
- // Renderer->plugin message handlers.
- void OnMsgSwapBuffersACK(const ppapi::HostResource& surface,
- int32_t pp_error);
-
- void SendSwapBuffersACKToPlugin(int32_t result,
- const ppapi::HostResource& surface_3d);
-
- pp::CompletionCallbackFactory<PPB_Surface3D_Proxy,
- ProxyNonThreadSafeRefCount> callback_factory_;
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_PPB_SURFACE_3D_PROXY_H_
diff --git a/ppapi/proxy/ppb_video_decoder_proxy.cc b/ppapi/proxy/ppb_video_decoder_proxy.cc
index 8446ca5..91b91c6 100644
--- a/ppapi/proxy/ppb_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppb_video_decoder_proxy.cc
@@ -10,7 +10,6 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppb_buffer_proxy.h"
-#include "ppapi/proxy/ppb_context_3d_proxy.h"
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/resource_creation_api.h"
@@ -18,7 +17,6 @@
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_Buffer_API;
-using ppapi::thunk::PPB_Context3D_API;
using ppapi::thunk::PPB_Graphics3D_API;
using ppapi::thunk::PPB_VideoDecoder_API;
@@ -195,34 +193,23 @@ PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource(
if (!dispatcher)
return 0;
- HostResource host_context;
- gpu::gles2::GLES2Implementation* gles2_impl = NULL;
-
- EnterResourceNoLock<PPB_Context3D_API> enter_context(graphics_context, false);
- if (enter_context.succeeded()) {
- Context3D* context = static_cast<Context3D*>(enter_context.object());
- host_context = context->host_resource();
- gles2_impl = context->gles2_impl();
- } else {
- EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context,
- true);
- if (enter_context.failed())
- return 0;
- Graphics3D* context = static_cast<Graphics3D*>(enter_context.object());
- host_context = context->host_resource();
- gles2_impl = context->gles2_impl();
- }
+ EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context,
+ true);
+ if (enter_context.failed())
+ return 0;
+
+ Graphics3D* context = static_cast<Graphics3D*>(enter_context.object());
HostResource result;
dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create(
API_ID_PPB_VIDEO_DECODER_DEV, instance,
- host_context, profile, &result));
+ context->host_resource(), profile, &result));
if (result.is_null())
return 0;
// Need a scoped_refptr to keep the object alive during the Init call.
scoped_refptr<VideoDecoder> decoder(new VideoDecoder(result));
- decoder->InitCommon(graphics_context, gles2_impl);
+ decoder->InitCommon(graphics_context, context->gles2_impl());
return decoder->GetReference();
}
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index d044745..77936c4 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -14,7 +14,6 @@
#include "ppapi/proxy/ppb_audio_proxy.h"
#include "ppapi/proxy/ppb_buffer_proxy.h"
#include "ppapi/proxy/ppb_broker_proxy.h"
-#include "ppapi/proxy/ppb_context_3d_proxy.h"
#include "ppapi/proxy/ppb_file_chooser_proxy.h"
#include "ppapi/proxy/ppb_file_ref_proxy.h"
#include "ppapi/proxy/ppb_file_system_proxy.h"
@@ -24,7 +23,6 @@
#include "ppapi/proxy/ppb_graphics_2d_proxy.h"
#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
#include "ppapi/proxy/ppb_image_data_proxy.h"
-#include "ppapi/proxy/ppb_surface_3d_proxy.h"
#include "ppapi/proxy/ppb_tcp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_udp_socket_private_proxy.h"
#include "ppapi/proxy/ppb_url_loader_proxy.h"
@@ -109,25 +107,6 @@ PP_Resource ResourceCreationProxy::CreateBuffer(PP_Instance instance,
return PPB_Buffer_Proxy::CreateProxyResource(instance, size);
}
-PP_Resource ResourceCreationProxy::CreateContext3D(
- PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) {
- return PPB_Context3D_Proxy::Create(instance, config, share_context,
- attrib_list);
-}
-
-PP_Resource ResourceCreationProxy::CreateContext3DRaw(
- PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) {
- // Not proxied. The raw creation function is used only in the implementation
- // of the proxy on the host side.
- return 0;
-}
-
PP_Resource ResourceCreationProxy::CreateDirectoryReader(
PP_Resource directory_ref) {
NOTIMPLEMENTED(); // Not proxied yet.
@@ -290,15 +269,6 @@ PP_Resource ResourceCreationProxy::CreateScrollbar(PP_Instance instance,
return 0;
}
-PP_Resource ResourceCreationProxy::CreateSurface3D(
- PP_Instance instance,
- PP_Config3D_Dev config,
- const int32_t* attrib_list) {
- return PPB_Surface3D_Proxy::CreateProxyResource(instance, config,
- attrib_list);
-}
-
-
PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate(
PP_Instance instance) {
return PPB_TCPSocket_Private_Proxy::CreateProxyResource(instance);
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 370ac9e..5d3eb66 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -55,14 +55,6 @@ class ResourceCreationProxy : public InterfaceProxy,
virtual PP_Resource CreateBroker(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateBuffer(PP_Instance instance,
uint32_t size) OVERRIDE;
- virtual PP_Resource CreateContext3D(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) OVERRIDE;
- virtual PP_Resource CreateContext3DRaw(PP_Instance instance,
- PP_Config3D_Dev config,
- PP_Resource share_context,
- const int32_t* attrib_list) OVERRIDE;
virtual PP_Resource CreateDirectoryReader(PP_Resource directory_ref) OVERRIDE;
virtual PP_Resource CreateFileChooser(
PP_Instance instance,
@@ -110,9 +102,6 @@ class ResourceCreationProxy : public InterfaceProxy,
const PP_Point* mouse_movement) OVERRIDE;
virtual PP_Resource CreateScrollbar(PP_Instance instance,
PP_Bool vertical) OVERRIDE;
- virtual PP_Resource CreateSurface3D(PP_Instance instance,
- PP_Config3D_Dev config,
- const int32_t* attrib_list) OVERRIDE;
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateTransport(PP_Instance instance,
const char* name,