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