diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-09 17:01:54 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-09 17:01:54 +0000 |
commit | b9d1624fd67dacd86cf95a2279b42388defbf336 (patch) | |
tree | eab1f050d1237d0920e8420dadb9f8727b09430d /chrome/browser/net/cookie_policy_browsertest.cc | |
parent | 711aa65991f407a4873f76695636967a9cb34067 (diff) | |
download | chromium_src-b9d1624fd67dacd86cf95a2279b42388defbf336.zip chromium_src-b9d1624fd67dacd86cf95a2279b42388defbf336.tar.gz chromium_src-b9d1624fd67dacd86cf95a2279b42388defbf336.tar.bz2 |
Re-land http://codereview.chromium.org/7831056/ and http://codereview.chromium.org/7833042/ .
Finalize a CL originally by departed intern ycxiao@ that detaches the loading of cookies from the IO thread.
They are now loaded on the DB thread. Cookie operations received in the meantime are queued and executed, on the IO thread, in the order they were received, when loading completes.
A few straggler clients are updated to use the asynchronous CookieStore/CookieMonster API as part of this CL, as the synchronous API is removed.
This entire CL has been previously reviewed by the appropriate owners, however an error was made during the submit.
BUG=68657
TEST=net_unittests / DeferredCookieTaskTest.* and CookieMonsterTest.*
Review URL: http://codereview.chromium.org/7860039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/cookie_policy_browsertest.cc')
-rw-r--r-- | chrome/browser/net/cookie_policy_browsertest.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc index 251ae69..b242c5c 100644 --- a/chrome/browser/net/cookie_policy_browsertest.cc +++ b/chrome/browser/net/cookie_policy_browsertest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/task.h" #include "base/synchronization/waitable_event.h" #include "chrome/browser/content_settings/host_content_settings_map.h" @@ -29,10 +30,19 @@ class GetCookiesTask : public Task { cookies_(cookies) {} virtual void Run() { - *cookies_ = - context_getter_->GetURLRequestContext()->cookie_store()-> - GetCookies(url_); - event_->Signal(); + net::CookieOptions options; + context_getter_->GetURLRequestContext()->cookie_store() + ->GetCookiesWithOptionsAsync( + url_, options, base::Bind(&GetCookiesTask::GetCookiesCallback, + base::Unretained(cookies_), + base::Unretained(event_))); + } + + static void GetCookiesCallback(std::string* cookies_out, + base::WaitableEvent* event, + const std::string& cookies) { + *cookies_out = cookies; + event->Signal(); } private: |