OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "chrome/browser/cache_manager_host.h" | 7 #include "chrome/browser/cache_manager_host.h" |
8 | 8 |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/render_process_host.h" | 12 #include "chrome/browser/render_process_host.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "chrome/common/pref_service.h" | 15 #include "chrome/common/pref_service.h" |
16 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
17 | 17 |
| 18 using base::Time; |
| 19 using base::TimeDelta; |
| 20 |
18 static const unsigned int kReviseAllocationDelayMS = 200 /* milliseconds */; | 21 static const unsigned int kReviseAllocationDelayMS = 200 /* milliseconds */; |
19 | 22 |
20 // The default size limit of the in-memory cache is 8 MB | 23 // The default size limit of the in-memory cache is 8 MB |
21 static const int kDefaultMemoryCacheSize = 8 * 1024 * 1024; | 24 static const int kDefaultMemoryCacheSize = 8 * 1024 * 1024; |
22 | 25 |
23 // The amount of idle time before we consider a tab to be "inactive" | 26 // The amount of idle time before we consider a tab to be "inactive" |
24 const TimeDelta CacheManagerHost::kRendererInactiveThreshold = | 27 const TimeDelta CacheManagerHost::kRendererInactiveThreshold = |
25 TimeDelta::FromMinutes(5); | 28 TimeDelta::FromMinutes(5); |
26 | 29 |
27 namespace { | 30 namespace { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // Moved to inactive status. This invalidates our iterator. | 371 // Moved to inactive status. This invalidates our iterator. |
369 inactive_renderers_.insert(*iter); | 372 inactive_renderers_.insert(*iter); |
370 active_renderers_.erase(*iter); | 373 active_renderers_.erase(*iter); |
371 iter = active_renderers_.begin(); | 374 iter = active_renderers_.begin(); |
372 continue; | 375 continue; |
373 } | 376 } |
374 ++iter; | 377 ++iter; |
375 } | 378 } |
376 } | 379 } |
377 | 380 |
OLD | NEW |