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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/history_report/delta_file_backend_leveldb.h
diff --git a/chrome/browser/android/history_report/delta_file_backend_leveldb.h b/chrome/browser/android/history_report/delta_file_backend_leveldb.h
new file mode 100644
index 0000000000000000000000000000000000000000..85f0f9116a5b771157279029c3e579db651b7275
--- /dev/null
+++ b/chrome/browser/android/history_report/delta_file_backend_leveldb.h
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_BACKEND_LEVELDB_H_
+#define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_BACKEND_LEVELDB_H_
+
+#include <vector>
+
+#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
+
+class GURL;
+
+namespace leveldb {
+class DB;
+}
+
+namespace history_report {
+
+class DeltaFileEntryWithData;
+
+// Backend for delta file.
+class DeltaFileBackend {
+ public:
+ explicit DeltaFileBackend(const base::FilePath& dir);
+ ~DeltaFileBackend();
+
+ // Adds new addition entry to delta file
+ void PageAdded(const GURL& url);
+ // Adds new deletion entry to delta file
+ void PageDeleted(const GURL& url);
+ // Removes all delta file entries with
+ // sequence number <= min(|lower_bound|, max sequence number - 1).
+ // Returns max sequence number in delta file.
+ int64 Trim(int64 lower_bound);
+ // Recreates delta file using given |urls|.
+ bool Recreate(const std::vector<std::string>& urls);
+ // Provides up to |limit| delta file entries with
+ // sequence number > |last_seq_no|.
+ scoped_ptr<std::vector<DeltaFileEntryWithData> > Query(int64 last_seq_no,
+ int32 limit);
+ // Removes all entries from delta file
+ void Clear();
+
+ // Dumps internal state to string. For debuging.
+ std::string Dump();
+
+ private:
+ // Starts delta file backend.
+ bool Init();
+
+ bool EnsureInitialized();
+
+ class DigitsComparator;
+
+ base::FilePath path_;
+ scoped_ptr<leveldb::DB> db_;
+ scoped_ptr<DigitsComparator> leveldb_cmp_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeltaFileBackend);
+};
+
+} // namespace history_report
+
+#endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_BACKEND_LEVELDB_H_

Powered by Google App Engine
This is Rietveld 408576698