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

Side by Side Diff: base/pickle.h

Issue 6488010: Propagate the remote socket address to URLRequest and to ViewHostMsg_FrameNavigate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use HostPortPair everywhere Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_PICKLE_H__ 5 #ifndef BASE_PICKLE_H__
6 #define BASE_PICKLE_H__ 6 #define BASE_PICKLE_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 const void* data() const { return header_; } 61 const void* data() const { return header_; }
62 62
63 // Methods for reading the payload of the Pickle. To read from the start of 63 // Methods for reading the payload of the Pickle. To read from the start of
64 // the Pickle, initialize *iter to NULL. If successful, these methods return 64 // the Pickle, initialize *iter to NULL. If successful, these methods return
65 // true. Otherwise, false is returned to indicate that the result could not 65 // true. Otherwise, false is returned to indicate that the result could not
66 // be extracted. 66 // be extracted.
67 bool ReadBool(void** iter, bool* result) const; 67 bool ReadBool(void** iter, bool* result) const;
68 bool ReadInt(void** iter, int* result) const; 68 bool ReadInt(void** iter, int* result) const;
69 bool ReadLong(void** iter, long* result) const; 69 bool ReadLong(void** iter, long* result) const;
70 bool ReadSize(void** iter, size_t* result) const; 70 bool ReadSize(void** iter, size_t* result) const;
71 bool ReadUInt16(void** iter, uint16* result) const;
71 bool ReadUInt32(void** iter, uint32* result) const; 72 bool ReadUInt32(void** iter, uint32* result) const;
72 bool ReadInt64(void** iter, int64* result) const; 73 bool ReadInt64(void** iter, int64* result) const;
73 bool ReadUInt64(void** iter, uint64* result) const; 74 bool ReadUInt64(void** iter, uint64* result) const;
74 bool ReadString(void** iter, std::string* result) const; 75 bool ReadString(void** iter, std::string* result) const;
75 bool ReadWString(void** iter, std::wstring* result) const; 76 bool ReadWString(void** iter, std::wstring* result) const;
76 bool ReadString16(void** iter, string16* result) const; 77 bool ReadString16(void** iter, string16* result) const;
77 bool ReadData(void** iter, const char** data, int* length) const; 78 bool ReadData(void** iter, const char** data, int* length) const;
78 bool ReadBytes(void** iter, const char** data, int length) const; 79 bool ReadBytes(void** iter, const char** data, int length) const;
79 80
80 // Safer version of ReadInt() checks for the result not being negative. 81 // Safer version of ReadInt() checks for the result not being negative.
81 // Use it for reading the object sizes. 82 // Use it for reading the object sizes.
82 bool ReadLength(void** iter, int* result) const; 83 bool ReadLength(void** iter, int* result) const;
83 84
84 // Methods for adding to the payload of the Pickle. These values are 85 // Methods for adding to the payload of the Pickle. These values are
85 // appended to the end of the Pickle's payload. When reading values from a 86 // appended to the end of the Pickle's payload. When reading values from a
86 // Pickle, it is important to read them in the order in which they were added 87 // Pickle, it is important to read them in the order in which they were added
87 // to the Pickle. 88 // to the Pickle.
88 bool WriteBool(bool value) { 89 bool WriteBool(bool value) {
89 return WriteInt(value ? 1 : 0); 90 return WriteInt(value ? 1 : 0);
90 } 91 }
91 bool WriteInt(int value) { 92 bool WriteInt(int value) {
92 return WriteBytes(&value, sizeof(value)); 93 return WriteBytes(&value, sizeof(value));
93 } 94 }
94 bool WriteLong(long value) { 95 bool WriteLong(long value) {
95 return WriteBytes(&value, sizeof(value)); 96 return WriteBytes(&value, sizeof(value));
96 } 97 }
97 bool WriteSize(size_t value) { 98 bool WriteSize(size_t value) {
98 return WriteBytes(&value, sizeof(value)); 99 return WriteBytes(&value, sizeof(value));
99 } 100 }
101 bool WriteUInt16(uint16 value) {
102 return WriteBytes(&value, sizeof(value));
103 }
100 bool WriteUInt32(uint32 value) { 104 bool WriteUInt32(uint32 value) {
101 return WriteBytes(&value, sizeof(value)); 105 return WriteBytes(&value, sizeof(value));
102 } 106 }
103 bool WriteInt64(int64 value) { 107 bool WriteInt64(int64 value) {
104 return WriteBytes(&value, sizeof(value)); 108 return WriteBytes(&value, sizeof(value));
105 } 109 }
106 bool WriteUInt64(uint64 value) { 110 bool WriteUInt64(uint64 value) {
107 return WriteBytes(&value, sizeof(value)); 111 return WriteBytes(&value, sizeof(value));
108 } 112 }
109 bool WriteString(const std::string& value); 113 bool WriteString(const std::string& value);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 size_t capacity_; 237 size_t capacity_;
234 size_t variable_buffer_offset_; // IF non-zero, then offset to a buffer. 238 size_t variable_buffer_offset_; // IF non-zero, then offset to a buffer.
235 239
236 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize); 240 FRIEND_TEST_ALL_PREFIXES(PickleTest, Resize);
237 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext); 241 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNext);
238 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader); 242 FRIEND_TEST_ALL_PREFIXES(PickleTest, FindNextWithIncompleteHeader);
239 FRIEND_TEST_ALL_PREFIXES(PickleTest, IteratorHasRoom); 243 FRIEND_TEST_ALL_PREFIXES(PickleTest, IteratorHasRoom);
240 }; 244 };
241 245
242 #endif // BASE_PICKLE_H__ 246 #endif // BASE_PICKLE_H__
OLDNEW
« no previous file with comments | « no previous file | base/pickle.cc » ('j') | chrome/browser/renderer_host/test/render_view_host_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698