Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 1410153009: DevTools: Make network events continuous on Timeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 4 landing Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 #include "core/frame/FrameConsole.h" 38 #include "core/frame/FrameConsole.h"
39 #include "core/frame/FrameHost.h" 39 #include "core/frame/FrameHost.h"
40 #include "core/frame/FrameView.h" 40 #include "core/frame/FrameView.h"
41 #include "core/frame/LocalFrame.h" 41 #include "core/frame/LocalFrame.h"
42 #include "core/frame/Settings.h" 42 #include "core/frame/Settings.h"
43 #include "core/html/HTMLFrameOwnerElement.h" 43 #include "core/html/HTMLFrameOwnerElement.h"
44 #include "core/html/imports/HTMLImportsController.h" 44 #include "core/html/imports/HTMLImportsController.h"
45 #include "core/inspector/ConsoleMessage.h" 45 #include "core/inspector/ConsoleMessage.h"
46 #include "core/inspector/InspectorInstrumentation.h" 46 #include "core/inspector/InspectorInstrumentation.h"
47 #include "core/inspector/InspectorResourceAgent.h" 47 #include "core/inspector/InspectorResourceAgent.h"
48 #include "core/inspector/InspectorTraceEvents.h"
49 #include "core/inspector/InstrumentingAgents.h" 48 #include "core/inspector/InstrumentingAgents.h"
50 #include "core/loader/DocumentLoader.h" 49 #include "core/loader/DocumentLoader.h"
51 #include "core/loader/FrameLoader.h" 50 #include "core/loader/FrameLoader.h"
52 #include "core/loader/FrameLoaderClient.h" 51 #include "core/loader/FrameLoaderClient.h"
53 #include "core/loader/LinkLoader.h" 52 #include "core/loader/LinkLoader.h"
54 #include "core/loader/MixedContentChecker.h" 53 #include "core/loader/MixedContentChecker.h"
55 #include "core/loader/NetworkHintsInterface.h" 54 #include "core/loader/NetworkHintsInterface.h"
56 #include "core/loader/PingLoader.h" 55 #include "core/loader/PingLoader.h"
57 #include "core/loader/ProgressTracker.h" 56 #include "core/loader/ProgressTracker.h"
58 #include "core/loader/appcache/ApplicationCacheHost.h" 57 #include "core/loader/appcache/ApplicationCacheHost.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 216
218 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi er, ResourceLoadPriority loadPriority, int intraPriorityValue) 217 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi er, ResourceLoadPriority loadPriority, int intraPriorityValue)
219 { 218 {
220 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo adPriority, intraPriorityValue); 219 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo adPriority, intraPriorityValue);
221 } 220 }
222 221
223 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo) 222 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo)
224 { 223 {
225 frame()->loader().applyUserAgent(request); 224 frame()->loader().applyUserAgent(request);
226 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi fier, request, redirectResponse); 225 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi fier, request, redirectResponse);
227 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est));
228 InspectorInstrumentation::willSendRequest(frame(), identifier, ensureLoaderF orNotifications(), request, redirectResponse, initiatorInfo); 226 InspectorInstrumentation::willSendRequest(frame(), identifier, ensureLoaderF orNotifications(), request, redirectResponse, initiatorInfo);
229 } 227 }
230 228
231 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, ResourceLoader* resourceLoader) 229 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, ResourceLoader* resourceLoader)
232 { 230 {
233 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre ss()); 231 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre ss());
234 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame()->do cument(), NetworkHintsInterfaceImpl()); 232 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame()->do cument(), NetworkHintsInterfaceImpl());
235 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { 233 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) {
236 ResourceFetcher* fetcher = nullptr; 234 ResourceFetcher* fetcher = nullptr;
237 if (frame()->document()) 235 if (frame()->document())
238 fetcher = frame()->document()->fetcher(); 236 fetcher = frame()->document()->fetcher();
239 m_documentLoader->clientHintsPreferences().updateFromAcceptClientHintsHe ader(response.httpHeaderField("accept-ch"), fetcher); 237 m_documentLoader->clientHintsPreferences().updateFromAcceptClientHintsHe ader(response.httpHeaderField("accept-ch"), fetcher);
240 } 238 }
241 239
242 frame()->loader().progress().incrementProgress(identifier, response); 240 frame()->loader().progress().incrementProgress(identifier, response);
243 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide ntifier, response); 241 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide ntifier, response);
244 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame (), response));
245 DocumentLoader* documentLoader = ensureLoaderForNotifications(); 242 DocumentLoader* documentLoader = ensureLoaderForNotifications();
246 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do cumentLoader, response, resourceLoader); 243 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do cumentLoader, response, resourceLoader);
247 // It is essential that inspector gets resource response BEFORE console. 244 // It is essential that inspector gets resource response BEFORE console.
248 frame()->console().reportResourceResponseReceived(documentLoader, identifier , response); 245 frame()->console().reportResourceResponseReceived(documentLoader, identifier , response);
249 } 246 }
250 247
251 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, const c har* data, int dataLength, int encodedDataLength) 248 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, const c har* data, int dataLength, int encodedDataLength)
252 { 249 {
253 frame()->loader().progress().incrementProgress(identifier, dataLength); 250 frame()->loader().progress().incrementProgress(identifier, dataLength);
254 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc odedDataLength));
255 InspectorInstrumentation::didReceiveData(frame(), identifier, data, dataLeng th, encodedDataLength); 251 InspectorInstrumentation::didReceiveData(frame(), identifier, data, dataLeng th, encodedDataLength);
256 } 252 }
257 253
258 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, int da taLength, int encodedDataLength) 254 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, int da taLength, int encodedDataLength)
259 { 255 {
260 frame()->loader().progress().incrementProgress(identifier, dataLength); 256 frame()->loader().progress().incrementProgress(identifier, dataLength);
261 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc odedDataLength));
262 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength); 257 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength);
263 } 258 }
264 259
265 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl e finishTime, int64_t encodedDataLength) 260 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl e finishTime, int64_t encodedDataLength)
266 { 261 {
267 frame()->loader().progress().completeProgress(identifier); 262 frame()->loader().progress().completeProgress(identifier);
268 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier); 263 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier);
269
270 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal se));
271 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength); 264 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength);
272 } 265 }
273 266
274 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource Error& error, bool isInternalRequest) 267 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource Error& error, bool isInternalRequest)
275 { 268 {
276 frame()->loader().progress().completeProgress(identifier); 269 frame()->loader().progress().completeProgress(identifier);
277 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier); 270 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier);
278 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true));
279 InspectorInstrumentation::didFailLoading(frame(), identifier, error); 271 InspectorInstrumentation::didFailLoading(frame(), identifier, error);
280 // Notification to FrameConsole should come AFTER InspectorInstrumentation c all, DevTools front-end relies on this. 272 // Notification to FrameConsole should come AFTER InspectorInstrumentation c all, DevTools front-end relies on this.
281 if (!isInternalRequest) 273 if (!isInternalRequest)
282 frame()->console().didFailLoading(identifier, error); 274 frame()->console().didFailLoading(identifier, error);
283 } 275 }
284 276
285 277
286 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const Resource* r esource) 278 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const Resource* r esource)
287 { 279 {
288 ResourceRequest request(resource->url()); 280 ResourceRequest request(resource->url());
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 737 }
746 738
747 DEFINE_TRACE(FrameFetchContext) 739 DEFINE_TRACE(FrameFetchContext)
748 { 740 {
749 visitor->trace(m_document); 741 visitor->trace(m_document);
750 visitor->trace(m_documentLoader); 742 visitor->trace(m_documentLoader);
751 FetchContext::trace(visitor); 743 FetchContext::trace(visitor);
752 } 744 }
753 745
754 } // namespace blink 746 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698