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

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

Issue 11783091: Remove GenericRequest templates from WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix WIN error Created 7 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // 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_DATA_REQUEST_MANAGER_H__ 9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_REQUEST_MANAGER_H__
10 #define CHROME_BROWSER_WEBDATA_WEB_DATA_REQUEST_MANAGER_H__ 10 #define CHROME_BROWSER_WEBDATA_WEB_DATA_REQUEST_MANAGER_H__
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // The originator of the service request. 76 // The originator of the service request.
77 WebDataServiceConsumer* consumer_; 77 WebDataServiceConsumer* consumer_;
78 78
79 WDTypedResult* result_; 79 WDTypedResult* result_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(WebDataRequest); 81 DISALLOW_COPY_AND_ASSIGN(WebDataRequest);
82 }; 82 };
83 83
84 ////////////////////////////////////////////////////////////////////////////// 84 //////////////////////////////////////////////////////////////////////////////
85 // 85 //
86 // Webdata request templates
87 //
88 // Internally we use instances of the following template to represent
89 // requests.
90 //////////////////////////////////////////////////////////////////////////////
91
92 template <class T>
93 class GenericRequest : public WebDataRequest {
94 public:
95 GenericRequest(WebDataService* service,
96 WebDataServiceConsumer* consumer,
97 WebDataRequestManager* manager,
98 const T& arg)
99 : WebDataRequest(service, consumer, manager),
100 arg_(arg) {
101 }
102
103 virtual ~GenericRequest() {
104 }
105
106 const T& arg() const { return arg_; }
107
108 private:
109 T arg_;
110 };
111
112 template <class T, class U>
113 class GenericRequest2 : public WebDataRequest {
114 public:
115 GenericRequest2(WebDataService* service,
116 WebDataServiceConsumer* consumer,
117 WebDataRequestManager* manager,
118 const T& arg1,
119 const U& arg2)
120 : WebDataRequest(service, consumer, manager),
121 arg1_(arg1),
122 arg2_(arg2) {
123 }
124
125 virtual ~GenericRequest2() { }
126
127 const T& arg1() const { return arg1_; }
128
129 const U& arg2() const { return arg2_; }
130
131 private:
132 T arg1_;
133 U arg2_;
134 };
135
136 //////////////////////////////////////////////////////////////////////////////
137 //
138 // Webdata Request Manager 86 // Webdata Request Manager
139 // 87 //
140 // Tracks all WebDataRequests for a WebDataService. 88 // Tracks all WebDataRequests for a WebDataService.
141 // 89 //
142 // Note: This is an internal interface, not to be used outside of webdata/ 90 // Note: This is an internal interface, not to be used outside of webdata/
143 ////////////////////////////////////////////////////////////////////////////// 91 //////////////////////////////////////////////////////////////////////////////
144 class WebDataRequestManager { 92 class WebDataRequestManager {
145 public: 93 public:
146 WebDataRequestManager(); 94 WebDataRequestManager();
147 95
(...skipping 18 matching lines...) Expand all
166 // Next handle to be used for requests. Incremented for each use. 114 // Next handle to be used for requests. Incremented for each use.
167 WebDataServiceBase::Handle next_request_handle_; 115 WebDataServiceBase::Handle next_request_handle_;
168 116
169 typedef std::map<WebDataServiceBase::Handle, WebDataRequest*> RequestMap; 117 typedef std::map<WebDataServiceBase::Handle, WebDataRequest*> RequestMap;
170 RequestMap pending_requests_; 118 RequestMap pending_requests_;
171 119
172 DISALLOW_COPY_AND_ASSIGN(WebDataRequestManager); 120 DISALLOW_COPY_AND_ASSIGN(WebDataRequestManager);
173 }; 121 };
174 122
175 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_REQUEST_MANAGER_H__ 123 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_REQUEST_MANAGER_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/webdata/web_data_service.h » ('j') | chrome/browser/webdata/web_data_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698