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

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

Issue 153983004: Schedule image resource downloads by decreasing visual impact - Blink Side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + variable name change. Created 6 years, 9 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/fetch/ResourceFetcher.h ('k') | Source/core/fetch/ResourceLoadPriorityOptimizer.h » ('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) 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 rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 if (!resource->hasClients()) 640 if (!resource->hasClients())
641 m_deadStatsRecorder.update(policy); 641 m_deadStatsRecorder.update(policy);
642 642
643 if (policy != Use) 643 if (policy != Use)
644 resource->setIdentifier(createUniqueIdentifier()); 644 resource->setIdentifier(createUniqueIdentifier());
645 645
646 if (!request.forPreload() || policy != Use) { 646 if (!request.forPreload() || policy != Use) {
647 ResourceLoadPriority priority = loadPriority(type, request); 647 ResourceLoadPriority priority = loadPriority(type, request);
648 if (priority != resource->resourceRequest().priority()) { 648 if (priority != resource->resourceRequest().priority()) {
649 resource->resourceRequest().setPriority(priority); 649 resource->resourceRequest().setPriority(priority);
650 resource->didChangePriority(priority); 650 resource->didChangePriority(priority, 0);
651 } 651 }
652 } 652 }
653 653
654 if (resourceNeedsLoad(resource.get(), request, policy)) { 654 if (resourceNeedsLoad(resource.get(), request, policy)) {
655 if (!shouldLoadNewResource(type)) { 655 if (!shouldLoadNewResource(type)) {
656 if (memoryCache()->contains(resource.get())) 656 if (memoryCache()->contains(resource.get()))
657 memoryCache()->remove(resource.get()); 657 memoryCache()->remove(resource.get());
658 return 0; 658 return 0;
659 } 659 }
660 660
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 } 1174 }
1175 m_preloads.clear(); 1175 m_preloads.clear();
1176 } 1176 }
1177 1177
1178 void ResourceFetcher::didFinishLoading(const Resource* resource, double finishTi me, int64_t encodedDataLength) 1178 void ResourceFetcher::didFinishLoading(const Resource* resource, double finishTi me, int64_t encodedDataLength)
1179 { 1179 {
1180 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); 1180 TRACE_EVENT_ASYNC_END0("net", "Resource", resource);
1181 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(), finishTime, encodedDataLength); 1181 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(), finishTime, encodedDataLength);
1182 } 1182 }
1183 1183
1184 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc eLoadPriority loadPriority) 1184 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc eLoadPriority loadPriority, int intraPriorityValue)
1185 { 1185 {
1186 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority", "priority", loadPriority); 1186 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority", "priority", loadPriority);
1187 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio rity); 1187 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio rity, intraPriorityValue);
1188 } 1188 }
1189 1189
1190 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error) 1190 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error)
1191 { 1191 {
1192 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); 1192 TRACE_EVENT_ASYNC_END0("net", "Resource", resource);
1193 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); 1193 context().dispatchDidFail(m_documentLoader, resource->identifier(), error);
1194 } 1194 }
1195 1195
1196 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo) 1196 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo)
1197 { 1197 {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 case Revalidate: 1395 case Revalidate:
1396 ++m_revalidateCount; 1396 ++m_revalidateCount;
1397 return; 1397 return;
1398 case Use: 1398 case Use:
1399 ++m_useCount; 1399 ++m_useCount;
1400 return; 1400 return;
1401 } 1401 }
1402 } 1402 }
1403 1403
1404 } 1404 }
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceFetcher.h ('k') | Source/core/fetch/ResourceLoadPriorityOptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698