OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "content/common/debug_flags.h" | 5 #include "content/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 "base/utf_string_conversions.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "ipc/ipc_switches.h" | 11 #include "ipc/ipc_switches.h" |
12 | 12 |
13 bool DebugFlags::ProcessDebugFlags(CommandLine* command_line, | 13 namespace content { |
14 content::ProcessType type, | 14 |
15 bool is_in_sandbox) { | 15 bool ProcessDebugFlags(CommandLine* command_line, |
| 16 ProcessType type, |
| 17 bool is_in_sandbox) { |
16 bool should_help_child = false; | 18 bool should_help_child = false; |
17 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); | 19 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); |
18 if (current_cmd_line.HasSwitch(switches::kDebugChildren)) { | 20 if (current_cmd_line.HasSwitch(switches::kDebugChildren)) { |
19 // Look to pass-on the kDebugOnStart flag. | 21 // Look to pass-on the kDebugOnStart flag. |
20 std::string value = current_cmd_line.GetSwitchValueASCII( | 22 std::string value = current_cmd_line.GetSwitchValueASCII( |
21 switches::kDebugChildren); | 23 switches::kDebugChildren); |
22 if (value.empty() || | 24 if (value.empty() || |
23 (type == content::PROCESS_TYPE_WORKER && | 25 (type == PROCESS_TYPE_WORKER && |
24 value == switches::kWorkerProcess) || | 26 value == switches::kWorkerProcess) || |
25 (type == content::PROCESS_TYPE_RENDERER && | 27 (type == PROCESS_TYPE_RENDERER && |
26 value == switches::kRendererProcess) || | 28 value == switches::kRendererProcess) || |
27 (type == content::PROCESS_TYPE_PLUGIN && | 29 (type == PROCESS_TYPE_PLUGIN && |
28 value == switches::kPluginProcess)) { | 30 value == switches::kPluginProcess)) { |
29 command_line->AppendSwitch(switches::kDebugOnStart); | 31 command_line->AppendSwitch(switches::kDebugOnStart); |
30 should_help_child = true; | 32 should_help_child = true; |
31 } | 33 } |
32 command_line->AppendSwitchASCII(switches::kDebugChildren, value); | 34 command_line->AppendSwitchASCII(switches::kDebugChildren, value); |
33 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) { | 35 } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) { |
34 // Look to pass-on the kWaitForDebugger flag. | 36 // Look to pass-on the kWaitForDebugger flag. |
35 std::string value = current_cmd_line.GetSwitchValueASCII( | 37 std::string value = current_cmd_line.GetSwitchValueASCII( |
36 switches::kWaitForDebuggerChildren); | 38 switches::kWaitForDebuggerChildren); |
37 if (value.empty() || | 39 if (value.empty() || |
38 (type == content::PROCESS_TYPE_WORKER && | 40 (type == PROCESS_TYPE_WORKER && |
39 value == switches::kWorkerProcess) || | 41 value == switches::kWorkerProcess) || |
40 (type == content::PROCESS_TYPE_RENDERER && | 42 (type == PROCESS_TYPE_RENDERER && |
41 value == switches::kRendererProcess) || | 43 value == switches::kRendererProcess) || |
42 (type == content::PROCESS_TYPE_PLUGIN && | 44 (type == PROCESS_TYPE_PLUGIN && |
43 value == switches::kPluginProcess)) { | 45 value == switches::kPluginProcess)) { |
44 command_line->AppendSwitch(switches::kWaitForDebugger); | 46 command_line->AppendSwitch(switches::kWaitForDebugger); |
45 } | 47 } |
46 command_line->AppendSwitchASCII(switches::kWaitForDebuggerChildren, value); | 48 command_line->AppendSwitchASCII(switches::kWaitForDebuggerChildren, value); |
47 } | 49 } |
48 return should_help_child; | 50 return should_help_child; |
49 } | 51 } |
| 52 |
| 53 } // namespace content |
OLD | NEW |