| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "components/webdata/common/web_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 sql::Connection* WebDatabase::GetSQLConnection() { | 68 sql::Connection* WebDatabase::GetSQLConnection() { |
| 69 return &db_; | 69 return &db_; |
| 70 } | 70 } |
| 71 | 71 |
| 72 sql::InitStatus WebDatabase::Init(const base::FilePath& db_name) { | 72 sql::InitStatus WebDatabase::Init(const base::FilePath& db_name) { |
| 73 // When running in unit tests, there is already a NotificationService object. | 73 // When running in unit tests, there is already a NotificationService object. |
| 74 // Since only one can exist at a time per thread, check first. | 74 // Since only one can exist at a time per thread, check first. |
| 75 if (!content::NotificationService::current()) | 75 if (!content::NotificationService::current()) |
| 76 notification_service_.reset(content::NotificationService::Create()); | 76 notification_service_.reset(content::NotificationService::Create()); |
| 77 | 77 |
| 78 db_.set_error_histogram_name("Sqlite.Web.Error"); | 78 db_.set_histogram_prefix("Sqlite.Web"); |
| 79 | 79 |
| 80 // We don't store that much data in the tables so use a small page size. | 80 // We don't store that much data in the tables so use a small page size. |
| 81 // This provides a large benefit for empty tables (which is very likely with | 81 // This provides a large benefit for empty tables (which is very likely with |
| 82 // the tables we create). | 82 // the tables we create). |
| 83 db_.set_page_size(2048); | 83 db_.set_page_size(2048); |
| 84 | 84 |
| 85 // We shouldn't have much data and what access we currently have is quite | 85 // We shouldn't have much data and what access we currently have is quite |
| 86 // infrequent. So we go with a small cache size. | 86 // infrequent. So we go with a small cache size. |
| 87 db_.set_cache_size(32); | 87 db_.set_cache_size(32); |
| 88 | 88 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 if (!it->second->MigrateToVersion(next_version, | 164 if (!it->second->MigrateToVersion(next_version, |
| 165 &update_compatible_version)) { | 165 &update_compatible_version)) { |
| 166 return FailedMigrationTo(next_version); | 166 return FailedMigrationTo(next_version); |
| 167 } | 167 } |
| 168 | 168 |
| 169 ChangeVersion(&meta_table_, next_version, update_compatible_version); | 169 ChangeVersion(&meta_table_, next_version, update_compatible_version); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 return sql::INIT_OK; | 172 return sql::INIT_OK; |
| 173 } | 173 } |
| OLD | NEW |