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

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

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
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_message_loop.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 // TODO(skyostil): Migrate to SingleThreadTaskRunner (crbug.com/465354). 21 // TODO(skyostil): Migrate to SingleThreadTaskRunner (crbug.com/465354).
22 class MessageLoopProxy; 22 class SingleThreadTaskRunner;
23 class Thread; 23 class Thread;
24 } 24 }
25 25
26 // Base for WebDataService class hierarchy. 26 // Base for WebDataService class hierarchy.
27 // WebDataServiceBase is destroyed on the UI thread. 27 // WebDataServiceBase is destroyed on the UI thread.
28 class WEBDATA_EXPORT WebDataServiceBase 28 class WEBDATA_EXPORT WebDataServiceBase
29 : public base::RefCountedDeleteOnMessageLoop<WebDataServiceBase> { 29 : public base::RefCountedDeleteOnMessageLoop<WebDataServiceBase> {
30 public: 30 public:
31 // All requests return an opaque handle of the following type. 31 // All requests return an opaque handle of the following type.
32 typedef int Handle; 32 typedef int Handle;
33 33
34 // Users of this class may provide a callback to handle errors 34 // Users of this class may provide a callback to handle errors
35 // (e.g. by showing a UI). The callback is called only on error, and 35 // (e.g. by showing a UI). The callback is called only on error, and
36 // takes a single parameter, the sql::InitStatus value from trying 36 // takes a single parameter, the sql::InitStatus value from trying
37 // to open the database. 37 // to open the database.
38 // TODO(joi): Should we combine this with WebDatabaseService::InitCallback? 38 // TODO(joi): Should we combine this with WebDatabaseService::InitCallback?
39 typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback; 39 typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback;
40 40
41 typedef base::Closure DBLoadedCallback; 41 typedef base::Closure DBLoadedCallback;
42 42
43 // |callback| will only be invoked on error, and only if 43 // |callback| will only be invoked on error, and only if
44 // |callback.is_null()| evaluates to false. 44 // |callback.is_null()| evaluates to false.
45 // 45 //
46 // The ownership of |wdbs| is shared, with the primary owner being the 46 // The ownership of |wdbs| is shared, with the primary owner being the
47 // WebDataServiceWrapper, and secondary owners being subclasses of 47 // WebDataServiceWrapper, and secondary owners being subclasses of
48 // WebDataServiceBase, which receive |wdbs| upon construction. The 48 // WebDataServiceBase, which receive |wdbs| upon construction. The
49 // WebDataServiceWrapper handles the initializing and shutting down and of 49 // WebDataServiceWrapper handles the initializing and shutting down and of
50 // the |wdbs| object. 50 // the |wdbs| object.
51 // WebDataServiceBase is destroyed on |ui_thread|. 51 // WebDataServiceBase is destroyed on |ui_thread|.
52 WebDataServiceBase(scoped_refptr<WebDatabaseService> wdbs, 52 WebDataServiceBase(
53 const ProfileErrorCallback& callback, 53 scoped_refptr<WebDatabaseService> wdbs,
54 const scoped_refptr<base::MessageLoopProxy>& ui_thread); 54 const ProfileErrorCallback& callback,
55 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread);
55 56
56 // Cancel any pending request. You need to call this method if your 57 // Cancel any pending request. You need to call this method if your
57 // WebDataServiceConsumer is about to be deleted. 58 // WebDataServiceConsumer is about to be deleted.
58 virtual void CancelRequest(Handle h); 59 virtual void CancelRequest(Handle h);
59 60
60 // Shutdown the web data service. The service can no longer be used after this 61 // Shutdown the web data service. The service can no longer be used after this
61 // call. 62 // call.
62 virtual void ShutdownOnUIThread(); 63 virtual void ShutdownOnUIThread();
63 64
64 // Initializes the web data service. 65 // Initializes the web data service.
(...skipping 27 matching lines...) Expand all
92 // Our database service. 93 // Our database service.
93 scoped_refptr<WebDatabaseService> wdbs_; 94 scoped_refptr<WebDatabaseService> wdbs_;
94 95
95 private: 96 private:
96 ProfileErrorCallback profile_error_callback_; 97 ProfileErrorCallback profile_error_callback_;
97 98
98 DISALLOW_COPY_AND_ASSIGN(WebDataServiceBase); 99 DISALLOW_COPY_AND_ASSIGN(WebDataServiceBase);
99 }; 100 };
100 101
101 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_ 102 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_
OLDNEW
« no previous file with comments | « components/webdata/common/web_data_request_manager.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