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/notification_service.h" | |
13 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 // There are two separate caches, |large_cache| and |small_cache|. large_cache | 16 // 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 | 17 // is meant for large items (tabs, popup windows), while small_cache is meant |
19 // for small items (extension popups, HTML5 notifications). The idea is that | 18 // for small items (extension popups, HTML5 notifications). The idea is that |
20 // we'll almost always try to evict from large_cache first since small_cache | 19 // 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. | 20 // items will tend to be visible more of the time. |
22 typedef base::OwningMRUCache<RenderWidgetHost*, BackingStore*> | 21 typedef base::OwningMRUCache<RenderWidgetHost*, BackingStore*> |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 size_t mem = 0; | 277 size_t mem = 0; |
279 BackingStoreCache::iterator it; | 278 BackingStoreCache::iterator it; |
280 for (it = large_cache->begin(); it != large_cache->end(); ++it) | 279 for (it = large_cache->begin(); it != large_cache->end(); ++it) |
281 mem += it->second->MemorySize(); | 280 mem += it->second->MemorySize(); |
282 | 281 |
283 for (it = small_cache->begin(); it != small_cache->end(); ++it) | 282 for (it = small_cache->begin(); it != small_cache->end(); ++it) |
284 mem += it->second->MemorySize(); | 283 mem += it->second->MemorySize(); |
285 | 284 |
286 return mem; | 285 return mem; |
287 } | 286 } |
OLD | NEW |