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/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.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 11 matching lines...) Expand all Loading... |
22 // established. In such a case, it is necessary to wait for the set up | 22 // established. In such a case, it is necessary to wait for the set up |
23 // completion. | 23 // completion. |
24 class ManifestMessageFilter : public IPC::SyncMessageFilter { | 24 class ManifestMessageFilter : public IPC::SyncMessageFilter { |
25 public: | 25 public: |
26 ManifestMessageFilter(base::WaitableEvent* shutdown_event) | 26 ManifestMessageFilter(base::WaitableEvent* shutdown_event) |
27 : SyncMessageFilter(shutdown_event), | 27 : SyncMessageFilter(shutdown_event), |
28 connected_event_( | 28 connected_event_( |
29 true /* manual_reset */, false /* initially_signaled */) { | 29 true /* manual_reset */, false /* initially_signaled */) { |
30 } | 30 } |
31 | 31 |
32 virtual bool Send(IPC::Message* message) OVERRIDE { | 32 virtual bool Send(IPC::Message* message) override { |
33 // Wait until set up is actually done. | 33 // Wait until set up is actually done. |
34 connected_event_.Wait(); | 34 connected_event_.Wait(); |
35 return SyncMessageFilter::Send(message); | 35 return SyncMessageFilter::Send(message); |
36 } | 36 } |
37 | 37 |
38 // When set up is done, OnFilterAdded is called on IO thread. Unblocks the | 38 // When set up is done, OnFilterAdded is called on IO thread. Unblocks the |
39 // Send(). | 39 // Send(). |
40 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE { | 40 virtual void OnFilterAdded(IPC::Sender* sender) override { |
41 SyncMessageFilter::OnFilterAdded(sender); | 41 SyncMessageFilter::OnFilterAdded(sender); |
42 connected_event_.Signal(); | 42 connected_event_.Signal(); |
43 } | 43 } |
44 | 44 |
45 // If an error is found, unblocks the Send(), too, to return an error. | 45 // If an error is found, unblocks the Send(), too, to return an error. |
46 virtual void OnChannelError() OVERRIDE { | 46 virtual void OnChannelError() override { |
47 SyncMessageFilter::OnChannelError(); | 47 SyncMessageFilter::OnChannelError(); |
48 connected_event_.Signal(); | 48 connected_event_.Signal(); |
49 } | 49 } |
50 | 50 |
51 // Similar to OnChannelError, unblocks the Send() on the channel closing. | 51 // Similar to OnChannelError, unblocks the Send() on the channel closing. |
52 virtual void OnChannelClosing() OVERRIDE { | 52 virtual void OnChannelClosing() override { |
53 SyncMessageFilter::OnChannelClosing(); | 53 SyncMessageFilter::OnChannelClosing(); |
54 connected_event_.Signal(); | 54 connected_event_.Signal(); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 base::WaitableEvent connected_event_; | 58 base::WaitableEvent connected_event_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(ManifestMessageFilter); | 60 DISALLOW_COPY_AND_ASSIGN(ManifestMessageFilter); |
61 }; | 61 }; |
62 | 62 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 ManifestService* manifest_service = GetManifestService(); | 133 ManifestService* manifest_service = GetManifestService(); |
134 if (manifest_service == NULL || | 134 if (manifest_service == NULL || |
135 !manifest_service->OpenResource(file, fd)) { | 135 !manifest_service->OpenResource(file, fd)) { |
136 return NACL_ABI_EIO; | 136 return NACL_ABI_EIO; |
137 } | 137 } |
138 return (*fd == -1) ? NACL_ABI_ENOENT : 0; | 138 return (*fd == -1) ? NACL_ABI_ENOENT : 0; |
139 } | 139 } |
140 | 140 |
141 } // namespace ppapi | 141 } // namespace ppapi |
OLD | NEW |