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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "components/webdata/common/web_data_request_manager.h" | 9 #include "components/webdata/common/web_data_request_manager.h" |
10 #include "components/webdata/common/web_data_results.h" | 10 #include "components/webdata/common/web_data_results.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 private: | 35 private: |
36 const base::WeakPtr<WebDatabaseService> web_database_service_; | 36 const base::WeakPtr<WebDatabaseService> web_database_service_; |
37 scoped_refptr<base::MessageLoopProxy> callback_thread_; | 37 scoped_refptr<base::MessageLoopProxy> callback_thread_; |
38 }; | 38 }; |
39 | 39 |
40 WebDatabaseService::WebDatabaseService( | 40 WebDatabaseService::WebDatabaseService( |
41 const base::FilePath& path, | 41 const base::FilePath& path, |
42 const scoped_refptr<base::MessageLoopProxy>& ui_thread, | 42 const scoped_refptr<base::MessageLoopProxy>& ui_thread, |
43 const scoped_refptr<base::MessageLoopProxy>& db_thread) | 43 const scoped_refptr<base::MessageLoopProxy>& db_thread) |
44 : base::RefCountedDeleteOnMessageLoop<WebDatabaseService>(ui_thread), | 44 : base::RefCountedDeleteOnTaskRunner<WebDatabaseService>(ui_thread), |
45 path_(path), | 45 path_(path), |
46 db_loaded_(false), | 46 db_loaded_(false), |
47 db_thread_(db_thread), | 47 db_thread_(db_thread), |
48 weak_ptr_factory_(this) { | 48 weak_ptr_factory_(this) { |
49 // WebDatabaseService should be instantiated on UI thread. | 49 // WebDatabaseService should be instantiated on UI thread. |
50 DCHECK(ui_thread->BelongsToCurrentThread()); | 50 DCHECK(ui_thread->BelongsToCurrentThread()); |
51 // WebDatabaseService requires DB thread if instantiated. | 51 // WebDatabaseService requires DB thread if instantiated. |
52 DCHECK(db_thread.get()); | 52 DCHECK(db_thread.get()); |
53 } | 53 } |
54 | 54 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } else { | 146 } else { |
147 // Notify that the database load failed. | 147 // Notify that the database load failed. |
148 for (size_t i = 0; i < error_callbacks_.size(); i++) { | 148 for (size_t i = 0; i < error_callbacks_.size(); i++) { |
149 if (!error_callbacks_[i].is_null()) | 149 if (!error_callbacks_[i].is_null()) |
150 error_callbacks_[i].Run(status); | 150 error_callbacks_[i].Run(status); |
151 } | 151 } |
152 | 152 |
153 error_callbacks_.clear(); | 153 error_callbacks_.clear(); |
154 } | 154 } |
155 } | 155 } |
OLD | NEW |