summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorgregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 00:29:54 +0000
committergregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 00:29:54 +0000
commit0b6e0a2ba1c90550d2dc4e33e2d0d282e09ebfdb (patch)
tree7e0c2f17e82dd477294d26a51051bee13c4dc5bb /chrome/common
parent732a0f086db4bfdfd29749c3a500af0405934b6f (diff)
downloadchromium_src-0b6e0a2ba1c90550d2dc4e33e2d0d282e09ebfdb.zip
chromium_src-0b6e0a2ba1c90550d2dc4e33e2d0d282e09ebfdb.tar.gz
chromium_src-0b6e0a2ba1c90550d2dc4e33e2d0d282e09ebfdb.tar.bz2
Revert 37578 - Implement the broker process that launches NaCl loader processes on 64bit Windows systems.
BUG=28176 TEST=none Review URL: http://codereview.chromium.org/542030 TBR=gregoryd@google.com git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/child_process_host.cc8
-rw-r--r--chrome/common/child_process_host.h2
-rw-r--r--chrome/common/child_process_info.cc4
-rw-r--r--chrome/common/child_process_info.h3
-rw-r--r--chrome/common/chrome_constants.cc1
-rw-r--r--chrome/common/chrome_constants.h1
-rw-r--r--chrome/common/chrome_switches.cc8
-rw-r--r--chrome/common/chrome_switches.h3
-rw-r--r--chrome/common/nacl_cmd_line.cc44
-rw-r--r--chrome/common/nacl_cmd_line.h16
-rw-r--r--chrome/common/nacl_messages_internal.h11
-rw-r--r--chrome/common/nacl_types.h20
-rw-r--r--chrome/common/sandbox_init_wrapper_mac.cc2
-rw-r--r--chrome/common/sandbox_init_wrapper_win.cc2
-rw-r--r--chrome/common/sandbox_policy.cc20
15 files changed, 19 insertions, 126 deletions
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index 51c6de4..9fb6b52 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -177,13 +177,9 @@ void ChildProcessHost::Notify(NotificationType type) {
ChromeThread::UI, FROM_HERE, new ChildNotificationTask(type, this));
}
-bool ChildProcessHost::DidChildCrash() {
- return child_process_->DidProcessCrash();
-}
-
void ChildProcessHost::OnChildDied() {
- if (handle() != base::kNullProcessHandle) {
- bool did_crash = DidChildCrash();
+ if (child_process_->GetHandle()) {
+ bool did_crash = child_process_->DidProcessCrash();
if (did_crash) {
OnProcessCrashed();
// Report that this child process crashed.
diff --git a/chrome/common/child_process_host.h b/chrome/common/child_process_host.h
index 22d5cc3..ec6e86d 100644
--- a/chrome/common/child_process_host.h
+++ b/chrome/common/child_process_host.h
@@ -116,8 +116,6 @@ class ChildProcessHost : public ResourceDispatcherHost::Receiver,
bool opening_channel() { return opening_channel_; }
const std::string& channel_id() { return channel_id_; }
- virtual bool DidChildCrash();
-
private:
// Sends the given notification to the notification service on the UI thread.
void Notify(NotificationType type);
diff --git a/chrome/common/child_process_info.cc b/chrome/common/child_process_info.cc
index 473512f..c915e80 100644
--- a/chrome/common/child_process_info.cc
+++ b/chrome/common/child_process_info.cc
@@ -54,7 +54,7 @@ std::wstring ChildProcessInfo::GetTypeNameInEnglish(
return L"Zygote";
case SANDBOX_HELPER_PROCESS:
return L"Sandbox helper";
- case NACL_LOADER_PROCESS:
+ case NACL_PROCESS:
return L"Native Client module";
case UNKNOWN_PROCESS:
default:
@@ -77,7 +77,7 @@ std::wstring ChildProcessInfo::GetLocalizedTitle() const {
message_id = IDS_TASK_MANAGER_UTILITY_PREFIX;
} else if (type_ == ChildProcessInfo::PROFILE_IMPORT_PROCESS) {
message_id = IDS_TASK_MANAGER_PROFILE_IMPORT_PREFIX;
- } else if (type_ == ChildProcessInfo::NACL_LOADER_PROCESS) {
+ } else if (type_ == ChildProcessInfo::NACL_PROCESS) {
message_id = IDS_TASK_MANAGER_NACL_PREFIX;
} else {
DCHECK(false) << "Need localized name for child process type.";
diff --git a/chrome/common/child_process_info.h b/chrome/common/child_process_info.h
index 1607417..5726675 100644
--- a/chrome/common/child_process_info.h
+++ b/chrome/common/child_process_info.h
@@ -20,12 +20,11 @@ class ChildProcessInfo {
RENDER_PROCESS,
PLUGIN_PROCESS,
WORKER_PROCESS,
- NACL_LOADER_PROCESS,
+ NACL_PROCESS,
UTILITY_PROCESS,
PROFILE_IMPORT_PROCESS,
ZYGOTE_PROCESS,
SANDBOX_HELPER_PROCESS,
- NACL_BROKER_PROCESS,
GPU_PROCESS
};
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 8226cd8..c75ab65 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -52,7 +52,6 @@ const FilePath::CharType kHelperProcessExecutablePath[] =
const FilePath::CharType kFrameworkName[] =
FPL(PRODUCT_STRING " Framework.framework");
#endif // OS_MACOSX
-const wchar_t kNaClAppName[] = L"nacl";
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kBrowserAppName[] = L"Chrome";
const char kStatsFilename[] = "ChromeStats2";
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index fc271e0..c8121d0 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -31,7 +31,6 @@ extern const wchar_t kNotSignedInProfile[];
extern const wchar_t kNotSignedInID[];
extern const char kStatsFilename[];
extern const wchar_t kBrowserResourcesDll[];
-extern const wchar_t kNaClAppName[];
extern const FilePath::CharType kExtensionFileExtension[];
// filenames
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index c9bc494..574752a 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -384,12 +384,8 @@ const char kMessageLoopHistogrammer[] = "message-loop-histogrammer";
// and performance tests.
const char kMetricsRecordingOnly[] = "metrics-recording-only";
-// Causes the process to run as a NativeClient broker
-// (used for launching NaCl loader processes on 64-bit Windows).
-const char kNaClBrokerProcess[] = "nacl-broker";
-
-// Causes the process to run as a NativeClient loader.
-const char kNaClLoaderProcess[] = "nacl-loader";
+// Causes the process to run as a NativeClient's sel_ldr subprocess.
+const char kNaClProcess[] = "nacl";
// Causes the Native Client process to display a dialog on launch.
const char kNaClStartupDialog[] = "nacl-startup-dialog";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 856df24..4f8d4d6 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -121,8 +121,7 @@ extern const char kMediaCacheSize[];
extern const char kMemoryProfiling[];
extern const char kMessageLoopHistogrammer[];
extern const char kMetricsRecordingOnly[];
-extern const char kNaClBrokerProcess[];
-extern const char kNaClLoaderProcess[];
+extern const char kNaClProcess[];
extern const char kNaClStartupDialog[];
extern const char kNewTabPage[];
extern const char kNoDefaultBrowserCheck[];
diff --git a/chrome/common/nacl_cmd_line.cc b/chrome/common/nacl_cmd_line.cc
deleted file mode 100644
index 2212c68..0000000
--- a/chrome/common/nacl_cmd_line.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/command_line.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/logging_chrome.h"
-
-namespace nacl {
- void CopyNaClCommandLineArguments(CommandLine* cmd_line) {
- const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
- if (logging::DialogsAreSuppressed())
- cmd_line->AppendSwitch(switches::kNoErrorDialogs);
-
- // Propagate the following switches to the NaCl loader command line (along
- // with any associated values) if present in the browser command line.
- // TODO(gregoryd): check which flags of those below can be supported.
- static const char* const switch_names[] = {
- switches::kNoSandbox,
- switches::kTestSandbox,
- switches::kDisableBreakpad,
- switches::kFullMemoryCrashReport,
- switches::kEnableLogging,
- switches::kDisableLogging,
- switches::kLoggingLevel,
- switches::kEnableDCHECK,
- switches::kSilentDumpOnDCHECK,
- switches::kMemoryProfiling,
-#if defined(OS_MACOSX)
- // TODO(dspringer): remove this when NaCl x86-32 security issues are fixed
- switches::kEnableNaClOnMac,
-#endif
- };
-
- for (size_t i = 0; i < arraysize(switch_names); ++i) {
- if (browser_command_line.HasSwitch(switch_names[i])) {
- cmd_line->AppendSwitchWithValue(
- switch_names[i],
- browser_command_line.GetSwitchValueASCII(switch_names[i]));
- }
- }
- }
-}
diff --git a/chrome/common/nacl_cmd_line.h b/chrome/common/nacl_cmd_line.h
deleted file mode 100644
index 1091e11..0000000
--- a/chrome/common/nacl_cmd_line.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_NACL_CMD_LINE_H_
-#define CHROME_COMMON_NACL_CMD_LINE_H_
-
-#include "base/command_line.h"
-
-namespace nacl {
- // Copy all the relevant arguments from the command line of the current
- // process to cmd_line that will be used for launching the NaCl loader/broker.
- void CopyNaClCommandLineArguments(CommandLine* cmd_line);
-}
-
-#endif // CHROME_COMMON_NACL_CMD_LINE_H_
diff --git a/chrome/common/nacl_messages_internal.h b/chrome/common/nacl_messages_internal.h
index 11dfba7..3794255 100644
--- a/chrome/common/nacl_messages_internal.h
+++ b/chrome/common/nacl_messages_internal.h
@@ -14,16 +14,5 @@ IPC_BEGIN_MESSAGES(NaClProcess)
int /* descriptor id */,
nacl::FileDescriptor /* handle value */)
- // Tells the NaCl broker to launch a NaCl loader process.
- IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker,
- std::wstring /* channel ID for the loader */)
-
- // Notify the browser process that the loader was launched successfully.
- IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched,
- std::wstring, /* channel ID for the loader */
- base::ProcessHandle /* loader process handle */)
-
- // Notify the browser process that the broker is ready (sent by the broker)
- IPC_MESSAGE_CONTROL0(NaClProcessMsg_BrokerReady)
IPC_END_MESSAGES(NaClProcess)
diff --git a/chrome/common/nacl_types.h b/chrome/common/nacl_types.h
index 5c5f5dc..394edd3 100644
--- a/chrome/common/nacl_types.h
+++ b/chrome/common/nacl_types.h
@@ -6,23 +6,15 @@
#ifndef CHROME_COMMON_NACL_TYPES_H_
#define CHROME_COMMON_NACL_TYPES_H_
-#if defined(OS_POSIX)
-#include "base/file_descriptor_posix.h"
-#endif
-
-// TODO(gregoryd): add a Windows definition for base::FileDescriptor
+// TODO(gregoryd): add a Windows definition for base::FileDescriptor,
+// replace the macros with inline functions.
namespace nacl {
#if defined(OS_WIN)
- // We assume that HANDLE always uses less than 32 bits
- typedef int FileDescriptor;
- inline HANDLE ToNativeHandle(const FileDescriptor& desc) {
- return reinterpret_cast<HANDLE>(desc);
- }
+typedef HANDLE FileDescriptor;
+#define NATIVE_HANDLE(desc) (desc)
#elif defined(OS_POSIX)
- typedef base::FileDescriptor FileDescriptor;
- inline int ToNativeHandle(const FileDescriptor& desc) {
- return desc.fd;
- }
+typedef base::FileDescriptor FileDescriptor;
+#define NATIVE_HANDLE(desc) ((desc).fd)
#endif
}
diff --git a/chrome/common/sandbox_init_wrapper_mac.cc b/chrome/common/sandbox_init_wrapper_mac.cc
index a47240d..3341b08 100644
--- a/chrome/common/sandbox_init_wrapper_mac.cc
+++ b/chrome/common/sandbox_init_wrapper_mac.cc
@@ -39,7 +39,7 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
} else if (process_type == switches::kWorkerProcess) {
// Worker process sandbox.
sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER;
- } else if ((process_type == switches::kNaClLoaderProcess) ||
+ } else if ((process_type == switches::kNaClProcess) ||
(process_type == switches::kPluginProcess) ||
(process_type == switches::kProfileImportProcess)) {
return true;
diff --git a/chrome/common/sandbox_init_wrapper_win.cc b/chrome/common/sandbox_init_wrapper_win.cc
index 5d4399a..0bfba24 100644
--- a/chrome/common/sandbox_init_wrapper_win.cc
+++ b/chrome/common/sandbox_init_wrapper_win.cc
@@ -21,7 +21,7 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
if ((process_type == switches::kRendererProcess) ||
(process_type == switches::kExtensionProcess) ||
(process_type == switches::kWorkerProcess) ||
- (process_type == switches::kNaClLoaderProcess) ||
+ (process_type == switches::kNaClProcess) ||
(process_type == switches::kUtilityProcess) ||
(process_type == switches::kPluginProcess &&
command_line.HasSwitch(switches::kSafePlugins))) {
diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc
index a79a962..9e70b08 100644
--- a/chrome/common/sandbox_policy.cc
+++ b/chrome/common/sandbox_policy.cc
@@ -23,13 +23,6 @@
#include "sandbox/src/sandbox.h"
#include "webkit/glue/plugins/plugin_list.h"
-#ifdef NACL_WIN64
- // The sandbox can be used also by the NaCl broker process. In this case we
- // define a global variable g_broker_services instead of g_browser_process.
- // This can be changed if we discover that the broker process needs to be more
- // similar to the browser process.
- extern sandbox::BrokerServices* g_broker_services;
-#endif
namespace {
// The DLLs listed here are known (or under strong suspicion) of causing crashes
@@ -349,12 +342,10 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line,
type = ChildProcessInfo::PLUGIN_PROCESS;
} else if (type_str == switches::kWorkerProcess) {
type = ChildProcessInfo::WORKER_PROCESS;
- } else if (type_str == switches::kNaClLoaderProcess) {
- type = ChildProcessInfo::NACL_LOADER_PROCESS;
+ } else if (type_str == switches::kNaClProcess) {
+ type = ChildProcessInfo::NACL_PROCESS;
} else if (type_str == switches::kUtilityProcess) {
type = ChildProcessInfo::UTILITY_PROCESS;
- } else if (type_str == switches::kNaClBrokerProcess) {
- type = ChildProcessInfo::NACL_BROKER_PROCESS;
} else if (type_str == switches::kGpuProcess) {
type = ChildProcessInfo::GPU_PROCESS;
} else {
@@ -388,15 +379,10 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line,
return process;
}
-#ifdef NACL_WIN64
- // When running in the broker we get the BrokerServices pointer from a global
- // variable. It is initialized in NaClBrokerMain.
- sandbox::BrokerServices* broker_service = g_broker_services;
-#else
// spawn the child process in the sandbox
sandbox::BrokerServices* broker_service =
g_browser_process->broker_services();
-#endif
+
sandbox::ResultCode result;
PROCESS_INFORMATION target = {0};
sandbox::TargetPolicy* policy = broker_service->CreatePolicy();