Commit 8956bcd3 authored by pranay.kumar's avatar pranay.kumar Committed by Commit bot

Replace MessageLoopProxy usage with ThreadTaskRunnerHandle in components/policy module.

MessageLoopProxy is deprecated.
This basically does a search and replace:

MessageLoopProxy::current() -> ThreadTaskRunnerHandle::Get().

BUG=391045

Review URL: https://codereview.chromium.org/1130753002

Cr-Commit-Position: refs/heads/master@{#329386}
parent 43071fd2
......@@ -7,12 +7,13 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/prefs/pref_service.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_runner_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
......@@ -406,7 +407,7 @@ URLBlacklistManager::URLBlacklistManager(
io_task_runner_(io_task_runner),
segment_url_(segment_url),
override_blacklist_(override_blacklist),
ui_task_runner_(base::MessageLoopProxy::current()),
ui_task_runner_(base::ThreadTaskRunnerHandle::Get()),
blacklist_(new URLBlacklist(segment_url)),
ui_weak_ptr_factory_(this),
io_weak_ptr_factory_(this) {
......
......@@ -7,9 +7,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "components/policy/core/common/async_policy_loader.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/schema_registry.h"
......@@ -38,7 +38,7 @@ void AsyncPolicyProvider::Init(SchemaRegistry* registry) {
AsyncPolicyLoader::UpdateCallback callback =
base::Bind(&AsyncPolicyProvider::LoaderUpdateCallback,
base::MessageLoopProxy::current(),
base::ThreadTaskRunnerHandle::Get(),
weak_factory_.GetWeakPtr());
bool post = loader_->task_runner()->PostTask(
FROM_HERE,
......@@ -120,10 +120,10 @@ void AsyncPolicyProvider::OnLoaderReloaded(scoped_ptr<PolicyBundle> bundle) {
// static
void AsyncPolicyProvider::LoaderUpdateCallback(
scoped_refptr<base::MessageLoopProxy> loop,
scoped_refptr<base::SingleThreadTaskRunner> runner,
base::WeakPtr<AsyncPolicyProvider> weak_this,
scoped_ptr<PolicyBundle> bundle) {
loop->PostTask(FROM_HERE,
runner->PostTask(FROM_HERE,
base::Bind(&AsyncPolicyProvider::OnLoaderReloaded,
weak_this,
base::Passed(&bundle)));
......
......@@ -14,7 +14,7 @@
#include "components/policy/policy_export.h"
namespace base {
class MessageLoopProxy;
class SingleThreadTaskRunner;
}
namespace policy {
......@@ -50,11 +50,12 @@ class POLICY_EXPORT AsyncPolicyProvider : public ConfigurationPolicyProvider,
// Callback passed to the loader that it uses to pass back the current policy
// bundle to the provider. This is invoked on the background thread and
// forwards to OnLoaderReloaded() on the loop that owns the provider,
// forwards to OnLoaderReloaded() on the runner that owns the provider,
// if |weak_this| is still valid.
static void LoaderUpdateCallback(scoped_refptr<base::MessageLoopProxy> loop,
base::WeakPtr<AsyncPolicyProvider> weak_this,
scoped_ptr<PolicyBundle> bundle);
static void LoaderUpdateCallback(
scoped_refptr<base::SingleThreadTaskRunner> runner,
base::WeakPtr<AsyncPolicyProvider> weak_this,
scoped_ptr<PolicyBundle> bundle);
// The |loader_| that does the platform-specific policy loading. It lives
// on the background thread but is owned by |this|.
......
......@@ -8,6 +8,7 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "crypto/signature_verifier.h"
......@@ -191,13 +192,13 @@ void CloudPolicyValidatorBase::PostValidationTask(
// static
void CloudPolicyValidatorBase::PerformValidation(
scoped_ptr<CloudPolicyValidatorBase> self,
scoped_refptr<base::MessageLoopProxy> message_loop,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const base::Closure& completion_callback) {
// Run the validation activities on this thread.
self->RunValidation();
// Report completion on |message_loop|.
message_loop->PostTask(
// Report completion on |task_runner|.
task_runner->PostTask(
FROM_HERE,
base::Bind(&CloudPolicyValidatorBase::ReportCompletion,
base::Passed(&self),
......
......@@ -23,7 +23,7 @@
#endif
namespace base {
class MessageLoopProxy;
class SingleThreadTaskRunner;
}
namespace google {
......@@ -227,7 +227,7 @@ class POLICY_EXPORT CloudPolicyValidatorBase {
// Performs validation, called on a background thread.
static void PerformValidation(
scoped_ptr<CloudPolicyValidatorBase> self,
scoped_refptr<base::MessageLoopProxy> message_loop,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const base::Closure& completion_callback);
// Reports completion to the |completion_callback_|.
......
......@@ -7,9 +7,10 @@
#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_validator.h"
#include "components/policy/core/common/cloud/policy_builder.h"
......@@ -83,7 +84,7 @@ class CloudPolicyValidatorTest : public testing::Test {
public_key_bytes.size());
UserCloudPolicyValidator* validator = UserCloudPolicyValidator::Create(
policy_response.Pass(), base::MessageLoopProxy::current());
policy_response.Pass(), base::ThreadTaskRunnerHandle::Get());
validator->ValidateTimestamp(timestamp_, timestamp_,
timestamp_option_);
validator->ValidateUsername(PolicyBuilder::kFakeUsername, true);
......
......@@ -11,8 +11,9 @@
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h"
#include "components/policy/core/common/cloud/component_cloud_policy_store.h"
......@@ -252,7 +253,7 @@ ComponentCloudPolicyService::ComponentCloudPolicyService(
backend_.reset(
new Backend(weak_ptr_factory_.GetWeakPtr(),
backend_task_runner_,
base::MessageLoopProxy::current(),
base::ThreadTaskRunnerHandle::Get(),
cache.Pass(),
external_policy_data_fetcher_backend_->CreateFrontend(
backend_task_runner_)));
......
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