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

Side by Side Diff: components/webdata/common/web_data_service_base.h

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 2 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 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_
6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/ref_counted_delete_on_message_loop.h" 11 #include "base/memory/ref_counted_delete_on_task_runner.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "components/webdata/common/webdata_export.h" 13 #include "components/webdata/common/webdata_export.h"
14 #include "sql/init_status.h" 14 #include "sql/init_status.h"
15 15
16 class WebDatabase; 16 class WebDatabase;
17 class WebDatabaseService; 17 class WebDatabaseService;
18 class WebDatabaseTable; 18 class WebDatabaseTable;
19 19
20 namespace base { 20 namespace base {
21 class Thread; 21 class Thread;
22 class MessageLoopProxy;
22 } 23 }
23 24
24 // Base for WebDataService class hierarchy. 25 // Base for WebDataService class hierarchy.
25 // WebDataServiceBase is destroyed on the UI thread. 26 // WebDataServiceBase is destroyed on the UI thread.
26 class WEBDATA_EXPORT WebDataServiceBase 27 class WEBDATA_EXPORT WebDataServiceBase
27 : public base::RefCountedDeleteOnMessageLoop<WebDataServiceBase> { 28 : public base::RefCountedDeleteOnTaskRunner<WebDataServiceBase> {
28 public: 29 public:
29 // All requests return an opaque handle of the following type. 30 // All requests return an opaque handle of the following type.
30 typedef int Handle; 31 typedef int Handle;
31 32
32 // Users of this class may provide a callback to handle errors 33 // Users of this class may provide a callback to handle errors
33 // (e.g. by showing a UI). The callback is called only on error, and 34 // (e.g. by showing a UI). The callback is called only on error, and
34 // takes a single parameter, the sql::InitStatus value from trying 35 // takes a single parameter, the sql::InitStatus value from trying
35 // to open the database. 36 // to open the database.
36 // TODO(joi): Should we combine this with WebDatabaseService::InitCallback? 37 // TODO(joi): Should we combine this with WebDatabaseService::InitCallback?
37 typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback; 38 typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Returns true if the database load has completetd successfully, and 76 // Returns true if the database load has completetd successfully, and
76 // ShutdownOnUIThread has not yet been called. 77 // ShutdownOnUIThread has not yet been called.
77 virtual bool IsDatabaseLoaded(); 78 virtual bool IsDatabaseLoaded();
78 79
79 // Returns a pointer to the DB (used by SyncableServices). May return NULL if 80 // Returns a pointer to the DB (used by SyncableServices). May return NULL if
80 // the database is not loaded or otherwise unavailable. Must be called on 81 // the database is not loaded or otherwise unavailable. Must be called on
81 // DBThread. 82 // DBThread.
82 virtual WebDatabase* GetDatabase(); 83 virtual WebDatabase* GetDatabase();
83 84
84 protected: 85 protected:
85 friend class base::RefCountedDeleteOnMessageLoop<WebDataServiceBase>; 86 friend class base::RefCountedDeleteOnTaskRunner<WebDataServiceBase>;
86 friend class base::DeleteHelper<WebDataServiceBase>; 87 friend class base::DeleteHelper<WebDataServiceBase>;
87 88
88 virtual ~WebDataServiceBase(); 89 virtual ~WebDataServiceBase();
89 90
90 // Our database service. 91 // Our database service.
91 scoped_refptr<WebDatabaseService> wdbs_; 92 scoped_refptr<WebDatabaseService> wdbs_;
92 93
93 private: 94 private:
94 ProfileErrorCallback profile_error_callback_; 95 ProfileErrorCallback profile_error_callback_;
95 96
96 DISALLOW_COPY_AND_ASSIGN(WebDataServiceBase); 97 DISALLOW_COPY_AND_ASSIGN(WebDataServiceBase);
97 }; 98 };
98 99
99 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ 100 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_
OLDNEW
« no previous file with comments | « components/webdata/common/web_data_service_backend.cc ('k') | components/webdata/common/web_data_service_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698