| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_ | 5 #ifndef COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_ |
| 6 #define COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_ | 6 #define COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.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 "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
| 17 | 17 |
| 18 namespace IPC { | 18 namespace IPC { |
| 19 class Message; | 19 class Message; |
| 20 class SyncChannel; | 20 class SyncChannel; |
| 21 } // namespace IPC | 21 } // namespace IPC |
| 22 | 22 |
| 23 namespace mojo { | |
| 24 namespace edk { | |
| 25 class ScopedIPCSupport; | |
| 26 } // namespace edk | |
| 27 } // namespace mojo | |
| 28 | |
| 29 class NaClTrustedListener; | 23 class NaClTrustedListener; |
| 30 | 24 |
| 31 namespace nacl { | 25 namespace nacl { |
| 32 | 26 |
| 33 struct NaClStartParams; | 27 struct NaClStartParams; |
| 34 | 28 |
| 35 namespace nonsfi { | 29 namespace nonsfi { |
| 36 | 30 |
| 37 class NonSfiListener : public IPC::Listener { | 31 class NonSfiListener : public IPC::Listener { |
| 38 public: | 32 public: |
| 39 NonSfiListener(); | 33 NonSfiListener(); |
| 40 ~NonSfiListener() override; | 34 ~NonSfiListener() override; |
| 41 | 35 |
| 42 // Listen for a request to launch a non-SFI NaCl module. | 36 // Listen for a request to launch a non-SFI NaCl module. |
| 43 void Listen(); | 37 void Listen(); |
| 44 | 38 |
| 45 private: | 39 private: |
| 46 bool OnMessageReceived(const IPC::Message& msg) override; | 40 bool OnMessageReceived(const IPC::Message& msg) override; |
| 47 void OnAddPrefetchedResource( | 41 void OnAddPrefetchedResource( |
| 48 const nacl::NaClResourcePrefetchResult& prefetched_resource_file); | 42 const nacl::NaClResourcePrefetchResult& prefetched_resource_file); |
| 49 void OnStart(const nacl::NaClStartParams& params); | 43 void OnStart(const nacl::NaClStartParams& params); |
| 50 | 44 |
| 51 base::Thread io_thread_; | 45 base::Thread io_thread_; |
| 52 base::WaitableEvent shutdown_event_; | 46 base::WaitableEvent shutdown_event_; |
| 53 std::unique_ptr<IPC::SyncChannel> channel_; | 47 std::unique_ptr<IPC::SyncChannel> channel_; |
| 54 std::unique_ptr<NaClTrustedListener> trusted_listener_; | 48 std::unique_ptr<NaClTrustedListener> trusted_listener_; |
| 55 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; | |
| 56 | 49 |
| 57 std::unique_ptr<std::map<std::string, int>> key_fd_map_; | 50 std::unique_ptr<std::map<std::string, int>> key_fd_map_; |
| 58 | 51 |
| 59 DISALLOW_COPY_AND_ASSIGN(NonSfiListener); | 52 DISALLOW_COPY_AND_ASSIGN(NonSfiListener); |
| 60 }; | 53 }; |
| 61 | 54 |
| 62 } // namespace nonsfi | 55 } // namespace nonsfi |
| 63 } // namespace nacl | 56 } // namespace nacl |
| 64 | 57 |
| 65 #endif // COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_ | 58 #endif // COMPONENTS_NACL_LOADER_NONSFI_NONSFI_LISTENER_H_ |
| OLD | NEW |