⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246615 in webkit


Ignore:
Timestamp:
Jun 19, 2019, 4:36:35 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

DownloadMonitor::measuredThroughputRate should approach zero with no throughput
https://bugs.webkit.org/show_bug.cgi?id=198981
<rdar://problem/51456914>

Patch by Alex Christensen <achristensen@webkit.org> on 2019-06-19
Reviewed by Geoffrey Garen.

When the timer fires to approximate the download rate, add a new timestamp with 0 bytes received since the last time we received bytes.
Then, if there's only one timestamp, assume the throughput rate is 0 instead of infinite.
This will prevent false positives estimating large download rates based on old data when the throughput drops to 0.

  • NetworkProcess/Downloads/DownloadMonitor.cpp:

(WebKit::DownloadMonitor::measuredThroughputRate const):
(WebKit::DownloadMonitor::timerFired):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r246608 r246615  
     12019-06-19  Alex Christensen  <achristensen@webkit.org>
     2
     3        DownloadMonitor::measuredThroughputRate should approach zero with no throughput
     4        https://bugs.webkit.org/show_bug.cgi?id=198981
     5        <rdar://problem/51456914>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        When the timer fires to approximate the download rate, add a new timestamp with 0 bytes received since the last time we received bytes.
     10        Then, if there's only one timestamp, assume the throughput rate is 0 instead of infinite.
     11        This will prevent false positives estimating large download rates based on old data when the throughput drops to 0.
     12
     13        * NetworkProcess/Downloads/DownloadMonitor.cpp:
     14        (WebKit::DownloadMonitor::measuredThroughputRate const):
     15        (WebKit::DownloadMonitor::timerFired):
     16
    1172019-06-19  Sihui Liu  <sihui_liu@apple.com>
    218
  • trunk/Source/WebKit/NetworkProcess/Downloads/DownloadMonitor.cpp

    r243110 r246615  
    7979    double seconds = timeDifference.seconds();
    8080    if (!seconds)
    81         return std::numeric_limits<double>::max();
     81        return 0;
    8282    return bytes / seconds;
    8383}
     
    114114void DownloadMonitor::timerFired()
    115115{
     116    downloadReceivedBytes(0);
     117
    116118    RELEASE_ASSERT(m_interval < WTF_ARRAY_LENGTH(throughputIntervals));
    117119    if (measuredThroughputRate() < throughputIntervals[m_interval].bytesPerSecond) {
Note: See TracChangeset for help on using the changeset viewer.