Commit d8275f9a authored by Takashi Toyoshima's avatar Takashi Toyoshima Committed by Commit Bot

ResourceLoadScheduler: Change only running loader's priority

In DidChangePriority, the last patch changed to check the ClientId,
but it isn't enough to check the running status. This patch adds
a new ResourceLoadScheduler interface to query if the specified
client is in running state.

Bug: 819931
Change-Id: Ibfb6ecc529a21709f144796f5a4c039e2862884e
Reviewed-on: https://chromium-review.googlesource.com/964070Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543630}
parent 5ccdec62
...@@ -178,6 +178,10 @@ class PLATFORM_EXPORT ResourceLoadScheduler final ...@@ -178,6 +178,10 @@ class PLATFORM_EXPORT ResourceLoadScheduler final
// TrafficReportHints::InvalidInstance() can be used to omit reporting. // TrafficReportHints::InvalidInstance() can be used to omit reporting.
bool Release(ClientId, ReleaseOption, const TrafficReportHints&); bool Release(ClientId, ReleaseOption, const TrafficReportHints&);
// Checks if the specified client was already scheduled to call Run(), but
// haven't call Release() yet.
bool IsRunning(ClientId id) { return running_requests_.Contains(id); }
// Sets outstanding limit for testing. // Sets outstanding limit for testing.
void SetOutstandingLimitForTesting(size_t limit) { void SetOutstandingLimitForTesting(size_t limit) {
SetOutstandingLimitForTesting(limit, limit); SetOutstandingLimitForTesting(limit, limit);
......
...@@ -168,8 +168,9 @@ void ResourceLoader::SetDefersLoading(bool defers) { ...@@ -168,8 +168,9 @@ void ResourceLoader::SetDefersLoading(bool defers) {
void ResourceLoader::DidChangePriority(ResourceLoadPriority load_priority, void ResourceLoader::DidChangePriority(ResourceLoadPriority load_priority,
int intra_priority_value) { int intra_priority_value) {
if (scheduler_client_id_ != ResourceLoadScheduler::kInvalidClientId) { if (scheduler_->IsRunning(scheduler_client_id_)) {
DCHECK(loader_); DCHECK(loader_);
DCHECK_NE(ResourceLoadScheduler::kInvalidClientId, scheduler_client_id_);
loader_->DidChangePriority( loader_->DidChangePriority(
static_cast<WebURLRequest::Priority>(load_priority), static_cast<WebURLRequest::Priority>(load_priority),
intra_priority_value); intra_priority_value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment