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