Commit 80f11cb5 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Remove the blocking pool from the service process.

The blocking pool is deprecated.

The only remaining user was the ServiceProcessPrefs' JsonPrefStore,
which now uses TaskScheduler instead.

Bug: 667892
Change-Id: Ic4739018ff111b7886bbc186e50f40408a8d9367
Reviewed-on: https://chromium-review.googlesource.com/660677Reviewed-by: default avatarGene Gutnik <gene@chromium.org>
Commit-Queue: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501264}
parent dc4e108d
......@@ -23,6 +23,7 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/task_scheduler/post_task.h"
#include "base/task_scheduler/scheduler_worker_pool_params.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/sequenced_worker_pool.h"
......@@ -185,13 +186,6 @@ bool ServiceProcess::Initialize(base::MessageLoopForUI* message_loop,
return false;
}
// Since SequencedWorkerPool is redirected to TaskScheduler, the value of
// |kMaxBlockingPoolThreads| is ignored.
constexpr int kMaxBlockingPoolThreads = 3;
blocking_pool_ =
new base::SequencedWorkerPool(kMaxBlockingPoolThreads, "ServiceBlocking",
base::TaskPriority::USER_VISIBLE);
// Initialize Mojo early so things can use it.
mojo::edk::Init();
mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport(
......@@ -204,10 +198,11 @@ bool ServiceProcess::Initialize(base::MessageLoopForUI* message_loop,
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
base::FilePath pref_path =
user_data_dir.Append(chrome::kServiceStateFileName);
service_prefs_.reset(new ServiceProcessPrefs(
service_prefs_ = std::make_unique<ServiceProcessPrefs>(
pref_path,
JsonPrefStore::GetTaskRunnerForFile(pref_path, blocking_pool_.get())
.get()));
base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN})
.get());
service_prefs_->ReadPrefs();
// This switch it required to run connector with test gaia.
......@@ -280,16 +275,6 @@ bool ServiceProcess::Teardown() {
io_thread_.reset();
file_thread_.reset();
if (blocking_pool_.get()) {
// The goal is to make it impossible for chrome to 'infinite loop' during
// shutdown, but to reasonably expect that all BLOCKING_SHUTDOWN tasks
// queued during shutdown get run. There's nothing particularly scientific
// about the number chosen.
const int kMaxNewShutdownBlockingTasks = 1000;
blocking_pool_->Shutdown(kMaxNewShutdownBlockingTasks);
blocking_pool_ = NULL;
}
if (base::TaskScheduler::GetInstance())
base::TaskScheduler::GetInstance()->Shutdown();
......
......@@ -24,7 +24,6 @@ class ServiceProcessState;
namespace base {
class CommandLine;
class SequencedWorkerPool;
class WaitableEvent;
}
......@@ -122,7 +121,6 @@ class ServiceProcess : public ServiceIPCServer::Client,
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
std::unique_ptr<base::Thread> io_thread_;
std::unique_ptr<base::Thread> file_thread_;
scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
std::unique_ptr<cloud_print::CloudPrintProxy> cloud_print_proxy_;
std::unique_ptr<ServiceProcessPrefs> service_prefs_;
std::unique_ptr<ServiceIPCServer> ipc_server_;
......
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