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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2519893002: Stop dispatching encoded-data-length on each data chunk arrival (Closed)
Patch Set: fix 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 } 1179 }
1180 1180
1181 void ResourceFetcher::didFailLoading(Resource* resource, 1181 void ResourceFetcher::didFailLoading(Resource* resource,
1182 const ResourceError& error) { 1182 const ResourceError& error) {
1183 network_instrumentation::endResourceLoad( 1183 network_instrumentation::endResourceLoad(
1184 resource->identifier(), network_instrumentation::RequestOutcome::Fail); 1184 resource->identifier(), network_instrumentation::RequestOutcome::Fail);
1185 removeResourceLoader(resource->loader()); 1185 removeResourceLoader(resource->loader());
1186 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); 1186 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource));
1187 bool isInternalRequest = resource->options().initiatorInfo.name == 1187 bool isInternalRequest = resource->options().initiatorInfo.name ==
1188 FetchInitiatorTypeNames::internal; 1188 FetchInitiatorTypeNames::internal;
1189 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); 1189 context().dispatchDidFail(resource->identifier(), error,
1190 resource->response().encodedDataLength(),
1191 isInternalRequest);
1190 resource->error(error); 1192 resource->error(error);
1191 context().didLoadResource(resource); 1193 context().didLoadResource(resource);
1192 1194
1193 if (resource->isImage() && 1195 if (resource->isImage() &&
1194 toImageResource(resource)->shouldReloadBrokenPlaceholder()) { 1196 toImageResource(resource)->shouldReloadBrokenPlaceholder()) {
1195 toImageResource(resource)->reloadIfLoFiOrPlaceholder(this); 1197 toImageResource(resource)->reloadIfLoFiOrPlaceholder(this);
1196 } 1198 }
1197 } 1199 }
1198 1200
1199 void ResourceFetcher::didReceiveResponse( 1201 void ResourceFetcher::didReceiveResponse(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 if (resource->loader() && response.httpStatusCode() >= 400 && 1255 if (resource->loader() && response.httpStatusCode() >= 400 &&
1254 !resource->shouldIgnoreHTTPStatusCodeErrors()) { 1256 !resource->shouldIgnoreHTTPStatusCodeErrors()) {
1255 resource->loader()->didFail(ResourceError::cancelledError(response.url())); 1257 resource->loader()->didFail(ResourceError::cancelledError(response.url()));
1256 } 1258 }
1257 } 1259 }
1258 1260
1259 void ResourceFetcher::didReceiveData(const Resource* resource, 1261 void ResourceFetcher::didReceiveData(const Resource* resource,
1260 const char* data, 1262 const char* data,
1261 int dataLength, 1263 int dataLength,
1262 int encodedDataLength) { 1264 int encodedDataLength) {
1263 context().dispatchDidReceiveData(resource->identifier(), data, dataLength, 1265 context().dispatchDidReceiveData(resource->identifier(), data, dataLength);
1264 encodedDataLength);
1265 } 1266 }
1266 1267
1267 void ResourceFetcher::didDownloadData(const Resource* resource, 1268 void ResourceFetcher::didDownloadData(const Resource* resource,
1268 int dataLength, 1269 int dataLength,
1269 int encodedDataLength) { 1270 int encodedDataLength) {
1270 context().dispatchDidDownloadData(resource->identifier(), dataLength, 1271 context().dispatchDidDownloadData(resource->identifier(), dataLength,
1271 encodedDataLength); 1272 encodedDataLength);
1272 } 1273 }
1273 1274
1274 void ResourceFetcher::acceptDataFromThreadedReceiver(unsigned long identifier, 1275 void ResourceFetcher::acceptDataFromThreadedReceiver(unsigned long identifier,
1275 const char* data, 1276 const char* data,
1276 int dataLength, 1277 int dataLength,
1277 int encodedDataLength) { 1278 int encodedDataLength) {
1278 context().dispatchDidReceiveData(identifier, data, dataLength, 1279 context().dispatchDidReceiveData(identifier, data, dataLength);
1279 encodedDataLength);
1280 } 1280 }
1281 1281
1282 void ResourceFetcher::moveResourceLoaderToNonBlocking(ResourceLoader* loader) { 1282 void ResourceFetcher::moveResourceLoaderToNonBlocking(ResourceLoader* loader) {
1283 m_nonBlockingLoaders.add(loader); 1283 m_nonBlockingLoaders.add(loader);
1284 m_loaders.remove(loader); 1284 m_loaders.remove(loader);
1285 } 1285 }
1286 1286
1287 bool ResourceFetcher::startLoad(Resource* resource) { 1287 bool ResourceFetcher::startLoad(Resource* resource) {
1288 DCHECK(resource); 1288 DCHECK(resource);
1289 DCHECK(resource->stillNeedsLoad()); 1289 DCHECK(resource->stillNeedsLoad());
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 visitor->trace(m_context); 1641 visitor->trace(m_context);
1642 visitor->trace(m_archive); 1642 visitor->trace(m_archive);
1643 visitor->trace(m_loaders); 1643 visitor->trace(m_loaders);
1644 visitor->trace(m_nonBlockingLoaders); 1644 visitor->trace(m_nonBlockingLoaders);
1645 visitor->trace(m_documentResources); 1645 visitor->trace(m_documentResources);
1646 visitor->trace(m_preloads); 1646 visitor->trace(m_preloads);
1647 visitor->trace(m_resourceTimingInfoMap); 1647 visitor->trace(m_resourceTimingInfoMap);
1648 } 1648 }
1649 1649
1650 } // namespace blink 1650 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698