Changeset 91006 in webkit


Ignore:
Timestamp:
Jul 14, 2011 9:59:11 AM (13 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: InspectorResourceAgent should generate unique identifier and save cachedResource for resources from memory cache.
https://bugs.webkit.org/show_bug.cgi?id=64356

Reviewed by Yury Semikhatsky.

  • inspector/Inspector.json:
  • inspector/InspectorInstrumentation.cpp:

(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):

  • inspector/InspectorInstrumentation.h:

(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):

  • inspector/InspectorResourceAgent.cpp:

(WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):

  • inspector/InspectorResourceAgent.h:
  • inspector/front-end/NetworkManager.js:

(WebInspector.NetworkManager.prototype.requestContent):
(WebInspector.NetworkDispatcher):
(WebInspector.NetworkDispatcher.prototype.resourceLoadedFromMemoryCache):
(WebInspector.NetworkDispatcher.prototype._appendRedirect):

  • inspector/front-end/NetworkPanel.js:

(WebInspector.NetworkLogView.prototype._frameNavigated):

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::loadedResourceFromMemoryCache):

  • loader/FrameLoader.h:
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91005 r91006  
     12011-07-14  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: InspectorResourceAgent should generate unique identifier and save cachedResource for resources from memory cache.
     4        https://bugs.webkit.org/show_bug.cgi?id=64356
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/Inspector.json:
     9        * inspector/InspectorInstrumentation.cpp:
     10        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
     11        * inspector/InspectorInstrumentation.h:
     12        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
     13        * inspector/InspectorResourceAgent.cpp:
     14        (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
     15        * inspector/InspectorResourceAgent.h:
     16        * inspector/front-end/NetworkManager.js:
     17        (WebInspector.NetworkManager.prototype.requestContent):
     18        (WebInspector.NetworkDispatcher):
     19        (WebInspector.NetworkDispatcher.prototype.resourceLoadedFromMemoryCache):
     20        (WebInspector.NetworkDispatcher.prototype._appendRedirect):
     21        * inspector/front-end/NetworkPanel.js:
     22        (WebInspector.NetworkLogView.prototype._frameNavigated):
     23        * loader/FrameLoader.cpp:
     24        (WebCore::FrameLoader::loadedResourceFromMemoryCache):
     25        * loader/FrameLoader.h:
     26
    1272011-07-14  Tim Horton  <timothy_horton@apple.com>
    228
  • trunk/Source/WebCore/inspector/Inspector.json

    r90626 r91006  
    574574                "description": "Fired when HTTP request has been served from memory cache.",
    575575                "parameters": [
     576                    { "name": "identifier", "type": "integer", "description": "Request identifier." },
    576577                    { "name": "frameId", "type": "string", "description": "Frame identifier." },
    577578                    { "name": "loaderId", "type": "string", "description": "Loader identifier." },
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r90544 r91006  
    423423}
    424424
    425 void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader, const CachedResource* cachedResource)
     425void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader, CachedResource* cachedResource)
    426426{
    427427    InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r90389 r91006  
    119119    static void continueAfterPingLoader(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
    120120    static void markResourceAsCached(Page*, unsigned long identifier);
    121     static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, const CachedResource*);
     121    static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
    122122    static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier);
    123123    static void didReceiveResourceData(const InspectorInstrumentationCookie&);
     
    246246    static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
    247247    static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
    248     static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, const CachedResource*);
     248    static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
    249249    static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier);
    250250    static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
     
    697697}
    698698
    699 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, const CachedResource* resource)
     699inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
    700700{
    701701#if ENABLE(INSPECTOR)
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r90553 r91006  
    5252#include "KURL.h"
    5353#include "NetworkResourcesData.h"
     54#include "Page.h"
    5455#include "ProgressTracker.h"
    5556#include "ResourceError.h"
     
    292293}
    293294
    294 void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* loader, const CachedResource* resource)
    295 {
    296     m_frontend->resourceLoadedFromMemoryCache(m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), currentTime(), buildObjectForCachedResource(*resource));
     295void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* loader, CachedResource* resource)
     296{
     297    String loaderId = m_pageAgent->loaderId(loader);
     298    String frameId = m_pageAgent->frameId(loader->frame());
     299    unsigned long identifier = loader->frame()->page()->progress()->createUniqueIdentifier();
     300    m_resourcesData->resourceCreated(identifier, loaderId);
     301    m_resourcesData->addCachedResource(identifier, resource);
     302
     303    m_frontend->resourceLoadedFromMemoryCache(static_cast<int>(identifier), frameId, loaderId, loader->url().string(), currentTime(), buildObjectForCachedResource(*resource));
    297304}
    298305
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.h

    r90553 r91006  
    9595    void didFinishLoading(unsigned long identifier, DocumentLoader*, double finishTime);
    9696    void didFailLoading(unsigned long identifier, DocumentLoader*, const ResourceError&);
    97     void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
     97    void didLoadResourceFromMemoryCache(DocumentLoader*, CachedResource*);
    9898    void mainFrameNavigated(DocumentLoader*);
    9999    void setInitialScriptContent(unsigned long identifier, const String& sourceString);
  • trunk/Source/WebCore/inspector/front-end/NetworkManager.js

    r90913 r91006  
    5454        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=61363 We should separate NetworkResource (NetworkPanel resource)
    5555        // from ResourceRevision (ResourcesPanel/ScriptsPanel resource) and request content accordingly.
    56         if (resource.hasNetworkData)
     56        if (resource.identifier && !resource.networkDataRemoved)
    5757            NetworkAgent.getResourceContent(resource.identifier, callbackWrapper);
    5858        else
     
    7373    this._inflightResourcesById = {};
    7474    this._inflightResourcesByURL = {};
    75     this._lastIdentifierForCachedResource = 0;
    7675    InspectorBackend.registerDomainDispatcher("Network", this);
    7776}
     
    205204    },
    206205
    207     resourceLoadedFromMemoryCache: function(frameId, loaderId, documentURL, time, cachedResource)
    208     {
    209         var resource = this._createResource("cached:" + ++this._lastIdentifierForCachedResource, frameId, loaderId, cachedResource.url, documentURL);
     206    resourceLoadedFromMemoryCache: function(identifier, frameId, loaderId, documentURL, time, cachedResource)
     207    {
     208        var resource = this._createResource(identifier, frameId, loaderId, cachedResource.url, documentURL);
    210209        this._updateResourceWithCachedResource(resource, cachedResource);
    211210        resource.cached = true;
     
    277276        originalResource.identifier = "redirected:" + identifier + "." + previousRedirects.length;
    278277        delete originalResource.redirects;
    279         originalResource.hasNetworkData = false;
     278        originalResource.networkDataRemoved = true;
    280279        this._finishResource(originalResource, time);
    281280        var newResource = this._createResource(identifier, originalResource.frameId, originalResource.loaderId,
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r90913 r91006  
    758758                var resource = this._resources[i];
    759759                if (resource.loaderId !== loaderId)
    760                     resource.hasNetworkData = false;
     760                    originalResource.networkDataRemoved = true;
    761761            }
    762762            return;
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r90936 r91006  
    28602860}
    28612861
    2862 void FrameLoader::loadedResourceFromMemoryCache(const CachedResource* resource)
     2862void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource)
    28632863{
    28642864    Page* page = m_frame->page();
  • trunk/Source/WebCore/loader/FrameLoader.h

    r90164 r91006  
    178178    void didFirstVisuallyNonEmptyLayout();
    179179
    180     void loadedResourceFromMemoryCache(const CachedResource*);
     180    void loadedResourceFromMemoryCache(CachedResource*);
    181181    void tellClientAboutPastMemoryCacheLoads();
    182182
Note: See TracChangeset for help on using the changeset viewer.