Index: components/nacl/loader/nacl_trusted_listener.h |
diff --git a/components/nacl/loader/nacl_trusted_listener.h b/components/nacl/loader/nacl_trusted_listener.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..34463ccecede47dc6714909ddf574220d584255c |
--- /dev/null |
+++ b/components/nacl/loader/nacl_trusted_listener.h |
@@ -0,0 +1,51 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_NACL_LOADER_NACL_TRUSTED_LISTENER_H_ |
+#define COMPONENTS_NACL_LOADER_NACL_TRUSTED_LISTENER_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/message_loop/message_loop_proxy.h" |
+#include "base/synchronization/waitable_event.h" |
+#include "ipc/ipc_channel.h" |
+#include "ipc/ipc_listener.h" |
+#include "ipc/ipc_platform_file.h" |
+#include "ipc/ipc_sync_channel.h" |
+#include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
+ |
+struct NaClApp; |
+ |
+class NaClTrustedListener : public base::RefCounted<NaClTrustedListener>, |
+ public IPC::Listener { |
+ public: |
+ NaClTrustedListener(const IPC::ChannelHandle& handle, |
+ struct NaClApp* nacl_app, |
+ int irt_fd, |
+ base::MessageLoopProxy* message_loop_proxy, |
+ base::WaitableEvent* shutdown_event); |
+ |
+#if defined(OS_POSIX) |
+ int TakeClientFileDescriptor(); |
+#endif |
+ |
+ // Listener implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
+ virtual void OnChannelError() OVERRIDE; |
+ |
+ virtual bool Send(IPC::Message* msg); |
+ |
+ private: |
+ void OnLoadModule( |
+ const IPC::PlatformFileForTransit& platform_file_for_transit, |
+ NaClErrorCode* output_code); |
+ void OnStartModule(); |
+ |
+ struct NaClApp* nacl_app_; |
+ int irt_fd_; |
+ scoped_ptr<IPC::SyncChannel> channel_; |
+ base::Thread chrome_main_thread_; |
+}; |
+ |
+#endif // COMPONENTS_NACL_LOADER_NACL_TRUSTED_LISTENER_H_ |