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

Unified Diff: sync/internal_api/http_bridge.cc

Issue 2083713002: Remove calls to MessageLoop::current() in sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self-review Created 4 years, 6 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 | sync/internal_api/http_bridge_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/http_bridge.cc
diff --git a/sync/internal_api/http_bridge.cc b/sync/internal_api/http_bridge.cc
index 24e8413fedfa427a5bd04f37159a2c50a5685a7b..87884c55373f015673415d68cbe0c7587bbecbfa 100644
--- a/sync/internal_api/http_bridge.cc
+++ b/sync/internal_api/http_bridge.cc
@@ -11,7 +11,6 @@
#include "base/bit_cast.h"
#include "base/location.h"
-#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/single_thread_task_runner.h"
@@ -131,8 +130,7 @@ HttpBridge::HttpBridge(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
const NetworkTimeUpdateCallback& network_time_update_callback,
const BindToTrackerCallback& bind_to_tracker_callback)
- : created_on_loop_(base::MessageLoop::current()),
- user_agent_(user_agent),
+ : user_agent_(user_agent),
http_post_completed_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED),
request_context_getter_(context_getter),
@@ -151,7 +149,7 @@ void HttpBridge::SetExtraRequestHeaders(const char * headers) {
void HttpBridge::SetURL(const char* url, int port) {
#if DCHECK_IS_ON()
- DCHECK_EQ(base::MessageLoop::current(), created_on_loop_);
+ DCHECK(thread_checker_.CalledOnValidThread());
{
base::AutoLock lock(fetch_state_lock_);
DCHECK(!fetch_state_.request_completed);
@@ -170,7 +168,7 @@ void HttpBridge::SetPostPayload(const char* content_type,
int content_length,
const char* content) {
#if DCHECK_IS_ON()
- DCHECK_EQ(base::MessageLoop::current(), created_on_loop_);
+ DCHECK(thread_checker_.CalledOnValidThread());
{
base::AutoLock lock(fetch_state_lock_);
DCHECK(!fetch_state_.request_completed);
@@ -191,7 +189,7 @@ void HttpBridge::SetPostPayload(const char* content_type,
bool HttpBridge::MakeSynchronousPost(int* error_code, int* response_code) {
#if DCHECK_IS_ON()
- DCHECK_EQ(base::MessageLoop::current(), created_on_loop_);
+ DCHECK(thread_checker_.CalledOnValidThread());
{
base::AutoLock lock(fetch_state_lock_);
DCHECK(!fetch_state_.request_completed);
@@ -260,14 +258,14 @@ void HttpBridge::MakeAsynchronousPost() {
}
int HttpBridge::GetResponseContentLength() const {
- DCHECK_EQ(base::MessageLoop::current(), created_on_loop_);
+ DCHECK(thread_checker_.CalledOnValidThread());
base::AutoLock lock(fetch_state_lock_);
DCHECK(fetch_state_.request_completed);
return fetch_state_.response_content.size();
}
const char* HttpBridge::GetResponseContent() const {
- DCHECK_EQ(base::MessageLoop::current(), created_on_loop_);
+ DCHECK(thread_checker_.CalledOnValidThread());
base::AutoLock lock(fetch_state_lock_);
DCHECK(fetch_state_.request_completed);
return fetch_state_.response_content.data();
@@ -275,8 +273,7 @@ const char* HttpBridge::GetResponseContent() const {
const std::string HttpBridge::GetResponseHeaderValue(
const std::string& name) const {
-
- DCHECK_EQ(base::MessageLoop::current(), created_on_loop_);
+ DCHECK(thread_checker_.CalledOnValidThread());
base::AutoLock lock(fetch_state_lock_);
DCHECK(fetch_state_.request_completed);
« no previous file with comments | « no previous file | sync/internal_api/http_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698