| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 55     WTF_MAKE_NONCOPYABLE(ProgressItem); WTF_MAKE_FAST_ALLOCATED; | 55     WTF_MAKE_NONCOPYABLE(ProgressItem); WTF_MAKE_FAST_ALLOCATED; | 
| 56 public: | 56 public: | 
| 57     ProgressItem(long long length) | 57     ProgressItem(long long length) | 
| 58         : bytesReceived(0) | 58         : bytesReceived(0) | 
| 59         , estimatedLength(length) { } | 59         , estimatedLength(length) { } | 
| 60 | 60 | 
| 61     long long bytesReceived; | 61     long long bytesReceived; | 
| 62     long long estimatedLength; | 62     long long estimatedLength; | 
| 63 }; | 63 }; | 
| 64 | 64 | 
|  | 65 PassOwnPtrWillBeRawPtr<ProgressTracker> ProgressTracker::create(LocalFrame* fram
     e) | 
|  | 66 { | 
|  | 67     return adoptPtrWillBeNoop(new ProgressTracker(frame)); | 
|  | 68 } | 
|  | 69 | 
| 65 ProgressTracker::ProgressTracker(LocalFrame* frame) | 70 ProgressTracker::ProgressTracker(LocalFrame* frame) | 
| 66     : m_frame(frame) | 71     : m_frame(frame) | 
| 67     , m_inProgress(false) | 72     , m_inProgress(false) | 
| 68     , m_totalPageAndResourceBytesToLoad(0) | 73     , m_totalPageAndResourceBytesToLoad(0) | 
| 69     , m_totalBytesReceived(0) | 74     , m_totalBytesReceived(0) | 
| 70     , m_lastNotifiedProgressValue(0) | 75     , m_lastNotifiedProgressValue(0) | 
| 71     , m_lastNotifiedProgressTime(0) | 76     , m_lastNotifiedProgressTime(0) | 
| 72     , m_progressNotificationInterval(0.02) | 77     , m_progressNotificationInterval(0.02) | 
| 73     , m_progressNotificationTimeInterval(0.1) | 78     , m_progressNotificationTimeInterval(0.1) | 
| 74     , m_finalProgressChangedSent(false) | 79     , m_finalProgressChangedSent(false) | 
| 75     , m_progressValue(0) | 80     , m_progressValue(0) | 
| 76 { | 81 { | 
| 77 } | 82 } | 
| 78 | 83 | 
| 79 ProgressTracker::~ProgressTracker() | 84 ProgressTracker::~ProgressTracker() | 
| 80 { | 85 { | 
|  | 86     ASSERT(!m_inProgress); | 
|  | 87 } | 
|  | 88 | 
|  | 89 void ProgressTracker::trace(Visitor* visitor) | 
|  | 90 { | 
|  | 91     visitor->trace(m_frame); | 
|  | 92 } | 
|  | 93 | 
|  | 94 void ProgressTracker::dispose() | 
|  | 95 { | 
| 81     if (m_inProgress) | 96     if (m_inProgress) | 
| 82         progressCompleted(); | 97         progressCompleted(); | 
| 83 } | 98 } | 
| 84 | 99 | 
| 85 PassOwnPtr<ProgressTracker> ProgressTracker::create(LocalFrame* frame) |  | 
| 86 { |  | 
| 87     return adoptPtr(new ProgressTracker(frame)); |  | 
| 88 } |  | 
| 89 |  | 
| 90 double ProgressTracker::estimatedProgress() const | 100 double ProgressTracker::estimatedProgress() const | 
| 91 { | 101 { | 
| 92     return m_progressValue; | 102     return m_progressValue; | 
| 93 } | 103 } | 
| 94 | 104 | 
| 95 void ProgressTracker::reset() | 105 void ProgressTracker::reset() | 
| 96 { | 106 { | 
| 97     m_progressItems.clear(); | 107     m_progressItems.clear(); | 
| 98 | 108 | 
| 99     m_totalPageAndResourceBytesToLoad = 0; | 109     m_totalPageAndResourceBytesToLoad = 0; | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 208         return; | 218         return; | 
| 209 | 219 | 
| 210     // Adjust the total expected bytes to account for any overage/underage. | 220     // Adjust the total expected bytes to account for any overage/underage. | 
| 211     long long delta = item->bytesReceived - item->estimatedLength; | 221     long long delta = item->bytesReceived - item->estimatedLength; | 
| 212     m_totalPageAndResourceBytesToLoad += delta; | 222     m_totalPageAndResourceBytesToLoad += delta; | 
| 213 | 223 | 
| 214     m_progressItems.remove(identifier); | 224     m_progressItems.remove(identifier); | 
| 215 } | 225 } | 
| 216 | 226 | 
| 217 } | 227 } | 
| OLD | NEW | 
|---|