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 "mojo/edk/embedder/embedder.h" |
15 #include "ppapi/nacl_irt/manifest_service.h" | 16 #include "ppapi/nacl_irt/manifest_service.h" |
16 #include "ppapi/shared_impl/ppb_audio_shared.h" | 17 #include "ppapi/shared_impl/ppb_audio_shared.h" |
17 | 18 |
18 namespace ppapi { | 19 namespace ppapi { |
19 namespace { | 20 namespace { |
20 | 21 |
21 int g_nacl_browser_ipc_fd = -1; | 22 int g_nacl_browser_ipc_fd = -1; |
22 int g_nacl_renderer_ipc_fd = -1; | 23 int g_nacl_renderer_ipc_fd = -1; |
23 int g_manifest_service_fd = -1; | 24 int g_manifest_service_fd = -1; |
24 | 25 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 g_nacl_browser_ipc_fd = browser_ipc_fd; | 57 g_nacl_browser_ipc_fd = browser_ipc_fd; |
57 g_nacl_renderer_ipc_fd = renderer_ipc_fd; | 58 g_nacl_renderer_ipc_fd = renderer_ipc_fd; |
58 g_manifest_service_fd = manifest_service_fd; | 59 g_manifest_service_fd = manifest_service_fd; |
59 } | 60 } |
60 | 61 |
61 void StartUpPlugin() { | 62 void StartUpPlugin() { |
62 // The start up must be called only once. | 63 // The start up must be called only once. |
63 DCHECK(!g_shutdown_event); | 64 DCHECK(!g_shutdown_event); |
64 DCHECK(!g_io_thread); | 65 DCHECK(!g_io_thread); |
65 | 66 |
| 67 // The Mojo EDK must be initialized before using IPC. |
| 68 mojo::edk::Init(); |
| 69 |
66 g_shutdown_event = | 70 g_shutdown_event = |
67 new base::WaitableEvent(base::WaitableEvent::ResetPolicy::MANUAL, | 71 new base::WaitableEvent(base::WaitableEvent::ResetPolicy::MANUAL, |
68 base::WaitableEvent::InitialState::NOT_SIGNALED); | 72 base::WaitableEvent::InitialState::NOT_SIGNALED); |
69 g_io_thread = new base::Thread("Chrome_NaClIOThread"); | 73 g_io_thread = new base::Thread("Chrome_NaClIOThread"); |
70 g_io_thread->StartWithOptions( | 74 g_io_thread->StartWithOptions( |
71 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 75 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
72 | 76 |
73 if (g_manifest_service_fd != -1) { | 77 if (g_manifest_service_fd != -1) { |
74 // Manifest service must be created on IOThread so that the main message | 78 // Manifest service must be created on IOThread so that the main message |
75 // handling will be done on the thread, which has a message loop | 79 // handling will be done on the thread, which has a message loop |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // The IOThread must be initialized in advance. | 113 // The IOThread must be initialized in advance. |
110 DCHECK(g_io_thread); | 114 DCHECK(g_io_thread); |
111 return g_io_thread; | 115 return g_io_thread; |
112 } | 116 } |
113 | 117 |
114 ManifestService* GetManifestService() { | 118 ManifestService* GetManifestService() { |
115 return g_manifest_service; | 119 return g_manifest_service; |
116 } | 120 } |
117 | 121 |
118 } // namespace ppapi | 122 } // namespace ppapi |
OLD | NEW |