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

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: Changes from review. Created 6 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
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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if (!resource->hasClients()) 638 if (!resource->hasClients())
639 m_deadStatsRecorder.update(policy); 639 m_deadStatsRecorder.update(policy);
640 640
641 if (policy != Use) 641 if (policy != Use)
642 resource->setIdentifier(createUniqueIdentifier()); 642 resource->setIdentifier(createUniqueIdentifier());
643 643
644 if (!request.forPreload() || policy != Use) { 644 if (!request.forPreload() || policy != Use) {
645 ResourceLoadPriority priority = loadPriority(type, request); 645 ResourceLoadPriority priority = loadPriority(type, request);
646 if (priority != resource->resourceRequest().priority()) { 646 if (priority != resource->resourceRequest().priority()) {
647 resource->resourceRequest().setPriority(priority); 647 resource->resourceRequest().setPriority(priority);
648 resource->didChangePriority(priority); 648 resource->didChangePriority(priority, 0);
649 } 649 }
650 } 650 }
651 651
652 if (resourceNeedsLoad(resource.get(), request, policy)) { 652 if (resourceNeedsLoad(resource.get(), request, policy)) {
653 if (!shouldLoadNewResource(type)) { 653 if (!shouldLoadNewResource(type)) {
654 if (resource->inCache()) 654 if (resource->inCache())
655 memoryCache()->remove(resource.get()); 655 memoryCache()->remove(resource.get());
656 return 0; 656 return 0;
657 } 657 }
658 658
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 { 1202 {
1203 m_pendingPreloads.clear(); 1203 m_pendingPreloads.clear();
1204 } 1204 }
1205 1205
1206 void ResourceFetcher::didFinishLoading(const Resource* resource, double finishTi me) 1206 void ResourceFetcher::didFinishLoading(const Resource* resource, double finishTi me)
1207 { 1207 {
1208 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); 1208 TRACE_EVENT_ASYNC_END0("net", "Resource", resource);
1209 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(), finishTime); 1209 context().dispatchDidFinishLoading(m_documentLoader, resource->identifier(), finishTime);
1210 } 1210 }
1211 1211
1212 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc eLoadPriority loadPriority) 1212 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc eLoadPriority loadPriority, int intraPriorityValue)
1213 { 1213 {
1214 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority", "priority", loadPriority); 1214 TRACE_EVENT_ASYNC_STEP_INTO1("net", "Resource", resource, "ChangePriority", "priority", loadPriority);
1215 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio rity); 1215 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio rity, intraPriorityValue);
1216 } 1216 }
1217 1217
1218 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error) 1218 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr or& error)
1219 { 1219 {
1220 TRACE_EVENT_ASYNC_END0("net", "Resource", resource); 1220 TRACE_EVENT_ASYNC_END0("net", "Resource", resource);
1221 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); 1221 context().dispatchDidFail(m_documentLoader, resource->identifier(), error);
1222 } 1222 }
1223 1223
1224 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo) 1224 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo)
1225 { 1225 {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 case Revalidate: 1413 case Revalidate:
1414 ++m_revalidateCount; 1414 ++m_revalidateCount;
1415 return; 1415 return;
1416 case Use: 1416 case Use:
1417 ++m_useCount; 1417 ++m_useCount;
1418 return; 1418 return;
1419 } 1419 }
1420 } 1420 }
1421 1421
1422 } 1422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698