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

Side by Side Diff: Source/core/loader/DocumentLoader.cpp

Issue 916273002: Make DocumentLoader::timing return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase against ToT Created 5 years, 10 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
« no previous file with comments | « Source/core/loader/DocumentLoader.h ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 { 220 {
221 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading() || In spectorInstrumentation::isDebuggerPaused(m_frame)); 221 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading() || In spectorInstrumentation::isDebuggerPaused(m_frame));
222 222
223 RefPtr<DocumentLoader> protect(this); 223 RefPtr<DocumentLoader> protect(this);
224 224
225 double responseEndTime = finishTime; 225 double responseEndTime = finishTime;
226 if (!responseEndTime) 226 if (!responseEndTime)
227 responseEndTime = m_timeOfLastDataReceived; 227 responseEndTime = m_timeOfLastDataReceived;
228 if (!responseEndTime) 228 if (!responseEndTime)
229 responseEndTime = monotonicallyIncreasingTime(); 229 responseEndTime = monotonicallyIncreasingTime();
230 timing()->setResponseEnd(responseEndTime); 230 timing().setResponseEnd(responseEndTime);
231 231
232 commitIfReady(); 232 commitIfReady();
233 if (!frameLoader()) 233 if (!frameLoader())
234 return; 234 return;
235 235
236 if (!maybeCreateArchive()) { 236 if (!maybeCreateArchive()) {
237 // If this is an empty document, it will not have actually been created yet. Commit dummy data so that 237 // If this is an empty document, it will not have actually been created yet. Commit dummy data so that
238 // DocumentWriter::begin() gets called and creates the Document. 238 // DocumentWriter::begin() gets called and creates the Document.
239 if (!m_writer) 239 if (!m_writer)
240 commitData(0, 0); 240 commitData(0, 0);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Note that there are no asserts here as there are for the other callbacks. This is due to the 317 // Note that there are no asserts here as there are for the other callbacks. This is due to the
318 // fact that this "callback" is sent when starting every load, and the state of callback 318 // fact that this "callback" is sent when starting every load, and the state of callback
319 // deferrals plays less of a part in this function in preventing the bad beh avior deferring 319 // deferrals plays less of a part in this function in preventing the bad beh avior deferring
320 // callbacks is meant to prevent. 320 // callbacks is meant to prevent.
321 ASSERT(!newRequest.isNull()); 321 ASSERT(!newRequest.isNull());
322 if (isFormSubmission(m_navigationType) && !m_frame->document()->contentSecur ityPolicy()->allowFormAction(newRequest.url())) { 322 if (isFormSubmission(m_navigationType) && !m_frame->document()->contentSecur ityPolicy()->allowFormAction(newRequest.url())) {
323 cancelMainResourceLoad(ResourceError::cancelledError(newRequest.url())); 323 cancelMainResourceLoad(ResourceError::cancelledError(newRequest.url()));
324 return; 324 return;
325 } 325 }
326 326
327 ASSERT(timing()->fetchStart()); 327 ASSERT(timing().fetchStart());
328 if (!redirectResponse.isNull()) { 328 if (!redirectResponse.isNull()) {
329 // If the redirecting url is not allowed to display content from the tar get origin, 329 // If the redirecting url is not allowed to display content from the tar get origin,
330 // then block the redirect. 330 // then block the redirect.
331 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redire ctResponse.url()); 331 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redire ctResponse.url());
332 if (!redirectingOrigin->canDisplay(newRequest.url())) { 332 if (!redirectingOrigin->canDisplay(newRequest.url())) {
333 FrameLoader::reportLocalLoadFailed(m_frame, newRequest.url().string( )); 333 FrameLoader::reportLocalLoadFailed(m_frame, newRequest.url().string( ));
334 cancelMainResourceLoad(ResourceError::cancelledError(newRequest.url( ))); 334 cancelMainResourceLoad(ResourceError::cancelledError(newRequest.url( )));
335 return; 335 return;
336 } 336 }
337 timing()->addRedirect(redirectResponse.url(), newRequest.url()); 337 timing().addRedirect(redirectResponse.url(), newRequest.url());
338 } 338 }
339 339
340 // If we're fielding a redirect in response to a POST, force a load from ori gin, since 340 // If we're fielding a redirect in response to a POST, force a load from ori gin, since
341 // this is a common site technique to return to a page viewing some data tha t the POST 341 // this is a common site technique to return to a page viewing some data tha t the POST
342 // just modified. 342 // just modified.
343 if (newRequest.cachePolicy() == UseProtocolCachePolicy && isRedirectAfterPos t(newRequest, redirectResponse)) 343 if (newRequest.cachePolicy() == UseProtocolCachePolicy && isRedirectAfterPos t(newRequest, redirectResponse))
344 newRequest.setCachePolicy(ReloadBypassingCache); 344 newRequest.setCachePolicy(ReloadBypassingCache);
345 345
346 m_request = newRequest; 346 m_request = newRequest;
347 347
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 m_request.setURL(blankURL()); 661 m_request.setURL(blankURL());
662 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str ing()); 662 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str ing());
663 finishedLoading(monotonicallyIncreasingTime()); 663 finishedLoading(monotonicallyIncreasingTime());
664 return true; 664 return true;
665 } 665 }
666 666
667 void DocumentLoader::startLoadingMainResource() 667 void DocumentLoader::startLoadingMainResource()
668 { 668 {
669 RefPtr<DocumentLoader> protect(this); 669 RefPtr<DocumentLoader> protect(this);
670 m_mainDocumentError = ResourceError(); 670 m_mainDocumentError = ResourceError();
671 timing()->markNavigationStart(); 671 timing().markNavigationStart();
672 ASSERT(!m_mainResource); 672 ASSERT(!m_mainResource);
673 ASSERT(!m_loadingMainResource); 673 ASSERT(!m_loadingMainResource);
674 m_loadingMainResource = true; 674 m_loadingMainResource = true;
675 675
676 if (maybeLoadEmpty()) 676 if (maybeLoadEmpty())
677 return; 677 return;
678 678
679 ASSERT(timing()->navigationStart()); 679 ASSERT(timing().navigationStart());
680 ASSERT(!timing()->fetchStart()); 680 ASSERT(!timing().fetchStart());
681 timing()->markFetchStart(); 681 timing().markFetchStart();
682 willSendRequest(m_request, ResourceResponse()); 682 willSendRequest(m_request, ResourceResponse());
683 683
684 // willSendRequest() may lead to our LocalFrame being detached or cancelling the load via nulling the ResourceRequest. 684 // willSendRequest() may lead to our LocalFrame being detached or cancelling the load via nulling the ResourceRequest.
685 if (!m_frame || m_request.isNull()) 685 if (!m_frame || m_request.isNull())
686 return; 686 return;
687 687
688 m_applicationCacheHost->willStartLoadingMainResource(m_request); 688 m_applicationCacheHost->willStartLoadingMainResource(m_request);
689 prepareSubframeArchiveLoadIfNeeded(); 689 prepareSubframeArchiveLoadIfNeeded();
690 690
691 ResourceRequest request(m_request); 691 ResourceRequest request(m_request);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L() 782 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L()
783 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument) 783 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument)
784 { 784 {
785 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 785 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
786 if (!source.isNull()) 786 if (!source.isNull())
787 m_writer->appendReplacingData(source); 787 m_writer->appendReplacingData(source);
788 endWriting(m_writer.get()); 788 endWriting(m_writer.get());
789 } 789 }
790 790
791 } // namespace blink 791 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentLoader.h ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698