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 |
(...skipping 19 matching lines...) Expand all Loading... | |
30 // After that, most of the communication is directly between NaCl plugin | 30 // After that, most of the communication is directly between NaCl plugin |
31 // running in the renderer and NaCl processes. | 31 // running in the renderer and NaCl processes. |
32 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { | 32 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { |
33 public: | 33 public: |
34 explicit NaClProcessHost(const std::wstring& url); | 34 explicit NaClProcessHost(const std::wstring& url); |
35 virtual ~NaClProcessHost(); | 35 virtual ~NaClProcessHost(); |
36 | 36 |
37 // Do any minimal work that must be done at browser startup. | 37 // Do any minimal work that must be done at browser startup. |
38 static void EarlyStartup(); | 38 static void EarlyStartup(); |
39 | 39 |
40 // Initialize the new NaCl process, returning true on success. On success, | 40 // Initialize the new NaCl process, returning true on success. On success, |
Mark Seaborn
2012/03/21 20:41:29
Update the comment. Launch() no longer returns tr
halyavin
2012/03/22 08:35:47
Done.
| |
41 // the NaCl process host will assume responsibility for sending the reply | 41 // the NaCl process host will assume responsibility for sending the reply |
42 // message. On failure, the reply will not be sent and this is the caller's | 42 // message. On failure, the reply will not be sent and this is the caller's |
43 // responsibility to avoid hanging the renderer. | 43 // responsibility to avoid hanging the renderer. |
44 bool Launch(ChromeRenderMessageFilter* chrome_render_message_filter, | 44 void Launch(ChromeRenderMessageFilter* chrome_render_message_filter, |
45 int socket_count, | 45 int socket_count, |
46 IPC::Message* reply_msg); | 46 IPC::Message* reply_msg); |
47 | 47 |
48 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 48 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
49 | 49 |
50 void OnProcessLaunchedByBroker(base::ProcessHandle handle); | 50 void OnProcessLaunchedByBroker(base::ProcessHandle handle); |
51 | 51 |
52 private: | 52 private: |
53 // Internal class that holds the nacl::Handle objecs so that | 53 // Internal class that holds the nacl::Handle objecs so that |
54 // nacl_process_host.h doesn't include NaCl headers. Needed since it's | 54 // nacl_process_host.h doesn't include NaCl headers. Needed since it's |
55 // included by src\content, which can't depend on the NaCl gyp file because it | 55 // included by src\content, which can't depend on the NaCl gyp file because it |
56 // depends on chrome.gyp (circular dependency). | 56 // depends on chrome.gyp (circular dependency). |
57 struct NaClInternal; | 57 struct NaClInternal; |
58 | 58 |
59 // Create command line for launching loader under nacl-gdb. | 59 // Create command line for launching loader under nacl-gdb. |
60 scoped_ptr<CommandLine> LaunchWithNaClGdb(const FilePath& nacl_gdb, | 60 scoped_ptr<CommandLine> LaunchWithNaClGdb(const FilePath& nacl_gdb, |
61 CommandLine* line); | 61 CommandLine* line); |
62 bool LaunchSelLdr(); | 62 bool LaunchSelLdr(); |
63 | 63 |
64 // BrowserChildProcessHostDelegate implementation: | 64 // BrowserChildProcessHostDelegate implementation: |
65 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 65 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
66 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 66 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
67 virtual void OnProcessLaunched() OVERRIDE; | 67 virtual void OnProcessLaunched() OVERRIDE; |
68 | 68 |
69 void IrtReady(); | 69 void IrtReady(); |
70 void SendStart(base::PlatformFile irt_file); | 70 void SendStart(base::PlatformFile irt_file); |
71 | 71 |
72 // Send message to the renderer that NaCl failed to load. | |
73 void SendNaClLaunchError(); | |
74 | |
72 bool IsHardwareExceptionHandlingEnabled(); | 75 bool IsHardwareExceptionHandlingEnabled(); |
73 | 76 |
74 private: | 77 private: |
75 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
76 class DebugContext; | 79 class DebugContext; |
77 | 80 |
78 scoped_refptr<DebugContext> debug_context_; | 81 scoped_refptr<DebugContext> debug_context_; |
82 | |
83 // This field becames true when the broker successfully launched | |
Mark Seaborn
2012/03/21 20:41:29
'becomes'. Actually the comment is rather unneces
halyavin
2012/03/22 08:35:47
Done.
| |
84 // the NaCl loader. | |
85 bool process_launched_by_broker_; | |
79 #endif | 86 #endif |
80 // The ChromeRenderMessageFilter that requested this NaCl process. We use | 87 // The ChromeRenderMessageFilter that requested this NaCl process. We use |
81 // this for sending the reply once the process has started. | 88 // this for sending the reply once the process has started. |
82 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; | 89 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; |
83 | 90 |
84 // The reply message to send. We must always send this message when the | 91 // The reply message to send. We must always send this message when the |
85 // sub-process either succeeds or fails to unblock the renderer waiting for | 92 // sub-process either succeeds or fails to unblock the renderer waiting for |
86 // the reply. NULL when there is no reply to send. | 93 // the reply. NULL when there is no reply to send. |
87 IPC::Message* reply_msg_; | 94 IPC::Message* reply_msg_; |
88 | 95 |
89 // Socket pairs for the NaCl process and renderer. | 96 // Socket pairs for the NaCl process and renderer. |
90 scoped_ptr<NaClInternal> internal_; | 97 scoped_ptr<NaClInternal> internal_; |
91 | 98 |
92 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 99 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
93 | 100 |
94 scoped_ptr<content::BrowserChildProcessHost> process_; | 101 scoped_ptr<content::BrowserChildProcessHost> process_; |
95 | 102 |
96 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 103 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
97 }; | 104 }; |
98 | 105 |
99 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 106 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ |
OLD | NEW |