| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_NACL_NACL_LISTENER_H_ | |
| 6 #define CHROME_NACL_NACL_LISTENER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/synchronization/waitable_event.h" | |
| 12 #include "base/threading/thread.h" | |
| 13 #include "chrome/common/nacl_types.h" | |
| 14 #include "ipc/ipc_listener.h" | |
| 15 | |
| 16 namespace IPC { | |
| 17 class SyncChannel; | |
| 18 class SyncMessageFilter; | |
| 19 } | |
| 20 | |
| 21 // The NaClListener is an IPC channel listener that waits for a | |
| 22 // request to start a NaCl module. | |
| 23 class NaClListener : public IPC::Listener { | |
| 24 public: | |
| 25 NaClListener(); | |
| 26 virtual ~NaClListener(); | |
| 27 // Listen for a request to launch a NaCl module. | |
| 28 void Listen(); | |
| 29 | |
| 30 bool Send(IPC::Message* msg); | |
| 31 | |
| 32 #if defined(OS_LINUX) | |
| 33 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { | |
| 34 prereserved_sandbox_size_ = prereserved_sandbox_size; | |
| 35 } | |
| 36 #endif | |
| 37 | |
| 38 private: | |
| 39 void OnStart(const nacl::NaClStartParams& params); | |
| 40 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | |
| 41 | |
| 42 // A channel back to the browser. | |
| 43 scoped_ptr<IPC::SyncChannel> channel_; | |
| 44 | |
| 45 // A filter that allows other threads to use the channel. | |
| 46 scoped_refptr<IPC::SyncMessageFilter> filter_; | |
| 47 | |
| 48 base::WaitableEvent shutdown_event_; | |
| 49 base::Thread io_thread_; | |
| 50 | |
| 51 #if defined(OS_LINUX) | |
| 52 size_t prereserved_sandbox_size_; | |
| 53 #endif | |
| 54 | |
| 55 // Used to identify what thread we're on. | |
| 56 base::MessageLoop* main_loop_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(NaClListener); | |
| 59 }; | |
| 60 | |
| 61 #endif // CHROME_NACL_NACL_LISTENER_H_ | |
| OLD | NEW |