| 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_backend.h" | 5 #include "components/webdata/common/web_database_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "components/webdata/common/web_data_request_manager.h" | 12 #include "components/webdata/common/web_data_request_manager.h" |
| 13 #include "components/webdata/common/web_database.h" | 13 #include "components/webdata/common/web_database.h" |
| 14 #include "components/webdata/common/web_database_table.h" | 14 #include "components/webdata/common/web_database_table.h" |
| 15 #include "sql/error_delegate_util.h" | 15 #include "sql/error_delegate_util.h" |
| 16 | 16 |
| 17 using base::Bind; | 17 using base::Bind; |
| 18 using base::FilePath; | 18 using base::FilePath; |
| 19 | 19 |
| 20 WebDatabaseBackend::WebDatabaseBackend( | 20 WebDatabaseBackend::WebDatabaseBackend( |
| 21 const FilePath& path, | 21 const FilePath& path, |
| 22 Delegate* delegate, | 22 Delegate* delegate, |
| 23 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread) | 23 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread) |
| 24 : base::RefCountedDeleteOnMessageLoop<WebDatabaseBackend>(db_thread), | 24 : base::RefCountedDeleteOnSequence<WebDatabaseBackend>(db_thread), |
| 25 db_path_(path), | 25 db_path_(path), |
| 26 request_manager_(new WebDataRequestManager()), | 26 request_manager_(new WebDataRequestManager()), |
| 27 init_status_(sql::INIT_FAILURE), | 27 init_status_(sql::INIT_FAILURE), |
| 28 init_complete_(false), | 28 init_complete_(false), |
| 29 catastrophic_error_occurred_(false), | 29 catastrophic_error_occurred_(false), |
| 30 delegate_(delegate) {} | 30 delegate_(delegate) {} |
| 31 | 31 |
| 32 void WebDatabaseBackend::AddTable(std::unique_ptr<WebDatabaseTable> table) { | 32 void WebDatabaseBackend::AddTable(std::unique_ptr<WebDatabaseTable> table) { |
| 33 DCHECK(!db_.get()); | 33 DCHECK(!db_.get()); |
| 34 tables_.push_back(table.release()); | 34 tables_.push_back(table.release()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 db_->GetSQLConnection()->RazeAndClose(); | 135 db_->GetSQLConnection()->RazeAndClose(); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 void WebDatabaseBackend::Commit() { | 139 void WebDatabaseBackend::Commit() { |
| 140 DCHECK(db_); | 140 DCHECK(db_); |
| 141 DCHECK_EQ(sql::INIT_OK, init_status_); | 141 DCHECK_EQ(sql::INIT_OK, init_status_); |
| 142 db_->CommitTransaction(); | 142 db_->CommitTransaction(); |
| 143 db_->BeginTransaction(); | 143 db_->BeginTransaction(); |
| 144 } | 144 } |
| OLD | NEW |