| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/webdata/web_database.h" | 5 #include "chrome/browser/webdata/web_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/gfx/codec/png_codec.h" | 11 #include "app/gfx/codec/png_codec.h" |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "app/sql/statement.h" | 13 #include "app/sql/statement.h" |
| 14 #include "app/sql/transaction.h" | 14 #include "app/sql/transaction.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
| 17 #include "chrome/browser/history/history_database.h" | 18 #include "chrome/browser/history/history_database.h" |
| 18 #include "chrome/browser/search_engines/template_url.h" | 19 #include "chrome/browser/search_engines/template_url.h" |
| 19 #include "webkit/glue/password_form.h" | 20 #include "webkit/glue/password_form.h" |
| 20 | 21 |
| 21 // Encryptor is the *wrong* way of doing things; we need to turn it into a | 22 // Encryptor is the *wrong* way of doing things; we need to turn it into a |
| 22 // bottleneck to use the platform methods (e.g. Keychain on the Mac, Gnome | 23 // bottleneck to use the platform methods (e.g. Keychain on the Mac, Gnome |
| 23 // Keyring / KWallet on Linux). That's going to take a massive change in its | 24 // Keyring / KWallet on Linux). That's going to take a massive change in its |
| 24 // API... see: | 25 // API... see: |
| 25 // http://code.google.com/p/chromium/issues/detail?id=8205 (Linux) | 26 // http://code.google.com/p/chromium/issues/detail?id=8205 (Linux) |
| 26 #include "chrome/browser/password_manager/encryptor.h" | 27 #include "chrome/browser/password_manager/encryptor.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 127 |
| 127 void WebDatabase::BeginTransaction() { | 128 void WebDatabase::BeginTransaction() { |
| 128 db_.BeginTransaction(); | 129 db_.BeginTransaction(); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void WebDatabase::CommitTransaction() { | 132 void WebDatabase::CommitTransaction() { |
| 132 db_.CommitTransaction(); | 133 db_.CommitTransaction(); |
| 133 } | 134 } |
| 134 | 135 |
| 135 bool WebDatabase::Init(const FilePath& db_name) { | 136 bool WebDatabase::Init(const FilePath& db_name) { |
| 137 // Set the exceptional sqlite error handler. |
| 138 db_.set_error_delegate(GetErrorHandlerForWebDb()); |
| 139 |
| 136 // We don't store that much data in the tables so use a small page size. | 140 // We don't store that much data in the tables so use a small page size. |
| 137 // This provides a large benefit for empty tables (which is very likely with | 141 // This provides a large benefit for empty tables (which is very likely with |
| 138 // the tables we create). | 142 // the tables we create). |
| 139 db_.set_page_size(2048); | 143 db_.set_page_size(2048); |
| 140 | 144 |
| 141 // We shouldn't have much data and what access we currently have is quite | 145 // We shouldn't have much data and what access we currently have is quite |
| 142 // infrequent. So we go with a small cache size. | 146 // infrequent. So we go with a small cache size. |
| 143 db_.set_cache_size(32); | 147 db_.set_cache_size(32); |
| 144 | 148 |
| 145 // Run the database in exclusive mode. Nobody else should be accessing the | 149 // Run the database in exclusive mode. Nobody else should be accessing the |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 | 1153 |
| 1150 // Add successive versions here. Each should set the version number and | 1154 // Add successive versions here. Each should set the version number and |
| 1151 // compatible version number as appropriate, then fall through to the next | 1155 // compatible version number as appropriate, then fall through to the next |
| 1152 // case. | 1156 // case. |
| 1153 | 1157 |
| 1154 case kCurrentVersionNumber: | 1158 case kCurrentVersionNumber: |
| 1155 // No migration needed. | 1159 // No migration needed. |
| 1156 return; | 1160 return; |
| 1157 } | 1161 } |
| 1158 } | 1162 } |
| OLD | NEW |