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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 g_nacl_browser_ipc_fd = browser_ipc_fd; | 56 g_nacl_browser_ipc_fd = browser_ipc_fd; |
57 g_nacl_renderer_ipc_fd = renderer_ipc_fd; | 57 g_nacl_renderer_ipc_fd = renderer_ipc_fd; |
58 g_manifest_service_fd = manifest_service_fd; | 58 g_manifest_service_fd = manifest_service_fd; |
59 } | 59 } |
60 | 60 |
61 void StartUpPlugin() { | 61 void StartUpPlugin() { |
62 // The start up must be called only once. | 62 // The start up must be called only once. |
63 DCHECK(!g_shutdown_event); | 63 DCHECK(!g_shutdown_event); |
64 DCHECK(!g_io_thread); | 64 DCHECK(!g_io_thread); |
65 | 65 |
66 g_shutdown_event = new base::WaitableEvent(true, false); | 66 g_shutdown_event = |
| 67 new base::WaitableEvent(base::WaitableEvent::ResetPolicy::MANUAL, |
| 68 base::WaitableEvent::InitialState::NOT_SIGNALED); |
67 g_io_thread = new base::Thread("Chrome_NaClIOThread"); | 69 g_io_thread = new base::Thread("Chrome_NaClIOThread"); |
68 g_io_thread->StartWithOptions( | 70 g_io_thread->StartWithOptions( |
69 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 71 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
70 | 72 |
71 if (g_manifest_service_fd != -1) { | 73 if (g_manifest_service_fd != -1) { |
72 // 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 |
73 // 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 |
74 // even before irt_ppapi_start invocation. | 76 // even before irt_ppapi_start invocation. |
75 // TODO(hidehiko,dmichael): This works, but is probably not well designed | 77 // TODO(hidehiko,dmichael): This works, but is probably not well designed |
76 // usage. Once a better approach is made, replace this by that way. | 78 // usage. Once a better approach is made, replace this by that way. |
77 // (crbug.com/364241). | 79 // (crbug.com/364241). |
78 base::WaitableEvent event(true, false); | 80 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 81 base::WaitableEvent::InitialState::NOT_SIGNALED); |
79 g_io_thread->task_runner()->PostTask( | 82 g_io_thread->task_runner()->PostTask( |
80 FROM_HERE, base::Bind(StartUpManifestServiceOnIOThread, &event)); | 83 FROM_HERE, base::Bind(StartUpManifestServiceOnIOThread, &event)); |
81 event.Wait(); | 84 event.Wait(); |
82 } | 85 } |
83 | 86 |
84 PPB_Audio_Shared::SetNaClMode(); | 87 PPB_Audio_Shared::SetNaClMode(); |
85 } | 88 } |
86 | 89 |
87 int GetBrowserIPCFileDescriptor() { | 90 int GetBrowserIPCFileDescriptor() { |
88 // The descriptor must be initialized in advance. | 91 // The descriptor must be initialized in advance. |
(...skipping 17 matching lines...) Expand all Loading... |
106 // The IOThread must be initialized in advance. | 109 // The IOThread must be initialized in advance. |
107 DCHECK(g_io_thread); | 110 DCHECK(g_io_thread); |
108 return g_io_thread; | 111 return g_io_thread; |
109 } | 112 } |
110 | 113 |
111 ManifestService* GetManifestService() { | 114 ManifestService* GetManifestService() { |
112 return g_manifest_service; | 115 return g_manifest_service; |
113 } | 116 } |
114 | 117 |
115 } // namespace ppapi | 118 } // namespace ppapi |
OLD | NEW |