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

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

Issue 2211283004: Drop test-only WebFrameClient params/functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 4 years, 4 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // The |m_documentLoader| is null in the FrameFetchContext of an imported docume nt. 307 // The |m_documentLoader| is null in the FrameFetchContext of an imported docume nt.
308 // FIXME(http://crbug.com/274173): This means Inspector, which uses DocumentLoad er 308 // FIXME(http://crbug.com/274173): This means Inspector, which uses DocumentLoad er
309 // as a grouping entity, cannot see imported documents. 309 // as a grouping entity, cannot see imported documents.
310 inline DocumentLoader* FrameFetchContext::masterDocumentLoader() const 310 inline DocumentLoader* FrameFetchContext::masterDocumentLoader() const
311 { 311 {
312 return m_documentLoader ? m_documentLoader.get() : frame()->loader().documen tLoader(); 312 return m_documentLoader ? m_documentLoader.get() : frame()->loader().documen tLoader();
313 } 313 }
314 314
315 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi er, ResourceLoadPriority loadPriority, int intraPriorityValue) 315 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi er, ResourceLoadPriority loadPriority, int intraPriorityValue)
316 { 316 {
317 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo adPriority, intraPriorityValue);
318 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier, loadPriority)); 317 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier, loadPriority));
319 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa dPriority); 318 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa dPriority);
320 } 319 }
321 320
322 void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest & request, const ResourceResponse& redirectResponse) 321 void FrameFetchContext::prepareRequest(ResourceRequest& request)
323 { 322 {
324 frame()->loader().applyUserAgent(request); 323 frame()->loader().applyUserAgent(request);
325 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi fier, request, redirectResponse); 324 frame()->loader().client()->dispatchWillSendRequest(request);
326 } 325 }
327 326
328 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo) 327 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo)
329 { 328 {
330 // For initial requests, prepareRequest() is called in 329 // For initial requests, prepareRequest() is called in
331 // willStartLoadingResource(), before revalidation policy is determined. 330 // willStartLoadingResource(), before revalidation policy is determined.
332 // That call doesn't exist for redirects, so call preareRequest() here. 331 // That call doesn't exist for redirects, so call preareRequest() here.
333 if (!redirectResponse.isNull()) 332 if (!redirectResponse.isNull())
334 prepareRequest(identifier, request, redirectResponse); 333 prepareRequest(request);
335 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est)); 334 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est));
336 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen tLoader(), request, redirectResponse, initiatorInfo); 335 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen tLoader(), request, redirectResponse, initiatorInfo);
337 if (frame()->frameScheduler()) 336 if (frame()->frameScheduler())
338 frame()->frameScheduler()->didStartLoading(identifier); 337 frame()->frameScheduler()->didStartLoading(identifier);
339 } 338 }
340 339
341 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest ::RequestContext requestContext, Resource* resource) 340 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest ::RequestContext requestContext, Resource* resource)
342 { 341 {
343 dispatchDidReceiveResponseInternal(identifier, response, frameType, requestC ontext, resource, LinkLoader::LoadResourcesAndPreconnect); 342 dispatchDidReceiveResponseInternal(identifier, response, frameType, requestC ontext, resource, LinkLoader::LoadResourcesAndPreconnect);
344 } 343 }
345 344
346 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, const c har* data, int dataLength, int encodedDataLength) 345 void FrameFetchContext::dispatchDidReceiveData(unsigned long identifier, const c har* data, int dataLength, int encodedDataLength)
347 { 346 {
348 frame()->loader().progress().incrementProgress(identifier, dataLength); 347 frame()->loader().progress().incrementProgress(identifier, dataLength);
349 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc odedDataLength)); 348 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc odedDataLength));
350 InspectorInstrumentation::didReceiveData(frame(), identifier, data, dataLeng th, encodedDataLength); 349 InspectorInstrumentation::didReceiveData(frame(), identifier, data, dataLeng th, encodedDataLength);
351 } 350 }
352 351
353 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, int da taLength, int encodedDataLength) 352 void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, int da taLength, int encodedDataLength)
354 { 353 {
355 frame()->loader().progress().incrementProgress(identifier, dataLength); 354 frame()->loader().progress().incrementProgress(identifier, dataLength);
356 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc odedDataLength)); 355 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVEN T_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), enc odedDataLength));
357 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength); 356 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength);
358 } 357 }
359 358
360 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl e finishTime, int64_t encodedDataLength) 359 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl e finishTime, int64_t encodedDataLength)
361 { 360 {
362 frame()->loader().progress().completeProgress(identifier); 361 frame()->loader().progress().completeProgress(identifier);
363 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier);
364
365 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal se)); 362 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal se));
366 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength); 363 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, encodedDataLength);
367 if (frame()->frameScheduler()) 364 if (frame()->frameScheduler())
368 frame()->frameScheduler()->didStopLoading(identifier); 365 frame()->frameScheduler()->didStopLoading(identifier);
369 } 366 }
370 367
371 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource Error& error, bool isInternalRequest) 368 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource Error& error, bool isInternalRequest)
372 { 369 {
373 frame()->loader().progress().completeProgress(identifier); 370 frame()->loader().progress().completeProgress(identifier);
374 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident ifier);
375 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); 371 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true));
376 InspectorInstrumentation::didFailLoading(frame(), identifier, error); 372 InspectorInstrumentation::didFailLoading(frame(), identifier, error);
377 // Notification to FrameConsole should come AFTER InspectorInstrumentation c all, DevTools front-end relies on this. 373 // Notification to FrameConsole should come AFTER InspectorInstrumentation c all, DevTools front-end relies on this.
378 if (!isInternalRequest) 374 if (!isInternalRequest)
379 frame()->console().didFailLoading(identifier, error); 375 frame()->console().didFailLoading(identifier, error);
380 if (frame()->frameScheduler()) 376 if (frame()->frameScheduler())
381 frame()->frameScheduler()->didStopLoading(identifier); 377 frame()->frameScheduler()->didStopLoading(identifier);
382 } 378 }
383 379
384 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest:: RequestContext requestContext) 380 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest:: RequestContext requestContext)
(...skipping 29 matching lines...) Expand all
414 value->setString("requestId", requestId); 410 value->setString("requestId", requestId);
415 value->setString("url", url.getString()); 411 value->setString("url", url.getString());
416 value->setInteger("priority", priority); 412 value->setInteger("priority", priority);
417 return value; 413 return value;
418 } 414 }
419 415
420 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou rceRequest& request, Resource::Type type) 416 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou rceRequest& request, Resource::Type type)
421 { 417 {
422 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe sourceTraceData(identifier, request.url(), request.priority())); 418 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe sourceTraceData(identifier, request.url(), request.priority()));
423 frame()->loader().progress().willStartLoading(identifier); 419 frame()->loader().progress().willStartLoading(identifier);
424 prepareRequest(identifier, request, ResourceResponse()); 420 prepareRequest(request);
425 421
426 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request. url().isValid()) 422 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request. url().isValid())
427 return; 423 return;
428 if (type == Resource::MainResource) 424 if (type == Resource::MainResource)
429 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r equest); 425 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r equest);
430 else 426 else
431 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque st); 427 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque st);
432 } 428 }
433 429
434 void FrameFetchContext::didLoadResource(Resource* resource) 430 void FrameFetchContext::didLoadResource(Resource* resource)
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 m_documentLoader->clientHintsPreferences().updateFromAcceptClientHintsHe ader(response.httpHeaderField(HTTPNames::Accept_CH), fetcher); 813 m_documentLoader->clientHintsPreferences().updateFromAcceptClientHintsHe ader(response.httpHeaderField(HTTPNames::Accept_CH), fetcher);
818 // When response is received with a provisional docloader, the resource haven't committed yet, and we cannot load resources, only preconnect. 814 // When response is received with a provisional docloader, the resource haven't committed yet, and we cannot load resources, only preconnect.
819 resourceLoadingPolicy = LinkLoader::DoNotLoadResources; 815 resourceLoadingPolicy = LinkLoader::DoNotLoadResources;
820 } 816 }
821 LinkLoader::loadLinksFromHeader(response.httpHeaderField(HTTPNames::Link), r esponse.url(), frame()->document(), NetworkHintsInterfaceImpl(), resourceLoading Policy, LinkLoader::LoadAll, nullptr); 817 LinkLoader::loadLinksFromHeader(response.httpHeaderField(HTTPNames::Link), r esponse.url(), frame()->document(), NetworkHintsInterfaceImpl(), resourceLoading Policy, LinkLoader::LoadAll, nullptr);
822 818
823 if (response.hasMajorCertificateErrors()) 819 if (response.hasMajorCertificateErrors())
824 MixedContentChecker::handleCertificateError(frame(), response, frameType , requestContext); 820 MixedContentChecker::handleCertificateError(frame(), response, frameType , requestContext);
825 821
826 frame()->loader().progress().incrementProgress(identifier, response); 822 frame()->loader().progress().incrementProgress(identifier, response);
827 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide ntifier, response); 823 frame()->loader().client()->dispatchDidReceiveResponse(response);
828 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame (), response)); 824 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame (), response));
829 DocumentLoader* documentLoader = masterDocumentLoader(); 825 DocumentLoader* documentLoader = masterDocumentLoader();
830 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do cumentLoader, response, resource); 826 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do cumentLoader, response, resource);
831 // It is essential that inspector gets resource response BEFORE console. 827 // It is essential that inspector gets resource response BEFORE console.
832 frame()->console().reportResourceResponseReceived(documentLoader, identifier , response); 828 frame()->console().reportResourceResponseReceived(documentLoader, identifier , response);
833 } 829 }
834 830
835 DEFINE_TRACE(FrameFetchContext) 831 DEFINE_TRACE(FrameFetchContext)
836 { 832 {
837 visitor->trace(m_document); 833 visitor->trace(m_document);
838 visitor->trace(m_documentLoader); 834 visitor->trace(m_documentLoader);
839 FetchContext::trace(visitor); 835 FetchContext::trace(visitor);
840 } 836 }
841 837
842 } // namespace blink 838 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698