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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 m_totalPageAndResourceBytesToLoad += estimatedLength; | 150 m_totalPageAndResourceBytesToLoad += estimatedLength; |
151 | 151 |
152 if (ProgressItem* item = m_progressItems.get(identifier)) { | 152 if (ProgressItem* item = m_progressItems.get(identifier)) { |
153 item->bytesReceived = 0; | 153 item->bytesReceived = 0; |
154 item->estimatedLength = estimatedLength; | 154 item->estimatedLength = estimatedLength; |
155 } else | 155 } else |
156 m_progressItems.set(identifier, adoptPtr(new ProgressItem(estimatedLengt
h))); | 156 m_progressItems.set(identifier, adoptPtr(new ProgressItem(estimatedLengt
h))); |
157 } | 157 } |
158 | 158 |
159 void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i
nt length) | 159 void ProgressTracker::incrementProgress(unsigned long identifier, int length) |
160 { | 160 { |
161 ProgressItem* item = m_progressItems.get(identifier); | 161 ProgressItem* item = m_progressItems.get(identifier); |
162 | 162 |
163 // FIXME: Can this ever happen? | 163 // FIXME: Can this ever happen? |
164 if (!item) | 164 if (!item) |
165 return; | 165 return; |
166 | 166 |
167 unsigned bytesReceived = length; | 167 unsigned bytesReceived = length; |
168 double increment, percentOfRemainingBytes; | 168 double increment, percentOfRemainingBytes; |
169 long long remainingBytes, estimatedBytesForPendingRequests; | 169 long long remainingBytes, estimatedBytesForPendingRequests; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return; | 218 return; |
219 | 219 |
220 // Adjust the total expected bytes to account for any overage/underage. | 220 // Adjust the total expected bytes to account for any overage/underage. |
221 long long delta = item->bytesReceived - item->estimatedLength; | 221 long long delta = item->bytesReceived - item->estimatedLength; |
222 m_totalPageAndResourceBytesToLoad += delta; | 222 m_totalPageAndResourceBytesToLoad += delta; |
223 | 223 |
224 m_progressItems.remove(identifier); | 224 m_progressItems.remove(identifier); |
225 } | 225 } |
226 | 226 |
227 } | 227 } |
OLD | NEW |