Skip to content

Commit

Permalink
components: Remove use of MessageLoopProxy and deprecated MessageLoop…
Browse files Browse the repository at this point in the history
… APIs

This patch was mostly autogenerated with
https://codereview.chromium.org/1010073002/.

BUG=465354

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

Cr-Commit-Position: refs/heads/master@{#332440}
  • Loading branch information
skyostil authored and Commit bot committed Jun 2, 2015
1 parent 3f2a3ab commit b0daa01
Show file tree
Hide file tree
Showing 198 changed files with 999 additions and 1,080 deletions.
4 changes: 3 additions & 1 deletion components/audio_modem/audio_player_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include "components/audio_modem/audio_player.h"

#include "base/bind.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "components/audio_modem/audio_player_impl.h"
#include "components/audio_modem/public/audio_modem_types.h"
#include "components/audio_modem/test/random_samples.h"
Expand Down Expand Up @@ -52,7 +54,7 @@ class TestAudioOutputStream : public media::AudioOutputStream {
frames = callback_->OnMoreData(dest.get(), 0);
total_frames += frames;
// Send the samples given to us by the player to the gather callback.
caller_loop_->PostTask(
caller_loop_->task_runner()->PostTask(
FROM_HERE, base::Bind(gather_callback_, base::Passed(&dest), frames));
} while (frames && total_frames < max_frame_count_);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include "base/command_line.h"
#include "base/thread_task_runner_handle.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/wallet/real_pan_wallet_client.h"
#include "components/autofill/core/common/autofill_switches.h"
Expand All @@ -28,7 +29,7 @@ class RealPanWalletClientTest : public testing::Test,
switches::kWalletServiceUseSandbox, "0");

request_context_ = new net::TestURLRequestContextGetter(
base::MessageLoopProxy::current());
base::ThreadTaskRunnerHandle::Get());
token_service_.reset(new FakeOAuth2TokenService());
identity_provider_.reset(new FakeIdentityProvider(token_service_.get()));
client_.reset(new RealPanWalletClient(request_context_.get(), this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/histogram_tester.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/autofill/content/browser/wallet/full_wallet.h"
#include "components/autofill/content/browser/wallet/instrument.h"
Expand Down Expand Up @@ -708,7 +708,7 @@ class WalletClientTest : public testing::Test {
public:
WalletClientTest()
: request_context_(new net::TestURLRequestContextGetter(
base::MessageLoopProxy::current())) {}
base::ThreadTaskRunnerHandle::Get())) {}
~WalletClientTest() override {}

void SetUp() override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "components/autofill/content/browser/wallet/wallet_service_url.h"
#include "components/autofill/content/browser/wallet/wallet_signin_helper_delegate.h"
#include "content/public/browser/cookie_store_factory.h"
Expand Down Expand Up @@ -51,7 +51,7 @@ class WalletSigninHelperTest : public testing::Test {
protected:
WalletSigninHelperTest()
: request_context_(new net::TestURLRequestContextGetter(
base::MessageLoopProxy::current())) {}
base::ThreadTaskRunnerHandle::Get())) {}
~WalletSigninHelperTest() override {}

void SetUp() override {
Expand Down
12 changes: 6 additions & 6 deletions components/autofill/content/renderer/autofill_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "components/autofill/content/common/autofill_messages.h"
#include "components/autofill/content/renderer/form_autofill_util.h"
Expand Down Expand Up @@ -395,11 +397,9 @@ void AutofillAgent::textFieldDidChange(const WebFormControlElement& element) {
// properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976) and
// it is needed to trigger autofill.
weak_ptr_factory_.InvalidateWeakPtrs();
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&AutofillAgent::TextFieldDidChangeImpl,
weak_ptr_factory_.GetWeakPtr(),
element));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&AutofillAgent::TextFieldDidChangeImpl,
weak_ptr_factory_.GetWeakPtr(), element));
}

void AutofillAgent::TextFieldDidChangeImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#include <vector>

#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/prefs/pref_service.h"
#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/thread_task_runner_handle.h"
#include "components/autofill/core/browser/autocomplete_history_manager.h"
#include "components/autofill/core/browser/autofill_external_delegate.h"
#include "components/autofill/core/browser/autofill_manager.h"
Expand All @@ -34,8 +34,8 @@ namespace {
class MockWebDataService : public AutofillWebDataService {
public:
MockWebDataService()
: AutofillWebDataService(base::MessageLoopProxy::current(),
base::MessageLoopProxy::current()) {}
: AutofillWebDataService(base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get()) {}

MOCK_METHOD1(AddFormFields, void(const std::vector<FormFieldData>&));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include <list>

#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/histogram_tester.h"
#include "base/test/test_timeouts.h"
#include "base/thread_task_runner_handle.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
Expand Down Expand Up @@ -60,7 +60,7 @@ class AutofillDownloadTest : public AutofillDownloadManager::Observer,
AutofillDownloadTest()
: prefs_(test::PrefServiceForTesting()),
request_context_(new net::TestURLRequestContextGetter(
base::MessageLoopProxy::current())),
base::ThreadTaskRunnerHandle::Get())),
download_manager_(&driver_, prefs_.get(), this) {
driver_.SetURLRequestContext(request_context_.get());
}
Expand Down
6 changes: 3 additions & 3 deletions components/autofill/core/browser/autofill_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_service.h"
#include "base/run_loop.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "components/autofill/core/browser/autocomplete_history_manager.h"
#include "components/autofill/core/browser/autofill_manager.h"
Expand Down Expand Up @@ -641,8 +641,8 @@ class AutofillManagerTest : public testing::Test {
personal_data_.set_database(autofill_client_.GetDatabase());
personal_data_.SetPrefService(autofill_client_.GetPrefs());
autofill_driver_.reset(new MockAutofillDriver());
request_context_ =
new net::TestURLRequestContextGetter(base::MessageLoopProxy::current());
request_context_ = new net::TestURLRequestContextGetter(
base::ThreadTaskRunnerHandle::Get());
autofill_driver_->SetURLRequestContext(request_context_.get());
autofill_manager_.reset(new TestAutofillManager(
autofill_driver_.get(), &autofill_client_, &personal_data_));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "base/files/scoped_temp_dir.h"
#include "base/guid.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/thread_task_runner_handle.h"
#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
Expand Down Expand Up @@ -95,9 +95,9 @@ class PersonalDataManagerTest : public testing::Test {
prefs_ = test::PrefServiceForTesting();
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB");
web_database_ = new WebDatabaseService(path,
base::MessageLoopProxy::current(),
base::MessageLoopProxy::current());
web_database_ =
new WebDatabaseService(path, base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get());

// Setup account tracker.
signin_client_.reset(new TestSigninClient(prefs_.get()));
Expand All @@ -110,11 +110,10 @@ class PersonalDataManagerTest : public testing::Test {
autofill_table_ = new AutofillTable("en-US");
web_database_->AddTable(scoped_ptr<WebDatabaseTable>(autofill_table_));
web_database_->LoadDatabase();
autofill_database_service_ =
new AutofillWebDataService(web_database_,
base::MessageLoopProxy::current(),
base::MessageLoopProxy::current(),
WebDataServiceBase::ProfileErrorCallback());
autofill_database_service_ = new AutofillWebDataService(
web_database_, base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get(),
WebDataServiceBase::ProfileErrorCallback());
autofill_database_service_->Init();

test::DisableSystemServices(prefs_.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include "components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h"

#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_profile.h"
Expand All @@ -26,8 +27,8 @@ namespace autofill {

AutofillWebDataBackendImpl::AutofillWebDataBackendImpl(
scoped_refptr<WebDatabaseBackend> web_database_backend,
scoped_refptr<base::MessageLoopProxy> ui_thread,
scoped_refptr<base::MessageLoopProxy> db_thread,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread,
const base::Closure& on_changed_callback)
: base::RefCountedDeleteOnMessageLoop<AutofillWebDataBackendImpl>(
db_thread),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "components/webdata/common/web_database.h"

namespace base {
class MessageLoopProxy;
class SingleThreadTaskRunner;
}

class WebDatabaseBackend;
Expand Down Expand Up @@ -48,8 +48,8 @@ class AutofillWebDataBackendImpl
// times).
AutofillWebDataBackendImpl(
scoped_refptr<WebDatabaseBackend> web_database_backend,
scoped_refptr<base::MessageLoopProxy> ui_thread,
scoped_refptr<base::MessageLoopProxy> db_thread,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread,
const base::Closure& on_changed_callback);

// AutofillWebDataBackend implementation.
Expand Down Expand Up @@ -187,11 +187,11 @@ class AutofillWebDataBackendImpl
DISALLOW_COPY_AND_ASSIGN(SupportsUserDataAggregatable);
};

// The MessageLoopProxy that this class uses as its UI thread.
scoped_refptr<base::MessageLoopProxy> ui_thread_;
// The task runner that this class uses as its UI thread.
scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;

// The MessageLoopProxy that this class uses as its DB thread.
scoped_refptr<base::MessageLoopProxy> db_thread_;
// The task runner that this class uses as its DB thread.
scoped_refptr<base::SingleThreadTaskRunner> db_thread_;

// Storage for user data to be accessed only on the DB thread. May
// be used e.g. for SyncableService subclasses that need to be owned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"

#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_profile.h"
Expand All @@ -27,15 +28,14 @@ namespace autofill {

AutofillWebDataService::AutofillWebDataService(
scoped_refptr<WebDatabaseService> wdbs,
scoped_refptr<base::MessageLoopProxy> ui_thread,
scoped_refptr<base::MessageLoopProxy> db_thread,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread,
const ProfileErrorCallback& callback)
: WebDataServiceBase(wdbs, callback, ui_thread),
ui_thread_(ui_thread),
db_thread_(db_thread),
autofill_backend_(NULL),
weak_ptr_factory_(this) {

base::Closure on_changed_callback = Bind(
&AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread,
weak_ptr_factory_.GetWeakPtr());
Expand All @@ -45,16 +45,17 @@ AutofillWebDataService::AutofillWebDataService(
}

AutofillWebDataService::AutofillWebDataService(
scoped_refptr<base::MessageLoopProxy> ui_thread,
scoped_refptr<base::MessageLoopProxy> db_thread)
: WebDataServiceBase(NULL, WebDataServiceBase::ProfileErrorCallback(),
ui_thread),
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread)
: WebDataServiceBase(NULL,
WebDataServiceBase::ProfileErrorCallback(),
ui_thread),
ui_thread_(ui_thread),
db_thread_(db_thread),
autofill_backend_(new AutofillWebDataBackendImpl(NULL,
ui_thread_,
db_thread_,
base::Closure())),
ui_thread_,
db_thread_,
base::Closure())),
weak_ptr_factory_(this) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class WebDatabaseService;

namespace base {
class MessageLoopProxy;
class SingleThreadTaskRunner;
}

namespace autofill {
Expand All @@ -39,11 +39,11 @@ class CreditCard;
class AutofillWebDataService : public AutofillWebData,
public WebDataServiceBase {
public:
AutofillWebDataService(scoped_refptr<base::MessageLoopProxy> ui_thread,
scoped_refptr<base::MessageLoopProxy> db_thread);
AutofillWebDataService(scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread);
AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs,
scoped_refptr<base::MessageLoopProxy> ui_thread,
scoped_refptr<base::MessageLoopProxy> db_thread,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread,
const ProfileErrorCallback& callback);

// WebDataServiceBase implementation.
Expand Down Expand Up @@ -132,11 +132,11 @@ class AutofillWebDataService : public AutofillWebData,
private:
ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_;

// The MessageLoopProxy that this class uses as its UI thread.
scoped_refptr<base::MessageLoopProxy> ui_thread_;
// The task runner that this class uses as its UI thread.
scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;

// The MessageLoopProxy that this class uses as its DB thread.
scoped_refptr<base::MessageLoopProxy> db_thread_;
// The task runner that this class uses as its DB thread.
scoped_refptr<base::SingleThreadTaskRunner> db_thread_;

scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_;

Expand Down
Loading

0 comments on commit b0daa01

Please sign in to comment.