| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/webdata/common/web_database_service.h" | 5 #include "components/webdata/common/web_database_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 private: | 36 private: |
| 37 const base::WeakPtr<WebDatabaseService> web_database_service_; | 37 const base::WeakPtr<WebDatabaseService> web_database_service_; |
| 38 scoped_refptr<base::SingleThreadTaskRunner> callback_thread_; | 38 scoped_refptr<base::SingleThreadTaskRunner> callback_thread_; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 WebDatabaseService::WebDatabaseService( | 41 WebDatabaseService::WebDatabaseService( |
| 42 const base::FilePath& path, | 42 const base::FilePath& path, |
| 43 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, | 43 scoped_refptr<base::SingleThreadTaskRunner> ui_thread, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> db_thread) | 44 scoped_refptr<base::SingleThreadTaskRunner> db_thread) |
| 45 : base::RefCountedDeleteOnMessageLoop<WebDatabaseService>(ui_thread), | 45 : base::RefCountedDeleteOnSequence<WebDatabaseService>(ui_thread), |
| 46 path_(path), | 46 path_(path), |
| 47 db_loaded_(false), | 47 db_loaded_(false), |
| 48 db_thread_(db_thread), | 48 db_thread_(db_thread), |
| 49 weak_ptr_factory_(this) { | 49 weak_ptr_factory_(this) { |
| 50 // WebDatabaseService should be instantiated on UI thread. | 50 // WebDatabaseService should be instantiated on UI thread. |
| 51 DCHECK(ui_thread->BelongsToCurrentThread()); | 51 DCHECK(ui_thread->BelongsToCurrentThread()); |
| 52 // WebDatabaseService requires DB thread if instantiated. | 52 // WebDatabaseService requires DB thread if instantiated. |
| 53 DCHECK(db_thread.get()); | 53 DCHECK(db_thread.get()); |
| 54 } | 54 } |
| 55 | 55 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 db_loaded_ = true; | 155 db_loaded_ = true; |
| 156 | 156 |
| 157 while (!loaded_callbacks_.empty()) { | 157 while (!loaded_callbacks_.empty()) { |
| 158 DBLoadedCallback loaded_callback = loaded_callbacks_.back(); | 158 DBLoadedCallback loaded_callback = loaded_callbacks_.back(); |
| 159 loaded_callbacks_.pop_back(); | 159 loaded_callbacks_.pop_back(); |
| 160 if (!loaded_callback.is_null()) | 160 if (!loaded_callback.is_null()) |
| 161 loaded_callback.Run(); | 161 loaded_callback.Run(); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 } | 164 } |
| OLD | NEW |