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/manifest_service.h" | 5 #include "ppapi/nacl_irt/manifest_service.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "ipc/ipc_channel_handle.h" | 8 #include "ipc/ipc_channel_handle.h" |
9 #include "ipc/ipc_channel_proxy.h" | 9 #include "ipc/ipc_channel_proxy.h" |
10 #include "ipc/ipc_sync_message_filter.h" | 10 #include "ipc/ipc_sync_message_filter.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace ppapi { | 22 namespace ppapi { |
23 | 23 |
24 // IPC channel is asynchronously set up. So, the NaCl process may try to | 24 // IPC channel is asynchronously set up. So, the NaCl process may try to |
25 // send a OpenResource message to the host before the connection is | 25 // send a OpenResource message to the host before the connection is |
26 // established. In such a case, it is necessary to wait for the set up | 26 // established. In such a case, it is necessary to wait for the set up |
27 // completion. | 27 // completion. |
28 class ManifestMessageFilter : public IPC::SyncMessageFilter { | 28 class ManifestMessageFilter : public IPC::SyncMessageFilter { |
29 public: | 29 public: |
30 ManifestMessageFilter(base::WaitableEvent* shutdown_event) | 30 ManifestMessageFilter(base::WaitableEvent* shutdown_event) |
31 : SyncMessageFilter(shutdown_event), | 31 : SyncMessageFilter(shutdown_event, |
| 32 false /* is_channel_send_thread_safe */), |
32 connected_event_( | 33 connected_event_( |
33 true /* manual_reset */, false /* initially_signaled */) { | 34 true /* manual_reset */, false /* initially_signaled */) { |
34 } | 35 } |
35 | 36 |
36 bool Send(IPC::Message* message) override { | 37 bool Send(IPC::Message* message) override { |
37 // Wait until set up is actually done. | 38 // Wait until set up is actually done. |
38 connected_event_.Wait(); | 39 connected_event_.Wait(); |
39 return SyncMessageFilter::Send(message); | 40 return SyncMessageFilter::Send(message); |
40 } | 41 } |
41 | 42 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 163 |
163 ManifestService* manifest_service = GetManifestService(); | 164 ManifestService* manifest_service = GetManifestService(); |
164 if (manifest_service == NULL || | 165 if (manifest_service == NULL || |
165 !manifest_service->OpenResource(file, fd)) { | 166 !manifest_service->OpenResource(file, fd)) { |
166 return NACL_ABI_EIO; | 167 return NACL_ABI_EIO; |
167 } | 168 } |
168 return (*fd == -1) ? NACL_ABI_ENOENT : 0; | 169 return (*fd == -1) ? NACL_ABI_ENOENT : 0; |
169 } | 170 } |
170 | 171 |
171 } // namespace ppapi | 172 } // namespace ppapi |
OLD | NEW |