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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/historyreport/SearchJniBridge.java

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/android/java_staging/src/org/chromium/chrome/browser/historyreport/SearchJniBridge.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/historyreport/SearchJniBridge.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/historyreport/SearchJniBridge.java
new file mode 100644
index 0000000000000000000000000000000000000000..2ba996d4df134b2e7df3d8548e17bd5feff6629b
--- /dev/null
+++ b/chrome/android/java_staging/src/org/chromium/chrome/browser/historyreport/SearchJniBridge.java
@@ -0,0 +1,81 @@
+// 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.
+
+package org.chromium.chrome.browser.historyreport;
+
+import org.chromium.base.VisibleForTesting;
+
+import java.io.PrintWriter;
+
+/**
+ * Defines contract which has to be fulfilled by data provider on native side.
+ */
+public interface SearchJniBridge {
+
+ /**
+ * Inits native side and registers data change observer.
+ * Native initialization will be done on UI thread.
+ */
+ boolean init(DataChangeObserver observer);
+
+ /**
+ * Queries native side for delta file entries which will be served to local indexing service.
+ * @param lastSeqNo which is a lower bound for seqno's of returned entries
+ * @param limit of returned entries
+ */
+ DeltaFileEntry[] query(long lastSeqNo, int limit);
+
+ /**
+ * Trims delta file by dropping entries with seqno smaller and equal to seqNoLowerBound.
+ * It returns highest seqno in delta file.
+ */
+ long trimDeltaFile(long seqNoLowerBound);
+
+ /**
+ * Queries native side for a batch of usage reports which will be sync'ed with local indexing
+ * service.
+ * @param batchSize intended number of usage reports in a batch.
+ */
+ UsageReport[] getUsageReportsBatch(int batchSize);
+
+ /**
+ * Removes usage reports from the internal buffer.
+ */
+ void removeUsageReports(UsageReport[] reports);
+
+ /**
+ * Adds all the historic visits to the usage report buffer.
+ *
+ * Should be done only once.
+ * @return whether the visits were successfully added to the buffer.
+ */
+ boolean addHistoricVisitsToUsageReportsBuffer();
+
+ /**
+ * Observer on data changes.
+ */
+ public static interface DataChangeObserver {
+ /**
+ * Called when data has been changed.
+ */
+ void onDataChanged();
+ /**
+ * Called when data has been cleared.
+ */
+ void onDataCleared();
+ /**
+ * Called when usage reports can be reported to local indexing service.
+ */
+ void startReportingTask();
+ /**
+ * Called when usage reports can't be reported to local indexing service any more.
+ */
+ void stopReportingTask();
+ }
+
+ @VisibleForTesting
+ boolean isStartedForTest();
+
+ void dump(PrintWriter writer);
+}

Powered by Google App Engine
This is Rietveld 408576698