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

Unified Diff: ppapi/proxy/ppb_flash_tcp_socket_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: Address review comments 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_flash_tcp_socket_proxy.cc
diff --git a/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc b/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc
index 5e5a272ef54e67306fa154d72d4b42efd20320c1..e0b0894684855cab4b566658c09ed713cc2eab7b 100644
--- a/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc
+++ b/ppapi/proxy/ppb_flash_tcp_socket_proxy.cc
@@ -14,13 +14,14 @@
#include "base/task.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/resource.h"
#include "ppapi/thunk/ppb_flash_tcp_socket_api.h"
#include "ppapi/thunk/thunk.h"
using ppapi::HostResource;
+using ppapi::Resource;
using ppapi::thunk::PPB_Flash_TCPSocket_API;
namespace pp {
@@ -58,12 +59,12 @@ InterfaceProxy* CreateFlashTCPSocketProxy(Dispatcher* dispatcher,
} // namespace
class FlashTCPSocket : public PPB_Flash_TCPSocket_API,
- public PluginResource {
+ public Resource {
public:
FlashTCPSocket(const HostResource& resource, uint32 socket_id);
virtual ~FlashTCPSocket();
- // ResourceObjectBase overrides.
+ // Resource overrides.
virtual PPB_Flash_TCPSocket_API* AsPPB_Flash_TCPSocket_API() OVERRIDE;
// PPB_Flash_TCPSocket_API implementation.
@@ -110,6 +111,10 @@ class FlashTCPSocket : public PPB_Flash_TCPSocket_API,
bool IsConnected() const;
+ PluginDispatcher* GetDispatcher() const {
+ return PluginDispatcher::GetForResource(this);
+ }
+
// Backend for both Connect() and ConnectWithNetAddress(). To keep things
// generic, the message is passed in (on error, it's deleted).
int32_t ConnectWithMessage(IPC::Message* msg,
@@ -135,7 +140,7 @@ class FlashTCPSocket : public PPB_Flash_TCPSocket_API,
};
FlashTCPSocket::FlashTCPSocket(const HostResource& resource, uint32 socket_id)
- : PluginResource(resource),
+ : Resource(resource),
socket_id_(socket_id),
connection_state_(BEFORE_CONNECT),
connect_callback_(PP_BlockUntilComplete()),
@@ -420,9 +425,8 @@ PP_Resource PPB_Flash_TCPSocket_Proxy::CreateProxyResource(
&socket_id));
if (socket_id == 0)
return 0;
-
- return PluginResourceTracker::GetInstance()->AddResource(
- new FlashTCPSocket(HostResource::MakeInstanceOnly(instance), socket_id));
+ return (new FlashTCPSocket(HostResource::MakeInstanceOnly(instance),
+ socket_id))->GetReference();
}
bool PPB_Flash_TCPSocket_Proxy::OnMessageReceived(const IPC::Message& msg) {

Powered by Google App Engine
This is Rietveld 408576698