Changeset 83975 in webkit


Ignore:
Timestamp:
Apr 15, 2011 8:15:42 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-04-15 Sergey Vorobyev <sergeyvorobyev@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: Network events don't preserves,
when inspector frontend closed and open again
https://bugs.webkit.org/show_bug.cgi?id=58064

Added InspectorFrontendProxy and EventsCollector.
They allow captured messages from InspectorResourceAgent
to frontend (or mockFrontend if frontend disabled) and
push collected data when frontend reconnect.
This functionality is disabled by default.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • inspector/EventsCollector.cpp: Added. (WebCore::EventsCollector::EventsCollector): (WebCore::EventsCollector::addEvent): (WebCore::EventsCollector::sendCollectedEvents):
  • inspector/EventsCollector.h: Added. (WebCore::EventsCollector::~EventsCollector):
  • inspector/Inspector.json:
  • inspector/InspectorFrontendProxy.cpp: Added. (WebCore::InspectorFrontendProxy::InspectorFrontendProxy): (WebCore::InspectorFrontendProxy::setInspectorFrontendChannel): (WebCore::InspectorFrontendProxy::setEventsCollector): (WebCore::InspectorFrontendProxy::sendMessageToFrontend):
  • inspector/InspectorFrontendProxy.h: Added. (WebCore::InspectorFrontendProxy::~InspectorFrontendProxy):
  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl): (WebCore::InspectorInstrumentation::loadEventFiredImpl):
  • inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveContentLength): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket):
  • inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::setFrontend): (WebCore::InspectorResourceAgent::resourceContent): (WebCore::InspectorResourceAgent::~InspectorResourceAgent): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::domContentEventFired): (WebCore::InspectorResourceAgent::loadEventFired): (WebCore::InspectorResourceAgent::enabledBackgoundEventsCoollection): (WebCore::InspectorResourceAgent::enable): (WebCore::InspectorResourceAgent::InspectorResourceAgent):
  • inspector/InspectorResourceAgent.h:
  • inspector/front-end/NetworkManager.js: (WebInspector.NetworkDispatcher.prototype.domContentEventFired): (WebInspector.NetworkDispatcher.prototype.loadEventFired):
  • inspector/front-end/inspector.js: (WebInspector.domContentEventFired): (WebInspector.loadEventFired):
Location:
trunk/Source/WebCore
Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r83952 r83975  
    889889    inspector/ConsoleMessage.cpp
    890890    inspector/DOMNodeHighlighter.cpp
     891    inspector/EventsCollector.cpp
    891892    inspector/InjectedScript.cpp
    892893    inspector/InjectedScriptHost.cpp
     
    908909    inspector/InspectorFrontendClientLocal.cpp
    909910    inspector/InspectorFrontendHost.cpp
     911    inspector/InspectorFrontendProxy.cpp
    910912    inspector/InspectorInstrumentation.cpp
    911913    inspector/InspectorProfilerAgent.cpp
  • trunk/Source/WebCore/ChangeLog

    r83973 r83975  
     12011-04-15  Sergey Vorobyev  <sergeyvorobyev@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: Network events don't preserves,
     6        when inspector frontend closed and open again
     7        https://bugs.webkit.org/show_bug.cgi?id=58064
     8
     9        Added InspectorFrontendProxy and EventsCollector.
     10        They allow captured messages from InspectorResourceAgent
     11        to frontend (or mockFrontend if frontend disabled) and
     12        push collected data when frontend reconnect.
     13        This functionality is disabled by default.
     14
     15        * CMakeLists.txt:
     16        * GNUmakefile.list.am:
     17        * WebCore.gypi:
     18        * WebCore.pro:
     19        * WebCore.vcproj/WebCore.vcproj:
     20        * WebCore.xcodeproj/project.pbxproj:
     21        * inspector/EventsCollector.cpp: Added.
     22        (WebCore::EventsCollector::EventsCollector):
     23        (WebCore::EventsCollector::addEvent):
     24        (WebCore::EventsCollector::sendCollectedEvents):
     25        * inspector/EventsCollector.h: Added.
     26        (WebCore::EventsCollector::~EventsCollector):
     27        * inspector/Inspector.json:
     28        * inspector/InspectorFrontendProxy.cpp: Added.
     29        (WebCore::InspectorFrontendProxy::InspectorFrontendProxy):
     30        (WebCore::InspectorFrontendProxy::setInspectorFrontendChannel):
     31        (WebCore::InspectorFrontendProxy::setEventsCollector):
     32        (WebCore::InspectorFrontendProxy::sendMessageToFrontend):
     33        * inspector/InspectorFrontendProxy.h: Added.
     34        (WebCore::InspectorFrontendProxy::~InspectorFrontendProxy):
     35        * inspector/InspectorInstrumentation.cpp:
     36        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
     37        (WebCore::InspectorInstrumentation::loadEventFiredImpl):
     38        * inspector/InspectorInstrumentation.h:
     39        (WebCore::InspectorInstrumentation::willSendRequest):
     40        (WebCore::InspectorInstrumentation::willReceiveResourceResponse):
     41        (WebCore::InspectorInstrumentation::didReceiveContentLength):
     42        (WebCore::InspectorInstrumentation::didFinishLoading):
     43        (WebCore::InspectorInstrumentation::domContentLoadedEventFired):
     44        (WebCore::InspectorInstrumentation::loadEventFired):
     45        (WebCore::InspectorInstrumentation::frameDetachedFromParent):
     46        (WebCore::InspectorInstrumentation::didCreateWebSocket):
     47        (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
     48        (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
     49        (WebCore::InspectorInstrumentation::didCloseWebSocket):
     50        * inspector/InspectorResourceAgent.cpp:
     51        (WebCore::InspectorResourceAgent::setFrontend):
     52        (WebCore::InspectorResourceAgent::resourceContent):
     53        (WebCore::InspectorResourceAgent::~InspectorResourceAgent):
     54        (WebCore::InspectorResourceAgent::didReceiveResponse):
     55        (WebCore::InspectorResourceAgent::domContentEventFired):
     56        (WebCore::InspectorResourceAgent::loadEventFired):
     57        (WebCore::InspectorResourceAgent::enabledBackgoundEventsCoollection):
     58        (WebCore::InspectorResourceAgent::enable):
     59        (WebCore::InspectorResourceAgent::InspectorResourceAgent):
     60        * inspector/InspectorResourceAgent.h:
     61        * inspector/front-end/NetworkManager.js:
     62        (WebInspector.NetworkDispatcher.prototype.domContentEventFired):
     63        (WebInspector.NetworkDispatcher.prototype.loadEventFired):
     64        * inspector/front-end/inspector.js:
     65        (WebInspector.domContentEventFired):
     66        (WebInspector.loadEventFired):
     67
    1682011-04-15  Alexis Menard  <alexis.menard@openbossa.org>
    269
  • trunk/Source/WebCore/GNUmakefile.list.am

    r83945 r83975  
    19221922        Source/WebCore/inspector/DOMNodeHighlighter.cpp \
    19231923        Source/WebCore/inspector/DOMNodeHighlighter.h \
     1924        Source/WebCore/inspector/EventsCollector.cpp \
     1925        Source/WebCore/inspector/EventsCollector.h \
    19241926        Source/WebCore/inspector/InjectedScript.cpp \
    19251927        Source/WebCore/inspector/InjectedScript.h \
     
    19621964        Source/WebCore/inspector/InspectorFrontendHost.cpp \
    19631965        Source/WebCore/inspector/InspectorFrontendHost.h \
     1966        Source/WebCore/inspector/InspectorFrontendProxy.cpp \
     1967        Source/WebCore/inspector/InspectorFrontendProxy.h \
    19641968        Source/WebCore/inspector/InspectorInstrumentation.cpp \
    19651969        Source/WebCore/inspector/InspectorInstrumentation.h \
  • trunk/Source/WebCore/WebCore.gypi

    r83884 r83975  
    32123212            'inspector/DOMNodeHighlighter.cpp',
    32133213            'inspector/DOMNodeHighlighter.h',
     3214            'inspector/EventsCollector.cpp',
     3215            'inspector/EventsCollector.h',
    32143216            'inspector/InjectedScript.cpp',
    32153217            'inspector/InjectedScript.h',
     
    32463248            'inspector/InspectorFrontendHost.cpp',
    32473249            'inspector/InspectorFrontendHost.h',
     3250            'inspector/InspectorFrontendProxy.cpp',
     3251            'inspector/InspectorFrontendProxy.h',
    32483252            'inspector/InspectorInstrumentation.cpp',
    32493253            'inspector/InspectorInstrumentation.h',
  • trunk/Source/WebCore/WebCore.pro

    r83884 r83975  
    811811    inspector/ConsoleMessage.cpp \
    812812    inspector/DOMNodeHighlighter.cpp \
     813    inspector/EventsCollector.cpp \
    813814    inspector/InjectedScript.cpp \
    814815    inspector/InjectedScriptHost.cpp \
     
    829830    inspector/InspectorFrontendClientLocal.cpp \
    830831    inspector/InspectorFrontendHost.cpp \
     832    inspector/InspectorFrontendProxy.cpp \
    831833    inspector/InspectorInstrumentation.cpp \
    832834    inspector/InspectorPageAgent.cpp \
     
    17451747    inspector/ConsoleMessage.h \
    17461748    inspector/DOMNodeHighlighter.h \
     1749    inspector/EventsCollector.h \
    17471750    inspector/InjectedScript.h \
    17481751    inspector/InjectedScriptHost.h \
     
    17611764    inspector/InspectorDOMStorageAgent.h \
    17621765    inspector/InspectorDOMStorageResource.h \
     1766    inspector/InspectorFrontendChannel.h \
    17631767    inspector/InspectorFrontendClient.h \
    17641768    inspector/InspectorFrontendClientLocal.h \
    17651769    inspector/InspectorFrontendHost.h \
     1770    inspector/InspectorFrontendProxy.h \
    17661771    inspector/InspectorInstrumentation.h \
    17671772    inspector/InspectorPageAgent.h \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r83884 r83975  
    6660366603                        </File>
    6660466604                        <File
     66605                                RelativePath="..\inspector\EventsCollector.cpp"
     66606                                >
     66607                        </File>
     66608                        <File
     66609                                RelativePath="..\inspector\EventsCollector.h"
     66610                                >
     66611                        </File>
     66612                        <File
    6660566613                                RelativePath="..\inspector\DOMNodeHighlighter.cpp"
    6660666614                                >
     
    6676866776                        <File
    6676966777                                RelativePath="..\inspector\InspectorFrontendHost.h"
     66778                                >
     66779                        </File>
     66780                        <File
     66781                                RelativePath="..\inspector\InspectorFrontendProxy.cpp"
     66782                                >
     66783                        </File>
     66784                        <File
     66785                                RelativePath="..\inspector\InspectorFrontendProxy.h"
    6677066786                                >
    6677166787                        </File>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r83884 r83975  
    647647                20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; };
    648648                227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
     649                22777B4A134A018C008EA455 /* EventsCollector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22777B48134A018C008EA455 /* EventsCollector.cpp */; };
     650                22777B4B134A018C008EA455 /* EventsCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 22777B49134A018C008EA455 /* EventsCollector.h */; settings = {ATTRIBUTES = (Private, ); }; };
     651                22777B4E134A01A8008EA455 /* InspectorFrontendProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22777B4C134A01A8008EA455 /* InspectorFrontendProxy.cpp */; };
     652                22777B4F134A01A8008EA455 /* InspectorFrontendProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 22777B4D134A01A8008EA455 /* InspectorFrontendProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
    649653                22885E641301AE4C00526E68 /* JSDOMImplementationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */; };
    650654                228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */ = {isa = PBXBuildFile; fileRef = 228C284410D82500009D0D0E /* ScriptWrappable.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    70857089                20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; };
    70867090                2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendChannel.h; sourceTree = "<group>"; };
     7091                22777B48134A018C008EA455 /* EventsCollector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventsCollector.cpp; sourceTree = "<group>"; };
     7092                22777B49134A018C008EA455 /* EventsCollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventsCollector.h; sourceTree = "<group>"; };
     7093                22777B4C134A01A8008EA455 /* InspectorFrontendProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontendProxy.cpp; sourceTree = "<group>"; };
     7094                22777B4D134A01A8008EA455 /* InspectorFrontendProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendProxy.h; sourceTree = "<group>"; };
    70877095                22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMImplementationCustom.cpp; sourceTree = "<group>"; };
    70887096                228C284410D82500009D0D0E /* ScriptWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappable.h; sourceTree = "<group>"; };
     
    1322613234                                4F1442261339FD6200E0D6F8 /* DOMNodeHighlighter.cpp */,
    1322713235                                4F1442271339FD6200E0D6F8 /* DOMNodeHighlighter.h */,
     13236                                22777B48134A018C008EA455 /* EventsCollector.cpp */,
     13237                                22777B49134A018C008EA455 /* EventsCollector.h */,
    1322813238                                F3644AFD1119805900E0D537 /* InjectedScript.cpp */,
    1322913239                                F3644AFE1119805900E0D537 /* InjectedScript.h */,
     
    1326913279                                7A0E770C10C00A8800A0276E /* InspectorFrontendHost.h */,
    1327013280                                7A0E770D10C00A8800A0276E /* InspectorFrontendHost.idl */,
     13281                                22777B4C134A01A8008EA455 /* InspectorFrontendProxy.cpp */,
     13282                                22777B4D134A01A8008EA455 /* InspectorFrontendProxy.h */,
    1327113283                                20D629241253690B00081543 /* InspectorInstrumentation.cpp */,
    1327213284                                20D629251253690B00081543 /* InspectorInstrumentation.h */,
     
    2098620998                                8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */,
    2098720999                                E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */,
     21000                                22777B4B134A018C008EA455 /* EventsCollector.h in Headers */,
    2098821001                                E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */,
    2098921002                                BC60D8F30D2A11E000B9918F /* ExceptionBase.h in Headers */,
     
    2133721350                                F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */,
    2133821351                                7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */,
     21352                                22777B4F134A01A8008EA455 /* InspectorFrontendProxy.h in Headers */,
    2133921353                                20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */,
    2134021354                                4F6FDD651341DEDD001F8EE3 /* InspectorPageAgent.h in Headers */,
     
    2383423848                                8F67561C1288B17B0047ACA3 /* EventQueue.cpp in Sources */,
    2383523849                                E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */,
     23850                                22777B4A134A018C008EA455 /* EventsCollector.cpp in Sources */,
    2383623851                                E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */,
    2383723852                                BC60D8F20D2A11E000B9918F /* ExceptionBase.cpp in Sources */,
     
    2414424159                                F344C75811294FF600F26EEE /* InspectorFrontendClientLocal.cpp in Sources */,
    2414524160                                7A0E770E10C00A8800A0276E /* InspectorFrontendHost.cpp in Sources */,
     24161                                22777B4E134A01A8008EA455 /* InspectorFrontendProxy.cpp in Sources */,
    2414624162                                20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */,
    2414724163                                4F6FDD641341DEDD001F8EE3 /* InspectorPageAgent.cpp in Sources */,
  • trunk/Source/WebCore/inspector/Inspector.json

    r83962 r83975  
    433433        ],
    434434        "events": [
     435            {
     436                "name": "domContentEventFired",
     437                "parameters": [
     438                    { "name": "time", "type": "number" }
     439                ]
     440            },
     441            {
     442                "name": "loadEventFired",
     443                "parameters": [
     444                    { "name": "time", "type": "number" }
     445                ]
     446            },
    435447            {
    436448                "name": "frameDetached",
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r83933 r83975  
    526526        timelineAgent->didMarkDOMContentEvent();
    527527
     528    if (InspectorResourceAgent* resourceAgent = inspectorAgent->instrumentingAgents()->inspectorResourceAgent())
     529        resourceAgent->domContentEventFired();
     530
    528531    if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
    529532        pageAgent->domContentEventFired();
     
    543546    if (InspectorTimelineAgent* timelineAgent = inspectorAgent->instrumentingAgents()->inspectorTimelineAgent())
    544547        timelineAgent->didMarkLoadEvent();
     548
     549    if (InspectorResourceAgent* resourceAgent = inspectorAgent->instrumentingAgents()->inspectorResourceAgent())
     550        resourceAgent->loadEventFired();
    545551
    546552    if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r83933 r83975  
    618618{
    619619#if ENABLE(INSPECTOR)
    620     if (InspectorAgent* ic = inspectorAgentWithFrontendForFrame(frame))
     620    if (InspectorAgent* ic = inspectorAgentForFrame(frame))
    621621        willSendRequestImpl(ic, identifier, loader, request, redirectResponse);
    622622#endif
     
    657657{
    658658#if ENABLE(INSPECTOR)
    659     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
     659    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
    660660        return willReceiveResourceResponseImpl(inspectorAgent, identifier, response);
    661661#endif
     
    690690{
    691691#if ENABLE(INSPECTOR)
    692     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
     692    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
    693693        didReceiveContentLengthImpl(inspectorAgent, identifier, dataLength, lengthReceived);
    694694#endif
     
    698698{
    699699#if ENABLE(INSPECTOR)
    700     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
     700    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
    701701        didFinishLoadingImpl(inspectorAgent, identifier, finishTime);
    702702#endif
     
    730730{
    731731#if ENABLE(INSPECTOR)
    732     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
     732    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
    733733        domContentLoadedEventFiredImpl(inspectorAgent, frame, url);
    734734#endif
     
    738738{
    739739#if ENABLE(INSPECTOR)
    740     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
     740    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
    741741        loadEventFiredImpl(inspectorAgent, frame, url);
    742742#endif
     
    746746{
    747747#if ENABLE(INSPECTOR)
    748     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
     748    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
    749749        frameDetachedFromParentImpl(inspectorAgent, frame);
    750750#endif
     
    814814{
    815815#if ENABLE(INSPECTOR)
    816     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
     816    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
    817817        didCreateWebSocketImpl(inspectorAgent, identifier, requestURL, documentURL);
    818818#endif
     
    822822{
    823823#if ENABLE(INSPECTOR)
    824     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
     824    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
    825825        willSendWebSocketHandshakeRequestImpl(inspectorAgent, identifier, request);
    826826#endif
     
    830830{
    831831#if ENABLE(INSPECTOR)
    832     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
     832    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
    833833        didReceiveWebSocketHandshakeResponseImpl(inspectorAgent, identifier, response);
    834834#endif
     
    838838{
    839839#if ENABLE(INSPECTOR)
    840     if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
     840    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
    841841        didCloseWebSocketImpl(inspectorAgent, identifier);
    842842#endif
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r83950 r83975  
    3535
    3636#include "Base64.h"
    37 #include "MemoryCache.h"
    3837#include "CachedResource.h"
    3938#include "CachedResourceLoader.h"
    4039#include "Document.h"
    4140#include "DocumentLoader.h"
     41#include "EventsCollector.h"
    4242#include "Frame.h"
    4343#include "FrameLoader.h"
     
    4646#include "HTTPHeaderMap.h"
    4747#include "InspectorFrontend.h"
     48#include "InspectorFrontendChannel.h"
     49#include "InspectorFrontendProxy.h"
    4850#include "InspectorState.h"
    4951#include "InspectorValues.h"
    5052#include "InstrumentingAgents.h"
    5153#include "KURL.h"
     54#include "MemoryCache.h"
    5255#include "Page.h"
    5356#include "ProgressTracker.h"
     
    8992{
    9093    m_frontend = frontend->network();
     94    if (backgroundEventsCollectionEnabled()) {
     95        // Insert Message Proxy in receiver chain.
     96        InspectorFrontendChannel* client = m_frontend->getInspectorFrontendChannel();
     97        m_inspectorFrontendProxy->setInspectorFrontendChannel(client);
     98        m_frontend->setInspectorFrontendChannel(m_inspectorFrontendProxy.get());
     99        m_eventsCollector->sendCollectedEvents(client);
     100    }
    91101}
    92102
    93103void InspectorResourceAgent::clearFrontend()
    94104{
    95     m_frontend = 0;
     105    if (backgroundEventsCollectionEnabled()) {
     106        m_inspectorFrontendProxy->setInspectorFrontendChannel(0);
     107        m_frontend = m_mockFrontend.get();
     108    } else
     109        m_frontend = 0;
    96110    disable(0);
    97111}
     
    106120{
    107121    if (!frame) {
    108         *errorString = "No frame to get resource content for"; 
     122        *errorString = "No frame to get resource content for";
    109123        return;
    110124    }
     
    286300InspectorResourceAgent::~InspectorResourceAgent()
    287301{
     302    if (m_state->getBoolean(ResourceAgentState::resourceAgentEnabled)) {
     303        ErrorString error;
     304        disable(&error);
     305    }
    288306    ASSERT(!m_instrumentingAgents->inspectorResourceAgent());
    289307}
     
    379397}
    380398
     399void InspectorResourceAgent::domContentEventFired()
     400{
     401    m_frontend->domContentEventFired(currentTime());
     402}
     403
     404void InspectorResourceAgent::loadEventFired()
     405{
     406    m_frontend->loadEventFired(currentTime());
     407}
     408
    381409static PassRefPtr<InspectorObject> buildObjectForFrame(Frame* frame)
    382410{
     
    491519}
    492520
     521bool InspectorResourceAgent::backgroundEventsCollectionEnabled()
     522{
     523    // FIXME (https://bugs.webkit.org/show_bug.cgi?id=58652)
     524    // Add here condition to enable background events collection.
     525    // Now this function is disable.
     526    return false;
     527}
     528
    493529void InspectorResourceAgent::enable(ErrorString*)
    494530{
     
    537573    , m_page(page)
    538574    , m_state(state)
    539     , m_frontend(0)
    540 {
     575{
     576    if (backgroundEventsCollectionEnabled()) {
     577        m_eventsCollector = new EventsCollector();
     578        m_inspectorFrontendProxy = new InspectorFrontendProxy(m_eventsCollector.get());
     579        // Create mock frontend, so we can collect network events.
     580        m_mockFrontend = new InspectorFrontend::Network(m_inspectorFrontendProxy.get());
     581        m_frontend = m_mockFrontend.get();
     582        enable();
     583    } else
     584        m_frontend = 0;
    541585}
    542586
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.h

    r82847 r83975  
    3535#include "PlatformString.h"
    3636
     37#include <wtf/OwnPtr.h>
    3738#include <wtf/PassRefPtr.h>
    3839#include <wtf/Vector.h>
     
    5253class InspectorArray;
    5354class InspectorFrontend;
     55class InspectorFrontendProxy;
    5456class InspectorObject;
    5557class InspectorState;
    5658class InstrumentingAgents;
    5759class KURL;
     60class EventsCollector;
    5861class Page;
    5962class ResourceError;
     
    98101    void setInitialScriptContent(unsigned long identifier, const String& sourceString);
    99102    void setInitialXHRContent(unsigned long identifier, const String& sourceString);
     103    void domContentEventFired();
     104    void loadEventFired();
    100105    void didCommitLoad(DocumentLoader*);
    101106    void frameDetachedFromParent(Frame*);
     
    109114
    110115    Frame* frameForId(const String& frameId);
     116    bool backgroundEventsCollectionEnabled();
    111117
    112118    // Called from frontend
     
    125131    Page* m_page;
    126132    InspectorState* m_state;
     133    OwnPtr<EventsCollector> m_eventsCollector;
    127134    InspectorFrontend::Network* m_frontend;
     135    OwnPtr<InspectorFrontend::Network> m_mockFrontend;
     136    OwnPtr<InspectorFrontendProxy> m_inspectorFrontendProxy;
    128137};
    129138
  • trunk/Source/WebCore/inspector/front-end/NetworkManager.js

    r83950 r83975  
    154154    },
    155155
     156    domContentEventFired: function(time)
     157    {
     158        if (WebInspector.panels.network)
     159            WebInspector.panels.network.mainResourceDOMContentTime = time;
     160    },
     161
     162    loadEventFired: function(time)
     163    {
     164        if (WebInspector.panels.network)
     165            WebInspector.panels.network.mainResourceLoadTime = time;
     166    },
     167
    156168    dataReceived: function(identifier, time, dataLength, lengthReceived)
    157169    {
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r83968 r83975  
    980980{
    981981    this.panels.audits.mainResourceDOMContentTime = time;
    982     if (this.panels.network)
    983         this.panels.network.mainResourceDOMContentTime = time;
    984982    this.mainResourceDOMContentTime = time;
    985983}
     
    988986{
    989987    this.panels.audits.mainResourceLoadTime = time;
    990     this.panels.network.mainResourceLoadTime = time;
    991988    this.panels.resources.loadEventFired();
    992989    this.mainResourceLoadTime = time;
Note: See TracChangeset for help on using the changeset viewer.