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

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

Issue 2191633003: Move ResourceClient to Oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-raw-resource-client
Patch Set: fix Created 4 years, 4 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const KURL& url() const { return m_resourceRequest.url();} 126 const KURL& url() const { return m_resourceRequest.url();}
127 Type getType() const { return static_cast<Type>(m_type); } 127 Type getType() const { return static_cast<Type>(m_type); }
128 const ResourceLoaderOptions& options() const { return m_options; } 128 const ResourceLoaderOptions& options() const { return m_options; }
129 ResourceLoaderOptions& mutableOptions() { return m_options; } 129 ResourceLoaderOptions& mutableOptions() { return m_options; }
130 130
131 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); 131 void didChangePriority(ResourceLoadPriority, int intraPriorityValue);
132 virtual ResourcePriority priorityFromObservers() { return ResourcePriority() ; } 132 virtual ResourcePriority priorityFromObservers() { return ResourcePriority() ; }
133 133
134 void addClient(ResourceClient*); 134 void addClient(ResourceClient*);
135 void removeClient(ResourceClient*); 135 void removeClient(ResourceClient*);
136 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); }
137 136
138 enum PreloadResult { 137 enum PreloadResult {
139 PreloadNotReferenced, 138 PreloadNotReferenced,
140 PreloadReferenced, 139 PreloadReferenced,
141 PreloadReferencedWhileLoading, 140 PreloadReferencedWhileLoading,
142 PreloadReferencedWhileComplete 141 PreloadReferencedWhileComplete
143 }; 142 };
144 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); } 143 PreloadResult getPreloadResult() const { return static_cast<PreloadResult>(m _preloadResult); }
145 144
146 Status getStatus() const { return static_cast<Status>(m_status); } 145 Status getStatus() const { return static_cast<Status>(m_status); }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 bool hasCacheControlNoStoreHeader() const; 215 bool hasCacheControlNoStoreHeader() const;
217 bool hasVaryHeader() const; 216 bool hasVaryHeader() const;
218 virtual bool mustRefetchDueToIntegrityMetadata(const FetchRequest& request) const { return false; } 217 virtual bool mustRefetchDueToIntegrityMetadata(const FetchRequest& request) const { return false; }
219 218
220 double currentAge() const; 219 double currentAge() const;
221 double freshnessLifetime(); 220 double freshnessLifetime();
222 double stalenessLifetime(); 221 double stalenessLifetime();
223 222
224 bool isPurgeable() const; 223 bool isPurgeable() const;
225 bool lock(); 224 bool lock();
225 bool isAlive() const { return m_isAlive; }
226 226
227 void setCacheIdentifier(const String& cacheIdentifier) { m_cacheIdentifier = cacheIdentifier; } 227 void setCacheIdentifier(const String& cacheIdentifier) { m_cacheIdentifier = cacheIdentifier; }
228 String cacheIdentifier() const { return m_cacheIdentifier; } 228 String cacheIdentifier() const { return m_cacheIdentifier; }
229 229
230 virtual void didSendData(unsigned long long /* bytesSent */, unsigned long l ong /* totalBytesToBeSent */) { } 230 virtual void didSendData(unsigned long long /* bytesSent */, unsigned long l ong /* totalBytesToBeSent */) { }
231 virtual void didDownloadData(int) { } 231 virtual void didDownloadData(int) { }
232 232
233 double loadFinishTime() const { return m_loadFinishTime; } 233 double loadFinishTime() const { return m_loadFinishTime; }
234 234
235 void addToEncodedBodyLength(int value) { m_response.addToEncodedBodyLength(v alue); } 235 void addToEncodedBodyLength(int value) { m_response.addToEncodedBodyLength(v alue); }
236 void addToDecodedBodyLength(int value) { m_response.addToDecodedBodyLength(v alue); } 236 void addToDecodedBodyLength(int value) { m_response.addToDecodedBodyLength(v alue); }
237 237
238 virtual bool canReuse(const ResourceRequest&) const { return true; } 238 virtual bool canReuse(const ResourceRequest&) const { return true; }
239 239
240 // Used by the MemoryCache to reduce the memory consumption of the entry. 240 // Used by the MemoryCache to reduce the memory consumption of the entry.
241 void prune(); 241 void prune();
242 242
243 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const; 243 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const;
244 244
245 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); 245 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&);
246 246
247 protected: 247 protected:
248 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 248 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
249 249
250 virtual void checkNotify(); 250 virtual void checkNotify();
251 251
252 virtual bool hasClientsOrObservers() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty() || !m_finishedClients.isEmpty(); }
252 virtual void destroyDecodedDataForFailedRevalidation() { } 253 virtual void destroyDecodedDataForFailedRevalidation() { }
253 254
254 void setEncodedSize(size_t); 255 void setEncodedSize(size_t);
255 void setDecodedSize(size_t); 256 void setDecodedSize(size_t);
256 void didAccessDecodedData(); 257 void didAccessDecodedData();
257 258
258 void finishPendingClients(); 259 void finishPendingClients();
259 260
260 virtual void didAddClient(ResourceClient*); 261 virtual void didAddClient(ResourceClient*);
261 void willAddClientOrObserver(); 262 void willAddClientOrObserver();
(...skipping 19 matching lines...) Expand all
281 const Vector<RedirectPair>& redirectChain() const { return m_redirectChain; } 282 const Vector<RedirectPair>& redirectChain() const { return m_redirectChain; }
282 283
283 virtual bool isSafeToUnlock() const { return false; } 284 virtual bool isSafeToUnlock() const { return false; }
284 virtual void destroyDecodedDataIfPossible() { } 285 virtual void destroyDecodedDataIfPossible() { }
285 286
286 virtual void markClientsAndObserversFinished(); 287 virtual void markClientsAndObserversFinished();
287 288
288 // Returns the memory dump name used for tracing. See Resource::onMemoryDump . 289 // Returns the memory dump name used for tracing. See Resource::onMemoryDump .
289 String getMemoryDumpName() const; 290 String getMemoryDumpName() const;
290 291
291 const HashCountedSet<ResourceClient*>& clients() const { return m_clients; } 292 const HeapHashCountedSet<WeakMember<ResourceClient>>& clients() const { retu rn m_clients; }
292 DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBuffe ringPolicy; } 293 DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBuffe ringPolicy; }
293 294
294 void setCachePolicyBypassingCache(); 295 void setCachePolicyBypassingCache();
295 void setLoFiStateOff(); 296 void setLoFiStateOff();
296 297
297 SharedBuffer* data() const { return m_data.get(); } 298 SharedBuffer* data() const { return m_data.get(); }
298 void clearData() { m_data.clear(); } 299 void clearData() { m_data.clear(); }
299 300
300 private: 301 private:
301 class ResourceCallback; 302 class ResourceCallback;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 338
338 String m_cacheIdentifier; 339 String m_cacheIdentifier;
339 340
340 unsigned m_preloadResult : 2; // PreloadResult 341 unsigned m_preloadResult : 2; // PreloadResult
341 unsigned m_type : 4; // Type 342 unsigned m_type : 4; // Type
342 unsigned m_status : 3; // Status 343 unsigned m_status : 3; // Status
343 344
344 unsigned m_needsSynchronousCacheHit : 1; 345 unsigned m_needsSynchronousCacheHit : 1;
345 unsigned m_linkPreload : 1; 346 unsigned m_linkPreload : 1;
346 bool m_isRevalidating : 1; 347 bool m_isRevalidating : 1;
348 bool m_isAlive : 1;
347 349
348 // Ordered list of all redirects followed while fetching this resource. 350 // Ordered list of all redirects followed while fetching this resource.
349 Vector<RedirectPair> m_redirectChain; 351 Vector<RedirectPair> m_redirectChain;
350 352
351 HashCountedSet<ResourceClient*> m_clients; 353 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients;
352 HashCountedSet<ResourceClient*> m_clientsAwaitingCallback; 354 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback;
353 HashCountedSet<ResourceClient*> m_finishedClients; 355 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients;
354 356
355 ResourceLoaderOptions m_options; 357 ResourceLoaderOptions m_options;
356 358
357 double m_responseTimestamp; 359 double m_responseTimestamp;
358 360
359 Timer<Resource> m_cancelTimer; 361 Timer<Resource> m_cancelTimer;
360 362
361 ResourceRequest m_resourceRequest; 363 ResourceRequest m_resourceRequest;
362 Member<ResourceLoader> m_loader; 364 Member<ResourceLoader> m_loader;
363 ResourceResponse m_response; 365 ResourceResponse m_response;
(...skipping 12 matching lines...) Expand all
376 378
377 Resource::Type m_type; 379 Resource::Type m_type;
378 }; 380 };
379 381
380 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 382 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
381 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); 383 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName);
382 384
383 } // namespace blink 385 } // namespace blink
384 386
385 #endif 387 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698