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

Side by Side Diff: chrome/browser/history/android/sqlite_cursor.h

Issue 366133003: Change AndroidHistoryProviderService to use CancelableTaskTracker (3/6) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cancelable_task_tracker.3
Patch Set: Fix unit tests Created 6 years, 5 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 CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ 5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_
6 #define CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ 6 #define CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/task/cancelable_task_tracker.h" 17 #include "base/task/cancelable_task_tracker.h"
18 #include "chrome/browser/common/cancelable_request.h"
19 #include "chrome/browser/history/android/android_history_provider_service.h" 18 #include "chrome/browser/history/android/android_history_provider_service.h"
20 #include "chrome/browser/history/history_types.h" 19 #include "chrome/browser/history/history_types.h"
21 #include "components/favicon_base/favicon_callback.h" 20 #include "components/favicon_base/favicon_callback.h"
22 21
23 class FaviconService; 22 class FaviconService;
24 23
25 // This class is JNI implementation of 24 // This class is JNI implementation of
26 // org.chromium.chrome.database.SqliteCursor, it uses the AndroidStatement to 25 // org.chromium.chrome.database.SqliteCursor, it uses the AndroidStatement to
27 // iterate among the result rows. This is not thread safe, all methods should 26 // iterate among the result rows. This is not thread safe, all methods should
28 // be called from the same non-UI thread which typical is the Java thread. 27 // be called from the same non-UI thread which typical is the Java thread.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 std::vector<unsigned char>* image_data); 151 std::vector<unsigned char>* image_data);
153 152
154 void GetFaviconForIDInUIThread( 153 void GetFaviconForIDInUIThread(
155 favicon_base::FaviconID id, 154 favicon_base::FaviconID id,
156 const favicon_base::FaviconRawBitmapCallback& callback); 155 const favicon_base::FaviconRawBitmapCallback& callback);
157 156
158 // The callback function of FaviconService::GetLargestRawFaviconForID(). 157 // The callback function of FaviconService::GetLargestRawFaviconForID().
159 void OnFaviconData(const favicon_base::FaviconRawBitmapResult& bitmap_result); 158 void OnFaviconData(const favicon_base::FaviconRawBitmapResult& bitmap_result);
160 159
161 // The callback function of MoveTo(). 160 // The callback function of MoveTo().
162 void OnMoved(AndroidHistoryProviderService::Handle handle, int pos); 161 void OnMoved(int pos);
163 162
164 JavaColumnType GetColumnTypeInternal(int column); 163 JavaColumnType GetColumnTypeInternal(int column);
165 164
166 // Runs the MoveStatement on UI thread. 165 // Runs the MoveStatement on UI thread.
167 void RunMoveStatementOnUIThread(int pos); 166 void RunMoveStatementOnUIThread(int pos);
168 167
169 // The current row position, '-1' means the position before the first one. 168 // The current row position, '-1' means the position before the first one.
170 int position_; 169 int position_;
171 170
172 base::WaitableEvent event_; 171 base::WaitableEvent event_;
173 172
174 // The wrapped history::AndroidStatement. 173 // The wrapped history::AndroidStatement.
175 history::AndroidStatement* statement_; 174 history::AndroidStatement* statement_;
176 175
177 // Result set columns' name 176 // Result set columns' name
178 const std::vector<std::string> column_names_; 177 const std::vector<std::string> column_names_;
179 178
180 AndroidHistoryProviderService* service_; 179 AndroidHistoryProviderService* service_;
181 180
182 FaviconService* favicon_service_; 181 FaviconService* favicon_service_;
183 182
184 // Live on UI thread. 183 // Live on UI thread.
185 scoped_ptr<CancelableRequestConsumer> consumer_;
186 scoped_ptr<base::CancelableTaskTracker> tracker_; 184 scoped_ptr<base::CancelableTaskTracker> tracker_;
187 185
188 // The count of result rows. 186 // The count of result rows.
189 int count_; 187 int count_;
190 188
191 // The favicon image. 189 // The favicon image.
192 favicon_base::FaviconRawBitmapResult favicon_bitmap_result_; 190 favicon_base::FaviconRawBitmapResult favicon_bitmap_result_;
193 191
194 TestObserver* test_observer_; 192 TestObserver* test_observer_;
195 193
196 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); 194 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor);
197 }; 195 };
198 196
199 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ 197 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698