OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/nacl_irt/ppapi_dispatcher.h" | 5 #include "ppapi/nacl_irt/ppapi_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 175 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
176 logging::InitLogging(settings); | 176 logging::InitLogging(settings); |
177 | 177 |
178 proxy::PluginGlobals::Get()->set_keepalive_throttle_interval_milliseconds( | 178 proxy::PluginGlobals::Get()->set_keepalive_throttle_interval_milliseconds( |
179 args.keepalive_throttle_interval_milliseconds); | 179 args.keepalive_throttle_interval_milliseconds); |
180 | 180 |
181 // Tell the process-global GetInterface which interfaces it can return to the | 181 // Tell the process-global GetInterface which interfaces it can return to the |
182 // plugin. | 182 // plugin. |
183 proxy::InterfaceList::SetProcessGlobalPermissions(args.permissions); | 183 proxy::InterfaceList::SetProcessGlobalPermissions(args.permissions); |
184 | 184 |
185 // Notify the renderer process, if necessary. | |
186 ManifestService* manifest_service = GetManifestService(); | |
187 if (manifest_service) | |
188 manifest_service->StartupInitializationComplete(); | |
189 | |
190 int32_t error = ::PPP_InitializeModule( | 185 int32_t error = ::PPP_InitializeModule( |
191 0 /* module */, | 186 0 /* module */, |
192 &proxy::PluginDispatcher::GetBrowserInterface); | 187 &proxy::PluginDispatcher::GetBrowserInterface); |
193 if (error) | 188 if (error) |
194 ::exit(error); | 189 ::exit(error); |
195 | 190 |
196 proxy::PluginDispatcher* dispatcher = | 191 proxy::PluginDispatcher* dispatcher = |
197 new proxy::PluginDispatcher(::PPP_GetInterface, args.permissions, | 192 new proxy::PluginDispatcher(::PPP_GetInterface, args.permissions, |
198 args.off_the_record); | 193 args.off_the_record); |
199 IPC::ChannelHandle channel_handle( | 194 IPC::ChannelHandle channel_handle( |
200 "nacl", | 195 "nacl", |
201 base::FileDescriptor(renderer_ipc_fd_, false)); | 196 base::FileDescriptor(renderer_ipc_fd_, false)); |
202 if (!dispatcher->InitPluginWithChannel(this, base::kNullProcessId, | 197 if (!dispatcher->InitPluginWithChannel(this, base::kNullProcessId, |
203 channel_handle, false)) { | 198 channel_handle, false)) { |
204 delete dispatcher; | 199 delete dispatcher; |
205 return; | 200 return; |
206 } | 201 } |
207 // From here, the dispatcher will manage its own lifetime according to the | 202 // From here, the dispatcher will manage its own lifetime according to the |
208 // lifetime of the attached channel. | 203 // lifetime of the attached channel. |
| 204 |
| 205 // Notify the renderer process, if necessary. |
| 206 ManifestService* manifest_service = GetManifestService(); |
| 207 if (manifest_service) |
| 208 manifest_service->StartupInitializationComplete(); |
209 } | 209 } |
210 | 210 |
211 void PpapiDispatcher::OnPluginDispatcherMessageReceived( | 211 void PpapiDispatcher::OnPluginDispatcherMessageReceived( |
212 const IPC::Message& msg) { | 212 const IPC::Message& msg) { |
213 // The first parameter should be a plugin dispatcher ID. | 213 // The first parameter should be a plugin dispatcher ID. |
214 PickleIterator iter(msg); | 214 PickleIterator iter(msg); |
215 uint32 id = 0; | 215 uint32 id = 0; |
216 if (!iter.ReadUInt32(&id)) { | 216 if (!iter.ReadUInt32(&id)) { |
217 NOTREACHED(); | 217 NOTREACHED(); |
218 return; | 218 return; |
219 } | 219 } |
220 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = | 220 std::map<uint32, proxy::PluginDispatcher*>::iterator dispatcher = |
221 plugin_dispatchers_.find(id); | 221 plugin_dispatchers_.find(id); |
222 if (dispatcher != plugin_dispatchers_.end()) | 222 if (dispatcher != plugin_dispatchers_.end()) |
223 dispatcher->second->OnMessageReceived(msg); | 223 dispatcher->second->OnMessageReceived(msg); |
224 } | 224 } |
225 | 225 |
226 } // namespace ppapi | 226 } // namespace ppapi |
OLD | NEW |