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 <limits> | 5 #include <limits> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/history/text_database.h" | 9 #include "chrome/browser/history/text_database.h" |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return year * 100 + month; | 125 return year * 100 + month; |
126 } | 126 } |
127 | 127 |
128 bool TextDatabase::Init() { | 128 bool TextDatabase::Init() { |
129 // Make sure, if we're not allowed to create the file, that it exists. | 129 // Make sure, if we're not allowed to create the file, that it exists. |
130 if (!allow_create_) { | 130 if (!allow_create_) { |
131 if (!file_util::PathExists(file_name_)) | 131 if (!file_util::PathExists(file_name_)) |
132 return false; | 132 return false; |
133 } | 133 } |
134 | 134 |
135 db_.set_error_histogram_name("Sqlite.Text.Error"); | 135 db_.set_histogram_tag("Text"); |
136 | 136 |
137 // Set the database page size to something a little larger to give us | 137 // Set the database page size to something a little larger to give us |
138 // better performance (we're typically seek rather than bandwidth limited). | 138 // better performance (we're typically seek rather than bandwidth limited). |
139 // This only has an effect before any tables have been created, otherwise | 139 // This only has an effect before any tables have been created, otherwise |
140 // this is a NOP. Must be a power of 2 and a max of 8192. | 140 // this is a NOP. Must be a power of 2 and a max of 8192. |
141 db_.set_page_size(4096); | 141 db_.set_page_size(4096); |
142 | 142 |
143 // The default cache size is 2000 which give >8MB of data. Since we will often | 143 // The default cache size is 2000 which give >8MB of data. Since we will often |
144 // have 2-3 of these objects, each with their own 8MB, this adds up very fast. | 144 // have 2-3 of these objects, each with their own 8MB, this adds up very fast. |
145 // We therefore reduce the size so when there are multiple objects, we're not | 145 // We therefore reduce the size so when there are multiple objects, we're not |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 // Compute the snippet based on those matches. | 346 // Compute the snippet based on those matches. |
347 std::string body = statement.ColumnString(4); | 347 std::string body = statement.ColumnString(4); |
348 match.snippet.ComputeSnippet(match_positions, body); | 348 match.snippet.ComputeSnippet(match_positions, body); |
349 } | 349 } |
350 statement.Reset(true); | 350 statement.Reset(true); |
351 return result_count > options.EffectiveMaxCount(); | 351 return result_count > options.EffectiveMaxCount(); |
352 } | 352 } |
353 | 353 |
354 } // namespace history | 354 } // namespace history |
OLD | NEW |