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.cpp

Issue 1807323002: [WeakMemoryCache 1a] Make Reference from Inspector to Resource weak, remove removedFromMemoryCache() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove some comments Created 4 years, 7 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) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 , m_decodedSize(0) 219 , m_decodedSize(0)
220 , m_overheadSize(calculateOverheadSize()) 220 , m_overheadSize(calculateOverheadSize())
221 , m_preloadCount(0) 221 , m_preloadCount(0)
222 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()) 222 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier())
223 , m_preloadResult(PreloadNotReferenced) 223 , m_preloadResult(PreloadNotReferenced)
224 , m_type(type) 224 , m_type(type)
225 , m_status(NotStarted) 225 , m_status(NotStarted)
226 , m_needsSynchronousCacheHit(false) 226 , m_needsSynchronousCacheHit(false)
227 , m_linkPreload(false) 227 , m_linkPreload(false)
228 { 228 {
229 ThreadState::current()->registerPreFinalizer(this);
230
229 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car eless updates of the enum. 231 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car eless updates of the enum.
230 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); 232 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter);
231 233
232 // Currently we support the metadata caching only for HTTP family. 234 // Currently we support the metadata caching only for HTTP family.
233 if (m_resourceRequest.url().protocolIsInHTTPFamily()) 235 if (m_resourceRequest.url().protocolIsInHTTPFamily())
234 m_cacheHandler = CacheHandler::create(this); 236 m_cacheHandler = CacheHandler::create(this);
235 } 237 }
236 238
237 Resource::~Resource() 239 Resource::~Resource()
238 { 240 {
239 InstanceCounters::decrementCounter(InstanceCounters::ResourceCounter); 241 InstanceCounters::decrementCounter(InstanceCounters::ResourceCounter);
240 } 242 }
241 243
242 void Resource::removedFromMemoryCache() 244 void Resource::willDestroyResource()
243 { 245 {
244 InspectorInstrumentation::removedResourceFromMemoryCache(this); 246 InspectorInstrumentation::willDestroyResource(this);
247 willDestroyResourceInternal();
245 } 248 }
246 249
247 DEFINE_TRACE(Resource) 250 DEFINE_TRACE(Resource)
248 { 251 {
249 visitor->trace(m_loader); 252 visitor->trace(m_loader);
250 visitor->trace(m_cacheHandler); 253 visitor->trace(m_cacheHandler);
251 } 254 }
252 255
253 void Resource::load(ResourceFetcher* fetcher) 256 void Resource::load(ResourceFetcher* fetcher)
254 { 257 {
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 case Resource::Media: 1080 case Resource::Media:
1078 return "Media"; 1081 return "Media";
1079 case Resource::Manifest: 1082 case Resource::Manifest:
1080 return "Manifest"; 1083 return "Manifest";
1081 } 1084 }
1082 ASSERT_NOT_REACHED(); 1085 ASSERT_NOT_REACHED();
1083 return "Unknown"; 1086 return "Unknown";
1084 } 1087 }
1085 1088
1086 } // namespace blink 1089 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698