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

Side by Side Diff: third_party/WebKit/Source/core/loader/ProgressTracker.cpp

Issue 2412803004: Don't update progress when Frame::isLoading() is false (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (!item) 165 if (!item)
166 return; 166 return;
167 167
168 item->bytesReceived += length; 168 item->bytesReceived += length;
169 if (item->bytesReceived > item->estimatedLength) 169 if (item->bytesReceived > item->estimatedLength)
170 item->estimatedLength = item->bytesReceived * 2; 170 item->estimatedLength = item->bytesReceived * 2;
171 maybeSendProgress(); 171 maybeSendProgress();
172 } 172 }
173 173
174 void ProgressTracker::maybeSendProgress() { 174 void ProgressTracker::maybeSendProgress() {
175 if (!m_frame->isLoading())
176 return;
177
175 m_progressValue = initialProgressValue + 0.1; // +0.1 for committing 178 m_progressValue = initialProgressValue + 0.1; // +0.1 for committing
176 if (m_finishedParsing) 179 if (m_finishedParsing)
177 m_progressValue += 0.2; 180 m_progressValue += 0.2;
178 181
179 long long bytesReceived = 0; 182 long long bytesReceived = 0;
180 long long estimatedBytesForPendingRequests = 0; 183 long long estimatedBytesForPendingRequests = 0;
181 for (const auto& progressItem : m_progressItems) { 184 for (const auto& progressItem : m_progressItems) {
182 bytesReceived += progressItem.value->bytesReceived; 185 bytesReceived += progressItem.value->bytesReceived;
183 estimatedBytesForPendingRequests += progressItem.value->estimatedLength; 186 estimatedBytesForPendingRequests += progressItem.value->estimatedLength;
184 } 187 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void ProgressTracker::completeProgress(unsigned long identifier) { 231 void ProgressTracker::completeProgress(unsigned long identifier) {
229 ProgressItem* item = m_progressItems.get(identifier); 232 ProgressItem* item = m_progressItems.get(identifier);
230 if (!item) 233 if (!item)
231 return; 234 return;
232 235
233 item->estimatedLength = item->bytesReceived; 236 item->estimatedLength = item->bytesReceived;
234 maybeSendProgress(); 237 maybeSendProgress();
235 } 238 }
236 239
237 } // namespace blink 240 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698