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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/MemoryCache.cpp

Issue 2845513002: [WIP] Add Resource::IsShareable
Patch Set: fix Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (!resource_maps_.Contains(cache_identifier)) { 125 if (!resource_maps_.Contains(cache_identifier)) {
126 ResourceMapIndex::AddResult result = 126 ResourceMapIndex::AddResult result =
127 resource_maps_.insert(cache_identifier, new ResourceMap); 127 resource_maps_.insert(cache_identifier, new ResourceMap);
128 CHECK(result.is_new_entry); 128 CHECK(result.is_new_entry);
129 } 129 }
130 return resource_maps_.at(cache_identifier); 130 return resource_maps_.at(cache_identifier);
131 } 131 }
132 132
133 void MemoryCache::Add(Resource* resource) { 133 void MemoryCache::Add(Resource* resource) {
134 DCHECK(resource); 134 DCHECK(resource);
135 DCHECK(resource->IsShareable());
136
135 ResourceMap* resources = EnsureResourceMap(resource->CacheIdentifier()); 137 ResourceMap* resources = EnsureResourceMap(resource->CacheIdentifier());
136 AddInternal(resources, MemoryCacheEntry::Create(resource)); 138 AddInternal(resources, MemoryCacheEntry::Create(resource));
137 RESOURCE_LOADING_DVLOG(1) 139 RESOURCE_LOADING_DVLOG(1)
138 << "MemoryCache::add Added " << resource->Url().GetString() 140 << "MemoryCache::add Added " << resource->Url().GetString()
139 << ", resource " << resource; 141 << ", resource " << resource;
140 } 142 }
141 143
142 void MemoryCache::AddInternal(ResourceMap* resource_map, 144 void MemoryCache::AddInternal(ResourceMap* resource_map,
143 MemoryCacheEntry* entry) { 145 MemoryCacheEntry* entry) {
144 DCHECK(WTF::IsMainThread()); 146 DCHECK(WTF::IsMainThread());
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 463 }
462 } 464 }
463 return true; 465 return true;
464 } 466 }
465 467
466 void MemoryCache::OnMemoryPressure(WebMemoryPressureLevel level) { 468 void MemoryCache::OnMemoryPressure(WebMemoryPressureLevel level) {
467 PruneAll(); 469 PruneAll();
468 } 470 }
469 471
470 } // namespace blink 472 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698