| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "ipc/ipc_channel_handle.h" | 12 #include "ipc/ipc_channel_handle.h" |
| 13 #include "ppapi/nacl_irt/manifest_service.h" | 13 #include "ppapi/nacl_irt/manifest_service.h" |
| 14 #include "ppapi/shared_impl/ppb_audio_shared.h" |
| 14 | 15 |
| 15 namespace ppapi { | 16 namespace ppapi { |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 int g_nacl_browser_ipc_fd = -1; | 19 int g_nacl_browser_ipc_fd = -1; |
| 19 int g_nacl_renderer_ipc_fd = -1; | 20 int g_nacl_renderer_ipc_fd = -1; |
| 20 int g_manifest_service_fd = -1; | 21 int g_manifest_service_fd = -1; |
| 21 | 22 |
| 22 base::WaitableEvent* g_shutdown_event = NULL; | 23 base::WaitableEvent* g_shutdown_event = NULL; |
| 23 base::Thread* g_io_thread = NULL; | 24 base::Thread* g_io_thread = NULL; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // even before irt_ppapi_start invocation. | 73 // even before irt_ppapi_start invocation. |
| 73 // TODO(hidehiko,dmichael): This works, but is probably not well designed | 74 // TODO(hidehiko,dmichael): This works, but is probably not well designed |
| 74 // usage. Once a better approach is made, replace this by that way. | 75 // usage. Once a better approach is made, replace this by that way. |
| 75 // (crbug.com/364241). | 76 // (crbug.com/364241). |
| 76 base::WaitableEvent event(true, false); | 77 base::WaitableEvent event(true, false); |
| 77 g_io_thread->message_loop_proxy()->PostTask( | 78 g_io_thread->message_loop_proxy()->PostTask( |
| 78 FROM_HERE, | 79 FROM_HERE, |
| 79 base::Bind(StartUpManifestServiceOnIOThread, &event)); | 80 base::Bind(StartUpManifestServiceOnIOThread, &event)); |
| 80 event.Wait(); | 81 event.Wait(); |
| 81 } | 82 } |
| 83 |
| 84 PPB_Audio_Shared::SetNaClMode(); |
| 82 } | 85 } |
| 83 | 86 |
| 84 int GetBrowserIPCFileDescriptor() { | 87 int GetBrowserIPCFileDescriptor() { |
| 85 // The descriptor must be initialized in advance. | 88 // The descriptor must be initialized in advance. |
| 86 DCHECK_NE(g_nacl_browser_ipc_fd, -1); | 89 DCHECK_NE(g_nacl_browser_ipc_fd, -1); |
| 87 return g_nacl_browser_ipc_fd; | 90 return g_nacl_browser_ipc_fd; |
| 88 } | 91 } |
| 89 | 92 |
| 90 int GetRendererIPCFileDescriptor() { | 93 int GetRendererIPCFileDescriptor() { |
| 91 // The descriptor must be initialized in advance. | 94 // The descriptor must be initialized in advance. |
| 92 DCHECK_NE(g_nacl_renderer_ipc_fd, -1); | 95 DCHECK_NE(g_nacl_renderer_ipc_fd, -1); |
| 93 return g_nacl_renderer_ipc_fd; | 96 return g_nacl_renderer_ipc_fd; |
| 94 } | 97 } |
| 95 | 98 |
| 96 base::WaitableEvent* GetShutdownEvent() { | 99 base::WaitableEvent* GetShutdownEvent() { |
| 97 // The shutdown event must be initialized in advance. | 100 // The shutdown event must be initialized in advance. |
| 98 DCHECK(g_shutdown_event); | 101 DCHECK(g_shutdown_event); |
| 99 return g_shutdown_event; | 102 return g_shutdown_event; |
| 100 } | 103 } |
| 101 | 104 |
| 102 base::Thread* GetIOThread() { | 105 base::Thread* GetIOThread() { |
| 103 // The IOThread must be initialized in advance. | 106 // The IOThread must be initialized in advance. |
| 104 DCHECK(g_io_thread); | 107 DCHECK(g_io_thread); |
| 105 return g_io_thread; | 108 return g_io_thread; |
| 106 } | 109 } |
| 107 | 110 |
| 108 } // namespace ppapi | 111 } // namespace ppapi |
| OLD | NEW |