ipc/chromium/src/chrome/common/debug_flags.cc

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial