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

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

Issue 2511313002: transferSize implementation (Closed)
Patch Set: addressed comments Created 4 years 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) 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ClientRedirectPolicy clientRedirectPolicy) 100 ClientRedirectPolicy clientRedirectPolicy)
101 : m_frame(frame), 101 : m_frame(frame),
102 m_fetcher(FrameFetchContext::createContextAndFetcher(this, nullptr)), 102 m_fetcher(FrameFetchContext::createContextAndFetcher(this, nullptr)),
103 m_originalRequest(req), 103 m_originalRequest(req),
104 m_substituteData(substituteData), 104 m_substituteData(substituteData),
105 m_request(req), 105 m_request(req),
106 m_isClientRedirect(clientRedirectPolicy == 106 m_isClientRedirect(clientRedirectPolicy ==
107 ClientRedirectPolicy::ClientRedirect), 107 ClientRedirectPolicy::ClientRedirect),
108 m_replacesCurrentHistoryItem(false), 108 m_replacesCurrentHistoryItem(false),
109 m_dataReceived(false), 109 m_dataReceived(false),
110 m_mainResourceIdentifier(0),
110 m_navigationType(NavigationTypeOther), 111 m_navigationType(NavigationTypeOther),
111 m_documentLoadTiming(*this), 112 m_documentLoadTiming(*this),
112 m_timeOfLastDataReceived(0.0), 113 m_timeOfLastDataReceived(0.0),
113 m_applicationCacheHost(ApplicationCacheHost::create(this)), 114 m_applicationCacheHost(ApplicationCacheHost::create(this)),
114 m_wasBlockedAfterXFrameOptionsOrCSP(false), 115 m_wasBlockedAfterXFrameOptionsOrCSP(false),
115 m_state(NotStarted), 116 m_state(NotStarted),
116 m_inDataReceived(false), 117 m_inDataReceived(false),
117 m_dataBuffer(SharedBuffer::create()) { 118 m_dataBuffer(SharedBuffer::create()) {
118 // The document URL needs to be added to the head of the list as that is 119 // The document URL needs to be added to the head of the list as that is
119 // where the redirects originated. 120 // where the redirects originated.
(...skipping 18 matching lines...) Expand all
138 visitor->trace(m_fetcher); 139 visitor->trace(m_fetcher);
139 visitor->trace(m_mainResource); 140 visitor->trace(m_mainResource);
140 visitor->trace(m_writer); 141 visitor->trace(m_writer);
141 visitor->trace(m_documentLoadTiming); 142 visitor->trace(m_documentLoadTiming);
142 visitor->trace(m_applicationCacheHost); 143 visitor->trace(m_applicationCacheHost);
143 visitor->trace(m_contentSecurityPolicy); 144 visitor->trace(m_contentSecurityPolicy);
144 RawResourceClient::trace(visitor); 145 RawResourceClient::trace(visitor);
145 } 146 }
146 147
147 unsigned long DocumentLoader::mainResourceIdentifier() const { 148 unsigned long DocumentLoader::mainResourceIdentifier() const {
148 return m_mainResource ? m_mainResource->identifier() : 0; 149 return m_mainResourceIdentifier;
150 }
151
152 ResourceTimingInfo* DocumentLoader::getMainResourceTimingInfo() const {
153 return fetcher()->getMainResourceTimingInfo(mainResourceIdentifier());
149 } 154 }
150 155
151 const ResourceRequest& DocumentLoader::originalRequest() const { 156 const ResourceRequest& DocumentLoader::originalRequest() const {
152 return m_originalRequest; 157 return m_originalRequest;
153 } 158 }
154 159
155 const ResourceRequest& DocumentLoader::request() const { 160 const ResourceRequest& DocumentLoader::request() const {
156 return m_request; 161 return m_request;
157 } 162 }
158 163
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 } 716 }
712 717
713 DEFINE_STATIC_LOCAL( 718 DEFINE_STATIC_LOCAL(
714 ResourceLoaderOptions, mainResourceLoadOptions, 719 ResourceLoaderOptions, mainResourceLoadOptions,
715 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, 720 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials,
716 CheckContentSecurityPolicy, DocumentContext)); 721 CheckContentSecurityPolicy, DocumentContext));
717 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, 722 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document,
718 mainResourceLoadOptions); 723 mainResourceLoadOptions);
719 m_mainResource = 724 m_mainResource =
720 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); 725 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData);
726 m_mainResourceIdentifier = m_mainResource ? m_mainResource->identifier() : 0;
721 727
722 // PlzNavigate: 728 // PlzNavigate:
723 // The final access checks are still performed here, potentially rejecting 729 // The final access checks are still performed here, potentially rejecting
724 // the "provisional" load, but the browser side already expects the renderer 730 // the "provisional" load, but the browser side already expects the renderer
725 // to be able to unconditionally commit. 731 // to be able to unconditionally commit.
726 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && 732 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() &&
727 m_mainResource->errorOccurred())) { 733 m_mainResource->errorOccurred())) {
728 m_request = ResourceRequest(blankURL()); 734 m_request = ResourceRequest(blankURL());
729 maybeLoadEmpty(); 735 maybeLoadEmpty();
730 return; 736 return;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 m_writer ? m_writer->encoding() : emptyAtom, true, 800 m_writer ? m_writer->encoding() : emptyAtom, true,
795 ForceSynchronousParsing); 801 ForceSynchronousParsing);
796 if (!source.isNull()) 802 if (!source.isNull())
797 m_writer->appendReplacingData(source); 803 m_writer->appendReplacingData(source);
798 endWriting(); 804 endWriting();
799 } 805 }
800 806
801 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 807 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
802 808
803 } // namespace blink 809 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698