summaryrefslogtreecommitdiffstats
path: root/chrome/browser/debugger/debugger_wrapper.cc
blob: 9b29903c66b127a511925ac79b410c834d997671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "debugger_wrapper.h"
#include "debugger_shell.h"
#include "debugger_io_socket.h"

DebuggerWrapper::DebuggerWrapper(int port) {
#ifndef CHROME_DEBUGGER_DISABLED
  if (port > 0) {
    DebuggerInputOutputSocket *io = new DebuggerInputOutputSocket(port);
    debugger_ = new DebuggerShell(io);
    debugger_->Start();
  }
#endif
}

DebuggerWrapper::~DebuggerWrapper() {
}

void DebuggerWrapper::SetDebugger(DebuggerShell* debugger) {
  debugger_ = debugger;
}

DebuggerShell* DebuggerWrapper::GetDebugger() {
  return debugger_.get();
}

void DebuggerWrapper::DebugMessage(const std::wstring& msg) {
  if (debugger_.get())
    debugger_->DebugMessage(msg);
}

void DebuggerWrapper::OnDebugAttach() {
  if (debugger_.get())
    debugger_->OnDebugAttach();
}

void DebuggerWrapper::OnDebugDisconnect() {
  if (debugger_.get())
    debugger_->OnDebugDisconnect();
}