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

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

Issue 6286070: Remove all uses of the global Dispatcher Get function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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_cursor_control_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) 2010 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/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 &AddRefResource, 72 &AddRefResource,
73 &ReleaseResource, 73 &ReleaseResource,
74 &MemAlloc, 74 &MemAlloc,
75 &MemFree, 75 &MemFree,
76 &GetTime, 76 &GetTime,
77 &GetTimeTicks, 77 &GetTimeTicks,
78 &CallOnMainThread, 78 &CallOnMainThread,
79 &IsMainThread 79 &IsMainThread
80 }; 80 };
81 81
82 InterfaceProxy* CreateCoreProxy(Dispatcher* dispatcher,
83 const void* target_interface) {
84 return new PPB_Core_Proxy(dispatcher, target_interface);
85 }
86
82 } // namespace 87 } // namespace
83 88
84 PPB_Core_Proxy::PPB_Core_Proxy(Dispatcher* dispatcher, 89 PPB_Core_Proxy::PPB_Core_Proxy(Dispatcher* dispatcher,
85 const void* target_interface) 90 const void* target_interface)
86 : InterfaceProxy(dispatcher, target_interface) { 91 : InterfaceProxy(dispatcher, target_interface) {
87 } 92 }
88 93
89 PPB_Core_Proxy::~PPB_Core_Proxy() { 94 PPB_Core_Proxy::~PPB_Core_Proxy() {
90 } 95 }
91 96
92 const void* PPB_Core_Proxy::GetSourceInterface() const { 97 // static
93 return &core_interface; 98 const InterfaceProxy::Info* PPB_Core_Proxy::GetInfo() {
94 } 99 static const Info info = {
95 100 &core_interface,
96 InterfaceID PPB_Core_Proxy::GetInterfaceId() const { 101 PPB_CORE_INTERFACE,
97 return INTERFACE_ID_PPB_CORE; 102 INTERFACE_ID_PPB_CORE,
103 false,
104 &CreateCoreProxy,
105 };
106 return &info;
98 } 107 }
99 108
100 bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) { 109 bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) {
101 bool handled = true; 110 bool handled = true;
102 IPC_BEGIN_MESSAGE_MAP(PPB_Core_Proxy, msg) 111 IPC_BEGIN_MESSAGE_MAP(PPB_Core_Proxy, msg)
103 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource, 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource,
104 OnMsgAddRefResource) 113 OnMsgAddRefResource)
105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource, 114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource,
106 OnMsgReleaseResource) 115 OnMsgReleaseResource)
107 IPC_MESSAGE_UNHANDLED(handled = false) 116 IPC_MESSAGE_UNHANDLED(handled = false)
108 IPC_END_MESSAGE_MAP() 117 IPC_END_MESSAGE_MAP()
109 // TODO(brettw) handle bad messages! 118 // TODO(brettw) handle bad messages!
110 return handled; 119 return handled;
111 } 120 }
112 121
113 void PPB_Core_Proxy::OnMsgAddRefResource(HostResource resource) { 122 void PPB_Core_Proxy::OnMsgAddRefResource(HostResource resource) {
114 ppb_core_target()->AddRefResource(resource.host_resource()); 123 ppb_core_target()->AddRefResource(resource.host_resource());
115 } 124 }
116 125
117 void PPB_Core_Proxy::OnMsgReleaseResource(HostResource resource) { 126 void PPB_Core_Proxy::OnMsgReleaseResource(HostResource resource) {
118 ppb_core_target()->ReleaseResource(resource.host_resource()); 127 ppb_core_target()->ReleaseResource(resource.host_resource());
119 } 128 }
120 129
121 } // namespace proxy 130 } // namespace proxy
122 } // namespace pp 131 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_core_proxy.h ('k') | ppapi/proxy/ppb_cursor_control_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698