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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/shared_memory.h" |
11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
12 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
13 #include "components/nacl/common/nacl_types.h" | 14 #include "components/nacl/common/nacl_types.h" |
14 #include "components/nacl/loader/nacl_trusted_listener.h" | 15 #include "components/nacl/loader/nacl_trusted_listener.h" |
15 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class MessageLoopProxy; | 19 class MessageLoopProxy; |
19 } | 20 } |
20 | 21 |
(...skipping 17 matching lines...) Expand all Loading... |
38 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { | 39 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { |
39 prereserved_sandbox_size_ = prereserved_sandbox_size; | 40 prereserved_sandbox_size_ = prereserved_sandbox_size; |
40 } | 41 } |
41 #endif | 42 #endif |
42 #if defined(OS_POSIX) | 43 #if defined(OS_POSIX) |
43 void set_number_of_cores(int number_of_cores) { | 44 void set_number_of_cores(int number_of_cores) { |
44 number_of_cores_ = number_of_cores; | 45 number_of_cores_ = number_of_cores; |
45 } | 46 } |
46 #endif | 47 #endif |
47 | 48 |
| 49 void* crash_info_shmem_memory() const { return crash_info_shmem_->memory(); } |
| 50 |
48 private: | 51 private: |
49 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 52 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
50 | 53 |
51 void OnStart(const nacl::NaClStartParams& params); | 54 void OnStart(const nacl::NaClStartParams& params); |
52 | 55 |
53 // A channel back to the browser. | 56 // A channel back to the browser. |
54 scoped_ptr<IPC::SyncChannel> channel_; | 57 scoped_ptr<IPC::SyncChannel> channel_; |
55 | 58 |
56 // A filter that allows other threads to use the channel. | 59 // A filter that allows other threads to use the channel. |
57 scoped_refptr<IPC::SyncMessageFilter> filter_; | 60 scoped_refptr<IPC::SyncMessageFilter> filter_; |
58 | 61 |
59 base::WaitableEvent shutdown_event_; | 62 base::WaitableEvent shutdown_event_; |
60 base::Thread io_thread_; | 63 base::Thread io_thread_; |
61 | 64 |
62 #if defined(OS_LINUX) | 65 #if defined(OS_LINUX) |
63 size_t prereserved_sandbox_size_; | 66 size_t prereserved_sandbox_size_; |
64 #endif | 67 #endif |
65 #if defined(OS_POSIX) | 68 #if defined(OS_POSIX) |
66 // The outer sandbox on Linux and OSX prevents | 69 // The outer sandbox on Linux and OSX prevents |
67 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no | 70 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no |
68 // problems with invoking GetSystemInfo. Therefore, only in | 71 // problems with invoking GetSystemInfo. Therefore, only in |
69 // OS_POSIX do we need to supply the number of cores into the | 72 // OS_POSIX do we need to supply the number of cores into the |
70 // NaClChromeMainArgs object. | 73 // NaClChromeMainArgs object. |
71 int number_of_cores_; | 74 int number_of_cores_; |
72 #endif | 75 #endif |
73 | 76 |
| 77 scoped_ptr<base::SharedMemory> crash_info_shmem_; |
| 78 |
74 scoped_refptr<NaClTrustedListener> trusted_listener_; | 79 scoped_refptr<NaClTrustedListener> trusted_listener_; |
75 | 80 |
76 // Used to identify what thread we're on. | 81 // Used to identify what thread we're on. |
77 base::MessageLoop* main_loop_; | 82 base::MessageLoop* main_loop_; |
78 | 83 |
79 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 84 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
80 }; | 85 }; |
81 | 86 |
82 #endif // CHROME_NACL_NACL_LISTENER_H_ | 87 #endif // CHROME_NACL_NACL_LISTENER_H_ |
OLD | NEW |