summaryrefslogtreecommitdiffstats
path: root/content/common/debug_flags.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-11 21:56:11 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-11 21:56:11 +0000
commit415c2cdea5dfa8bc87bd36a91bdb8473026f943f (patch)
tree22aefe975f1be77a1bb18cdd96aeb86fbd96e096 /content/common/debug_flags.cc
parent5471bc3e9d08d1d955c96a8193ee2d9638c1591a (diff)
downloadchromium_src-415c2cdea5dfa8bc87bd36a91bdb8473026f943f.zip
chromium_src-415c2cdea5dfa8bc87bd36a91bdb8473026f943f.tar.gz
chromium_src-415c2cdea5dfa8bc87bd36a91bdb8473026f943f.tar.bz2
Move some chrome\common code to content in preparation for moving chrome\gpu.
TBR=avi Review URL: http://codereview.chromium.org/6686002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/debug_flags.cc')
-rw-r--r--content/common/debug_flags.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/content/common/debug_flags.cc b/content/common/debug_flags.cc
new file mode 100644
index 0000000..9fcf2f0
--- /dev/null
+++ b/content/common/debug_flags.cc
@@ -0,0 +1,49 @@
+// 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 "content/common/debug_flags.h"
+
+#include "base/base_switches.h"
+#include "base/command_line.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/common/chrome_switches.h"
+#include "ipc/ipc_switches.h"
+
+bool DebugFlags::ProcessDebugFlags(CommandLine* command_line,
+ ChildProcessInfo::ProcessType type,
+ bool is_in_sandbox) {
+ bool should_help_child = false;
+ const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
+ if (current_cmd_line.HasSwitch(switches::kDebugChildren)) {
+ // Look to pass-on the kDebugOnStart flag.
+ std::string value = current_cmd_line.GetSwitchValueASCII(
+ switches::kDebugChildren);
+ if (value.empty() ||
+ (type == ChildProcessInfo::WORKER_PROCESS &&
+ value == switches::kWorkerProcess) ||
+ (type == ChildProcessInfo::RENDER_PROCESS &&
+ value == switches::kRendererProcess) ||
+ (type == ChildProcessInfo::PLUGIN_PROCESS &&
+ value == switches::kPluginProcess)) {
+ command_line->AppendSwitch(switches::kDebugOnStart);
+ should_help_child = true;
+ }
+ command_line->AppendSwitchASCII(switches::kDebugChildren, value);
+ } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) {
+ // Look to pass-on the kWaitForDebugger flag.
+ std::string value = current_cmd_line.GetSwitchValueASCII(
+ switches::kWaitForDebuggerChildren);
+ if (value.empty() ||
+ (type == ChildProcessInfo::WORKER_PROCESS &&
+ value == switches::kWorkerProcess) ||
+ (type == ChildProcessInfo::RENDER_PROCESS &&
+ value == switches::kRendererProcess) ||
+ (type == ChildProcessInfo::PLUGIN_PROCESS &&
+ value == switches::kPluginProcess)) {
+ command_line->AppendSwitch(switches::kWaitForDebugger);
+ }
+ command_line->AppendSwitchASCII(switches::kWaitForDebuggerChildren, value);
+ }
+ return should_help_child;
+}