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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java

Issue 2296833002: Add tab persistence support for CustomTabs. (Closed)
Patch Set: Fix test Created 4 years, 3 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/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
index 8126adb8b952f402fd165c959ebad2db4b201168..1bfbef6313b1ea72abd98f771805c0f4a5b2f0ba 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -219,11 +219,12 @@ public class TabPersistentStore extends TabPersister {
mPreferences = ContextUtils.getAppSharedPreferences();
assert isStateFile(policy.getStateFileName()) : "State file name is not valid";
- boolean needsMigration = mPersistencePolicy.performMigration(AsyncTask.SERIAL_EXECUTOR);
+ boolean needsInitialization = mPersistencePolicy.performInitialization(
+ AsyncTask.SERIAL_EXECUTOR);
if (mPersistencePolicy.isMergeInProgress()) return;
- Executor executor = needsMigration
+ Executor executor = needsInitialization
? AsyncTask.SERIAL_EXECUTOR : AsyncTask.THREAD_POOL_EXECUTOR;
mPrefetchTabListTask =
@@ -247,7 +248,7 @@ public class TabPersistentStore extends TabPersister {
*/
@VisibleForTesting
public void waitForMigrationToFinish() {
- mPersistencePolicy.waitForMigrationToFinish();
+ mPersistencePolicy.waitForInitializationToFinish();
}
/**
@@ -998,7 +999,7 @@ public class TabPersistentStore extends TabPersister {
* @param forMerge Whether this state file was read as part of a merge.
* @return The next available tab ID based on the maximum ID referenced in this state file.
*/
- protected static int readSavedStateFile(
+ public static int readSavedStateFile(
DataInputStream stream, @Nullable OnTabStateReadCallback callback,
@Nullable SparseBooleanArray tabIds, boolean forMerge) throws IOException {
if (stream == null) return 0;
@@ -1367,9 +1368,19 @@ public class TabPersistentStore extends TabPersister {
}
/**
+ * Parses the state file name and returns the unique ID encoded into it.
+ * @param stateFileName The state file name to be parsed.
+ * @return The unique ID used when generating the file name.
+ */
+ public static String getStateFileUniqueId(String stateFileName) {
+ assert isStateFile(stateFileName);
+ return stateFileName.substring(TabPersistencePolicy.SAVED_STATE_FILE_PREFIX.length());
+ }
+
+ /**
* @return Whether the specified filename matches the expected pattern of the tab state files.
*/
- private static boolean isStateFile(String fileName) {
+ public static boolean isStateFile(String fileName) {
return fileName.startsWith(TabPersistencePolicy.SAVED_STATE_FILE_PREFIX);
}

Powered by Google App Engine
This is Rietveld 408576698