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

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

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
« no previous file with comments | « no previous file | android_webview/browser/net/aw_cookie_store_wrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 17 matching lines...) Expand all
28 // CookieManager when it's needed, allowing for lazy creation of the 28 // CookieManager when it's needed, allowing for lazy creation of the
29 // CookieStore. 29 // CookieStore.
30 // 30 //
31 // AwCookieStoreWrapper may only be called from the thread on which it's 31 // AwCookieStoreWrapper may only be called from the thread on which it's
32 // created. 32 // created.
33 // 33 //
34 // The CookieManager must outlive the AwCookieStoreWrapper. 34 // The CookieManager must outlive the AwCookieStoreWrapper.
35 class AwCookieStoreWrapper : public net::CookieStore { 35 class AwCookieStoreWrapper : public net::CookieStore {
36 public: 36 public:
37 AwCookieStoreWrapper(); 37 AwCookieStoreWrapper();
38 ~AwCookieStoreWrapper() override;
38 39
39 // CookieStore implementation: 40 // CookieStore implementation:
40 void SetCookieWithOptionsAsync(const GURL& url, 41 void SetCookieWithOptionsAsync(const GURL& url,
41 const std::string& cookie_line, 42 const std::string& cookie_line,
42 const net::CookieOptions& options, 43 const net::CookieOptions& options,
43 const SetCookiesCallback& callback) override; 44 const SetCookiesCallback& callback) override;
44 void SetCookieWithDetailsAsync(const GURL& url, 45 void SetCookieWithDetailsAsync(const GURL& url,
45 const std::string& name, 46 const std::string& name,
46 const std::string& value, 47 const std::string& value,
47 const std::string& domain, 48 const std::string& domain,
(...skipping 30 matching lines...) Expand all
78 const DeleteCallback& callback) override; 79 const DeleteCallback& callback) override;
79 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override; 80 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
80 void FlushStore(const base::Closure& callback) override; 81 void FlushStore(const base::Closure& callback) override;
81 void SetForceKeepSessionState() override; 82 void SetForceKeepSessionState() override;
82 scoped_ptr<CookieChangedSubscription> AddCallbackForCookie( 83 scoped_ptr<CookieChangedSubscription> AddCallbackForCookie(
83 const GURL& url, 84 const GURL& url,
84 const std::string& name, 85 const std::string& name,
85 const CookieChangedCallback& callback) override; 86 const CookieChangedCallback& callback) override;
86 87
87 private: 88 private:
88 ~AwCookieStoreWrapper() override;
89
90 // Used by CreateWrappedCallback below. Takes an arugment of Type and posts 89 // Used by CreateWrappedCallback below. Takes an arugment of Type and posts
91 // a task to |task_runner| to invoke |callback| with that argument. If 90 // a task to |task_runner| to invoke |callback| with that argument. If
92 // |weak_cookie_store| is deleted before the task is run, the task will not 91 // |weak_cookie_store| is deleted before the task is run, the task will not
93 // be run. 92 // be run.
94 template <class Type> 93 template <class Type>
95 static void RunCallbackOnClientThread( 94 static void RunCallbackOnClientThread(
96 base::TaskRunner* task_runner, 95 base::TaskRunner* task_runner,
97 base::WeakPtr<AwCookieStoreWrapper> weak_cookie_store, 96 base::WeakPtr<AwCookieStoreWrapper> weak_cookie_store,
98 base::Callback<void(Type)> callback, 97 base::Callback<void(Type)> callback,
99 Type argument) { 98 Type argument) {
(...skipping 22 matching lines...) Expand all
122 // Runs |callback|. Used to prevent callbacks from being invoked after the 121 // Runs |callback|. Used to prevent callbacks from being invoked after the
123 // AwCookieStoreWrapper has been destroyed. 122 // AwCookieStoreWrapper has been destroyed.
124 void RunClosureCallback(const base::Closure& callback); 123 void RunClosureCallback(const base::Closure& callback);
125 124
126 scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_; 125 scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_;
127 126
128 base::WeakPtrFactory<AwCookieStoreWrapper> weak_factory_; 127 base::WeakPtrFactory<AwCookieStoreWrapper> weak_factory_;
129 }; 128 };
130 129
131 } // namesspace android_webview 130 } // namesspace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/net/aw_cookie_store_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698