[content shell] hook up testRunner.dumpEditingCallbacks
[chromium-blink-merge.git] / content / common / debug_flags.cc
blob9057fbccb1e27700b64b1c06f06e65267d85ceaa
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/debug_flags.h"
7 #include "base/base_switches.h"
8 #include "base/command_line.h"
9 #include "base/utf_string_conversions.h"
10 #include "content/public/common/content_switches.h"
11 #include "ipc/ipc_switches.h"
13 namespace content {
15 bool ProcessDebugFlags(CommandLine* command_line,
16 ProcessType type,
17 bool is_in_sandbox) {
18 bool should_help_child = false;
19 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
20 if (current_cmd_line.HasSwitch(switches::kDebugChildren)) {
21 // Look to pass-on the kDebugOnStart flag.
22 std::string value = current_cmd_line.GetSwitchValueASCII(
23 switches::kDebugChildren);
24 if (value.empty() ||
25 (type == PROCESS_TYPE_WORKER &&
26 value == switches::kWorkerProcess) ||
27 (type == PROCESS_TYPE_RENDERER &&
28 value == switches::kRendererProcess) ||
29 (type == PROCESS_TYPE_PLUGIN &&
30 value == switches::kPluginProcess)) {
31 command_line->AppendSwitch(switches::kDebugOnStart);
32 should_help_child = true;
34 command_line->AppendSwitchASCII(switches::kDebugChildren, value);
35 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) {
36 // Look to pass-on the kWaitForDebugger flag.
37 std::string value = current_cmd_line.GetSwitchValueASCII(
38 switches::kWaitForDebuggerChildren);
39 if (value.empty() ||
40 (type == PROCESS_TYPE_WORKER &&
41 value == switches::kWorkerProcess) ||
42 (type == PROCESS_TYPE_RENDERER &&
43 value == switches::kRendererProcess) ||
44 (type == PROCESS_TYPE_PLUGIN &&
45 value == switches::kPluginProcess)) {
46 command_line->AppendSwitch(switches::kWaitForDebugger);
48 command_line->AppendSwitchASCII(switches::kWaitForDebuggerChildren, value);
50 return should_help_child;
53 } // namespace content