Chromium Code Reviews| 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 abe8a2d8e67e9ba8d7f4b81938492f2be2c4a36b..24838ea79c7c3cc208ce6eb84513a7bd461b23bc 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. |
| @@ -101,6 +102,10 @@ class FlashTCPSocket : public PPB_Flash_TCPSocket_API, |
| DISCONNECTED |
| }; |
| + PluginDispatcher* GetDispatcher() const { |
| + return PluginDispatcher::GetForResource(this); |
| + } |
|
dmichael (off chromium)
2011/08/17 16:28:07
optional nit: You didn't do this anywhere else...
brettw
2011/08/17 17:16:25
I did this in a few places where we used GetDispat
|
| + |
| // 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, |
| @@ -125,7 +130,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()), |
| @@ -374,9 +379,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) { |