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

Side by Side Diff: chrome/browser/webdata/web_database_service.h

Issue 12897009: Autofill Webdata Split TRY ONLY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try again Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Chromium settings and storage represent user-selected preferences and 5 // Chromium settings and storage represent user-selected preferences and
6 // information and MUST not be extracted, overwritten or modified except 6 // information and MUST not be extracted, overwritten or modified except
7 // through Chromium defined APIs. 7 // through Chromium defined APIs.
8 8
9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ 9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
10 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ 10 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
(...skipping 23 matching lines...) Expand all
34 34
35 35
36 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
37 // 37 //
38 // WebDatabaseService defines the interface to a generic data repository 38 // WebDatabaseService defines the interface to a generic data repository
39 // responsible for controlling access to the web database (metadata associated 39 // responsible for controlling access to the web database (metadata associated
40 // with web pages). 40 // with web pages).
41 // 41 //
42 //////////////////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////////////////
43 43
44 class WebDatabaseService { 44 class WebDatabaseService
45 : public base::RefCountedThreadSafe<
46 WebDatabaseService,
47 content::BrowserThread::DeleteOnUIThread> {
45 public: 48 public:
46 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask; 49 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask;
47 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask; 50 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask;
48 typedef base::Callback<void(sql::InitStatus)> InitCallback; 51 typedef base::Callback<void(sql::InitStatus)> InitCallback;
49 52
50 // Takes the path to the WebDatabase file. 53 // Takes the path to the WebDatabase file.
51 explicit WebDatabaseService(const base::FilePath& path); 54 explicit WebDatabaseService(const base::FilePath& path);
52 55
53 virtual ~WebDatabaseService(); 56 // Adds |table| as a WebDatabaseTable that will participate in
57 // managing the database, transferring ownership. All calls to this
58 // method must be made before |LoadDatabase| is called.
59 virtual void AddTable(scoped_ptr<WebDatabaseTable> table);
54 60
55 // Initializes the web database service. Takes a callback which will return 61 // Initializes the web database service. Takes a callback which will return
56 // the status of the DB after the init. 62 // the status of the DB after the init.
57 virtual void LoadDatabase(const InitCallback& callback); 63 virtual void LoadDatabase(const InitCallback& callback);
58 64
59 // Unloads the database without actually shutting down the service. This can 65 // Unloads the database without actually shutting down the service. This can
60 // be used to temporarily reduce the browser process' memory footprint. 66 // be used to temporarily reduce the browser process' memory footprint.
61 virtual void UnloadDatabase(); 67 virtual void UnloadDatabase();
62 68
63 // Unloads database and will not reload. 69 // Unloads database and will not reload.
(...skipping 13 matching lines...) Expand all
77 const tracked_objects::Location& from_here, 83 const tracked_objects::Location& from_here,
78 const ReadTask& task, 84 const ReadTask& task,
79 WebDataServiceConsumer* consumer); 85 WebDataServiceConsumer* consumer);
80 86
81 // Cancel an existing request for a task on the DB thread. 87 // Cancel an existing request for a task on the DB thread.
82 // TODO(caitkp): Think about moving the definition of the Handle type to 88 // TODO(caitkp): Think about moving the definition of the Handle type to
83 // somewhere else. 89 // somewhere else.
84 virtual void CancelRequest(WebDataServiceBase::Handle h); 90 virtual void CancelRequest(WebDataServiceBase::Handle h);
85 91
86 private: 92 private:
93 friend struct content::BrowserThread::DeleteOnThread<
94 content::BrowserThread::UI>;
95 friend class base::DeleteHelper<WebDatabaseService>;
96
97 virtual ~WebDatabaseService();
98
87 base::FilePath path_; 99 base::FilePath path_;
88 100
89 // The primary owner is |WebDatabaseService| but is refcounted because 101 // The primary owner is |WebDatabaseService| but is refcounted because
90 // PostTask on DB thread may outlive us. 102 // PostTask on DB thread may outlive us.
91 scoped_refptr<WebDataServiceBackend> wds_backend_; 103 scoped_refptr<WebDataServiceBackend> wds_backend_;
92 }; 104 };
93 105
94 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ 106 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service_unittest.cc ('k') | chrome/browser/webdata/web_database_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698