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

Side by Side Diff: Source/web/WebCache.cpp

Issue 1278403007: [tracing] Fix accounting of WebCache memory statistics (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@oilpan_light
Patch Set: Changing internal api to use size_t. Created 5 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
« no previous file with comments | « Source/core/fetch/MemoryCache.h ('k') | public/web/WebCache.h » ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 22 matching lines...) Expand all
33 33
34 #include "core/fetch/MemoryCache.h" 34 #include "core/fetch/MemoryCache.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 // A helper method for coverting a MemoryCache::TypeStatistic to a 38 // A helper method for coverting a MemoryCache::TypeStatistic to a
39 // WebCache::ResourceTypeStat. 39 // WebCache::ResourceTypeStat.
40 static void ToResourceTypeStat(const MemoryCache::TypeStatistic& from, 40 static void ToResourceTypeStat(const MemoryCache::TypeStatistic& from,
41 WebCache::ResourceTypeStat& to) 41 WebCache::ResourceTypeStat& to)
42 { 42 {
43 to.count = static_cast<size_t>(from.count); 43 to.count = from.count;
44 to.size = static_cast<size_t>(from.size); 44 to.size = from.size;
45 to.liveSize = static_cast<size_t>(from.liveSize); 45 to.liveSize = from.liveSize;
46 to.decodedSize = static_cast<size_t>(from.decodedSize); 46 to.decodedSize = from.decodedSize;
47 to.purgeableSize = from.purgedSize;
48 to.purgedSize = from.purgedSize;
47 } 49 }
48 50
49 void WebCache::setCapacities( 51 void WebCache::setCapacities(
50 size_t minDeadCapacity, size_t maxDeadCapacity, size_t capacity) 52 size_t minDeadCapacity, size_t maxDeadCapacity, size_t capacity)
51 { 53 {
52 MemoryCache* cache = memoryCache(); 54 MemoryCache* cache = memoryCache();
53 if (cache) 55 if (cache)
54 cache->setCapacities(static_cast<unsigned>(minDeadCapacity), static_cast <unsigned>(maxDeadCapacity), static_cast<unsigned>(capacity)); 56 cache->setCapacities(static_cast<unsigned>(minDeadCapacity), static_cast <unsigned>(maxDeadCapacity), static_cast<unsigned>(capacity));
55 } 57 }
56 58
(...skipping 22 matching lines...) Expand all
79 void WebCache::getResourceTypeStats(ResourceTypeStats* result) 81 void WebCache::getResourceTypeStats(ResourceTypeStats* result)
80 { 82 {
81 MemoryCache* cache = memoryCache(); 83 MemoryCache* cache = memoryCache();
82 if (cache) { 84 if (cache) {
83 MemoryCache::Statistics stats = cache->getStatistics(); 85 MemoryCache::Statistics stats = cache->getStatistics();
84 ToResourceTypeStat(stats.images, result->images); 86 ToResourceTypeStat(stats.images, result->images);
85 ToResourceTypeStat(stats.cssStyleSheets, result->cssStyleSheets); 87 ToResourceTypeStat(stats.cssStyleSheets, result->cssStyleSheets);
86 ToResourceTypeStat(stats.scripts, result->scripts); 88 ToResourceTypeStat(stats.scripts, result->scripts);
87 ToResourceTypeStat(stats.xslStyleSheets, result->xslStyleSheets); 89 ToResourceTypeStat(stats.xslStyleSheets, result->xslStyleSheets);
88 ToResourceTypeStat(stats.fonts, result->fonts); 90 ToResourceTypeStat(stats.fonts, result->fonts);
91 ToResourceTypeStat(stats.other, result->other);
89 } else 92 } else
90 memset(result, 0, sizeof(WebCache::ResourceTypeStats)); 93 memset(result, 0, sizeof(WebCache::ResourceTypeStats));
91 } 94 }
92 95
93 void WebCache::pruneAll() 96 void WebCache::pruneAll()
94 { 97 {
95 MemoryCache* cache = memoryCache(); 98 MemoryCache* cache = memoryCache();
96 if (cache) 99 if (cache)
97 cache->pruneAll(); 100 cache->pruneAll();
98 } 101 }
99 102
100 } // namespace blink 103 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fetch/MemoryCache.h ('k') | public/web/WebCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698