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

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

Issue 12871006: Second try at splitting WebDataService (minus ownership changes) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix WIN paths 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Chromium settings and storage represent user-selected preferences and
6 // information and MUST not be extracted, overwritten or modified except
7 // through Chromium defined APIs.
8
9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
10 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
11
12 #include "base/basictypes.h"
13 #include "base/callback_forward.h"
14 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h"
16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "chrome/browser/api/webdata/web_data_service_base.h"
19 #include "chrome/browser/webdata/web_database.h"
20
21 class WebDatabaseServiceInternal;
22 class WebDataRequestManager;
23
24 namespace content {
25 class BrowserContext;
26 }
27
28 namespace tracked_objects {
29 class Location;
30 }
31
32 class WDTypedResult;
33 class WebDataServiceConsumer;
34
35
36 ////////////////////////////////////////////////////////////////////////////////
37 //
38 // WebDatabaseService defines the interface to a generic data repository
39 // responsible for controlling access to the web database (metadata associated
40 // with web pages).
41 //
42 ////////////////////////////////////////////////////////////////////////////////
43
44 class WebDatabaseService {
45 public:
46 typedef base::Callback<scoped_ptr<WDTypedResult>(WebDatabase*)> ReadTask;
47 typedef base::Callback<WebDatabase::State(WebDatabase*)> WriteTask;
48 typedef base::Callback<void(sql::InitStatus)> InitCallback;
49
50 // Retrieve a WebDatabaseService for the given context.
dhollowa 2013/03/15 18:56:21 What is this comment referencing?
Cait (Slow) 2013/03/15 20:43:59 Done.
51 //
52 // Can return NULL in some contexts.
53
54 // Takes the path to the WebDatabase file.
55 explicit WebDatabaseService(const base::FilePath& path);
56
57 virtual ~WebDatabaseService();
58
59 // Initializes the web database service. Takes a callback which will return
60 // the status of the DB after the init.
61 virtual void LoadDatabase(const InitCallback& callback);
62
63 // Unloads the database without actually shutting down the service. This can
64 // be used to temporarily reduce the browser process' memory footprint.
65 virtual void UnloadDatabase();
66
67 // Unloads database and will not reload.
68 virtual void ShutdownDatabase();
69
70 // Gets a ptr to the WebDatabase (owned by WebDatabaseService).
71 // TODO(caitkp): remove this method once SyncServices no longer depend on it.
72 virtual WebDatabase* GetDatabase() const;
73
74 // Schedule an update/write task on the DB thread.
75 virtual void ScheduleDBTask(
76 const tracked_objects::Location& from_here,
77 const WriteTask& task);
78
79 // Schedule a read task on the DB thread.
80 virtual WebDataServiceBase::Handle ScheduleDBTaskWithResult(
81 const tracked_objects::Location& from_here,
82 const ReadTask& task,
83 WebDataServiceConsumer* consumer);
84
85 // Cancel an existing request for a task on the DB thread.
86 // TODO(caitkp): Think about moving the definition of the Handle type to
87 // somewhere else.
88 virtual void CancelRequest(WebDataServiceBase::Handle h);
89
90 private:
91 base::FilePath path_;
92 scoped_refptr<WebDatabaseServiceInternal> wdbs_internal_;
dhollowa 2013/03/15 18:56:21 Please document ownership an lifetime of this inst
Cait (Slow) 2013/03/15 20:43:59 Done.
93
dhollowa 2013/03/15 18:56:21 nit: Remove empty line.
Cait (Slow) 2013/03/15 20:43:59 Done.
94 };
95
96 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698