Skip to content

Commit

Permalink
Remove Windows and Mac specific NaCl code
Browse files Browse the repository at this point in the history
Remove Windows and Mac specific NaCl code from components/nacl.
Since NaCl no longer works on Windows or Mac, this code is now dead and
can be removed.

Bug: b:303417958
Change-Id: I9929e3148fc5d110af0c3c84ec1bad1988d12e25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4980487
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Fabian Sommer <fabiansommer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216886}
  • Loading branch information
Fabian-Sommer authored and Chromium LUCI CQ committed Oct 30, 2023
1 parent bcad92c commit 23cde5e
Show file tree
Hide file tree
Showing 25 changed files with 9 additions and 724 deletions.
25 changes: 2 additions & 23 deletions components/nacl/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ static_library("browser") {
"//build:chromeos_buildflags",
"//components/nacl/common",
"//components/nacl/common:buildflags",
"//components/nacl/common:debug_exception_handler",
"//components/url_formatter",
"//content/public/browser",
"//content/public/common",
Expand All @@ -49,20 +48,6 @@ static_library("browser") {

data_deps = []

if (is_win) {
sources += [
"nacl_broker_host_win.cc",
"nacl_broker_host_win.h",
"nacl_broker_service_win.cc",
"nacl_broker_service_win.h",
]

deps += [
# This is needed for the Windows debug exception handler.
"//native_client/src/trusted/service_runtime:sel",
]
}

if (is_linux || is_chromeos) {
sources += [
"../zygote/nacl_fork_delegate_linux.cc",
Expand All @@ -73,26 +58,20 @@ static_library("browser") {
"//sandbox/linux:sandbox_services",
"//sandbox/linux:suid_sandbox_client",
]

# TODO(https://crbug.com/1299021): This dependency might be redundant
# given that we were able to disable it, apparently without negative
# consequences, for the ARM32-NaCl-on-ARM64 case.
if (target_cpu != "arm64") {
deps += [
"//components/nacl/loader:nacl_helper_integration",
]
deps += [ "//components/nacl/loader:nacl_helper_integration" ]
}
}

if (is_win && current_cpu == "x86") {
data_deps += [ "//components/nacl/broker:nacl64" ]
}
}

source_set("unit_tests") {
testonly = true
sources = [
"nacl_file_host_unittest.cc",
"nacl_process_host_unittest.cc",
"nacl_validation_cache_unittest.cc",
"pnacl_host_unittest.cc",
"pnacl_translation_cache_unittest.cc",
Expand Down
28 changes: 2 additions & 26 deletions components/nacl/browser/nacl_browser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#include "content/public/browser/browser_thread.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif

namespace {

// Tasks posted in this file are on the critical path of displaying the official
Expand All @@ -45,17 +41,10 @@ const base::FilePath::StringType NaClIrtName() {

#if defined(ARCH_CPU_X86_FAMILY)
#if defined(ARCH_CPU_X86_64)
bool is64 = true;
#elif BUILDFLAG(IS_WIN)
bool is64 = base::win::OSInfo::GetInstance()->IsWowX86OnAMD64();
irt_name.append(FILE_PATH_LITERAL("x86_64"));
#else
bool is64 = false;
irt_name.append(FILE_PATH_LITERAL("x86_32"));
#endif
if (is64)
irt_name.append(FILE_PATH_LITERAL("x86_64"));
else
irt_name.append(FILE_PATH_LITERAL("x86_32"));

#elif defined(ARCH_CPU_ARM_FAMILY)
irt_name.append(FILE_PATH_LITERAL("arm"));
#elif defined(ARCH_CPU_MIPSEL)
Expand Down Expand Up @@ -206,19 +195,6 @@ void NaClBrowser::InitIrtFilePath() {
}
}

#if BUILDFLAG(IS_WIN)
bool NaClBrowser::GetNaCl64ExePath(base::FilePath* exe_path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::FilePath module_path;
if (!base::PathService::Get(base::FILE_MODULE, &module_path)) {
LOG(ERROR) << "NaCl process launch failed: could not resolve module";
return false;
}
*exe_path = module_path.DirName().Append(L"nacl64");
return true;
}
#endif

// static
NaClBrowser* NaClBrowser::GetInstanceInternal() {
static NaClBrowser* g_instance = nullptr;
Expand Down
5 changes: 0 additions & 5 deletions components/nacl/browser/nacl_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ class NaClBrowser {
bool QueryKnownToValidate(const std::string& signature, bool off_the_record);
void SetKnownToValidate(const std::string& signature, bool off_the_record);
void ClearValidationCache(base::OnceClosure callback);
#if BUILDFLAG(IS_WIN)
// Get path to NaCl loader on the filesystem if possible.
// |exe_path| does not change if the method fails.
bool GetNaCl64ExePath(base::FilePath* exe_path);
#endif

void EarlyStartup();

Expand Down
6 changes: 0 additions & 6 deletions components/nacl/browser/nacl_file_host_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,8 @@ TEST_F(NaClFileHostTest, TestFilenamesWithPnaclPath) {
EXPECT_FALSE(PnaclCanOpenFile(std::string(), &out_path));
EXPECT_FALSE(PnaclCanOpenFile(".", &out_path));
EXPECT_FALSE(PnaclCanOpenFile("..", &out_path));
#if BUILDFLAG(IS_WIN)
EXPECT_FALSE(PnaclCanOpenFile("..\\llc", &out_path));
EXPECT_FALSE(PnaclCanOpenFile("%SystemRoot%", &out_path));
EXPECT_FALSE(PnaclCanOpenFile("%SystemRoot%\\explorer.exe", &out_path));
#else
EXPECT_FALSE(PnaclCanOpenFile("../llc", &out_path));
EXPECT_FALSE(PnaclCanOpenFile("/bin/sh", &out_path));
EXPECT_FALSE(PnaclCanOpenFile("$HOME", &out_path));
EXPECT_FALSE(PnaclCanOpenFile("$HOME/.bashrc", &out_path));
#endif
}
4 changes: 0 additions & 4 deletions components/nacl/browser/nacl_host_message_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ void NaClHostMessageFilter::LaunchNaClContinuation(
nacl::NaClLaunchParams safe_launch_params(launch_params);
safe_launch_params.resource_prefetch_request_list.clear();

// TODO(yusukes): Fix NaClProcessHost::~NaClProcessHost() and remove the
// ifdef.
#if !BUILDFLAG(IS_WIN)
const std::vector<NaClResourcePrefetchRequest>& original_request_list =
launch_params.resource_prefetch_request_list;
content::SiteInstance* site_instance = rfh->GetSiteInstance();
Expand All @@ -195,7 +192,6 @@ void NaClHostMessageFilter::LaunchNaClContinuation(
safe_launch_params.resource_prefetch_request_list.push_back(
original_request);
}
#endif

// Process a list of resource file URLs in
// |launch_params.resource_files_to_prefetch|.
Expand Down

0 comments on commit 23cde5e

Please sign in to comment.