Changeset 80332 in webkit


Ignore:
Timestamp:
Mar 4, 2011 12:28:36 AM (13 years ago)
Author:
yurys@chromium.org
Message:

2011-03-03 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: AppCache agent should have same lifetime as InspectorAgent
https://bugs.webkit.org/show_bug.cgi?id=55673

  • inspector/InspectorAgent.cpp: (WebCore::InspectorAgent::InspectorAgent): (WebCore::InspectorAgent::setFrontend): (WebCore::InspectorAgent::disconnectFrontend): (WebCore::InspectorAgent::createFrontendLifetimeAgents): (WebCore::InspectorAgent::releaseFrontendLifetimeAgents): (WebCore::InspectorAgent::didCommitLoad):
  • inspector/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent): (WebCore::InspectorApplicationCacheAgent::setFrontend): (WebCore::InspectorApplicationCacheAgent::clearFrontend):
  • inspector/InspectorApplicationCacheAgent.h:
  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::networkStateChangedImpl): (WebCore::InspectorInstrumentation::updateApplicationCacheStatusImpl):
  • inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorApplicationCacheAgent): (WebCore::InstrumentingAgents::setInspectorApplicationCacheAgent):
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80331 r80332  
     12011-03-03  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: AppCache agent should have same lifetime as InspectorAgent
     6        https://bugs.webkit.org/show_bug.cgi?id=55673
     7
     8        * inspector/InspectorAgent.cpp:
     9        (WebCore::InspectorAgent::InspectorAgent):
     10        (WebCore::InspectorAgent::setFrontend):
     11        (WebCore::InspectorAgent::disconnectFrontend):
     12        (WebCore::InspectorAgent::createFrontendLifetimeAgents):
     13        (WebCore::InspectorAgent::releaseFrontendLifetimeAgents):
     14        (WebCore::InspectorAgent::didCommitLoad):
     15        * inspector/InspectorApplicationCacheAgent.cpp:
     16        (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
     17        (WebCore::InspectorApplicationCacheAgent::setFrontend):
     18        (WebCore::InspectorApplicationCacheAgent::clearFrontend):
     19        * inspector/InspectorApplicationCacheAgent.h:
     20        * inspector/InspectorInstrumentation.cpp:
     21        (WebCore::InspectorInstrumentation::networkStateChangedImpl):
     22        (WebCore::InspectorInstrumentation::updateApplicationCacheStatusImpl):
     23        * inspector/InstrumentingAgents.h:
     24        (WebCore::InstrumentingAgents::inspectorApplicationCacheAgent):
     25        (WebCore::InstrumentingAgents::setInspectorApplicationCacheAgent):
     26
    1272011-03-03  Brian Weinstein  <bweinstein@apple.com>
    228
  • trunk/Source/WebCore/inspector/InspectorAgent.cpp

    r80239 r80332  
    149149    , m_state(new InspectorState(client))
    150150    , m_timelineAgent(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()))
     151#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     152    , m_applicationCacheAgent(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page))
     153#endif
    151154    , m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), page, m_state.get()))
    152155    , m_consoleAgent(new InspectorConsoleAgent(m_instrumentingAgents.get(), this, m_state.get(), m_injectedScriptHost.get(), m_domAgent.get()))
     
    366369    createFrontendLifetimeAgents();
    367370
     371#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     372    m_applicationCacheAgent->setFrontend(m_frontend);
     373#endif
    368374    m_domAgent->setFrontend(m_frontend);
    369375    m_consoleAgent->setFrontend(m_frontend);
     
    407413    m_profilerAgent->clearFrontend();
    408414    m_profilerAgent->stopUserInitiatedProfiling(true);
     415#endif
     416#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     417    m_applicationCacheAgent->clearFrontend();
    409418#endif
    410419
     
    427436{
    428437    m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get());
    429 
    430 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    431     m_applicationCacheAgent = new InspectorApplicationCacheAgent(m_inspectedPage->mainFrame()->loader()->documentLoader(), m_frontend);
    432 #endif
    433438}
    434439
     
    436441{
    437442    m_runtimeAgent.clear();
    438 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    439     m_applicationCacheAgent.clear();
    440 #endif
    441443}
    442444
     
    519521        if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
    520522            timelineAgent->didCommitLoad();
    521 
    522 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    523         if (m_applicationCacheAgent)
    524             m_applicationCacheAgent->didCommitLoad(loader);
    525 #endif
    526523
    527524#if ENABLE(JAVASCRIPT_DEBUGGER)
  • trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp

    r80204 r80332  
    3636#include "InspectorFrontend.h"
    3737#include "InspectorValues.h"
     38#include "InstrumentingAgents.h"
    3839#include "NetworkStateNotifier.h"
    3940#include "Page.h"
     
    4243namespace WebCore {
    4344
    44 InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(DocumentLoader* documentLoader, InspectorFrontend* frontend)
    45     : m_documentLoader(documentLoader)
    46     , m_frontend(frontend->applicationcache())
     45InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents* instrumentingAgents, Page* inspectedPage)
     46    : m_instrumentingAgents(instrumentingAgents)
     47    , m_inspectedPage(inspectedPage)
     48    , m_frontend(0)
    4749{
    4850}
    4951
    50 void InspectorApplicationCacheAgent::didCommitLoad(DocumentLoader* documentLoader)
     52void InspectorApplicationCacheAgent::setFrontend(InspectorFrontend* frontend)
    5153{
    52     m_documentLoader = documentLoader;
     54    m_frontend = frontend->applicationcache();
     55    m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
     56}
     57
     58void InspectorApplicationCacheAgent::clearFrontend()
     59{
     60    m_instrumentingAgents->setInspectorApplicationCacheAgent(0);
     61    m_frontend = 0;
    5362}
    5463
     
    6776void InspectorApplicationCacheAgent::getApplicationCaches(ErrorString*, RefPtr<InspectorValue>* applicationCaches)
    6877{
    69     if (m_documentLoader) {
    70         ApplicationCacheHost* host = m_documentLoader->applicationCacheHost();
    71         ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
     78    DocumentLoader* documentLoader = m_inspectedPage->mainFrame()->loader()->documentLoader();
     79    if (!documentLoader)
     80        return;
     81    ApplicationCacheHost* host = documentLoader->applicationCacheHost();
     82    ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
    7283
    73         ApplicationCacheHost::ResourceInfoList resources;
    74         host->fillResourceList(&resources);
    75         *applicationCaches = buildObjectForApplicationCache(resources, info);
    76     }
     84    ApplicationCacheHost::ResourceInfoList resources;
     85    host->fillResourceList(&resources);
     86    *applicationCaches = buildObjectForApplicationCache(resources, info);
    7787}
    7888
  • trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.h

    r80204 r80332  
    3535namespace WebCore {
    3636
    37 class DocumentLoader;
    3837class Frame;
    3938class InspectorArray;
     
    4241class InspectorObject;
    4342class InspectorValue;
     43class InstrumentingAgents;
     44class Page;
    4445class ResourceResponse;
    4546
     
    4950    WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
    5051public:
    51     InspectorApplicationCacheAgent(DocumentLoader*, InspectorFrontend*);
     52    InspectorApplicationCacheAgent(InstrumentingAgents*, Page*);
    5253    ~InspectorApplicationCacheAgent() { }
    5354
    54     void didCommitLoad(DocumentLoader*);
     55    void setFrontend(InspectorFrontend*);
     56    void clearFrontend();
    5557
    5658    // Backend to Frontend
     
    6668    PassRefPtr<InspectorObject> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
    6769
    68     DocumentLoader* m_documentLoader;
     70    InstrumentingAgents* m_instrumentingAgents;
     71    Page* m_inspectedPage;
    6972    InspectorFrontend::ApplicationCache* m_frontend;
    7073};
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r80239 r80332  
    655655void InspectorInstrumentation::networkStateChangedImpl(InspectorAgent* inspectorAgent)
    656656{
    657     if (InspectorApplicationCacheAgent* applicationCacheAgent = inspectorAgent->applicationCacheAgent())
     657    if (InspectorApplicationCacheAgent* applicationCacheAgent = inspectorAgent->instrumentingAgents()->inspectorApplicationCacheAgent())
    658658        applicationCacheAgent->networkStateChanged();
    659659}
     
    661661void InspectorInstrumentation::updateApplicationCacheStatusImpl(InspectorAgent* inspectorAgent, Frame* frame)
    662662{
    663     if (InspectorApplicationCacheAgent* applicationCacheAgent = inspectorAgent->applicationCacheAgent())
     663    if (InspectorApplicationCacheAgent* applicationCacheAgent = inspectorAgent->instrumentingAgents()->inspectorApplicationCacheAgent())
    664664        applicationCacheAgent->updateApplicationCacheStatus(frame);
    665665}
  • trunk/Source/WebCore/inspector/InstrumentingAgents.h

    r79217 r80332  
    3737namespace WebCore {
    3838
     39class InspectorApplicationCacheAgent;
    3940class InspectorBrowserDebuggerAgent;
    4041class InspectorConsoleAgent;
     
    5556    InstrumentingAgents()
    5657        : m_inspectorBrowserDebuggerAgent(0)
     58#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     59        , m_inspectorApplicationCacheAgent(0)
     60#endif
    5761        , m_inspectorConsoleAgent(0)
    5862        , m_inspectorDOMAgent(0)
     
    7074    InspectorBrowserDebuggerAgent* inspectorBrowserDebuggerAgent() const { return m_inspectorBrowserDebuggerAgent; }
    7175    void setInspectorBrowserDebuggerAgent(InspectorBrowserDebuggerAgent* agent) { m_inspectorBrowserDebuggerAgent = agent; }
     76
     77#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     78    InspectorApplicationCacheAgent* inspectorApplicationCacheAgent() const { return m_inspectorApplicationCacheAgent; }
     79    void setInspectorApplicationCacheAgent(InspectorApplicationCacheAgent* agent) { m_inspectorApplicationCacheAgent = agent; }
     80#endif
    7281
    7382    InspectorConsoleAgent* inspectorConsoleAgent() const { return m_inspectorConsoleAgent; }
     
    103112private:
    104113    InspectorBrowserDebuggerAgent* m_inspectorBrowserDebuggerAgent;
     114#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     115    InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent;
     116#endif
    105117    InspectorConsoleAgent* m_inspectorConsoleAgent;
    106118    InspectorDOMAgent* m_inspectorDOMAgent;
Note: See TracChangeset for help on using the changeset viewer.