| 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/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "components/nacl/common/nacl_types.h" | 13 #include "components/nacl/common/nacl_types.h" |
| 14 #include "components/nacl/loader/nacl_trusted_listener.h" | 14 #include "components/nacl/loader/nacl_trusted_listener.h" |
| 15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
| 16 | 16 |
| 17 namespace base { |
| 18 class MessageLoopProxy; |
| 19 } |
| 20 |
| 17 namespace IPC { | 21 namespace IPC { |
| 18 class SyncChannel; | 22 class SyncChannel; |
| 19 class SyncMessageFilter; | 23 class SyncMessageFilter; |
| 20 } | 24 } |
| 21 | 25 |
| 22 // The NaClListener is an IPC channel listener that waits for a | 26 // The NaClListener is an IPC channel listener that waits for a |
| 23 // request to start a NaCl module. | 27 // request to start a NaCl module. |
| 24 class NaClListener : public IPC::Listener { | 28 class NaClListener : public IPC::Listener { |
| 25 public: | 29 public: |
| 26 NaClListener(); | 30 NaClListener(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 38 prereserved_sandbox_size_ = prereserved_sandbox_size; | 42 prereserved_sandbox_size_ = prereserved_sandbox_size; |
| 39 } | 43 } |
| 40 #endif | 44 #endif |
| 41 #if defined(OS_POSIX) | 45 #if defined(OS_POSIX) |
| 42 void set_number_of_cores(int number_of_cores) { | 46 void set_number_of_cores(int number_of_cores) { |
| 43 number_of_cores_ = number_of_cores; | 47 number_of_cores_ = number_of_cores; |
| 44 } | 48 } |
| 45 #endif | 49 #endif |
| 46 | 50 |
| 47 private: | 51 private: |
| 52 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 53 |
| 48 void OnStart(const nacl::NaClStartParams& params); | 54 void OnStart(const nacl::NaClStartParams& params); |
| 49 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 55 |
| 56 // Non-SFI version of OnStart(). |
| 57 void StartNonSfi(const nacl::NaClStartParams& params); |
| 58 |
| 59 IPC::ChannelHandle CreateTrustedListener( |
| 60 base::MessageLoopProxy* message_loop_proxy, |
| 61 base::WaitableEvent* shutdown_event); |
| 50 | 62 |
| 51 // A channel back to the browser. | 63 // A channel back to the browser. |
| 52 scoped_ptr<IPC::SyncChannel> channel_; | 64 scoped_ptr<IPC::SyncChannel> channel_; |
| 53 | 65 |
| 54 // A filter that allows other threads to use the channel. | 66 // A filter that allows other threads to use the channel. |
| 55 scoped_refptr<IPC::SyncMessageFilter> filter_; | 67 scoped_refptr<IPC::SyncMessageFilter> filter_; |
| 56 | 68 |
| 57 base::WaitableEvent shutdown_event_; | 69 base::WaitableEvent shutdown_event_; |
| 58 base::Thread io_thread_; | 70 base::Thread io_thread_; |
| 59 | 71 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 72 | 84 |
| 73 scoped_refptr<NaClTrustedListener> trusted_listener_; | 85 scoped_refptr<NaClTrustedListener> trusted_listener_; |
| 74 | 86 |
| 75 // Used to identify what thread we're on. | 87 // Used to identify what thread we're on. |
| 76 base::MessageLoop* main_loop_; | 88 base::MessageLoop* main_loop_; |
| 77 | 89 |
| 78 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 90 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
| 79 }; | 91 }; |
| 80 | 92 |
| 81 #endif // CHROME_NACL_NACL_LISTENER_H_ | 93 #endif // CHROME_NACL_NACL_LISTENER_H_ |
| OLD | NEW |