Chromium Code Reviews| 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 #endif |
| 70 #if defined(OS_LINUX) | |
|
Mark Seaborn
2012/04/03 21:57:44
Use #elif, since this is the Linux version of the
halyavin
2012/04/04 09:23:15
Done.
| |
| 71 bool LaunchNaClGdb(base::ProcessId pid); | |
| 72 void OnNaClGdbAttached(); | |
| 73 #endif | |
| 74 // Get path to manifest on local disk if possible. | |
| 75 FilePath GetManifestPath(); | |
| 68 bool LaunchSelLdr(); | 76 bool LaunchSelLdr(); |
| 69 | 77 |
| 70 // BrowserChildProcessHostDelegate implementation: | 78 // BrowserChildProcessHostDelegate implementation: |
| 71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 79 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 72 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 80 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 73 virtual void OnProcessLaunched() OVERRIDE; | 81 virtual void OnProcessLaunched() OVERRIDE; |
| 74 | 82 |
| 75 void IrtReady(); | 83 void IrtReady(); |
| 76 void SendStart(); | 84 void SendStart(); |
| 77 | 85 |
| 78 // Message handlers for validation caching. | 86 // Message handlers for validation caching. |
| 79 void OnQueryKnownToValidate(const std::string& signature, bool* result); | 87 void OnQueryKnownToValidate(const std::string& signature, bool* result); |
| 80 void OnSetKnownToValidate(const std::string& signature); | 88 void OnSetKnownToValidate(const std::string& signature); |
| 81 | 89 |
| 82 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
| 83 class DebugContext; | 91 class DebugContext; |
| 84 | 92 |
| 85 scoped_refptr<DebugContext> debug_context_; | 93 scoped_refptr<DebugContext> debug_context_; |
| 86 | 94 |
| 87 // This field becomes true when the broker successfully launched | 95 // This field becomes true when the broker successfully launched |
| 88 // the NaCl loader. | 96 // the NaCl loader. |
| 89 bool process_launched_by_broker_; | 97 bool process_launched_by_broker_; |
| 90 #endif | 98 #endif |
| 99 #if defined(OS_LINUX) | |
|
Mark Seaborn
2012/04/03 21:57:44
It'd be neater to use #elif here too.
halyavin
2012/04/04 09:23:15
Done.
| |
| 100 bool wait_for_nacl_gdb_; | |
| 101 MessageLoopForIO::FileDescriptorWatcher nacl_gdb_watcher_; | |
| 102 scoped_ptr<MessageLoopForIO::Watcher> nacl_gdb_watcher_delegate_; | |
| 103 #endif | |
| 91 // The ChromeRenderMessageFilter that requested this NaCl process. We use | 104 // The ChromeRenderMessageFilter that requested this NaCl process. We use |
| 92 // this for sending the reply once the process has started. | 105 // this for sending the reply once the process has started. |
| 93 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; | 106 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; |
| 94 | 107 |
| 95 // The reply message to send. We must always send this message when the | 108 // 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 | 109 // sub-process either succeeds or fails to unblock the renderer waiting for |
| 97 // the reply. NULL when there is no reply to send. | 110 // the reply. NULL when there is no reply to send. |
| 98 IPC::Message* reply_msg_; | 111 IPC::Message* reply_msg_; |
| 99 | 112 |
| 100 // Set of extensions for (NaCl) manifest auto-detection. The file path to | 113 // 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. | 114 // manifest is passed to nacl-gdb when it is used to debug the NaCl loader. |
| 102 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 115 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 103 | 116 |
| 104 // Socket pairs for the NaCl process and renderer. | 117 // Socket pairs for the NaCl process and renderer. |
| 105 scoped_ptr<NaClInternal> internal_; | 118 scoped_ptr<NaClInternal> internal_; |
| 106 | 119 |
| 107 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 120 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
| 108 | 121 |
| 109 scoped_ptr<content::BrowserChildProcessHost> process_; | 122 scoped_ptr<content::BrowserChildProcessHost> process_; |
| 110 | 123 |
| 111 bool enable_exception_handling_; | 124 bool enable_exception_handling_; |
| 112 | 125 |
| 113 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 126 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
| 114 }; | 127 }; |
| 115 | 128 |
| 116 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 129 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ |
| OLD | NEW |