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

Side by Side Diff: ppapi/proxy/ppb_core_proxy.cc

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_core_proxy.h ('k') | ppapi/proxy/ppb_crypto_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppb_core_proxy.h" 5 #include "ppapi/proxy/ppb_core_proxy.h"
6 6
7 #include <stdlib.h> // For malloc 7 #include <stdlib.h> // For malloc
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 const PPB_Core core_interface = { 69 const PPB_Core core_interface = {
70 &AddRefResource, 70 &AddRefResource,
71 &ReleaseResource, 71 &ReleaseResource,
72 &GetTime, 72 &GetTime,
73 &GetTimeTicks, 73 &GetTimeTicks,
74 &CallOnMainThread, 74 &CallOnMainThread,
75 &IsMainThread 75 &IsMainThread
76 }; 76 };
77 77
78 InterfaceProxy* CreateCoreProxy(Dispatcher* dispatcher,
79 const void* target_interface) {
80 return new PPB_Core_Proxy(dispatcher, target_interface);
81 }
82
78 } // namespace 83 } // namespace
79 84
80 PPB_Core_Proxy::PPB_Core_Proxy(Dispatcher* dispatcher) 85 PPB_Core_Proxy::PPB_Core_Proxy(Dispatcher* dispatcher,
81 : InterfaceProxy(dispatcher), 86 const void* target_interface)
82 ppb_core_impl_(NULL) { 87 : InterfaceProxy(dispatcher, target_interface) {
83 if (!dispatcher->IsPlugin()) {
84 ppb_core_impl_ = static_cast<const PPB_Core*>(
85 dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
86 }
87 } 88 }
88 89
89 PPB_Core_Proxy::~PPB_Core_Proxy() { 90 PPB_Core_Proxy::~PPB_Core_Proxy() {
90 } 91 }
91 92
92 // static 93 // static
93 const PPB_Core* PPB_Core_Proxy::GetPPB_Core_Interface() { 94 const InterfaceProxy::Info* PPB_Core_Proxy::GetInfo() {
94 return &core_interface; 95 static const Info info = {
96 &core_interface,
97 PPB_CORE_INTERFACE,
98 INTERFACE_ID_PPB_CORE,
99 false,
100 &CreateCoreProxy,
101 };
102 return &info;
95 } 103 }
96 104
97 bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) { 105 bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) {
98 bool handled = true; 106 bool handled = true;
99 IPC_BEGIN_MESSAGE_MAP(PPB_Core_Proxy, msg) 107 IPC_BEGIN_MESSAGE_MAP(PPB_Core_Proxy, msg)
100 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource, 108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource,
101 OnMsgAddRefResource) 109 OnMsgAddRefResource)
102 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource, 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource,
103 OnMsgReleaseResource) 111 OnMsgReleaseResource)
104 IPC_MESSAGE_UNHANDLED(handled = false) 112 IPC_MESSAGE_UNHANDLED(handled = false)
105 IPC_END_MESSAGE_MAP() 113 IPC_END_MESSAGE_MAP()
106 // TODO(brettw) handle bad messages! 114 // TODO(brettw) handle bad messages!
107 return handled; 115 return handled;
108 } 116 }
109 117
110 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) { 118 void PPB_Core_Proxy::OnMsgAddRefResource(const HostResource& resource) {
111 ppb_core_impl_->AddRefResource(resource.host_resource()); 119 ppb_core_target()->AddRefResource(resource.host_resource());
112 } 120 }
113 121
114 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) { 122 void PPB_Core_Proxy::OnMsgReleaseResource(const HostResource& resource) {
115 ppb_core_impl_->ReleaseResource(resource.host_resource()); 123 ppb_core_target()->ReleaseResource(resource.host_resource());
116 } 124 }
117 125
118 } // namespace proxy 126 } // namespace proxy
119 } // namespace ppapi 127 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_core_proxy.h ('k') | ppapi/proxy/ppb_crypto_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698