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

Unified Diff: ppapi/proxy/ppb_broker_proxy.cc

Issue 7874002: This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | « ppapi/proxy/ppb_broker_proxy.h ('k') | ppapi/proxy/ppb_buffer_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_broker_proxy.cc
===================================================================
--- ppapi/proxy/ppb_broker_proxy.cc (revision 100758)
+++ ppapi/proxy/ppb_broker_proxy.cc (working copy)
@@ -11,6 +11,7 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/thunk/ppb_broker_api.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
using ppapi::thunk::PPB_Broker_API;
@@ -40,11 +41,6 @@
#endif
}
-InterfaceProxy* CreateBrokerProxy(Dispatcher* dispatcher,
- const void* target_interface) {
- return new PPB_Broker_Proxy(dispatcher, target_interface);
-}
-
} // namespace
class Broker : public PPB_Broker_API, public Resource {
@@ -147,9 +143,8 @@
PP_RunAndClearCompletionCallback(&current_connect_callback_, result);
}
-PPB_Broker_Proxy::PPB_Broker_Proxy(Dispatcher* dispatcher,
- const void* target_interface)
- : InterfaceProxy(dispatcher, target_interface) ,
+PPB_Broker_Proxy::PPB_Broker_Proxy(Dispatcher* dispatcher)
+ : InterfaceProxy(dispatcher),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)){
}
@@ -157,18 +152,6 @@
}
// static
-const InterfaceProxy::Info* PPB_Broker_Proxy::GetInfo() {
- static const Info info = {
- ppapi::thunk::GetPPB_Broker_Thunk(),
- PPB_BROKER_TRUSTED_INTERFACE,
- INTERFACE_ID_PPB_BROKER,
- true,
- &CreateBrokerProxy,
- };
- return &info;
-}
-
-// static
PP_Resource PPB_Broker_Proxy::CreateProxyResource(PP_Instance instance) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
@@ -196,9 +179,12 @@
void PPB_Broker_Proxy::OnMsgCreate(PP_Instance instance,
HostResource* result_resource) {
- result_resource->SetHostResource(
- instance,
- ppb_broker_target()->CreateTrusted(instance));
+ thunk::EnterResourceCreation enter(instance);
+ if (enter.succeeded()) {
+ result_resource->SetHostResource(
+ instance,
+ enter.functions()->CreateBroker(instance));
+ }
}
void PPB_Broker_Proxy::OnMsgConnect(const HostResource& broker) {
@@ -240,8 +226,9 @@
IPC::InvalidPlatformFileForTransit();
if (result == PP_OK) {
int32_t socket_handle = PlatformFileToInt(base::kInvalidPlatformFileValue);
- result = ppb_broker_target()->GetHandle(broker.host_resource(),
- &socket_handle);
+ EnterHostFromHostResource<PPB_Broker_API> enter(broker);
+ if (enter.succeeded())
+ result = enter.object()->GetHandle(&socket_handle);
DCHECK(result == PP_OK ||
socket_handle == PlatformFileToInt(base::kInvalidPlatformFileValue));
« no previous file with comments | « ppapi/proxy/ppb_broker_proxy.h ('k') | ppapi/proxy/ppb_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698