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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 unsigned long identifier, | 313 unsigned long identifier, |
314 ResourceRequest& request, | 314 ResourceRequest& request, |
315 const ResourceResponse& redirect_response, | 315 const ResourceResponse& redirect_response, |
316 const FetchInitiatorInfo& initiator_info) { | 316 const FetchInitiatorInfo& initiator_info) { |
317 if (redirect_response.IsNull()) { | 317 if (redirect_response.IsNull()) { |
318 // Progress doesn't care about redirects, only notify it when an | 318 // Progress doesn't care about redirects, only notify it when an |
319 // initial request is sent. | 319 // initial request is sent. |
320 GetFrame()->Loader().Progress().WillStartLoading(identifier, | 320 GetFrame()->Loader().Progress().WillStartLoading(identifier, |
321 request.Priority()); | 321 request.Priority()); |
322 } | 322 } |
323 probe::willSendRequest(GetFrame(), identifier, MasterDocumentLoader(), | 323 probe::willSendRequest(GetFrame()->GetDocument(), identifier, |
324 request, redirect_response, initiator_info); | 324 MasterDocumentLoader(), request, redirect_response, |
| 325 initiator_info); |
325 if (GetFrame()->FrameScheduler()) | 326 if (GetFrame()->FrameScheduler()) |
326 GetFrame()->FrameScheduler()->DidStartLoading(identifier); | 327 GetFrame()->FrameScheduler()->DidStartLoading(identifier); |
327 } | 328 } |
328 | 329 |
329 void FrameFetchContext::DispatchDidReceiveResponse( | 330 void FrameFetchContext::DispatchDidReceiveResponse( |
330 unsigned long identifier, | 331 unsigned long identifier, |
331 const ResourceResponse& response, | 332 const ResourceResponse& response, |
332 WebURLRequest::FrameType frame_type, | 333 WebURLRequest::FrameType frame_type, |
333 WebURLRequest::RequestContext request_context, | 334 WebURLRequest::RequestContext request_context, |
334 Resource* resource, | 335 Resource* resource, |
(...skipping 28 matching lines...) Expand all Loading... |
363 LinkLoader::kLoadAll, nullptr); | 364 LinkLoader::kLoadAll, nullptr); |
364 | 365 |
365 if (response.HasMajorCertificateErrors()) { | 366 if (response.HasMajorCertificateErrors()) { |
366 MixedContentChecker::HandleCertificateError(GetFrame(), response, | 367 MixedContentChecker::HandleCertificateError(GetFrame(), response, |
367 frame_type, request_context); | 368 frame_type, request_context); |
368 } | 369 } |
369 | 370 |
370 GetFrame()->Loader().Progress().IncrementProgress(identifier, response); | 371 GetFrame()->Loader().Progress().IncrementProgress(identifier, response); |
371 GetLocalFrameClient()->DispatchDidReceiveResponse(response); | 372 GetLocalFrameClient()->DispatchDidReceiveResponse(response); |
372 DocumentLoader* document_loader = MasterDocumentLoader(); | 373 DocumentLoader* document_loader = MasterDocumentLoader(); |
373 probe::didReceiveResourceResponse(GetFrame(), identifier, document_loader, | 374 probe::didReceiveResourceResponse(GetFrame()->GetDocument(), identifier, |
374 response, resource); | 375 document_loader, response, resource); |
375 // It is essential that inspector gets resource response BEFORE console. | 376 // It is essential that inspector gets resource response BEFORE console. |
376 GetFrame()->Console().ReportResourceResponseReceived(document_loader, | 377 GetFrame()->Console().ReportResourceResponseReceived(document_loader, |
377 identifier, response); | 378 identifier, response); |
378 | 379 |
379 // MainResource responses were already added, skip them here. | 380 // MainResource responses were already added, skip them here. |
380 if (RuntimeEnabledFeatures::serverTimingEnabled() && | 381 if (RuntimeEnabledFeatures::serverTimingEnabled() && |
381 resource->GetType() != Resource::kMainResource && | 382 resource->GetType() != Resource::kMainResource && |
382 GetFrame()->GetDocument() && GetFrame()->GetDocument()->domWindow()) { | 383 GetFrame()->GetDocument() && GetFrame()->GetDocument()->domWindow()) { |
383 LocalDOMWindow* localDOMWindow = GetFrame()->GetDocument()->domWindow(); | 384 LocalDOMWindow* localDOMWindow = GetFrame()->GetDocument()->domWindow(); |
384 DOMWindowPerformance::performance(*localDOMWindow) | 385 DOMWindowPerformance::performance(*localDOMWindow) |
385 ->AddServerTiming(response, | 386 ->AddServerTiming(response, |
386 localDOMWindow->HasLoadEventFired() | 387 localDOMWindow->HasLoadEventFired() |
387 ? PerformanceBase::ShouldAddToBuffer::Never | 388 ? PerformanceBase::ShouldAddToBuffer::Never |
388 : PerformanceBase::ShouldAddToBuffer::Always); | 389 : PerformanceBase::ShouldAddToBuffer::Always); |
389 } | 390 } |
390 } | 391 } |
391 | 392 |
392 void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier, | 393 void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier, |
393 const char* data, | 394 const char* data, |
394 int data_length) { | 395 int data_length) { |
395 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length); | 396 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length); |
396 probe::didReceiveData(GetFrame(), identifier, data, data_length); | 397 probe::didReceiveData(GetFrame()->GetDocument(), identifier, |
| 398 MasterDocumentLoader(), data, data_length); |
397 } | 399 } |
398 | 400 |
399 void FrameFetchContext::DispatchDidReceiveEncodedData(unsigned long identifier, | 401 void FrameFetchContext::DispatchDidReceiveEncodedData(unsigned long identifier, |
400 int encoded_data_length) { | 402 int encoded_data_length) { |
401 probe::didReceiveEncodedDataLength(GetFrame(), identifier, | 403 probe::didReceiveEncodedDataLength(GetFrame()->GetDocument(), identifier, |
402 encoded_data_length); | 404 encoded_data_length); |
403 } | 405 } |
404 | 406 |
405 void FrameFetchContext::DispatchDidDownloadData(unsigned long identifier, | 407 void FrameFetchContext::DispatchDidDownloadData(unsigned long identifier, |
406 int data_length, | 408 int data_length, |
407 int encoded_data_length) { | 409 int encoded_data_length) { |
408 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length); | 410 GetFrame()->Loader().Progress().IncrementProgress(identifier, data_length); |
409 probe::didReceiveData(GetFrame(), identifier, 0, data_length); | 411 probe::didReceiveData(GetFrame()->GetDocument(), identifier, |
410 probe::didReceiveEncodedDataLength(GetFrame(), identifier, | 412 MasterDocumentLoader(), 0, data_length); |
| 413 probe::didReceiveEncodedDataLength(GetFrame()->GetDocument(), identifier, |
411 encoded_data_length); | 414 encoded_data_length); |
412 } | 415 } |
413 | 416 |
414 void FrameFetchContext::DispatchDidFinishLoading(unsigned long identifier, | 417 void FrameFetchContext::DispatchDidFinishLoading(unsigned long identifier, |
415 double finish_time, | 418 double finish_time, |
416 int64_t encoded_data_length, | 419 int64_t encoded_data_length, |
417 int64_t decoded_body_length) { | 420 int64_t decoded_body_length) { |
418 GetFrame()->Loader().Progress().CompleteProgress(identifier); | 421 GetFrame()->Loader().Progress().CompleteProgress(identifier); |
419 probe::didFinishLoading(GetFrame(), identifier, finish_time, | 422 probe::didFinishLoading(GetFrame()->GetDocument(), identifier, |
| 423 MasterDocumentLoader(), finish_time, |
420 encoded_data_length, decoded_body_length); | 424 encoded_data_length, decoded_body_length); |
421 if (GetFrame()->FrameScheduler()) | 425 if (GetFrame()->FrameScheduler()) |
422 GetFrame()->FrameScheduler()->DidStopLoading(identifier); | 426 GetFrame()->FrameScheduler()->DidStopLoading(identifier); |
423 } | 427 } |
424 | 428 |
425 void FrameFetchContext::DispatchDidFail(unsigned long identifier, | 429 void FrameFetchContext::DispatchDidFail(unsigned long identifier, |
426 const ResourceError& error, | 430 const ResourceError& error, |
427 int64_t encoded_data_length, | 431 int64_t encoded_data_length, |
428 bool is_internal_request) { | 432 bool is_internal_request) { |
429 GetFrame()->Loader().Progress().CompleteProgress(identifier); | 433 GetFrame()->Loader().Progress().CompleteProgress(identifier); |
430 probe::didFailLoading(GetFrame(), identifier, error); | 434 probe::didFailLoading(GetFrame()->GetDocument(), identifier, error); |
431 // Notification to FrameConsole should come AFTER InspectorInstrumentation | 435 // Notification to FrameConsole should come AFTER InspectorInstrumentation |
432 // call, DevTools front-end relies on this. | 436 // call, DevTools front-end relies on this. |
433 if (!is_internal_request) | 437 if (!is_internal_request) |
434 GetFrame()->Console().DidFailLoading(identifier, error); | 438 GetFrame()->Console().DidFailLoading(identifier, error); |
435 if (GetFrame()->FrameScheduler()) | 439 if (GetFrame()->FrameScheduler()) |
436 GetFrame()->FrameScheduler()->DidStopLoading(identifier); | 440 GetFrame()->FrameScheduler()->DidStopLoading(identifier); |
437 } | 441 } |
438 | 442 |
439 void FrameFetchContext::DispatchDidLoadResourceFromMemoryCache( | 443 void FrameFetchContext::DispatchDidLoadResourceFromMemoryCache( |
440 unsigned long identifier, | 444 unsigned long identifier, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 732 |
729 SecurityContext* FrameFetchContext::GetParentSecurityContext() const { | 733 SecurityContext* FrameFetchContext::GetParentSecurityContext() const { |
730 if (Frame* parent = GetFrame()->Tree().Parent()) | 734 if (Frame* parent = GetFrame()->Tree().Parent()) |
731 return parent->GetSecurityContext(); | 735 return parent->GetSecurityContext(); |
732 return nullptr; | 736 return nullptr; |
733 } | 737 } |
734 | 738 |
735 bool FrameFetchContext::ShouldBlockRequestByInspector( | 739 bool FrameFetchContext::ShouldBlockRequestByInspector( |
736 const ResourceRequest& resource_request) const { | 740 const ResourceRequest& resource_request) const { |
737 bool should_block_request = false; | 741 bool should_block_request = false; |
738 probe::shouldBlockRequest(GetFrame(), resource_request, | 742 probe::shouldBlockRequest(GetDocument(), resource_request, |
739 &should_block_request); | 743 &should_block_request); |
740 return should_block_request; | 744 return should_block_request; |
741 } | 745 } |
742 | 746 |
743 void FrameFetchContext::DispatchDidBlockRequest( | 747 void FrameFetchContext::DispatchDidBlockRequest( |
744 const ResourceRequest& resource_request, | 748 const ResourceRequest& resource_request, |
745 const FetchInitiatorInfo& fetch_initiator_info, | 749 const FetchInitiatorInfo& fetch_initiator_info, |
746 ResourceRequestBlockedReason blocked_reason) const { | 750 ResourceRequestBlockedReason blocked_reason) const { |
747 probe::didBlockRequest(GetFrame(), resource_request, MasterDocumentLoader(), | 751 probe::didBlockRequest(GetDocument(), resource_request, |
748 fetch_initiator_info, blocked_reason); | 752 MasterDocumentLoader(), fetch_initiator_info, |
| 753 blocked_reason); |
749 } | 754 } |
750 | 755 |
751 void FrameFetchContext::ReportLocalLoadFailed(const KURL& url) const { | 756 void FrameFetchContext::ReportLocalLoadFailed(const KURL& url) const { |
752 FrameLoader::ReportLocalLoadFailed(GetFrame(), url.ElidedString()); | 757 FrameLoader::ReportLocalLoadFailed(GetFrame(), url.ElidedString()); |
753 } | 758 } |
754 | 759 |
755 bool FrameFetchContext::ShouldBypassMainWorldCSP() const { | 760 bool FrameFetchContext::ShouldBypassMainWorldCSP() const { |
756 return GetFrame()->GetScriptController().ShouldBypassMainWorldCSP(); | 761 return GetFrame()->GetScriptController().ShouldBypassMainWorldCSP(); |
757 } | 762 } |
758 | 763 |
(...skipping 20 matching lines...) Expand all Loading... |
779 std::unique_ptr<WebURLLoader> FrameFetchContext::CreateURLLoader() { | 784 std::unique_ptr<WebURLLoader> FrameFetchContext::CreateURLLoader() { |
780 return GetFrame()->CreateURLLoader(); | 785 return GetFrame()->CreateURLLoader(); |
781 } | 786 } |
782 | 787 |
783 DEFINE_TRACE(FrameFetchContext) { | 788 DEFINE_TRACE(FrameFetchContext) { |
784 visitor->Trace(document_loader_); | 789 visitor->Trace(document_loader_); |
785 BaseFetchContext::Trace(visitor); | 790 BaseFetchContext::Trace(visitor); |
786 } | 791 } |
787 | 792 |
788 } // namespace blink | 793 } // namespace blink |
OLD | NEW |