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 21 matching lines...) Expand all Loading... |
32 #define WebCache_h | 32 #define WebCache_h |
33 | 33 |
34 #include "../platform/WebCommon.h" | 34 #include "../platform/WebCommon.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 // An interface to query and configure WebKit's resource cache. | 38 // An interface to query and configure WebKit's resource cache. |
39 class WebCache { | 39 class WebCache { |
40 public: | 40 public: |
41 struct UsageStats { | 41 struct UsageStats { |
42 // Capacities. | |
43 size_t minDeadCapacity; | |
44 size_t maxDeadCapacity; | |
45 size_t capacity; | 42 size_t capacity; |
46 // Utilization. | 43 size_t size; |
47 size_t liveSize; | |
48 size_t deadSize; | |
49 }; | 44 }; |
50 | 45 |
51 // A struct mirroring blink::MemoryCache::TypeStatistic. | 46 // A struct mirroring blink::MemoryCache::TypeStatistic. |
52 struct ResourceTypeStat { | 47 struct ResourceTypeStat { |
53 size_t count; | 48 size_t count; |
54 size_t size; | 49 size_t size; |
55 size_t liveSize; | |
56 size_t decodedSize; | 50 size_t decodedSize; |
57 }; | 51 }; |
58 | 52 |
59 // A struct mirroring blink::MemoryCache::Statistics. | 53 // A struct mirroring blink::MemoryCache::Statistics. |
60 struct ResourceTypeStats { | 54 struct ResourceTypeStats { |
61 ResourceTypeStat images; | 55 ResourceTypeStat images; |
62 ResourceTypeStat cssStyleSheets; | 56 ResourceTypeStat cssStyleSheets; |
63 ResourceTypeStat scripts; | 57 ResourceTypeStat scripts; |
64 ResourceTypeStat xslStyleSheets; | 58 ResourceTypeStat xslStyleSheets; |
65 ResourceTypeStat fonts; | 59 ResourceTypeStat fonts; |
66 ResourceTypeStat other; | 60 ResourceTypeStat other; |
67 }; | 61 }; |
68 | 62 |
69 // Sets the capacities of the resource cache, evicting objects as necessary. | 63 // Sets the capacities of the resource cache, evicting objects as necessary. |
70 BLINK_EXPORT static void setCapacities(size_t minDeadCapacity, | 64 BLINK_EXPORT static void setCapacity(size_t); |
71 size_t maxDeadCapacity, | |
72 size_t capacity); | |
73 | 65 |
74 // Clears the cache (as much as possible; some resources may not be | 66 // Clears the cache (as much as possible; some resources may not be |
75 // cleared if they are actively referenced). Note that this method | 67 // cleared if they are actively referenced). Note that this method |
76 // only removes resources from live list, w/o releasing cache memory. | 68 // only removes resources from live list, w/o releasing cache memory. |
77 BLINK_EXPORT static void clear(); | 69 BLINK_EXPORT static void clear(); |
78 | 70 |
79 // Gets the usage statistics from the resource cache. | 71 // Gets the usage statistics from the resource cache. |
80 BLINK_EXPORT static void getUsageStats(UsageStats*); | 72 BLINK_EXPORT static void getUsageStats(UsageStats*); |
81 | 73 |
82 // Get usage stats about the resource cache. | 74 // Get usage stats about the resource cache. |
83 BLINK_EXPORT static void getResourceTypeStats(ResourceTypeStats*); | 75 BLINK_EXPORT static void getResourceTypeStats(ResourceTypeStats*); |
84 | 76 |
85 private: | 77 private: |
86 WebCache(); // Not intended to be instanced. | 78 WebCache(); // Not intended to be instanced. |
87 }; | 79 }; |
88 | 80 |
89 } // namespace blink | 81 } // namespace blink |
90 | 82 |
91 #endif | 83 #endif |
OLD | NEW |