| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_PPB_SURFACE_3D_PROXY_H_ | 5 #ifndef PPAPI_PPB_SURFACE_3D_PROXY_H_ |
| 6 #define PPAPI_PPB_SURFACE_3D_PROXY_H_ | 6 #define PPAPI_PPB_SURFACE_3D_PROXY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ppapi/c/dev/pp_graphics_3d_dev.h" | 10 #include "ppapi/c/dev/pp_graphics_3d_dev.h" |
| 11 #include "ppapi/c/pp_completion_callback.h" | 11 #include "ppapi/c/pp_completion_callback.h" |
| 12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/cpp/completion_callback.h" | 13 #include "ppapi/cpp/completion_callback.h" |
| 14 #include "ppapi/proxy/interface_proxy.h" | 14 #include "ppapi/proxy/interface_proxy.h" |
| 15 #include "ppapi/proxy/plugin_resource.h" | |
| 16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 15 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
| 16 #include "ppapi/shared_impl/resource.h" |
| 17 #include "ppapi/thunk/ppb_surface_3d_api.h" | 17 #include "ppapi/thunk/ppb_surface_3d_api.h" |
| 18 | 18 |
| 19 struct PPB_Surface3D_Dev; | 19 struct PPB_Surface3D_Dev; |
| 20 | 20 |
| 21 namespace pp { | 21 namespace pp { |
| 22 namespace proxy { | 22 namespace proxy { |
| 23 | 23 |
| 24 class Context3D; | 24 class Context3D; |
| 25 | 25 |
| 26 class Surface3D : public PluginResource, | 26 class Surface3D : public ppapi::Resource, |
| 27 public ppapi::thunk::PPB_Surface3D_API { | 27 public ppapi::thunk::PPB_Surface3D_API { |
| 28 public: | 28 public: |
| 29 explicit Surface3D(const ppapi::HostResource& host_resource); | 29 explicit Surface3D(const ppapi::HostResource& host_resource); |
| 30 virtual ~Surface3D(); | 30 virtual ~Surface3D(); |
| 31 | 31 |
| 32 // ResourceObjectBase overrides. | 32 // Resource overrides. |
| 33 virtual PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE; | 33 virtual PPB_Surface3D_API* AsPPB_Surface3D_API() OVERRIDE; |
| 34 | 34 |
| 35 // PPB_Surface3D_API implementation. | 35 // PPB_Surface3D_API implementation. |
| 36 virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE; | 36 virtual int32_t SetAttrib(int32_t attribute, int32_t value) OVERRIDE; |
| 37 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE; | 37 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE; |
| 38 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; | 38 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; |
| 39 | 39 |
| 40 void SwapBuffersACK(int32_t pp_error); | 40 void SwapBuffersACK(int32_t pp_error); |
| 41 | 41 |
| 42 bool is_flush_pending() const { return !!current_flush_callback_.func; } | 42 bool is_flush_pending() const { return !!current_flush_callback_.func; } |
| 43 | 43 |
| 44 PP_CompletionCallback current_flush_callback() const { | 44 PP_CompletionCallback current_flush_callback() const { |
| 45 return current_flush_callback_; | 45 return current_flush_callback_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void set_context(Context3D* context) { | 48 void set_context(Context3D* context) { |
| 49 context_ = context; | 49 context_ = context; |
| 50 } | 50 } |
| 51 | 51 |
| 52 Context3D* context() const { return context_; } | 52 Context3D* context() const { return context_; } |
| 53 | 53 |
| 54 void set_resource(PP_Resource resource) { resource_ = resource; } | |
| 55 PP_Resource resource() const { return resource_; } | |
| 56 | |
| 57 private: | 54 private: |
| 58 PP_Resource resource_; | |
| 59 Context3D* context_; | 55 Context3D* context_; |
| 60 | 56 |
| 61 // In the plugin, this is the current callback set for Flushes. When the | 57 // In the plugin, this is the current callback set for Flushes. When the |
| 62 // callback function pointer is non-NULL, we're waiting for a flush ACK. | 58 // callback function pointer is non-NULL, we're waiting for a flush ACK. |
| 63 PP_CompletionCallback current_flush_callback_; | 59 PP_CompletionCallback current_flush_callback_; |
| 64 | 60 |
| 65 DISALLOW_COPY_AND_ASSIGN(Surface3D); | 61 DISALLOW_COPY_AND_ASSIGN(Surface3D); |
| 66 }; | 62 }; |
| 67 | 63 |
| 68 class PPB_Surface3D_Proxy : public InterfaceProxy { | 64 class PPB_Surface3D_Proxy : public InterfaceProxy { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 94 const ppapi::HostResource& surface_3d); | 90 const ppapi::HostResource& surface_3d); |
| 95 | 91 |
| 96 CompletionCallbackFactory<PPB_Surface3D_Proxy, | 92 CompletionCallbackFactory<PPB_Surface3D_Proxy, |
| 97 ProxyNonThreadSafeRefCount> callback_factory_; | 93 ProxyNonThreadSafeRefCount> callback_factory_; |
| 98 }; | 94 }; |
| 99 | 95 |
| 100 } // namespace proxy | 96 } // namespace proxy |
| 101 } // namespace pp | 97 } // namespace pp |
| 102 | 98 |
| 103 #endif // PPAPI_PPB_SURFACE_3D_PROXY_H_ | 99 #endif // PPAPI_PPB_SURFACE_3D_PROXY_H_ |
| OLD | NEW |