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