OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #include "bindings/core/v8/ScriptCallStackFactory.h" | 35 #include "bindings/core/v8/ScriptCallStackFactory.h" |
36 #include "core/FetchInitiatorTypeNames.h" | 36 #include "core/FetchInitiatorTypeNames.h" |
37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
38 #include "core/dom/ScriptableDocumentParser.h" | 38 #include "core/dom/ScriptableDocumentParser.h" |
39 #include "core/fetch/FetchInitiatorInfo.h" | 39 #include "core/fetch/FetchInitiatorInfo.h" |
40 #include "core/fetch/MemoryCache.h" | 40 #include "core/fetch/MemoryCache.h" |
41 #include "core/fetch/Resource.h" | 41 #include "core/fetch/Resource.h" |
42 #include "core/fetch/ResourceFetcher.h" | 42 #include "core/fetch/ResourceFetcher.h" |
43 #include "core/fetch/ResourceLoader.h" | 43 #include "core/fetch/ResourceLoader.h" |
44 #include "core/frame/LocalFrame.h" | 44 #include "core/frame/LocalFrame.h" |
45 #include "core/inspector/EditedResourcesContentManager.h" | |
45 #include "core/inspector/IdentifiersFactory.h" | 46 #include "core/inspector/IdentifiersFactory.h" |
46 #include "core/inspector/InspectorOverlay.h" | 47 #include "core/inspector/InspectorOverlay.h" |
47 #include "core/inspector/InspectorPageAgent.h" | 48 #include "core/inspector/InspectorPageAgent.h" |
48 #include "core/inspector/InspectorState.h" | 49 #include "core/inspector/InspectorState.h" |
49 #include "core/inspector/InstrumentingAgents.h" | 50 #include "core/inspector/InstrumentingAgents.h" |
50 #include "core/inspector/NetworkResourcesData.h" | 51 #include "core/inspector/NetworkResourcesData.h" |
51 #include "core/inspector/ScriptAsyncCallStack.h" | 52 #include "core/inspector/ScriptAsyncCallStack.h" |
52 #include "core/inspector/ScriptCallStack.h" | 53 #include "core/inspector/ScriptCallStack.h" |
53 #include "core/loader/DocumentLoader.h" | 54 #include "core/loader/DocumentLoader.h" |
54 #include "core/loader/DocumentThreadableLoader.h" | 55 #include "core/loader/DocumentThreadableLoader.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 ErrorString error; | 295 ErrorString error; |
295 disable(&error); | 296 disable(&error); |
296 } | 297 } |
297 ASSERT(!m_instrumentingAgents->inspectorResourceAgent()); | 298 ASSERT(!m_instrumentingAgents->inspectorResourceAgent()); |
298 #endif | 299 #endif |
299 } | 300 } |
300 | 301 |
301 void InspectorResourceAgent::trace(Visitor* visitor) | 302 void InspectorResourceAgent::trace(Visitor* visitor) |
302 { | 303 { |
303 visitor->trace(m_pageAgent); | 304 visitor->trace(m_pageAgent); |
305 visitor->trace(m_editedResourcesContentManager); | |
304 #if ENABLE(OILPAN) | 306 #if ENABLE(OILPAN) |
305 visitor->trace(m_pendingXHRReplayData); | 307 visitor->trace(m_pendingXHRReplayData); |
306 visitor->trace(m_replayXHRs); | 308 visitor->trace(m_replayXHRs); |
307 visitor->trace(m_replayXHRsToBeDeleted); | 309 visitor->trace(m_replayXHRsToBeDeleted); |
308 #endif | 310 #endif |
309 InspectorBaseAgent::trace(visitor); | 311 InspectorBaseAgent::trace(visitor); |
310 } | 312 } |
311 | 313 |
312 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL oader* loader, ResourceRequest& request, const ResourceResponse& redirectRespons e, const FetchInitiatorInfo& initiatorInfo) | 314 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL oader* loader, ResourceRequest& request, const ResourceResponse& redirectRespons e, const FetchInitiatorInfo& initiatorInfo) |
313 { | 315 { |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
838 void InspectorResourceAgent::frameClearedScheduledNavigation(LocalFrame* frame) | 840 void InspectorResourceAgent::frameClearedScheduledNavigation(LocalFrame* frame) |
839 { | 841 { |
840 m_frameNavigationInitiatorMap.remove(m_pageAgent->frameId(frame)); | 842 m_frameNavigationInitiatorMap.remove(m_pageAgent->frameId(frame)); |
841 } | 843 } |
842 | 844 |
843 void InspectorResourceAgent::setHostId(const String& hostId) | 845 void InspectorResourceAgent::setHostId(const String& hostId) |
844 { | 846 { |
845 m_hostId = hostId; | 847 m_hostId = hostId; |
846 } | 848 } |
847 | 849 |
848 bool InspectorResourceAgent::fetchResourceContent(Document* document, const KURL & url, String* content, bool* base64Encoded) | 850 bool InspectorResourceAgent::fetchResourceContent(Document* document, const KURL & url, String* content, bool* base64Encoded) |
vsevik
2014/08/08 11:40:59
This is only used in InspectorStyleSheet. It might
eustas
2014/08/08 14:03:07
Done.
| |
849 { | 851 { |
850 if (m_pageAgent->getEditedResourceContent(url, content)) { | 852 if (m_editedResourcesContentManager->get(url, content)) { |
851 *base64Encoded = false; | 853 *base64Encoded = false; |
852 return true; | 854 return true; |
853 } | 855 } |
854 | 856 |
855 // First try to fetch content from the cached resource. | 857 // First try to fetch content from the cached resource. |
856 Resource* cachedResource = document->fetcher()->cachedResource(url); | 858 Resource* cachedResource = document->fetcher()->cachedResource(url); |
857 if (!cachedResource) | 859 if (!cachedResource) |
858 cachedResource = memoryCache()->resourceForURL(url); | 860 cachedResource = memoryCache()->resourceForURL(url); |
859 if (cachedResource && InspectorPageAgent::cachedResourceContent(cachedResour ce, content, base64Encoded)) | 861 if (cachedResource && InspectorPageAgent::cachedResourceContent(cachedResour ce, content, base64Encoded)) |
860 return true; | 862 return true; |
861 | 863 |
862 // Then fall back to resource data. | 864 // Then fall back to resource data. |
863 Vector<NetworkResourcesData::ResourceData*> resources = m_resourcesData->res ources(); | 865 Vector<NetworkResourcesData::ResourceData*> resources = m_resourcesData->res ources(); |
864 for (Vector<NetworkResourcesData::ResourceData*>::iterator it = resources.be gin(); it != resources.end(); ++it) { | 866 for (Vector<NetworkResourcesData::ResourceData*>::iterator it = resources.be gin(); it != resources.end(); ++it) { |
865 if ((*it)->url() == url) { | 867 if ((*it)->url() == url) { |
866 *content = (*it)->content(); | 868 *content = (*it)->content(); |
867 *base64Encoded = (*it)->base64Encoded(); | 869 *base64Encoded = (*it)->base64Encoded(); |
868 return true; | 870 return true; |
869 } | 871 } |
870 } | 872 } |
871 return false; | 873 return false; |
872 } | 874 } |
873 | 875 |
874 void InspectorResourceAgent::removeFinishedReplayXHRFired(Timer<InspectorResourc eAgent>*) | 876 void InspectorResourceAgent::removeFinishedReplayXHRFired(Timer<InspectorResourc eAgent>*) |
875 { | 877 { |
876 m_replayXHRsToBeDeleted.clear(); | 878 m_replayXHRsToBeDeleted.clear(); |
877 } | 879 } |
878 | 880 |
879 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) | 881 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent, Ed itedResourcesContentManager* editedResourcesContentManager) |
880 : InspectorBaseAgent<InspectorResourceAgent>("Network") | 882 : InspectorBaseAgent<InspectorResourceAgent>("Network") |
881 , m_pageAgent(pageAgent) | 883 , m_pageAgent(pageAgent) |
884 , m_editedResourcesContentManager(editedResourcesContentManager) | |
882 , m_frontend(0) | 885 , m_frontend(0) |
883 , m_resourcesData(adoptPtr(new NetworkResourcesData())) | 886 , m_resourcesData(adoptPtr(new NetworkResourcesData())) |
884 , m_isRecalculatingStyle(false) | 887 , m_isRecalculatingStyle(false) |
885 , m_removeFinishedReplayXHRTimer(this, &InspectorResourceAgent::removeFinish edReplayXHRFired) | 888 , m_removeFinishedReplayXHRTimer(this, &InspectorResourceAgent::removeFinish edReplayXHRFired) |
886 { | 889 { |
887 } | 890 } |
888 | 891 |
889 } // namespace blink | 892 } // namespace blink |
OLD | NEW |