OLD | NEW |
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 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // should match the sql query's projection name. | 129 // should match the sql query's projection name. |
130 // |statement| is query's statement which bound the variables. This class | 130 // |statement| is query's statement which bound the variables. This class |
131 // take the ownership of |statement|. | 131 // take the ownership of |statement|. |
132 SQLiteCursor(const std::vector<std::string>& column_names, | 132 SQLiteCursor(const std::vector<std::string>& column_names, |
133 history::AndroidStatement* statement, | 133 history::AndroidStatement* statement, |
134 AndroidHistoryProviderService* service, | 134 AndroidHistoryProviderService* service, |
135 FaviconService* favicon_service); | 135 FaviconService* favicon_service); |
136 | 136 |
137 virtual ~SQLiteCursor(); | 137 virtual ~SQLiteCursor(); |
138 | 138 |
| 139 // Destory SQLiteCursor object on UI thread. All cleanup need finish in UI |
| 140 // thread. |
| 141 void DestroyOnUIThread(); |
| 142 |
139 // This method is for testing only. | 143 // This method is for testing only. |
140 void set_test_observer(TestObserver* test_observer) { | 144 void set_test_observer(TestObserver* test_observer) { |
141 test_observer_ = test_observer; | 145 test_observer_ = test_observer; |
142 } | 146 } |
143 | 147 |
144 // Get Favicon from history backend. | 148 // Get Favicon from history backend. |
145 bool GetFavicon(chrome::FaviconID id, | 149 bool GetFavicon(chrome::FaviconID id, |
146 std::vector<unsigned char>* image_data); | 150 std::vector<unsigned char>* image_data); |
147 | 151 |
148 void GetFaviconForIDInUIThread( | 152 void GetFaviconForIDInUIThread( |
149 chrome::FaviconID id, | 153 chrome::FaviconID id, |
150 const FaviconService::FaviconRawCallback& callback); | 154 const FaviconService::FaviconRawCallback& callback); |
151 | 155 |
152 // The callback function of FaviconService::GetLargestRawFaviconForID(). | 156 // The callback function of FaviconService::GetLargestRawFaviconForID(). |
153 void OnFaviconData(const chrome::FaviconBitmapResult& bitmap_result); | 157 void OnFaviconData(const chrome::FaviconBitmapResult& bitmap_result); |
154 | 158 |
155 // The callback function of MoveTo(). | 159 // The callback function of MoveTo(). |
156 void OnMoved(AndroidHistoryProviderService::Handle handle, int pos); | 160 void OnMoved(AndroidHistoryProviderService::Handle handle, int pos); |
157 | 161 |
158 // Used to cancel all request on the UI thread during shutdown. | |
159 void CancelAllRequests(base::WaitableEvent* finished); | |
160 | |
161 JavaColumnType GetColumnTypeInternal(int column); | 162 JavaColumnType GetColumnTypeInternal(int column); |
162 | 163 |
163 // Runs the MoveStatement on UI thread. | 164 // Runs the MoveStatement on UI thread. |
164 void RunMoveStatementOnUIThread(int pos); | 165 void RunMoveStatementOnUIThread(int pos); |
165 | 166 |
166 // The current row position, '-1' means the position before the first one. | 167 // The current row position, '-1' means the position before the first one. |
167 int position_; | 168 int position_; |
168 | 169 |
169 base::WaitableEvent event_; | 170 base::WaitableEvent event_; |
170 | 171 |
(...skipping 16 matching lines...) Expand all Loading... |
187 | 188 |
188 // The favicon image. | 189 // The favicon image. |
189 chrome::FaviconBitmapResult favicon_bitmap_result_; | 190 chrome::FaviconBitmapResult favicon_bitmap_result_; |
190 | 191 |
191 TestObserver* test_observer_; | 192 TestObserver* test_observer_; |
192 | 193 |
193 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); | 194 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); |
194 }; | 195 }; |
195 | 196 |
196 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 197 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
OLD | NEW |