diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-06 09:33:53 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-06 09:33:53 +0000 |
commit | 4ecbb8f86691102f2a1162677ce091d3de8c5888 (patch) | |
tree | 97bd98672d4145a39081d305e632ac8056954f5c /base | |
parent | 129b1856e1cf1aa873c863385f21a5a424cd8549 (diff) | |
download | chromium_src-4ecbb8f86691102f2a1162677ce091d3de8c5888.zip chromium_src-4ecbb8f86691102f2a1162677ce091d3de8c5888.tar.gz chromium_src-4ecbb8f86691102f2a1162677ce091d3de8c5888.tar.bz2 |
Allow atomic file writes from Android on the UI thread.
This is needed because Android writes its tab data during closedown or
when the browser goes into the background. This has to be done on
the UI thread to ensure timely completion.
BUG=148011
Review URL: https://codereview.chromium.org/12457007
Patch from Anthony Berent <aberent@chromium.org>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/android/important_file_writer_android.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/base/android/important_file_writer_android.cc b/base/android/important_file_writer_android.cc index f2275c1..05719ae 100644 --- a/base/android/important_file_writer_android.cc +++ b/base/android/important_file_writer_android.cc @@ -8,6 +8,7 @@ #include "base/android/jni_string.h" #include "base/files/important_file_writer.h" +#include "base/threading/thread_restrictions.h" #include "jni/ImportantFileWriterAndroid_jni.h" namespace base { @@ -17,6 +18,9 @@ static jboolean WriteFileAtomically(JNIEnv* env, jclass /* clazz */, jstring file_name, jbyteArray data) { + // This is called on the UI thread during shutdown to save tab data, so + // needs to enable IO. + base::ThreadRestrictions::ScopedAllowIO(); std::string native_file_name; base::android::ConvertJavaStringToUTF8(env, file_name, &native_file_name); base::FilePath path(native_file_name); |