Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 2885017: Moved common parts of ChildProcessHost into chrome/common and created a Brows... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Code review changes Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/nacl_host/nacl_process_host.h" 7 #include "chrome/browser/nacl_host/nacl_process_host.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 10 matching lines...) Expand all
21 21
22 #if defined(OS_POSIX) 22 #if defined(OS_POSIX)
23 #include "ipc/ipc_channel_posix.h" 23 #include "ipc/ipc_channel_posix.h"
24 #elif defined(OS_WIN) 24 #elif defined(OS_WIN)
25 #include "chrome/browser/nacl_host/nacl_broker_service_win.h" 25 #include "chrome/browser/nacl_host/nacl_broker_service_win.h"
26 #endif 26 #endif
27 27
28 NaClProcessHost::NaClProcessHost( 28 NaClProcessHost::NaClProcessHost(
29 ResourceDispatcherHost *resource_dispatcher_host, 29 ResourceDispatcherHost *resource_dispatcher_host,
30 const std::wstring& url) 30 const std::wstring& url)
31 : ChildProcessHost(NACL_LOADER_PROCESS, resource_dispatcher_host), 31 : BrowserChildProcessHost(NACL_LOADER_PROCESS, resource_dispatcher_host),
32 resource_dispatcher_host_(resource_dispatcher_host), 32 resource_dispatcher_host_(resource_dispatcher_host),
33 reply_msg_(NULL), 33 reply_msg_(NULL),
34 descriptor_(0), 34 descriptor_(0),
35 running_on_wow64_(false) { 35 running_on_wow64_(false) {
36 set_name(url); 36 set_name(url);
37 #if defined(OS_WIN) 37 #if defined(OS_WIN)
38 CheckIsWow64(); 38 CheckIsWow64();
39 #endif 39 #endif
40 } 40 }
41 41
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, 92 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID,
93 ASCIIToWide(channel_id())); 93 ASCIIToWide(channel_id()));
94 94
95 // On Windows we might need to start the broker process to launch a new loader 95 // On Windows we might need to start the broker process to launch a new loader
96 #if defined(OS_WIN) 96 #if defined(OS_WIN)
97 if (running_on_wow64_) { 97 if (running_on_wow64_) {
98 NaClBrokerService::GetInstance()->Init(resource_dispatcher_host_); 98 NaClBrokerService::GetInstance()->Init(resource_dispatcher_host_);
99 return NaClBrokerService::GetInstance()->LaunchLoader(this, 99 return NaClBrokerService::GetInstance()->LaunchLoader(this,
100 ASCIIToWide(channel_id())); 100 ASCIIToWide(channel_id()));
101 } else { 101 } else {
102 ChildProcessHost::Launch(FilePath(), cmd_line); 102 BrowserChildProcessHost::Launch(FilePath(), cmd_line);
103 } 103 }
104 #elif defined(OS_POSIX) 104 #elif defined(OS_POSIX)
105 ChildProcessHost::Launch(true, // use_zygote 105 BrowserChildProcessHost::Launch(true, // use_zygote
106 base::environment_vector(), 106 base::environment_vector(),
107 cmd_line); 107 cmd_line);
108 #endif 108 #endif
109 109
110 return true; 110 return true;
111 } 111 }
112 112
113 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { 113 void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) {
114 set_handle(handle); 114 set_handle(handle);
115 OnProcessLaunched(); 115 OnProcessLaunched();
116 } 116 }
117 117
118 bool NaClProcessHost::DidChildCrash() { 118 bool NaClProcessHost::DidChildCrash() {
119 if (running_on_wow64_) 119 if (running_on_wow64_)
120 return base::DidProcessCrash(NULL, handle()); 120 return base::DidProcessCrash(NULL, handle());
121 return ChildProcessHost::DidChildCrash(); 121 return BrowserChildProcessHost::DidChildCrash();
122 } 122 }
123 123
124 void NaClProcessHost::OnChildDied() { 124 void NaClProcessHost::OnChildDied() {
125 #if defined(OS_WIN) 125 #if defined(OS_WIN)
126 NaClBrokerService::GetInstance()->OnLoaderDied(); 126 NaClBrokerService::GetInstance()->OnLoaderDied();
127 #endif 127 #endif
128 ChildProcessHost::OnChildDied(); 128 BrowserChildProcessHost::OnChildDied();
129 } 129 }
130 130
131 void NaClProcessHost::OnProcessLaunched() { 131 void NaClProcessHost::OnProcessLaunched() {
132 nacl::FileDescriptor imc_handle; 132 nacl::FileDescriptor imc_handle;
133 base::ProcessHandle nacl_process_handle; 133 base::ProcessHandle nacl_process_handle;
134 #if defined(OS_WIN) 134 #if defined(OS_WIN)
135 // Duplicate the IMC handle 135 // Duplicate the IMC handle
136 // We assume the size of imc_handle has the same size as HANDLE, so the cast 136 // We assume the size of imc_handle has the same size as HANDLE, so the cast
137 // below is safe. 137 // below is safe.
138 DCHECK(sizeof(HANDLE) == sizeof(imc_handle)); 138 DCHECK(sizeof(HANDLE) == sizeof(imc_handle));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (fnIsWow64Process != NULL) { 220 if (fnIsWow64Process != NULL) {
221 BOOL bIsWow64 = FALSE; 221 BOOL bIsWow64 = FALSE;
222 if (fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) { 222 if (fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) {
223 if (bIsWow64) { 223 if (bIsWow64) {
224 running_on_wow64_ = true; 224 running_on_wow64_ = true;
225 } 225 }
226 } 226 }
227 } 227 }
228 } 228 }
229 #endif 229 #endif
OLDNEW
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.h ('k') | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698