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/plugin_startup.h" | 5 #include "ppapi/nacl_irt/plugin_startup.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_descriptor_posix.h" | 8 #include "base/file_descriptor_posix.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "ipc/ipc_channel_handle.h" | 14 #include "ipc/ipc_channel_handle.h" |
15 #include "ppapi/nacl_irt/manifest_service.h" | 15 #include "ppapi/nacl_irt/manifest_service.h" |
16 #include "ppapi/shared_impl/ppb_audio_shared.h" | 16 #include "ppapi/shared_impl/ppb_audio_shared.h" |
17 | 17 |
18 namespace ppapi { | 18 namespace ppapi { |
19 namespace { | 19 namespace { |
20 | 20 |
21 IPC::ChannelHandle* g_nacl_browser_ipc_handle = nullptr; | 21 IPC::ChannelHandle* g_nacl_browser_ipc_handle = nullptr; |
22 IPC::ChannelHandle* g_nacl_renderer_ipc_handle = nullptr; | 22 IPC::ChannelHandle* g_nacl_renderer_ipc_handle = nullptr; |
23 IPC::ChannelHandle* g_manifest_service_handle = nullptr; | 23 IPC::ChannelHandle* g_manifest_service_handle = nullptr; |
24 | 24 |
25 base::WaitableEvent* g_shutdown_event = NULL; | 25 base::WaitableEvent* g_shutdown_event = NULL; |
26 base::Thread* g_io_thread = NULL; | 26 base::Thread* g_io_thread = NULL; |
27 ManifestService* g_manifest_service = NULL; | 27 ManifestService* g_manifest_service = NULL; |
28 | 28 |
29 bool IsValidChannelHandle(IPC::ChannelHandle* handle) { | 29 bool IsValidChannelHandle(IPC::ChannelHandle* handle) { |
30 // ChannelMojo not yet supported. | 30 return handle && (handle->socket.fd != -1 || handle->mojo_handle.is_valid()); |
31 return handle && handle->socket.fd != -1 && !handle->mojo_handle.is_valid(); | |
32 } | 31 } |
33 | 32 |
34 // Creates the manifest service on IO thread so that its Listener's thread and | 33 // Creates the manifest service on IO thread so that its Listener's thread and |
35 // IO thread are shared. Upon completion of the manifest service creation, | 34 // IO thread are shared. Upon completion of the manifest service creation, |
36 // event is signaled. | 35 // event is signaled. |
37 void StartUpManifestServiceOnIOThread(base::WaitableEvent* event) { | 36 void StartUpManifestServiceOnIOThread(base::WaitableEvent* event) { |
38 // The start up must be called only once. | 37 // The start up must be called only once. |
39 DCHECK(!g_manifest_service); | 38 DCHECK(!g_manifest_service); |
40 // manifest_service_handle must be set. | 39 // manifest_service_handle must be set. |
41 DCHECK(IsValidChannelHandle(g_manifest_service_handle)); | 40 DCHECK(IsValidChannelHandle(g_manifest_service_handle)); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // The IOThread must be initialized in advance. | 114 // The IOThread must be initialized in advance. |
116 DCHECK(g_io_thread); | 115 DCHECK(g_io_thread); |
117 return g_io_thread; | 116 return g_io_thread; |
118 } | 117 } |
119 | 118 |
120 ManifestService* GetManifestService() { | 119 ManifestService* GetManifestService() { |
121 return g_manifest_service; | 120 return g_manifest_service; |
122 } | 121 } |
123 | 122 |
124 } // namespace ppapi | 123 } // namespace ppapi |
OLD | NEW |