OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/web_cache/browser/web_cache_manager.h" | 5 #include "components/web_cache/browser/web_cache_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 max_dead_capacity); | 317 max_dead_capacity); |
318 } | 318 } |
319 host->Send(new WebCacheMsg_SetCacheCapacities(min_dead_capacity, | 319 host->Send(new WebCacheMsg_SetCacheCapacities(min_dead_capacity, |
320 max_dead_capacity, | 320 max_dead_capacity, |
321 capacity)); | 321 capacity)); |
322 } | 322 } |
323 ++allocation; | 323 ++allocation; |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
| 327 void WebCacheManager::ClearCacheForProcess(int render_process_id) { |
| 328 std::set<int> renderers; |
| 329 renderers.insert(render_process_id); |
| 330 ClearRendererCache(renderers, INSTANTLY); |
| 331 } |
| 332 |
327 void WebCacheManager::ClearRendererCache( | 333 void WebCacheManager::ClearRendererCache( |
328 const std::set<int>& renderers, | 334 const std::set<int>& renderers, |
329 WebCacheManager::ClearCacheOccasion occasion) { | 335 WebCacheManager::ClearCacheOccasion occasion) { |
330 std::set<int>::const_iterator iter = renderers.begin(); | 336 std::set<int>::const_iterator iter = renderers.begin(); |
331 for (; iter != renderers.end(); ++iter) { | 337 for (; iter != renderers.end(); ++iter) { |
332 content::RenderProcessHost* host = | 338 content::RenderProcessHost* host = |
333 content::RenderProcessHost::FromID(*iter); | 339 content::RenderProcessHost::FromID(*iter); |
334 if (host) | 340 if (host) |
335 host->Send(new WebCacheMsg_ClearCache(occasion == ON_NAVIGATION)); | 341 host->Send(new WebCacheMsg_ClearCache(occasion == ON_NAVIGATION)); |
336 } | 342 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 inactive_renderers_.insert(*iter); | 433 inactive_renderers_.insert(*iter); |
428 active_renderers_.erase(*iter); | 434 active_renderers_.erase(*iter); |
429 iter = active_renderers_.begin(); | 435 iter = active_renderers_.begin(); |
430 continue; | 436 continue; |
431 } | 437 } |
432 ++iter; | 438 ++iter; |
433 } | 439 } |
434 } | 440 } |
435 | 441 |
436 } // namespace web_cache | 442 } // namespace web_cache |
OLD | NEW |