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

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.h

Issue 1837873003: Do not update Resource::overheadSize() for ResourceRequest's URL modifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); } 142 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); }
143 143
144 unsigned count() const { return m_clients.size(); } 144 unsigned count() const { return m_clients.size(); }
145 145
146 Status getStatus() const { return static_cast<Status>(m_status); } 146 Status getStatus() const { return static_cast<Status>(m_status); }
147 void setStatus(Status status) { m_status = status; } 147 void setStatus(Status status) { m_status = status; }
148 148
149 size_t size() const { return encodedSize() + decodedSize() + overheadSize(); } 149 size_t size() const { return encodedSize() + decodedSize() + overheadSize(); }
150 size_t encodedSize() const { return m_encodedSize; } 150 size_t encodedSize() const { return m_encodedSize; }
151 size_t decodedSize() const { return m_decodedSize; } 151 size_t decodedSize() const { return m_decodedSize; }
152 size_t overheadSize() const; 152 size_t overheadSize() const { return m_overheadSize; }
153 153
154 bool isLoaded() const { return m_status > Pending; } 154 bool isLoaded() const { return m_status > Pending; }
155 155
156 bool isLoading() const { return m_status == Pending; } 156 bool isLoading() const { return m_status == Pending; }
157 bool stillNeedsLoad() const { return m_status < Pending; } 157 bool stillNeedsLoad() const { return m_status < Pending; }
158 158
159 ResourceLoader* loader() const { return m_loader.get(); } 159 ResourceLoader* loader() const { return m_loader.get(); }
160 160
161 virtual bool isImage() const { return false; } 161 virtual bool isImage() const { return false; }
162 bool shouldBlockLoadEvent() const; 162 bool shouldBlockLoadEvent() const;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 RefPtr<SharedBuffer> m_data; 323 RefPtr<SharedBuffer> m_data;
324 Timer<Resource> m_cancelTimer; 324 Timer<Resource> m_cancelTimer;
325 325
326 private: 326 private:
327 class CacheHandler; 327 class CacheHandler;
328 void cancelTimerFired(Timer<Resource>*); 328 void cancelTimerFired(Timer<Resource>*);
329 329
330 void revalidationSucceeded(const ResourceResponse&); 330 void revalidationSucceeded(const ResourceResponse&);
331 void revalidationFailed(); 331 void revalidationFailed();
332 332
333 size_t calculateOverheadSize() const;
334
333 bool unlock(); 335 bool unlock();
334 336
335 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad ataHandler::CacheType); 337 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad ataHandler::CacheType);
336 void clearCachedMetadata(CachedMetadataHandler::CacheType); 338 void clearCachedMetadata(CachedMetadataHandler::CacheType);
337 CachedMetadata* cachedMetadata(unsigned dataTypeID) const; 339 CachedMetadata* cachedMetadata(unsigned dataTypeID) const;
338 340
339 String m_fragmentIdentifierForRequest; 341 String m_fragmentIdentifierForRequest;
340 342
341 #if !ENABLE(OILPAN) 343 #if !ENABLE(OILPAN)
342 WeakPtrFactory<Resource> m_weakPtrFactory; 344 WeakPtrFactory<Resource> m_weakPtrFactory;
343 #endif 345 #endif
344 346
345 RefPtr<CachedMetadata> m_cachedMetadata; 347 RefPtr<CachedMetadata> m_cachedMetadata;
346 OwnPtrWillBeMember<CacheHandler> m_cacheHandler; 348 OwnPtrWillBeMember<CacheHandler> m_cacheHandler;
347 349
348 ResourceError m_error; 350 ResourceError m_error;
349 351
350 double m_loadFinishTime; 352 double m_loadFinishTime;
351 353
352 unsigned long m_identifier; 354 unsigned long m_identifier;
353 355
354 size_t m_encodedSize; 356 size_t m_encodedSize;
355 size_t m_decodedSize; 357 size_t m_decodedSize;
358
359 // Resource::calculateOverheadSize() is affected by changes in
360 // |m_resourceRequest.url()|, but |m_overheadSize| is not updated after
361 // initial |m_resourceRequest| is given, to reduce MemoryCache manipulation
362 // and thus potential bugs. crbug.com/594644
363 const size_t m_overheadSize;
364
356 unsigned m_preloadCount; 365 unsigned m_preloadCount;
357 366
358 String m_cacheIdentifier; 367 String m_cacheIdentifier;
359 368
360 unsigned m_preloadResult : 2; // PreloadResult 369 unsigned m_preloadResult : 2; // PreloadResult
361 unsigned m_type : 4; // Type 370 unsigned m_type : 4; // Type
362 unsigned m_status : 3; // Status 371 unsigned m_status : 3; // Status
363 372
364 unsigned m_needsSynchronousCacheHit : 1; 373 unsigned m_needsSynchronousCacheHit : 1;
365 unsigned m_linkPreload : 1; 374 unsigned m_linkPreload : 1;
(...skipping 14 matching lines...) Expand all
380 Resource::Type m_type; 389 Resource::Type m_type;
381 }; 390 };
382 391
383 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 392 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
384 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); \ 393 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); \
385 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R esource>& ptr) { return to##typeName##Resource(ptr.get()); } 394 inline typeName##Resource* to##typeName##Resource(const RefPtrWillBeRawPtr<R esource>& ptr) { return to##typeName##Resource(ptr.get()); }
386 395
387 } // namespace blink 396 } // namespace blink
388 397
389 #endif 398 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | third_party/WebKit/Source/core/fetch/Resource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698