Commit b29f0e30 authored by brettw@chromium.org's avatar brettw@chromium.org

Move the refcounting from the proxy/impl resource object to the shared resource object base class.

Fix the audio and video code which shouldn't have derived from the
ResourceObjectBase class. This produced a diamond inheritance on refcounted.

The refcounting for resources is no longer threadsafe. We weren't doing any
thread stuff with these, so this should be fine.

There should be no behavior change.

BUG=
TEST=

Review URL: http://codereview.chromium.org/7608033

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96394 0039d316-1c4b-4281-b951-d872f2087c98
parent d7db5688
......@@ -6,7 +6,6 @@
#define PPAPI_PROXY_PLUGIN_RESOURCE_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/host_resource.h"
#include "ppapi/proxy/plugin_dispatcher.h"
......@@ -46,8 +45,7 @@ namespace proxy {
FOR_ALL_PLUGIN_RESOURCES(DECLARE_RESOURCE_CLASS)
#undef DECLARE_RESOURCE_CLASS
class PluginResource : public ::ppapi::ResourceObjectBase,
public base::RefCounted<PluginResource> {
class PluginResource : public ::ppapi::ResourceObjectBase {
public:
PluginResource(const HostResource& resource);
virtual ~PluginResource();
......
......@@ -25,10 +25,6 @@ AudioImpl::~AudioImpl() {
}
}
::ppapi::thunk::PPB_Audio_API* AudioImpl::AsPPB_Audio_API() {
return this;
}
void AudioImpl::SetCallback(PPB_Audio_Callback callback, void* user_data) {
callback_ = callback;
user_data_ = user_data;
......
......@@ -18,16 +18,12 @@ namespace ppapi {
// Implements the logic to map shared memory and run the audio thread signaled
// from the sync socket. Both the proxy and the renderer implementation use
// this code.
class AudioImpl : public ResourceObjectBase,
public thunk::PPB_Audio_API,
class AudioImpl : public thunk::PPB_Audio_API,
public base::DelegateSimpleThread::Delegate {
public:
AudioImpl();
virtual ~AudioImpl();
// ResourceObjectBase implementation.
virtual ::ppapi::thunk::PPB_Audio_API* AsPPB_Audio_API() OVERRIDE;
bool playing() const { return playing_; }
// Sets the callback information that the background thread will use. This
......
......@@ -7,6 +7,8 @@
#include <stddef.h> // For NULL.
#include "base/memory/ref_counted.h"
#define FOR_ALL_PPAPI_RESOURCE_APIS(F) \
F(PPB_AudioConfig_API) \
F(PPB_AudioTrusted_API) \
......@@ -51,7 +53,7 @@ FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS)
#undef DECLARE_RESOURCE_CLASS
} // namespace thunk
class ResourceObjectBase {
class ResourceObjectBase : public base::RefCounted<ResourceObjectBase> {
public:
virtual ~ResourceObjectBase();
......
......@@ -22,10 +22,6 @@ VideoDecoderImpl::VideoDecoderImpl()
gles2_impl_(NULL) {
}
thunk::PPB_VideoDecoder_API* VideoDecoderImpl::AsPPB_VideoDecoder_API() {
return this;
}
VideoDecoderImpl::~VideoDecoderImpl() {
}
......
......@@ -30,15 +30,11 @@ namespace ppapi {
// Implements the logic to set and run callbacks for various video decoder
// events. Both the proxy and the renderer implementation share this code.
class VideoDecoderImpl : public ResourceObjectBase,
public thunk::PPB_VideoDecoder_API {
class VideoDecoderImpl : public thunk::PPB_VideoDecoder_API {
public:
VideoDecoderImpl();
virtual ~VideoDecoderImpl();
// ResourceObjectBase implementation.
virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
// PPB_VideoDecoder_API implementation.
virtual void Destroy() OVERRIDE;
......
......@@ -6,7 +6,6 @@
#define WEBKIT_PLUGINS_PPAPI_RESOURCE_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/shared_impl/resource_object_base.h"
#include "webkit/plugins/ppapi/resource_tracker.h"
......@@ -14,8 +13,7 @@
namespace webkit {
namespace ppapi {
class Resource : public base::RefCountedThreadSafe<Resource>,
public ::ppapi::ResourceObjectBase {
class Resource : public ::ppapi::ResourceObjectBase {
public:
explicit Resource(PluginInstance* instance);
virtual ~Resource();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment