OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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_BROWSER_NACL_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_NACL_PROCESS_HOST_H_ |
| 7 |
| 8 #include "build/build_config.h" |
| 9 #include "chrome/common/child_process_host.h" |
| 10 #include "chrome/common/nacl_types.h" |
| 11 #include "native_client/src/shared/imc/nacl_imc.h" |
| 12 |
| 13 class ResourceMessageFilter; |
| 14 |
| 15 // Represents the browser side of the browser <--> NaCl communication |
| 16 // channel. There will be one NaClProcessHost per NaCl process |
| 17 // The browser is responsible for starting the NaCl process |
| 18 // when requested by the renderer. |
| 19 // After that, most of the communication is directly between NaCl plugin |
| 20 // running in the renderer and NaCl processes. |
| 21 class NaClProcessHost : public ChildProcessHost { |
| 22 public: |
| 23 explicit NaClProcessHost(ResourceDispatcherHost *resource_dispatcher_host); |
| 24 ~NaClProcessHost() {} |
| 25 |
| 26 // Initialize the new NaCl process, returning true on success. |
| 27 bool Launch(ResourceMessageFilter* renderer_msg_filter, |
| 28 const int descriptor, |
| 29 nacl::FileDescriptor *handle); |
| 30 |
| 31 virtual void OnMessageReceived(const IPC::Message& msg); |
| 32 |
| 33 private: |
| 34 bool LaunchSelLdr(ResourceMessageFilter* renderer_msg_filter, |
| 35 const int descriptor, |
| 36 const nacl::Handle handle); |
| 37 |
| 38 bool SendStartMessage(base::ProcessHandle process, |
| 39 int descriptor, |
| 40 nacl::Handle handle); |
| 41 |
| 42 // ResourceDispatcherHost::Receiver implementation: |
| 43 virtual URLRequestContext* GetRequestContext( |
| 44 uint32 request_id, |
| 45 const ViewHostMsg_Resource_Request& request_data); |
| 46 |
| 47 virtual bool CanShutdown() { return true; } |
| 48 |
| 49 private: |
| 50 ResourceDispatcherHost* resource_dispatcher_host_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
| 53 }; |
| 54 |
| 55 #endif // CHROME_BROWSER_NACL_PROCESS_HOST_H_ |
OLD | NEW |