| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (m_frame->settings()->getProgressBarCompletion() != | 144 if (m_frame->settings()->getProgressBarCompletion() != |
| 145 ProgressBarCompletion::LoadEvent && | 145 ProgressBarCompletion::LoadEvent && |
| 146 (m_finishedParsing || priority < ResourceLoadPriorityHigh)) | 146 (m_finishedParsing || priority < ResourceLoadPriorityHigh)) |
| 147 return; | 147 return; |
| 148 m_progressItems.set(identifier, WTF::makeUnique<ProgressItem>( | 148 m_progressItems.set(identifier, WTF::makeUnique<ProgressItem>( |
| 149 progressItemDefaultEstimatedLength)); | 149 progressItemDefaultEstimatedLength)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ProgressTracker::incrementProgress(unsigned long identifier, | 152 void ProgressTracker::incrementProgress(unsigned long identifier, |
| 153 const ResourceResponse& response) { | 153 const ResourceResponse& response) { |
| 154 ProgressItem* item = m_progressItems.get(identifier); | 154 ProgressItem* item = m_progressItems.at(identifier); |
| 155 if (!item) | 155 if (!item) |
| 156 return; | 156 return; |
| 157 | 157 |
| 158 long long estimatedLength = response.expectedContentLength(); | 158 long long estimatedLength = response.expectedContentLength(); |
| 159 if (estimatedLength < 0) | 159 if (estimatedLength < 0) |
| 160 estimatedLength = progressItemDefaultEstimatedLength; | 160 estimatedLength = progressItemDefaultEstimatedLength; |
| 161 item->bytesReceived = 0; | 161 item->bytesReceived = 0; |
| 162 item->estimatedLength = estimatedLength; | 162 item->estimatedLength = estimatedLength; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void ProgressTracker::incrementProgress(unsigned long identifier, int length) { | 165 void ProgressTracker::incrementProgress(unsigned long identifier, int length) { |
| 166 ProgressItem* item = m_progressItems.get(identifier); | 166 ProgressItem* item = m_progressItems.at(identifier); |
| 167 if (!item) | 167 if (!item) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 item->bytesReceived += length; | 170 item->bytesReceived += length; |
| 171 if (item->bytesReceived > item->estimatedLength) | 171 if (item->bytesReceived > item->estimatedLength) |
| 172 item->estimatedLength = item->bytesReceived * 2; | 172 item->estimatedLength = item->bytesReceived * 2; |
| 173 maybeSendProgress(); | 173 maybeSendProgress(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ProgressTracker::maybeSendProgress() { | 176 void ProgressTracker::maybeSendProgress() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 m_progressValue - m_lastNotifiedProgressValue; | 224 m_progressValue - m_lastNotifiedProgressValue; |
| 225 if (notificationProgressDelta >= progressNotificationInterval || | 225 if (notificationProgressDelta >= progressNotificationInterval || |
| 226 notifiedProgressTimeDelta >= progressNotificationTimeInterval) { | 226 notifiedProgressTimeDelta >= progressNotificationTimeInterval) { |
| 227 frameLoaderClient()->progressEstimateChanged(m_progressValue); | 227 frameLoaderClient()->progressEstimateChanged(m_progressValue); |
| 228 m_lastNotifiedProgressValue = m_progressValue; | 228 m_lastNotifiedProgressValue = m_progressValue; |
| 229 m_lastNotifiedProgressTime = now; | 229 m_lastNotifiedProgressTime = now; |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 void ProgressTracker::completeProgress(unsigned long identifier) { | 233 void ProgressTracker::completeProgress(unsigned long identifier) { |
| 234 ProgressItem* item = m_progressItems.get(identifier); | 234 ProgressItem* item = m_progressItems.at(identifier); |
| 235 if (!item) | 235 if (!item) |
| 236 return; | 236 return; |
| 237 | 237 |
| 238 item->estimatedLength = item->bytesReceived; | 238 item->estimatedLength = item->bytesReceived; |
| 239 maybeSendProgress(); | 239 maybeSendProgress(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |