Changeset 69283 in webkit


Ignore:
Timestamp:
Oct 7, 2010 2:43:02 AM (14 years ago)
Author:
podivilov@chromium.org
Message:

2010-10-05 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: extract Inspector Instrumentation API as a class
https://bugs.webkit.org/show_bug.cgi?id=47173

  • bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::send):
  • bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld):
  • bindings/v8/V8DOMWindowShell.cpp:
  • bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::evaluate): (WebCore::V8Proxy::callFunction):
  • bindings/v8/custom/V8XMLHttpRequestCustom.cpp: (WebCore::V8XMLHttpRequest::sendCallback):
  • dom/Document.cpp: (WebCore::Document::recalcStyle):
  • dom/Document.h:
  • dom/Node.cpp: (WebCore::Node::dispatchGenericEvent):
  • html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::pumpTokenizer):
  • html/parser/HTMLDocumentParser.h:
  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::hasFrontend): (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
  • inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::hasFrontends): (WebCore::InspectorInstrumentation::inspectorControllerForContext): (WebCore::InspectorInstrumentation::inspectorControllerForDocument): (WebCore::InspectorInstrumentation::inspectorControllerForFrame): (WebCore::InspectorInstrumentation::inspectorControllerForPage):
  • inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): (WebCore::InspectorTimelineAgent::~InspectorTimelineAgent):
  • inspector/InspectorTimelineAgent.h:
  • loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didReceiveResponse): (WebCore::ResourceLoader::didReceiveData):
  • loader/loader.cpp: (WebCore::Loader::load):
  • page/DOMTimer.cpp: (WebCore::DOMTimer::install): (WebCore::DOMTimer::removeById): (WebCore::DOMTimer::fired):
  • page/DOMTimer.h:
  • page/DOMWindow.cpp: (WebCore::DOMWindow::dispatchEvent):
  • page/DOMWindow.h:
  • page/FrameView.cpp: (WebCore::FrameView::layout): (WebCore::FrameView::paintContents):
  • page/FrameView.h:
  • page/Page.cpp:
  • page/Page.h:
  • rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::paintContents):
  • xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::callReadyStateChangeListener):
Location:
trunk/WebCore
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69282 r69283  
     12010-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
    1632010-10-07  Zraly Mike  <mike.zraly@nokia.com>
    264
  • trunk/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp

    r68767 r69283  
    9595JSValue JSXMLHttpRequest::send(ExecState* exec)
    9696{
    97     InspectorInstrumentation::instrumentWillSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());
     97    InspectorInstrumentation::willSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());
    9898
    9999    ExceptionCode ec = 0;
  • trunk/WebCore/bindings/js/ScriptController.cpp

    r65082 r69283  
    2929#include "GCController.h"
    3030#include "HTMLPlugInElement.h"
    31 #include "InspectorTimelineAgent.h"
     31#include "InspectorInstrumentation.h"
    3232#include "JSDocument.h"
    3333#include "JSMainThreadExecState.h"
     
    143143    RefPtr<Frame> protect = m_frame;
    144144
    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());
    149146
    150147    exec->globalData().timeoutChecker.start();
     
    152149    exec->globalData().timeoutChecker.stop();
    153150
    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);
    158152
    159153    // Evaluating the JavaScript could cause the frame to be deallocated
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r68666 r69283  
    3838#include "Frame.h"
    3939#include "FrameLoaderClient.h"
    40 #include "InspectorTimelineAgent.h"
    4140#include "Page.h"
    4241#include "PageGroup.h"
  • trunk/WebCore/bindings/v8/V8Proxy.cpp

    r68666 r69283  
    4040#include "IDBFactoryBackendInterface.h"
    4141#include "IDBPendingTransactionMonitor.h"
    42 #include "InspectorTimelineAgent.h"
     42#include "InspectorInstrumentation.h"
    4343#include "Page.h"
    4444#include "PageGroup.h"
     
    377377    V8GCController::checkMemoryUsage();
    378378
    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());
    383380
    384381    v8::Local<v8::Value> result;
     
    415412#endif
    416413
    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);
    421415
    422416    return result;
     
    506500        m_frame->keepAlive();
    507501
    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);
    522512        }
    523 #endif // !ENABLE(INSPECTOR)
    524513
    525514        m_recursion++;
     
    527516        m_recursion--;
    528517
    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);
    535519    }
    536520
  • trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

    r68767 r69283  
    115115    XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
    116116
    117     InspectorInstrumentation::instrumentWillSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
     117    InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
    118118
    119119    ExceptionCode ec = 0;
  • trunk/WebCore/dom/Document.cpp

    r69192 r69283  
    8989#include "ImageLoader.h"
    9090#include "InspectorController.h"
    91 #include "InspectorTimelineAgent.h"
     91#include "InspectorInstrumentation.h"
    9292#include "KeyboardEvent.h"
    9393#include "Logging.h"
     
    14611461        return; // Guard against re-entrancy. -dwh
    14621462
    1463 #if ENABLE(INSPECTOR)
    1464     if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
    1465         timelineAgent->willRecalculateStyle();
    1466 #endif
     1463    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
    14671464
    14681465    m_inStyleRecalc = true;
     
    15191516    }
    15201517
    1521 #if ENABLE(INSPECTOR)
    1522     if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
    1523         timelineAgent->didRecalculateStyle();
    1524 #endif
     1518    InspectorInstrumentation::didRecalculateStyle(this, cookie);
    15251519}
    15261520
     
    46864680#endif
    46874681
    4688 #if ENABLE(INSPECTOR)
    4689 InspectorTimelineAgent* Document::inspectorTimelineAgent() const
    4690 {
    4691     return page() ? page()->inspectorTimelineAgent() : 0;
    4692 }
    4693 
    4694 InspectorController* Document::inspectorController() const
    4695 {
    4696     return page() ? page()->inspectorController() : 0;
    4697 }
    4698 #endif
    4699    
    47004682#if ENABLE(FULLSCREEN_API)
    47014683void Document::webkitRequestFullScreenForElement(Element* element, unsigned short flags)
  • trunk/WebCore/dom/Document.h

    r69043 r69283  
    8989class HitTestRequest;
    9090class HitTestResult;
    91 class InspectorTimelineAgent;
    9291class IntPoint;
    9392class DOMWrapperWorld;
     
    481480    Page* page() const; // can be NULL
    482481    Settings* settings() const; // can be NULL
    483 #if ENABLE(INSPECTOR)
    484     InspectorTimelineAgent* inspectorTimelineAgent() const; // can be NULL
    485     virtual InspectorController* inspectorController() const; // can be NULL
    486 #endif
    487482
    488483    PassRefPtr<Range> createRange();
  • trunk/WebCore/dom/Node.cpp

    r69014 r69283  
    26032603    }
    26042604
    2605     int instrumentationCookie = InspectorInstrumentation::instrumentWillDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors);
     2605    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors);
    26062606
    26072607    // Give the target node a chance to do some work before DOM event handlers get a crack.
     
    26862686doneWithDefault:
    26872687
    2688     InspectorInstrumentation::instrumentDidDispatchEvent(document(), instrumentationCookie);
     2688    InspectorInstrumentation::didDispatchEvent(document(), cookie);
    26892689
    26902690    return !event->defaultPrevented();
  • trunk/WebCore/html/parser/HTMLDocumentParser.cpp

    r68115 r69283  
    3737#include "HTMLTreeBuilder.h"
    3838#include "HTMLDocument.h"
     39#include "InspectorInstrumentation.h"
    3940#include "NestingLevelIncrementer.h"
    4041#include "Settings.h"
    4142#include "XSSAuditor.h"
    4243#include <wtf/CurrentTime.h>
    43 
    44 #if ENABLE(INSPECTOR)
    45 #include "InspectorTimelineAgent.h"
    46 #endif
    4744
    4845namespace WebCore {
     
    211208    ASSERT(refCount() >= 2);
    212209
    213     // We tell the InspectorTimelineAgent about every pump, even if we
     210    // We tell the InspectorInstrumentation about every pump, even if we
    214211    // 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());
    216216
    217217    HTMLParserScheduler::PumpSession session;
     
    257257    }
    258258
    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);
    279260}
    280261
  • trunk/WebCore/html/parser/HTMLDocumentParser.h

    r67890 r69283  
    104104    virtual void notifyFinished(CachedResource*);
    105105
    106     void willPumpLexer();
    107     void didPumpLexer();
    108 
    109106    enum SynchronousMode {
    110107        AllowYield,
  • trunk/WebCore/inspector/InspectorInstrumentation.cpp

    r69014 r69283  
    4040#include "InspectorDebuggerAgent.h"
    4141#include "InspectorTimelineAgent.h"
     42#include "XMLHttpRequest.h"
    4243
    4344namespace WebCore {
     
    6566{
    6667#if ENABLE(JAVASCRIPT_DEBUGGER)
    67     if (!inspectorController->hasFrontend())
    68         return;
    6968    InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get();
    7069    if (!debuggerAgent)
     
    8180void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspectorController, Node* node)
    8281{
    83     if (!inspectorController->hasFrontend())
    84         return;
    8582    if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
    8683        domAgent->didInsertDOMNode(node);
     
    9087{
    9188#if ENABLE(JAVASCRIPT_DEBUGGER)
    92     if (!inspectorController->hasFrontend())
    93         return;
    9489    InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get();
    9590    if (!debuggerAgent)
     
    106101void InspectorInstrumentation::didRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node)
    107102{
    108     if (!inspectorController->hasFrontend())
    109         return;
    110103    if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
    111104        domAgent->didRemoveDOMNode(node);
     
    115108{
    116109#if ENABLE(JAVASCRIPT_DEBUGGER)
    117     if (!inspectorController->hasFrontend())
    118         return;
    119110    InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get();
    120111    if (!debuggerAgent)
     
    131122void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorController* inspectorController, Element* element)
    132123{
    133     if (!inspectorController->hasFrontend())
    134         return;
    135124    if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
    136125        domAgent->didModifyDOMAttr(element);
     
    139128void InspectorInstrumentation::characterDataModifiedImpl(InspectorController* inspectorController, CharacterData* characterData)
    140129{
    141     if (!inspectorController->hasFrontend())
    142         return;
    143130    if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get())
    144131        domAgent->characterDataModified(characterData);
    145132}
    146133
    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
     135void 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
     152void InspectorInstrumentation::didScheduleResourceRequestImpl(InspectorController* inspectorController, const String& url)
     153{
     154    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController))
     155        timelineAgent->didScheduleResourceRequest(url);
     156}
     157
     158void 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
     164void InspectorInstrumentation::didRemoveTimerImpl(InspectorController* inspectorController, int timerId)
     165{
     166    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController))
     167        timelineAgent->didRemoveTimer(timerId);
     168}
     169
     170
     171InspectorInstrumentationCookie 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
     180void InspectorInstrumentation::didCallFunctionImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     181{
     182    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     183        timelineAgent->didCallFunction();
     184}
     185
     186InspectorInstrumentationCookie 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
     196void InspectorInstrumentation::didChangeXHRReadyStateImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     197{
     198    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     199        timelineAgent->didChangeXHRReadyState();
     200}
     201
     202InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors)
     203{
    154204#if ENABLE(JAVASCRIPT_DEBUGGER)
    155205    if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) {
     
    163213#endif
    164214
    165     InspectorTimelineAgent* timelineAgent = inspectorController->m_timelineAgent.get();
     215    InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
    166216    if (timelineAgent && eventHasListeners(event.type(), window, node, ancestors)) {
    167217        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
     223void InspectorInstrumentation::didDispatchEventImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     224{
    178225#if ENABLE(JAVASCRIPT_DEBUGGER)
    179226    if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get())
     
    181228#endif
    182229
    183     InspectorTimelineAgent* timelineAgent = inspectorController->m_timelineAgent.get();
    184     if (timelineAgent && timelineAgent->id() == instrumentationCookie)
     230    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
    185231        timelineAgent->didDispatchEvent();
    186232}
    187233
    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
     234InspectorInstrumentationCookie 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
     244void InspectorInstrumentation::didDispatchEventOnWindowImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     245{
     246    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     247        timelineAgent->didDispatchEvent();
     248}
     249
     250InspectorInstrumentationCookie 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
     259void InspectorInstrumentation::didEvaluateScriptImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     260{
     261    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     262        timelineAgent->didEvaluateScript();
     263}
     264
     265InspectorInstrumentationCookie 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
     274void InspectorInstrumentation::didFireTimerImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     275{
     276    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     277        timelineAgent->didFireTimer();
     278}
     279
     280InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InspectorController* inspectorController)
     281{
     282    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) {
     283        timelineAgent->willLayout();
     284        return timelineAgent->id();
     285    }
     286    return 0;
     287}
     288
     289void InspectorInstrumentation::didLayoutImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     290{
     291    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     292        timelineAgent->didLayout();
     293}
     294
     295InspectorInstrumentationCookie 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
     305void InspectorInstrumentation::didLoadXHRImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     306{
     307    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     308        timelineAgent->didLoadXHR();
     309}
     310
     311InspectorInstrumentationCookie 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
     320void InspectorInstrumentation::didPaintImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     321{
     322    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     323        timelineAgent->didPaint();
     324}
     325
     326InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InspectorController* inspectorController)
     327{
     328    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) {
     329        timelineAgent->willRecalculateStyle();
     330        return timelineAgent->id();
     331    }
     332    return 0;
     333}
     334
     335void InspectorInstrumentation::didRecalculateStyleImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     336{
     337    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     338        timelineAgent->didRecalculateStyle();
     339}
     340
     341InspectorInstrumentationCookie 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
     350void InspectorInstrumentation::didReceiveResourceDataImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     351{
     352    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     353        timelineAgent->didReceiveResourceData();
     354}
     355
     356InspectorInstrumentationCookie 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
     365void InspectorInstrumentation::didReceiveResourceResponseImpl(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     366{
     367    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     368        timelineAgent->didReceiveResourceResponse();
     369}
     370
     371InspectorInstrumentationCookie 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
     380void InspectorInstrumentation::didWriteHTMLImpl(InspectorController* inspectorController, unsigned int endLine, InspectorInstrumentationCookie cookie)
     381{
     382    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController, cookie))
     383        timelineAgent->didWriteHTML(endLine);
     384}
     385
     386
     387bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorController)
     388{
     389    return inspectorController->hasFrontend();
     390}
     391
     392InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController)
     393{
     394    return inspectorController->m_timelineAgent.get();
     395}
     396
     397InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController, InspectorInstrumentationCookie cookie)
     398{
     399    InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController);
     400    if (timelineAgent && timelineAgent->id() == cookie)
     401        return timelineAgent;
     402    return 0;
    206403}
    207404
  • trunk/WebCore/inspector/InspectorInstrumentation.h

    r69014 r69283  
    3333
    3434#include "Document.h"
     35#include "Frame.h"
    3536#include "Page.h"
    3637#include "ScriptExecutionContext.h"
     
    4142class Element;
    4243class InspectorController;
     44class InspectorTimelineAgent;
    4345class Node;
     46class ResourceRequest;
     47class ResourceResponse;
     48class XMLHttpRequest;
     49
     50typedef int InspectorInstrumentationCookie;
    4451
    4552class InspectorInstrumentation {
     
    5259    static void characterDataModified(Document*, CharacterData*);
    5360
    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);
    5892
    5993#if ENABLE(INSPECTOR)
     
    6195    static void frontendDeleted() { s_frontendCounter -= 1; }
    6296    static bool hasFrontends() { return s_frontendCounter; }
     97#else
     98    static bool hasFrontends() { return false; }
    6399#endif
    64100
     
    73109    static void characterDataModifiedImpl(InspectorController*, CharacterData*);
    74110
    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*);
    81144    static InspectorController* inspectorControllerForDocument(Document*);
     145    static InspectorController* inspectorControllerForFrame(Frame*);
    82146    static InspectorController* inspectorControllerForPage(Page*);
     147
     148    static bool hasFrontend(InspectorController*);
     149    static InspectorTimelineAgent* retrieveTimelineAgent(InspectorController*);
     150    static InspectorTimelineAgent* retrieveTimelineAgent(InspectorController*, InspectorInstrumentationCookie);
    83151
    84152    static int s_frontendCounter;
     
    136204}
    137205
    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
     207inline 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
     215inline 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
     223inline 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
     231inline 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
     240inline 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
     249inline 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
     257inline 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
     266inline 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
     274inline 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
     283inline 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
     291inline 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
     300inline 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
     308inline 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
     317inline 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
     325inline 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
     334inline 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
     342inline 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
     351inline 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
     359inline 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
     368inline 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
     376inline 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
     385inline 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
     393inline 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
     402inline 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
     410inline 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
     419inline 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
     427inline 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
     436inline 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
     444inline 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
     453inline 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)
     463inline InspectorController* InspectorInstrumentation::inspectorControllerForContext(ScriptExecutionContext* context)
    165464{
    166465    if (hasFrontends() && context && context->isDocument())
     
    171470inline InspectorController* InspectorInstrumentation::inspectorControllerForDocument(Document* document)
    172471{
    173     if (hasFrontends())
     472    if (hasFrontends() && document)
    174473        return inspectorControllerForPage(document->page());
    175474    return 0;
    176475}
    177476
     477inline InspectorController* InspectorInstrumentation::inspectorControllerForFrame(Frame* frame)
     478{
     479    if (hasFrontends() && frame)
     480        return inspectorControllerForPage(frame->page());
     481    return 0;
     482}
     483
    178484inline InspectorController* InspectorInstrumentation::inspectorControllerForPage(Page* page)
    179485{
    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;
    181493}
    182494#endif
  • trunk/WebCore/inspector/InspectorTimelineAgent.cpp

    r69014 r69283  
    4545namespace WebCore {
    4646
    47 int InspectorTimelineAgent::s_instanceCount = 0;
    4847int InspectorTimelineAgent::s_id = 0;
    4948
     
    5251    , m_id(++s_id)
    5352{
    54     ++s_instanceCount;
    5553    ScriptGCEvent::addEventListener(this);
    5654    ASSERT(m_frontend);
     
    7977InspectorTimelineAgent::~InspectorTimelineAgent()
    8078{
    81     ASSERT(s_instanceCount);
    82     --s_instanceCount;
    8379    ScriptGCEvent::removeEventListener(this);
    8480}
  • trunk/WebCore/inspector/InspectorTimelineAgent.h

    r69014 r69283  
    3434#if ENABLE(INSPECTOR)
    3535
    36 #include "Document.h"
    3736#include "InspectorValues.h"
    38 #include "ScriptExecutionContext.h"
    3937#include "ScriptGCEvent.h"
    4038#include "ScriptGCEventListener.h"
     
    131129    virtual void didGC(double, double, size_t);
    132130
    133     static int instanceCount() { return s_instanceCount; }
    134     static InspectorTimelineAgent* retrieve(ScriptExecutionContext*);
    135 
    136131private:
    137132    struct TimelineRecordEntry {
     
    158153
    159154    Vector<TimelineRecordEntry> m_recordStack;
    160     static int s_instanceCount;
     155
    161156    static int s_id;
    162157    const int m_id;
     
    174169};
    175170
    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 
    183171} // namespace WebCore
    184172
  • trunk/WebCore/loader/ResourceLoader.cpp

    r67553 r69283  
    3737#include "FrameLoader.h"
    3838#include "FrameLoaderClient.h"
    39 #include "InspectorController.h"
    40 #include "InspectorTimelineAgent.h"
     39#include "InspectorInstrumentation.h"
    4140#include "Page.h"
    4241#include "ProgressTracker.h"
     
    402401void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
    403402{
    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);
    411404#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    412405    if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(this, response))
     
    414407#endif
    415408    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);
    423410}
    424411
    425412void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int lengthReceived)
    426413{
    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());
    434415    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);
    442417}
    443418
  • trunk/WebCore/loader/loader.cpp

    r66963 r69283  
    2929#include "CachedResource.h"
    3030#include "CachedResourceLoader.h"
    31 #include "InspectorTimelineAgent.h"
     31#include "InspectorInstrumentation.h"
    3232#include "Frame.h"
    3333#include "FrameLoader.h"
     
    150150    } else {
    151151        // 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());
    159153        scheduleServePendingRequests();
    160154    }
  • trunk/WebCore/page/DOMTimer.cpp

    r67758 r69283  
    2828#include "DOMTimer.h"
    2929
    30 #include "InspectorTimelineAgent.h"
     30#include "InspectorInstrumentation.h"
    3131#include "ScheduledAction.h"
    3232#include "ScriptExecutionContext.h"
     
    8282    DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
    8383
    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);
    8885
    8986    return timer->m_timeoutId;
     
    9895        return;
    9996
    100 #if ENABLE(INSPECTOR)
    101     if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
    102         timelineAgent->didRemoveTimer(timeoutId);
    103 #endif
     97    InspectorInstrumentation::didRemoveTimer(context, timeoutId);
    10498
    10599    delete context->findTimeout(timeoutId);
     
    111105    timerNestingLevel = m_nestingLevel;
    112106
    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);
    117108
    118109    // Simple case for non-one-shot timers.
     
    126117        // No access to member variables after this point, it can delete the timer.
    127118        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
    132122        return;
    133123    }
     
    141131    action->execute(context);
    142132
    143 #if ENABLE(INSPECTOR)
    144     if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
    145         timelineAgent->didFireTimer();
    146 #endif
     133    InspectorInstrumentation::didFireTimer(context, cookie);
    147134
    148135    timerNestingLevel = 0;
  • trunk/WebCore/page/DOMTimer.h

    r67758 r69283  
    3535namespace WebCore {
    3636
    37     class InspectorTimelineAgent;
    38 
    3937    class DOMTimer : public SuspendableTimer {
    4038    public:
  • trunk/WebCore/page/DOMWindow.cpp

    r69262 r69283  
    6363#include "IDBFactoryBackendInterface.h"
    6464#include "InspectorController.h"
    65 #include "InspectorTimelineAgent.h"
     65#include "InspectorInstrumentation.h"
    6666#include "KURL.h"
    6767#include "Location.h"
     
    15231523}
    15241524
    1525 #if ENABLE(INSPECTOR)
    1526 InspectorTimelineAgent* DOMWindow::inspectorTimelineAgent()
    1527 {
    1528     if (frame() && frame()->page())
    1529         return frame()->page()->inspectorTimelineAgent();
    1530     return 0;
    1531 }
    1532 #endif
    1533 
    15341525bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget)
    15351526{
     
    15411532    event->setEventPhase(Event::AT_TARGET);
    15421533
    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);
    15521535
    15531536    bool result = fireEventListeners(event.get());
    15541537
    1555 #if ENABLE(INSPECTOR)
    1556     if (inspectedPage)
    1557         if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent())
    1558             timelineAgent->didDispatchEvent();
    1559 #endif
     1538    InspectorInstrumentation::didDispatchEventOnWindow(frame(), cookie);
    15601539
    15611540    return result;
  • trunk/WebCore/page/DOMWindow.h

    r68222 r69283  
    5858    class History;
    5959    class IDBFactory;
    60     class InspectorTimelineAgent;
    6160    class Location;
    6261    class StyleMedia;
     
    408407        virtual EventTargetData* eventTargetData();
    409408        virtual EventTargetData* ensureEventTargetData();
    410         InspectorTimelineAgent* inspectorTimelineAgent();
    411409
    412410        RefPtr<SecurityOrigin> m_securityOrigin;
  • trunk/WebCore/page/FrameView.cpp

    r68681 r69283  
    4646#include "HTMLNames.h"
    4747#include "HTMLPlugInImageElement.h"
    48 #include "InspectorTimelineAgent.h"
     48#include "InspectorInstrumentation.h"
    4949#include "OverflowEvent.h"
    5050#include "RenderEmbeddedObject.h"
     
    618618        return;
    619619
    620 #if ENABLE(INSPECTOR)   
    621     if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
    622         timelineAgent->willLayout();
    623 #endif
     620    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(m_frame.get());
    624621
    625622    if (!allowSubtree && m_layoutRoot) {
     
    841838    }
    842839
    843 #if ENABLE(INSPECTOR)
    844     if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
    845         timelineAgent->didLayout();
    846 #endif
     840    InspectorInstrumentation::didLayout(m_frame.get(), cookie);
    847841
    848842    m_nestedLayoutCount--;
     
    19331927        return;
    19341928
    1935 #if ENABLE(INSPECTOR)
    1936     if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
    1937         timelineAgent->willPaint(rect);
    1938 #endif
     1929    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_frame.get(), rect);
    19391930
    19401931    Document* document = frame()->document();
     
    20102001        sCurrentPaintTimeStamp = 0;
    20112002
    2012 #if ENABLE(INSPECTOR)
    2013     if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
    2014         timelineAgent->didPaint();
    2015 #endif
     2003    InspectorInstrumentation::didPaint(m_frame.get(), cookie);
    20162004}
    20172005
  • trunk/WebCore/page/FrameView.h

    r67771 r69283  
    2626#define FrameView_h
    2727
    28 #include "Frame.h" // Only used by FrameView::inspectorTimelineAgent()
     28#include "Frame.h"
    2929#include "IntSize.h"
    30 #include "Page.h" // Only used by FrameView::inspectorTimelineAgent()
     30#include "Page.h"
    3131#include "RenderObject.h" // For PaintBehavior
    3232#include "ScrollView.h"
     
    3939class Event;
    4040class FrameViewPrivate;
    41 class InspectorTimelineAgent;
    4241class IntRect;
    4342class Node;
     
    294293    void scrollPositionChanged();
    295294
    296 #if ENABLE(INSPECTOR)
    297     InspectorTimelineAgent* inspectorTimelineAgent() const;
    298 #endif
    299    
    300295    bool hasCustomScrollbars() const;
    301296
     
    387382};
    388383
    389 #if ENABLE(INSPECTOR)
    390 inline InspectorTimelineAgent* FrameView::inspectorTimelineAgent() const
    391 {
    392     return m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0;
    393 }
    394 #endif
    395 
    396384} // namespace WebCore
    397385
  • trunk/WebCore/page/Page.cpp

    r69197 r69283  
    4747#include "HistoryItem.h"
    4848#include "InspectorController.h"
    49 #include "InspectorTimelineAgent.h"
    5049#include "Logging.h"
    5150#include "MediaCanStartListener.h"
     
    842841}
    843842
    844 #if ENABLE(INSPECTOR)
    845 InspectorTimelineAgent* Page::inspectorTimelineAgent() const
    846 {
    847     return m_inspectorController->timelineAgent();
    848 }
    849 #endif
    850 
    851843#if ENABLE(INPUT_SPEECH)
    852844SpeechInput* Page::speechInput()
  • trunk/WebCore/page/Page.h

    r69053 r69283  
    6262    class InspectorClient;
    6363    class InspectorController;
    64     class InspectorTimelineAgent;
    6564    class MediaCanStartListener;
    6665    class Node;
     
    290289        bool javaScriptURLsAreAllowed() const;
    291290
    292 #if ENABLE(INSPECTOR)
    293         InspectorTimelineAgent* inspectorTimelineAgent() const;
    294 #endif
    295 
    296291        // Don't allow more than a certain number of frames in a page.
    297292        // This seems like a reasonable upper bound, and otherwise mutually
  • trunk/WebCore/rendering/RenderLayerBacking.cpp

    r68233 r69283  
    4444#include "HTMLMediaElement.h"
    4545#include "HTMLNames.h"
    46 #include "InspectorTimelineAgent.h"
     46#include "InspectorInstrumentation.h"
    4747#include "KeyframeList.h"
    4848#include "PluginViewBase.h"
     
    10601060}
    10611061
    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 #endif
    1074 
    10751062// Up-call from compositing layer drawing callback.
    10761063void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)
    10771064{
    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);
    10821066
    10831067    // We have to use the same root as for hit testing, because both methods
     
    10991083    paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase, renderer());
    11001084
    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);
    11051086}
    11061087
  • trunk/WebCore/xml/XMLHttpRequest.cpp

    r68124 r69283  
    3636#include "HTTPParsers.h"
    3737#include "InspectorController.h"
    38 #include "InspectorTimelineAgent.h"
     38#include "InspectorInstrumentation.h"
    3939#include "ResourceError.h"
    4040#include "ResourceRequest.h"
     
    304304        return;
    305305
    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);
    312307
    313308    if (m_async || (m_state <= OPENED || m_state == DONE))
    314309        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
    315310
    316 #if ENABLE(INSPECTOR)
    317     if (callTimelineAgentOnReadyStateChange && (timelineAgent = InspectorTimelineAgent::retrieve(scriptExecutionContext())))
    318         timelineAgent->didChangeXHRReadyState();
    319 #endif
     311    InspectorInstrumentation::didChangeXHRReadyState(scriptExecutionContext(), cookie);
    320312
    321313    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);
    329315        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);
    335317    }
    336318}
Note: See TracChangeset for help on using the changeset viewer.