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

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

Issue 2374523002: Add logging for prefetch tablist task. (Closed)
Patch Set: Add logging. 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/TabbedModeTabPersistencePolicy.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabbedModeTabPersistencePolicy.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabbedModeTabPersistencePolicy.java
index 3100095057b1a587cff8f536b5e927d4770542b5..7164e6d1440e08a3b48d55515a92f2723f594c5a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabbedModeTabPersistencePolicy.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabbedModeTabPersistencePolicy.java
@@ -4,7 +4,6 @@
package org.chromium.chrome.browser.tabmodel;
-import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.StrictMode;
@@ -76,7 +75,6 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
private static File sStateDirectory;
private final SharedPreferences mPreferences;
- private final Context mContext;
private final int mSelectorIndex;
private final int mOtherSelectorIndex;
@@ -85,14 +83,11 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
/**
* Constructs a persistence policy that handles the Tabbed mode specific logic.
- *
- * @param context A Context instance.
* @param selectorIndex The index that represents which state file to pull and save state to.
* This is used when there can be more than one TabModelSelector.
*/
- public TabbedModeTabPersistencePolicy(Context context, int selectorIndex) {
+ public TabbedModeTabPersistencePolicy(int selectorIndex) {
mPreferences = ContextUtils.getAppSharedPreferences();
- mContext = context;
mSelectorIndex = selectorIndex;
mOtherSelectorIndex = selectorIndex == 0 ? 1 : 0;
}
@@ -172,7 +167,6 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
if (!hasRunMultiInstanceMigration) {
performMultiInstanceMigration();
}
-
return null;
}
}.executeOnExecutor(executor);
@@ -186,11 +180,12 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
*/
@WorkerThread
private void performLegacyMigration() {
+ Log.w(TAG, "Starting to perform legacy migration.");
File newFolder = getOrCreateStateDirectory();
File[] newFiles = newFolder.listFiles();
// Attempt migration if we have no tab state file in the new directory.
if (newFiles == null || newFiles.length == 0) {
- File oldFolder = mContext.getFilesDir();
+ File oldFolder = ContextUtils.getApplicationContext().getFilesDir();
File modelFile = new File(oldFolder, LEGACY_SAVED_STATE_FILE);
if (modelFile.exists()) {
if (!modelFile.renameTo(new File(newFolder, getStateFileName()))) {
@@ -210,6 +205,7 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
}
}
setLegacyFileMigrationPref();
+ Log.w(TAG, "Finished performing legacy migration.");
}
/**
@@ -218,6 +214,7 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
*/
@WorkerThread
private void performMultiInstanceMigration() {
+ Log.w(TAG, "Starting to perform multi-instance migration.");
// 0. Do not rename the old metadata file if the new metadata file already exists. This
// should not happen, but if it does and the metadata file is overwritten then users
// may lose tabs. See crbug.com/649384.
@@ -297,6 +294,7 @@ public class TabbedModeTabPersistencePolicy implements TabPersistencePolicy {
}
setMultiInstanceFileMigrationPref();
+ Log.w(TAG, "Finished performing multi-instance migration.");
}
private void setLegacyFileMigrationPref() {

Powered by Google App Engine
This is Rietveld 408576698