| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "core/fileapi/FileReaderLoaderClient.h" | 45 #include "core/fileapi/FileReaderLoaderClient.h" |
| 46 #include "core/frame/FrameHost.h" | 46 #include "core/frame/FrameHost.h" |
| 47 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
| 48 #include "core/html/HTMLFrameOwnerElement.h" | 48 #include "core/html/HTMLFrameOwnerElement.h" |
| 49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
| 50 #include "core/inspector/ConsoleMessageStorage.h" | 50 #include "core/inspector/ConsoleMessageStorage.h" |
| 51 #include "core/inspector/IdentifiersFactory.h" | 51 #include "core/inspector/IdentifiersFactory.h" |
| 52 #include "core/inspector/InspectorIdentifiers.h" | 52 #include "core/inspector/InspectorIdentifiers.h" |
| 53 #include "core/inspector/InspectorOverlay.h" | 53 #include "core/inspector/InspectorOverlay.h" |
| 54 #include "core/inspector/InspectorPageAgent.h" | 54 #include "core/inspector/InspectorPageAgent.h" |
| 55 #include "core/inspector/InspectorResolver.h" |
| 55 #include "core/inspector/InspectorState.h" | 56 #include "core/inspector/InspectorState.h" |
| 56 #include "core/inspector/InstrumentingAgents.h" | 57 #include "core/inspector/InstrumentingAgents.h" |
| 57 #include "core/inspector/NetworkResourcesData.h" | 58 #include "core/inspector/NetworkResourcesData.h" |
| 58 #include "core/inspector/ScriptAsyncCallStack.h" | 59 #include "core/inspector/ScriptAsyncCallStack.h" |
| 59 #include "core/inspector/ScriptCallStack.h" | 60 #include "core/inspector/ScriptCallStack.h" |
| 60 #include "core/loader/DocumentLoader.h" | 61 #include "core/loader/DocumentLoader.h" |
| 61 #include "core/loader/FrameLoader.h" | 62 #include "core/loader/FrameLoader.h" |
| 62 #include "core/loader/ThreadableLoaderClient.h" | 63 #include "core/loader/ThreadableLoaderClient.h" |
| 63 #include "core/page/Page.h" | 64 #include "core/page/Page.h" |
| 64 #include "core/xmlhttprequest/XMLHttpRequest.h" | 65 #include "core/xmlhttprequest/XMLHttpRequest.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (m_state->getBoolean(ResourceAgentState::resourceAgentEnabled)) { | 302 if (m_state->getBoolean(ResourceAgentState::resourceAgentEnabled)) { |
| 302 ErrorString error; | 303 ErrorString error; |
| 303 disable(&error); | 304 disable(&error); |
| 304 } | 305 } |
| 305 ASSERT(!m_instrumentingAgents->inspectorResourceAgent()); | 306 ASSERT(!m_instrumentingAgents->inspectorResourceAgent()); |
| 306 #endif | 307 #endif |
| 307 } | 308 } |
| 308 | 309 |
| 309 DEFINE_TRACE(InspectorResourceAgent) | 310 DEFINE_TRACE(InspectorResourceAgent) |
| 310 { | 311 { |
| 311 visitor->trace(m_pageAgent); | 312 visitor->trace(m_inspectedFrame); |
| 312 #if ENABLE(OILPAN) | 313 #if ENABLE(OILPAN) |
| 313 visitor->trace(m_pendingXHRReplayData); | 314 visitor->trace(m_pendingXHRReplayData); |
| 314 visitor->trace(m_replayXHRs); | 315 visitor->trace(m_replayXHRs); |
| 315 visitor->trace(m_replayXHRsToBeDeleted); | 316 visitor->trace(m_replayXHRsToBeDeleted); |
| 316 #endif | 317 #endif |
| 317 InspectorBaseAgent::trace(visitor); | 318 InspectorBaseAgent::trace(visitor); |
| 318 } | 319 } |
| 319 | 320 |
| 320 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
oader* loader, ResourceRequest& request, const ResourceResponse& redirectRespons
e, const FetchInitiatorInfo& initiatorInfo) | 321 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
oader* loader, ResourceRequest& request, const ResourceResponse& redirectRespons
e, const FetchInitiatorInfo& initiatorInfo) |
| 321 { | 322 { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 { | 537 { |
| 537 m_pendingXHRReplayData.remove(client); | 538 m_pendingXHRReplayData.remove(client); |
| 538 | 539 |
| 539 // See comments on |didFailXHRLoading| for why we are delaying delete. | 540 // See comments on |didFailXHRLoading| for why we are delaying delete. |
| 540 delayedRemoveReplayXHR(xhr); | 541 delayedRemoveReplayXHR(xhr); |
| 541 | 542 |
| 542 if (m_state->getBoolean(ResourceAgentState::monitoringXHR)) { | 543 if (m_state->getBoolean(ResourceAgentState::monitoringXHR)) { |
| 543 String message = "XHR finished loading: " + method + " \"" + url + "\"."
; | 544 String message = "XHR finished loading: " + method + " \"" + url + "\"."
; |
| 544 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea
te(NetworkMessageSource, DebugMessageLevel, message); | 545 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea
te(NetworkMessageSource, DebugMessageLevel, message); |
| 545 consoleMessage->setRequestIdentifier(identifier); | 546 consoleMessage->setRequestIdentifier(identifier); |
| 546 m_pageAgent->frameHost()->consoleMessageStorage().reportMessage(context,
consoleMessage.release()); | 547 m_inspectedFrame->host()->consoleMessageStorage().reportMessage(context,
consoleMessage.release()); |
| 547 } | 548 } |
| 548 } | 549 } |
| 549 | 550 |
| 550 void InspectorResourceAgent::willSendEventSourceRequest(ThreadableLoaderClient*
eventSource) | 551 void InspectorResourceAgent::willSendEventSourceRequest(ThreadableLoaderClient*
eventSource) |
| 551 { | 552 { |
| 552 m_pendingEventSource = eventSource; | 553 m_pendingEventSource = eventSource; |
| 553 } | 554 } |
| 554 | 555 |
| 555 void InspectorResourceAgent::willDispachEventSourceEvent(ThreadableLoaderClient*
eventSource, const AtomicString& eventName, const AtomicString& eventId, const
Vector<UChar>& data) | 556 void InspectorResourceAgent::willDispachEventSourceEvent(ThreadableLoaderClient*
eventSource, const AtomicString& eventName, const AtomicString& eventId, const
Vector<UChar>& data) |
| 556 { | 557 { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 { | 729 { |
| 729 m_state->setObject(ResourceAgentState::extraRequestHeaders, headers); | 730 m_state->setObject(ResourceAgentState::extraRequestHeaders, headers); |
| 730 } | 731 } |
| 731 | 732 |
| 732 bool InspectorResourceAgent::getResponseBodyBlob(const String& requestId, PassRe
fPtrWillBeRawPtr<GetResponseBodyCallback> callback) | 733 bool InspectorResourceAgent::getResponseBodyBlob(const String& requestId, PassRe
fPtrWillBeRawPtr<GetResponseBodyCallback> callback) |
| 733 { | 734 { |
| 734 NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->da
ta(requestId); | 735 NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->da
ta(requestId); |
| 735 if (!resourceData) | 736 if (!resourceData) |
| 736 return false; | 737 return false; |
| 737 if (BlobDataHandle* blob = resourceData->downloadedFileBlob()) { | 738 if (BlobDataHandle* blob = resourceData->downloadedFileBlob()) { |
| 738 if (LocalFrame* frame = m_pageAgent->frameForId(resourceData->frameId())
) { | 739 if (LocalFrame* frame = InspectorResolver::resolveFrame(m_inspectedFrame
, resourceData->frameId())) { |
| 739 if (Document* document = frame->document()) { | 740 if (Document* document = frame->document()) { |
| 740 InspectorFileReaderLoaderClient* client = new InspectorFileReade
rLoaderClient(blob, InspectorPageAgent::createResourceTextDecoder(resourceData->
mimeType(), resourceData->textEncodingName()), callback); | 741 InspectorFileReaderLoaderClient* client = new InspectorFileReade
rLoaderClient(blob, InspectorPageAgent::createResourceTextDecoder(resourceData->
mimeType(), resourceData->textEncodingName()), callback); |
| 741 client->start(document); | 742 client->start(document); |
| 742 return true; | 743 return true; |
| 743 } | 744 } |
| 744 } | 745 } |
| 745 } | 746 } |
| 746 return false; | 747 return false; |
| 747 } | 748 } |
| 748 | 749 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 void InspectorResourceAgent::canClearBrowserCookies(ErrorString*, bool* result) | 835 void InspectorResourceAgent::canClearBrowserCookies(ErrorString*, bool* result) |
| 835 { | 836 { |
| 836 *result = true; | 837 *result = true; |
| 837 } | 838 } |
| 838 | 839 |
| 839 void InspectorResourceAgent::setCacheDisabled(ErrorString*, bool cacheDisabled) | 840 void InspectorResourceAgent::setCacheDisabled(ErrorString*, bool cacheDisabled) |
| 840 { | 841 { |
| 841 m_state->setBoolean(ResourceAgentState::cacheDisabled, cacheDisabled); | 842 m_state->setBoolean(ResourceAgentState::cacheDisabled, cacheDisabled); |
| 842 if (cacheDisabled) | 843 if (cacheDisabled) |
| 843 memoryCache()->evictResources(); | 844 memoryCache()->evictResources(); |
| 844 for (Frame* frame = m_pageAgent->inspectedFrame(); frame; frame = frame->tre
e().traverseNext()) { | 845 for (Frame* frame = m_inspectedFrame; frame; frame = frame->tree().traverseN
ext(m_inspectedFrame)) { |
| 845 if (frame->isLocalFrame()) | 846 if (frame->isLocalFrame()) |
| 846 toLocalFrame(frame)->document()->fetcher()->garbageCollectDocumentRe
sources(); | 847 toLocalFrame(frame)->document()->fetcher()->garbageCollectDocumentRe
sources(); |
| 847 } | 848 } |
| 848 } | 849 } |
| 849 | 850 |
| 850 void InspectorResourceAgent::emulateNetworkConditions(ErrorString*, bool, double
, double, double) | 851 void InspectorResourceAgent::emulateNetworkConditions(ErrorString*, bool, double
, double, double) |
| 851 { | 852 { |
| 852 } | 853 } |
| 853 | 854 |
| 854 void InspectorResourceAgent::setDataSizeLimitsForTest(ErrorString*, int maxTotal
, int maxResource) | 855 void InspectorResourceAgent::setDataSizeLimitsForTest(ErrorString*, int maxTotal
, int maxResource) |
| 855 { | 856 { |
| 856 m_resourcesData->setResourcesDataSizeLimits(maxTotal, maxResource); | 857 m_resourcesData->setResourcesDataSizeLimits(maxTotal, maxResource); |
| 857 } | 858 } |
| 858 | 859 |
| 859 void InspectorResourceAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* lo
ader) | 860 void InspectorResourceAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* lo
ader) |
| 860 { | 861 { |
| 861 if (loader->frame() != m_pageAgent->inspectedFrame()) | 862 if (loader->frame() != m_inspectedFrame) |
| 862 return; | 863 return; |
| 863 | 864 |
| 864 if (m_state->getBoolean(ResourceAgentState::cacheDisabled)) | 865 if (m_state->getBoolean(ResourceAgentState::cacheDisabled)) |
| 865 memoryCache()->evictResources(); | 866 memoryCache()->evictResources(); |
| 866 | 867 |
| 867 m_resourcesData->clear(InspectorIdentifiers<DocumentLoader>::identifier(load
er)); | 868 m_resourcesData->clear(InspectorIdentifiers<DocumentLoader>::identifier(load
er)); |
| 868 } | 869 } |
| 869 | 870 |
| 870 void InspectorResourceAgent::frameScheduledNavigation(LocalFrame* frame, double) | 871 void InspectorResourceAgent::frameScheduledNavigation(LocalFrame* frame, double) |
| 871 { | 872 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 901 } | 902 } |
| 902 } | 903 } |
| 903 return false; | 904 return false; |
| 904 } | 905 } |
| 905 | 906 |
| 906 void InspectorResourceAgent::removeFinishedReplayXHRFired(Timer<InspectorResourc
eAgent>*) | 907 void InspectorResourceAgent::removeFinishedReplayXHRFired(Timer<InspectorResourc
eAgent>*) |
| 907 { | 908 { |
| 908 m_replayXHRsToBeDeleted.clear(); | 909 m_replayXHRsToBeDeleted.clear(); |
| 909 } | 910 } |
| 910 | 911 |
| 911 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) | 912 InspectorResourceAgent::InspectorResourceAgent(LocalFrame* inspectedFrame) |
| 912 : InspectorBaseAgent<InspectorResourceAgent, InspectorFrontend::Network>("Ne
twork") | 913 : InspectorBaseAgent<InspectorResourceAgent, InspectorFrontend::Network>("Ne
twork") |
| 913 , m_pageAgent(pageAgent) | 914 , m_inspectedFrame(inspectedFrame) |
| 914 , m_resourcesData(adoptPtr(new NetworkResourcesData())) | 915 , m_resourcesData(adoptPtr(new NetworkResourcesData())) |
| 915 , m_pendingEventSource(nullptr) | 916 , m_pendingEventSource(nullptr) |
| 916 , m_isRecalculatingStyle(false) | 917 , m_isRecalculatingStyle(false) |
| 917 , m_removeFinishedReplayXHRTimer(this, &InspectorResourceAgent::removeFinish
edReplayXHRFired) | 918 , m_removeFinishedReplayXHRTimer(this, &InspectorResourceAgent::removeFinish
edReplayXHRFired) |
| 918 { | 919 { |
| 919 } | 920 } |
| 920 | 921 |
| 921 bool InspectorResourceAgent::shouldForceCORSPreflight() | 922 bool InspectorResourceAgent::shouldForceCORSPreflight() |
| 922 { | 923 { |
| 923 return m_state->getBoolean(ResourceAgentState::cacheDisabled); | 924 return m_state->getBoolean(ResourceAgentState::cacheDisabled); |
| 924 } | 925 } |
| 925 | 926 |
| 926 } // namespace blink | 927 } // namespace blink |
| OLD | NEW |