Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: components/web_cache/browser/web_cache_manager.cc

Issue 1619363002: Add compile time checks against longs being used in IPC structs on 32 bit Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more per Dmitry Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) { 302 void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) {
303 // Inform each render process of its cache allocation. 303 // Inform each render process of its cache allocation.
304 AllocationStrategy::const_iterator allocation = strategy.begin(); 304 AllocationStrategy::const_iterator allocation = strategy.begin();
305 while (allocation != strategy.end()) { 305 while (allocation != strategy.end()) {
306 content::RenderProcessHost* host = 306 content::RenderProcessHost* host =
307 content::RenderProcessHost::FromID(allocation->first); 307 content::RenderProcessHost::FromID(allocation->first);
308 if (host) { 308 if (host) {
309 // This is the capacity this renderer has been allocated. 309 // This is the capacity this renderer has been allocated.
310 size_t capacity = allocation->second; 310 uint32_t capacity = allocation->second;
311 311
312 // We don't reserve any space for dead objects in the cache. Instead, we 312 // We don't reserve any space for dead objects in the cache. Instead, we
313 // prefer to keep live objects around. There is probably some performance 313 // prefer to keep live objects around. There is probably some performance
314 // tuning to be done here. 314 // tuning to be done here.
315 size_t min_dead_capacity = 0; 315 uint32_t min_dead_capacity = 0;
316 316
317 // We allow the dead objects to consume up to half of the cache capacity. 317 // We allow the dead objects to consume up to half of the cache capacity.
318 size_t max_dead_capacity = capacity / 2; 318 uint32_t max_dead_capacity = capacity / 2;
319 if (base::SysInfo::IsLowEndDevice()) { 319 if (base::SysInfo::IsLowEndDevice())
320 max_dead_capacity = std::min(static_cast<size_t>(512 * 1024), 320 max_dead_capacity = std::min(512 * 1024u, max_dead_capacity);
321 max_dead_capacity); 321
322 }
323 host->Send(new WebCacheMsg_SetCacheCapacities(min_dead_capacity, 322 host->Send(new WebCacheMsg_SetCacheCapacities(min_dead_capacity,
324 max_dead_capacity, 323 max_dead_capacity,
325 capacity)); 324 capacity));
326 } 325 }
327 ++allocation; 326 ++allocation;
328 } 327 }
329 } 328 }
330 329
331 void WebCacheManager::ClearCacheForProcess(int render_process_id) { 330 void WebCacheManager::ClearCacheForProcess(int render_process_id) {
332 std::set<int> renderers; 331 std::set<int> renderers;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 inactive_renderers_.insert(*iter); 435 inactive_renderers_.insert(*iter);
437 active_renderers_.erase(*iter); 436 active_renderers_.erase(*iter);
438 iter = active_renderers_.begin(); 437 iter = active_renderers_.begin();
439 continue; 438 continue;
440 } 439 }
441 ++iter; 440 ++iter;
442 } 441 }
443 } 442 }
444 443
445 } // namespace web_cache 444 } // namespace web_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698