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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 2877343003: Switch browser/extensions/api/file_system/file_system_api.[h|cc] to the TaskScheduler API (Closed)
Patch Set: Address Ben's comments. Created 3 years, 7 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
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/file_system/file_system_api.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 966ec6635852503db2694689f1fab495b39c56f9..18bebc7236782b5c5bca99c1eb47a721d54570f5 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -23,6 +23,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/post_task.h"
#include "base/value_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -591,11 +592,10 @@ bool FileSystemGetWritableEntryFunction::RunAsync() {
render_frame_host()->GetProcess()->GetID(), &path_, &error_))
return false;
- content::BrowserThread::PostTaskAndReply(
- content::BrowserThread::FILE, FROM_HERE,
- base::BindOnce(
- &FileSystemGetWritableEntryFunction::SetIsDirectoryOnFileThread,
- this),
+ base::PostTaskWithTraitsAndReply(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
+ base::BindOnce(&FileSystemGetWritableEntryFunction::SetIsDirectoryAsync,
+ this),
base::BindOnce(
&FileSystemGetWritableEntryFunction::CheckPermissionAndSendResponse,
this));
@@ -615,8 +615,7 @@ void FileSystemGetWritableEntryFunction::CheckPermissionAndSendResponse() {
PrepareFilesForWritableApp(paths);
}
-void FileSystemGetWritableEntryFunction::SetIsDirectoryOnFileThread() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
+void FileSystemGetWritableEntryFunction::SetIsDirectoryAsync() {
if (base::DirectoryExists(path_)) {
is_directory_ = true;
}
@@ -878,11 +877,11 @@ void FileSystemChooseEntryFunction::FilesSelected(
file_manager::util::IsUnderNonNativeLocalPath(GetProfile(), paths[0]);
#endif
- content::BrowserThread::PostTask(
- content::BrowserThread::FILE, FROM_HERE,
+ base::PostTaskWithTraits(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
base::BindOnce(
- &FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread,
- this, non_native_path, paths, web_contents));
+ &FileSystemChooseEntryFunction::ConfirmDirectoryAccessAsync, this,
+ non_native_path, paths, web_contents));
return;
}
@@ -894,7 +893,7 @@ void FileSystemChooseEntryFunction::FileSelectionCanceled() {
SendResponse(false);
}
-void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread(
+void FileSystemChooseEntryFunction::ConfirmDirectoryAccessAsync(
bool non_native_path,
const std::vector<base::FilePath>& paths,
content::WebContents* web_contents) {
@@ -1114,8 +1113,8 @@ bool FileSystemChooseEntryFunction::RunAsync() {
return true;
}
#endif
- content::BrowserThread::PostTaskAndReplyWithResult(
- content::BrowserThread::FILE, FROM_HERE,
+ base::PostTaskWithTraitsAndReplyWithResult(
+ FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
base::Bind(&base::DirectoryExists, previous_path),
set_initial_path_callback);
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698