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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 18 matching lines...) Expand all
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"
40 #include "wtf/text/CString.h" 39 #include "wtf/text/CString.h"
41 40
42 using namespace std; 41 using namespace std;
43 42
44 namespace blink { 43 namespace blink {
45 44
46 // Always start progress at initialProgressValue. This helps provide feedback as 45 // Always start progress at initialProgressValue. This helps provide feedback as
47 // soon as a load starts. 46 // soon as a load starts.
48 static const double initialProgressValue = 0.1; 47 static const double initialProgressValue = 0.1;
49 48
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 long long estimatedLength = response.expectedContentLength(); 161 long long estimatedLength = response.expectedContentLength();
163 if (estimatedLength < 0) 162 if (estimatedLength < 0)
164 estimatedLength = progressItemDefaultEstimatedLength; 163 estimatedLength = progressItemDefaultEstimatedLength;
165 164
166 m_totalPageAndResourceBytesToLoad += estimatedLength; 165 m_totalPageAndResourceBytesToLoad += estimatedLength;
167 166
168 if (ProgressItem* item = m_progressItems.get(identifier)) { 167 if (ProgressItem* item = m_progressItems.get(identifier)) {
169 item->bytesReceived = 0; 168 item->bytesReceived = 0;
170 item->estimatedLength = estimatedLength; 169 item->estimatedLength = estimatedLength;
171 } else { 170 } else {
172 m_progressItems.set(identifier, wrapUnique(new ProgressItem(estimatedLen gth))); 171 m_progressItems.set(identifier, adoptPtr(new ProgressItem(estimatedLengt h)));
173 } 172 }
174 } 173 }
175 174
176 void ProgressTracker::incrementProgressForMainResourceOnly(unsigned long identif ier, int length) 175 void ProgressTracker::incrementProgressForMainResourceOnly(unsigned long identif ier, int length)
177 { 176 {
178 if (identifier != m_mainResourceIdentifier) 177 if (identifier != m_mainResourceIdentifier)
179 return; 178 return;
180 179
181 ProgressItem* item = m_progressItems.get(identifier); 180 ProgressItem* item = m_progressItems.get(identifier);
182 if (!item) 181 if (!item)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return; 272 return;
274 273
275 // Adjust the total expected bytes to account for any overage/underage. 274 // Adjust the total expected bytes to account for any overage/underage.
276 long long delta = item->bytesReceived - item->estimatedLength; 275 long long delta = item->bytesReceived - item->estimatedLength;
277 m_totalPageAndResourceBytesToLoad += delta; 276 m_totalPageAndResourceBytesToLoad += delta;
278 277
279 m_progressItems.remove(identifier); 278 m_progressItems.remove(identifier);
280 } 279 }
281 280
282 } // namespace blink 281 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698