OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 public: | 45 public: |
46 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask; | 46 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask; |
47 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask; | 47 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask; |
48 typedef base::Callback<void(sql::InitStatus)> InitCallback; | 48 typedef base::Callback<void(sql::InitStatus)> InitCallback; |
49 | 49 |
50 // Takes the path to the WebDatabase file. | 50 // Takes the path to the WebDatabase file. |
51 explicit WebDatabaseService(const base::FilePath& path); | 51 explicit WebDatabaseService(const base::FilePath& path); |
52 | 52 |
53 virtual ~WebDatabaseService(); | 53 virtual ~WebDatabaseService(); |
54 | 54 |
| 55 // Adds |table| as a WebDatabaseTable that will participate in |
| 56 // managing the database, transferring ownership. All calls to this |
| 57 // method must be made before |LoadDatabase| is called. |
| 58 virtual void AddTable(scoped_ptr<WebDatabaseTable> table); |
| 59 |
55 // Initializes the web database service. Takes a callback which will return | 60 // Initializes the web database service. Takes a callback which will return |
56 // the status of the DB after the init. | 61 // the status of the DB after the init. |
57 virtual void LoadDatabase(const InitCallback& callback); | 62 virtual void LoadDatabase(const InitCallback& callback); |
58 | 63 |
59 // Unloads the database without actually shutting down the service. This can | 64 // Unloads the database without actually shutting down the service. This can |
60 // be used to temporarily reduce the browser process' memory footprint. | 65 // be used to temporarily reduce the browser process' memory footprint. |
61 virtual void UnloadDatabase(); | 66 virtual void UnloadDatabase(); |
62 | 67 |
63 // Unloads database and will not reload. | 68 // Unloads database and will not reload. |
64 virtual void ShutdownDatabase(); | 69 virtual void ShutdownDatabase(); |
(...skipping 20 matching lines...) Expand all Loading... |
85 | 90 |
86 private: | 91 private: |
87 base::FilePath path_; | 92 base::FilePath path_; |
88 | 93 |
89 // The primary owner is |WebDatabaseService| but is refcounted because | 94 // The primary owner is |WebDatabaseService| but is refcounted because |
90 // PostTask on DB thread may outlive us. | 95 // PostTask on DB thread may outlive us. |
91 scoped_refptr<WebDataServiceBackend> wds_backend_; | 96 scoped_refptr<WebDataServiceBackend> wds_backend_; |
92 }; | 97 }; |
93 | 98 |
94 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ | 99 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_ |
OLD | NEW |