summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/http_bridge.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 03:59:31 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 03:59:31 +0000
commitd85cf074f2186dbe1cf8a9db5d89a2b817ffb0e1 (patch)
treee03156e3142955f7cf637fe404a1ce2c6f7aaaf4 /chrome/browser/sync/glue/http_bridge.h
parent76a188be4e3ddc42c42beabfeeeb618b2adae11e (diff)
downloadchromium_src-d85cf074f2186dbe1cf8a9db5d89a2b817ffb0e1.zip
chromium_src-d85cf074f2186dbe1cf8a9db5d89a2b817ffb0e1.tar.gz
chromium_src-d85cf074f2186dbe1cf8a9db5d89a2b817ffb0e1.tar.bz2
Simplify threading in browser thread by making only ChromeThread deal with different thread lifetimes.The rest of the code doesn't get MessageLoop pointers since they're not thread-safe and instead just call PostTask on ChromeThread. If the target thread is not alive, then the task is simply deleted.In a followup change, I'll remove any remaining MessageLoop* caching. With this change, there's little to be gained by caching since no locks are involved if the target MessageLoop is guaranteed to outlive the current thread (inferred automatically by the order of the chrome_threads_ array).BUG=25354
Review URL: http://codereview.chromium.org/306032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue/http_bridge.h')
-rw-r--r--chrome/browser/sync/glue/http_bridge.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h
index 7e1d967..12500ec 100644
--- a/chrome/browser/sync/glue/http_bridge.h
+++ b/chrome/browser/sync/glue/http_bridge.h
@@ -97,7 +97,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
DISALLOW_COPY_AND_ASSIGN(RequestContextGetter);
};
- HttpBridge(RequestContextGetter* context, MessageLoop* io_loop);
+ HttpBridge(RequestContextGetter* context);
virtual ~HttpBridge();
// sync_api::HttpPostProvider implementation.
@@ -135,7 +135,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
private:
friend class ::HttpBridgeTest;
- // Called on the io_loop_ to issue the network request. The extra level
+ // Called on the IO loop to issue the network request. The extra level
// of indirection is so that the unit test can override this behavior but we
// still have a function to statically pass to PostTask.
void CallMakeAsynchronousPost() { MakeAsynchronousPost(); }
@@ -148,7 +148,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
// so we can block created_on_loop_ while the fetch is in progress.
// NOTE: This is not a scoped_ptr for a reason. It must be deleted on the same
// thread that created it, which isn't the same thread |this| gets deleted on.
- // We must manually delete url_poster_ on the io_loop_.
+ // We must manually delete url_poster_ on the IO loop.
URLFetcher* url_poster_;
// The message loop of the thread we were created on. This is the thread that
@@ -158,10 +158,6 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
// on network IO through curl_easy_perform.
MessageLoop* const created_on_loop_;
- // Member variable for the IO loop instead of asking ChromeThread directly,
- // done this way for testability.
- MessageLoop* const io_loop_;
-
// The URL to POST to.
GURL url_for_request_;
@@ -178,15 +174,10 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
std::string response_content_;
// A waitable event we use to provide blocking semantics to
- // MakeSynchronousPost. We block created_on_loop_ while the io_loop_ fetches
+ // MakeSynchronousPost. We block created_on_loop_ while the IO loop fetches
// network request.
base::WaitableEvent http_post_completed_;
- // This is here so that the unit test subclass can force our URLFetcher to
- // use the io_loop_ passed on construction for network requests, rather than
- // ChromeThread::IO's message loop (which won't exist in testing).
- bool use_io_loop_for_testing_;
-
DISALLOW_COPY_AND_ASSIGN(HttpBridge);
};