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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // request to start a NaCl module. | 23 // request to start a NaCl module. |
24 class NaClListener : public IPC::Listener { | 24 class NaClListener : public IPC::Listener { |
25 public: | 25 public: |
26 NaClListener(); | 26 NaClListener(); |
27 virtual ~NaClListener(); | 27 virtual ~NaClListener(); |
28 // Listen for a request to launch a NaCl module. | 28 // Listen for a request to launch a NaCl module. |
29 void Listen(); | 29 void Listen(); |
30 | 30 |
31 bool Send(IPC::Message* msg); | 31 bool Send(IPC::Message* msg); |
32 | 32 |
| 33 void set_uses_nonsfi_mode(bool uses_nonsfi_mode) { |
| 34 uses_nonsfi_mode_ = uses_nonsfi_mode; |
| 35 } |
33 #if defined(OS_LINUX) | 36 #if defined(OS_LINUX) |
34 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { | 37 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { |
35 prereserved_sandbox_size_ = prereserved_sandbox_size; | 38 prereserved_sandbox_size_ = prereserved_sandbox_size; |
36 } | 39 } |
37 #endif | 40 #endif |
38 #if defined(OS_POSIX) | 41 #if defined(OS_POSIX) |
39 void set_number_of_cores(int number_of_cores) { | 42 void set_number_of_cores(int number_of_cores) { |
40 number_of_cores_ = number_of_cores; | 43 number_of_cores_ = number_of_cores; |
41 } | 44 } |
42 #endif | 45 #endif |
43 | 46 |
44 private: | 47 private: |
45 void OnStart(const nacl::NaClStartParams& params); | 48 void OnStart(const nacl::NaClStartParams& params); |
46 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 49 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
47 | 50 |
48 // A channel back to the browser. | 51 // A channel back to the browser. |
49 scoped_ptr<IPC::SyncChannel> channel_; | 52 scoped_ptr<IPC::SyncChannel> channel_; |
50 | 53 |
51 // A filter that allows other threads to use the channel. | 54 // A filter that allows other threads to use the channel. |
52 scoped_refptr<IPC::SyncMessageFilter> filter_; | 55 scoped_refptr<IPC::SyncMessageFilter> filter_; |
53 | 56 |
54 base::WaitableEvent shutdown_event_; | 57 base::WaitableEvent shutdown_event_; |
55 base::Thread io_thread_; | 58 base::Thread io_thread_; |
56 | 59 |
| 60 bool uses_nonsfi_mode_; |
57 #if defined(OS_LINUX) | 61 #if defined(OS_LINUX) |
58 size_t prereserved_sandbox_size_; | 62 size_t prereserved_sandbox_size_; |
59 #endif | 63 #endif |
60 #if defined(OS_POSIX) | 64 #if defined(OS_POSIX) |
61 // The outer sandbox on Linux and OSX prevents | 65 // The outer sandbox on Linux and OSX prevents |
62 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no | 66 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no |
63 // problems with invoking GetSystemInfo. Therefore, only in | 67 // problems with invoking GetSystemInfo. Therefore, only in |
64 // OS_POSIX do we need to supply the number of cores into the | 68 // OS_POSIX do we need to supply the number of cores into the |
65 // NaClChromeMainArgs object. | 69 // NaClChromeMainArgs object. |
66 int number_of_cores_; | 70 int number_of_cores_; |
67 #endif | 71 #endif |
68 | 72 |
69 scoped_refptr<NaClTrustedListener> trusted_listener_; | 73 scoped_refptr<NaClTrustedListener> trusted_listener_; |
70 | 74 |
71 // Used to identify what thread we're on. | 75 // Used to identify what thread we're on. |
72 base::MessageLoop* main_loop_; | 76 base::MessageLoop* main_loop_; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 78 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
75 }; | 79 }; |
76 | 80 |
77 #endif // CHROME_NACL_NACL_LISTENER_H_ | 81 #endif // CHROME_NACL_NACL_LISTENER_H_ |
OLD | NEW |