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 #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/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.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/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_split.h" | 22 #include "base/strings/string_split.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
| 27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
| 28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 29 #include "components/nacl/browser/nacl_browser.h" | 29 #include "components/nacl/browser/nacl_browser.h" |
| 30 #include "components/nacl/browser/nacl_browser_delegate.h" | |
| 30 #include "components/nacl/browser/nacl_host_message_filter.h" | 31 #include "components/nacl/browser/nacl_host_message_filter.h" |
| 31 #include "components/nacl/common/nacl_cmd_line.h" | 32 #include "components/nacl/common/nacl_cmd_line.h" |
| 32 #include "components/nacl/common/nacl_host_messages.h" | 33 #include "components/nacl/common/nacl_host_messages.h" |
| 33 #include "components/nacl/common/nacl_messages.h" | 34 #include "components/nacl/common/nacl_messages.h" |
| 34 #include "components/nacl/common/nacl_process_type.h" | 35 #include "components/nacl/common/nacl_process_type.h" |
| 35 #include "components/nacl/common/nacl_switches.h" | 36 #include "components/nacl/common/nacl_switches.h" |
| 36 #include "content/public/browser/browser_child_process_host.h" | 37 #include "content/public/browser/browser_child_process_host.h" |
| 37 #include "content/public/browser/browser_ppapi_host.h" | 38 #include "content/public/browser/browser_ppapi_host.h" |
| 38 #include "content/public/browser/child_process_data.h" | 39 #include "content/public/browser/child_process_data.h" |
| 39 #include "content/public/browser/plugin_service.h" | 40 #include "content/public/browser/plugin_service.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); | 424 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| 424 nacl_browser->EnsureAllResourcesAvailable(); | 425 nacl_browser->EnsureAllResourcesAvailable(); |
| 425 if (!nacl_browser->IsOk()) { | 426 if (!nacl_browser->IsOk()) { |
| 426 SendErrorToRenderer("could not find all the resources needed" | 427 SendErrorToRenderer("could not find all the resources needed" |
| 427 " to launch the process"); | 428 " to launch the process"); |
| 428 delete this; | 429 delete this; |
| 429 return; | 430 return; |
| 430 } | 431 } |
| 431 | 432 |
| 432 if (uses_nonsfi_mode_) { | 433 if (uses_nonsfi_mode_) { |
| 434 bool nonsfi_mode_enabled = false; | |
| 433 #if defined(OS_LINUX) | 435 #if defined(OS_LINUX) |
| 434 const bool kNonSFIModeSupported = true; | 436 nonsfi_mode_enabled = nonsfi_mode_enabled || |
|
jln (very slow on Chromium)
2014/05/08 23:22:41
This is fine, but if you don't mind havint differe
jln (very slow on Chromium)
2014/05/08 23:44:57
err, enabled, not disabled:
nonsfi_mode_enabled =
elijahtaylor1
2014/05/09 00:33:28
Done.
| |
| 435 #else | 437 cmd->HasSwitch(switches::kEnableNaClNonSfiMode); |
| 436 const bool kNonSFIModeSupported = false; | 438 # if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 439 nonsfi_mode_enabled = nonsfi_mode_enabled || | |
| 440 NaClBrowser::GetDelegate()->IsNonSfiModeAllowed(manifest_url_); | |
| 441 # endif | |
| 437 #endif | 442 #endif |
| 438 if (!kNonSFIModeSupported || | 443 if (!nonsfi_mode_enabled) { |
| 439 !cmd->HasSwitch(switches::kEnableNaClNonSfiMode)) { | 444 SendErrorToRenderer("NaCl non-SFI mode is not available for this platform" |
| 440 SendErrorToRenderer("NaCl non-SFI mode works only on Linux with" | 445 " and NaCl module."); |
| 441 " --enable-nacl-nonsfi-mode specified"); | |
| 442 delete this; | 446 delete this; |
| 443 return; | 447 return; |
| 444 } | 448 } |
| 445 } | 449 } |
| 446 | 450 |
| 447 // Rather than creating a socket pair in the renderer, and passing | 451 // Rather than creating a socket pair in the renderer, and passing |
| 448 // one side through the browser to sel_ldr, socket pairs are created | 452 // one side through the browser to sel_ldr, socket pairs are created |
| 449 // in the browser and then passed to the renderer and sel_ldr. | 453 // in the browser and then passed to the renderer and sel_ldr. |
| 450 // | 454 // |
| 451 // This is mainly for the benefit of Windows, where sockets cannot | 455 // This is mainly for the benefit of Windows, where sockets cannot |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1092 process_handle.Take(), info, | 1096 process_handle.Take(), info, |
| 1093 base::MessageLoopProxy::current(), | 1097 base::MessageLoopProxy::current(), |
| 1094 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1098 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1095 weak_factory_.GetWeakPtr())); | 1099 weak_factory_.GetWeakPtr())); |
| 1096 return true; | 1100 return true; |
| 1097 } | 1101 } |
| 1098 } | 1102 } |
| 1099 #endif | 1103 #endif |
| 1100 | 1104 |
| 1101 } // namespace nacl | 1105 } // namespace nacl |
| OLD | NEW |