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

Side by Side Diff: android_webview/browser/net/aw_cookie_store_wrapper.cc

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: merge Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/browser/net/aw_cookie_store_wrapper.h" 5 #include "android_webview/browser/net/aw_cookie_store_wrapper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "android_webview/browser/net/init_native_callback.h" 9 #include "android_webview/browser/net/init_native_callback.h"
10 #include "base/memory/ref_counted_delete_on_message_loop.h" 10 #include "base/memory/ref_counted_delete_on_message_loop.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void SetForceKeepSessionStateOnCookieThread() { 188 void SetForceKeepSessionStateOnCookieThread() {
189 GetCookieStore()->SetForceKeepSessionState(); 189 GetCookieStore()->SetForceKeepSessionState();
190 } 190 }
191 191
192 } // namespace 192 } // namespace
193 193
194 AwCookieStoreWrapper::AwCookieStoreWrapper() 194 AwCookieStoreWrapper::AwCookieStoreWrapper()
195 : client_task_runner_(base::ThreadTaskRunnerHandle::Get()), 195 : client_task_runner_(base::ThreadTaskRunnerHandle::Get()),
196 weak_factory_(this) {} 196 weak_factory_(this) {}
197 197
198 AwCookieStoreWrapper::~AwCookieStoreWrapper() {}
199
198 void AwCookieStoreWrapper::SetCookieWithOptionsAsync( 200 void AwCookieStoreWrapper::SetCookieWithOptionsAsync(
199 const GURL& url, 201 const GURL& url,
200 const std::string& cookie_line, 202 const std::string& cookie_line,
201 const net::CookieOptions& options, 203 const net::CookieOptions& options,
202 const net::CookieStore::SetCookiesCallback& callback) { 204 const net::CookieStore::SetCookiesCallback& callback) {
203 DCHECK(client_task_runner_->RunsTasksOnCurrentThread()); 205 DCHECK(client_task_runner_->RunsTasksOnCurrentThread());
204 PostTaskToCookieStoreTaskRunner( 206 PostTaskToCookieStoreTaskRunner(
205 base::Bind(&SetCookieWithOptionsAsyncOnCookieThread, url, cookie_line, 207 base::Bind(&SetCookieWithOptionsAsyncOnCookieThread, url, cookie_line,
206 options, CreateWrappedCallback<bool>(callback))); 208 options, CreateWrappedCallback<bool>(callback)));
207 } 209 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // The SubscriptionWrapper is owned by the subscription itself, and has no 328 // The SubscriptionWrapper is owned by the subscription itself, and has no
327 // connection to the AwCookieStoreWrapper after creation. Other CookieStore 329 // connection to the AwCookieStoreWrapper after creation. Other CookieStore
328 // implementations DCHECK if a subscription outlasts the cookie store, 330 // implementations DCHECK if a subscription outlasts the cookie store,
329 // unfortunately, this design makes DCHECKing if there's an outstanding 331 // unfortunately, this design makes DCHECKing if there's an outstanding
330 // subscription when the AwCookieStoreWrapper is destroyed a bit ugly. 332 // subscription when the AwCookieStoreWrapper is destroyed a bit ugly.
331 // TODO(mmenke): Still worth adding a DCHECK? 333 // TODO(mmenke): Still worth adding a DCHECK?
332 SubscriptionWrapper* subscription = new SubscriptionWrapper(); 334 SubscriptionWrapper* subscription = new SubscriptionWrapper();
333 return subscription->Subscribe(url, name, callback); 335 return subscription->Subscribe(url, name, callback);
334 } 336 }
335 337
336 AwCookieStoreWrapper::~AwCookieStoreWrapper() {}
337
338 base::Closure AwCookieStoreWrapper::CreateWrappedClosureCallback( 338 base::Closure AwCookieStoreWrapper::CreateWrappedClosureCallback(
339 const base::Closure& callback) { 339 const base::Closure& callback) {
340 if (callback.is_null()) 340 if (callback.is_null())
341 return callback; 341 return callback;
342 return base::Bind(base::IgnoreResult(&base::TaskRunner::PostTask), 342 return base::Bind(base::IgnoreResult(&base::TaskRunner::PostTask),
343 client_task_runner_, FROM_HERE, 343 client_task_runner_, FROM_HERE,
344 base::Bind(&AwCookieStoreWrapper::RunClosureCallback, 344 base::Bind(&AwCookieStoreWrapper::RunClosureCallback,
345 weak_factory_.GetWeakPtr(), callback)); 345 weak_factory_.GetWeakPtr(), callback));
346 } 346 }
347 347
348 void AwCookieStoreWrapper::RunClosureCallback(const base::Closure& callback) { 348 void AwCookieStoreWrapper::RunClosureCallback(const base::Closure& callback) {
349 DCHECK(client_task_runner_->RunsTasksOnCurrentThread()); 349 DCHECK(client_task_runner_->RunsTasksOnCurrentThread());
350 callback.Run(); 350 callback.Run();
351 } 351 }
352 352
353 } // namespace android_webview 353 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/net/aw_cookie_store_wrapper.h ('k') | android_webview/browser/net/aw_cookie_store_wrapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698