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

Unified Diff: chrome/common/sandbox_init_wrapper_win.cc

Issue 6483006: Use a struct instead of a union for SandboxInterfaceInfo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/client_util.h ('k') | sandbox/src/sandbox_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/sandbox_init_wrapper_win.cc
===================================================================
--- chrome/common/sandbox_init_wrapper_win.cc (revision 74231)
+++ chrome/common/sandbox_init_wrapper_win.cc (working copy)
@@ -1,10 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 "chrome/common/sandbox_init_wrapper.h"
#include "base/command_line.h"
+#include "base/logging.h"
+
#include "chrome/common/chrome_switches.h"
void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) {
@@ -12,6 +14,9 @@
broker_services_ = info->broker_services;
target_services_ = info->target_services;
}
+ // Both interface pointers cannot be non-zero. A process can either
+ // be a target or a broker but not both.
+ DCHECK(!(target_services_ && broker_services_));
}
bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
@@ -22,12 +27,16 @@
(process_type == switches::kExtensionProcess) ||
(process_type == switches::kWorkerProcess) ||
(process_type == switches::kNaClLoaderProcess) ||
- (process_type == switches::kUtilityProcess) ||
- (process_type == switches::kPluginProcess &&
- command_line.HasSwitch(switches::kSafePlugins))) {
+ (process_type == switches::kUtilityProcess)) {
+ // The above five process types must be sandboxed unless --no-sandbox
+ // is present in the command line.
if (!target_services_)
return false;
- target_services_->Init();
+ } else {
+ // Other process types might or might not be sandboxed.
+ // TODO(cpu): clean this mess.
+ if (!target_services_)
+ return true;
}
- return true;
+ return (sandbox::SBOX_ALL_OK == target_services_->Init());
}
« no previous file with comments | « chrome/app/client_util.h ('k') | sandbox/src/sandbox_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698