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

Side by Side Diff: chrome/browser/android/history_report/delta_file_backend_leveldb.h

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_BACKEND_LEVELDB_H_
6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_BACKEND_LEVELDB_H_
7
8 #include <vector>
9
10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12
13 class GURL;
14
15 namespace leveldb {
16 class DB;
17 }
18
19 namespace history_report {
20
21 class DeltaFileEntryWithData;
22
23 // Backend for delta file.
24 class DeltaFileBackend {
25 public:
26 explicit DeltaFileBackend(const base::FilePath& dir);
27 ~DeltaFileBackend();
28
29 // Adds new addition entry to delta file
30 void PageAdded(const GURL& url);
31 // Adds new deletion entry to delta file
32 void PageDeleted(const GURL& url);
33 // Removes all delta file entries with
34 // sequence number <= min(|lower_bound|, max sequence number - 1).
35 // Returns max sequence number in delta file.
36 int64 Trim(int64 lower_bound);
37 // Recreates delta file using given |urls|.
38 bool Recreate(const std::vector<std::string>& urls);
39 // Provides up to |limit| delta file entries with
40 // sequence number > |last_seq_no|.
41 scoped_ptr<std::vector<DeltaFileEntryWithData> > Query(int64 last_seq_no,
42 int32 limit);
43 // Removes all entries from delta file
44 void Clear();
45
46 // Dumps internal state to string. For debuging.
47 std::string Dump();
48
49 private:
50 // Starts delta file backend.
51 bool Init();
52
53 bool EnsureInitialized();
54
55 class DigitsComparator;
56
57 base::FilePath path_;
58 scoped_ptr<leveldb::DB> db_;
59 scoped_ptr<DigitsComparator> leveldb_cmp_;
60
61 DISALLOW_COPY_AND_ASSIGN(DeltaFileBackend);
62 };
63
64 } // namespace history_report
65
66 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_BACKEND_LEVELDB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698