OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dispatcher.h" | 5 #include "ppapi/proxy/dispatcher.h" |
6 | 6 |
7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 declared_supported_remote_interfaces_(false), | 70 declared_supported_remote_interfaces_(false), |
71 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 71 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
72 memset(id_to_proxy_, 0, | 72 memset(id_to_proxy_, 0, |
73 static_cast<int>(INTERFACE_ID_COUNT) * sizeof(InterfaceProxy*)); | 73 static_cast<int>(INTERFACE_ID_COUNT) * sizeof(InterfaceProxy*)); |
74 } | 74 } |
75 | 75 |
76 Dispatcher::~Dispatcher() { | 76 Dispatcher::~Dispatcher() { |
77 } | 77 } |
78 | 78 |
79 bool Dispatcher::InitWithChannel(MessageLoop* ipc_message_loop, | 79 bool Dispatcher::InitWithChannel(MessageLoop* ipc_message_loop, |
80 const std::string& channel_name, | 80 const IPC::ChannelHandle& channel_handle, |
81 bool is_client, | 81 bool is_client, |
82 base::WaitableEvent* shutdown_event) { | 82 base::WaitableEvent* shutdown_event) { |
83 IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT | 83 IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT |
84 : IPC::Channel::MODE_SERVER; | 84 : IPC::Channel::MODE_SERVER; |
85 channel_.reset(new IPC::SyncChannel(channel_name, mode, this, | 85 channel_.reset(new IPC::SyncChannel(channel_handle, mode, this, |
86 ipc_message_loop, false, shutdown_event)); | 86 ipc_message_loop, false, shutdown_event)); |
87 return true; | 87 return true; |
88 } | 88 } |
89 | 89 |
90 void Dispatcher::OnMessageReceived(const IPC::Message& msg) { | 90 void Dispatcher::OnMessageReceived(const IPC::Message& msg) { |
91 // Control messages. | 91 // Control messages. |
92 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 92 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
93 IPC_BEGIN_MESSAGE_MAP(Dispatcher, msg) | 93 IPC_BEGIN_MESSAGE_MAP(Dispatcher, msg) |
94 IPC_MESSAGE_HANDLER(PpapiMsg_DeclareInterfaces, | 94 IPC_MESSAGE_HANDLER(PpapiMsg_DeclareInterfaces, |
95 OnMsgDeclareInterfaces) | 95 OnMsgDeclareInterfaces) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 if (interface_name == PPB_URLLOADERTRUSTED_INTERFACE) | 269 if (interface_name == PPB_URLLOADERTRUSTED_INTERFACE) |
270 return new PPB_URLLoaderTrusted_Proxy(this, interface_functions); | 270 return new PPB_URLLoaderTrusted_Proxy(this, interface_functions); |
271 } | 271 } |
272 | 272 |
273 return NULL; | 273 return NULL; |
274 } | 274 } |
275 | 275 |
276 } // namespace proxy | 276 } // namespace proxy |
277 } // namespace pp | 277 } // namespace pp |
278 | 278 |
OLD | NEW |