diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-01 06:47:09 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-01 06:47:09 +0000 |
commit | 88cc7818c81afdcb418f8fd0486b2c8f57457525 (patch) | |
tree | e31e7bc875da0d45ecdf8db3bb703f80a354d861 | |
parent | 62df0a016209f927a61b76cf85f98c68aeea141f (diff) | |
download | chromium_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
63 files changed, 199 insertions, 3240 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 11e3baa..16fc4d2 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1435,6 +1435,7 @@ _FUNCTION_INFO = { 'get_len_func': 'DoGetShaderiv', 'get_len_enum': 'GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE', 'unit_test': False, + 'extension': True, }, 'GetUniformfv': { 'type': 'Custom', @@ -5689,7 +5690,8 @@ class GLGenerator(object): """Writes the gles2 common utility header.""" enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)') dict = {} - for fname in ['../GLES2/gl2.h', '../GLES2/gl2ext.h']: + for fname in ['../../third_party/khronos/GLES2/gl2.h', + '../../third_party/khronos/GLES2/gl2ext.h']: lines = open(fname).readlines() for line in lines: m = enum_re.match(line) @@ -5779,21 +5781,18 @@ const size_t GLES2Util::enum_to_string_table_len_ = file.Write("#include \"base/logging.h\"\n") file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") file.Write("#include \"ppapi/shared_impl/graphics_3d_impl.h\"\n") - file.Write("#include \"ppapi/thunk/enter.h\"\n") - file.Write("#include \"ppapi/thunk/ppb_context_3d_api.h\"\n\n") + file.Write("#include \"ppapi/thunk/enter.h\"\n\n") file.Write("namespace ppapi {\n\n") file.Write("namespace {\n\n") - file.Write("gpu::gles2::GLES2Implementation* GetGLES(PP_Resource context) {\n") - file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API> enter_g3d(context, false);\n") - file.Write(" if (enter_g3d.succeeded()) {\n") - file.Write(" return static_cast<Graphics3DImpl*>(enter_g3d.object())->gles2_impl();\n") - file.Write(" } else {\n") - file.Write(" thunk::EnterResource<thunk::PPB_Context3D_API> enter_c3d(context, true);\n") - file.Write(" DCHECK(enter_c3d.succeeded());\n") - file.Write(" return enter_c3d.object()->GetGLES2Impl();\n") - file.Write(" }\n") + file.Write("gpu::gles2::GLES2Implementation*" + " GetGLES(PP_Resource context) {\n") + file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>" + " enter_g3d(context, false);\n") + file.Write(" DCHECK(enter_g3d.succeeded());\n") + file.Write(" return static_cast<Graphics3DImpl*>" + "(enter_g3d.object())->gles2_impl();\n") file.Write("}\n\n") for func in self.original_functions: diff --git a/ppapi/api/dev/ppb_video_decoder_dev.idl b/ppapi/api/dev/ppb_video_decoder_dev.idl index 2a205db..257562e 100644 --- a/ppapi/api/dev/ppb_video_decoder_dev.idl +++ b/ppapi/api/dev/ppb_video_decoder_dev.idl @@ -35,7 +35,7 @@ interface PPB_VideoDecoder_Dev { * * Parameters: * |instance| pointer to the plugin instance. - * |context_3d| a PPB_Context3D_Dev resource in which decoding will happen. + * |context| a PPB_Graphics3D resource in which decoding will happen. * |profile| the video stream's format profile. * * The created decoder is returned as PP_Resource. 0 means failure. diff --git a/ppapi/api/dev/ppb_video_layer_dev.idl b/ppapi/api/dev/ppb_video_layer_dev.idl index a98e145..1ec50ec 100644 --- a/ppapi/api/dev/ppb_video_layer_dev.idl +++ b/ppapi/api/dev/ppb_video_layer_dev.idl @@ -43,9 +43,9 @@ enum PP_VideoLayerMode_Dev { /** * PPB_VideoLayer is a mechanism to enhance rendering performance of video - * content. Rendering is generally done by using PPB_Context3D or + * content. Rendering is generally done by using PPB_Graphics3D or * PPB_Graphics2D, however for video content it is redundant to go through - * PPB_Context3D or PPB_Graphics2D. PPB_VideoLayer allows video content to be + * PPB_Graphics3D or PPB_Graphics2D. PPB_VideoLayer allows video content to be * rendered directly. * * PPB_VideoLayer can be used in two modes: diff --git a/ppapi/api/pp_graphics_3d.idl b/ppapi/api/pp_graphics_3d.idl new file mode 100644 index 0000000..97c735c --- /dev/null +++ b/ppapi/api/pp_graphics_3d.idl @@ -0,0 +1,69 @@ +/* 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. + */ + +/** + * This file defines the <code>PP_Graphics3DAttrib</code> enumeration for use in + * PPAPI C headers. + */ + +[assert_size(4)] enum PP_Graphics3DAttrib { + /** + * Bits of Alpha in the color buffer. + */ + PP_GRAPHICS3DATTRIB_ALPHA_SIZE = 0x3021, + /** + * Bits of Blue in the color buffer. + */ + PP_GRAPHICS3DATTRIB_BLUE_SIZE = 0x3022, + /** + * Bits of Green in the color buffer. + */ + PP_GRAPHICS3DATTRIB_GREEN_SIZE = 0x3023, + /** + * Bits of Red in the color buffer. + */ + PP_GRAPHICS3DATTRIB_RED_SIZE = 0x3024, + /** + * Bits of Z in the depth buffer. + */ + PP_GRAPHICS3DATTRIB_DEPTH_SIZE = 0x3025, + /** + * Bits of Stencil in the stencil buffer. + */ + PP_GRAPHICS3DATTRIB_STENCIL_SIZE = 0x3026, + /** + * Number of samples per pixel. + */ + PP_GRAPHICS3DATTRIB_SAMPLES = 0x3031, + /** + * Number of multisample buffers. + */ + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS = 0x3032, + /** + * Attrib list terminator. + */ + PP_GRAPHICS3DATTRIB_NONE = 0x3038, + /** + * Height of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_HEIGHT = 0x3056, + /** + * Width of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_WIDTH = 0x3057, + /** + * Specifies the effect on the color buffer of posting a surface + * with SwapBuffers. The initial value is chosen by the implementation. + */ + PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR = 0x3093, + /** + * Indicates that color buffer contents are unaffected. + */ + PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED = 0x3094, + /** + * Indicates that color buffer contents may be destroyed or changed. + */ + PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED = 0x3095 +}; diff --git a/ppapi/api/private/ppb_flash_fullscreen.idl b/ppapi/api/private/ppb_flash_fullscreen.idl index 59cfb93..6760fad 100644 --- a/ppapi/api/private/ppb_flash_fullscreen.idl +++ b/ppapi/api/private/ppb_flash_fullscreen.idl @@ -23,16 +23,16 @@ interface PPB_FlashFullscreen { * Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on * success, PP_FALSE on failure. * - * This unbinds the current Graphics2D or Surface3D. Pending flushes and + * This unbinds the current Graphics2D or Graphics3D. Pending flushes and * swapbuffers will execute as if the resource was off-screen. The transition * is asynchronous. During the transition, IsFullscreen will return PP_FALSE, - * and no Graphics2D or Surface3D can be bound. The transition ends at the + * and no Graphics2D or Graphics3D can be bound. The transition ends at the * next DidChangeView when going into fullscreen mode. The transition out of * fullscreen mode is synchronous. * - * Note: when switching to and from fullscreen, Context3D and Surface3D - * resources need to be re-created. This is a current limitation that will be - * lifted in a later revision. + * Note: when switching to and from fullscreen, Graphics3D resources need to + * be re-created. This is a current limitation that will be lifted in a later + * revision. */ PP_Bool SetFullscreen( [in] PP_Instance instance, diff --git a/ppapi/c/dev/ppb_context_3d_dev.h b/ppapi/c/dev/ppb_context_3d_dev.h deleted file mode 100644 index 447cdfa..0000000 --- a/ppapi/c/dev/ppb_context_3d_dev.h +++ /dev/null @@ -1,124 +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_C_DEV_PPB_CONTEXT_3D_DEV_H_ -#define PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_graphics_3d.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" - -#define PPB_CONTEXT_3D_DEV_INTERFACE_0_1 "PPB_Context3D(Dev);0.1" -#define PPB_CONTEXT_3D_DEV_INTERFACE PPB_CONTEXT_3D_DEV_INTERFACE_0_1 - -struct PPB_Context3D_Dev { - // Creates and initializes a rendering context and returns a handle to it. - // The context can be used to render to any compatible PPB_Surface3D_Dev. - // - // If share_context is not NULL, then all shareable data, as defined - // by the client API (note that for OpenGL and OpenGL ES, shareable data - // excludes texture objects named 0) will be shared by share_context, all - // other contexts share_context already shares with, and the newly created - // context. An arbitrary number of PPB_Context3D_Dev can share data in - // this fashion. - // - // attrib_list specifies a list of attributes for the context. The list - // has the same structure as described for - // PPB_Graphics3D_Dev::GetConfigAttribs. The only attribute that can be - // specified in attrib_list is PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION, - // and this attribute may only be specified when creating a OpenGL ES context. - // attrib_list may be NULL or empty (first attribute is EGL_NONE), in which - // case attributes assume their default values. - // - // If config is not a valid PP_Config3D_Dev, or does not support - // the requested client API, then an PP_GRAPHICS3DERROR_BAD_CONFIG error is - // generated (this includes requesting creation of an OpenGL ES 1.x context - // when the PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE attribute of config does not - // contain PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_BIT, or creation of an - // OpenGL ES 2.x context when the attribute does not contain - // PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES2_BIT). - // - // On failure Create returns NULL resource. - PP_Resource (*Create)(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list); - - // Returns PP_TRUE if the given resource is a valid PPB_Context3D_Dev, - // PP_FALSE if it is an invalid resource or is a resource of another type. - PP_Bool (*IsContext3D)(PP_Resource resource); - - // Returns in value the value of attribute for context. - // Attributes that can be queried for include: - // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the - // PP_Config3D_Dev with respect to which the context was created. - // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE: returns the type of client API - // this context supports. - // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION: returns the version of the - // client API this context supports, as specified at context creation time. - // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER: returns the buffer which client API - // rendering via this context will use. The value returned depends on - // properties of both the context, and the surface to which the context - // is bound: - // - If the context is bound to a surface, then either - // PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER or - // PP_GRAPHICS3DATTRIBVALUE_SINGLE_BUFFER may be returned. The value - // returned depends on the buffer requested by the setting of the - // PP_GRAPHICS3DATTRIB_RENDER_BUFFER property of the surface. - // - If the context is not bound to a surface, then - // PP_GRAPHICS3DATTRIBVALUE_NONE will be returned. - // - // On failure the following error codes may be returned: - // - PP_GRAPHICS3DERROR_BAD_ATTRIBUTE if attribute is not a valid attribute - // - PP_GRAPHICS3DERROR_BAD_CONTEXT if context is invalid. - int32_t (*GetAttrib)(PP_Resource context, - int32_t attribute, - int32_t* value); - - // Binds context to the draw and read surfaces. - // For an OpenGL or OpenGL ES context, draw is used for all operations except - // for any pixel data read back or copied, which is taken from the frame - // buffer values of read. Note that the same PPB_Surface3D_Dev may be - // specified for both draw and read. - // - // On failure the following error codes may be returned: - // - PP_GRAPHICS3DERROR_BAD_MATCH: if draw or read surfaces are not - // compatible with context. - // - PP_GRAPHICS3DERROR_BAD_ACCESS: if either draw or read is bound to any - // other context. - // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context. - // - PP_GRAPHICS3DERROR_BAD_SURFACE: if either draw or read are not valid - // surfaces. - // - PP_GRAPHICS3DERROR_BAD_MATCH: if draw and read cannot fit into - // graphics memory simultaneously. - // - PP_ERROR_NOMEMORY: if the ancillary buffers for draw and read cannot - // be allocated. - // - PP_GRAPHICS3DERROR_CONTEXT_LOST: if a power management event has - // occurred. - // - // If draw is destroyed after BindSurfaces is called, then subsequent - // rendering commands will be processed and the context state will be updated, - // but the surface contents become undefined. If read is destroyed after - // BindSurfaces then pixel values read from the framebuffer (e.g., as result - // of calling glReadPixels) are undefined. - // - // To unbind surfaces set draw and read to NULL. - int32_t (*BindSurfaces)(PP_Resource context, - PP_Resource draw, - PP_Resource read); - - // Returns the surfaces bound to the context for drawing and reading in - // draw and read respectively. - // - // On failure, the following error codes can be returned: - // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context. - // - PP_ERROR_BADARGUMENT: if either draw or read is NULL. - int32_t (*GetBoundSurfaces)(PP_Resource context, - PP_Resource* draw, - PP_Resource* read); -}; - -#endif // PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_ diff --git a/ppapi/c/dev/ppb_context_3d_trusted_dev.h b/ppapi/c/dev/ppb_context_3d_trusted_dev.h deleted file mode 100644 index a57c9dd..0000000 --- a/ppapi/c/dev/ppb_context_3d_trusted_dev.h +++ /dev/null @@ -1,108 +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_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ -#define PPAPI_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ - -#include "ppapi/c/dev/ppb_context_3d_dev.h" -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" - -#define PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE_0_4 "PPB_Context3DTrusted(Dev);0.4" -#define PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE \ - PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE_0_4 - -// TODO(brettw) Remove these generic names from the global namespace! -typedef enum { - kNoError, - kInvalidSize, - kOutOfBounds, - kUnknownCommand, - kInvalidArguments, - kLostContext, - kGenericError -} PPB_Context3DTrustedError; - -struct PP_Context3DTrustedState { - // Size of the command buffer in command buffer entries. - int32_t num_entries; - - // The offset (in entries) from which the reader is reading. - int32_t get_offset; - - // The offset (in entries) at which the writer is writing. - int32_t put_offset; - - // The current token value. This is used by the writer to defer - // changes to shared memory objects until the reader has reached a certain - // point in the command buffer. The reader is responsible for updating the - // token value, for example in response to an asynchronous set token command - // embedded in the command buffer. The default token value is zero. - int32_t token; - - // Error status. - PPB_Context3DTrustedError error; - - // Generation index of this state. The generation index is incremented every - // time a new state is retrieved from the command processor, so that - // consistency can be kept even if IPC messages are processed out-of-order. - uint32_t generation; -}; - -struct PPB_Context3DTrusted_Dev { - // Creates a raw Context3D resource. A raw Context3D is intended to be used - // with the trusted interface, through the command buffer (for proxying). In - // particular, when a Surface3D is bound to a raw context, SwapBuffers has no - // effect. - PP_Resource (*CreateRaw)(PP_Instance instance_id, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list); - - // Initializes the command buffer with the given size. - PP_Bool (*Initialize)(PP_Resource context_id, int32_t size); - - // Gets the ring buffer for the command buffer. - PP_Bool (*GetRingBuffer)(PP_Resource context_id, - int* shm_handle, - uint32_t* shm_size); - - // Returns the current state. - struct PP_Context3DTrustedState (*GetState)(PP_Resource context); - - // The writer calls this to update its put offset. - PP_Bool (*Flush)(PP_Resource context, int32_t put_offset); - - - // The writer calls this to update its put offset. This function returns the - // reader's most recent get offset. Does not return until after the put offset - // change callback has been invoked. - struct PP_Context3DTrustedState (*FlushSync)(PP_Resource context, - int32_t put_offset); - - // Create a transfer buffer and return a handle that uniquely - // identifies it or -1 on error. - int32_t (*CreateTransferBuffer)(PP_Resource context, uint32_t size); - - // Destroy a transfer buffer and recycle the handle. - PP_Bool (*DestroyTransferBuffer)(PP_Resource context, int32_t id); - - // Get the transfer buffer associated with a handle. - PP_Bool (*GetTransferBuffer)(PP_Resource context, - int32_t id, - int* shm_handle, - uint32_t* shm_size); - - // Like FlushSync, but returns before processing commands if the get offset is - // different than last_known_get. Allows synchronization with the command - // processor without forcing immediate command execution. - struct PP_Context3DTrustedState (*FlushSyncFast)(PP_Resource context, - int32_t put_offset, - int32_t last_known_get); -}; - -#endif // PPAPI_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ - diff --git a/ppapi/c/dev/ppb_surface_3d_dev.h b/ppapi/c/dev/ppb_surface_3d_dev.h deleted file mode 100644 index c89d721..0000000 --- a/ppapi/c/dev/ppb_surface_3d_dev.h +++ /dev/null @@ -1,113 +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_C_DEV_PPB_SURFACE_3D_DEV_H_ -#define PPAPI_C_DEV_PPB_SURFACE_3D_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_graphics_3d.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" - -#define PPB_SURFACE_3D_DEV_INTERFACE_0_2 "PPB_Surface3D(Dev);0.2" -#define PPB_SURFACE_3D_DEV_INTERFACE PPB_SURFACE_3D_DEV_INTERFACE_0_2 - -struct PPB_Surface3D_Dev { - // Creates a render surface and returns a handle to it. - // Any PPB_Context3D_Dev created with a compatible PP_Config3D_Dev - // can be used to render into this surface. The returned surface is - // off-screen to start with. It must be attached to a plugin instance - // using PPB_Instance::BindGraphics to draw on the web page. - // - // attrib_list specifies a list of attributes for the surface. The list has - // the same structure as described for PPB_Graphics3D_Dev::GetConfigAttribs. - // Attributes that can be specified in attrib_list include: - // - PP_GRAPHICS3DATTRIB_WIDTH - // - PP_GRAPHICS3DATTRIB_HEIGHT - // - PP_GRAPHICS3DATTRIB_LARGEST_SURFACE: If true, creates the largest - // possible surface when the allocation of the surface would otherwise fail. - // The width and height of the allocated surface will never exceed the - // values of PP_GRAPHICS3DATTRIB_WIDTH and PP_GRAPHICS3DATTRIB_HEIGHT, - // respectively. If this option is used, PPB_Surface3D_Dev::GetAttrib - // can be used to retrieve surface dimensions. - // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER - PP_Resource (*Create)(PP_Instance instance, - PP_Config3D_Dev config, - const int32_t* attrib_list); - - // Returns PP_TRUE if the given resource is a valid Surface3D, PP_FALSE if it - // is an invalid resource or is a resource of another type. - PP_Bool (*IsSurface3D)(PP_Resource resource); - - // Sets an attribute for PPB_Surface3D_Dev. The specified attribute of - // surface is set to value. Attributes that can be specified are: - // - PP_GRAPHICS3DATTRIB_MULTISAMPLE_RESOLVE: If value - // is PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX, and the - // PP_GRAPHICS3DATTRIB_SURFACE_TYPE attribute used to create surface does - // not contain PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX_BIT, a - // PP_GRAPHICS3DERROR_BAD_MATCH error is returned. - // - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: If value is - // PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED, and the - // PP_GRAPHICS3DATTRIB_SURFACE_TYPE attribute used to create surface - // does not contain PP_GRAPHICS3DATTRIBVALUE_SWAP_BEHAVIOR_PRESERVED_BIT, - // a PP_GRAPHICS3DERROR_BAD_MATCH error is returned. - int32_t (*SetAttrib)(PP_Resource surface, - int32_t attribute, - int32_t value); - - // Retrieves the value of attribute for surface. Attributes that can be - // queried for are: - // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the - // PP_Config3D_Dev with respect to which the surface was created. - // - PP_GRAPHICS3DATTRIB_LARGEST_SURFACE: returns the same attribute value - // specified when the surface was created with PPB_Surface3D_Dev::Create. - // - PP_GRAPHICS3DATTRIB_WIDTH and PP_GRAPHICS3DATTRIB_HEIGHT: The returned - // size may be less than the requested size if - // PP_GRAPHICS3DATTRIB_LARGEST_SURFACE is true. - // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER - // - PP_GRAPHICS3DATTRIB_MULTISAMPLE_RESOLVE - // - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR - // - // If attribute is not a valid PPB_Surface3D_Dev surface attribute, - // then an PP_GRAPHICS3DERROR_BAD_ATTRIBUTE error is returned. If surface - // is not a valid PPB_Surface3D_Dev then an PP_GRAPHICS3DERROR_BAD_SURFACE - // error is returned. - int32_t (*GetAttrib)(PP_Resource surface, - int32_t attribute, - int32_t* value); - - // Makes the contents of the color buffer available for compositing. - // This function has no effect on off-screen surfaces - ones not bound - // to any plugin instance. The contents of ancillary buffers are always - // undefined after calling SwapBuffers. The contents of the color buffer are - // undefined if the value of the PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute - // of surface is not PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED. - // - // If surface is bound as the draw surface of a context then SwapBuffers - // performs an implicit flush operation on the context. - // - // This functions can run in two modes: - // - In synchronous mode, you specify NULL for the callback and the callback - // data. This function will block the calling thread until the image has - // been painted to the screen. It is not legal to block the main thread of - // the plugin, you can use synchronous mode only from background threads. - // - In asynchronous mode, you specify a callback function and the argument - // for that callback function. The callback function will be executed on - // the calling thread when the image has been painted to the screen. While - // you are waiting for a Flush callback, additional calls to Flush will - // fail. - // - // Because the callback is executed (or thread unblocked) only when the - // plugin's current state is actually on the screen, this function provides a - // way to rate limit animations. By waiting until the image is on the screen - // before painting the next frame, you can ensure you're not generating - // updates faster than the screen can be updated. - // - int32_t (*SwapBuffers)(PP_Resource surface, - struct PP_CompletionCallback callback); -}; - -#endif // PPAPI_C_DEV_PPB_SURFACE_3D_DEV_H_ diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h index 154b395..6e16bb3 100644 --- a/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_video_decoder_dev.idl modified Wed Oct 5 09:00:09 2011. */ +/* From dev/ppb_video_decoder_dev.idl modified Tue Nov 29 11:27:39 2011. */ #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ @@ -55,7 +55,7 @@ struct PPB_VideoDecoder_Dev { * * Parameters: * |instance| pointer to the plugin instance. - * |context_3d| a PPB_Context3D_Dev resource in which decoding will happen. + * |context| a PPB_Graphics3D resource in which decoding will happen. * |profile| the video stream's format profile. * * The created decoder is returned as PP_Resource. 0 means failure. diff --git a/ppapi/c/dev/ppb_video_layer_dev.h b/ppapi/c/dev/ppb_video_layer_dev.h index 370a4d7..b78ea7e 100644 --- a/ppapi/c/dev/ppb_video_layer_dev.h +++ b/ppapi/c/dev/ppb_video_layer_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_video_layer_dev.idl modified Wed Oct 5 09:15:37 2011. */ +/* From dev/ppb_video_layer_dev.idl modified Tue Nov 29 11:43:36 2011. */ #ifndef PPAPI_C_DEV_PPB_VIDEO_LAYER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_LAYER_DEV_H_ @@ -68,9 +68,9 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoLayerMode_Dev, 4); */ /** * PPB_VideoLayer is a mechanism to enhance rendering performance of video - * content. Rendering is generally done by using PPB_Context3D or + * content. Rendering is generally done by using PPB_Graphics3D or * PPB_Graphics2D, however for video content it is redundant to go through - * PPB_Context3D or PPB_Graphics2D. PPB_VideoLayer allows video content to be + * PPB_Graphics3D or PPB_Graphics2D. PPB_VideoLayer allows video content to be * rendered directly. * * PPB_VideoLayer can be used in two modes: diff --git a/ppapi/c/pp_graphics_3d.h b/ppapi/c/pp_graphics_3d.h index 06886f8..db142f1 100644 --- a/ppapi/c/pp_graphics_3d.h +++ b/ppapi/c/pp_graphics_3d.h @@ -3,46 +3,87 @@ * found in the LICENSE file. */ +/* From pp_graphics_3d.idl modified Tue Nov 29 12:56:32 2011. */ + #ifndef PPAPI_C_PP_GRAPHICS_3D_H_ #define PPAPI_C_PP_GRAPHICS_3D_H_ -#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file defines the <code>PP_Graphics3DAttrib</code> enumeration for use in + * PPAPI C headers. + */ + -enum PP_Graphics3DAttrib { - // Bits of Alpha in the color buffer. +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Bits of Alpha in the color buffer. + */ PP_GRAPHICS3DATTRIB_ALPHA_SIZE = 0x3021, - // Bits of Blue in the color buffer. + /** + * Bits of Blue in the color buffer. + */ PP_GRAPHICS3DATTRIB_BLUE_SIZE = 0x3022, - // Bits of Green in the color buffer. + /** + * Bits of Green in the color buffer. + */ PP_GRAPHICS3DATTRIB_GREEN_SIZE = 0x3023, - // Bits of Red in the color buffer. + /** + * Bits of Red in the color buffer. + */ PP_GRAPHICS3DATTRIB_RED_SIZE = 0x3024, - // Bits of Z in the depth buffer. + /** + * Bits of Z in the depth buffer. + */ PP_GRAPHICS3DATTRIB_DEPTH_SIZE = 0x3025, - // Bits of Stencil in the stencil buffer. + /** + * Bits of Stencil in the stencil buffer. + */ PP_GRAPHICS3DATTRIB_STENCIL_SIZE = 0x3026, - // Number of samples per pixel. + /** + * Number of samples per pixel. + */ PP_GRAPHICS3DATTRIB_SAMPLES = 0x3031, - // Number of multisample buffers. + /** + * Number of multisample buffers. + */ PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS = 0x3032, - // Attrib list terminator. + /** + * Attrib list terminator. + */ PP_GRAPHICS3DATTRIB_NONE = 0x3038, - // Height of surface in pixels. + /** + * Height of surface in pixels. + */ PP_GRAPHICS3DATTRIB_HEIGHT = 0x3056, - // Width of surface in pixels. + /** + * Width of surface in pixels. + */ PP_GRAPHICS3DATTRIB_WIDTH = 0x3057, - - // Specifies the effect on the color buffer of posting a surface - // with SwapBuffers. The initial value is chosen by the implementation. + /** + * Specifies the effect on the color buffer of posting a surface + * with SwapBuffers. The initial value is chosen by the implementation. + */ PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR = 0x3093, - // Indicates that color buffer contents are unaffected. + /** + * Indicates that color buffer contents are unaffected. + */ PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED = 0x3094, - // Indicates that color buffer contents may be destroyed or changed. + /** + * Indicates that color buffer contents may be destroyed or changed. + */ PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED = 0x3095 -}; +} PP_Graphics3DAttrib; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Graphics3DAttrib, 4); +/** + * @} + */ -// TODO(alokp): Remove this when PPB_Context3D_Dev and PPB_Surface3D_Dev -// are deprecated. -typedef int32_t PP_Config3D_Dev; +#endif /* PPAPI_C_PP_GRAPHICS_3D_H_ */ -#endif // PPAPI_C_PP_GRAPHICS_3D_H_ diff --git a/ppapi/c/private/ppb_flash_fullscreen.h b/ppapi/c/private/ppb_flash_fullscreen.h index 23eef57..6f84af8 100644 --- a/ppapi/c/private/ppb_flash_fullscreen.h +++ b/ppapi/c/private/ppb_flash_fullscreen.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_flash_fullscreen.idl modified Fri Aug 26 10:51:16 2011. */ +/* From private/ppb_flash_fullscreen.idl modified Tue Nov 29 11:39:26 2011. */ #ifndef PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_ #define PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_ @@ -18,18 +18,11 @@ #define PPB_FLASHFULLSCREEN_INTERFACE PPB_FLASHFULLSCREEN_INTERFACE_0_1 /** - * PPB_Fullscreen is a copy of PPB_Fullscreen_Dev at rev 0.4. - * For backward compatibility keep the string for it until Flash is updated to - * use PPB_FlashFullscreen. - */ -#define PPB_FULLSCREEN_DEV_INTERFACE_0_4 "PPB_Fullscreen(Dev);0.4" - - -/** * @file * This file defines the <code>PPB_FlashFullscreen</code> interface. */ + /** * @addtogroup Interfaces * @{ @@ -43,16 +36,16 @@ struct PPB_FlashFullscreen { * Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on * success, PP_FALSE on failure. * - * This unbinds the current Graphics2D or Surface3D. Pending flushes and + * This unbinds the current Graphics2D or Graphics3D. Pending flushes and * swapbuffers will execute as if the resource was off-screen. The transition * is asynchronous. During the transition, IsFullscreen will return PP_FALSE, - * and no Graphics2D or Surface3D can be bound. The transition ends at the + * and no Graphics2D or Graphics3D can be bound. The transition ends at the * next DidChangeView when going into fullscreen mode. The transition out of * fullscreen mode is synchronous. * - * Note: when switching to and from fullscreen, Context3D and Surface3D - * resources need to be re-created. This is a current limitation that will be - * lifted in a later revision. + * Note: when switching to and from fullscreen, Graphics3D resources need to + * be re-created. This is a current limitation that will be lifted in a later + * revision. */ PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); /** @@ -66,3 +59,4 @@ struct PPB_FlashFullscreen { */ #endif /* PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_ */ + diff --git a/ppapi/cpp/dev/context_3d_dev.cc b/ppapi/cpp/dev/context_3d_dev.cc deleted file mode 100644 index 4847642..0000000 --- a/ppapi/cpp/dev/context_3d_dev.cc +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2010 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/cpp/dev/context_3d_dev.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/dev/surface_3d_dev.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_Context3D_Dev>() { - return PPB_CONTEXT_3D_DEV_INTERFACE; -} - -} // namespace - -Context3D_Dev Context3D_Dev::FromResource(PP_Resource resource_id) { - if (has_interface<PPB_Context3D_Dev>() && - get_interface<PPB_Context3D_Dev>()->IsContext3D(resource_id)) - return Context3D_Dev(resource_id); - - return Context3D_Dev(); -} - -Context3D_Dev::Context3D_Dev(const Instance& instance, - PP_Config3D_Dev config, - const Context3D_Dev& share_context, - const int32_t* attrib_list) { - if (has_interface<PPB_Context3D_Dev>()) { - PassRefFromConstructor(get_interface<PPB_Context3D_Dev>()->Create( - instance.pp_instance(), - config, - share_context.pp_resource(), - attrib_list)); - } -} - -int32_t Context3D_Dev::BindSurfaces(const Surface3D_Dev& draw, - const Surface3D_Dev& read) { - if (!has_interface<PPB_Context3D_Dev>()) - return PP_ERROR_NOINTERFACE; - - return get_interface<PPB_Context3D_Dev>()->BindSurfaces( - pp_resource(), draw.pp_resource(), read.pp_resource()); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/context_3d_dev.h b/ppapi/cpp/dev/context_3d_dev.h deleted file mode 100644 index 0bc26c2..0000000 --- a/ppapi/cpp/dev/context_3d_dev.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2010 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_CPP_DEV_CONTEXT_3D_DEV_H_ -#define PPAPI_CPP_DEV_CONTEXT_3D_DEV_H_ - -#include "ppapi/c/dev/ppb_context_3d_dev.h" - -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/resource.h" - -namespace pp { - -class Surface3D_Dev; - -class Context3D_Dev : public Resource { - public: - // Creates an is_null() Context3D object. - Context3D_Dev() {} - - Context3D_Dev(const Instance& instance, - PP_Config3D_Dev config, - const Context3D_Dev& share_context, - const int32_t* attrib_list); - - int32_t BindSurfaces(const Surface3D_Dev& draw, - const Surface3D_Dev& read); - - protected: - explicit Context3D_Dev(PP_Resource resource_id) : Resource(resource_id) {} - static Context3D_Dev FromResource(PP_Resource resource_id); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_CONTEXT_3D_DEV_H_ - diff --git a/ppapi/cpp/dev/surface_3d_dev.cc b/ppapi/cpp/dev/surface_3d_dev.cc deleted file mode 100644 index 9bc1430..0000000 --- a/ppapi/cpp/dev/surface_3d_dev.cc +++ /dev/null @@ -1,50 +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/cpp/dev/surface_3d_dev.h" - -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/module_impl.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_Surface3D_Dev>() { - return PPB_SURFACE_3D_DEV_INTERFACE; -} - -} // namespace - -Surface3D_Dev Surface3D_Dev::FromResource(PP_Resource resource_id) { - if (has_interface<PPB_Surface3D_Dev>() && - get_interface<PPB_Surface3D_Dev>()->IsSurface3D(resource_id)) - return Surface3D_Dev(resource_id); - - return Surface3D_Dev(); -} - -Surface3D_Dev::Surface3D_Dev(const Instance& instance, - PP_Config3D_Dev config, - const int32_t* attrib_list) { - if (has_interface<PPB_Surface3D_Dev>()) { - PassRefFromConstructor(get_interface<PPB_Surface3D_Dev>()->Create( - instance.pp_instance(), - config, - attrib_list)); - } -} - -int32_t Surface3D_Dev::SwapBuffers(const CompletionCallback& cc) const { - if (!has_interface<PPB_Surface3D_Dev>()) - return cc.MayForce(PP_ERROR_NOINTERFACE); - - return get_interface<PPB_Surface3D_Dev>()->SwapBuffers( - pp_resource(), - cc.pp_completion_callback()); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/surface_3d_dev.h b/ppapi/cpp/dev/surface_3d_dev.h deleted file mode 100644 index 450ce41..0000000 --- a/ppapi/cpp/dev/surface_3d_dev.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2010 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_CPP_DEV_SURFACE_3D_DEV_H_ -#define PPAPI_CPP_DEV_SURFACE_3D_DEV_H_ - -#include "ppapi/c/dev/ppb_surface_3d_dev.h" - -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/instance.h" -#include "ppapi/cpp/resource.h" - -namespace pp { - -class CompletionCallback; - -class Surface3D_Dev : public Resource { - public: - // Creates an is_null() Surface3D object. - Surface3D_Dev() {} - - Surface3D_Dev(const Instance& instance, - PP_Config3D_Dev config, - const int32_t* attrib_list); - - int32_t SwapBuffers(const CompletionCallback& cc) const; - - protected: - explicit Surface3D_Dev(PP_Resource resource_id) : Resource(resource_id) {} - static Surface3D_Dev FromResource(PP_Resource resource_id); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_SURFACE_3D_DEV_H_ - diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc index 991ad55..7110695 100644 --- a/ppapi/cpp/dev/video_decoder_dev.cc +++ b/ppapi/cpp/dev/video_decoder_dev.cc @@ -7,7 +7,6 @@ #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppp_video_decoder_dev.h" #include "ppapi/c/pp_errors.h" -#include "ppapi/cpp/dev/context_3d_dev.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" @@ -24,15 +23,6 @@ template <> const char* interface_name<PPB_VideoDecoder_Dev>() { } // namespace VideoDecoder_Dev::VideoDecoder_Dev(const Instance* instance, - const Context3D_Dev& context, - PP_VideoDecoder_Profile profile) { - if (!has_interface<PPB_VideoDecoder_Dev>()) - return; - PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( - instance->pp_instance(), context.pp_resource(), profile)); -} - -VideoDecoder_Dev::VideoDecoder_Dev(const Instance* instance, const Graphics3D& context, PP_VideoDecoder_Profile profile) { if (!has_interface<PPB_VideoDecoder_Dev>()) diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h index b761ef1..28b7bc2 100644 --- a/ppapi/cpp/dev/video_decoder_dev.h +++ b/ppapi/cpp/dev/video_decoder_dev.h @@ -14,7 +14,6 @@ namespace pp { -class Context3D_Dev; class Graphics3D; class Instance; @@ -26,9 +25,6 @@ class VideoDecoder_Dev : public Resource { public: // See PPB_VideoDecoder_Dev::Create. VideoDecoder_Dev(const Instance* instance, - const Context3D_Dev& context, - PP_VideoDecoder_Profile profile); - VideoDecoder_Dev(const Instance* instance, const Graphics3D& context, PP_VideoDecoder_Profile profile); diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc index a6f5997..72e4f02 100644 --- a/ppapi/cpp/instance.cc +++ b/ppapi/cpp/instance.cc @@ -8,7 +8,6 @@ #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppb_messaging.h" -#include "ppapi/cpp/dev/surface_3d_dev.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/image_data.h" @@ -89,13 +88,6 @@ bool Instance::BindGraphics(const Graphics3D& graphics) { pp_instance(), graphics.pp_resource())); } -bool Instance::BindGraphics(const Surface3D_Dev& graphics) { - if (!has_interface<PPB_Instance>()) - return false; - return PP_ToBool(get_interface<PPB_Instance>()->BindGraphics( - pp_instance(), graphics.pp_resource())); -} - bool Instance::IsFullFrame() { if (!has_interface<PPB_Instance>()) return false; diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h index 981f29c..9a3bfaf 100644 --- a/ppapi/cpp/instance.h +++ b/ppapi/cpp/instance.h @@ -24,7 +24,6 @@ class Graphics2D; class Graphics3D; class InputEvent; class Rect; -class Surface3D_Dev; class URLLoader; class Var; @@ -278,17 +277,6 @@ class Instance { /// instance, so the caller can release its reference if it chooses. bool BindGraphics(const Graphics3D& graphics); - /// Binds the given Surface3D as the current display surface. - /// Refer to <code>BindGraphics(const Graphics2D& graphics)</code> for - /// further information. - /// - /// @param[in] graphics A <code>Surface3D_Dev</code> to bind. - /// - /// @return true if bind was successful or false if the device was not the - /// correct type. On success, a reference to the device will be held by the - /// instance, so the caller can release its reference if it chooses. - bool BindGraphics(const Surface3D_Dev& graphics); - /// IsFullFrame() determines if the instance is full-frame (repr). /// Such an instance represents the entire document in a frame rather than an /// embedded resource. This can happen if the user does a top-level diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc index a0f6205..868a56b 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc @@ -17,11 +17,8 @@ #include "native_client/src/shared/ppapi_proxy/utility.h" #include "native_client/src/shared/srpc/nacl_srpc.h" #include "native_client/src/trusted/plugin/plugin.h" -#include "ppapi/c/dev/ppb_context_3d_dev.h" -#include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" #include "ppapi/c/dev/ppb_layer_compositor_dev.h" -#include "ppapi/c/dev/ppb_surface_3d_dev.h" #include "ppapi/c/ppb_graphics_3d.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h" @@ -189,11 +186,8 @@ const void* GetBrowserInterface(const char* interface_name) { static const char* disabled_interface_names[] = { PPB_GRAPHICS_3D_INTERFACE, PPB_GRAPHICS_3D_TRUSTED_INTERFACE, - PPB_CONTEXT_3D_DEV_INTERFACE, - PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE, PPB_OPENGLES2_INTERFACE, - PPB_SURFACE_3D_DEV_INTERFACE, PPB_LAYER_COMPOSITOR_DEV_INTERFACE }; for (size_t i = 0; i < NACL_ARRAY_SIZE(disabled_interface_names); i++) { diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc index 4a2be03..8c23d1a4 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc +++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc @@ -4,12 +4,10 @@ #include "native_client/src/shared/platform/nacl_check.h" -#include "ppapi/c/dev/ppb_context_3d_dev.h" #include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_scrollbar_dev.h" -#include "ppapi/c/dev/ppb_surface_3d_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppb_widget_dev.h" @@ -145,12 +143,6 @@ const PPB_WheelInputEvent* PPBWheelInputEvent() { // Dev interfaces. -const PPB_Context3D_Dev* PPBContext3DDev() { - return reinterpret_cast<const PPB_Context3D_Dev*>( - // Change to GetBrowserInterfaceSafe when moving out of dev. - GetBrowserInterface(PPB_CONTEXT_3D_DEV_INTERFACE)); -} - const PPB_CursorControl_Dev* PPBCursorControlDev() { return reinterpret_cast<const PPB_CursorControl_Dev*>( // Change to GetBrowserInterfaceSafe when moving out of dev. @@ -175,12 +167,6 @@ const PPB_Scrollbar_Dev* PPBScrollbarDev() { GetBrowserInterface(PPB_SCROLLBAR_DEV_INTERFACE)); } -const PPB_Surface3D_Dev* PPBSurface3DDev() { - return reinterpret_cast<const PPB_Surface3D_Dev*>( - // Change to GetBrowserInterfaceSafe when moving out of dev. - GetBrowserInterface(PPB_SURFACE_3D_DEV_INTERFACE)); -} - const PPB_Testing_Dev* PPBTestingDev() { return reinterpret_cast<const PPB_Testing_Dev*>( // Change to GetBrowserInterfaceSafe when moving out of dev. diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h index 9071b2a..04df592 100644 --- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h +++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h @@ -13,7 +13,6 @@ // versions explicitly in all interfaces. #include "ppapi/c/dev/ppb_scrollbar_dev.h" -struct PPB_Context3D_Dev; struct PPB_Core; struct PPB_CursorControl_Dev; struct PPB_FileIO; @@ -31,7 +30,6 @@ struct PPB_Memory_Dev; struct PPB_Messaging; struct PPB_MouseInputEvent; struct PPB_OpenGLES2; -struct PPB_Surface3D_Dev; struct PPB_Testing_Dev; struct PPB_URLLoader; struct PPB_URLRequestInfo; @@ -75,12 +73,10 @@ const PPB_WheelInputEvent* PPBWheelInputEvent(); // Lookup returns NULL if the interface is not available. // -const PPB_Context3D_Dev* PPBContext3DDev(); const PPB_CursorControl_Dev* PPBCursorControlDev(); const PPB_Font_Dev* PPBFontDev(); const PPB_Memory_Dev* PPBMemoryDev(); const PPB_Scrollbar_Dev* PPBScrollbarDev(); -const PPB_Surface3D_Dev* PPBSurface3DDev(); const PPB_Testing_Dev* PPBTestingDev(); const PPB_Widget_Dev* PPBWidgetDev(); diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi index baa9c1b..70e2b52 100644 --- a/ppapi/ppapi_cpp.gypi +++ b/ppapi/ppapi_cpp.gypi @@ -61,8 +61,6 @@ 'c/dev/pp_video_dev.h', 'c/dev/ppb_buffer_dev.h', 'c/dev/ppb_char_set_dev.h', - 'c/dev/ppb_context_3d_dev.h', - 'c/dev/ppb_context_3d_trusted_dev.h', 'c/dev/ppb_console_dev.h', 'c/dev/ppb_cursor_control_dev.h', 'c/dev/ppb_directory_reader_dev.h', @@ -73,7 +71,6 @@ 'c/dev/ppb_ime_input_event_dev.h', 'c/dev/ppb_memory_dev.h', 'c/dev/ppb_scrollbar_dev.h', - 'c/dev/ppb_surface_3d_dev.h', 'c/dev/ppb_testing_dev.h', 'c/dev/ppb_url_util_dev.h', 'c/dev/ppb_video_decoder_dev.h', @@ -202,8 +199,6 @@ 'cpp/dev/audio_input_dev.h', 'cpp/dev/buffer_dev.cc', 'cpp/dev/buffer_dev.h', - 'cpp/dev/context_3d_dev.cc', - 'cpp/dev/context_3d_dev.h', 'cpp/dev/directory_entry_dev.cc', 'cpp/dev/directory_entry_dev.h', 'cpp/dev/directory_reader_dev.cc', @@ -226,8 +221,6 @@ 'cpp/dev/scrollbar_dev.h', 'cpp/dev/selection_dev.cc', 'cpp/dev/selection_dev.h', - 'cpp/dev/surface_3d_dev.cc', - 'cpp/dev/surface_3d_dev.h', 'cpp/dev/text_input_dev.cc', 'cpp/dev/text_input_dev.h', 'cpp/dev/url_util_dev.cc', @@ -392,8 +385,6 @@ # Dev interfaces. 'cpp/dev/buffer_dev.cc', 'cpp/dev/buffer_dev.h', - 'cpp/dev/context_3d_dev.cc', - 'cpp/dev/context_3d_dev.h', 'cpp/dev/directory_entry_dev.cc', 'cpp/dev/directory_entry_dev.h', 'cpp/dev/directory_reader_dev.cc', @@ -416,8 +407,6 @@ 'cpp/dev/scrollbar_dev.h', 'cpp/dev/selection_dev.cc', 'cpp/dev/selection_dev.h', - 'cpp/dev/surface_3d_dev.cc', - 'cpp/dev/surface_3d_dev.h', 'cpp/dev/text_input_dev.cc', 'cpp/dev/text_input_dev.h', 'cpp/dev/url_util_dev.cc', diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi index b1d3ee8..b43d7e3 100644 --- a/ppapi/ppapi_proxy.gypi +++ b/ppapi/ppapi_proxy.gypi @@ -64,8 +64,6 @@ 'proxy/ppb_broker_proxy.h', 'proxy/ppb_buffer_proxy.cc', 'proxy/ppb_buffer_proxy.h', - 'proxy/ppb_context_3d_proxy.cc', - 'proxy/ppb_context_3d_proxy.h', 'proxy/ppb_core_proxy.cc', 'proxy/ppb_core_proxy.h', 'proxy/ppb_cursor_control_proxy.cc', @@ -98,8 +96,6 @@ 'proxy/ppb_instance_proxy.h', 'proxy/ppb_pdf_proxy.cc', 'proxy/ppb_pdf_proxy.h', - 'proxy/ppb_surface_3d_proxy.cc', - 'proxy/ppb_surface_3d_proxy.h', 'proxy/ppb_tcp_socket_private_proxy.cc', 'proxy/ppb_tcp_socket_private_proxy.h', 'proxy/ppb_testing_proxy.cc', diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 02bb69a..84673de 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -114,9 +114,6 @@ 'thunk/ppb_buffer_trusted_thunk.cc', 'thunk/ppb_char_set_thunk.cc', 'thunk/ppb_console_thunk.cc', - 'thunk/ppb_context_3d_api.h', - 'thunk/ppb_context_3d_thunk.cc', - 'thunk/ppb_context_3d_trusted_thunk.cc', 'thunk/ppb_cursor_control_api.h', 'thunk/ppb_cursor_control_thunk.cc', 'thunk/ppb_directory_reader_api.h', @@ -161,8 +158,6 @@ 'thunk/ppb_pdf_api.h', 'thunk/ppb_scrollbar_api.h', 'thunk/ppb_scrollbar_thunk.cc', - 'thunk/ppb_surface_3d_api.h', - 'thunk/ppb_surface_3d_thunk.cc', 'thunk/ppb_tcp_socket_private_api.h', 'thunk/ppb_tcp_socket_private_thunk.cc', 'thunk/ppb_text_input_api.h', 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(¤t_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, diff --git a/ppapi/shared_impl/opengles2_impl.cc b/ppapi/shared_impl/opengles2_impl.cc index 400f0bc..2743d2e 100644 --- a/ppapi/shared_impl/opengles2_impl.cc +++ b/ppapi/shared_impl/opengles2_impl.cc @@ -12,7 +12,6 @@ #include "gpu/command_buffer/client/gles2_implementation.h" #include "ppapi/shared_impl/graphics_3d_impl.h" #include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_context_3d_api.h" namespace ppapi { @@ -20,13 +19,8 @@ namespace { gpu::gles2::GLES2Implementation* GetGLES(PP_Resource context) { thunk::EnterResource<thunk::PPB_Graphics3D_API> enter_g3d(context, false); - if (enter_g3d.succeeded()) { - return static_cast<Graphics3DImpl*>(enter_g3d.object())->gles2_impl(); - } else { - thunk::EnterResource<thunk::PPB_Context3D_API> enter_c3d(context, true); - DCHECK(enter_c3d.succeeded()); - return enter_c3d.object()->GetGLES2Impl(); - } + DCHECK(enter_g3d.succeeded()); + return static_cast<Graphics3DImpl*>(enter_g3d.object())->gles2_impl(); } void ActiveTexture(PP_Resource context_id, GLenum texture) { diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index 8dc4552..df4415c 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -24,7 +24,6 @@ F(PPB_Broker_API) \ F(PPB_Buffer_API) \ F(PPB_BufferTrusted_API) \ - F(PPB_Context3D_API) \ F(PPB_DirectoryReader_API) \ F(PPB_FileChooser_API) \ F(PPB_FileIO_API) \ @@ -41,7 +40,6 @@ F(PPB_LayerCompositor_API) \ F(PPB_PDFFont_API) \ F(PPB_Scrollbar_API) \ - F(PPB_Surface3D_API) \ F(PPB_TCPSocket_Private_API) \ F(PPB_Transport_API) \ F(PPB_UDPSocket_Private_API) \ diff --git a/ppapi/shared_impl/video_decoder_impl.cc b/ppapi/shared_impl/video_decoder_impl.cc index 497f727..1ab0a39 100644 --- a/ppapi/shared_impl/video_decoder_impl.cc +++ b/ppapi/shared_impl/video_decoder_impl.cc @@ -8,11 +8,8 @@ #include "gpu/command_buffer/client/gles2_implementation.h" #include "ppapi/c/pp_errors.h" #include "ppapi/shared_impl/resource_tracker.h" -#include "ppapi/thunk/ppb_context_3d_api.h" #include "ppapi/thunk/enter.h" -using ppapi::thunk::PPB_Context3D_API; - namespace ppapi { VideoDecoderImpl::VideoDecoderImpl() diff --git a/ppapi/shared_impl/video_decoder_impl.h b/ppapi/shared_impl/video_decoder_impl.h index 4845776..754dd75 100644 --- a/ppapi/shared_impl/video_decoder_impl.h +++ b/ppapi/shared_impl/video_decoder_impl.h @@ -59,13 +59,13 @@ class PPAPI_SHARED_EXPORT VideoDecoderImpl PP_CompletionCallback reset_callback_; CallbackById bitstream_buffer_callbacks_; - // The resource ID of the underlying Context3d object being used. Used only + // The resource ID of the underlying Graphics3D object being used. Used only // for reference counting to keep it alive for the lifetime of |*this|. PP_Resource graphics_context_; - // Reference to the GLES2Implementation owned by |context3d_id_|. - // Context3D is guaranteed to be alive for the lifetime of this class. - // In the out-of-process case, Context3D's gles2_impl() exists in the plugin + // Reference to the GLES2Implementation owned by |graphics_context_|. + // Graphics3D is guaranteed to be alive for the lifetime of this class. + // In the out-of-process case, Graphics3D's gles2_impl() exists in the plugin // process only, so gles2_impl_ is NULL in that case. gpu::gles2::GLES2Implementation* gles2_impl_; diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index 3c41d7d..3d30c6b 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -14,8 +14,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_context_3d_trusted_dev.h" #include "ppapi/c/dev/ppb_crypto_dev.h" #include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_directory_reader_dev.h" @@ -27,7 +25,6 @@ #include "ppapi/c/dev/ppb_layer_compositor_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_scrollbar_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_transport_dev.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index 4ea5e0a..4323f51 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -13,7 +13,6 @@ #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/core.h" #include "ppapi/cpp/dev/buffer_dev.h" -#include "ppapi/cpp/dev/context_3d_dev.h" #include "ppapi/cpp/dev/directory_entry_dev.h" #include "ppapi/cpp/dev/directory_reader_dev.h" #include "ppapi/cpp/dev/file_chooser_dev.h" @@ -26,7 +25,6 @@ #include "ppapi/cpp/dev/scriptable_object_deprecated.h" #include "ppapi/cpp/dev/scrollbar_dev.h" #include "ppapi/cpp/dev/selection_dev.h" -#include "ppapi/cpp/dev/surface_3d_dev.h" #include "ppapi/cpp/dev/text_input_dev.h" #include "ppapi/cpp/dev/transport_dev.h" #include "ppapi/cpp/dev/url_util_dev.h" diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index 17defe9..93f5450 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h @@ -20,9 +20,4 @@ PROXIED_IFACE(PPB_TCPSocket_Private, PPB_TCPSOCKET_PRIVATE_INTERFACE, PROXIED_IFACE(PPB_UDPSocket_Private, PPB_UDPSOCKET_PRIVATE_INTERFACE, PPB_UDPSocket_Private) -// Map the old fullscreen interface string to the Flash one, which is the same -// at the ABI level. TODO(polina): remove this when Flash is updated. -PROXIED_IFACE(PPB_Instance, PPB_FULLSCREEN_DEV_INTERFACE_0_4, - PPB_FlashFullscreen) - #include "ppapi/thunk/interfaces_postamble.h" diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 32dcb1d..c3fb3e4 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -9,7 +9,6 @@ PROXIED_API(PPB_AudioInput) PROXIED_API(PPB_Buffer) -PROXIED_API(PPB_Context3D) PROXIED_API(PPB_CursorControl) UNPROXIED_API(PPB_DirectoryReader) PROXIED_API(PPB_FileChooser) @@ -17,7 +16,6 @@ PROXIED_API(PPB_Font) PROXIED_API(PPB_Graphics3D) UNPROXIED_API(PPB_LayerCompositor) UNPROXIED_API(PPB_Scrollbar) -PROXIED_API(PPB_Surface3D) PROXIED_API(PPB_TextInput) UNPROXIED_API(PPB_Transport) PROXIED_API(PPB_VideoCapture) @@ -30,9 +28,7 @@ PROXIED_IFACE(PPB_AudioInput, PPB_AUDIO_INPUT_DEV_INTERFACE_0_1, PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1, PPB_IMEInputEvent_Dev) PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev) -PROXIED_IFACE(PPB_Context3D, PPB_CONTEXT_3D_DEV_INTERFACE_0_1, - PPB_Context3D_Dev) -PROXIED_IFACE(PPB_Context3D, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE, +PROXIED_IFACE(PPB_Graphics3D, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE, PPB_GLESChromiumTextureMapping_Dev) PROXIED_IFACE(NoAPIName, PPB_CRYPTO_DEV_INTERFACE, PPB_Crypto_Dev) PROXIED_IFACE(PPB_CursorControl, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4, @@ -52,8 +48,6 @@ UNPROXIED_IFACE(PPB_LayerCompositor, PPB_LAYER_COMPOSITOR_DEV_INTERFACE_0_2, PROXIED_IFACE(NoAPIName, PPB_MEMORY_DEV_INTERFACE, PPB_Memory_Dev) UNPROXIED_IFACE(PPB_Scrollbar, PPB_SCROLLBAR_DEV_INTERFACE_0_5, PPB_Scrollbar_Dev) -PROXIED_IFACE(PPB_Surface3D, PPB_SURFACE_3D_DEV_INTERFACE_0_2, - PPB_Surface3D_Dev) PROXIED_IFACE(PPB_TextInput, PPB_TEXTINPUT_DEV_INTERFACE_0_1, PPB_TextInput_Dev) UNPROXIED_IFACE(PPB_Transport, PPB_TRANSPORT_DEV_INTERFACE_0_7, diff --git a/ppapi/thunk/ppb_context_3d_api.h b/ppapi/thunk/ppb_context_3d_api.h deleted file mode 100644 index feeba89..0000000 --- a/ppapi/thunk/ppb_context_3d_api.h +++ /dev/null @@ -1,64 +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_THUNK_PPB_CONTEXT_3D_API_H_ -#define PPAPI_THUNK_PPB_CONTEXT_3D_API_H_ - -#include "ppapi/c/dev/ppb_context_3d_dev.h" -#include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" -#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" - -namespace gpu { -namespace gles2 { -class GLES2Implementation; -} // namespace gles2 -} // namespace gpu - -namespace ppapi { -namespace thunk { - -class PPB_Context3D_API { - public: - virtual ~PPB_Context3D_API() {} - - // Context3D. - virtual int32_t GetAttrib(int32_t attribute, int32_t* value) = 0; - virtual int32_t BindSurfaces(PP_Resource draw, PP_Resource read) = 0; - virtual int32_t GetBoundSurfaces(PP_Resource* draw, PP_Resource* read) = 0; - - // Context3DTrusted. - virtual PP_Bool InitializeTrusted(int32_t size) = 0; - virtual PP_Bool GetRingBuffer(int* shm_handle, - uint32_t* shm_size) = 0; - virtual PP_Context3DTrustedState GetState() = 0; - virtual PP_Bool Flush(int32_t put_offset) = 0; - virtual PP_Context3DTrustedState FlushSync(int32_t put_offset) = 0; - virtual int32_t CreateTransferBuffer(uint32_t size) = 0; - virtual PP_Bool DestroyTransferBuffer(int32_t id) = 0; - virtual PP_Bool GetTransferBuffer(int32_t id, - int* shm_handle, - uint32_t* shm_size) = 0; - virtual PP_Context3DTrustedState FlushSyncFast(int32_t put_offset, - int32_t last_known_get) = 0; - - // GLESChromiumTextureMapping. - virtual void* MapTexSubImage2DCHROMIUM(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - GLenum access) = 0; - virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0; - - // For binding with OpenGLES interface. - virtual gpu::gles2::GLES2Implementation* GetGLES2Impl() = 0; -}; - -} // namespace thunk -} // namespace ppapi - -#endif // PPAPI_THUNK_PPB_CONTEXT_3D_API_H_ diff --git a/ppapi/thunk/ppb_context_3d_thunk.cc b/ppapi/thunk/ppb_context_3d_thunk.cc deleted file mode 100644 index 200e044..0000000 --- a/ppapi/thunk/ppb_context_3d_thunk.cc +++ /dev/null @@ -1,72 +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/c/pp_errors.h" -#include "ppapi/thunk/thunk.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_context_3d_api.h" -#include "ppapi/thunk/resource_creation_api.h" - -namespace ppapi { -namespace thunk { - -namespace { - -typedef EnterResource<PPB_Context3D_API> EnterContext3D; - -PP_Resource Create(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - EnterFunction<ResourceCreationAPI> enter(instance, true); - if (enter.failed()) - return 0; - return enter.functions()->CreateContext3D(instance, config, share_context, - attrib_list); -} - -PP_Bool IsContext3D(PP_Resource resource) { - EnterContext3D enter(resource, false); - return PP_FromBool(enter.succeeded()); -} - -int32_t GetAttrib(PP_Resource context, int32_t attribute, int32_t* value) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_ERROR_BADRESOURCE; - return enter.object()->GetAttrib(attribute, value); -} - -int32_t BindSurfaces(PP_Resource context, PP_Resource draw, PP_Resource read) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_ERROR_BADRESOURCE; - return enter.object()->BindSurfaces(draw, read); -} - -int32_t GetBoundSurfaces(PP_Resource context, - PP_Resource* draw, - PP_Resource* read) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_ERROR_BADRESOURCE; - return enter.object()->GetBoundSurfaces(draw, read); -} - -const PPB_Context3D_Dev g_ppb_context_3d_thunk = { - &Create, - &IsContext3D, - &GetAttrib, - &BindSurfaces, - &GetBoundSurfaces -}; - -} // namespace - -const PPB_Context3D_Dev* GetPPB_Context3D_Dev_Thunk() { - return &g_ppb_context_3d_thunk; -} - -} // namespace thunk -} // namespace ppapi diff --git a/ppapi/thunk/ppb_context_3d_trusted_thunk.cc b/ppapi/thunk/ppb_context_3d_trusted_thunk.cc deleted file mode 100644 index 312898a..0000000 --- a/ppapi/thunk/ppb_context_3d_trusted_thunk.cc +++ /dev/null @@ -1,124 +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/thunk/thunk.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_context_3d_api.h" -#include "ppapi/thunk/resource_creation_api.h" - -namespace ppapi { -namespace thunk { - -namespace { - -typedef EnterResource<PPB_Context3D_API> EnterContext3D; - -PP_Context3DTrustedState GetErrorState() { - PP_Context3DTrustedState error_state = { 0 }; - error_state.error = kGenericError; - return error_state; -} - -PP_Resource CreateRaw(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - EnterFunction<ResourceCreationAPI> enter(instance, true); - if (enter.failed()) - return 0; - return enter.functions()->CreateContext3DRaw(instance, config, share_context, - attrib_list); -} - -PP_Bool Initialize(PP_Resource context, int32_t size) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->InitializeTrusted(size); -} - -PP_Bool GetRingBuffer(PP_Resource context, - int* shm_handle, - uint32_t* shm_size) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->GetRingBuffer(shm_handle, shm_size); -} - -PP_Context3DTrustedState GetState(PP_Resource context) { - EnterContext3D enter(context, true); - if (enter.failed()) - return GetErrorState(); - return enter.object()->GetState(); -} - -PP_Bool Flush(PP_Resource context, int32_t put_offset) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->Flush(put_offset); -} - -PP_Context3DTrustedState FlushSync(PP_Resource context, int32_t put_offset) { - EnterContext3D enter(context, true); - if (enter.failed()) - return GetErrorState(); - return enter.object()->FlushSync(put_offset); -} - -int32_t CreateTransferBuffer(PP_Resource context, uint32_t size) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->CreateTransferBuffer(size); -} - -PP_Bool DestroyTransferBuffer(PP_Resource context, int32_t id) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->DestroyTransferBuffer(id); -} - -PP_Bool GetTransferBuffer(PP_Resource context, - int32_t id, - int* shm_handle, - uint32_t* shm_size) { - EnterContext3D enter(context, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->GetTransferBuffer(id, shm_handle, shm_size); -} - -PP_Context3DTrustedState FlushSyncFast(PP_Resource context, - int32_t put_offset, - int32_t last_known_get) { - EnterContext3D enter(context, true); - if (enter.failed()) - return GetErrorState(); - return enter.object()->FlushSyncFast(put_offset, last_known_get); -} - -const PPB_Context3DTrusted_Dev g_ppb_context_3d_trusted_thunk = { - &CreateRaw, - &Initialize, - &GetRingBuffer, - &GetState, - &Flush, - &FlushSync, - &CreateTransferBuffer, - &DestroyTransferBuffer, - &GetTransferBuffer, - &FlushSyncFast, -}; - -} // namespace - -const PPB_Context3DTrusted_Dev* GetPPB_Context3DTrusted_Thunk() { - return &g_ppb_context_3d_trusted_thunk; -} - -} // namespace thunk -} // namespace ppapi diff --git a/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc b/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc index 085578a..0963631f7 100644 --- a/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc +++ b/ppapi/thunk/ppb_gles_chromium_texture_mapping_thunk.cc @@ -4,7 +4,6 @@ #include "ppapi/thunk/thunk.h" #include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_context_3d_api.h" #include "ppapi/thunk/ppb_graphics_3d_api.h" #include "ppapi/thunk/resource_creation_api.h" @@ -13,7 +12,6 @@ namespace thunk { namespace { -typedef EnterResource<PPB_Context3D_API> EnterContext3D; typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; void* MapTexSubImage2DCHROMIUM(PP_Resource context, @@ -26,38 +24,18 @@ void* MapTexSubImage2DCHROMIUM(PP_Resource context, GLenum format, GLenum type, GLenum access) { - { - EnterContext3D enter(context, false); - if (enter.succeeded()) { - return enter.object()->MapTexSubImage2DCHROMIUM( - target, level, xoffset, yoffset, width, height, format, type, access); - } - } - { - EnterGraphics3D enter(context, true); - if (enter.succeeded()) { - return enter.object()->MapTexSubImage2DCHROMIUM( - target, level, xoffset, yoffset, width, height, format, type, access); - } + EnterGraphics3D enter(context, true); + if (enter.succeeded()) { + return enter.object()->MapTexSubImage2DCHROMIUM( + target, level, xoffset, yoffset, width, height, format, type, access); } return NULL; } void UnmapTexSubImage2DCHROMIUM(PP_Resource context, const void* mem) { - { - EnterContext3D enter(context, false); - if (enter.succeeded()) { - enter.object()->UnmapTexSubImage2DCHROMIUM(mem); - return; - } - } - { - EnterGraphics3D enter(context, true); - if (enter.succeeded()) { - enter.object()->UnmapTexSubImage2DCHROMIUM(mem); - return; - } - } + EnterGraphics3D enter(context, true); + if (enter.succeeded()) + enter.object()->UnmapTexSubImage2DCHROMIUM(mem); } const PPB_GLESChromiumTextureMapping_Dev diff --git a/ppapi/thunk/ppb_surface_3d_api.h b/ppapi/thunk/ppb_surface_3d_api.h deleted file mode 100644 index 2c905f5..0000000 --- a/ppapi/thunk/ppb_surface_3d_api.h +++ /dev/null @@ -1,25 +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_THUNK_PPB_SURFACE_3D_API_H_ -#define PPAPI_THUNK_PPB_SURFACE_3D_API_H_ - -#include "ppapi/c/dev/ppb_surface_3d_dev.h" - -namespace ppapi { -namespace thunk { - -class PPB_Surface3D_API { - public: - virtual ~PPB_Surface3D_API() {} - - virtual int32_t SetAttrib(int32_t attribute, int32_t value) = 0; - virtual int32_t GetAttrib(int32_t attribute, int32_t* value) = 0; - virtual int32_t SwapBuffers(PP_CompletionCallback callback) = 0; -}; - -} // namespace thunk -} // namespace ppapi - -#endif // PPAPI_THUNK_PPB_SURFACE_3D_API_H_ diff --git a/ppapi/thunk/ppb_surface_3d_thunk.cc b/ppapi/thunk/ppb_surface_3d_thunk.cc deleted file mode 100644 index ba1df6f..0000000 --- a/ppapi/thunk/ppb_surface_3d_thunk.cc +++ /dev/null @@ -1,71 +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/c/pp_errors.h" -#include "ppapi/thunk/common.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/thunk.h" -#include "ppapi/thunk/ppb_surface_3d_api.h" -#include "ppapi/thunk/resource_creation_api.h" - -namespace ppapi { -namespace thunk { - -namespace { - -PP_Resource Create(PP_Instance instance, - PP_Config3D_Dev config, - const int32_t* attrib_list) { - EnterFunction<ResourceCreationAPI> enter(instance, true); - if (enter.failed()) - return 0; - return enter.functions()->CreateSurface3D(instance, config, attrib_list); -} - -PP_Bool IsSurface3D(PP_Resource resource) { - EnterResource<PPB_Surface3D_API> enter(resource, true); - return PP_FromBool(enter.succeeded()); -} - -int32_t SetAttrib(PP_Resource surface, int32_t attribute, int32_t value) { - EnterResource<PPB_Surface3D_API> enter(surface, true); - if (enter.failed()) - return PP_ERROR_BADRESOURCE; - return enter.object()->SetAttrib(attribute, value); -} - -int32_t GetAttrib(PP_Resource surface, - int32_t attribute, - int32_t* value) { - EnterResource<PPB_Surface3D_API> enter(surface, true); - if (enter.failed()) - return PP_ERROR_BADRESOURCE; - return enter.object()->GetAttrib(attribute, value); -} - -int32_t SwapBuffers(PP_Resource surface, - PP_CompletionCallback callback) { - EnterResource<PPB_Surface3D_API> enter(surface, true); - if (enter.failed()) - return MayForceCallback(callback, PP_ERROR_BADRESOURCE); - int32_t result = enter.object()->SwapBuffers(callback); - return MayForceCallback(callback, result); -} - -const PPB_Surface3D_Dev g_ppb_surface_3d_thunk = { - &Create, - &IsSurface3D, - &SetAttrib, - &GetAttrib, - &SwapBuffers -}; - -} // namespace - -const PPB_Surface3D_Dev* GetPPB_Surface3D_Dev_Thunk() { - return &g_ppb_surface_3d_thunk; -} - -} // namespace thunk -} // namespace ppapi diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc index 40b837b..e1962cd 100644 --- a/ppapi/thunk/ppb_video_decoder_thunk.cc +++ b/ppapi/thunk/ppb_video_decoder_thunk.cc @@ -17,12 +17,12 @@ namespace { typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder; PP_Resource Create(PP_Instance instance, - PP_Resource context_3d, + PP_Resource graphics_3d, PP_VideoDecoder_Profile profile) { EnterFunction<ResourceCreationAPI> enter(instance, true); if (enter.failed()) return 0; - return enter.functions()->CreateVideoDecoder(instance, context_3d, profile); + return enter.functions()->CreateVideoDecoder(instance, graphics_3d, profile); } PP_Bool IsVideoDecoder(PP_Resource resource) { diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 24a58c6..ecab7cd 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -57,14 +57,6 @@ class ResourceCreationAPI { virtual PP_Resource CreateAudioInputTrusted(PP_Instance instance) = 0; virtual PP_Resource CreateBroker(PP_Instance instance) = 0; virtual PP_Resource CreateBuffer(PP_Instance instance, uint32_t size) = 0; - virtual PP_Resource CreateContext3D(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) = 0; - virtual PP_Resource CreateContext3DRaw(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) = 0; virtual PP_Resource CreateDirectoryReader(PP_Resource directory_ref) = 0; virtual PP_Resource CreateFileChooser( PP_Instance instance, @@ -113,9 +105,6 @@ class ResourceCreationAPI { const PP_Point* mouse_movement) = 0; virtual PP_Resource CreateScrollbar(PP_Instance instance, PP_Bool vertical) = 0; - virtual PP_Resource CreateSurface3D(PP_Instance instance, - PP_Config3D_Dev config, - const int32_t* attrib_list) = 0; virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0; virtual PP_Resource CreateTransport(PP_Instance instance, const char* name, diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h index 5fb38b4..9d1080e 100644 --- a/ppapi/thunk/thunk.h +++ b/ppapi/thunk/thunk.h @@ -31,7 +31,6 @@ struct PPB_AudioInputTrusted_Dev; struct PPB_AudioTrusted; struct PPB_BrokerTrusted; struct PPB_BufferTrusted; -struct PPB_Context3DTrusted_Dev; struct PPB_FileChooserTrusted; struct PPB_FileIOTrusted; struct PPB_FileRefPrivate; @@ -59,8 +58,6 @@ PPAPI_THUNK_EXPORT const PPB_AudioInputTrusted_Dev* PPAPI_THUNK_EXPORT const PPB_AudioTrusted* GetPPB_AudioTrusted_Thunk(); PPAPI_THUNK_EXPORT const PPB_BrokerTrusted* GetPPB_Broker_Thunk(); PPAPI_THUNK_EXPORT const PPB_BufferTrusted* GetPPB_BufferTrusted_Thunk(); -PPAPI_THUNK_EXPORT const PPB_Context3DTrusted_Dev* - GetPPB_Context3DTrusted_Thunk(); PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted* GetPPB_FileChooser_Trusted_Thunk(); PPAPI_THUNK_EXPORT const PPB_FileIOTrusted* GetPPB_FileIOTrusted_Thunk(); diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 0c48a54..951432e 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -245,8 +245,6 @@ '../plugins/ppapi/ppb_broker_impl.h', '../plugins/ppapi/ppb_buffer_impl.cc', '../plugins/ppapi/ppb_buffer_impl.h', - '../plugins/ppapi/ppb_context_3d_impl.cc', - '../plugins/ppapi/ppb_context_3d_impl.h', '../plugins/ppapi/ppb_cursor_control_impl.cc', '../plugins/ppapi/ppb_cursor_control_impl.h', '../plugins/ppapi/ppb_directory_reader_impl.cc', @@ -288,8 +286,6 @@ '../plugins/ppapi/ppb_proxy_impl.h', '../plugins/ppapi/ppb_scrollbar_impl.cc', '../plugins/ppapi/ppb_scrollbar_impl.h', - '../plugins/ppapi/ppb_surface_3d_impl.cc', - '../plugins/ppapi/ppb_surface_3d_impl.h', '../plugins/ppapi/ppb_text_input_impl.cc', '../plugins/ppapi/ppb_text_input_impl.h', '../plugins/ppapi/ppb_uma_private_impl.cc', diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index ff09426e..aacc9aa 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -17,8 +17,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_context_3d_trusted_dev.h" #include "ppapi/c/dev/ppb_crypto_dev.h" #include "ppapi/c/dev/ppb_cursor_control_dev.h" #include "ppapi/c/dev/ppb_directory_reader_dev.h" @@ -30,7 +28,6 @@ #include "ppapi/c/dev/ppb_layer_compositor_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_scrollbar_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_transport_dev.h" @@ -283,8 +280,6 @@ const void* GetInterface(const char* name) { return ::ppapi::thunk::GetPPB_AudioTrusted_Thunk(); if (strcmp(name, PPB_BUFFER_TRUSTED_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_BufferTrusted_Thunk(); - if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0) - return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk(); if (strcmp(name, PPB_CORE_INTERFACE) == 0) return &core_interface; if (strcmp(name, PPB_FILEIOTRUSTED_INTERFACE) == 0) @@ -305,8 +300,6 @@ const void* GetInterface(const char* name) { return ::ppapi::thunk::GetPPB_Flash_Menu_Thunk(); if (strcmp(name, PPB_FLASH_TCPSOCKET_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_TCPSocket_Private_Thunk(); - if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE_0_4) == 0) - return ::ppapi::thunk::GetPPB_FlashFullscreen_Thunk(); if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE) == 0) return ::ppapi::thunk::GetPPB_Fullscreen_Thunk(); if (strcmp(name, PPB_GPU_BLACKLIST_INTERFACE) == 0) diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index ba7e44e..894a7cc 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -72,7 +72,6 @@ #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" #include "webkit/plugins/ppapi/ppb_image_data_impl.h" -#include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" #include "webkit/plugins/ppapi/ppp_pdf.h" @@ -111,7 +110,6 @@ using ppapi::thunk::PPB_Graphics2D_API; using ppapi::thunk::PPB_Graphics3D_API; using ppapi::thunk::PPB_ImageData_API; using ppapi::thunk::PPB_Instance_FunctionAPI; -using ppapi::thunk::PPB_Surface3D_API; using ppapi::Var; using WebKit::WebBindings; using WebKit::WebCanvas; @@ -409,8 +407,6 @@ void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { unsigned PluginInstance::GetBackingTextureId() { if (GetBoundGraphics3D()) return GetBoundGraphics3D()->GetBackingTextureId(); - else if (GetBoundSurface3D()) - return GetBoundSurface3D()->GetBackingTextureId(); return 0; } @@ -803,8 +799,6 @@ void PluginInstance::ViewInitiatedPaint() { GetBoundGraphics2D()->ViewInitiatedPaint(); else if (GetBoundGraphics3D()) GetBoundGraphics3D()->ViewInitiatedPaint(); - else if (GetBoundSurface3D()) - GetBoundSurface3D()->ViewInitiatedPaint(); } void PluginInstance::ViewFlushedPaint() { @@ -814,8 +808,6 @@ void PluginInstance::ViewFlushedPaint() { GetBoundGraphics2D()->ViewFlushedPaint(); else if (GetBoundGraphics3D()) GetBoundGraphics3D()->ViewFlushedPaint(); - else if (GetBoundSurface3D()) - GetBoundSurface3D()->ViewFlushedPaint(); } bool PluginInstance::GetBitmapForOptimizedPluginPaint( @@ -1544,15 +1536,6 @@ PPB_Graphics3D_Impl* PluginInstance::GetBoundGraphics3D() const { return NULL; } -PPB_Surface3D_Impl* PluginInstance::GetBoundSurface3D() const { - if (bound_graphics_.get() == NULL) - return NULL; - - if (bound_graphics_->AsPPB_Surface3D_API()) - return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); - return NULL; -} - void PluginInstance::setBackingTextureId(unsigned int id) { // If we have a fullscreen_container_ (under PPB_FlashFullscreen) // or desired_fullscreen_state is true (under PPB_Fullscreen), @@ -1630,8 +1613,6 @@ PP_Bool PluginInstance::BindGraphics(PP_Instance instance, GetBoundGraphics2D()->BindToInstance(NULL); } else if (GetBoundGraphics3D()) { GetBoundGraphics3D()->BindToInstance(false); - } else if (GetBoundSurface3D()) { - GetBoundSurface3D()->BindToInstance(false); } bound_graphics_ = NULL; } @@ -1655,9 +1636,6 @@ PP_Bool PluginInstance::BindGraphics(PP_Instance instance, EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; - EnterResourceNoLock<PPB_Surface3D_API> enter_surface_3d(device, false); - PPB_Surface3D_Impl* surface_3d = enter_surface_3d.succeeded() ? - static_cast<PPB_Surface3D_Impl*>(enter_surface_3d.object()) : NULL; if (graphics_2d) { if (graphics_2d->pp_instance() != pp_instance()) @@ -1678,16 +1656,6 @@ PP_Bool PluginInstance::BindGraphics(PP_Instance instance, bound_graphics_ = graphics_3d; setBackingTextureId(graphics_3d->GetBackingTextureId()); - } else if (surface_3d) { - // Make sure graphics can only be bound to the instance it is - // associated with. - if (surface_3d->pp_instance() != pp_instance()) - return PP_FALSE; - if (!surface_3d->BindToInstance(true)) - return PP_FALSE; - - bound_graphics_ = surface_3d; - setBackingTextureId(surface_3d->GetBackingTextureId()); } else { // The device is not a valid resource type. return PP_FALSE; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 371c945..56ea1e3 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -74,7 +74,6 @@ class PluginObject; class PPB_Graphics2D_Impl; class PPB_Graphics3D_Impl; class PPB_ImageData_Impl; -class PPB_Surface3D_Impl; class PPB_URLLoader_Impl; class PPB_URLRequestInfo_Impl; @@ -416,11 +415,6 @@ class PluginInstance : public base::RefCounted<PluginInstance>, // Returns NULL if bound graphics is not a 3D context. PPB_Graphics3D_Impl* GetBoundGraphics3D() const; - // DEPRECATED: PPB_Surface3D_Impl is being replaced with PPB_Graphics3D_Impl. - // Get the bound 3D graphics surface. - // Returns NULL if bound graphics is not a 3D surface. - PPB_Surface3D_Impl* GetBoundSurface3D() const; - // Sets the id of the texture that the plugin draws to. The id is in the // compositor space so it can use it to composite with rest of the page. // A value of zero indicates the plugin is not backed by a texture. diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.cc b/webkit/plugins/ppapi/ppb_context_3d_impl.cc deleted file mode 100644 index 5acf56c..0000000 --- a/webkit/plugins/ppapi/ppb_context_3d_impl.cc +++ /dev/null @@ -1,374 +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 "webkit/plugins/ppapi/ppb_context_3d_impl.h" - -#include "base/bind.h" -#include "base/logging.h" -#include "base/shared_memory.h" -#include "gpu/command_buffer/client/gles2_cmd_helper.h" -#include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/common/command_buffer.h" -#include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" -#include "ppapi/thunk/enter.h" -#include "webkit/plugins/ppapi/common.h" -#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" -#include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" -#include "webkit/plugins/ppapi/resource_helper.h" - -using ppapi::thunk::EnterResourceNoLock; -using ppapi::thunk::PPB_Context3D_API; -using ppapi::thunk::PPB_Surface3D_API; - -namespace webkit { -namespace ppapi { - -namespace { - -// Size of the transfer buffer. -const int32 kCommandBufferSize = 1024 * 1024; -const int32 kTransferBufferSize = 1024 * 1024; - -PP_Bool ShmToHandle(base::SharedMemory* shm, - size_t size, - int* shm_handle, - uint32_t* shm_size) { - if (!shm || !shm_handle || !shm_size) - return PP_FALSE; -#if defined(OS_POSIX) - *shm_handle = shm->handle().fd; -#elif defined(OS_WIN) - *shm_handle = reinterpret_cast<int>(shm->handle()); -#else - #error "Platform not supported." -#endif - *shm_size = size; - return PP_TRUE; -} - -PP_Context3DTrustedState GetErrorState() { - PP_Context3DTrustedState error_state = { 0 }; - error_state.error = kGenericError; - return error_state; -} - -PP_Context3DTrustedState PPStateFromGPUState( - const gpu::CommandBuffer::State& s) { - PP_Context3DTrustedState state = { - s.num_entries, - s.get_offset, - s.put_offset, - s.token, - static_cast<PPB_Context3DTrustedError>(s.error), - s.generation - }; - return state; -} - -} // namespace - -PPB_Context3D_Impl::PPB_Context3D_Impl(PP_Instance instance) - : Resource(instance), - transfer_buffer_id_(0), - draw_surface_(NULL), - read_surface_(NULL), - weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { -} - -PPB_Context3D_Impl::~PPB_Context3D_Impl() { - Destroy(); -} - -// static -PP_Resource PPB_Context3D_Impl::Create(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - // TODO(alokp): Support shared context. - DCHECK_EQ(0, share_context); - if (share_context != 0) - return 0; - - scoped_refptr<PPB_Context3D_Impl> context(new PPB_Context3D_Impl(instance)); - if (!context->Init(config, share_context, attrib_list)) - return 0; - - return context->GetReference(); -} - -// static -PP_Resource PPB_Context3D_Impl::CreateRaw(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - // TODO(alokp): Support shared context. - DCHECK_EQ(0, share_context); - if (share_context != 0) - return 0; - - scoped_refptr<PPB_Context3D_Impl> context(new PPB_Context3D_Impl(instance)); - if (!context->InitRaw(config, share_context, attrib_list)) - return 0; - - return context->GetReference(); -} - -PPB_Context3D_API* PPB_Context3D_Impl::AsPPB_Context3D_API() { - return this; -} - -int32_t PPB_Context3D_Impl::GetAttrib(int32_t attribute, int32_t* value) { - // TODO(alokp): Implement me. - return 0; -} - -int32_t PPB_Context3D_Impl::BindSurfaces(PP_Resource draw, PP_Resource read) { - EnterResourceNoLock<PPB_Surface3D_API> enter_draw(draw, true); - if (enter_draw.failed()) - return PP_ERROR_BADRESOURCE; - PPB_Surface3D_Impl* new_draw = - static_cast<PPB_Surface3D_Impl*>(enter_draw.object()); - - EnterResourceNoLock<PPB_Surface3D_API> enter_read(read, true); - if (enter_read.failed()) - return PP_ERROR_BADRESOURCE; - PPB_Surface3D_Impl* new_read = - static_cast<PPB_Surface3D_Impl*>(enter_read.object()); - return BindSurfacesImpl(new_draw, new_read); -} - -int32_t PPB_Context3D_Impl::BindSurfacesImpl(PPB_Surface3D_Impl* new_draw, - PPB_Surface3D_Impl* new_read) { - // TODO(alokp): Support separate draw-read surfaces. - DCHECK_EQ(new_draw, new_read); - if (new_draw != new_read) - return PP_ERROR_NOTSUPPORTED; - - if (new_draw == draw_surface_) - return PP_OK; - - if (new_draw && new_draw->context()) - return PP_ERROR_BADARGUMENT; // Already bound. - - if (draw_surface_) - draw_surface_->BindToContext(NULL); - if (new_draw && !new_draw->BindToContext(this)) - return PP_ERROR_NOMEMORY; - - draw_surface_ = new_draw; - read_surface_ = new_read; - return PP_OK; -} - -int32_t PPB_Context3D_Impl::GetBoundSurfaces(PP_Resource* draw, - PP_Resource* read) { - // TODO(alokp): Implement me. - return 0; -} - -PP_Bool PPB_Context3D_Impl::InitializeTrusted(int32_t size) { - if (!platform_context_.get()) - return PP_FALSE; - return PP_FromBool(platform_context_->GetCommandBuffer()->Initialize(size)); -} - -PP_Bool PPB_Context3D_Impl::GetRingBuffer(int* shm_handle, - uint32_t* shm_size) { - if (!platform_context_.get()) - return PP_FALSE; - gpu::Buffer buffer = platform_context_->GetCommandBuffer()->GetRingBuffer(); - return ShmToHandle(buffer.shared_memory, buffer.size, shm_handle, shm_size); -} - -PP_Context3DTrustedState PPB_Context3D_Impl::GetState() { - if (!platform_context_.get()) - return GetErrorState(); - return PPStateFromGPUState(platform_context_->GetCommandBuffer()->GetState()); -} - -PP_Bool PPB_Context3D_Impl::Flush(int32_t put_offset) { - if (!platform_context_.get()) - return PP_FALSE; - platform_context_->GetCommandBuffer()->Flush(put_offset); - return PP_TRUE; -} - -PP_Context3DTrustedState PPB_Context3D_Impl::FlushSync(int32_t put_offset) { - if (!platform_context_.get()) - return GetErrorState(); - gpu::CommandBuffer::State state = - platform_context_->GetCommandBuffer()->GetState(); - return PPStateFromGPUState( - platform_context_->GetCommandBuffer()->FlushSync(put_offset, - state.get_offset)); -} - -int32_t PPB_Context3D_Impl::CreateTransferBuffer(uint32_t size) { - if (!platform_context_.get()) - return 0; - return platform_context_->GetCommandBuffer()->CreateTransferBuffer(size, -1); -} - -PP_Bool PPB_Context3D_Impl::DestroyTransferBuffer(int32_t id) { - if (!platform_context_.get()) - return PP_FALSE; - platform_context_->GetCommandBuffer()->DestroyTransferBuffer(id); - return PP_TRUE; -} - -PP_Bool PPB_Context3D_Impl::GetTransferBuffer(int32_t id, - int* shm_handle, - uint32_t* shm_size) { - if (!platform_context_.get()) - return PP_FALSE; - gpu::Buffer buffer = - platform_context_->GetCommandBuffer()->GetTransferBuffer(id); - return ShmToHandle(buffer.shared_memory, buffer.size, shm_handle, shm_size); -} - -PP_Context3DTrustedState PPB_Context3D_Impl::FlushSyncFast( - int32_t put_offset, - int32_t last_known_get) { - if (!platform_context_.get()) - return GetErrorState(); - return PPStateFromGPUState( - platform_context_->GetCommandBuffer()->FlushSync(put_offset, - last_known_get)); -} - -void* PPB_Context3D_Impl::MapTexSubImage2DCHROMIUM(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - GLenum access) { - if (!gles2_impl_.get()) - return NULL; - return gles2_impl_->MapTexSubImage2DCHROMIUM( - target, level, xoffset, yoffset, width, height, format, type, access); -} - -void PPB_Context3D_Impl::UnmapTexSubImage2DCHROMIUM(const void* mem) { - if (gles2_impl_.get()) - gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem); -} - -gpu::gles2::GLES2Implementation* PPB_Context3D_Impl::GetGLES2Impl() { - return gles2_impl(); -} - -bool PPB_Context3D_Impl::Init(PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - if (!InitRaw(config, share_context, attrib_list)) - return false; - - if (!CreateImplementation()) { - Destroy(); - return false; - } - - return true; -} - -bool PPB_Context3D_Impl::InitRaw(PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); - if (!plugin_instance) - return false; - - // Create and initialize the objects required to issue GLES2 calls. - platform_context_.reset(plugin_instance->CreateContext3D()); - if (!platform_context_.get()) { - Destroy(); - return false; - } - - static const int32 kAttribs[] = { - PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, - PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, - PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, - PP_GRAPHICS3DATTRIB_SAMPLES, 0, - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, - PP_GRAPHICS3DATTRIB_HEIGHT, 1, - PP_GRAPHICS3DATTRIB_WIDTH, 1, - PP_GRAPHICS3DATTRIB_NONE, - }; - if (!platform_context_->Init(kAttribs)) { - Destroy(); - return false; - } - - platform_context_->SetContextLostCallback( - base::Bind(&PPB_Context3D_Impl::OnContextLost, - weak_ptr_factory_.GetWeakPtr())); - return true; -} - -bool PPB_Context3D_Impl::CreateImplementation() { - gpu::CommandBuffer* command_buffer = platform_context_->GetCommandBuffer(); - DCHECK(command_buffer); - - if (!command_buffer->Initialize(kCommandBufferSize)) - return false; - - // Create the GLES2 helper, which writes the command buffer protocol. - helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); - if (!helper_->Initialize(kCommandBufferSize)) - return false; - - // Create a transfer buffer used to copy resources between the renderer - // process and the GPU process. - transfer_buffer_id_ = - command_buffer->CreateTransferBuffer(kTransferBufferSize, -1); - if (transfer_buffer_id_ < 0) - return false; - - // Map the buffer into the renderer process's address space. - gpu::Buffer transfer_buffer = - command_buffer->GetTransferBuffer(transfer_buffer_id_); - if (!transfer_buffer.ptr) - return false; - - // Create the object exposing the OpenGL API. - gles2_impl_.reset(new gpu::gles2::GLES2Implementation( - helper_.get(), - transfer_buffer.size, - transfer_buffer.ptr, - transfer_buffer_id_, - false, - true)); - - return true; -} - -void PPB_Context3D_Impl::Destroy() { - if (draw_surface_) - draw_surface_->BindToContext(NULL); - - gles2_impl_.reset(); - - if (platform_context_.get() && transfer_buffer_id_ != 0) { - platform_context_->GetCommandBuffer()->DestroyTransferBuffer( - transfer_buffer_id_); - transfer_buffer_id_ = 0; - } - - helper_.reset(); - platform_context_.reset(); -} - -void PPB_Context3D_Impl::OnContextLost() { - if (draw_surface_) - draw_surface_->OnContextLost(); - if (read_surface_) - read_surface_->OnContextLost(); -} - -} // namespace ppapi -} // namespace webkit diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.h b/webkit/plugins/ppapi/ppb_context_3d_impl.h deleted file mode 100644 index 9f23aaf..0000000 --- a/webkit/plugins/ppapi/ppb_context_3d_impl.h +++ /dev/null @@ -1,118 +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 WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ -#define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ - -#include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "ppapi/shared_impl/resource.h" -#include "ppapi/thunk/ppb_context_3d_api.h" -#include "webkit/plugins/ppapi/plugin_delegate.h" - -namespace gpu { -namespace gles2 { -class GLES2CmdHelper; -class GLES2Implementation; -} // namespace gles2 -} // namespace gpu - -namespace webkit { -namespace ppapi { - -class PPB_Surface3D_Impl; - -class PPB_Context3D_Impl : public ::ppapi::Resource, - public ::ppapi::thunk::PPB_Context3D_API { - public: - virtual ~PPB_Context3D_Impl(); - - static PP_Resource Create(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list); - static PP_Resource CreateRaw(PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list); - - // Resource override. - virtual ::ppapi::thunk::PPB_Context3D_API* AsPPB_Context3D_API(); - - // 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; - - int32_t BindSurfacesImpl(PPB_Surface3D_Impl* draw, PPB_Surface3D_Impl* read); - - gpu::gles2::GLES2Implementation* gles2_impl() { - return gles2_impl_.get(); - } - - // Possibly NULL if initialization fails. - PluginDelegate::PlatformContext3D* platform_context() { - return platform_context_.get(); - } - - private: - explicit PPB_Context3D_Impl(PP_Instance instance); - - 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); - - bool CreateImplementation(); - void Destroy(); - void OnContextLost(); - - // PluginDelegate's 3D Context. Responsible for providing the command buffer. - // Possibly NULL. - scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; - - scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; - int32 transfer_buffer_id_; - scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; - - PPB_Surface3D_Impl* draw_surface_; - PPB_Surface3D_Impl* read_surface_; - - base::WeakPtrFactory<PPB_Context3D_Impl> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); -}; - -} // namespace ppapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ diff --git a/webkit/plugins/ppapi/ppb_surface_3d_impl.cc b/webkit/plugins/ppapi/ppb_surface_3d_impl.cc deleted file mode 100644 index e7f81c8..0000000 --- a/webkit/plugins/ppapi/ppb_surface_3d_impl.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 "webkit/plugins/ppapi/ppb_surface_3d_impl.h" - -#include "base/bind.h" -#include "base/message_loop.h" -#include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/common/command_buffer.h" -#include "ppapi/c/ppb_graphics_3d.h" -#include "ppapi/c/ppp_graphics_3d.h" -#include "webkit/plugins/ppapi/common.h" -#include "webkit/plugins/ppapi/plugin_module.h" -#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" -#include "webkit/plugins/ppapi/ppb_context_3d_impl.h" -#include "webkit/plugins/ppapi/resource_helper.h" - -using ppapi::thunk::PPB_Surface3D_API; - -namespace webkit { -namespace ppapi { - -PPB_Surface3D_Impl::PPB_Surface3D_Impl(PP_Instance instance) - : Resource(instance), - bound_to_instance_(false), - swap_initiated_(false), - context_(NULL), - weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { -} - -PPB_Surface3D_Impl::~PPB_Surface3D_Impl() { - if (context_) - context_->BindSurfacesImpl(NULL, NULL); -} - -// static -PP_Resource PPB_Surface3D_Impl::Create(PP_Instance instance, - PP_Config3D_Dev config, - const int32_t* attrib_list) { - scoped_refptr<PPB_Surface3D_Impl> surface( - new PPB_Surface3D_Impl(instance)); - if (!surface->Init(config, attrib_list)) - return 0; - return surface->GetReference(); -} - -PPB_Surface3D_API* PPB_Surface3D_Impl::AsPPB_Surface3D_API() { - return this; -} - -int32_t PPB_Surface3D_Impl::SetAttrib(int32_t attribute, int32_t value) { - // TODO(alokp): Implement me. - return 0; -} - -int32_t PPB_Surface3D_Impl::GetAttrib(int32_t attribute, int32_t* value) { - // TODO(alokp): Implement me. - return 0; -} - -int32_t PPB_Surface3D_Impl::SwapBuffers(PP_CompletionCallback callback) { - if (!callback.func) { - // Blocking SwapBuffers isn't supported (since we have to be on the main - // thread). - return PP_ERROR_BLOCKS_MAIN_THREAD; - } - - if (swap_callback_.get() && !swap_callback_->completed()) { - // Already a pending SwapBuffers that hasn't returned yet. - return PP_ERROR_INPROGRESS; - } - - if (!context_) - return PP_ERROR_FAILED; - - PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); - if (!plugin_module) - return PP_ERROR_FAILED; - - swap_callback_ = new TrackedCompletionCallback( - plugin_module->GetCallbackTracker(), pp_resource(), callback); - gpu::gles2::GLES2Implementation* impl = context_->gles2_impl(); - if (impl) - context_->gles2_impl()->SwapBuffers(); - context_->platform_context()->Echo( - base::Bind(&PPB_Surface3D_Impl::OnSwapBuffers, - weak_ptr_factory_.GetWeakPtr())); - // |SwapBuffers()| should not call us back synchronously, but double-check. - DCHECK(!swap_callback_->completed()); - return PP_OK_COMPLETIONPENDING; -} - -bool PPB_Surface3D_Impl::Init(PP_Config3D_Dev config, - const int32_t* attrib_list) { - return true; -} - -bool PPB_Surface3D_Impl::BindToInstance(bool bind) { - bound_to_instance_ = bind; - return true; -} - -bool PPB_Surface3D_Impl::BindToContext(PPB_Context3D_Impl* context) { - if (context == context_) - return true; - - PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); - if (!plugin_instance) - return false; - - if (!context && bound_to_instance_) - plugin_instance->BindGraphics(pp_instance(), 0); - - // Unbind from the current context. - if (context && context->platform_context()) { - // Resize the backing texture to the size of the instance when it is bound. - // TODO(alokp): This should be the responsibility of plugins. - gpu::gles2::GLES2Implementation* impl = context->gles2_impl(); - if (impl) { - const gfx::Size& size = plugin_instance->position().size(); - impl->ResizeCHROMIUM(size.width(), size.height()); - } - } - context_ = context; - return true; -} - -void PPB_Surface3D_Impl::ViewInitiatedPaint() { -} - -void PPB_Surface3D_Impl::ViewFlushedPaint() { - if (swap_initiated_ && swap_callback_.get() && !swap_callback_->completed()) { - // We must clear swap_callback_ before issuing the callback. It will be - // common for the plugin to issue another SwapBuffers in response to the - // callback, and we don't want to think that a callback is already pending. - swap_initiated_ = false; - scoped_refptr<TrackedCompletionCallback> callback; - callback.swap(swap_callback_); - callback->Run(PP_OK); // Will complete abortively if necessary. - } -} - -unsigned int PPB_Surface3D_Impl::GetBackingTextureId() { - return context_ ? context_->platform_context()->GetBackingTextureId() : 0; -} - -void PPB_Surface3D_Impl::OnSwapBuffers() { - PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); - if (!plugin_instance) - return; - - if (bound_to_instance_ && plugin_instance) { - plugin_instance->CommitBackingTexture(); - swap_initiated_ = true; - } else if (swap_callback_.get() && !swap_callback_->completed()) { - // If we're off-screen, no need to trigger compositing so run the callback - // immediately. - swap_initiated_ = false; - scoped_refptr<TrackedCompletionCallback> callback; - callback.swap(swap_callback_); - callback->Run(PP_OK); // Will complete abortively if necessary. - } -} - -void PPB_Surface3D_Impl::OnContextLost() { - PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); - if (bound_to_instance_ && plugin_instance) - plugin_instance->BindGraphics(pp_instance(), 0); - - // Send context lost to plugin. This may have been caused by a PPAPI call, so - // avoid re-entering. - MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&PPB_Surface3D_Impl::SendContextLost, this)); -} - -void PPB_Surface3D_Impl::SendContextLost() { - PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); - - // By the time we run this, the instance may have been deleted, or in the - // process of being deleted. Even in the latter case, we don't want to send a - // callback after DidDestroy. - if (!plugin_instance || !plugin_instance->container()) - return; - const PPP_Graphics3D* ppp_graphics_3d = - static_cast<const PPP_Graphics3D*>( - plugin_instance->module()->GetPluginInterface( - PPP_GRAPHICS_3D_INTERFACE)); - if (ppp_graphics_3d) - ppp_graphics_3d->Graphics3DContextLost(pp_instance()); -} - -} // namespace ppapi -} // namespace webkit diff --git a/webkit/plugins/ppapi/ppb_surface_3d_impl.h b/webkit/plugins/ppapi/ppb_surface_3d_impl.h deleted file mode 100644 index a68515f..0000000 --- a/webkit/plugins/ppapi/ppb_surface_3d_impl.h +++ /dev/null @@ -1,83 +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 WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ -#define WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ - -#include "base/memory/ref_counted.h" -#include "base/task.h" -#include "ppapi/shared_impl/resource.h" -#include "ppapi/thunk/ppb_surface_3d_api.h" -#include "webkit/plugins/ppapi/callbacks.h" -#include "webkit/plugins/ppapi/plugin_delegate.h" - -namespace webkit { -namespace ppapi { - -class PPB_Context3D_Impl; - -class PPB_Surface3D_Impl : public ::ppapi::Resource, - public ::ppapi::thunk::PPB_Surface3D_API { - public: - virtual ~PPB_Surface3D_Impl(); - - static PP_Resource Create(PP_Instance instance, - PP_Config3D_Dev config, - const int32_t* attrib_list); - - // Resource override. - virtual ::ppapi::thunk::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; - - PPB_Context3D_Impl* context() const { - return context_; - } - - // 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); - - // Binds the context such that all draw calls to context - // affect this surface. To unbind call this function will NULL context. - // Returns true if successful. - bool BindToContext(PPB_Context3D_Impl* context); - - unsigned int GetBackingTextureId(); - - void ViewInitiatedPaint(); - void ViewFlushedPaint(); - void OnContextLost(); - - private: - explicit PPB_Surface3D_Impl(PP_Instance instance); - - bool Init(PP_Config3D_Dev config, const int32_t* attrib_list); - - // Called when SwapBuffers is complete. - void OnSwapBuffers(); - void SendContextLost(); - - bool bound_to_instance_; - - // True when the page's SwapBuffers has been issued but not returned yet. - bool swap_initiated_; - scoped_refptr<TrackedCompletionCallback> swap_callback_; - - // The context this surface is currently bound to. - PPB_Context3D_Impl* context_; - - base::WeakPtrFactory<PPB_Surface3D_Impl> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); -}; - -} // namespace ppapi -} // namespace webkit - -#endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc index b9e6da0..f108ecf 100644 --- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc +++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc @@ -21,13 +21,11 @@ #include "webkit/plugins/ppapi/plugin_module.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/plugins/ppapi/ppb_buffer_impl.h" -#include "webkit/plugins/ppapi/ppb_context_3d_impl.h" #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" #include "webkit/plugins/ppapi/resource_helper.h" 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; @@ -64,28 +62,16 @@ PP_Resource PPB_VideoDecoder_Impl::Create( PP_Instance instance, PP_Resource graphics_context, PP_VideoDecoder_Profile profile) { - PluginDelegate::PlatformContext3D* platform_context = NULL; - gpu::gles2::GLES2Implementation* gles2_impl = NULL; - EnterResourceNoLock<PPB_Context3D_API> enter_context(graphics_context, false); - if (enter_context.succeeded()) { - PPB_Context3D_Impl* context3d_impl = - static_cast<PPB_Context3D_Impl*>(enter_context.object()); - platform_context = context3d_impl->platform_context(); - gles2_impl = context3d_impl->gles2_impl(); - } else { - EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, - true); - if (enter_context.failed()) - return 0; - PPB_Graphics3D_Impl* graphics3d_impl = - static_cast<PPB_Graphics3D_Impl*>(enter_context.object()); - platform_context = graphics3d_impl->platform_context(); - gles2_impl = graphics3d_impl->gles2_impl(); - } + EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, true); + if (enter_context.failed()) + return 0; + PPB_Graphics3D_Impl* graphics3d_impl = + static_cast<PPB_Graphics3D_Impl*>(enter_context.object()); scoped_refptr<PPB_VideoDecoder_Impl> decoder( new PPB_VideoDecoder_Impl(instance)); - if (decoder->Init(graphics_context, platform_context, gles2_impl, profile)) + if (decoder->Init(graphics_context, graphics3d_impl->platform_context(), + graphics3d_impl->gles2_impl(), profile)) return decoder->GetReference(); return 0; } diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc index 992d6e8..ace20f8 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.cc +++ b/webkit/plugins/ppapi/resource_creation_impl.cc @@ -13,7 +13,6 @@ #include "webkit/plugins/ppapi/ppb_audio_input_impl.h" #include "webkit/plugins/ppapi/ppb_broker_impl.h" #include "webkit/plugins/ppapi/ppb_buffer_impl.h" -#include "webkit/plugins/ppapi/ppb_context_3d_impl.h" #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" #include "webkit/plugins/ppapi/ppb_file_io_impl.h" @@ -26,7 +25,6 @@ #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" #include "webkit/plugins/ppapi/ppb_image_data_impl.h" #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" -#include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" #include "webkit/plugins/ppapi/ppb_transport_impl.h" #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" @@ -98,24 +96,6 @@ PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, return PPB_Buffer_Impl::Create(instance, size); } -PP_Resource ResourceCreationImpl::CreateContext3D( - PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - return PPB_Context3D_Impl::Create(instance, config, share_context, - attrib_list); -} - -PP_Resource ResourceCreationImpl::CreateContext3DRaw( - PP_Instance instance, - PP_Config3D_Dev config, - PP_Resource share_context, - const int32_t* attrib_list) { - return PPB_Context3D_Impl::CreateRaw(instance, config, share_context, - attrib_list); -} - PP_Resource ResourceCreationImpl::CreateDirectoryReader( PP_Resource directory_ref) { return PPB_DirectoryReader_Impl::Create(directory_ref); @@ -252,14 +232,6 @@ PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance, return PPB_Scrollbar_Impl::Create(instance, PP_ToBool(vertical)); } -PP_Resource ResourceCreationImpl::CreateSurface3D( - PP_Instance instance, - PP_Config3D_Dev config, - const int32_t* attrib_list) { - return PPB_Surface3D_Impl::Create(instance, config, attrib_list); -} - - PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) { // Creating TCP socket resource at the renderer side is not supported. return 0; @@ -298,9 +270,9 @@ PP_Resource ResourceCreationImpl::CreateVideoCapture(PP_Instance instance) { PP_Resource ResourceCreationImpl::CreateVideoDecoder( PP_Instance instance, - PP_Resource context3d_id, + PP_Resource graphics3d_id, PP_VideoDecoder_Profile profile) { - return PPB_VideoDecoder_Impl::Create(instance, context3d_id, profile); + return PPB_VideoDecoder_Impl::Create(instance, graphics3d_id, profile); } PP_Resource ResourceCreationImpl::CreateVideoLayer(PP_Instance instance, diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h index 7e8bb70..ae19755 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.h +++ b/webkit/plugins/ppapi/resource_creation_impl.h @@ -42,14 +42,6 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, 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, @@ -97,9 +89,6 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, 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, @@ -112,7 +101,7 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase, virtual PP_Resource CreateVideoCapture(PP_Instance instance) OVERRIDE; virtual PP_Resource CreateVideoDecoder( PP_Instance instance, - PP_Resource context3d_id, + PP_Resource graphics3d_id, PP_VideoDecoder_Profile profile) OVERRIDE; virtual PP_Resource CreateVideoLayer(PP_Instance instance, PP_VideoLayerMode_Dev mode) OVERRIDE; |