Commit 561bac59 authored by David Maunder's avatar David Maunder Committed by Chromium LUCI CQ

Enable CriticlaPersistedTabData in fieldtrial_testing_config

This was determined to be necessary in cl/342061697. This is a reland of
chromium CL 2548503. An explanation was provided in the commit
description why loadNextTab() should be called on the UI thread instead
of restoreTabs(false) on the background thread. I deep dived the issue
created by that CL and found that a policy violation occurs when the
directory for CriticalPersistedTabData is created/read. I change the
policy and revert back after the directory is read (and created if
necessary) like we do in several other parts of TabPersistentStore.

Bug: 1151871
Change-Id: I306d4d2bc2ab2b074621d76d1926cc07d1b56b38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574620
Commit-Queue: David Maunder <davidjm@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834421}
parent d4ea8fa0
...@@ -457,9 +457,7 @@ public class TabPersistentStore extends TabPersister { ...@@ -457,9 +457,7 @@ public class TabPersistentStore extends TabPersister {
} }
// Restore the tabs from the second activity asynchronously. // Restore the tabs from the second activity asynchronously.
PostTask.postTask(TaskTraits.BEST_EFFORT_MAY_BLOCK, () -> { loadNextTab();
restoreTabs(false);
});
} }
/** /**
......
...@@ -29,6 +29,8 @@ import java.io.IOException; ...@@ -29,6 +29,8 @@ import java.io.IOException;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Locale; import java.util.Locale;
import android.os.StrictMode;
/** /**
* {@link PersistedTabDataStorage} which uses a file for the storage * {@link PersistedTabDataStorage} which uses a file for the storage
*/ */
...@@ -45,8 +47,13 @@ public class FilePersistedTabDataStorage implements PersistedTabDataStorage { ...@@ -45,8 +47,13 @@ public class FilePersistedTabDataStorage implements PersistedTabDataStorage {
private static File sDirectory; private static File sDirectory;
static { static {
sDirectory = StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
ContextUtils.getApplicationContext().getDir(sBaseDirName, Context.MODE_PRIVATE); try {
sDirectory =
ContextUtils.getApplicationContext().getDir(sBaseDirName, Context.MODE_PRIVATE);
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
} }
} }
private SequencedTaskRunner mSequencedTaskRunner; private SequencedTaskRunner mSequencedTaskRunner;
......
...@@ -2035,6 +2035,21 @@ ...@@ -2035,6 +2035,21 @@
] ]
} }
], ],
"CriticalPersistedTabData": [
{
"platforms": [
"android"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"CriticalPersistedTabData"
]
}
]
}
],
"CrosSchedulerCore": [ "CrosSchedulerCore": [
{ {
"platforms": [ "platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment