Chromium Code Reviews| Index: base/pickle.h |
| diff --git a/base/pickle.h b/base/pickle.h |
| index cb9bab98965f141b5ea9bffe264ed5cc76ba77e2..e04cf920c1f1da999be3d5c3731f418e1acf76bf 100644 |
| --- a/base/pickle.h |
| +++ b/base/pickle.h |
| @@ -273,6 +273,11 @@ class BASE_EXPORT Pickle { |
| // not been changed. |
| void TrimWriteData(int length); |
| + // Reserves space for upcoming writes when multiple writes will be made and |
| + // their sizes are computed in advance. It can be significantly faster to call |
| + // Reserve() before calling WriteFoo() multiple times. |
| + void Reserve(size_t size); |
|
Tom Sepez
2013/10/24 17:48:06
Is |size| the additional amount of space to reserv
danakj
2013/10/24 17:51:38
Additional space, I will rename it to additional_c
|
| + |
| // Payload follows after allocation of Header (header size is customizable). |
| struct Header { |
| uint32 payload_size; // Specifies the size of the payload. |
| @@ -328,9 +333,7 @@ class BASE_EXPORT Pickle { |
| // Resize the capacity, note that the input value should include the size of |
| // the header: new_capacity = sizeof(Header) + desired_payload_capacity. |
| - // A realloc() failure will cause a Resize failure... and caller should check |
| - // the return result for true (i.e., successful resizing). |
| - bool Resize(size_t new_capacity); |
| + void Resize(size_t new_capacity); |
| // Aligns 'i' by rounding it up to the next multiple of 'alignment' |
| static size_t AlignInt(size_t i, int alignment) { |