Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: third_party/WebKit/Source/core/loader/ProgressTracker.cpp

Issue 2712033002: Part 1 Of Renaming FrameLoaderClient to LocalFrameClient. (Closed)
Patch Set: Change all forward declarations of FrameLoaderClient to LocalFrameClient and fix call sites. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 void ProgressTracker::reset() { 94 void ProgressTracker::reset() {
95 m_progressItems.clear(); 95 m_progressItems.clear();
96 m_progressValue = 0; 96 m_progressValue = 0;
97 m_lastNotifiedProgressValue = 0; 97 m_lastNotifiedProgressValue = 0;
98 m_lastNotifiedProgressTime = 0; 98 m_lastNotifiedProgressTime = 0;
99 m_finishedParsing = false; 99 m_finishedParsing = false;
100 } 100 }
101 101
102 FrameLoaderClient* ProgressTracker::frameLoaderClient() const { 102 LocalFrameClient* ProgressTracker::localFrameClient() const {
103 return m_frame->client(); 103 return m_frame->client();
104 } 104 }
105 105
106 void ProgressTracker::progressStarted(FrameLoadType type) { 106 void ProgressTracker::progressStarted(FrameLoadType type) {
107 if (!m_frame->isLoading()) 107 if (!m_frame->isLoading())
108 frameLoaderClient()->didStartLoading(NavigationToDifferentDocument); 108 localFrameClient()->didStartLoading(NavigationToDifferentDocument);
109 reset(); 109 reset();
110 m_progressValue = initialProgressValue; 110 m_progressValue = initialProgressValue;
111 m_frame->setIsLoading(true); 111 m_frame->setIsLoading(true);
112 InspectorInstrumentation::frameStartedLoading(m_frame, type); 112 InspectorInstrumentation::frameStartedLoading(m_frame, type);
113 } 113 }
114 114
115 void ProgressTracker::progressCompleted() { 115 void ProgressTracker::progressCompleted() {
116 DCHECK(m_frame->isLoading()); 116 DCHECK(m_frame->isLoading());
117 m_frame->setIsLoading(false); 117 m_frame->setIsLoading(false);
118 sendFinalProgress(); 118 sendFinalProgress();
119 reset(); 119 reset();
120 frameLoaderClient()->didStopLoading(); 120 localFrameClient()->didStopLoading();
121 InspectorInstrumentation::frameStoppedLoading(m_frame); 121 InspectorInstrumentation::frameStoppedLoading(m_frame);
122 } 122 }
123 123
124 void ProgressTracker::finishedParsing() { 124 void ProgressTracker::finishedParsing() {
125 m_finishedParsing = true; 125 m_finishedParsing = true;
126 maybeSendProgress(); 126 maybeSendProgress();
127 } 127 }
128 128
129 void ProgressTracker::sendFinalProgress() { 129 void ProgressTracker::sendFinalProgress() {
130 if (m_progressValue == 1) 130 if (m_progressValue == 1)
131 return; 131 return;
132 m_progressValue = 1; 132 m_progressValue = 1;
133 frameLoaderClient()->progressEstimateChanged(m_progressValue); 133 localFrameClient()->progressEstimateChanged(m_progressValue);
134 } 134 }
135 135
136 void ProgressTracker::willStartLoading(unsigned long identifier, 136 void ProgressTracker::willStartLoading(unsigned long identifier,
137 ResourceLoadPriority priority) { 137 ResourceLoadPriority priority) {
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.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (m_progressValue < m_lastNotifiedProgressValue) 217 if (m_progressValue < m_lastNotifiedProgressValue)
218 return; 218 return;
219 219
220 double now = currentTime(); 220 double now = currentTime();
221 double notifiedProgressTimeDelta = now - m_lastNotifiedProgressTime; 221 double notifiedProgressTimeDelta = now - m_lastNotifiedProgressTime;
222 222
223 double notificationProgressDelta = 223 double notificationProgressDelta =
224 m_progressValue - m_lastNotifiedProgressValue; 224 m_progressValue - m_lastNotifiedProgressValue;
225 if (notificationProgressDelta >= progressNotificationInterval || 225 if (notificationProgressDelta >= progressNotificationInterval ||
226 notifiedProgressTimeDelta >= progressNotificationTimeInterval) { 226 notifiedProgressTimeDelta >= progressNotificationTimeInterval) {
227 frameLoaderClient()->progressEstimateChanged(m_progressValue); 227 localFrameClient()->progressEstimateChanged(m_progressValue);
228 m_lastNotifiedProgressValue = m_progressValue; 228 m_lastNotifiedProgressValue = m_progressValue;
229 m_lastNotifiedProgressTime = now; 229 m_lastNotifiedProgressTime = now;
230 } 230 }
231 } 231 }
232 232
233 void ProgressTracker::completeProgress(unsigned long identifier) { 233 void ProgressTracker::completeProgress(unsigned long identifier) {
234 ProgressItem* item = m_progressItems.at(identifier); 234 ProgressItem* item = m_progressItems.at(identifier);
235 if (!item) 235 if (!item)
236 return; 236 return;
237 237
238 item->estimatedLength = item->bytesReceived; 238 item->estimatedLength = item->bytesReceived;
239 maybeSendProgress(); 239 maybeSendProgress();
240 } 240 }
241 241
242 } // namespace blink 242 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698