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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 uint64_t token_hi, | 55 uint64_t token_hi, |
55 ResolveFileTokenCallback cb); | 56 ResolveFileTokenCallback cb); |
56 void OnFileTokenResolved(uint64_t token_lo, | 57 void OnFileTokenResolved(uint64_t token_lo, |
57 uint64_t token_hi, | 58 uint64_t token_hi, |
58 IPC::PlatformFileForTransit ipc_fd, | 59 IPC::PlatformFileForTransit ipc_fd, |
59 base::FilePath file_path); | 60 base::FilePath file_path); |
60 | 61 |
61 private: | 62 private: |
62 bool OnMessageReceived(const IPC::Message& msg) override; | 63 bool OnMessageReceived(const IPC::Message& msg) override; |
63 | 64 |
| 65 typedef base::Callback<void(const IPC::Message&, |
| 66 IPC::PlatformFileForTransit, |
| 67 base::FilePath)> OpenResourceReplyCallback; |
| 68 |
| 69 bool OnOpenResource(const IPC::Message& msg, |
| 70 const std::string& key, |
| 71 OpenResourceReplyCallback cb); |
| 72 |
64 void OnStart(const nacl::NaClStartParams& params); | 73 void OnStart(const nacl::NaClStartParams& params); |
65 | 74 |
66 // A channel back to the browser. | 75 // A channel back to the browser. |
67 scoped_ptr<IPC::SyncChannel> channel_; | 76 scoped_ptr<IPC::SyncChannel> channel_; |
68 | 77 |
69 // A filter that allows other threads to use the channel. | 78 // A filter that allows other threads to use the channel. |
70 scoped_refptr<IPC::SyncMessageFilter> filter_; | 79 scoped_refptr<IPC::SyncMessageFilter> filter_; |
71 | 80 |
72 base::WaitableEvent shutdown_event_; | 81 base::WaitableEvent shutdown_event_; |
73 base::Thread io_thread_; | 82 base::Thread io_thread_; |
(...skipping 12 matching lines...) Expand all Loading... |
86 | 95 |
87 scoped_ptr<base::SharedMemory> crash_info_shmem_; | 96 scoped_ptr<base::SharedMemory> crash_info_shmem_; |
88 | 97 |
89 scoped_refptr<NaClTrustedListener> trusted_listener_; | 98 scoped_refptr<NaClTrustedListener> trusted_listener_; |
90 | 99 |
91 ResolveFileTokenCallback resolved_cb_; | 100 ResolveFileTokenCallback resolved_cb_; |
92 | 101 |
93 // Used to identify what thread we're on. | 102 // Used to identify what thread we're on. |
94 base::MessageLoop* main_loop_; | 103 base::MessageLoop* main_loop_; |
95 | 104 |
| 105 // Pre-opened resource descriptors. |
| 106 std::map< |
| 107 std::string, // key |
| 108 std::pair<IPC::PlatformFileForTransit, base::FilePath> > resource_files_; |
| 109 |
96 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 110 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
97 }; | 111 }; |
98 | 112 |
99 #endif // CHROME_NACL_NACL_LISTENER_H_ | 113 #endif // CHROME_NACL_NACL_LISTENER_H_ |
OLD | NEW |