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

Side by Side Diff: base/pickle.cc

Issue 19642005: Make TracedValue lower overhead. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Validations for dictionary entries, CR comments, and additional check before writting. Created 7 years, 4 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 "base/pickle.h" 5 #include "base/pickle.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> // for max() 9 #include <algorithm> // for max()
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 bool PickleIterator::ReadInt64(int64* result) { 85 bool PickleIterator::ReadInt64(int64* result) {
86 return ReadBuiltinType(result); 86 return ReadBuiltinType(result);
87 } 87 }
88 88
89 bool PickleIterator::ReadUInt64(uint64* result) { 89 bool PickleIterator::ReadUInt64(uint64* result) {
90 return ReadBuiltinType(result); 90 return ReadBuiltinType(result);
91 } 91 }
92 92
93 bool PickleIterator::ReadUIntPtr(uintptr_t* result) {
94 return ReadBuiltinType(result);
95 }
96
93 bool PickleIterator::ReadFloat(float* result) { 97 bool PickleIterator::ReadFloat(float* result) {
94 return ReadBuiltinType(result); 98 return ReadBuiltinType(result);
95 } 99 }
96 100
97 bool PickleIterator::ReadString(std::string* result) { 101 bool PickleIterator::ReadString(std::string* result) {
98 int len; 102 int len;
99 if (!ReadInt(&len)) 103 if (!ReadInt(&len))
100 return false; 104 return false;
101 const char* read_from = GetReadPointerAndAdvance(len); 105 const char* read_from = GetReadPointerAndAdvance(len);
102 if (!read_from) 106 if (!read_from)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return NULL; 356 return NULL;
353 357
354 const Header* hdr = reinterpret_cast<const Header*>(start); 358 const Header* hdr = reinterpret_cast<const Header*>(start);
355 const char* payload_base = start + header_size; 359 const char* payload_base = start + header_size;
356 const char* payload_end = payload_base + hdr->payload_size; 360 const char* payload_end = payload_base + hdr->payload_size;
357 if (payload_end < payload_base) 361 if (payload_end < payload_base)
358 return NULL; 362 return NULL;
359 363
360 return (payload_end > end) ? NULL : payload_end; 364 return (payload_end > end) ? NULL : payload_end;
361 } 365 }
OLDNEW
« base/debug/trace_event_value.cc ('K') | « base/pickle.h ('k') | base/pickle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698