OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_NACL_NACL_LISTENER_H_ | 5 #ifndef CHROME_NACL_NACL_LISTENER_H_ |
6 #define CHROME_NACL_NACL_LISTENER_H_ | 6 #define CHROME_NACL_NACL_LISTENER_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
12 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
13 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
14 #include "components/nacl/common/nacl_types.h" | 15 #include "components/nacl/common/nacl_types.h" |
15 #include "components/nacl/loader/nacl_trusted_listener.h" | 16 #include "components/nacl/loader/nacl_trusted_listener.h" |
16 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
17 | 18 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 uint64_t token_hi, | 59 uint64_t token_hi, |
59 ResolveFileTokenCallback cb); | 60 ResolveFileTokenCallback cb); |
60 void OnFileTokenResolved(uint64_t token_lo, | 61 void OnFileTokenResolved(uint64_t token_lo, |
61 uint64_t token_hi, | 62 uint64_t token_hi, |
62 IPC::PlatformFileForTransit ipc_fd, | 63 IPC::PlatformFileForTransit ipc_fd, |
63 base::FilePath file_path); | 64 base::FilePath file_path); |
64 | 65 |
65 private: | 66 private: |
66 bool OnMessageReceived(const IPC::Message& msg) override; | 67 bool OnMessageReceived(const IPC::Message& msg) override; |
67 | 68 |
| 69 typedef base::Callback<void(const IPC::Message&, |
| 70 IPC::PlatformFileForTransit, |
| 71 base::FilePath)> OpenResourceReplyCallback; |
| 72 |
| 73 bool OnOpenResource(const IPC::Message& msg, |
| 74 const std::string& key, |
| 75 OpenResourceReplyCallback cb); |
| 76 |
68 void OnStart(const nacl::NaClStartParams& params); | 77 void OnStart(const nacl::NaClStartParams& params); |
69 | 78 |
70 // A channel back to the browser. | 79 // A channel back to the browser. |
71 scoped_ptr<IPC::SyncChannel> channel_; | 80 scoped_ptr<IPC::SyncChannel> channel_; |
72 | 81 |
73 // A filter that allows other threads to use the channel. | 82 // A filter that allows other threads to use the channel. |
74 scoped_refptr<IPC::SyncMessageFilter> filter_; | 83 scoped_refptr<IPC::SyncMessageFilter> filter_; |
75 | 84 |
76 base::WaitableEvent shutdown_event_; | 85 base::WaitableEvent shutdown_event_; |
77 base::Thread io_thread_; | 86 base::Thread io_thread_; |
(...skipping 12 matching lines...) Expand all Loading... |
90 | 99 |
91 scoped_ptr<base::SharedMemory> crash_info_shmem_; | 100 scoped_ptr<base::SharedMemory> crash_info_shmem_; |
92 | 101 |
93 scoped_refptr<NaClTrustedListener> trusted_listener_; | 102 scoped_refptr<NaClTrustedListener> trusted_listener_; |
94 | 103 |
95 ResolveFileTokenCallback resolved_cb_; | 104 ResolveFileTokenCallback resolved_cb_; |
96 | 105 |
97 // Used to identify what thread we're on. | 106 // Used to identify what thread we're on. |
98 base::MessageLoop* main_loop_; | 107 base::MessageLoop* main_loop_; |
99 | 108 |
| 109 typedef std::map< |
| 110 std::string, // manifest key |
| 111 std::pair<IPC::PlatformFileForTransit, |
| 112 base::FilePath> > PrefetchedResourceFilesMap; |
| 113 PrefetchedResourceFilesMap prefetched_resource_files_; |
| 114 |
100 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 115 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
101 }; | 116 }; |
102 | 117 |
103 #endif // CHROME_NACL_NACL_LISTENER_H_ | 118 #endif // CHROME_NACL_NACL_LISTENER_H_ |
OLD | NEW |