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

Side by Side Diff: chrome/common/debug_flags.cc

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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 unified diff | Download patch
« no previous file with comments | « chrome/common/debug_flags.h ('k') | chrome/common/ipc_channel_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/debug_flags.h" 5 #include "chrome/common/debug_flags.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 10
11 bool DebugFlags::ProcessDebugFlags(std::wstring* command_line, 11 bool DebugFlags::ProcessDebugFlags(CommandLine* command_line,
12 ChildProcessType type, 12 ChildProcessType type,
13 bool is_in_sandbox) { 13 bool is_in_sandbox) {
14 bool should_help_child = false; 14 bool should_help_child = false;
15 CommandLine current_cmd_line; 15 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
16 if (current_cmd_line.HasSwitch(switches::kDebugChildren)) { 16 if (current_cmd_line.HasSwitch(switches::kDebugChildren)) {
17 // Look to pass-on the kDebugOnStart flag. 17 // Look to pass-on the kDebugOnStart flag.
18 std::wstring value; 18 std::wstring value;
19 value = current_cmd_line.GetSwitchValue(switches::kDebugChildren); 19 value = current_cmd_line.GetSwitchValue(switches::kDebugChildren);
20 if (value.empty() || 20 if (value.empty() ||
21 (type == RENDERER && value == switches::kRendererProcess) || 21 (type == RENDERER && value == switches::kRendererProcess) ||
22 (type == PLUGIN && value == switches::kPluginProcess)) { 22 (type == PLUGIN && value == switches::kPluginProcess)) {
23 CommandLine::AppendSwitch(command_line, switches::kDebugOnStart); 23 command_line->AppendSwitch(switches::kDebugOnStart);
24 should_help_child = true; 24 should_help_child = true;
25 } 25 }
26 CommandLine::AppendSwitchWithValue(command_line, 26 command_line->AppendSwitchWithValue(switches::kDebugChildren, value);
27 switches::kDebugChildren,
28 value);
29 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) { 27 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) {
30 // Look to pass-on the kWaitForDebugger flag. 28 // Look to pass-on the kWaitForDebugger flag.
31 std::wstring value; 29 std::wstring value;
32 value = current_cmd_line.GetSwitchValue(switches::kWaitForDebuggerChildren); 30 value = current_cmd_line.GetSwitchValue(switches::kWaitForDebuggerChildren);
33 if (value.empty() || 31 if (value.empty() ||
34 (type == RENDERER && value == switches::kRendererProcess) || 32 (type == RENDERER && value == switches::kRendererProcess) ||
35 (type == PLUGIN && value == switches::kPluginProcess)) { 33 (type == PLUGIN && value == switches::kPluginProcess)) {
36 CommandLine::AppendSwitch(command_line, switches::kWaitForDebugger); 34 command_line->AppendSwitch(switches::kWaitForDebugger);
37 } 35 }
38 CommandLine::AppendSwitchWithValue(command_line, 36 command_line->AppendSwitchWithValue(switches::kWaitForDebuggerChildren,
39 switches::kWaitForDebuggerChildren, 37 value);
40 value);
41 } 38 }
42 return should_help_child; 39 return should_help_child;
43 } 40 }
OLDNEW
« no previous file with comments | « chrome/common/debug_flags.h ('k') | chrome/common/ipc_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698