| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 void WebCache::clear() | 58 void WebCache::clear() |
| 59 { | 59 { |
| 60 MemoryCache* cache = memoryCache(); | 60 MemoryCache* cache = memoryCache(); |
| 61 if (cache) | 61 if (cache) |
| 62 cache->evictResources(); | 62 cache->evictResources(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void WebCache::getUsageStats(UsageStats* result) | 65 void WebCache::getUsageStats(UsageStats* result) |
| 66 { | 66 { |
| 67 ASSERT(result); | 67 DCHECK(result); |
| 68 | 68 |
| 69 MemoryCache* cache = memoryCache(); | 69 MemoryCache* cache = memoryCache(); |
| 70 if (cache) { | 70 if (cache) { |
| 71 result->minDeadCapacity = cache->minDeadCapacity(); | 71 result->minDeadCapacity = cache->minDeadCapacity(); |
| 72 result->maxDeadCapacity = cache->maxDeadCapacity(); | 72 result->maxDeadCapacity = cache->maxDeadCapacity(); |
| 73 result->capacity = cache->capacity(); | 73 result->capacity = cache->capacity(); |
| 74 result->liveSize = cache->liveSize(); | 74 result->liveSize = cache->liveSize(); |
| 75 result->deadSize = cache->deadSize(); | 75 result->deadSize = cache->deadSize(); |
| 76 } else | 76 } else |
| 77 memset(result, 0, sizeof(UsageStats)); | 77 memset(result, 0, sizeof(UsageStats)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void WebCache::getResourceTypeStats(ResourceTypeStats* result) | 80 void WebCache::getResourceTypeStats(ResourceTypeStats* result) |
| 81 { | 81 { |
| 82 MemoryCache* cache = memoryCache(); | 82 MemoryCache* cache = memoryCache(); |
| 83 if (cache) { | 83 if (cache) { |
| 84 MemoryCache::Statistics stats = cache->getStatistics(); | 84 MemoryCache::Statistics stats = cache->getStatistics(); |
| 85 ToResourceTypeStat(stats.images, result->images); | 85 ToResourceTypeStat(stats.images, result->images); |
| 86 ToResourceTypeStat(stats.cssStyleSheets, result->cssStyleSheets); | 86 ToResourceTypeStat(stats.cssStyleSheets, result->cssStyleSheets); |
| 87 ToResourceTypeStat(stats.scripts, result->scripts); | 87 ToResourceTypeStat(stats.scripts, result->scripts); |
| 88 ToResourceTypeStat(stats.xslStyleSheets, result->xslStyleSheets); | 88 ToResourceTypeStat(stats.xslStyleSheets, result->xslStyleSheets); |
| 89 ToResourceTypeStat(stats.fonts, result->fonts); | 89 ToResourceTypeStat(stats.fonts, result->fonts); |
| 90 ToResourceTypeStat(stats.other, result->other); | 90 ToResourceTypeStat(stats.other, result->other); |
| 91 } else | 91 } else |
| 92 memset(result, 0, sizeof(WebCache::ResourceTypeStats)); | 92 memset(result, 0, sizeof(WebCache::ResourceTypeStats)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |