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_data_service_backend.h" | 5 #include "components/webdata/common/web_data_service_backend.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_database.h" | 10 #include "components/webdata/common/web_database.h" |
11 #include "components/webdata/common/web_database_table.h" | 11 #include "components/webdata/common/web_database_table.h" |
12 | 12 |
13 | |
14 using base::Bind; | 13 using base::Bind; |
15 using base::FilePath; | 14 using base::FilePath; |
16 using content::BrowserThread; | |
17 | 15 |
18 WebDataServiceBackend::WebDataServiceBackend( | 16 WebDataServiceBackend::WebDataServiceBackend( |
19 const FilePath& path, Delegate* delegate) | 17 const FilePath& path, |
20 : db_path_(path), | 18 Delegate* delegate, |
| 19 const scoped_refptr<base::MessageLoopProxy>& db_thread) |
| 20 : base::RefCountedDeleteOnMessageLoop<WebDataServiceBackend>(db_thread), |
| 21 db_path_(path), |
21 request_manager_(new WebDataRequestManager()), | 22 request_manager_(new WebDataRequestManager()), |
22 init_status_(sql::INIT_FAILURE), | 23 init_status_(sql::INIT_FAILURE), |
23 init_complete_(false), | 24 init_complete_(false), |
24 delegate_(delegate) { | 25 delegate_(delegate) { |
25 } | 26 } |
26 | 27 |
27 void WebDataServiceBackend::AddTable(scoped_ptr<WebDatabaseTable> table) { | 28 void WebDataServiceBackend::AddTable(scoped_ptr<WebDatabaseTable> table) { |
28 DCHECK(!db_.get()); | 29 DCHECK(!db_.get()); |
29 tables_.push_back(table.release()); | 30 tables_.push_back(table.release()); |
30 } | 31 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 115 } |
115 | 116 |
116 void WebDataServiceBackend::Commit() { | 117 void WebDataServiceBackend::Commit() { |
117 if (db_ && init_status_ == sql::INIT_OK) { | 118 if (db_ && init_status_ == sql::INIT_OK) { |
118 db_->CommitTransaction(); | 119 db_->CommitTransaction(); |
119 db_->BeginTransaction(); | 120 db_->BeginTransaction(); |
120 } else { | 121 } else { |
121 NOTREACHED() << "Commit scheduled after Shutdown()"; | 122 NOTREACHED() << "Commit scheduled after Shutdown()"; |
122 } | 123 } |
123 } | 124 } |
OLD | NEW |