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 #include "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/location.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
19 #include "base/process/process_iterator.h" | 19 #include "base/process/process_iterator.h" |
20 #include "base/rand_util.h" | 20 #include "base/rand_util.h" |
| 21 #include "base/single_thread_task_runner.h" |
21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
26 #include "base/sys_byteorder.h" | 27 #include "base/sys_byteorder.h" |
| 28 #include "base/thread_task_runner_handle.h" |
27 #include "base/threading/sequenced_worker_pool.h" | 29 #include "base/threading/sequenced_worker_pool.h" |
28 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
29 #include "build/build_config.h" | 31 #include "build/build_config.h" |
30 #include "components/nacl/browser/nacl_browser.h" | 32 #include "components/nacl/browser/nacl_browser.h" |
31 #include "components/nacl/browser/nacl_browser_delegate.h" | 33 #include "components/nacl/browser/nacl_browser_delegate.h" |
32 #include "components/nacl/browser/nacl_host_message_filter.h" | 34 #include "components/nacl/browser/nacl_host_message_filter.h" |
33 #include "components/nacl/common/nacl_cmd_line.h" | 35 #include "components/nacl/common/nacl_cmd_line.h" |
34 #include "components/nacl/common/nacl_host_messages.h" | 36 #include "components/nacl/common/nacl_host_messages.h" |
35 #include "components/nacl/common/nacl_messages.h" | 37 #include "components/nacl/common/nacl_messages.h" |
36 #include "components/nacl/common/nacl_process_type.h" | 38 #include "components/nacl/common/nacl_process_type.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 if (ipc_proxy_channel_.get()) { | 1128 if (ipc_proxy_channel_.get()) { |
1127 // Attempt to open more than 1 browser channel is not supported. | 1129 // Attempt to open more than 1 browser channel is not supported. |
1128 // Shut down the NaCl process. | 1130 // Shut down the NaCl process. |
1129 process_->GetHost()->ForceShutdown(); | 1131 process_->GetHost()->ForceShutdown(); |
1130 return false; | 1132 return false; |
1131 } | 1133 } |
1132 | 1134 |
1133 DCHECK_EQ(PROCESS_TYPE_NACL_LOADER, process_->GetData().process_type); | 1135 DCHECK_EQ(PROCESS_TYPE_NACL_LOADER, process_->GetData().process_type); |
1134 | 1136 |
1135 ipc_proxy_channel_ = IPC::ChannelProxy::Create( | 1137 ipc_proxy_channel_ = IPC::ChannelProxy::Create( |
1136 channel_handle.release(), | 1138 channel_handle.release(), IPC::Channel::MODE_CLIENT, NULL, |
1137 IPC::Channel::MODE_CLIENT, | 1139 base::ThreadTaskRunnerHandle::Get().get()); |
1138 NULL, | |
1139 base::MessageLoopProxy::current().get()); | |
1140 // Create the browser ppapi host and enable PPAPI message dispatching to the | 1140 // Create the browser ppapi host and enable PPAPI message dispatching to the |
1141 // browser process. | 1141 // browser process. |
1142 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( | 1142 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
1143 ipc_proxy_channel_.get(), // sender | 1143 ipc_proxy_channel_.get(), // sender |
1144 permissions_, | 1144 permissions_, |
1145 process_->GetData().handle, | 1145 process_->GetData().handle, |
1146 ipc_proxy_channel_.get(), | 1146 ipc_proxy_channel_.get(), |
1147 nacl_host_message_filter_->render_process_id(), | 1147 nacl_host_message_filter_->render_process_id(), |
1148 render_view_id_, | 1148 render_view_id_, |
1149 profile_directory_)); | 1149 profile_directory_)); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 // If the NaCl loader is 64-bit, the process running its debug | 1376 // If the NaCl loader is 64-bit, the process running its debug |
1377 // exception handler must be 64-bit too, so we use the 64-bit NaCl | 1377 // exception handler must be 64-bit too, so we use the 64-bit NaCl |
1378 // broker process for this. Otherwise, on a 32-bit system, we use | 1378 // broker process for this. Otherwise, on a 32-bit system, we use |
1379 // the 32-bit browser process to run the debug exception handler. | 1379 // the 32-bit browser process to run the debug exception handler. |
1380 if (RunningOnWOW64()) { | 1380 if (RunningOnWOW64()) { |
1381 return NaClBrokerService::GetInstance()->LaunchDebugExceptionHandler( | 1381 return NaClBrokerService::GetInstance()->LaunchDebugExceptionHandler( |
1382 weak_factory_.GetWeakPtr(), nacl_pid, process.Handle(), | 1382 weak_factory_.GetWeakPtr(), nacl_pid, process.Handle(), |
1383 info); | 1383 info); |
1384 } else { | 1384 } else { |
1385 NaClStartDebugExceptionHandlerThread( | 1385 NaClStartDebugExceptionHandlerThread( |
1386 process.Pass(), info, | 1386 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), |
1387 base::MessageLoopProxy::current(), | |
1388 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1387 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
1389 weak_factory_.GetWeakPtr())); | 1388 weak_factory_.GetWeakPtr())); |
1390 return true; | 1389 return true; |
1391 } | 1390 } |
1392 } | 1391 } |
1393 #endif | 1392 #endif |
1394 | 1393 |
1395 } // namespace nacl | 1394 } // namespace nacl |
OLD | NEW |