| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 base::Bind(&SQLiteCursor::DestroyOnUIThread, | 155 base::Bind(&SQLiteCursor::DestroyOnUIThread, |
| 156 base::Unretained(this)))) { | 156 base::Unretained(this)))) { |
| 157 delete this; | 157 delete this; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 SQLiteCursor::SQLiteCursor(const std::vector<std::string>& column_names, | 161 SQLiteCursor::SQLiteCursor(const std::vector<std::string>& column_names, |
| 162 history::AndroidStatement* statement, | 162 history::AndroidStatement* statement, |
| 163 AndroidHistoryProviderService* service) | 163 AndroidHistoryProviderService* service) |
| 164 : position_(-1), | 164 : position_(-1), |
| 165 event_(false, false), | 165 event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 166 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 166 statement_(statement), | 167 statement_(statement), |
| 167 column_names_(column_names), | 168 column_names_(column_names), |
| 168 service_(service), | 169 service_(service), |
| 169 count_(-1), | 170 count_(-1), |
| 170 test_observer_(NULL) { | 171 test_observer_(NULL) {} |
| 171 } | |
| 172 | 172 |
| 173 SQLiteCursor::~SQLiteCursor() { | 173 SQLiteCursor::~SQLiteCursor() { |
| 174 } | 174 } |
| 175 | 175 |
| 176 void SQLiteCursor::DestroyOnUIThread() { | 176 void SQLiteCursor::DestroyOnUIThread() { |
| 177 // Consumer requests were set in the UI thread. They must be cancelled | 177 // Consumer requests were set in the UI thread. They must be cancelled |
| 178 // using the same thread. | 178 // using the same thread. |
| 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 180 tracker_.reset(); | 180 tracker_.reset(); |
| 181 service_->CloseStatement(statement_); | 181 service_->CloseStatement(statement_); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 246 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 247 if (!tracker_.get()) | 247 if (!tracker_.get()) |
| 248 tracker_.reset(new base::CancelableTaskTracker()); | 248 tracker_.reset(new base::CancelableTaskTracker()); |
| 249 service_->MoveStatement( | 249 service_->MoveStatement( |
| 250 statement_, | 250 statement_, |
| 251 position_, | 251 position_, |
| 252 pos, | 252 pos, |
| 253 base::Bind(&SQLiteCursor::OnMoved, base::Unretained(this)), | 253 base::Bind(&SQLiteCursor::OnMoved, base::Unretained(this)), |
| 254 tracker_.get()); | 254 tracker_.get()); |
| 255 } | 255 } |
| OLD | NEW |