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

Unified Diff: base/pickle.h

Issue 601563003: Add Read/WriteSizeT() functions to the pickle layer, plus one consumer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failure Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/pickle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle.h
diff --git a/base/pickle.h b/base/pickle.h
index 99add5eb42dac5b7a68954ca85eac418ce1922a6..11cf4841f67903b7bd62cd6bdc4dda5467a4f47c 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -35,6 +35,7 @@ class BASE_EXPORT PickleIterator {
bool ReadUInt32(uint32* result) WARN_UNUSED_RESULT;
bool ReadInt64(int64* result) WARN_UNUSED_RESULT;
bool ReadUInt64(uint64* result) WARN_UNUSED_RESULT;
+ bool ReadSizeT(size_t* result) WARN_UNUSED_RESULT;
bool ReadFloat(float* result) WARN_UNUSED_RESULT;
bool ReadDouble(double* result) WARN_UNUSED_RESULT;
bool ReadString(std::string* result) WARN_UNUSED_RESULT;
@@ -172,6 +173,10 @@ class BASE_EXPORT Pickle {
uint64* result) const WARN_UNUSED_RESULT {
return iter->ReadUInt64(result);
}
+ bool ReadSizeT(PickleIterator* iter,
+ size_t* result) const WARN_UNUSED_RESULT {
+ return iter->ReadSizeT(result);
+ }
bool ReadFloat(PickleIterator* iter,
float* result) const WARN_UNUSED_RESULT {
return iter->ReadFloat(result);
@@ -248,6 +253,11 @@ class BASE_EXPORT Pickle {
bool WriteUInt64(uint64 value) {
return WritePOD(value);
}
+ bool WriteSizeT(size_t value) {
+ // Always write size_t as a 64-bit value to ensure compatibility between
+ // 32-bit and 64-bit processes.
+ return WritePOD(static_cast<uint64>(value));
+ }
bool WriteFloat(float value) {
return WritePOD(value);
}
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/pickle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698