| OLD | NEW |
| 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(CommandLine* command_line, | 11 bool DebugFlags::ProcessDebugFlags(CommandLine* command_line, |
| 12 ChildProcessType type, | 12 ChildProcessInfo::ProcessType type, |
| 13 bool is_in_sandbox) { | 13 bool is_in_sandbox) { |
| 14 bool should_help_child = false; | 14 bool should_help_child = false; |
| 15 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); | 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 == ChildProcessInfo::RENDER_PROCESS && |
| 22 (type == PLUGIN && value == switches::kPluginProcess)) { | 22 value == switches::kRendererProcess) || |
| 23 (type == ChildProcessInfo::PLUGIN_PROCESS && |
| 24 value == switches::kPluginProcess)) { |
| 23 command_line->AppendSwitch(switches::kDebugOnStart); | 25 command_line->AppendSwitch(switches::kDebugOnStart); |
| 24 should_help_child = true; | 26 should_help_child = true; |
| 25 } | 27 } |
| 26 command_line->AppendSwitchWithValue(switches::kDebugChildren, value); | 28 command_line->AppendSwitchWithValue(switches::kDebugChildren, value); |
| 27 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) { | 29 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) { |
| 28 // Look to pass-on the kWaitForDebugger flag. | 30 // Look to pass-on the kWaitForDebugger flag. |
| 29 std::wstring value; | 31 std::wstring value; |
| 30 value = current_cmd_line.GetSwitchValue(switches::kWaitForDebuggerChildren); | 32 value = current_cmd_line.GetSwitchValue(switches::kWaitForDebuggerChildren); |
| 31 if (value.empty() || | 33 if (value.empty() || |
| 32 (type == RENDERER && value == switches::kRendererProcess) || | 34 (type == ChildProcessInfo::RENDER_PROCESS && |
| 33 (type == PLUGIN && value == switches::kPluginProcess)) { | 35 value == switches::kRendererProcess) || |
| 36 (type == ChildProcessInfo::PLUGIN_PROCESS && |
| 37 value == switches::kPluginProcess)) { |
| 34 command_line->AppendSwitch(switches::kWaitForDebugger); | 38 command_line->AppendSwitch(switches::kWaitForDebugger); |
| 35 } | 39 } |
| 36 command_line->AppendSwitchWithValue(switches::kWaitForDebuggerChildren, | 40 command_line->AppendSwitchWithValue(switches::kWaitForDebuggerChildren, |
| 37 value); | 41 value); |
| 38 } | 42 } |
| 39 return should_help_child; | 43 return should_help_child; |
| 40 } | 44 } |
| OLD | NEW |