OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |