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

Unified Diff: components/nacl/browser/nacl_file_host.cc

Issue 2770803002: Use TaskScheduler instead of blocking pool in nacl_file_host.cc. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/browser/nacl_file_host.cc
diff --git a/components/nacl/browser/nacl_file_host.cc b/components/nacl/browser/nacl_file_host.cc
index 4c1cdb68f6986767c2bcfaf958d982cbcfaac621..bc286ab2442dd78e56ba3b6c2b5568a1acf69091 100644
--- a/components/nacl/browser/nacl_file_host.cc
+++ b/components/nacl/browser/nacl_file_host.cc
@@ -13,6 +13,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/sequenced_worker_pool.h"
#include "components/nacl/browser/bad_message.h"
#include "components/nacl/browser/nacl_browser.h"
@@ -73,7 +74,6 @@ void DoOpenPnaclFile(
const std::string& filename,
bool is_executable,
IPC::Message* reply_msg) {
- DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
base::FilePath full_filepath;
// PNaCl must be installed.
@@ -127,8 +127,6 @@ void DoOpenNaClExecutableOnThreadPool(
const GURL& file_url,
bool enable_validation_caching,
IPC::Message* reply_msg) {
- DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
-
base::FilePath file_path;
if (!nacl::NaClBrowser::GetDelegate()->MapUrlToLocalFilePath(
file_url,
@@ -180,15 +178,10 @@ void GetReadonlyPnaclFd(
const std::string& filename,
bool is_executable,
IPC::Message* reply_msg) {
- if (!BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(&DoOpenPnaclFile,
- nacl_host_message_filter,
- filename,
- is_executable,
- reply_msg))) {
- NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg);
- }
+ base::PostTaskWithTraits(
+ FROM_HERE, base::TaskTraits().MayBlock(),
+ base::Bind(&DoOpenPnaclFile, nacl_host_message_filter, filename,
+ is_executable, reply_msg));
}
// This function is security sensitive. Be sure to check with a security
@@ -266,16 +259,10 @@ void OpenNaClExecutable(
// The URL is part of the current app. Now query the extension system for the
// file path and convert that to a file descriptor. This should be done on a
// blocking pool thread.
- if (!BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(
- &DoOpenNaClExecutableOnThreadPool,
- nacl_host_message_filter,
- file_url,
- enable_validation_caching,
- reply_msg))) {
- NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg);
- }
+ base::PostTaskWithTraits(
+ FROM_HERE, base::TaskTraits().MayBlock(),
+ base::Bind(&DoOpenNaClExecutableOnThreadPool, nacl_host_message_filter,
+ file_url, enable_validation_caching, reply_msg));
}
} // namespace nacl_file_host
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698