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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 void WebDatabaseService::ShutdownDatabase() { | 78 void WebDatabaseService::ShutdownDatabase() { |
79 if (!wds_backend_) | 79 if (!wds_backend_) |
80 return; | 80 return; |
81 weak_ptr_factory_.InvalidateWeakPtrs(); | 81 weak_ptr_factory_.InvalidateWeakPtrs(); |
82 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 82 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
83 Bind(&WebDataServiceBackend::ShutdownDatabase, | 83 Bind(&WebDataServiceBackend::ShutdownDatabase, |
84 wds_backend_, false)); | 84 wds_backend_, false)); |
85 } | 85 } |
86 | 86 |
| 87 void WebDatabaseService::GetDatabaseOnDB(const DBCallback& callback) { |
| 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 89 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 90 Bind(&WebDataServiceBackend::GetDatabaseAsync, wds_backend_, callback)); |
| 91 } |
| 92 |
87 WebDatabase* WebDatabaseService::GetDatabaseOnDB() const { | 93 WebDatabase* WebDatabaseService::GetDatabaseOnDB() const { |
88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
89 if (!wds_backend_) | 95 if (!wds_backend_) |
90 return NULL; | 96 return NULL; |
91 return wds_backend_->database(); | 97 return wds_backend_->database(); |
92 } | 98 } |
93 | 99 |
94 void WebDatabaseService::ScheduleDBTask( | 100 void WebDatabaseService::ScheduleDBTask( |
95 const tracked_objects::Location& from_here, | 101 const tracked_objects::Location& from_here, |
96 const WriteTask& task) { | 102 const WriteTask& task) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 FOR_EACH_OBSERVER(WebDatabaseObserver, | 156 FOR_EACH_OBSERVER(WebDatabaseObserver, |
151 observer_list_, | 157 observer_list_, |
152 WebDatabaseLoaded()); | 158 WebDatabaseLoaded()); |
153 } else { | 159 } else { |
154 // Notify that the database load failed. | 160 // Notify that the database load failed. |
155 FOR_EACH_OBSERVER(WebDatabaseObserver, | 161 FOR_EACH_OBSERVER(WebDatabaseObserver, |
156 observer_list_, | 162 observer_list_, |
157 WebDatabaseLoadFailed(status)); | 163 WebDatabaseLoadFailed(status)); |
158 } | 164 } |
159 } | 165 } |
OLD | NEW |