OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_ |
6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_ | 6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
| 13 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
13 | 16 |
14 class GURL; | 17 class GURL; |
15 | 18 |
16 namespace base { | 19 namespace base { |
17 class FilePath; | 20 class FilePath; |
18 } // namespace base | 21 } // namespace base |
19 | 22 |
20 namespace history_report { | 23 namespace history_report { |
21 | 24 |
22 class DeltaFileEntryWithData; | 25 class DeltaFileEntryWithData; |
23 class DeltaFileBackend; | 26 class DeltaFileBackend; |
24 | 27 |
25 // Delta file for gmscore integration and history reporting. | 28 // Delta file for gmscore integration and history reporting. |
26 class DeltaFileService { | 29 class DeltaFileService { |
27 public: | 30 public: |
28 explicit DeltaFileService(const base::FilePath& dir); | 31 explicit DeltaFileService(const base::FilePath& dir); |
29 ~DeltaFileService(); | 32 ~DeltaFileService(); |
30 | 33 |
31 // Adds new addtion entry to delta file. | 34 // Adds new addtion entry to delta file. |
32 void PageAdded(const GURL& url); | 35 void PageAdded(const GURL& url); |
33 // Adds new deletion entry to delta file. | 36 // Adds new deletion entry to delta file. |
34 void PageDeleted(const GURL& url); | 37 void PageDeleted(const GURL& url); |
35 // Removes all delta file entries with seqno <= lower_bound. | 38 // Removes all delta file entries with seqno <= lower_bound. |
36 // Returns max seqno in delta file. | 39 // Returns max seqno in delta file. |
37 int64 Trim(int64 lower_bound); | 40 int64_t Trim(int64_t lower_bound); |
38 // Removes all data from delta file and populates it with new addition | 41 // Removes all data from delta file and populates it with new addition |
39 // entries for given urls. | 42 // entries for given urls. |
40 bool Recreate(const std::vector<std::string>& urls); | 43 bool Recreate(const std::vector<std::string>& urls); |
41 // Provides up to limit delta file entries with seqno > last_seq_no. | 44 // Provides up to limit delta file entries with seqno > last_seq_no. |
42 scoped_ptr<std::vector<DeltaFileEntryWithData> > Query(int64 last_seq_no, | 45 scoped_ptr<std::vector<DeltaFileEntryWithData>> Query(int64_t last_seq_no, |
43 int32 limit); | 46 int32_t limit); |
44 // Removes all entries from delta file. | 47 // Removes all entries from delta file. |
45 void Clear(); | 48 void Clear(); |
46 | 49 |
47 // Dumps internal state to string. | 50 // Dumps internal state to string. |
48 std::string Dump(); | 51 std::string Dump(); |
49 | 52 |
50 private: | 53 private: |
51 | 54 |
52 base::SequencedWorkerPool::SequenceToken worker_pool_token_; | 55 base::SequencedWorkerPool::SequenceToken worker_pool_token_; |
53 scoped_ptr<DeltaFileBackend> delta_file_backend_; | 56 scoped_ptr<DeltaFileBackend> delta_file_backend_; |
54 | 57 |
55 DISALLOW_COPY_AND_ASSIGN(DeltaFileService); | 58 DISALLOW_COPY_AND_ASSIGN(DeltaFileService); |
56 }; | 59 }; |
57 | 60 |
58 } // namespace history_report | 61 } // namespace history_report |
59 | 62 |
60 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_ | 63 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_ |
OLD | NEW |