| 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 11 matching lines...) Expand all Loading... |
| 22 namespace IPC { | 22 namespace IPC { |
| 23 class SyncChannel; | 23 class SyncChannel; |
| 24 class SyncMessageFilter; | 24 class SyncMessageFilter; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // The NaClListener is an IPC channel listener that waits for a | 27 // The NaClListener is an IPC channel listener that waits for a |
| 28 // request to start a NaCl module. | 28 // request to start a NaCl module. |
| 29 class NaClListener : public IPC::Listener { | 29 class NaClListener : public IPC::Listener { |
| 30 public: | 30 public: |
| 31 NaClListener(); | 31 NaClListener(); |
| 32 virtual ~NaClListener(); | 32 ~NaClListener() override; |
| 33 // Listen for a request to launch a NaCl module. | 33 // Listen for a request to launch a NaCl module. |
| 34 void Listen(); | 34 void Listen(); |
| 35 | 35 |
| 36 bool Send(IPC::Message* msg); | 36 bool Send(IPC::Message* msg); |
| 37 | 37 |
| 38 #if defined(OS_LINUX) | 38 #if defined(OS_LINUX) |
| 39 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { | 39 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { |
| 40 prereserved_sandbox_size_ = prereserved_sandbox_size; | 40 prereserved_sandbox_size_ = prereserved_sandbox_size; |
| 41 } | 41 } |
| 42 #endif | 42 #endif |
| 43 #if defined(OS_POSIX) | 43 #if defined(OS_POSIX) |
| 44 void set_number_of_cores(int number_of_cores) { | 44 void set_number_of_cores(int number_of_cores) { |
| 45 number_of_cores_ = number_of_cores; | 45 number_of_cores_ = number_of_cores; |
| 46 } | 46 } |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 void* crash_info_shmem_memory() const { return crash_info_shmem_->memory(); } | 49 void* crash_info_shmem_memory() const { return crash_info_shmem_->memory(); } |
| 50 | 50 |
| 51 typedef base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> | 51 typedef base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> |
| 52 ResolveFileTokenCallback; | 52 ResolveFileTokenCallback; |
| 53 void ResolveFileToken(uint64_t token_lo, | 53 void ResolveFileToken(uint64_t token_lo, |
| 54 uint64_t token_hi, | 54 uint64_t token_hi, |
| 55 ResolveFileTokenCallback cb); | 55 ResolveFileTokenCallback cb); |
| 56 void OnFileTokenResolved(uint64_t token_lo, | 56 void OnFileTokenResolved(uint64_t token_lo, |
| 57 uint64_t token_hi, | 57 uint64_t token_hi, |
| 58 IPC::PlatformFileForTransit ipc_fd, | 58 IPC::PlatformFileForTransit ipc_fd, |
| 59 base::FilePath file_path); | 59 base::FilePath file_path); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 62 bool OnMessageReceived(const IPC::Message& msg) override; |
| 63 | 63 |
| 64 void OnStart(const nacl::NaClStartParams& params); | 64 void OnStart(const nacl::NaClStartParams& params); |
| 65 | 65 |
| 66 // A channel back to the browser. | 66 // A channel back to the browser. |
| 67 scoped_ptr<IPC::SyncChannel> channel_; | 67 scoped_ptr<IPC::SyncChannel> channel_; |
| 68 | 68 |
| 69 // A filter that allows other threads to use the channel. | 69 // A filter that allows other threads to use the channel. |
| 70 scoped_refptr<IPC::SyncMessageFilter> filter_; | 70 scoped_refptr<IPC::SyncMessageFilter> filter_; |
| 71 | 71 |
| 72 base::WaitableEvent shutdown_event_; | 72 base::WaitableEvent shutdown_event_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 | 90 |
| 91 ResolveFileTokenCallback resolved_cb_; | 91 ResolveFileTokenCallback resolved_cb_; |
| 92 | 92 |
| 93 // Used to identify what thread we're on. | 93 // Used to identify what thread we're on. |
| 94 base::MessageLoop* main_loop_; | 94 base::MessageLoop* main_loop_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 96 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 #endif // CHROME_NACL_NACL_LISTENER_H_ | 99 #endif // CHROME_NACL_NACL_LISTENER_H_ |
| OLD | NEW |