OLD | NEW |
(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 package org.chromium.chrome.browser.historyreport; |
| 6 |
| 7 import org.chromium.base.VisibleForTesting; |
| 8 |
| 9 import java.io.PrintWriter; |
| 10 |
| 11 /** |
| 12 * Defines contract which has to be fulfilled by data provider on native side. |
| 13 */ |
| 14 public interface SearchJniBridge { |
| 15 |
| 16 /** |
| 17 * Inits native side and registers data change observer. |
| 18 * Native initialization will be done on UI thread. |
| 19 */ |
| 20 boolean init(DataChangeObserver observer); |
| 21 |
| 22 /** |
| 23 * Queries native side for delta file entries which will be served to local
indexing service. |
| 24 * @param lastSeqNo which is a lower bound for seqno's of returned entries |
| 25 * @param limit of returned entries |
| 26 */ |
| 27 DeltaFileEntry[] query(long lastSeqNo, int limit); |
| 28 |
| 29 /** |
| 30 * Trims delta file by dropping entries with seqno smaller and equal to seqN
oLowerBound. |
| 31 * It returns highest seqno in delta file. |
| 32 */ |
| 33 long trimDeltaFile(long seqNoLowerBound); |
| 34 |
| 35 /** |
| 36 * Queries native side for a batch of usage reports which will be sync'ed wi
th local indexing |
| 37 * service. |
| 38 * @param batchSize intended number of usage reports in a batch. |
| 39 */ |
| 40 UsageReport[] getUsageReportsBatch(int batchSize); |
| 41 |
| 42 /** |
| 43 * Removes usage reports from the internal buffer. |
| 44 */ |
| 45 void removeUsageReports(UsageReport[] reports); |
| 46 |
| 47 /** |
| 48 * Adds all the historic visits to the usage report buffer. |
| 49 * |
| 50 * Should be done only once. |
| 51 * @return whether the visits were successfully added to the buffer. |
| 52 */ |
| 53 boolean addHistoricVisitsToUsageReportsBuffer(); |
| 54 |
| 55 /** |
| 56 * Observer on data changes. |
| 57 */ |
| 58 public static interface DataChangeObserver { |
| 59 /** |
| 60 * Called when data has been changed. |
| 61 */ |
| 62 void onDataChanged(); |
| 63 /** |
| 64 * Called when data has been cleared. |
| 65 */ |
| 66 void onDataCleared(); |
| 67 /** |
| 68 * Called when usage reports can be reported to local indexing service. |
| 69 */ |
| 70 void startReportingTask(); |
| 71 /** |
| 72 * Called when usage reports can't be reported to local indexing service
any more. |
| 73 */ |
| 74 void stopReportingTask(); |
| 75 } |
| 76 |
| 77 @VisibleForTesting |
| 78 boolean isStartedForTest(); |
| 79 |
| 80 void dump(PrintWriter writer); |
| 81 } |
OLD | NEW |