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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 wds_backend_, false)); | 84 wds_backend_, false)); |
85 } | 85 } |
86 | 86 |
87 WebDatabase* WebDatabaseService::GetDatabaseOnDB() const { | 87 WebDatabase* WebDatabaseService::GetDatabaseOnDB() const { |
88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
89 if (!wds_backend_) | 89 if (!wds_backend_) |
90 return NULL; | 90 return NULL; |
91 return wds_backend_->database(); | 91 return wds_backend_->database(); |
92 } | 92 } |
93 | 93 |
| 94 scoped_refptr<WebDataServiceBackend> WebDatabaseService::GetBackend() const { |
| 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 96 if (!wds_backend_) |
| 97 return NULL; |
| 98 return wds_backend_; |
| 99 } |
| 100 |
94 void WebDatabaseService::ScheduleDBTask( | 101 void WebDatabaseService::ScheduleDBTask( |
95 const tracked_objects::Location& from_here, | 102 const tracked_objects::Location& from_here, |
96 const WriteTask& task) { | 103 const WriteTask& task) { |
97 if (!wds_backend_) { | 104 if (!wds_backend_) { |
98 NOTREACHED() << "Task scheduled after Shutdown()"; | 105 NOTREACHED() << "Task scheduled after Shutdown()"; |
99 return; | 106 return; |
100 } | 107 } |
101 | 108 |
102 scoped_ptr<WebDataRequest> request( | 109 scoped_ptr<WebDataRequest> request( |
103 new WebDataRequest(NULL, wds_backend_->request_manager())); | 110 new WebDataRequest(NULL, wds_backend_->request_manager())); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 FOR_EACH_OBSERVER(WebDatabaseObserver, | 157 FOR_EACH_OBSERVER(WebDatabaseObserver, |
151 observer_list_, | 158 observer_list_, |
152 WebDatabaseLoaded()); | 159 WebDatabaseLoaded()); |
153 } else { | 160 } else { |
154 // Notify that the database load failed. | 161 // Notify that the database load failed. |
155 FOR_EACH_OBSERVER(WebDatabaseObserver, | 162 FOR_EACH_OBSERVER(WebDatabaseObserver, |
156 observer_list_, | 163 observer_list_, |
157 WebDatabaseLoadFailed(status)); | 164 WebDatabaseLoadFailed(status)); |
158 } | 165 } |
159 } | 166 } |
OLD | NEW |