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

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

Issue 1829803002: [WeakMemoryCache] Do not lookup MemoryCache when adding resource to Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@MemoryCache_MakeWeak2d
Patch Set: Do not expose DocumentLoader::mainResource() Created 4 years, 7 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 470 }
471 471
472 if (m_corsRedirectLimit <= 0) { 472 if (m_corsRedirectLimit <= 0) {
473 ThreadableLoaderClient* client = m_client; 473 ThreadableLoaderClient* client = m_client;
474 clear(); 474 clear();
475 client->didFailRedirectCheck(); 475 client->didFailRedirectCheck();
476 // |this| may be dead here. 476 // |this| may be dead here.
477 } else if (m_options.crossOriginRequestPolicy == UseAccessControl) { 477 } else if (m_options.crossOriginRequestPolicy == UseAccessControl) {
478 --m_corsRedirectLimit; 478 --m_corsRedirectLimit;
479 479
480 InspectorInstrumentation::didReceiveCORSRedirectResponse(document().fram e(), resource->identifier(), document().frame()->loader().documentLoader(), redi rectResponse, 0); 480 InspectorInstrumentation::didReceiveCORSRedirectResponse(document().fram e(), resource->identifier(), document().frame()->loader().documentLoader(), redi rectResponse, resource);
481 481
482 bool allowRedirect = false; 482 bool allowRedirect = false;
483 String accessControlErrorDescription; 483 String accessControlErrorDescription;
484 484
485 // Non-simple cross origin requests (both preflight and actual one) are 485 // Non-simple cross origin requests (both preflight and actual one) are
486 // not allowed to follow redirect. 486 // not allowed to follow redirect.
487 if (m_crossOriginNonSimpleRequest) { 487 if (m_crossOriginNonSimpleRequest) {
488 accessControlErrorDescription = "The request was redirected to '"+ r equest.url().getString() + "', which is disallowed for cross-origin requests tha t require preflight."; 488 accessControlErrorDescription = "The request was redirected to '"+ r equest.url().getString() + "', which is disallowed for cross-origin requests tha t require preflight.";
489 } else { 489 } else {
490 // The redirect response must pass the access control check if the 490 // The redirect response must pass the access control check if the
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 void DocumentThreadableLoader::reportResponseReceived(unsigned long identifier, const ResourceResponse& response) 628 void DocumentThreadableLoader::reportResponseReceived(unsigned long identifier, const ResourceResponse& response)
629 { 629 {
630 LocalFrame* frame = document().frame(); 630 LocalFrame* frame = document().frame();
631 // We are seeing crashes caused by nullptr (crbug.com/578849). But the frame 631 // We are seeing crashes caused by nullptr (crbug.com/578849). But the frame
632 // must be set here. TODO(horo): Find the root cause of the unset frame. 632 // must be set here. TODO(horo): Find the root cause of the unset frame.
633 ASSERT(frame); 633 ASSERT(frame);
634 if (!frame) 634 if (!frame)
635 return; 635 return;
636 DocumentLoader* loader = frame->loader().documentLoader(); 636 DocumentLoader* loader = frame->loader().documentLoader();
637 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame , response)); 637 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame , response));
638 InspectorInstrumentation::didReceiveResourceResponse(frame, identifier, load er, response, resource() ? resource()->loader() : 0); 638 InspectorInstrumentation::didReceiveResourceResponse(frame, identifier, load er, response, resource());
639 frame->console().reportResourceResponseReceived(loader, identifier, response ); 639 frame->console().reportResourceResponseReceived(loader, identifier, response );
640 } 640 }
641 641
642 void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re sourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) 642 void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re sourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle)
643 { 643 {
644 ASSERT(m_client); 644 ASSERT(m_client);
645 645
646 if (!m_actualRequest.isNull()) { 646 if (!m_actualRequest.isNull()) {
647 reportResponseReceived(identifier, response); 647 reportResponseReceived(identifier, response);
648 handlePreflightResponse(response); 648 handlePreflightResponse(response);
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 return m_securityOrigin ? m_securityOrigin.get() : document().getSecurityOri gin(); 974 return m_securityOrigin ? m_securityOrigin.get() : document().getSecurityOri gin();
975 } 975 }
976 976
977 Document& DocumentThreadableLoader::document() const 977 Document& DocumentThreadableLoader::document() const
978 { 978 {
979 ASSERT(m_document); 979 ASSERT(m_document);
980 return *m_document; 980 return *m_document;
981 } 981 }
982 982
983 } // namespace blink 983 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.cpp ('k') | third_party/WebKit/Source/core/loader/FrameFetchContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698