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