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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace ppapi { | 26 namespace ppapi { |
27 | 27 |
28 // IPC channel is asynchronously set up. So, the NaCl process may try to | 28 // IPC channel is asynchronously set up. So, the NaCl process may try to |
29 // send a OpenResource message to the host before the connection is | 29 // send a OpenResource message to the host before the connection is |
30 // established. In such a case, it is necessary to wait for the set up | 30 // established. In such a case, it is necessary to wait for the set up |
31 // completion. | 31 // completion. |
32 class ManifestMessageFilter : public IPC::SyncMessageFilter { | 32 class ManifestMessageFilter : public IPC::SyncMessageFilter { |
33 public: | 33 public: |
34 ManifestMessageFilter(base::WaitableEvent* shutdown_event) | 34 ManifestMessageFilter(base::WaitableEvent* shutdown_event) |
35 : SyncMessageFilter(shutdown_event, | 35 : SyncMessageFilter(shutdown_event), |
36 false /* is_channel_send_thread_safe */), | |
37 connected_event_(base::WaitableEvent::ResetPolicy::MANUAL, | 36 connected_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
38 base::WaitableEvent::InitialState::NOT_SIGNALED) {} | 37 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
39 | 38 |
40 bool Send(IPC::Message* message) override { | 39 bool Send(IPC::Message* message) override { |
41 // Wait until set up is actually done. | 40 // Wait until set up is actually done. |
42 connected_event_.Wait(); | 41 connected_event_.Wait(); |
43 return SyncMessageFilter::Send(message); | 42 return SyncMessageFilter::Send(message); |
44 } | 43 } |
45 | 44 |
46 // When set up is done, OnFilterAdded is called on IO thread. Unblocks the | 45 // When set up is done, OnFilterAdded is called on IO thread. Unblocks the |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 162 |
164 ManifestService* manifest_service = GetManifestService(); | 163 ManifestService* manifest_service = GetManifestService(); |
165 if (manifest_service == NULL || | 164 if (manifest_service == NULL || |
166 !manifest_service->OpenResource(file, fd)) { | 165 !manifest_service->OpenResource(file, fd)) { |
167 return NACL_ABI_EIO; | 166 return NACL_ABI_EIO; |
168 } | 167 } |
169 return (*fd == -1) ? NACL_ABI_ENOENT : 0; | 168 return (*fd == -1) ? NACL_ABI_ENOENT : 0; |
170 } | 169 } |
171 | 170 |
172 } // namespace ppapi | 171 } // namespace ppapi |
OLD | NEW |