1 | // -*- c-basic-offset: 2 -*-
|
---|
2 | /*
|
---|
3 | * Copyright (C) 2008 Apple Inc. All rights reserved.
|
---|
4 | * Copyright (C) 1999-2001 Harri Porten ([email protected])
|
---|
5 | * Copyright (C) 2001 Peter Kelly ([email protected])
|
---|
6 | *
|
---|
7 | * This library is free software; you can redistribute it and/or
|
---|
8 | * modify it under the terms of the GNU Lesser General Public
|
---|
9 | * License as published by the Free Software Foundation; either
|
---|
10 | * version 2 of the License, or (at your option) any later version.
|
---|
11 | *
|
---|
12 | * This library is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
15 | * Lesser General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU Lesser General Public
|
---|
18 | * License along with this library; if not, write to the Free Software
|
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
20 | *
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include "config.h"
|
---|
24 | #include "debugger.h"
|
---|
25 |
|
---|
26 | #include "JSGlobalObject.h"
|
---|
27 |
|
---|
28 | namespace KJS {
|
---|
29 |
|
---|
30 | Debugger::Debugger()
|
---|
31 | {
|
---|
32 | }
|
---|
33 |
|
---|
34 | Debugger::~Debugger()
|
---|
35 | {
|
---|
36 | HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end();
|
---|
37 | for (HashSet<JSGlobalObject*>::iterator it = m_globalObjects.begin(); it != end; ++it)
|
---|
38 | (*it)->setDebugger(0);
|
---|
39 | }
|
---|
40 |
|
---|
41 | void Debugger::attach(JSGlobalObject* globalObject)
|
---|
42 | {
|
---|
43 | ASSERT(!globalObject->debugger());
|
---|
44 | globalObject->setDebugger(this);
|
---|
45 | m_globalObjects.add(globalObject);
|
---|
46 | }
|
---|
47 |
|
---|
48 | void Debugger::detach(JSGlobalObject* globalObject)
|
---|
49 | {
|
---|
50 | ASSERT(m_globalObjects.contains(globalObject));
|
---|
51 | m_globalObjects.remove(globalObject);
|
---|
52 | globalObject->setDebugger(0);
|
---|
53 | }
|
---|
54 |
|
---|
55 | } // namespace KJS
|
---|