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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/chrome/common/debug_flags.cc	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#include "chrome/common/debug_flags.h"
     1.9 +
    1.10 +#include "base/base_switches.h"
    1.11 +#include "base/command_line.h"
    1.12 +#include "chrome/common/chrome_switches.h"
    1.13 +
    1.14 +bool DebugFlags::ProcessDebugFlags(CommandLine* command_line,
    1.15 +                                   ChildProcessInfo::ProcessType type,
    1.16 +                                   bool is_in_sandbox) {
    1.17 +  bool should_help_child = false;
    1.18 +  const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
    1.19 +  if (current_cmd_line.HasSwitch(switches::kDebugChildren)) {
    1.20 +    // Look to pass-on the kDebugOnStart flag.
    1.21 +    std::wstring value;
    1.22 +    value = current_cmd_line.GetSwitchValue(switches::kDebugChildren);
    1.23 +    if (value.empty() ||
    1.24 +        (type == ChildProcessInfo::RENDER_PROCESS &&
    1.25 +         value == switches::kRendererProcess) ||
    1.26 +        (type == ChildProcessInfo::PLUGIN_PROCESS &&
    1.27 +         value == switches::kPluginProcess)) {
    1.28 +      command_line->AppendSwitch(switches::kDebugOnStart);
    1.29 +      should_help_child = true;
    1.30 +    }
    1.31 +    command_line->AppendSwitchWithValue(switches::kDebugChildren, value);
    1.32 +  } else if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) {
    1.33 +    // Look to pass-on the kWaitForDebugger flag.
    1.34 +    std::wstring value;
    1.35 +    value = current_cmd_line.GetSwitchValue(switches::kWaitForDebuggerChildren);
    1.36 +    if (value.empty() ||
    1.37 +        (type == ChildProcessInfo::RENDER_PROCESS &&
    1.38 +         value == switches::kRendererProcess) ||
    1.39 +        (type == ChildProcessInfo::PLUGIN_PROCESS &&
    1.40 +         value == switches::kPluginProcess)) {
    1.41 +      command_line->AppendSwitch(switches::kWaitForDebugger);
    1.42 +    }
    1.43 +    command_line->AppendSwitchWithValue(switches::kWaitForDebuggerChildren,
    1.44 +                                        value);
    1.45 +  }
    1.46 +  return should_help_child;
    1.47 +}

mercurial