Commit 55c5863a authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Make RendererSiderResourceLoader work well with ResourceLoadScheduler

Make IsThrottable return false when it's throttled by WebFrameScheduler.

Bug: 785770
Change-Id: Idb075c759a10636b406505287b3a1139db54678b
Reviewed-on: https://chromium-review.googlesource.com/799539
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520817}
parent f12286c9
......@@ -243,16 +243,25 @@ void ResourceLoadScheduler::OnNetworkQuiet() {
bool ResourceLoadScheduler::IsThrottablePriority(
ResourceLoadPriority priority) const {
if (Platform::Current()->IsRendererSideResourceSchedulerEnabled()) {
if (priority >= ResourceLoadPriority::kMedium)
return false;
if (!Platform::Current()->IsRendererSideResourceSchedulerEnabled())
return true;
if (RuntimeEnabledFeatures::ResourceLoadSchedulerEnabled()) {
// If this scheduler is throttled by the associated WebFrameScheduler,
// consider every prioritiy as throttable.
const auto state = frame_scheduler_throttling_state_;
if (state == WebFrameScheduler::ThrottlingState::kThrottled ||
state == WebFrameScheduler::ThrottlingState::kStopped) {
return true;
}
}
return true;
return priority < ResourceLoadPriority::kMedium;
}
void ResourceLoadScheduler::OnThrottlingStateChanged(
WebFrameScheduler::ThrottlingState state) {
frame_scheduler_throttling_state_ = state;
switch (state) {
case WebFrameScheduler::ThrottlingState::kThrottled:
if (throttling_history_ == ThrottlingHistory::kInitial)
......
......@@ -187,6 +187,8 @@ class PLATFORM_EXPORT ResourceLoadScheduler final
kStopped,
};
ThrottlingHistory throttling_history_ = ThrottlingHistory::kInitial;
WebFrameScheduler::ThrottlingState frame_scheduler_throttling_state_ =
WebFrameScheduler::ThrottlingState::kNotThrottled;
// Holds clients that haven't been granted, and are waiting for a grant.
HeapHashMap<ClientId, Member<ClientWithPriority>> pending_request_map_;
......
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