| 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 #include "chrome/browser/history/android/sqlite_cursor.h" | 5 #include "chrome/browser/history/android/sqlite_cursor.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 ScopedJavaLocalRef<jobject> SQLiteCursor::NewJavaSqliteCursor( | 50 ScopedJavaLocalRef<jobject> SQLiteCursor::NewJavaSqliteCursor( |
| 51 JNIEnv* env, | 51 JNIEnv* env, |
| 52 const std::vector<std::string>& column_names, | 52 const std::vector<std::string>& column_names, |
| 53 history::AndroidStatement* statement, | 53 history::AndroidStatement* statement, |
| 54 AndroidHistoryProviderService* service, | 54 AndroidHistoryProviderService* service, |
| 55 FaviconService* favicon_service) { | 55 FaviconService* favicon_service) { |
| 56 SQLiteCursor* cursor = new SQLiteCursor(column_names, statement, service, | 56 SQLiteCursor* cursor = new SQLiteCursor(column_names, statement, service, |
| 57 favicon_service); | 57 favicon_service); |
| 58 return Java_SQLiteCursor_create(env, reinterpret_cast<jint>(cursor)); | 58 return Java_SQLiteCursor_create(env, reinterpret_cast<intptr_t>(cursor)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool SQLiteCursor::RegisterSqliteCursor(JNIEnv* env) { | 61 bool SQLiteCursor::RegisterSqliteCursor(JNIEnv* env) { |
| 62 return RegisterNativesImpl(env); | 62 return RegisterNativesImpl(env); |
| 63 } | 63 } |
| 64 | 64 |
| 65 jint SQLiteCursor::GetCount(JNIEnv* env, jobject obj) { | 65 jint SQLiteCursor::GetCount(JNIEnv* env, jobject obj) { |
| 66 // Moves to maxium possible position so we will reach the last row, then finds | 66 // Moves to maxium possible position so we will reach the last row, then finds |
| 67 // out the total number of rows. | 67 // out the total number of rows. |
| 68 int current_position = position_; | 68 int current_position = position_; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 | 236 |
| 237 void SQLiteCursor::RunMoveStatementOnUIThread(int pos) { | 237 void SQLiteCursor::RunMoveStatementOnUIThread(int pos) { |
| 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 239 if (!consumer_.get()) | 239 if (!consumer_.get()) |
| 240 consumer_.reset(new CancelableRequestConsumer()); | 240 consumer_.reset(new CancelableRequestConsumer()); |
| 241 service_->MoveStatement( | 241 service_->MoveStatement( |
| 242 statement_, position_, pos, consumer_.get(), | 242 statement_, position_, pos, consumer_.get(), |
| 243 base::Bind(&SQLiteCursor::OnMoved, base::Unretained(this))); | 243 base::Bind(&SQLiteCursor::OnMoved, base::Unretained(this))); |
| 244 } | 244 } |
| OLD | NEW |