Convert ppapi/shared to use TrackedCallback.
Convert all classes in ppapi/shared_impl to use the new shared TrackedCallback
class for the PP_CompletionCallbacks.
This required a few changes to some shared objects to make them resources.
BUG=
TEST=
Review URL: http://codereview.chromium.org/9053003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116467 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h
index 6f3a04f..8804181 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.h
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h
@@ -9,6 +9,8 @@
#include "base/memory/scoped_ptr.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/ppb_graphics_3d_api.h"
namespace gpu {
@@ -22,8 +24,12 @@
namespace ppapi {
class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared
- : public thunk::PPB_Graphics3D_API {
+ : public Resource,
+ public thunk::PPB_Graphics3D_API {
public:
+ // Resource overrides.
+ virtual thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE;
+
// PPB_Graphics3D_API implementation.
virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE;
virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE;
@@ -49,13 +55,14 @@
void SwapBuffersACK(int32_t pp_error);
protected:
- PPB_Graphics3D_Shared();
+ PPB_Graphics3D_Shared(PP_Instance instance);
+ PPB_Graphics3D_Shared(const HostResource& host_resource);
virtual ~PPB_Graphics3D_Shared();
virtual gpu::CommandBuffer* GetCommandBuffer() = 0;
virtual int32 DoSwapBuffers() = 0;
- bool HasPendingSwap() { return swap_callback_.func != NULL; }
+ bool HasPendingSwap() const;
bool CreateGLES2Impl(int32 command_buffer_size,
int32 transfer_buffer_size);
void DestroyGLES2Impl();
@@ -66,7 +73,7 @@
scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
// Callback that needs to be executed when swap-buffers is completed.
- PP_CompletionCallback swap_callback_;
+ scoped_refptr<TrackedCallback> swap_callback_;
DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared);
};