OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 DEFINE_TRACE(MainThreadDebugger) | 91 DEFINE_TRACE(MainThreadDebugger) |
92 { | 92 { |
93 #if ENABLE(OILPAN) | 93 #if ENABLE(OILPAN) |
94 visitor->trace(m_pausedFrame); | 94 visitor->trace(m_pausedFrame); |
95 visitor->trace(m_listenersMap); | 95 visitor->trace(m_listenersMap); |
96 #endif | 96 #endif |
97 ScriptDebuggerBase::trace(visitor); | 97 ScriptDebuggerBase::trace(visitor); |
98 } | 98 } |
99 | 99 |
100 void MainThreadDebugger::setContextDebugData(v8::Local<v8::Context> context, con
st String& type, int contextDebugId) | 100 void MainThreadDebugger::initializeContext(v8::Local<v8::Context> context, int w
orldId) |
101 { | 101 { |
102 String debugData = "[" + type + "," + String::number(contextDebugId) + "]"; | 102 LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context); |
| 103 if (!frame) |
| 104 return; |
| 105 LocalFrame* localFrameRoot = frame->localFrameRoot(); |
| 106 String type = worldId == MainWorldId ? "page" : "injected"; |
| 107 String debugData = "[" + type + "," + String::number(WeakIdentifierMap<Local
Frame>::identifier(localFrameRoot)) + "]"; |
103 V8Debugger::setContextDebugData(context, debugData); | 108 V8Debugger::setContextDebugData(context, debugData); |
104 } | 109 } |
105 | 110 |
106 void MainThreadDebugger::addListener(ScriptDebugListener* listener, LocalFrame*
localFrameRoot, int contextDebugId) | 111 void MainThreadDebugger::addListener(ScriptDebugListener* listener, LocalFrame*
localFrameRoot) |
107 { | 112 { |
108 ASSERT(localFrameRoot == localFrameRoot->localFrameRoot()); | 113 ASSERT(localFrameRoot == localFrameRoot->localFrameRoot()); |
109 | 114 |
110 ScriptController& scriptController = localFrameRoot->script(); | 115 ScriptController& scriptController = localFrameRoot->script(); |
111 if (!scriptController.canExecuteScripts(NotAboutToExecuteScript)) | 116 if (!scriptController.canExecuteScripts(NotAboutToExecuteScript)) |
112 return; | 117 return; |
113 | 118 |
114 if (m_listenersMap.isEmpty()) | 119 if (m_listenersMap.isEmpty()) |
115 debugger()->enable(); | 120 debugger()->enable(); |
116 m_listenersMap.set(localFrameRoot, listener); | 121 m_listenersMap.set(localFrameRoot, listener); |
117 String contextDataSubstring = "," + String::number(contextDebugId) + "]"; | 122 String contextDataSubstring = "," + String::number(WeakIdentifierMap<LocalFr
ame>::identifier(localFrameRoot)) + "]"; |
118 Vector<ScriptDebugListener::ParsedScript> compiledScripts; | 123 Vector<ScriptDebugListener::ParsedScript> compiledScripts; |
119 debugger()->getCompiledScripts(contextDataSubstring, compiledScripts); | 124 debugger()->getCompiledScripts(contextDataSubstring, compiledScripts); |
120 for (size_t i = 0; i < compiledScripts.size(); i++) | 125 for (size_t i = 0; i < compiledScripts.size(); i++) |
121 listener->didParseSource(compiledScripts[i]); | 126 listener->didParseSource(compiledScripts[i]); |
122 } | 127 } |
123 | 128 |
124 void MainThreadDebugger::removeListener(ScriptDebugListener* listener, LocalFram
e* localFrame) | 129 void MainThreadDebugger::removeListener(ScriptDebugListener* listener, LocalFram
e* localFrame) |
125 { | 130 { |
126 if (!m_listenersMap.contains(localFrame)) | 131 if (!m_listenersMap.contains(localFrame)) |
127 return; | 132 return; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 177 |
173 m_pausedFrame = 0; | 178 m_pausedFrame = 0; |
174 } | 179 } |
175 | 180 |
176 void MainThreadDebugger::quitMessageLoopOnPause() | 181 void MainThreadDebugger::quitMessageLoopOnPause() |
177 { | 182 { |
178 m_clientMessageLoop->quitNow(); | 183 m_clientMessageLoop->quitNow(); |
179 } | 184 } |
180 | 185 |
181 } // namespace blink | 186 } // namespace blink |
OLD | NEW |