| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util_proxy.h" | 12 #include "base/file_util_proxy.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/message_loop.h" |
| 15 #include "base/process.h" | 16 #include "base/process.h" |
| 16 #include "chrome/common/nacl_types.h" | 17 #include "chrome/common/nacl_types.h" |
| 17 #include "content/public/browser/browser_child_process_host_delegate.h" | 18 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 18 | 19 |
| 19 class ChromeRenderMessageFilter; | 20 class ChromeRenderMessageFilter; |
| 20 class CommandLine; | 21 class CommandLine; |
| 21 class ExtensionInfoMap; | 22 class ExtensionInfoMap; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class BrowserChildProcessHost; | 25 class BrowserChildProcessHost; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 bool Send(IPC::Message* msg); | 56 bool Send(IPC::Message* msg); |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 // Internal class that holds the nacl::Handle objecs so that | 59 // Internal class that holds the nacl::Handle objecs so that |
| 59 // nacl_process_host.h doesn't include NaCl headers. Needed since it's | 60 // nacl_process_host.h doesn't include NaCl headers. Needed since it's |
| 60 // included by src\content, which can't depend on the NaCl gyp file because it | 61 // included by src\content, which can't depend on the NaCl gyp file because it |
| 61 // depends on chrome.gyp (circular dependency). | 62 // depends on chrome.gyp (circular dependency). |
| 62 struct NaClInternal; | 63 struct NaClInternal; |
| 63 | 64 |
| 65 #if defined(OS_WIN) |
| 64 // Create command line for launching loader under nacl-gdb. | 66 // Create command line for launching loader under nacl-gdb. |
| 65 scoped_ptr<CommandLine> LaunchWithNaClGdb(const FilePath& nacl_gdb, | 67 scoped_ptr<CommandLine> LaunchWithNaClGdb(const FilePath& nacl_gdb, |
| 66 CommandLine* line, | 68 CommandLine* line); |
| 67 const FilePath& manifest_path); | 69 #elif defined(OS_LINUX) |
| 70 bool LaunchNaClGdb(base::ProcessId pid); |
| 71 void OnNaClGdbAttached(); |
| 72 #endif |
| 73 // Get path to manifest on local disk if possible. |
| 74 FilePath GetManifestPath(); |
| 68 bool LaunchSelLdr(); | 75 bool LaunchSelLdr(); |
| 69 | 76 |
| 70 // BrowserChildProcessHostDelegate implementation: | 77 // BrowserChildProcessHostDelegate implementation: |
| 71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 78 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 72 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 79 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 73 virtual void OnProcessLaunched() OVERRIDE; | 80 virtual void OnProcessLaunched() OVERRIDE; |
| 74 | 81 |
| 75 void IrtReady(); | 82 void IrtReady(); |
| 76 void SendStart(); | 83 void SendStart(); |
| 77 | 84 |
| 78 // Message handlers for validation caching. | 85 // Message handlers for validation caching. |
| 79 void OnQueryKnownToValidate(const std::string& signature, bool* result); | 86 void OnQueryKnownToValidate(const std::string& signature, bool* result); |
| 80 void OnSetKnownToValidate(const std::string& signature); | 87 void OnSetKnownToValidate(const std::string& signature); |
| 81 | 88 |
| 82 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
| 83 class DebugContext; | 90 class DebugContext; |
| 84 | 91 |
| 85 scoped_refptr<DebugContext> debug_context_; | 92 scoped_refptr<DebugContext> debug_context_; |
| 86 | 93 |
| 87 // This field becomes true when the broker successfully launched | 94 // This field becomes true when the broker successfully launched |
| 88 // the NaCl loader. | 95 // the NaCl loader. |
| 89 bool process_launched_by_broker_; | 96 bool process_launched_by_broker_; |
| 97 #elif defined(OS_LINUX) |
| 98 bool wait_for_nacl_gdb_; |
| 99 MessageLoopForIO::FileDescriptorWatcher nacl_gdb_watcher_; |
| 100 scoped_ptr<MessageLoopForIO::Watcher> nacl_gdb_watcher_delegate_; |
| 90 #endif | 101 #endif |
| 91 // The ChromeRenderMessageFilter that requested this NaCl process. We use | 102 // The ChromeRenderMessageFilter that requested this NaCl process. We use |
| 92 // this for sending the reply once the process has started. | 103 // this for sending the reply once the process has started. |
| 93 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; | 104 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; |
| 94 | 105 |
| 95 // The reply message to send. We must always send this message when the | 106 // The reply message to send. We must always send this message when the |
| 96 // sub-process either succeeds or fails to unblock the renderer waiting for | 107 // sub-process either succeeds or fails to unblock the renderer waiting for |
| 97 // the reply. NULL when there is no reply to send. | 108 // the reply. NULL when there is no reply to send. |
| 98 IPC::Message* reply_msg_; | 109 IPC::Message* reply_msg_; |
| 99 | 110 |
| 100 // Set of extensions for (NaCl) manifest auto-detection. The file path to | 111 // Set of extensions for (NaCl) manifest auto-detection. The file path to |
| 101 // manifest is passed to nacl-gdb when it is used to debug the NaCl loader. | 112 // manifest is passed to nacl-gdb when it is used to debug the NaCl loader. |
| 102 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 113 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 103 | 114 |
| 104 // Socket pairs for the NaCl process and renderer. | 115 // Socket pairs for the NaCl process and renderer. |
| 105 scoped_ptr<NaClInternal> internal_; | 116 scoped_ptr<NaClInternal> internal_; |
| 106 | 117 |
| 107 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 118 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
| 108 | 119 |
| 109 scoped_ptr<content::BrowserChildProcessHost> process_; | 120 scoped_ptr<content::BrowserChildProcessHost> process_; |
| 110 | 121 |
| 111 bool enable_exception_handling_; | 122 bool enable_exception_handling_; |
| 112 | 123 |
| 113 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 124 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
| 114 }; | 125 }; |
| 115 | 126 |
| 116 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 127 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ |
| OLD | NEW |