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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 if (!m_frame->isLoading()) | 138 if (!m_frame->isLoading()) |
139 return; | 139 return; |
140 // All of the progress bar completion policies besides LoadEvent instead block | 140 // All of the progress bar completion policies besides LoadEvent instead block |
141 // on parsing completion, which corresponds to finishing parsing. For those | 141 // on parsing completion, which corresponds to finishing parsing. For those |
142 // policies, don't consider resource load that start after DOMContentLoaded | 142 // policies, don't consider resource load that start after DOMContentLoaded |
143 // finishes. | 143 // finishes. |
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( |
149 progressItemDefaultEstimatedLength)); | 149 identifier, |
| 150 WTF::makeUnique<ProgressItem>(progressItemDefaultEstimatedLength)); |
150 } | 151 } |
151 | 152 |
152 void ProgressTracker::incrementProgress(unsigned long identifier, | 153 void ProgressTracker::incrementProgress(unsigned long identifier, |
153 const ResourceResponse& response) { | 154 const ResourceResponse& response) { |
154 ProgressItem* item = m_progressItems.get(identifier); | 155 ProgressItem* item = m_progressItems.get(identifier); |
155 if (!item) | 156 if (!item) |
156 return; | 157 return; |
157 | 158 |
158 long long estimatedLength = response.expectedContentLength(); | 159 long long estimatedLength = response.expectedContentLength(); |
159 if (estimatedLength < 0) | 160 if (estimatedLength < 0) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void ProgressTracker::completeProgress(unsigned long identifier) { | 234 void ProgressTracker::completeProgress(unsigned long identifier) { |
234 ProgressItem* item = m_progressItems.get(identifier); | 235 ProgressItem* item = m_progressItems.get(identifier); |
235 if (!item) | 236 if (!item) |
236 return; | 237 return; |
237 | 238 |
238 item->estimatedLength = item->bytesReceived; | 239 item->estimatedLength = item->bytesReceived; |
239 maybeSendProgress(); | 240 maybeSendProgress(); |
240 } | 241 } |
241 | 242 |
242 } // namespace blink | 243 } // namespace blink |
OLD | NEW |