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

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

Issue 1428383002: Make ResourceFetcher::m_documentResources use WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 virtual bool canReuse(const ResourceRequest&) const { return true; } 259 virtual bool canReuse(const ResourceRequest&) const { return true; }
260 260
261 // Used by the MemoryCache to reduce the memory consumption of the entry. 261 // Used by the MemoryCache to reduce the memory consumption of the entry.
262 void prune(); 262 void prune();
263 263
264 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const; 264 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) const;
265 265
266 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); 266 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&);
267 267
268 WeakPtrWillBeRawPtr<Resource> asWeakPtr();
sof 2015/12/15 12:29:43 Add a TODO about removing this once Oilpan ships?
Nate Chapin 2015/12/15 20:30:59 Done.
269
268 #ifdef ENABLE_RESOURCE_IS_DELETED_CHECK 270 #ifdef ENABLE_RESOURCE_IS_DELETED_CHECK
269 void assertAlive() const { RELEASE_ASSERT(!m_deleted); } 271 void assertAlive() const { RELEASE_ASSERT(!m_deleted); }
270 #else 272 #else
271 void assertAlive() const { } 273 void assertAlive() const { }
272 #endif 274 #endif
273 275
274 protected: 276 protected:
275 virtual void checkNotify(); 277 virtual void checkNotify();
276 virtual void finishOnePart(); 278 virtual void finishOnePart();
277 279
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 bool unlock(); 377 bool unlock();
376 378
377 bool hasRightHandleCountApartFromCache(unsigned targetCount) const; 379 bool hasRightHandleCountApartFromCache(unsigned targetCount) const;
378 380
379 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad ataHandler::CacheType); 381 void setCachedMetadata(unsigned dataTypeID, const char*, size_t, CachedMetad ataHandler::CacheType);
380 void clearCachedMetadata(CachedMetadataHandler::CacheType); 382 void clearCachedMetadata(CachedMetadataHandler::CacheType);
381 CachedMetadata* cachedMetadata(unsigned dataTypeID) const; 383 CachedMetadata* cachedMetadata(unsigned dataTypeID) const;
382 384
383 String m_fragmentIdentifierForRequest; 385 String m_fragmentIdentifierForRequest;
384 386
387 #if !ENABLE(OILPAN)
388 WeakPtrFactory<Resource> m_weakPtrFactory;
389 #endif
390
385 RefPtr<CachedMetadata> m_cachedMetadata; 391 RefPtr<CachedMetadata> m_cachedMetadata;
386 OwnPtrWillBeMember<CacheHandler> m_cacheHandler; 392 OwnPtrWillBeMember<CacheHandler> m_cacheHandler;
387 393
388 ResourceError m_error; 394 ResourceError m_error;
389 395
390 double m_loadFinishTime; 396 double m_loadFinishTime;
391 397
392 unsigned long m_identifier; 398 unsigned long m_identifier;
393 399
394 size_t m_encodedSize; 400 size_t m_encodedSize;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 const char* ResourceTypeName(Resource::Type); 445 const char* ResourceTypeName(Resource::Type);
440 #endif 446 #endif
441 447
442 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 448 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
443 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() = = Resource::typeName, resource.type() == Resource::typeName); \ 449 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() = = Resource::typeName, resource.type() == Resource::typeName); \
444 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource >& ptr) { return to##typeName##Resource(ptr.get()); } 450 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource >& ptr) { return to##typeName##Resource(ptr.get()); }
445 451
446 } 452 }
447 453
448 #endif 454 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698