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

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

Issue 2109843003: Adds enableVirtualTime and setVirtualTimePolicy To Emulation domain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix layering issue Created 4 years, 5 months 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "platform/TracedValue.h" 66 #include "platform/TracedValue.h"
67 #include "platform/mhtml/MHTMLArchive.h" 67 #include "platform/mhtml/MHTMLArchive.h"
68 #include "platform/network/ResourceLoadPriority.h" 68 #include "platform/network/ResourceLoadPriority.h"
69 #include "platform/network/ResourceTimingInfo.h" 69 #include "platform/network/ResourceTimingInfo.h"
70 #include "platform/weborigin/SchemeRegistry.h" 70 #include "platform/weborigin/SchemeRegistry.h"
71 #include "platform/weborigin/SecurityPolicy.h" 71 #include "platform/weborigin/SecurityPolicy.h"
72 #include "public/platform/WebCachePolicy.h" 72 #include "public/platform/WebCachePolicy.h"
73 #include "public/platform/WebDocumentSubresourceFilter.h" 73 #include "public/platform/WebDocumentSubresourceFilter.h"
74 #include "public/platform/WebFrameScheduler.h" 74 #include "public/platform/WebFrameScheduler.h"
75 #include "public/platform/WebInsecureRequestPolicy.h" 75 #include "public/platform/WebInsecureRequestPolicy.h"
76 #include "public/platform/WebViewScheduler.h"
76 #include <algorithm> 77 #include <algorithm>
77 #include <memory> 78 #include <memory>
78 79
79 namespace blink { 80 namespace blink {
80 81
81 namespace { 82 namespace {
82 83
83 void emitWarningForDocWriteScripts(const String& url, Document& document) 84 void emitWarningForDocWriteScripts(const String& url, Document& document)
84 { 85 {
85 String message = "A Parser-blocking, cross-origin script, " + url + ", is in voked via document.write. This may be blocked by the browser if the device has p oor network connectivity."; 86 String message = "A Parser-blocking, cross-origin script, " + url + ", is in voked via document.write. This may be blocked by the browser if the device has p oor network connectivity.";
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 313
313 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo) 314 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo)
314 { 315 {
315 // For initial requests, prepareRequest() is called in 316 // For initial requests, prepareRequest() is called in
316 // willStartLoadingResource(), before revalidation policy is determined. 317 // willStartLoadingResource(), before revalidation policy is determined.
317 // That call doesn't exist for redirects, so call preareRequest() here. 318 // That call doesn't exist for redirects, so call preareRequest() here.
318 if (!redirectResponse.isNull()) 319 if (!redirectResponse.isNull())
319 prepareRequest(identifier, request, redirectResponse); 320 prepareRequest(identifier, request, redirectResponse);
320 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est)); 321 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est));
321 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen tLoader(), request, redirectResponse, initiatorInfo); 322 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen tLoader(), request, redirectResponse, initiatorInfo);
323 frame()->frameScheduler()->webViewScheduler()->incrementPendingResourceLoadC ount();
322 } 324 }
323 325
324 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest ::RequestContext requestContext, Resource* resource) 326 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest ::RequestContext requestContext, Resource* resource)
325 { 327 {
326 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc esAndPreconnect; 328 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc esAndPreconnect;
327 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre ss()); 329 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre ss());
328 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { 330 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) {
329 ResourceFetcher* fetcher = nullptr; 331 ResourceFetcher* fetcher = nullptr;
330 if (frame()->document()) 332 if (frame()->document())
331 fetcher = frame()->document()->fetcher(); 333 fetcher = frame()->document()->fetcher();
(...skipping 29 matching lines...) Expand all
361 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength); 363 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength);
362 } 364 }
363 365
364 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl e finishTime, int64_t encodedDataLength) 366 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl e finishTime, int64_t encodedDataLength)
365 { 367 {
366 frame()->loader().progress().completeProgress(identifier); 368 frame()->loader().progress().completeProgress(identifier);
367 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier); 369 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier);
368 370
369 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal se)); 371 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal se));
370 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength); 372 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength);
373 frame()->frameScheduler()->webViewScheduler()->decrementPendingResourceLoadC ount();
371 } 374 }
372 375
373 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource Error& error, bool isInternalRequest) 376 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource Error& error, bool isInternalRequest)
374 { 377 {
375 frame()->loader().progress().completeProgress(identifier); 378 frame()->loader().progress().completeProgress(identifier);
376 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier); 379 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier);
377 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); 380 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true));
378 InspectorInstrumentation::didFailLoading(frame(), identifier, error); 381 InspectorInstrumentation::didFailLoading(frame(), identifier, error);
379 // Notification to FrameConsole should come AFTER InspectorInstrumentation c all, DevTools front-end relies on this. 382 // Notification to FrameConsole should come AFTER InspectorInstrumentation c all, DevTools front-end relies on this.
380 if (!isInternalRequest) 383 if (!isInternalRequest)
381 frame()->console().didFailLoading(identifier, error); 384 frame()->console().didFailLoading(identifier, error);
385 frame()->frameScheduler()->webViewScheduler()->decrementPendingResourceLoadC ount();
382 } 386 }
383 387
384 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest:: RequestContext requestContext) 388 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest:: RequestContext requestContext)
385 { 389 {
386 ResourceRequest request(resource->url()); 390 ResourceRequest request(resource->url());
387 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request, resource->response()); 391 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request, resource->response());
388 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o ptions().initiatorInfo); 392 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o ptions().initiatorInfo);
389 393
390 InspectorInstrumentation::markResourceAsCached(frame(), identifier); 394 InspectorInstrumentation::markResourceAsCached(frame(), identifier);
391 if (!resource->response().isNull()) 395 if (!resource->response().isNull())
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 } 787 }
784 788
785 DEFINE_TRACE(FrameFetchContext) 789 DEFINE_TRACE(FrameFetchContext)
786 { 790 {
787 visitor->trace(m_document); 791 visitor->trace(m_document);
788 visitor->trace(m_documentLoader); 792 visitor->trace(m_documentLoader);
789 FetchContext::trace(visitor); 793 FetchContext::trace(visitor);
790 } 794 }
791 795
792 } // namespace blink 796 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698