| 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 using base::Bind; | 13 using base::Bind; |
| 14 using base::FilePath; | 14 using base::FilePath; |
| 15 | 15 |
| 16 WebDataServiceBackend::WebDataServiceBackend( | 16 WebDataServiceBackend::WebDataServiceBackend( |
| 17 const FilePath& path, | 17 const FilePath& path, |
| 18 Delegate* delegate, | 18 Delegate* delegate, |
| 19 const scoped_refptr<base::MessageLoopProxy>& db_thread) | 19 const scoped_refptr<base::MessageLoopProxy>& db_thread) |
| 20 : base::RefCountedDeleteOnMessageLoop<WebDataServiceBackend>(db_thread), | 20 : base::RefCountedDeleteOnTaskRunner<WebDataServiceBackend>(db_thread), |
| 21 db_path_(path), | 21 db_path_(path), |
| 22 request_manager_(new WebDataRequestManager()), | 22 request_manager_(new WebDataRequestManager()), |
| 23 init_status_(sql::INIT_FAILURE), | 23 init_status_(sql::INIT_FAILURE), |
| 24 init_complete_(false), | 24 init_complete_(false), |
| 25 delegate_(delegate) { | 25 delegate_(delegate) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void WebDataServiceBackend::AddTable(scoped_ptr<WebDatabaseTable> table) { | 28 void WebDataServiceBackend::AddTable(scoped_ptr<WebDatabaseTable> table) { |
| 29 DCHECK(!db_.get()); | 29 DCHECK(!db_.get()); |
| 30 tables_.push_back(table.release()); | 30 tables_.push_back(table.release()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 WebDataServiceBackend::~WebDataServiceBackend() { | 110 WebDataServiceBackend::~WebDataServiceBackend() { |
| 111 ShutdownDatabase(); | 111 ShutdownDatabase(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void WebDataServiceBackend::Commit() { | 114 void WebDataServiceBackend::Commit() { |
| 115 DCHECK(db_); | 115 DCHECK(db_); |
| 116 DCHECK_EQ(sql::INIT_OK, init_status_); | 116 DCHECK_EQ(sql::INIT_OK, init_status_); |
| 117 db_->CommitTransaction(); | 117 db_->CommitTransaction(); |
| 118 db_->BeginTransaction(); | 118 db_->BeginTransaction(); |
| 119 } | 119 } |
| OLD | NEW |