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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 1378743002: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better names / cleanup Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index f54a0dc0d5b9c056c4624bbdcd83fabb292eb042..5c9e26944e13937b88c2a44d25fefd9a9caf3a04 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -941,10 +941,25 @@ size_t Resource::overheadSize() const
void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPriorityValue)
{
+ m_resourceRequest.setPriority(loadPriority, intraPriorityValue);
if (m_loader)
m_loader->didChangePriority(loadPriority, intraPriorityValue);
}
+ResourcePriority Resource::priorityFromClients()
+{
+ ResourcePriority priority;
+ ResourceClientWalker<ResourceClient> walker(m_clients);
+ while (ResourceClient* c = walker.next()) {
+ ResourcePriority nextPriority = c->computeResourcePriority();
+ if (nextPriority.visibility == ResourcePriority::NotVisible)
+ continue;
+ priority.visibility = ResourcePriority::Visible;
+ priority.intraPriorityValue += nextPriority.intraPriorityValue;
+ }
+ return priority;
+}
+
Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler()
{
DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ResourceCallback>, callbackHandler, (adoptPtrWillBeNoop(new ResourceCallback)));
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ResourceClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698