OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/backing_store_manager.h" | 5 #include "content/browser/renderer_host/backing_store_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/mru_cache.h" | 8 #include "base/memory/mru_cache.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
11 #include "content/browser/renderer_host/render_widget_host.h" | 11 #include "content/browser/renderer_host/render_widget_host.h" |
12 #include "content/common/content_switches.h" | |
13 #include "content/common/notification_service.h" | 12 #include "content/common/notification_service.h" |
| 13 #include "content/public/common/content_switches.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // There are two separate caches, |large_cache| and |small_cache|. large_cache | 17 // There are two separate caches, |large_cache| and |small_cache|. large_cache |
18 // is meant for large items (tabs, popup windows), while small_cache is meant | 18 // is meant for large items (tabs, popup windows), while small_cache is meant |
19 // for small items (extension toolstrips and buttons, etc.). The idea is that | 19 // for small items (extension toolstrips and buttons, etc.). The idea is that |
20 // we'll almost always try to evict from large_cache first since small_cache | 20 // we'll almost always try to evict from large_cache first since small_cache |
21 // items will tend to be visible more of the time. | 21 // items will tend to be visible more of the time. |
22 typedef base::OwningMRUCache<RenderWidgetHost*, BackingStore*> | 22 typedef base::OwningMRUCache<RenderWidgetHost*, BackingStore*> |
23 BackingStoreCache; | 23 BackingStoreCache; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 size_t mem = 0; | 274 size_t mem = 0; |
275 BackingStoreCache::iterator it; | 275 BackingStoreCache::iterator it; |
276 for (it = large_cache->begin(); it != large_cache->end(); ++it) | 276 for (it = large_cache->begin(); it != large_cache->end(); ++it) |
277 mem += it->second->MemorySize(); | 277 mem += it->second->MemorySize(); |
278 | 278 |
279 for (it = small_cache->begin(); it != small_cache->end(); ++it) | 279 for (it = small_cache->begin(); it != small_cache->end(); ++it) |
280 mem += it->second->MemorySize(); | 280 mem += it->second->MemorySize(); |
281 | 281 |
282 return mem; | 282 return mem; |
283 } | 283 } |
OLD | NEW |