Changeset 69283 in webkit
- Timestamp:
- Oct 7, 2010 2:43:02 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69282 r69283 1 2010-10-05 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: extract Inspector Instrumentation API as a class 6 https://bugs.webkit.org/show_bug.cgi?id=47173 7 8 * bindings/js/JSXMLHttpRequestCustom.cpp: 9 (WebCore::JSXMLHttpRequest::send): 10 * bindings/js/ScriptController.cpp: 11 (WebCore::ScriptController::evaluateInWorld): 12 * bindings/v8/V8DOMWindowShell.cpp: 13 * bindings/v8/V8Proxy.cpp: 14 (WebCore::V8Proxy::evaluate): 15 (WebCore::V8Proxy::callFunction): 16 * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: 17 (WebCore::V8XMLHttpRequest::sendCallback): 18 * dom/Document.cpp: 19 (WebCore::Document::recalcStyle): 20 * dom/Document.h: 21 * dom/Node.cpp: 22 (WebCore::Node::dispatchGenericEvent): 23 * html/parser/HTMLDocumentParser.cpp: 24 (WebCore::HTMLDocumentParser::pumpTokenizer): 25 * html/parser/HTMLDocumentParser.h: 26 * inspector/InspectorInstrumentation.cpp: 27 (WebCore::InspectorInstrumentation::hasFrontend): 28 (WebCore::InspectorInstrumentation::retrieveTimelineAgent): 29 * inspector/InspectorInstrumentation.h: 30 (WebCore::InspectorInstrumentation::hasFrontends): 31 (WebCore::InspectorInstrumentation::inspectorControllerForContext): 32 (WebCore::InspectorInstrumentation::inspectorControllerForDocument): 33 (WebCore::InspectorInstrumentation::inspectorControllerForFrame): 34 (WebCore::InspectorInstrumentation::inspectorControllerForPage): 35 * inspector/InspectorTimelineAgent.cpp: 36 (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): 37 (WebCore::InspectorTimelineAgent::~InspectorTimelineAgent): 38 * inspector/InspectorTimelineAgent.h: 39 * loader/ResourceLoader.cpp: 40 (WebCore::ResourceLoader::didReceiveResponse): 41 (WebCore::ResourceLoader::didReceiveData): 42 * loader/loader.cpp: 43 (WebCore::Loader::load): 44 * page/DOMTimer.cpp: 45 (WebCore::DOMTimer::install): 46 (WebCore::DOMTimer::removeById): 47 (WebCore::DOMTimer::fired): 48 * page/DOMTimer.h: 49 * page/DOMWindow.cpp: 50 (WebCore::DOMWindow::dispatchEvent): 51 * page/DOMWindow.h: 52 * page/FrameView.cpp: 53 (WebCore::FrameView::layout): 54 (WebCore::FrameView::paintContents): 55 * page/FrameView.h: 56 * page/Page.cpp: 57 * page/Page.h: 58 * rendering/RenderLayerBacking.cpp: 59 (WebCore::RenderLayerBacking::paintContents): 60 * xml/XMLHttpRequest.cpp: 61 (WebCore::XMLHttpRequest::callReadyStateChangeListener): 62 1 63 2010-10-07 Zraly Mike <mike.zraly@nokia.com> 2 64 -
trunk/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
r68767 r69283 95 95 JSValue JSXMLHttpRequest::send(ExecState* exec) 96 96 { 97 InspectorInstrumentation:: instrumentWillSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());97 InspectorInstrumentation::willSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url()); 98 98 99 99 ExceptionCode ec = 0; -
trunk/WebCore/bindings/js/ScriptController.cpp
r65082 r69283 29 29 #include "GCController.h" 30 30 #include "HTMLPlugInElement.h" 31 #include "Inspector TimelineAgent.h"31 #include "InspectorInstrumentation.h" 32 32 #include "JSDocument.h" 33 33 #include "JSMainThreadExecState.h" … … 143 143 RefPtr<Frame> protect = m_frame; 144 144 145 #if ENABLE(INSPECTOR) 146 if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) 147 timelineAgent->willEvaluateScript(sourceURL, sourceCode.startLine()); 148 #endif 145 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine()); 149 146 150 147 exec->globalData().timeoutChecker.start(); … … 152 149 exec->globalData().timeoutChecker.stop(); 153 150 154 #if ENABLE(INSPECTOR) 155 if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) 156 timelineAgent->didEvaluateScript(); 157 #endif 151 InspectorInstrumentation::didEvaluateScript(m_frame, cookie); 158 152 159 153 // Evaluating the JavaScript could cause the frame to be deallocated -
trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp
r68666 r69283 38 38 #include "Frame.h" 39 39 #include "FrameLoaderClient.h" 40 #include "InspectorTimelineAgent.h"41 40 #include "Page.h" 42 41 #include "PageGroup.h" -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r68666 r69283 40 40 #include "IDBFactoryBackendInterface.h" 41 41 #include "IDBPendingTransactionMonitor.h" 42 #include "Inspector TimelineAgent.h"42 #include "InspectorInstrumentation.h" 43 43 #include "Page.h" 44 44 #include "PageGroup.h" … … 377 377 V8GCController::checkMemoryUsage(); 378 378 379 #if ENABLE(INSPECTOR) 380 if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) 381 timelineAgent->willEvaluateScript(source.url().isNull() ? String() : source.url().string(), source.startLine()); 382 #endif 379 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine()); 383 380 384 381 v8::Local<v8::Value> result; … … 415 412 #endif 416 413 417 #if ENABLE(INSPECTOR) 418 if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) 419 timelineAgent->didEvaluateScript(); 420 #endif 414 InspectorInstrumentation::didEvaluateScript(m_frame, cookie); 421 415 422 416 return result; … … 506 500 m_frame->keepAlive(); 507 501 508 #if ENABLE(INSPECTOR) 509 Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0; 510 if (inspectedPage) { 511 if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) { 512 v8::ScriptOrigin origin = function->GetScriptOrigin(); 513 String resourceName("undefined"); 514 int lineNumber = 1; 515 if (!origin.ResourceName().IsEmpty()) { 516 resourceName = toWebCoreString(origin.ResourceName()); 517 lineNumber = function->GetScriptLineNumber() + 1; 518 } 519 timelineAgent->willCallFunction(resourceName, lineNumber); 520 } else 521 inspectedPage = 0; 502 InspectorInstrumentationCookie cookie = 0; 503 if (InspectorInstrumentation::hasFrontends()) { 504 v8::ScriptOrigin origin = function->GetScriptOrigin(); 505 String resourceName("undefined"); 506 int lineNumber = 1; 507 if (!origin.ResourceName().IsEmpty()) { 508 resourceName = toWebCoreString(origin.ResourceName()); 509 lineNumber = function->GetScriptLineNumber() + 1; 510 } 511 cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber); 522 512 } 523 #endif // !ENABLE(INSPECTOR)524 513 525 514 m_recursion++; … … 527 516 m_recursion--; 528 517 529 #if ENABLE(INSPECTOR) 530 if (inspectedPage) 531 if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) 532 timelineAgent->didCallFunction(); 533 #endif // !ENABLE(INSPECTOR) 534 518 InspectorInstrumentation::didCallFunction(m_frame, cookie); 535 519 } 536 520 -
trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
r68767 r69283 115 115 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder()); 116 116 117 InspectorInstrumentation:: instrumentWillSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());117 InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url()); 118 118 119 119 ExceptionCode ec = 0; -
trunk/WebCore/dom/Document.cpp
r69192 r69283 89 89 #include "ImageLoader.h" 90 90 #include "InspectorController.h" 91 #include "Inspector TimelineAgent.h"91 #include "InspectorInstrumentation.h" 92 92 #include "KeyboardEvent.h" 93 93 #include "Logging.h" … … 1461 1461 return; // Guard against re-entrancy. -dwh 1462 1462 1463 #if ENABLE(INSPECTOR) 1464 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) 1465 timelineAgent->willRecalculateStyle(); 1466 #endif 1463 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this); 1467 1464 1468 1465 m_inStyleRecalc = true; … … 1519 1516 } 1520 1517 1521 #if ENABLE(INSPECTOR) 1522 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) 1523 timelineAgent->didRecalculateStyle(); 1524 #endif 1518 InspectorInstrumentation::didRecalculateStyle(this, cookie); 1525 1519 } 1526 1520 … … 4686 4680 #endif 4687 4681 4688 #if ENABLE(INSPECTOR)4689 InspectorTimelineAgent* Document::inspectorTimelineAgent() const4690 {4691 return page() ? page()->inspectorTimelineAgent() : 0;4692 }4693 4694 InspectorController* Document::inspectorController() const4695 {4696 return page() ? page()->inspectorController() : 0;4697 }4698 #endif4699 4700 4682 #if ENABLE(FULLSCREEN_API) 4701 4683 void Document::webkitRequestFullScreenForElement(Element* element, unsigned short flags) -
trunk/WebCore/dom/Document.h
r69043 r69283 89 89 class HitTestRequest; 90 90 class HitTestResult; 91 class InspectorTimelineAgent;92 91 class IntPoint; 93 92 class DOMWrapperWorld; … … 481 480 Page* page() const; // can be NULL 482 481 Settings* settings() const; // can be NULL 483 #if ENABLE(INSPECTOR)484 InspectorTimelineAgent* inspectorTimelineAgent() const; // can be NULL485 virtual InspectorController* inspectorController() const; // can be NULL486 #endif487 482 488 483 PassRefPtr<Range> createRange(); -
trunk/WebCore/dom/Node.cpp
r69014 r69283 2603 2603 } 2604 2604 2605 int instrumentationCookie = InspectorInstrumentation::instrumentWillDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors);2605 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors); 2606 2606 2607 2607 // Give the target node a chance to do some work before DOM event handlers get a crack. … … 2686 2686 doneWithDefault: 2687 2687 2688 InspectorInstrumentation:: instrumentDidDispatchEvent(document(), instrumentationCookie);2688 InspectorInstrumentation::didDispatchEvent(document(), cookie); 2689 2689 2690 2690 return !event->defaultPrevented(); -
trunk/WebCore/html/parser/HTMLDocumentParser.cpp
r68115 r69283 37 37 #include "HTMLTreeBuilder.h" 38 38 #include "HTMLDocument.h" 39 #include "InspectorInstrumentation.h" 39 40 #include "NestingLevelIncrementer.h" 40 41 #include "Settings.h" 41 42 #include "XSSAuditor.h" 42 43 #include <wtf/CurrentTime.h> 43 44 #if ENABLE(INSPECTOR)45 #include "InspectorTimelineAgent.h"46 #endif47 44 48 45 namespace WebCore { … … 211 208 ASSERT(refCount() >= 2); 212 209 213 // We tell the Inspector TimelineAgentabout every pump, even if we210 // We tell the InspectorInstrumentation about every pump, even if we 214 211 // end up pumping nothing. It can filter out empty pumps itself. 215 willPumpLexer(); 212 // FIXME: m_input.current().length() is only accurate if we 213 // end up parsing the whole buffer in this pump. We should pass how 214 // much we parsed as part of didWriteHTML instead of willWriteHTML. 215 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), m_input.current().length(), m_tokenizer->lineNumber()); 216 216 217 217 HTMLParserScheduler::PumpSession session; … … 257 257 } 258 258 259 didPumpLexer(); 260 } 261 262 void HTMLDocumentParser::willPumpLexer() 263 { 264 #if ENABLE(INSPECTOR) 265 // FIXME: m_input.current().length() is only accurate if we 266 // end up parsing the whole buffer in this pump. We should pass how 267 // much we parsed as part of didWriteHTML instead of willWriteHTML. 268 if (InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent()) 269 timelineAgent->willWriteHTML(m_input.current().length(), m_tokenizer->lineNumber()); 270 #endif 271 } 272 273 void HTMLDocumentParser::didPumpLexer() 274 { 275 #if ENABLE(INSPECTOR) 276 if (InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent()) 277 timelineAgent->didWriteHTML(m_tokenizer->lineNumber()); 278 #endif 259 InspectorInstrumentation::didWriteHTML(document(), m_tokenizer->lineNumber(), cookie); 279 260 } 280 261 -
trunk/WebCore/html/parser/HTMLDocumentParser.h
r67890 r69283 104 104 virtual void notifyFinished(CachedResource*); 105 105 106 void willPumpLexer();107 void didPumpLexer();108 109 106 enum SynchronousMode { 110 107 AllowYield, -
trunk/WebCore/inspector/InspectorInstrumentation.cpp
r69014 r69283 40 40 #include "InspectorDebuggerAgent.h" 41 41 #include "InspectorTimelineAgent.h" 42 #include "XMLHttpRequest.h" 42 43 43 44 namespace WebCore { … … 65 66 { 66 67 #if ENABLE(JAVASCRIPT_DEBUGGER) 67 if (!inspectorController->hasFrontend())68 return;69 68 InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get(); 70 69 if (!debuggerAgent) … … 81 80 void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspectorController, Node* node) 82 81 { 83 if (!inspectorController->hasFrontend())84 return;85 82 if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) 86 83 domAgent->didInsertDOMNode(node); … … 90 87 { 91 88 #if ENABLE(JAVASCRIPT_DEBUGGER) 92 if (!inspectorController->hasFrontend())93 return;94 89 InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get(); 95 90 if (!debuggerAgent) … … 106 101 void InspectorInstrumentation::didRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node) 107 102 { 108 if (!inspectorController->hasFrontend())109 return;110 103 if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) 111 104 domAgent->didRemoveDOMNode(node); … … 115 108 { 116 109 #if ENABLE(JAVASCRIPT_DEBUGGER) 117 if (!inspectorController->hasFrontend())118 return;119 110 InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get(); 120 111 if (!debuggerAgent) … … 131 122 void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorController* inspectorController, Element* element) 132 123 { 133 if (!inspectorController->hasFrontend())134 return;135 124 if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) 136 125 domAgent->didModifyDOMAttr(element); … … 139 128 void InspectorInstrumentation::characterDataModifiedImpl(InspectorController* inspectorController, CharacterData* characterData) 140 129 { 141 if (!inspectorController->hasFrontend())142 return;143 130 if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) 144 131 domAgent->characterDataModified(characterData); 145 132 } 146 133 147 int InspectorInstrumentation::instrumentWillDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors) 148 { 149 int instrumentationCookie = 0; 150 151 if (!inspectorController->hasFrontend()) 152 return instrumentationCookie; 153 134 135 void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url) 136 { 137 #if ENABLE(JAVASCRIPT_DEBUGGER) 138 InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get(); 139 if (!debuggerAgent) 140 return; 141 142 if (!inspectorController->shouldBreakOnXMLHttpRequest(url)) 143 return; 144 145 RefPtr<InspectorObject> eventData = InspectorObject::create(); 146 eventData->setString("type", "XHR"); 147 eventData->setString("url", url); 148 debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData); 149 #endif 150 } 151 152 void InspectorInstrumentation::didScheduleResourceRequestImpl(InspectorController* inspectorController, const String& url) 153 { 154 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) 155 timelineAgent->didScheduleResourceRequest(url); 156 } 157 158 void InspectorInstrumentation::didInstallTimerImpl(InspectorController* inspectorController, int timerId, int timeout, bool singleShot) 159 { 160 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) 161 timelineAgent->didInstallTimer(timerId, timeout, singleShot); 162 } 163 164 void InspectorInstrumentation::didRemoveTimerImpl(InspectorController* inspectorController, int timerId) 165 { 166 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) 167 timelineAgent->didRemoveTimer(timerId); 168 } 169 170 171 InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InspectorController* inspectorController, const String& scriptName, int scriptLine) 172 { 173 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 174 timelineAgent->willCallFunction(scriptName, scriptLine); 175 return timelineAgent->id(); 176 } 177 return 0; 178 } 179 180 void InspectorInstrumentation::didCallFunctionImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 181 { 182 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 183 timelineAgent->didCallFunction(); 184 } 185 186 InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyStateImpl(InspectorController* inspectorController, XMLHttpRequest* request) 187 { 188 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); 189 if (timelineAgent && request->hasEventListeners(eventNames().readystatechangeEvent)) { 190 timelineAgent->willChangeXHRReadyState(request->url().string(), request->readyState()); 191 return timelineAgent->id(); 192 } 193 return 0; 194 } 195 196 void InspectorInstrumentation::didChangeXHRReadyStateImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 197 { 198 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 199 timelineAgent->didChangeXHRReadyState(); 200 } 201 202 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors) 203 { 154 204 #if ENABLE(JAVASCRIPT_DEBUGGER) 155 205 if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) { … … 163 213 #endif 164 214 165 InspectorTimelineAgent* timelineAgent = inspectorController->m_timelineAgent.get();215 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); 166 216 if (timelineAgent && eventHasListeners(event.type(), window, node, ancestors)) { 167 217 timelineAgent->willDispatchEvent(event); 168 instrumentationCookie = timelineAgent->id(); 169 } 170 return instrumentationCookie; 171 } 172 173 void InspectorInstrumentation::instrumentDidDispatchEventImpl(InspectorController* inspectorController, int instrumentationCookie) 174 { 175 if (!inspectorController->hasFrontend()) 176 return; 177 218 return timelineAgent->id(); 219 } 220 return 0; 221 } 222 223 void InspectorInstrumentation::didDispatchEventImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 224 { 178 225 #if ENABLE(JAVASCRIPT_DEBUGGER) 179 226 if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) … … 181 228 #endif 182 229 183 InspectorTimelineAgent* timelineAgent = inspectorController->m_timelineAgent.get(); 184 if (timelineAgent && timelineAgent->id() == instrumentationCookie) 230 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 185 231 timelineAgent->didDispatchEvent(); 186 232 } 187 233 188 void InspectorInstrumentation::instrumentWillSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url) 189 { 190 #if ENABLE(JAVASCRIPT_DEBUGGER) 191 if (!inspectorController->hasFrontend()) 192 return; 193 194 InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get(); 195 if (!debuggerAgent) 196 return; 197 198 if (!inspectorController->shouldBreakOnXMLHttpRequest(url)) 199 return; 200 201 RefPtr<InspectorObject> eventData = InspectorObject::create(); 202 eventData->setString("type", "XHR"); 203 eventData->setString("url", url); 204 debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData); 205 #endif 234 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window) 235 { 236 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); 237 if (timelineAgent && window->hasEventListeners(event.type())) { 238 timelineAgent->willDispatchEvent(event); 239 return timelineAgent->id(); 240 } 241 return 0; 242 } 243 244 void InspectorInstrumentation::didDispatchEventOnWindowImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 245 { 246 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 247 timelineAgent->didDispatchEvent(); 248 } 249 250 InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InspectorController* inspectorController, const String& url, int lineNumber) 251 { 252 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 253 timelineAgent->willEvaluateScript(url, lineNumber); 254 return timelineAgent->id(); 255 } 256 return 0; 257 } 258 259 void InspectorInstrumentation::didEvaluateScriptImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 260 { 261 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 262 timelineAgent->didEvaluateScript(); 263 } 264 265 InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InspectorController* inspectorController, int timerId) 266 { 267 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 268 timelineAgent->willFireTimer(timerId); 269 return timelineAgent->id(); 270 } 271 return 0; 272 } 273 274 void InspectorInstrumentation::didFireTimerImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 275 { 276 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 277 timelineAgent->didFireTimer(); 278 } 279 280 InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InspectorController* inspectorController) 281 { 282 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 283 timelineAgent->willLayout(); 284 return timelineAgent->id(); 285 } 286 return 0; 287 } 288 289 void InspectorInstrumentation::didLayoutImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 290 { 291 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 292 timelineAgent->didLayout(); 293 } 294 295 InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHRImpl(InspectorController* inspectorController, XMLHttpRequest* request) 296 { 297 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); 298 if (timelineAgent && request->hasEventListeners(eventNames().loadEvent)) { 299 timelineAgent->willLoadXHR(request->url().string()); 300 return timelineAgent->id(); 301 } 302 return 0; 303 } 304 305 void InspectorInstrumentation::didLoadXHRImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 306 { 307 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 308 timelineAgent->didLoadXHR(); 309 } 310 311 InspectorInstrumentationCookie InspectorInstrumentation::willPaintImpl(InspectorController* inspectorController, const IntRect& rect) 312 { 313 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 314 timelineAgent->willPaint(rect); 315 return timelineAgent->id(); 316 } 317 return 0; 318 } 319 320 void InspectorInstrumentation::didPaintImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 321 { 322 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 323 timelineAgent->didPaint(); 324 } 325 326 InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InspectorController* inspectorController) 327 { 328 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 329 timelineAgent->willRecalculateStyle(); 330 return timelineAgent->id(); 331 } 332 return 0; 333 } 334 335 void InspectorInstrumentation::didRecalculateStyleImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 336 { 337 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 338 timelineAgent->didRecalculateStyle(); 339 } 340 341 InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InspectorController* inspectorController, unsigned long identifier) 342 { 343 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 344 timelineAgent->willReceiveResourceData(identifier); 345 return timelineAgent->id(); 346 } 347 return 0; 348 } 349 350 void InspectorInstrumentation::didReceiveResourceDataImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 351 { 352 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 353 timelineAgent->didReceiveResourceData(); 354 } 355 356 InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InspectorController* inspectorController, unsigned long identifier, const ResourceResponse& response) 357 { 358 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 359 timelineAgent->willReceiveResourceResponse(identifier, response); 360 return timelineAgent->id(); 361 } 362 return 0; 363 } 364 365 void InspectorInstrumentation::didReceiveResourceResponseImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 366 { 367 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 368 timelineAgent->didReceiveResourceResponse(); 369 } 370 371 InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InspectorController* inspectorController, unsigned int length, unsigned int startLine) 372 { 373 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) { 374 timelineAgent->willWriteHTML(length, startLine); 375 return timelineAgent->id(); 376 } 377 return 0; 378 } 379 380 void InspectorInstrumentation::didWriteHTMLImpl(InspectorController* inspectorController, unsigned int endLine, InspectorInstrumentationCookie cookie) 381 { 382 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie)) 383 timelineAgent->didWriteHTML(endLine); 384 } 385 386 387 bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorController) 388 { 389 return inspectorController->hasFrontend(); 390 } 391 392 InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController) 393 { 394 return inspectorController->m_timelineAgent.get(); 395 } 396 397 InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController, InspectorInstrumentationCookie cookie) 398 { 399 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); 400 if (timelineAgent && timelineAgent->id() == cookie) 401 return timelineAgent; 402 return 0; 206 403 } 207 404 -
trunk/WebCore/inspector/InspectorInstrumentation.h
r69014 r69283 33 33 34 34 #include "Document.h" 35 #include "Frame.h" 35 36 #include "Page.h" 36 37 #include "ScriptExecutionContext.h" … … 41 42 class Element; 42 43 class InspectorController; 44 class InspectorTimelineAgent; 43 45 class Node; 46 class ResourceRequest; 47 class ResourceResponse; 48 class XMLHttpRequest; 49 50 typedef int InspectorInstrumentationCookie; 44 51 45 52 class InspectorInstrumentation { … … 52 59 static void characterDataModified(Document*, CharacterData*); 53 60 54 static int instrumentWillDispatchEvent(Document*, const Event&, DOMWindow*, Node*, const Vector<RefPtr<ContainerNode> >& ancestors); 55 static void instrumentDidDispatchEvent(Document*, int instrumentationCookie); 56 57 static void instrumentWillSendXMLHttpRequest(ScriptExecutionContext*, const String&); 61 static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url); 62 static void didScheduleResourceRequest(Document*, const String& url); 63 static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot); 64 static void didRemoveTimer(ScriptExecutionContext*, int timerId); 65 66 static InspectorInstrumentationCookie willCallFunction(Frame*, const String& scriptName, int scriptLine); 67 static void didCallFunction(Frame*, InspectorInstrumentationCookie cookie); 68 static InspectorInstrumentationCookie willChangeXHRReadyState(ScriptExecutionContext*, XMLHttpRequest* request); 69 static void didChangeXHRReadyState(ScriptExecutionContext*, InspectorInstrumentationCookie cookie); 70 static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors); 71 static void didDispatchEvent(Document*, InspectorInstrumentationCookie cookie); 72 static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window); 73 static void didDispatchEventOnWindow(Frame*, InspectorInstrumentationCookie cookie); 74 static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber); 75 static void didEvaluateScript(Frame*, InspectorInstrumentationCookie cookie); 76 static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId); 77 static void didFireTimer(ScriptExecutionContext*, InspectorInstrumentationCookie cookie); 78 static InspectorInstrumentationCookie willLayout(Frame*); 79 static void didLayout(Frame*, InspectorInstrumentationCookie cookie); 80 static InspectorInstrumentationCookie willLoadXHR(ScriptExecutionContext*, XMLHttpRequest* request); 81 static void didLoadXHR(ScriptExecutionContext*, InspectorInstrumentationCookie cookie); 82 static InspectorInstrumentationCookie willPaint(Frame*, const IntRect& rect); 83 static void didPaint(Frame*, InspectorInstrumentationCookie cookie); 84 static InspectorInstrumentationCookie willRecalculateStyle(Document*); 85 static void didRecalculateStyle(Document*, InspectorInstrumentationCookie cookie); 86 static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier); 87 static void didReceiveResourceData(Frame*, InspectorInstrumentationCookie cookie); 88 static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse& response); 89 static void didReceiveResourceResponse(Frame*, InspectorInstrumentationCookie cookie); 90 static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine); 91 static void didWriteHTML(Document*, unsigned int endLine, InspectorInstrumentationCookie cookie); 58 92 59 93 #if ENABLE(INSPECTOR) … … 61 95 static void frontendDeleted() { s_frontendCounter -= 1; } 62 96 static bool hasFrontends() { return s_frontendCounter; } 97 #else 98 static bool hasFrontends() { return false; } 63 99 #endif 64 100 … … 73 109 static void characterDataModifiedImpl(InspectorController*, CharacterData*); 74 110 75 static int instrumentWillDispatchEventImpl(InspectorController*, const Event&, DOMWindow*, Node*, const Vector<RefPtr<ContainerNode> >& ancestors); 76 static void instrumentDidDispatchEventImpl(InspectorController*, int instrumentationCookie); 77 78 static void instrumentWillSendXMLHttpRequestImpl(InspectorController*, const String&); 79 80 static InspectorController* inspectorControllerForScriptExecutionContext(ScriptExecutionContext*); 111 static void willSendXMLHttpRequestImpl(InspectorController*, const String& url); 112 static void didScheduleResourceRequestImpl(InspectorController*, const String& url); 113 static void didInstallTimerImpl(InspectorController*, int timerId, int timeout, bool singleShot); 114 static void didRemoveTimerImpl(InspectorController*, int timerId); 115 116 static InspectorInstrumentationCookie willCallFunctionImpl(InspectorController*, const String& scriptName, int scriptLine); 117 static void didCallFunctionImpl(InspectorController*, InspectorInstrumentationCookie); 118 static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InspectorController*, XMLHttpRequest* request); 119 static void didChangeXHRReadyStateImpl(InspectorController*, InspectorInstrumentationCookie); 120 static InspectorInstrumentationCookie willDispatchEventImpl(InspectorController*, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors); 121 static void didDispatchEventImpl(InspectorController*, InspectorInstrumentationCookie); 122 static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InspectorController*, const Event& event, DOMWindow* window); 123 static void didDispatchEventOnWindowImpl(InspectorController*, InspectorInstrumentationCookie); 124 static InspectorInstrumentationCookie willEvaluateScriptImpl(InspectorController*, const String& url, int lineNumber); 125 static void didEvaluateScriptImpl(InspectorController*, InspectorInstrumentationCookie); 126 static InspectorInstrumentationCookie willFireTimerImpl(InspectorController*, int timerId); 127 static void didFireTimerImpl(InspectorController*, InspectorInstrumentationCookie); 128 static InspectorInstrumentationCookie willLayoutImpl(InspectorController*); 129 static void didLayoutImpl(InspectorController*, InspectorInstrumentationCookie); 130 static InspectorInstrumentationCookie willLoadXHRImpl(InspectorController*, XMLHttpRequest* request); 131 static void didLoadXHRImpl(InspectorController*, InspectorInstrumentationCookie); 132 static InspectorInstrumentationCookie willPaintImpl(InspectorController*, const IntRect& rect); 133 static void didPaintImpl(InspectorController*, InspectorInstrumentationCookie); 134 static InspectorInstrumentationCookie willRecalculateStyleImpl(InspectorController*); 135 static void didRecalculateStyleImpl(InspectorController*, InspectorInstrumentationCookie); 136 static InspectorInstrumentationCookie willReceiveResourceDataImpl(InspectorController*, unsigned long identifier); 137 static void didReceiveResourceDataImpl(InspectorController*, InspectorInstrumentationCookie); 138 static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InspectorController*, unsigned long identifier, const ResourceResponse& response); 139 static void didReceiveResourceResponseImpl(InspectorController*, InspectorInstrumentationCookie); 140 static InspectorInstrumentationCookie willWriteHTMLImpl(InspectorController*, unsigned int length, unsigned int startLine); 141 static void didWriteHTMLImpl(InspectorController*, unsigned int endLine, InspectorInstrumentationCookie); 142 143 static InspectorController* inspectorControllerForContext(ScriptExecutionContext*); 81 144 static InspectorController* inspectorControllerForDocument(Document*); 145 static InspectorController* inspectorControllerForFrame(Frame*); 82 146 static InspectorController* inspectorControllerForPage(Page*); 147 148 static bool hasFrontend(InspectorController*); 149 static InspectorTimelineAgent* retrieveTimelineAgent(InspectorController*); 150 static InspectorTimelineAgent* retrieveTimelineAgent(InspectorController*, InspectorInstrumentationCookie); 83 151 84 152 static int s_frontendCounter; … … 136 204 } 137 205 138 inline int InspectorInstrumentation::instrumentWillDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors) 139 { 140 #if ENABLE(INSPECTOR) 141 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 142 return instrumentWillDispatchEventImpl(inspectorController, event, window, node, ancestors); 143 #endif 144 return 0; 145 } 146 147 inline void InspectorInstrumentation::instrumentDidDispatchEvent(Document* document, int instrumentationCookie) 148 { 149 #if ENABLE(INSPECTOR) 150 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 151 instrumentDidDispatchEventImpl(inspectorController, instrumentationCookie); 152 #endif 153 } 154 155 inline void InspectorInstrumentation::instrumentWillSendXMLHttpRequest(ScriptExecutionContext* context, const String& url) 156 { 157 #if ENABLE(INSPECTOR) 158 if (InspectorController* inspectorController = inspectorControllerForScriptExecutionContext(context)) 159 instrumentWillSendXMLHttpRequestImpl(inspectorController, url); 160 #endif 161 } 162 163 #if ENABLE(INSPECTOR) 164 inline InspectorController* InspectorInstrumentation::inspectorControllerForScriptExecutionContext(ScriptExecutionContext* context) 206 207 inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url) 208 { 209 #if ENABLE(INSPECTOR) 210 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 211 willSendXMLHttpRequestImpl(inspectorController, url); 212 #endif 213 } 214 215 inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url) 216 { 217 #if ENABLE(INSPECTOR) 218 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 219 didScheduleResourceRequestImpl(inspectorController, url); 220 #endif 221 } 222 223 inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot) 224 { 225 #if ENABLE(INSPECTOR) 226 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 227 didInstallTimerImpl(inspectorController, timerId, timeout, singleShot); 228 #endif 229 } 230 231 inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId) 232 { 233 #if ENABLE(INSPECTOR) 234 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 235 didRemoveTimerImpl(inspectorController, timerId); 236 #endif 237 } 238 239 240 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(Frame* frame, const String& scriptName, int scriptLine) 241 { 242 #if ENABLE(INSPECTOR) 243 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 244 return willCallFunctionImpl(inspectorController, scriptName, scriptLine); 245 #endif 246 return 0; 247 } 248 249 inline void InspectorInstrumentation::didCallFunction(Frame* frame, InspectorInstrumentationCookie cookie) 250 { 251 #if ENABLE(INSPECTOR) 252 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 253 didCallFunctionImpl(inspectorController, cookie); 254 #endif 255 } 256 257 inline InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyState(ScriptExecutionContext* context, XMLHttpRequest* request) 258 { 259 #if ENABLE(INSPECTOR) 260 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 261 return willChangeXHRReadyStateImpl(inspectorController, request); 262 #endif 263 return 0; 264 } 265 266 inline void InspectorInstrumentation::didChangeXHRReadyState(ScriptExecutionContext* context, InspectorInstrumentationCookie cookie) 267 { 268 #if ENABLE(INSPECTOR) 269 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 270 didChangeXHRReadyStateImpl(inspectorController, cookie); 271 #endif 272 } 273 274 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors) 275 { 276 #if ENABLE(INSPECTOR) 277 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 278 return willDispatchEventImpl(inspectorController, event, window, node, ancestors); 279 #endif 280 return 0; 281 } 282 283 inline void InspectorInstrumentation::didDispatchEvent(Document* document, InspectorInstrumentationCookie cookie) 284 { 285 #if ENABLE(INSPECTOR) 286 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 287 didDispatchEventImpl(inspectorController, cookie); 288 #endif 289 } 290 291 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window) 292 { 293 #if ENABLE(INSPECTOR) 294 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 295 return willDispatchEventOnWindowImpl(inspectorController, event, window); 296 #endif 297 return 0; 298 } 299 300 inline void InspectorInstrumentation::didDispatchEventOnWindow(Frame* frame, InspectorInstrumentationCookie cookie) 301 { 302 #if ENABLE(INSPECTOR) 303 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 304 didDispatchEventOnWindowImpl(inspectorController, cookie); 305 #endif 306 } 307 308 inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber) 309 { 310 #if ENABLE(INSPECTOR) 311 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 312 return willEvaluateScriptImpl(inspectorController, url, lineNumber); 313 #endif 314 return 0; 315 } 316 317 inline void InspectorInstrumentation::didEvaluateScript(Frame* frame, InspectorInstrumentationCookie cookie) 318 { 319 #if ENABLE(INSPECTOR) 320 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 321 didEvaluateScriptImpl(inspectorController, cookie); 322 #endif 323 } 324 325 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId) 326 { 327 #if ENABLE(INSPECTOR) 328 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 329 return willFireTimerImpl(inspectorController, timerId); 330 #endif 331 return 0; 332 } 333 334 inline void InspectorInstrumentation::didFireTimer(ScriptExecutionContext* context, InspectorInstrumentationCookie cookie) 335 { 336 #if ENABLE(INSPECTOR) 337 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 338 didFireTimerImpl(inspectorController, cookie); 339 #endif 340 } 341 342 inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame) 343 { 344 #if ENABLE(INSPECTOR) 345 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 346 return willLayoutImpl(inspectorController); 347 #endif 348 return 0; 349 } 350 351 inline void InspectorInstrumentation::didLayout(Frame* frame, InspectorInstrumentationCookie cookie) 352 { 353 #if ENABLE(INSPECTOR) 354 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 355 didLayoutImpl(inspectorController, cookie); 356 #endif 357 } 358 359 inline InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, XMLHttpRequest* request) 360 { 361 #if ENABLE(INSPECTOR) 362 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 363 return willLoadXHRImpl(inspectorController, request); 364 #endif 365 return 0; 366 } 367 368 inline void InspectorInstrumentation::didLoadXHR(ScriptExecutionContext* context, InspectorInstrumentationCookie cookie) 369 { 370 #if ENABLE(INSPECTOR) 371 if (InspectorController* inspectorController = inspectorControllerForContext(context)) 372 didLoadXHRImpl(inspectorController, cookie); 373 #endif 374 } 375 376 inline InspectorInstrumentationCookie InspectorInstrumentation::willPaint(Frame* frame, const IntRect& rect) 377 { 378 #if ENABLE(INSPECTOR) 379 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 380 return willPaintImpl(inspectorController, rect); 381 #endif 382 return 0; 383 } 384 385 inline void InspectorInstrumentation::didPaint(Frame* frame, InspectorInstrumentationCookie cookie) 386 { 387 #if ENABLE(INSPECTOR) 388 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 389 didPaintImpl(inspectorController, cookie); 390 #endif 391 } 392 393 inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document) 394 { 395 #if ENABLE(INSPECTOR) 396 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 397 return willRecalculateStyleImpl(inspectorController); 398 #endif 399 return 0; 400 } 401 402 inline void InspectorInstrumentation::didRecalculateStyle(Document* document, InspectorInstrumentationCookie cookie) 403 { 404 #if ENABLE(INSPECTOR) 405 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 406 didRecalculateStyleImpl(inspectorController, cookie); 407 #endif 408 } 409 410 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier) 411 { 412 #if ENABLE(INSPECTOR) 413 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 414 return willReceiveResourceDataImpl(inspectorController, identifier); 415 #endif 416 return 0; 417 } 418 419 inline void InspectorInstrumentation::didReceiveResourceData(Frame* frame, InspectorInstrumentationCookie cookie) 420 { 421 #if ENABLE(INSPECTOR) 422 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 423 didReceiveResourceDataImpl(inspectorController, cookie); 424 #endif 425 } 426 427 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response) 428 { 429 #if ENABLE(INSPECTOR) 430 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 431 return willReceiveResourceResponseImpl(inspectorController, identifier, response); 432 #endif 433 return 0; 434 } 435 436 inline void InspectorInstrumentation::didReceiveResourceResponse(Frame* frame, InspectorInstrumentationCookie cookie) 437 { 438 #if ENABLE(INSPECTOR) 439 if (InspectorController* inspectorController = inspectorControllerForFrame(frame)) 440 didReceiveResourceResponseImpl(inspectorController, cookie); 441 #endif 442 } 443 444 inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine) 445 { 446 #if ENABLE(INSPECTOR) 447 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 448 return willWriteHTMLImpl(inspectorController, length, startLine); 449 #endif 450 return 0; 451 } 452 453 inline void InspectorInstrumentation::didWriteHTML(Document* document, unsigned int endLine, InspectorInstrumentationCookie cookie) 454 { 455 #if ENABLE(INSPECTOR) 456 if (InspectorController* inspectorController = inspectorControllerForDocument(document)) 457 didWriteHTMLImpl(inspectorController, endLine, cookie); 458 #endif 459 } 460 461 462 #if ENABLE(INSPECTOR) 463 inline InspectorController* InspectorInstrumentation::inspectorControllerForContext(ScriptExecutionContext* context) 165 464 { 166 465 if (hasFrontends() && context && context->isDocument()) … … 171 470 inline InspectorController* InspectorInstrumentation::inspectorControllerForDocument(Document* document) 172 471 { 173 if (hasFrontends() )472 if (hasFrontends() && document) 174 473 return inspectorControllerForPage(document->page()); 175 474 return 0; 176 475 } 177 476 477 inline InspectorController* InspectorInstrumentation::inspectorControllerForFrame(Frame* frame) 478 { 479 if (hasFrontends() && frame) 480 return inspectorControllerForPage(frame->page()); 481 return 0; 482 } 483 178 484 inline InspectorController* InspectorInstrumentation::inspectorControllerForPage(Page* page) 179 485 { 180 return page ? page->inspectorController() : 0; 486 if (page) { 487 if (InspectorController* inspectorController = page->inspectorController()) { 488 if (hasFrontend(inspectorController)) 489 return inspectorController; 490 } 491 } 492 return 0; 181 493 } 182 494 #endif -
trunk/WebCore/inspector/InspectorTimelineAgent.cpp
r69014 r69283 45 45 namespace WebCore { 46 46 47 int InspectorTimelineAgent::s_instanceCount = 0;48 47 int InspectorTimelineAgent::s_id = 0; 49 48 … … 52 51 , m_id(++s_id) 53 52 { 54 ++s_instanceCount;55 53 ScriptGCEvent::addEventListener(this); 56 54 ASSERT(m_frontend); … … 79 77 InspectorTimelineAgent::~InspectorTimelineAgent() 80 78 { 81 ASSERT(s_instanceCount);82 --s_instanceCount;83 79 ScriptGCEvent::removeEventListener(this); 84 80 } -
trunk/WebCore/inspector/InspectorTimelineAgent.h
r69014 r69283 34 34 #if ENABLE(INSPECTOR) 35 35 36 #include "Document.h"37 36 #include "InspectorValues.h" 38 #include "ScriptExecutionContext.h"39 37 #include "ScriptGCEvent.h" 40 38 #include "ScriptGCEventListener.h" … … 131 129 virtual void didGC(double, double, size_t); 132 130 133 static int instanceCount() { return s_instanceCount; }134 static InspectorTimelineAgent* retrieve(ScriptExecutionContext*);135 136 131 private: 137 132 struct TimelineRecordEntry { … … 158 153 159 154 Vector<TimelineRecordEntry> m_recordStack; 160 static int s_instanceCount; 155 161 156 static int s_id; 162 157 const int m_id; … … 174 169 }; 175 170 176 inline InspectorTimelineAgent* InspectorTimelineAgent::retrieve(ScriptExecutionContext* context)177 {178 if (context && context->isDocument())179 return static_cast<Document*>(context)->inspectorTimelineAgent();180 return 0;181 }182 183 171 } // namespace WebCore 184 172 -
trunk/WebCore/loader/ResourceLoader.cpp
r67553 r69283 37 37 #include "FrameLoader.h" 38 38 #include "FrameLoaderClient.h" 39 #include "InspectorController.h" 40 #include "InspectorTimelineAgent.h" 39 #include "InspectorInstrumentation.h" 41 40 #include "Page.h" 42 41 #include "ProgressTracker.h" … … 402 401 void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response) 403 402 { 404 #if ENABLE(INSPECTOR) 405 if (InspectorTimelineAgent::instanceCount()) { 406 InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0; 407 if (timelineAgent) 408 timelineAgent->willReceiveResourceResponse(identifier(), response); 409 } 410 #endif 403 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_frame.get(), identifier(), response); 411 404 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 412 405 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(this, response)) … … 414 407 #endif 415 408 didReceiveResponse(response); 416 #if ENABLE(INSPECTOR) 417 if (InspectorTimelineAgent::instanceCount()) { 418 InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0; 419 if (timelineAgent) 420 timelineAgent->didReceiveResourceResponse(); 421 } 422 #endif 409 InspectorInstrumentation::didReceiveResourceResponse(m_frame.get(), cookie); 423 410 } 424 411 425 412 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int lengthReceived) 426 413 { 427 #if ENABLE(INSPECTOR) 428 if (InspectorTimelineAgent::instanceCount()) { 429 InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0; 430 if (timelineAgent) 431 timelineAgent->willReceiveResourceData(identifier()); 432 } 433 #endif 414 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier()); 434 415 didReceiveData(data, length, lengthReceived, false); 435 #if ENABLE(INSPECTOR) 436 if (InspectorTimelineAgent::instanceCount()) { 437 InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0; 438 if (timelineAgent) 439 timelineAgent->didReceiveResourceData(); 440 } 441 #endif 416 InspectorInstrumentation::didReceiveResourceData(m_frame.get(), cookie); 442 417 } 443 418 -
trunk/WebCore/loader/loader.cpp
r66963 r69283 29 29 #include "CachedResource.h" 30 30 #include "CachedResourceLoader.h" 31 #include "Inspector TimelineAgent.h"31 #include "InspectorInstrumentation.h" 32 32 #include "Frame.h" 33 33 #include "FrameLoader.h" … … 150 150 } else { 151 151 // Handle asynchronously so early low priority requests don't get scheduled before later high priority ones 152 #if ENABLE(INSPECTOR) 153 if (InspectorTimelineAgent::instanceCount()) { 154 InspectorTimelineAgent* agent = cachedResourceLoader->doc()->inspectorTimelineAgent(); 155 if (agent) 156 agent->didScheduleResourceRequest(resource->url()); 157 } 158 #endif // ENABLE(INSPECTOR) 152 InspectorInstrumentation::didScheduleResourceRequest(cachedResourceLoader->doc(), resource->url()); 159 153 scheduleServePendingRequests(); 160 154 } -
trunk/WebCore/page/DOMTimer.cpp
r67758 r69283 28 28 #include "DOMTimer.h" 29 29 30 #include "Inspector TimelineAgent.h"30 #include "InspectorInstrumentation.h" 31 31 #include "ScheduledAction.h" 32 32 #include "ScriptExecutionContext.h" … … 82 82 DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot); 83 83 84 #if ENABLE(INSPECTOR) 85 if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) 86 timelineAgent->didInstallTimer(timer->m_timeoutId, timeout, singleShot); 87 #endif 84 InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot); 88 85 89 86 return timer->m_timeoutId; … … 98 95 return; 99 96 100 #if ENABLE(INSPECTOR) 101 if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) 102 timelineAgent->didRemoveTimer(timeoutId); 103 #endif 97 InspectorInstrumentation::didRemoveTimer(context, timeoutId); 104 98 105 99 delete context->findTimeout(timeoutId); … … 111 105 timerNestingLevel = m_nestingLevel; 112 106 113 #if ENABLE(INSPECTOR) 114 if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) 115 timelineAgent->willFireTimer(m_timeoutId); 116 #endif 107 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId); 117 108 118 109 // Simple case for non-one-shot timers. … … 126 117 // No access to member variables after this point, it can delete the timer. 127 118 m_action->execute(context); 128 #if ENABLE(INSPECTOR) 129 if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) 130 timelineAgent->didFireTimer(); 131 #endif 119 120 InspectorInstrumentation::didFireTimer(context, cookie); 121 132 122 return; 133 123 } … … 141 131 action->execute(context); 142 132 143 #if ENABLE(INSPECTOR) 144 if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) 145 timelineAgent->didFireTimer(); 146 #endif 133 InspectorInstrumentation::didFireTimer(context, cookie); 147 134 148 135 timerNestingLevel = 0; -
trunk/WebCore/page/DOMTimer.h
r67758 r69283 35 35 namespace WebCore { 36 36 37 class InspectorTimelineAgent;38 39 37 class DOMTimer : public SuspendableTimer { 40 38 public: -
trunk/WebCore/page/DOMWindow.cpp
r69262 r69283 63 63 #include "IDBFactoryBackendInterface.h" 64 64 #include "InspectorController.h" 65 #include "Inspector TimelineAgent.h"65 #include "InspectorInstrumentation.h" 66 66 #include "KURL.h" 67 67 #include "Location.h" … … 1523 1523 } 1524 1524 1525 #if ENABLE(INSPECTOR)1526 InspectorTimelineAgent* DOMWindow::inspectorTimelineAgent()1527 {1528 if (frame() && frame()->page())1529 return frame()->page()->inspectorTimelineAgent();1530 return 0;1531 }1532 #endif1533 1534 1525 bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget) 1535 1526 { … … 1541 1532 event->setEventPhase(Event::AT_TARGET); 1542 1533 1543 #if ENABLE(INSPECTOR) 1544 Page* inspectedPage = InspectorTimelineAgent::instanceCount() && frame() ? frame()->page() : 0; 1545 if (inspectedPage) { 1546 if (InspectorTimelineAgent* timelineAgent = hasEventListeners(event->type()) ? inspectedPage->inspectorTimelineAgent() : 0) 1547 timelineAgent->willDispatchEvent(*event); 1548 else 1549 inspectedPage = 0; 1550 } 1551 #endif 1534 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), *event, this); 1552 1535 1553 1536 bool result = fireEventListeners(event.get()); 1554 1537 1555 #if ENABLE(INSPECTOR) 1556 if (inspectedPage) 1557 if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) 1558 timelineAgent->didDispatchEvent(); 1559 #endif 1538 InspectorInstrumentation::didDispatchEventOnWindow(frame(), cookie); 1560 1539 1561 1540 return result; -
trunk/WebCore/page/DOMWindow.h
r68222 r69283 58 58 class History; 59 59 class IDBFactory; 60 class InspectorTimelineAgent;61 60 class Location; 62 61 class StyleMedia; … … 408 407 virtual EventTargetData* eventTargetData(); 409 408 virtual EventTargetData* ensureEventTargetData(); 410 InspectorTimelineAgent* inspectorTimelineAgent();411 409 412 410 RefPtr<SecurityOrigin> m_securityOrigin; -
trunk/WebCore/page/FrameView.cpp
r68681 r69283 46 46 #include "HTMLNames.h" 47 47 #include "HTMLPlugInImageElement.h" 48 #include "Inspector TimelineAgent.h"48 #include "InspectorInstrumentation.h" 49 49 #include "OverflowEvent.h" 50 50 #include "RenderEmbeddedObject.h" … … 618 618 return; 619 619 620 #if ENABLE(INSPECTOR) 621 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) 622 timelineAgent->willLayout(); 623 #endif 620 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(m_frame.get()); 624 621 625 622 if (!allowSubtree && m_layoutRoot) { … … 841 838 } 842 839 843 #if ENABLE(INSPECTOR) 844 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) 845 timelineAgent->didLayout(); 846 #endif 840 InspectorInstrumentation::didLayout(m_frame.get(), cookie); 847 841 848 842 m_nestedLayoutCount--; … … 1933 1927 return; 1934 1928 1935 #if ENABLE(INSPECTOR) 1936 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) 1937 timelineAgent->willPaint(rect); 1938 #endif 1929 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_frame.get(), rect); 1939 1930 1940 1931 Document* document = frame()->document(); … … 2010 2001 sCurrentPaintTimeStamp = 0; 2011 2002 2012 #if ENABLE(INSPECTOR) 2013 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) 2014 timelineAgent->didPaint(); 2015 #endif 2003 InspectorInstrumentation::didPaint(m_frame.get(), cookie); 2016 2004 } 2017 2005 -
trunk/WebCore/page/FrameView.h
r67771 r69283 26 26 #define FrameView_h 27 27 28 #include "Frame.h" // Only used by FrameView::inspectorTimelineAgent()28 #include "Frame.h" 29 29 #include "IntSize.h" 30 #include "Page.h" // Only used by FrameView::inspectorTimelineAgent()30 #include "Page.h" 31 31 #include "RenderObject.h" // For PaintBehavior 32 32 #include "ScrollView.h" … … 39 39 class Event; 40 40 class FrameViewPrivate; 41 class InspectorTimelineAgent;42 41 class IntRect; 43 42 class Node; … … 294 293 void scrollPositionChanged(); 295 294 296 #if ENABLE(INSPECTOR)297 InspectorTimelineAgent* inspectorTimelineAgent() const;298 #endif299 300 295 bool hasCustomScrollbars() const; 301 296 … … 387 382 }; 388 383 389 #if ENABLE(INSPECTOR)390 inline InspectorTimelineAgent* FrameView::inspectorTimelineAgent() const391 {392 return m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0;393 }394 #endif395 396 384 } // namespace WebCore 397 385 -
trunk/WebCore/page/Page.cpp
r69197 r69283 47 47 #include "HistoryItem.h" 48 48 #include "InspectorController.h" 49 #include "InspectorTimelineAgent.h"50 49 #include "Logging.h" 51 50 #include "MediaCanStartListener.h" … … 842 841 } 843 842 844 #if ENABLE(INSPECTOR)845 InspectorTimelineAgent* Page::inspectorTimelineAgent() const846 {847 return m_inspectorController->timelineAgent();848 }849 #endif850 851 843 #if ENABLE(INPUT_SPEECH) 852 844 SpeechInput* Page::speechInput() -
trunk/WebCore/page/Page.h
r69053 r69283 62 62 class InspectorClient; 63 63 class InspectorController; 64 class InspectorTimelineAgent;65 64 class MediaCanStartListener; 66 65 class Node; … … 290 289 bool javaScriptURLsAreAllowed() const; 291 290 292 #if ENABLE(INSPECTOR)293 InspectorTimelineAgent* inspectorTimelineAgent() const;294 #endif295 296 291 // Don't allow more than a certain number of frames in a page. 297 292 // This seems like a reasonable upper bound, and otherwise mutually -
trunk/WebCore/rendering/RenderLayerBacking.cpp
r68233 r69283 44 44 #include "HTMLMediaElement.h" 45 45 #include "HTMLNames.h" 46 #include "Inspector TimelineAgent.h"46 #include "InspectorInstrumentation.h" 47 47 #include "KeyframeList.h" 48 48 #include "PluginViewBase.h" … … 1060 1060 } 1061 1061 1062 #if ENABLE(INSPECTOR)1063 static InspectorTimelineAgent* inspectorTimelineAgent(RenderObject* renderer)1064 {1065 Frame* frame = renderer->frame();1066 if (!frame)1067 return 0;1068 Page* page = frame->page();1069 if (!page)1070 return 0;1071 return page->inspectorTimelineAgent();1072 }1073 #endif1074 1075 1062 // Up-call from compositing layer drawing callback. 1076 1063 void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip) 1077 1064 { 1078 #if ENABLE(INSPECTOR) 1079 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent(m_owningLayer->renderer())) 1080 timelineAgent->willPaint(clip); 1081 #endif 1065 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_owningLayer->renderer()->frame(), clip); 1082 1066 1083 1067 // We have to use the same root as for hit testing, because both methods … … 1099 1083 paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase, renderer()); 1100 1084 1101 #if ENABLE(INSPECTOR) 1102 if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent(m_owningLayer->renderer())) 1103 timelineAgent->didPaint(); 1104 #endif 1085 InspectorInstrumentation::didPaint(m_owningLayer->renderer()->frame(), cookie); 1105 1086 } 1106 1087 -
trunk/WebCore/xml/XMLHttpRequest.cpp
r68124 r69283 36 36 #include "HTTPParsers.h" 37 37 #include "InspectorController.h" 38 #include "Inspector TimelineAgent.h"38 #include "InspectorInstrumentation.h" 39 39 #include "ResourceError.h" 40 40 #include "ResourceRequest.h" … … 304 304 return; 305 305 306 #if ENABLE(INSPECTOR) 307 InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()); 308 bool callTimelineAgentOnReadyStateChange = timelineAgent && hasEventListeners(eventNames().readystatechangeEvent); 309 if (callTimelineAgentOnReadyStateChange) 310 timelineAgent->willChangeXHRReadyState(m_url.string(), m_state); 311 #endif 306 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willChangeXHRReadyState(scriptExecutionContext(), this); 312 307 313 308 if (m_async || (m_state <= OPENED || m_state == DONE)) 314 309 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent); 315 310 316 #if ENABLE(INSPECTOR) 317 if (callTimelineAgentOnReadyStateChange && (timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()))) 318 timelineAgent->didChangeXHRReadyState(); 319 #endif 311 InspectorInstrumentation::didChangeXHRReadyState(scriptExecutionContext(), cookie); 320 312 321 313 if (m_state == DONE && !m_error) { 322 #if ENABLE(INSPECTOR) 323 timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()); 324 bool callTimelineAgentOnLoad = timelineAgent && hasEventListeners(eventNames().loadEvent); 325 if (callTimelineAgentOnLoad) 326 timelineAgent->willLoadXHR(m_url.string()); 327 #endif 328 314 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLoadXHR(scriptExecutionContext(), this); 329 315 m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); 330 331 #if ENABLE(INSPECTOR) 332 if (callTimelineAgentOnLoad && (timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext()))) 333 timelineAgent->didLoadXHR(); 334 #endif 316 InspectorInstrumentation::didLoadXHR(scriptExecutionContext(), cookie); 335 317 } 336 318 }
Note: See TracChangeset
for help on using the changeset viewer.