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

Unified Diff: webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc

Issue 7149026: Implement flash menu and net connector resources using the API/thunk model. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_net_connector_impl.h ('k') | webkit/plugins/ppapi/ppb_image_data_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc (revision 89119)
+++ webkit/plugins/ppapi/ppb_flash_net_connector_impl.cc (working copy)
@@ -11,65 +11,11 @@
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+using ::ppapi::thunk::PPB_Flash_NetConnector_API;
+
namespace webkit {
namespace ppapi {
-namespace {
-
-PP_Resource Create(PP_Instance instance_id) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return 0;
-
- scoped_refptr<PPB_Flash_NetConnector_Impl> connector(
- new PPB_Flash_NetConnector_Impl(instance));
- return connector->GetReference();
-}
-
-PP_Bool IsFlashNetConnector(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<PPB_Flash_NetConnector_Impl>(resource));
-}
-
-int32_t ConnectTcp(PP_Resource connector_id,
- const char* host,
- uint16_t port,
- PP_FileHandle* socket_out,
- PP_Flash_NetAddress* local_addr_out,
- PP_Flash_NetAddress* remote_addr_out,
- PP_CompletionCallback callback) {
- scoped_refptr<PPB_Flash_NetConnector_Impl> connector(
- Resource::GetAs<PPB_Flash_NetConnector_Impl>(connector_id));
- if (!connector.get())
- return PP_ERROR_BADRESOURCE;
-
- return connector->ConnectTcp(
- host, port, socket_out, local_addr_out, remote_addr_out, callback);
-}
-
-int32_t ConnectTcpAddress(PP_Resource connector_id,
- const PP_Flash_NetAddress* addr,
- PP_FileHandle* socket_out,
- PP_Flash_NetAddress* local_addr_out,
- PP_Flash_NetAddress* remote_addr_out,
- PP_CompletionCallback callback) {
- scoped_refptr<PPB_Flash_NetConnector_Impl> connector(
- Resource::GetAs<PPB_Flash_NetConnector_Impl>(connector_id));
- if (!connector.get())
- return PP_ERROR_BADRESOURCE;
-
- return connector->ConnectTcpAddress(
- addr, socket_out, local_addr_out, remote_addr_out, callback);
-}
-
-const PPB_Flash_NetConnector ppb_flash_netconnector = {
- &Create,
- &IsFlashNetConnector,
- &ConnectTcp,
- &ConnectTcpAddress,
-};
-
-} // namespace
-
PPB_Flash_NetConnector_Impl::PPB_Flash_NetConnector_Impl(
PluginInstance* instance)
: Resource(instance) {
@@ -79,12 +25,18 @@
}
// static
-const PPB_Flash_NetConnector* PPB_Flash_NetConnector_Impl::GetInterface() {
- return &ppb_flash_netconnector;
+PP_Resource PPB_Flash_NetConnector_Impl::Create(PP_Instance pp_instance) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0;
+
+ scoped_refptr<PPB_Flash_NetConnector_Impl> connector(
+ new PPB_Flash_NetConnector_Impl(instance));
+ return connector->GetReference();
}
-PPB_Flash_NetConnector_Impl*
- PPB_Flash_NetConnector_Impl::AsPPB_Flash_NetConnector_Impl() {
+PPB_Flash_NetConnector_API*
+ PPB_Flash_NetConnector_Impl::AsPPB_Flash_NetConnector_API() {
return this;
}
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_net_connector_impl.h ('k') | webkit/plugins/ppapi/ppb_image_data_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698