| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (!m_frame->isLoading()) | 134 if (!m_frame->isLoading()) |
| 135 return; | 135 return; |
| 136 // All of the progress bar completion policies besides LoadEvent instead block | 136 // All of the progress bar completion policies besides LoadEvent instead block |
| 137 // on parsing completion, which corresponds to finishing parsing. For those | 137 // on parsing completion, which corresponds to finishing parsing. For those |
| 138 // policies, don't consider resource load that start after DOMContentLoaded | 138 // policies, don't consider resource load that start after DOMContentLoaded |
| 139 // finishes. | 139 // finishes. |
| 140 if (m_frame->settings()->progressBarCompletion() != | 140 if (m_frame->settings()->progressBarCompletion() != |
| 141 ProgressBarCompletion::LoadEvent && | 141 ProgressBarCompletion::LoadEvent && |
| 142 (m_finishedParsing || priority < ResourceLoadPriorityHigh)) | 142 (m_finishedParsing || priority < ResourceLoadPriorityHigh)) |
| 143 return; | 143 return; |
| 144 m_progressItems.set( | 144 m_progressItems.set(identifier, WTF::makeUnique<ProgressItem>( |
| 145 identifier, makeUnique<ProgressItem>(progressItemDefaultEstimatedLength)); | 145 progressItemDefaultEstimatedLength)); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ProgressTracker::incrementProgress(unsigned long identifier, | 148 void ProgressTracker::incrementProgress(unsigned long identifier, |
| 149 const ResourceResponse& response) { | 149 const ResourceResponse& response) { |
| 150 ProgressItem* item = m_progressItems.get(identifier); | 150 ProgressItem* item = m_progressItems.get(identifier); |
| 151 if (!item) | 151 if (!item) |
| 152 return; | 152 return; |
| 153 | 153 |
| 154 long long estimatedLength = response.expectedContentLength(); | 154 long long estimatedLength = response.expectedContentLength(); |
| 155 if (estimatedLength < 0) | 155 if (estimatedLength < 0) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void ProgressTracker::completeProgress(unsigned long identifier) { | 229 void ProgressTracker::completeProgress(unsigned long identifier) { |
| 230 ProgressItem* item = m_progressItems.get(identifier); | 230 ProgressItem* item = m_progressItems.get(identifier); |
| 231 if (!item) | 231 if (!item) |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 item->estimatedLength = item->bytesReceived; | 234 item->estimatedLength = item->bytesReceived; |
| 235 maybeSendProgress(); | 235 maybeSendProgress(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |