Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / android / history_report / delta_file_service.h
bloba377b491aca210ea3a8e19a4c5a58a41adfa42c2
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_
6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/sequenced_worker_pool.h"
14 class GURL;
16 namespace base {
17 class FilePath;
18 } // namespace base
20 namespace history_report {
22 class DeltaFileEntryWithData;
23 class DeltaFileBackend;
25 // Delta file for gmscore integration and history reporting.
26 class DeltaFileService {
27 public:
28 explicit DeltaFileService(const base::FilePath& dir);
29 ~DeltaFileService();
31 // Adds new addtion entry to delta file.
32 void PageAdded(const GURL& url);
33 // Adds new deletion entry to delta file.
34 void PageDeleted(const GURL& url);
35 // Removes all delta file entries with seqno <= lower_bound.
36 // Returns max seqno in delta file.
37 int64 Trim(int64 lower_bound);
38 // Removes all data from delta file and populates it with new addition
39 // entries for given urls.
40 bool Recreate(const std::vector<std::string>& urls);
41 // Provides up to limit delta file entries with seqno > last_seq_no.
42 scoped_ptr<std::vector<DeltaFileEntryWithData> > Query(int64 last_seq_no,
43 int32 limit);
44 // Removes all entries from delta file.
45 void Clear();
47 // Dumps internal state to string.
48 std::string Dump();
50 private:
52 base::SequencedWorkerPool::SequenceToken worker_pool_token_;
53 scoped_ptr<DeltaFileBackend> delta_file_backend_;
55 DISALLOW_COPY_AND_ASSIGN(DeltaFileService);
58 } // namespace history_report
60 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_SERVICE_H_