| 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 <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "components/nacl/common/nacl_types.h" | 15 #include "components/nacl/common/nacl_types.h" |
| 16 #include "components/nacl/loader/nacl_trusted_listener.h" | 16 #include "components/nacl/loader/nacl_trusted_listener.h" |
| 17 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 18 | 18 |
| 19 namespace IPC { | 19 namespace IPC { |
| 20 class AttachmentBroker; |
| 20 class SyncChannel; | 21 class SyncChannel; |
| 21 class SyncMessageFilter; | 22 class SyncMessageFilter; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // The NaClListener is an IPC channel listener that waits for a | 25 // The NaClListener is an IPC channel listener that waits for a |
| 25 // request to start a NaCl module. | 26 // request to start a NaCl module. |
| 26 class NaClListener : public IPC::Listener { | 27 class NaClListener : public IPC::Listener { |
| 27 public: | 28 public: |
| 28 NaClListener(); | 29 // |broker| must outlive NaClListener. |
| 30 NaClListener(IPC::AttachmentBroker* broker); |
| 29 ~NaClListener() override; | 31 ~NaClListener() override; |
| 30 // Listen for a request to launch a NaCl module. | 32 // Listen for a request to launch a NaCl module. |
| 31 void Listen(); | 33 void Listen(); |
| 32 | 34 |
| 33 bool Send(IPC::Message* msg); | 35 bool Send(IPC::Message* msg); |
| 34 | 36 |
| 35 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) |
| 36 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { | 38 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) { |
| 37 prereserved_sandbox_size_ = prereserved_sandbox_size; | 39 prereserved_sandbox_size_ = prereserved_sandbox_size; |
| 38 } | 40 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void OnStart(const nacl::NaClStartParams& params); | 77 void OnStart(const nacl::NaClStartParams& params); |
| 76 | 78 |
| 77 // A channel back to the browser. | 79 // A channel back to the browser. |
| 78 scoped_ptr<IPC::SyncChannel> channel_; | 80 scoped_ptr<IPC::SyncChannel> channel_; |
| 79 | 81 |
| 80 // A filter that allows other threads to use the channel. | 82 // A filter that allows other threads to use the channel. |
| 81 scoped_refptr<IPC::SyncMessageFilter> filter_; | 83 scoped_refptr<IPC::SyncMessageFilter> filter_; |
| 82 | 84 |
| 83 base::WaitableEvent shutdown_event_; | 85 base::WaitableEvent shutdown_event_; |
| 84 base::Thread io_thread_; | 86 base::Thread io_thread_; |
| 87 IPC::AttachmentBroker* broker_; |
| 85 | 88 |
| 86 #if defined(OS_LINUX) | 89 #if defined(OS_LINUX) |
| 87 size_t prereserved_sandbox_size_; | 90 size_t prereserved_sandbox_size_; |
| 88 #endif | 91 #endif |
| 89 #if defined(OS_POSIX) | 92 #if defined(OS_POSIX) |
| 90 // The outer sandbox on Linux and OSX prevents | 93 // The outer sandbox on Linux and OSX prevents |
| 91 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no | 94 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no |
| 92 // problems with invoking GetSystemInfo. Therefore, only in | 95 // problems with invoking GetSystemInfo. Therefore, only in |
| 93 // OS_POSIX do we need to supply the number of cores into the | 96 // OS_POSIX do we need to supply the number of cores into the |
| 94 // NaClChromeMainArgs object. | 97 // NaClChromeMainArgs object. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 109 std::pair<IPC::PlatformFileForTransit, | 112 std::pair<IPC::PlatformFileForTransit, |
| 110 base::FilePath> > PrefetchedResourceFilesMap; | 113 base::FilePath> > PrefetchedResourceFilesMap; |
| 111 PrefetchedResourceFilesMap prefetched_resource_files_; | 114 PrefetchedResourceFilesMap prefetched_resource_files_; |
| 112 | 115 |
| 113 bool is_started_; | 116 bool is_started_; |
| 114 | 117 |
| 115 DISALLOW_COPY_AND_ASSIGN(NaClListener); | 118 DISALLOW_COPY_AND_ASSIGN(NaClListener); |
| 116 }; | 119 }; |
| 117 | 120 |
| 118 #endif // CHROME_NACL_NACL_LISTENER_H_ | 121 #endif // CHROME_NACL_NACL_LISTENER_H_ |
| OLD | NEW |