| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/frame/FrameView.h" | 29 #include "core/frame/FrameView.h" |
| 30 #include "core/frame/LocalFrame.h" | 30 #include "core/frame/LocalFrame.h" |
| 31 #include "core/frame/Settings.h" | 31 #include "core/frame/Settings.h" |
| 32 #include "core/inspector/InspectorInstrumentation.h" | 32 #include "core/inspector/InspectorInstrumentation.h" |
| 33 #include "core/loader/DocumentLoader.h" | 33 #include "core/loader/DocumentLoader.h" |
| 34 #include "core/loader/FrameLoader.h" | 34 #include "core/loader/FrameLoader.h" |
| 35 #include "core/loader/FrameLoaderClient.h" | 35 #include "core/loader/FrameLoaderClient.h" |
| 36 #include "platform/Logging.h" | 36 #include "platform/Logging.h" |
| 37 #include "platform/network/ResourceResponse.h" | 37 #include "platform/network/ResourceResponse.h" |
| 38 #include "wtf/CurrentTime.h" | 38 #include "wtf/CurrentTime.h" |
| 39 #include "wtf/PtrUtil.h" |
| 39 #include "wtf/text/CString.h" | 40 #include "wtf/text/CString.h" |
| 40 | 41 |
| 41 using namespace std; | 42 using namespace std; |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 // Always start progress at initialProgressValue. This helps provide feedback as | 46 // Always start progress at initialProgressValue. This helps provide feedback as |
| 46 // soon as a load starts. | 47 // soon as a load starts. |
| 47 static const double initialProgressValue = 0.1; | 48 static const double initialProgressValue = 0.1; |
| 48 | 49 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 long long estimatedLength = response.expectedContentLength(); | 162 long long estimatedLength = response.expectedContentLength(); |
| 162 if (estimatedLength < 0) | 163 if (estimatedLength < 0) |
| 163 estimatedLength = progressItemDefaultEstimatedLength; | 164 estimatedLength = progressItemDefaultEstimatedLength; |
| 164 | 165 |
| 165 m_totalPageAndResourceBytesToLoad += estimatedLength; | 166 m_totalPageAndResourceBytesToLoad += estimatedLength; |
| 166 | 167 |
| 167 if (ProgressItem* item = m_progressItems.get(identifier)) { | 168 if (ProgressItem* item = m_progressItems.get(identifier)) { |
| 168 item->bytesReceived = 0; | 169 item->bytesReceived = 0; |
| 169 item->estimatedLength = estimatedLength; | 170 item->estimatedLength = estimatedLength; |
| 170 } else { | 171 } else { |
| 171 m_progressItems.set(identifier, adoptPtr(new ProgressItem(estimatedLengt
h))); | 172 m_progressItems.set(identifier, wrapUnique(new ProgressItem(estimatedLen
gth))); |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 | 175 |
| 175 void ProgressTracker::incrementProgressForMainResourceOnly(unsigned long identif
ier, int length) | 176 void ProgressTracker::incrementProgressForMainResourceOnly(unsigned long identif
ier, int length) |
| 176 { | 177 { |
| 177 if (identifier != m_mainResourceIdentifier) | 178 if (identifier != m_mainResourceIdentifier) |
| 178 return; | 179 return; |
| 179 | 180 |
| 180 ProgressItem* item = m_progressItems.get(identifier); | 181 ProgressItem* item = m_progressItems.get(identifier); |
| 181 if (!item) | 182 if (!item) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 return; | 273 return; |
| 273 | 274 |
| 274 // Adjust the total expected bytes to account for any overage/underage. | 275 // Adjust the total expected bytes to account for any overage/underage. |
| 275 long long delta = item->bytesReceived - item->estimatedLength; | 276 long long delta = item->bytesReceived - item->estimatedLength; |
| 276 m_totalPageAndResourceBytesToLoad += delta; | 277 m_totalPageAndResourceBytesToLoad += delta; |
| 277 | 278 |
| 278 m_progressItems.remove(identifier); | 279 m_progressItems.remove(identifier); |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace blink | 282 } // namespace blink |
| OLD | NEW |