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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::RefCountedDeleteOnMessageLoop<WebDatabaseService>(ui_thread), |
45 path_(path), | 45 path_(path), |
46 weak_ptr_factory_(this), | 46 weak_ptr_factory_(this), |
47 db_loaded_(false), | 47 db_loaded_(false), |
48 db_thread_(db_thread) { | 48 db_thread_(db_thread) { |
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); | 52 DCHECK(db_thread.get()); |
53 } | 53 } |
54 | 54 |
55 WebDatabaseService::~WebDatabaseService() { | 55 WebDatabaseService::~WebDatabaseService() { |
56 } | 56 } |
57 | 57 |
58 void WebDatabaseService::AddTable(scoped_ptr<WebDatabaseTable> table) { | 58 void WebDatabaseService::AddTable(scoped_ptr<WebDatabaseTable> table) { |
59 if (!wds_backend_.get()) { | 59 if (!wds_backend_.get()) { |
60 wds_backend_ = new WebDataServiceBackend( | 60 wds_backend_ = new WebDataServiceBackend( |
61 path_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr()), | 61 path_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr()), |
62 db_thread_); | 62 db_thread_); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } else { | 172 } else { |
173 // Notify that the database load failed. | 173 // Notify that the database load failed. |
174 for (size_t i = 0; i < error_callbacks_.size(); i++) { | 174 for (size_t i = 0; i < error_callbacks_.size(); i++) { |
175 if (!error_callbacks_[i].is_null()) | 175 if (!error_callbacks_[i].is_null()) |
176 error_callbacks_[i].Run(status); | 176 error_callbacks_[i].Run(status); |
177 } | 177 } |
178 | 178 |
179 error_callbacks_.clear(); | 179 error_callbacks_.clear(); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |