debugger.cc revision 3f50c38dc070f4bb515c1b64450dae14f316474e
1// Copyright (c) 2010 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.
4
5#include "base/debug/debugger.h"
6
7#include "base/threading/platform_thread.h"
8
9namespace base {
10namespace debug {
11
12static bool is_debug_ui_suppressed = false;
13
14bool WaitForDebugger(int wait_seconds, bool silent) {
15  for (int i = 0; i < wait_seconds * 10; ++i) {
16    if (BeingDebugged()) {
17      if (!silent)
18        BreakDebugger();
19      return true;
20    }
21    PlatformThread::Sleep(100);
22  }
23  return false;
24}
25
26void SetSuppressDebugUI(bool suppress) {
27  is_debug_ui_suppressed = suppress;
28}
29
30bool IsDebugUISuppressed() {
31  return is_debug_ui_suppressed;
32}
33
34}  // namespace debug
35}  // namespace base
36