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

Side by Side Diff: chrome/browser/net/sqlite_persistent_cookie_store.h

Issue 12314015: Make SQLitePersistentCookieStore run on injected SequencedTaskRunners vs named BrowserThreads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix perf tests. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // A sqlite implementation of a cookie monster persistent store. 5 // A sqlite implementation of a cookie monster persistent store.
6 6
7 #ifndef CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 7 #ifndef CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_
8 #define CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 8 #define CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "net/cookies/cookie_monster.h" 16 #include "net/cookies/cookie_monster.h"
17 17
18 class ClearOnExitPolicy; 18 class ClearOnExitPolicy;
19 class Task; 19 class Task;
20 20
21 namespace base { 21 namespace base {
22 class FilePath; 22 class FilePath;
23 class SequencedTaskRunner;
23 } 24 }
24 25
25 namespace net { 26 namespace net {
26 class CanonicalCookie; 27 class CanonicalCookie;
27 } 28 }
28 29
29 // Implements the PersistentCookieStore interface in terms of a SQLite database. 30 // Implements the PersistentCookieStore interface in terms of a SQLite database.
30 // For documentation about the actual member functions consult the documentation 31 // For documentation about the actual member functions consult the documentation
31 // of the parent class |net::CookieMonster::PersistentCookieStore|. 32 // of the parent class |net::CookieMonster::PersistentCookieStore|.
32 // If provided, a |ClearOnExitPolicy| is consulted when the SQLite database is 33 // If provided, a |ClearOnExitPolicy| is consulted when the SQLite database is
33 // closed to decide which cookies to keep. 34 // closed to decide which cookies to keep.
34 class SQLitePersistentCookieStore 35 class SQLitePersistentCookieStore
35 : public net::CookieMonster::PersistentCookieStore { 36 : public net::CookieMonster::PersistentCookieStore {
36 public: 37 public:
37 // If non-NULL, SQLitePersistentCookieStore will keep a scoped_refptr to the 38 // If non-NULL, SQLitePersistentCookieStore will keep a scoped_refptr to the
38 // |clear_on_exit_policy| throughout its lifetime. 39 // |clear_on_exit_policy| throughout its lifetime.
39 SQLitePersistentCookieStore( 40 SQLitePersistentCookieStore(
40 const base::FilePath& path, 41 const base::FilePath& path,
42 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
43 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
41 bool restore_old_session_cookies, 44 bool restore_old_session_cookies,
42 ClearOnExitPolicy* clear_on_exit_policy); 45 ClearOnExitPolicy* clear_on_exit_policy);
43 46
44 // net::CookieMonster::PersistentCookieStore: 47 // net::CookieMonster::PersistentCookieStore:
45 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; 48 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE;
46 virtual void LoadCookiesForKey(const std::string& key, 49 virtual void LoadCookiesForKey(const std::string& key,
47 const LoadedCallback& callback) OVERRIDE; 50 const LoadedCallback& callback) OVERRIDE;
48 virtual void AddCookie(const net::CanonicalCookie& cc) OVERRIDE; 51 virtual void AddCookie(const net::CanonicalCookie& cc) OVERRIDE;
49 virtual void UpdateCookieAccessTime(const net::CanonicalCookie& cc) OVERRIDE; 52 virtual void UpdateCookieAccessTime(const net::CanonicalCookie& cc) OVERRIDE;
50 virtual void DeleteCookie(const net::CanonicalCookie& cc) OVERRIDE; 53 virtual void DeleteCookie(const net::CanonicalCookie& cc) OVERRIDE;
51 virtual void SetForceKeepSessionState() OVERRIDE; 54 virtual void SetForceKeepSessionState() OVERRIDE;
52 virtual void Flush(const base::Closure& callback) OVERRIDE; 55 virtual void Flush(const base::Closure& callback) OVERRIDE;
53 56
54 protected: 57 protected:
55 virtual ~SQLitePersistentCookieStore(); 58 virtual ~SQLitePersistentCookieStore();
56 59
57 private: 60 private:
58 class Backend; 61 class Backend;
59 62
60 scoped_refptr<Backend> backend_; 63 scoped_refptr<Backend> backend_;
61 64
62 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore); 65 DISALLOW_COPY_AND_ASSIGN(SQLitePersistentCookieStore);
63 }; 66 };
64 67
65 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_ 68 #endif // CHROME_BROWSER_NET_SQLITE_PERSISTENT_COOKIE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698