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

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: Created 5 years, 3 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 f1aaf35ded75c5e9d21ed0548344ec9bd3c24798..1b89c6ad343162c20e8036ef4f036e4f1aa59b28 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()
Nate Chapin 2015/10/07 19:40:40 I could go either way on whether this belongs here
+{
+ ResourcePriority priority;
+ ResourceClientWalker<ResourceClient> w(m_clients);
esprehn 2015/10/08 05:39:11 walker
Nate Chapin 2015/10/08 21:26:37 Done.
+ while (ResourceClient* c = w.next()) {
esprehn 2015/10/08 05:39:11 client = walker.next() we should also really make
Nate Chapin 2015/10/08 21:26:37 I'll add that to my list of things to do eventuall
+ ResourcePriority nextPriority = c->updatePriority(this);
+ 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)));

Powered by Google App Engine
This is Rietveld 408576698