| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "sky/engine/config.h" | 31 #include "sky/engine/config.h" |
| 32 #include "sky/engine/core/loader/FrameFetchContext.h" | 32 #include "sky/engine/core/loader/FrameFetchContext.h" |
| 33 | 33 |
| 34 #include "sky/engine/core/dom/Document.h" | 34 #include "sky/engine/core/dom/Document.h" |
| 35 #include "sky/engine/core/frame/FrameConsole.h" | 35 #include "sky/engine/core/frame/FrameConsole.h" |
| 36 #include "sky/engine/core/frame/LocalFrame.h" | 36 #include "sky/engine/core/frame/LocalFrame.h" |
| 37 #include "sky/engine/core/inspector/InspectorTraceEvents.h" | |
| 38 #include "sky/engine/core/loader/FrameLoaderClient.h" | 37 #include "sky/engine/core/loader/FrameLoaderClient.h" |
| 39 #include "sky/engine/core/page/Page.h" | 38 #include "sky/engine/core/page/Page.h" |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 FrameFetchContext::FrameFetchContext(LocalFrame* frame) | 42 FrameFetchContext::FrameFetchContext(LocalFrame* frame) |
| 44 : m_frame(frame) | 43 : m_frame(frame) |
| 45 { | 44 { |
| 46 } | 45 } |
| 47 | 46 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 } | 60 } |
| 62 | 61 |
| 63 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) | 62 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) |
| 64 { | 63 { |
| 65 m_frame->loaderClient()->dispatchDidChangeResourcePriority(identifier, loadP
riority, intraPriorityValue); | 64 m_frame->loaderClient()->dispatchDidChangeResourcePriority(identifier, loadP
riority, intraPriorityValue); |
| 66 } | 65 } |
| 67 | 66 |
| 68 void FrameFetchContext::dispatchWillSendRequest(Document* document, unsigned lon
g identifier, ResourceRequest& request, const ResourceResponse& redirectResponse
, const FetchInitiatorInfo& initiatorInfo) | 67 void FrameFetchContext::dispatchWillSendRequest(Document* document, unsigned lon
g identifier, ResourceRequest& request, const ResourceResponse& redirectResponse
, const FetchInitiatorInfo& initiatorInfo) |
| 69 { | 68 { |
| 70 m_frame->loaderClient()->dispatchWillSendRequest(document, identifier, reque
st, redirectResponse); | 69 m_frame->loaderClient()->dispatchWillSendRequest(document, identifier, reque
st, redirectResponse); |
| 71 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceSendRequest", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorSendRequestEvent::da
ta(identifier, request)); | |
| 72 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | |
| 73 } | 70 } |
| 74 | 71 |
| 75 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq
uest& request, const ResourceResponse& response) | 72 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq
uest& request, const ResourceResponse& response) |
| 76 { | 73 { |
| 77 m_frame->loaderClient()->dispatchDidLoadResourceFromMemoryCache(request, res
ponse); | 74 m_frame->loaderClient()->dispatchDidLoadResourceFromMemoryCache(request, res
ponse); |
| 78 } | 75 } |
| 79 | 76 |
| 80 void FrameFetchContext::dispatchDidReceiveResponse(Document* document, unsigned
long identifier, const ResourceResponse& r, ResourceLoader* resourceLoader) | 77 void FrameFetchContext::dispatchDidReceiveResponse(Document* document, unsigned
long identifier, const ResourceResponse& r, ResourceLoader* resourceLoader) |
| 81 { | 78 { |
| 82 m_frame->loaderClient()->dispatchDidReceiveResponse(document, identifier, r)
; | 79 m_frame->loaderClient()->dispatchDidReceiveResponse(document, identifier, r)
; |
| 83 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceReceiveResponse", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorReceiveResponseE
vent::data(identifier, r)); | |
| 84 m_frame->console().reportResourceResponseReceived(document, identifier, r); | 80 m_frame->console().reportResourceResponseReceived(document, identifier, r); |
| 85 } | 81 } |
| 86 | 82 |
| 87 void FrameFetchContext::dispatchDidReceiveData(Document*, unsigned long identifi
er, const char* data, int dataLength, int encodedDataLength) | 83 void FrameFetchContext::dispatchDidReceiveData(Document*, unsigned long identifi
er, const char* data, int dataLength, int encodedDataLength) |
| 88 { | 84 { |
| 89 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceReceivedData", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorReceiveDataEvent::d
ata(identifier, encodedDataLength)); | |
| 90 } | 85 } |
| 91 | 86 |
| 92 void FrameFetchContext::dispatchDidDownloadData(Document*, unsigned long identif
ier, int dataLength, int encodedDataLength) | 87 void FrameFetchContext::dispatchDidDownloadData(Document*, unsigned long identif
ier, int dataLength, int encodedDataLength) |
| 93 { | 88 { |
| 94 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceReceivedData", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorReceiveDataEvent::d
ata(identifier, encodedDataLength)); | |
| 95 } | 89 } |
| 96 | 90 |
| 97 void FrameFetchContext::dispatchDidFinishLoading(Document* document, unsigned lo
ng identifier, double finishTime, int64_t encodedDataLength) | 91 void FrameFetchContext::dispatchDidFinishLoading(Document* document, unsigned lo
ng identifier, double finishTime, int64_t encodedDataLength) |
| 98 { | 92 { |
| 99 m_frame->loaderClient()->dispatchDidFinishLoading(document, identifier); | 93 m_frame->loaderClient()->dispatchDidFinishLoading(document, identifier); |
| 100 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceFinish", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorResourceFinishEvent::data
(identifier, finishTime, false)); | |
| 101 } | 94 } |
| 102 | 95 |
| 103 void FrameFetchContext::dispatchDidFail(Document* document, unsigned long identi
fier, const ResourceError& error) | 96 void FrameFetchContext::dispatchDidFail(Document* document, unsigned long identi
fier, const ResourceError& error) |
| 104 { | 97 { |
| 105 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceFinish", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorResourceFinishEvent::data
(identifier, 0, true)); | |
| 106 } | 98 } |
| 107 | 99 |
| 108 void FrameFetchContext::sendRemainingDelegateMessages(Document* document, unsign
ed long identifier, const ResourceResponse& response, int dataLength) | 100 void FrameFetchContext::sendRemainingDelegateMessages(Document* document, unsign
ed long identifier, const ResourceResponse& response, int dataLength) |
| 109 { | 101 { |
| 110 if (!response.isNull()) | 102 if (!response.isNull()) |
| 111 dispatchDidReceiveResponse(document, identifier, response); | 103 dispatchDidReceiveResponse(document, identifier, response); |
| 112 | 104 |
| 113 if (dataLength > 0) | 105 if (dataLength > 0) |
| 114 dispatchDidReceiveData(document, identifier, 0, dataLength, 0); | 106 dispatchDidReceiveData(document, identifier, 0, dataLength, 0); |
| 115 | 107 |
| 116 dispatchDidFinishLoading(document, identifier, 0, 0); | 108 dispatchDidFinishLoading(document, identifier, 0, 0); |
| 117 } | 109 } |
| 118 | 110 |
| 119 } // namespace blink | 111 } // namespace blink |
| OLD | NEW |