Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: ppapi/proxy/ppb_broker_proxy.cc

Issue 7629017: Add a unified resource tracker shared between the proxy and the impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Assertion fixed Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/ppb_broker_proxy.cc
diff --git a/ppapi/proxy/ppb_broker_proxy.cc b/ppapi/proxy/ppb_broker_proxy.cc
index ac996998f874ddc37b10c68b51aaab9123d7b01f..b0ebcb52f0bfe9056f8196d8f8fca7f94164cf61 100644
--- a/ppapi/proxy/ppb_broker_proxy.cc
+++ b/ppapi/proxy/ppb_broker_proxy.cc
@@ -8,13 +8,13 @@
#include "ppapi/c/trusted/ppb_broker_trusted.h"
#include "ppapi/proxy/enter_proxy.h"
#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/thunk/ppb_broker_api.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
using ppapi::HostResource;
+using ppapi::Resource;
using ppapi::thunk::PPB_Broker_API;
namespace pp {
@@ -49,12 +49,12 @@ InterfaceProxy* CreateBrokerProxy(Dispatcher* dispatcher,
} // namespace
-class Broker : public PPB_Broker_API, public PluginResource {
+class Broker : public PPB_Broker_API, public Resource {
public:
explicit Broker(const HostResource& resource);
virtual ~Broker();
- // ResourceObjectBase overries.
+ // Resource overries.
virtual PPB_Broker_API* AsPPB_Broker_API() OVERRIDE;
// PPB_Broker_API implementation.
@@ -78,8 +78,7 @@ class Broker : public PPB_Broker_API, public PluginResource {
DISALLOW_COPY_AND_ASSIGN(Broker);
};
-Broker::Broker(const HostResource& resource)
- : PluginResource(resource),
+Broker::Broker(const HostResource& resource) : Resource(resource),
called_connect_(false),
current_connect_callback_(PP_MakeCompletionCallback(NULL, NULL)),
socket_handle_(base::kInvalidPlatformFileValue) {
@@ -116,8 +115,9 @@ int32_t Broker::Connect(PP_CompletionCallback connect_callback) {
current_connect_callback_ = connect_callback;
called_connect_ = true;
- bool success = GetDispatcher()->Send(new PpapiHostMsg_PPBBroker_Connect(
- INTERFACE_ID_PPB_BROKER, host_resource()));
+ bool success = PluginDispatcher::GetForResource(this)->Send(
dmichael (off chromium) 2011/08/17 16:28:07 optional nit: Most places I've seen so far, you're
+ new PpapiHostMsg_PPBBroker_Connect(
+ INTERFACE_ID_PPB_BROKER, host_resource()));
return success ? PP_OK_COMPLETIONPENDING : PP_ERROR_FAILED;
}
@@ -181,8 +181,7 @@ PP_Resource PPB_Broker_Proxy::CreateProxyResource(PP_Instance instance) {
INTERFACE_ID_PPB_BROKER, instance, &result));
if (result.is_null())
return 0;
-
- return PluginResourceTracker::GetInstance()->AddResource(new Broker(result));
+ return (new Broker(result))->GetReference();
}
bool PPB_Broker_Proxy::OnMessageReceived(const IPC::Message& msg) {

Powered by Google App Engine
This is Rietveld 408576698