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

Side by Side Diff: chrome/common/render_messages.cc

Issue 1687543003: Fix crash from r374241 when renderers are using more than 2GB of cache memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/common/render_messages.h" 5 #include "chrome/common/render_messages.h"
6 6
7 #include "chrome/common/content_settings_pattern_serializer.h" 7 #include "chrome/common/content_settings_pattern_serializer.h"
8 8
9 namespace IPC { 9 namespace IPC {
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 void ParamTraits<ContentSettingsPattern>::Log( 24 void ParamTraits<ContentSettingsPattern>::Log(
25 const ContentSettingsPattern& p, std::string* l) { 25 const ContentSettingsPattern& p, std::string* l) {
26 l->append("<ContentSettingsPattern: "); 26 l->append("<ContentSettingsPattern: ");
27 l->append(p.ToString()); 27 l->append(p.ToString());
28 l->append(">"); 28 l->append(">");
29 } 29 }
30 30
31 void ParamTraits<blink::WebCache::UsageStats>::Write( 31 void ParamTraits<blink::WebCache::UsageStats>::Write(
32 base::Pickle* m, const blink::WebCache::UsageStats& u) { 32 base::Pickle* m, const blink::WebCache::UsageStats& u) {
33 m->WriteUInt32(base::checked_cast<int>(u.minDeadCapacity)); 33 m->WriteUInt64(static_cast<uint64_t>(u.minDeadCapacity));
34 m->WriteUInt32(base::checked_cast<int>(u.maxDeadCapacity)); 34 m->WriteUInt64(static_cast<uint64_t>(u.maxDeadCapacity));
35 m->WriteUInt32(base::checked_cast<int>(u.capacity)); 35 m->WriteUInt64(static_cast<uint64_t>(u.capacity));
36 m->WriteUInt32(base::checked_cast<int>(u.liveSize)); 36 m->WriteUInt64(static_cast<uint64_t>(u.liveSize));
37 m->WriteUInt32(base::checked_cast<int>(u.deadSize)); 37 m->WriteUInt64(static_cast<uint64_t>(u.deadSize));
38 } 38 }
39 39
40 bool ParamTraits<blink::WebCache::UsageStats>::Read( 40 bool ParamTraits<blink::WebCache::UsageStats>::Read(
41 const base::Pickle* m, 41 const base::Pickle* m,
42 base::PickleIterator* iter, 42 base::PickleIterator* iter,
43 blink::WebCache::UsageStats* u) { 43 blink::WebCache::UsageStats* u) {
44 uint32_t min_capacity, max_capacity, capacity, live_size, dead_size; 44 uint64_t min_capacity, max_capacity, capacity, live_size, dead_size;
Tom Sepez 2016/02/10 00:27:29 nit: one per line.
45 if (!iter->ReadUInt32(&min_capacity) || 45 if (!iter->ReadUInt64(&min_capacity) ||
46 !iter->ReadUInt32(&max_capacity) || 46 !iter->ReadUInt64(&max_capacity) ||
47 !iter->ReadUInt32(&capacity) || 47 !iter->ReadUInt64(&capacity) ||
48 !iter->ReadUInt32(&live_size) || 48 !iter->ReadUInt64(&live_size) ||
49 !iter->ReadUInt32(&dead_size)) { 49 !iter->ReadUInt64(&dead_size)) {
50 return false; 50 return false;
51 } 51 }
52 52
53 u->minDeadCapacity = min_capacity; 53 u->minDeadCapacity = base::checked_cast<size_t>(min_capacity);
54 u->maxDeadCapacity = max_capacity; 54 u->maxDeadCapacity = base::checked_cast<size_t>(max_capacity);
55 u->capacity = capacity; 55 u->capacity = base::checked_cast<size_t>(capacity);
56 u->liveSize = live_size; 56 u->liveSize = base::checked_cast<size_t>(live_size);
57 u->deadSize = dead_size; 57 u->deadSize = base::checked_cast<size_t>(dead_size);
jam 2016/02/09 23:00:17 this should be safe since right now don't have 32
58 58
59 return true; 59 return true;
60 } 60 }
61 61
62 void ParamTraits<blink::WebCache::UsageStats>::Log( 62 void ParamTraits<blink::WebCache::UsageStats>::Log(
63 const blink::WebCache::UsageStats& p, std::string* l) { 63 const blink::WebCache::UsageStats& p, std::string* l) {
64 l->append("<blink::WebCache::UsageStats>"); 64 l->append("<blink::WebCache::UsageStats>");
65 } 65 }
66 66
67 } // namespace IPC 67 } // namespace IPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698