1 : // Copyright (c) 2006-2008 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.
4 :
5 : #include "chrome/common/debug_flags.h"
6 :
7 : #include "base/base_switches.h"
8 : #include "base/command_line.h"
9 : #include "chrome/common/chrome_switches.h"
10 :
11 0 : bool DebugFlags::ProcessDebugFlags(CommandLine* command_line,
12 : ChildProcessInfo::ProcessType type,
13 : bool is_in_sandbox) {
14 0 : bool should_help_child = false;
15 0 : const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
16 0 : if (current_cmd_line.HasSwitch(switches::kDebugChildren)) {
17 : // Look to pass-on the kDebugOnStart flag.
18 0 : std::wstring value;
19 0 : value = current_cmd_line.GetSwitchValue(switches::kDebugChildren);
20 0 : if (value.empty() ||
21 : (type == ChildProcessInfo::RENDER_PROCESS &&
22 0 : value == switches::kRendererProcess) ||
23 : (type == ChildProcessInfo::PLUGIN_PROCESS &&
24 0 : value == switches::kPluginProcess)) {
25 0 : command_line->AppendSwitch(switches::kDebugOnStart);
26 0 : should_help_child = true;
27 : }
28 0 : command_line->AppendSwitchWithValue(switches::kDebugChildren, value);
29 0 : } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) {
30 : // Look to pass-on the kWaitForDebugger flag.
31 0 : std::wstring value;
32 0 : value = current_cmd_line.GetSwitchValue(switches::kWaitForDebuggerChildren);
33 0 : if (value.empty() ||
34 : (type == ChildProcessInfo::RENDER_PROCESS &&
35 0 : value == switches::kRendererProcess) ||
36 : (type == ChildProcessInfo::PLUGIN_PROCESS &&
37 0 : value == switches::kPluginProcess)) {
38 0 : command_line->AppendSwitch(switches::kWaitForDebugger);
39 : }
40 : command_line->AppendSwitchWithValue(switches::kWaitForDebuggerChildren,
41 0 : value);
42 : }
43 0 : return should_help_child;
44 : }
|