summaryrefslogtreecommitdiffstats
path: root/chrome/browser/nacl_process_host.h
diff options
context:
space:
mode:
authorgregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-26 09:47:54 +0000
committergregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-26 09:47:54 +0000
commit08127f528cf213bd2d24539e0dd78436df0cd434 (patch)
tree27090d8cc7a2e431b6099383dd96ee92798e16e8 /chrome/browser/nacl_process_host.h
parent09843b5f0930b2f19a55a3b405aeacb48fc90f01 (diff)
downloadchromium_src-08127f528cf213bd2d24539e0dd78436df0cd434.zip
chromium_src-08127f528cf213bd2d24539e0dd78436df0cd434.tar.gz
chromium_src-08127f528cf213bd2d24539e0dd78436df0cd434.tar.bz2
First step towards NaCl-Chrome integration:1. NaCl plugin becomes a built-in plugin in Chrome and runs in the renderer process.2. Most of the changes are related to launching the NaCl process (that loads and runs the NaCl module) and establishing the initial communication between that process and the NaCl plugin.3. Command line flag "--internal-nacl" is required to enable the built-in NaCl plugin. NaCl still cannot run in Chrome sandbox, the flag automatically disables the sandboxCommitted: http://src.chromium.org/viewvc/chrome?view=rev&revision=27315
Review URL: http://codereview.chromium.org/153002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/nacl_process_host.h')
-rw-r--r--chrome/browser/nacl_process_host.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/chrome/browser/nacl_process_host.h b/chrome/browser/nacl_process_host.h
new file mode 100644
index 0000000..59de526
--- /dev/null
+++ b/chrome/browser/nacl_process_host.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2009 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 CHROME_BROWSER_NACL_PROCESS_HOST_H_
+#define CHROME_BROWSER_NACL_PROCESS_HOST_H_
+
+#include "build/build_config.h"
+#include "chrome/common/child_process_host.h"
+#include "chrome/common/nacl_types.h"
+#include "native_client/src/shared/imc/nacl_imc.h"
+
+class ResourceMessageFilter;
+
+// Represents the browser side of the browser <--> NaCl communication
+// channel. There will be one NaClProcessHost per NaCl process
+// The browser is responsible for starting the NaCl process
+// when requested by the renderer.
+// After that, most of the communication is directly between NaCl plugin
+// running in the renderer and NaCl processes.
+class NaClProcessHost : public ChildProcessHost {
+ public:
+ explicit NaClProcessHost(ResourceDispatcherHost *resource_dispatcher_host);
+ ~NaClProcessHost() {}
+
+ // Initialize the new NaCl process, returning true on success.
+ bool Launch(ResourceMessageFilter* renderer_msg_filter,
+ const int descriptor,
+ nacl::FileDescriptor *handle);
+
+ virtual void OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ bool LaunchSelLdr(ResourceMessageFilter* renderer_msg_filter,
+ const int descriptor,
+ const nacl::Handle handle);
+
+ bool SendStartMessage(base::ProcessHandle process,
+ int descriptor,
+ nacl::Handle handle);
+
+ // ResourceDispatcherHost::Receiver implementation:
+ virtual URLRequestContext* GetRequestContext(
+ uint32 request_id,
+ const ViewHostMsg_Resource_Request& request_data);
+
+ virtual bool CanShutdown() { return true; }
+
+ private:
+ ResourceDispatcherHost* resource_dispatcher_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
+};
+
+#endif // CHROME_BROWSER_NACL_PROCESS_HOST_H_