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/chromeos/contacts/contact_database.h" | 5 #include "chrome/browser/chromeos/contacts/contact_database.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace contacts { | 23 namespace contacts { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // LevelDB key used for storing UpdateMetadata messages. | 27 // LevelDB key used for storing UpdateMetadata messages. |
28 const char kUpdateMetadataKey[] = "__chrome_update_metadata__"; | 28 const char kUpdateMetadataKey[] = "__chrome_update_metadata__"; |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 ContactDatabase::ContactDatabase() : weak_ptr_factory_(this) { | 32 ContactDatabase::ContactDatabase() |
| 33 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
34 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 35 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
35 task_runner_ = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 36 task_runner_ = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
36 } | 37 } |
37 | 38 |
38 void ContactDatabase::DestroyOnUIThread() { | 39 void ContactDatabase::DestroyOnUIThread() { |
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
40 weak_ptr_factory_.InvalidateWeakPtrs(); | 41 weak_ptr_factory_.InvalidateWeakPtrs(); |
41 task_runner_->PostNonNestableTask( | 42 task_runner_->PostNonNestableTask( |
42 FROM_HERE, | 43 FROM_HERE, |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 275 } |
275 contacts->push_back(contact.release()); | 276 contacts->push_back(contact.release()); |
276 } | 277 } |
277 db_iterator->Next(); | 278 db_iterator->Next(); |
278 } | 279 } |
279 | 280 |
280 *success = true; | 281 *success = true; |
281 } | 282 } |
282 | 283 |
283 } // namespace contacts | 284 } // namespace contacts |
OLD | NEW |