OLD | NEW |
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 #ifndef CHROME_BROWSER_SESSIONS_COMPRESS_DATA_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_COMPRESS_DATA_HELPER_H_ |
6 #define CHROME_BROWSER_SESSIONS_COMPRESS_DATA_HELPER_H_ | 6 #define CHROME_BROWSER_SESSIONS_COMPRESS_DATA_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 class Pickle; | 13 class Pickle; |
| 14 class PickleIterator; |
14 | 15 |
15 class CompressDataHelper { | 16 class CompressDataHelper { |
16 public: | 17 public: |
17 // Compresses and writes |str| into |pickle|. |str| may contain NULL | 18 // Compresses and writes |str| into |pickle|. |str| may contain NULL |
18 // charaters. | 19 // charaters. |
19 static void CompressAndWriteStringToPickle(const std::string& str, | 20 static void CompressAndWriteStringToPickle(const std::string& str, |
20 int max_bytes, | 21 int max_bytes, |
21 Pickle* pickle, | 22 Pickle* pickle, |
22 int* bytes_written); | 23 int* bytes_written); |
23 | 24 |
24 // Reads and decompresses a string from |pickle| and saves it to |str|. |iter| | 25 // Reads and decompresses a string from |pickle| and saves it to |str|. |iter| |
25 // indicates the position of the data. The same iterator is used by | 26 // indicates the position of the data. The same iterator is used by |
26 // Pickle::Read* functions. | 27 // Pickle::Read* functions. |
27 static bool ReadAndDecompressStringFromPickle(const Pickle& pickle, | 28 static bool ReadAndDecompressStringFromPickle(const Pickle& pickle, |
28 void** iter, | 29 PickleIterator* iter, |
29 std::string* str); | 30 std::string* str); |
30 private: | 31 private: |
31 DISALLOW_IMPLICIT_CONSTRUCTORS(CompressDataHelper); | 32 DISALLOW_IMPLICIT_CONSTRUCTORS(CompressDataHelper); |
32 }; | 33 }; |
33 | 34 |
34 #endif // CHROME_BROWSER_SESSIONS_COMPRESS_DATA_HELPER_H_ | 35 #endif // CHROME_BROWSER_SESSIONS_COMPRESS_DATA_HELPER_H_ |
OLD | NEW |