OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 10 matching lines...) Expand all Loading... |
21 // channel. There will be one NaClProcessHost per NaCl process | 21 // channel. There will be one NaClProcessHost per NaCl process |
22 // The browser is responsible for starting the NaCl process | 22 // The browser is responsible for starting the NaCl process |
23 // when requested by the renderer. | 23 // when requested by the renderer. |
24 // After that, most of the communication is directly between NaCl plugin | 24 // After that, most of the communication is directly between NaCl plugin |
25 // running in the renderer and NaCl processes. | 25 // running in the renderer and NaCl processes. |
26 class NaClProcessHost : public BrowserChildProcessHost { | 26 class NaClProcessHost : public BrowserChildProcessHost { |
27 public: | 27 public: |
28 explicit NaClProcessHost(const std::wstring& url); | 28 explicit NaClProcessHost(const std::wstring& url); |
29 virtual ~NaClProcessHost(); | 29 virtual ~NaClProcessHost(); |
30 | 30 |
| 31 // Open the integrated runtime library file and save it for later. |
| 32 static void OpenIrtLibraryFile(); |
| 33 |
31 // Initialize the new NaCl process, returning true on success. | 34 // Initialize the new NaCl process, returning true on success. |
32 bool Launch(ChromeRenderMessageFilter* chrome_render_message_filter, | 35 bool Launch(ChromeRenderMessageFilter* chrome_render_message_filter, |
33 int socket_count, | 36 int socket_count, |
34 IPC::Message* reply_msg); | 37 IPC::Message* reply_msg); |
35 | 38 |
36 virtual bool OnMessageReceived(const IPC::Message& msg); | 39 virtual bool OnMessageReceived(const IPC::Message& msg); |
37 | 40 |
38 void OnProcessLaunchedByBroker(base::ProcessHandle handle); | 41 void OnProcessLaunchedByBroker(base::ProcessHandle handle); |
39 | 42 |
40 protected: | 43 protected: |
41 virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); | 44 virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); |
42 virtual void OnChildDied(); | 45 virtual void OnChildDied(); |
43 | 46 |
44 private: | 47 private: |
45 // Internal class that holds the nacl::Handle objecs so that | 48 // Internal class that holds the nacl::Handle objecs so that |
46 // nacl_process_host.h doesn't include NaCl headers. Needed since it's | 49 // nacl_process_host.h doesn't include NaCl headers. Needed since it's |
47 // included by src\content, which can't depend on the NaCl gyp file because it | 50 // included by src\content, which can't depend on the NaCl gyp file because it |
48 // depends on chrome.gyp (circular dependency). | 51 // depends on chrome.gyp (circular dependency). |
49 struct NaClInternal; | 52 struct NaClInternal; |
50 | 53 |
51 bool LaunchSelLdr(); | 54 bool LaunchSelLdr(); |
52 | 55 |
53 // Get the architecture-specific filename of NaCl's integrated | |
54 // runtime (IRT) library, relative to the plugins directory. | |
55 FilePath::StringType GetIrtLibraryFilename(); | |
56 | |
57 virtual void OnProcessLaunched(); | 56 virtual void OnProcessLaunched(); |
58 | 57 |
59 void OpenIrtFileDone(base::PlatformFileError error_code, | 58 void SendStart(base::PlatformFile irt_file); |
60 base::PassPlatformFile file, | |
61 bool created); | |
62 | 59 |
63 virtual bool CanShutdown(); | 60 virtual bool CanShutdown(); |
64 | 61 |
| 62 static bool RunningOnWOW64(); |
| 63 |
65 private: | 64 private: |
| 65 static base::PlatformFile irt_platform_file_; |
| 66 |
66 // The ChromeRenderMessageFilter that requested this NaCl process. We use | 67 // The ChromeRenderMessageFilter that requested this NaCl process. We use |
67 // this for sending the reply once the process has started. | 68 // this for sending the reply once the process has started. |
68 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; | 69 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; |
69 | 70 |
70 // The reply message to send. | 71 // The reply message to send. |
71 IPC::Message* reply_msg_; | 72 IPC::Message* reply_msg_; |
72 | 73 |
73 // Socket pairs for the NaCl process and renderer. | 74 // Socket pairs for the NaCl process and renderer. |
74 scoped_ptr<NaClInternal> internal_; | 75 scoped_ptr<NaClInternal> internal_; |
75 | 76 |
76 // Windows platform flag | |
77 bool running_on_wow64_; | |
78 | |
79 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 77 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
80 | 78 |
81 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 79 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
82 }; | 80 }; |
83 | 81 |
84 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 82 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ |
OLD | NEW |