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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 int year, month; | 120 int year, month; |
121 base::StringToInt(suffix.substr(0, 4), &year); | 121 base::StringToInt(suffix.substr(0, 4), &year); |
122 base::StringToInt(suffix.substr(5, 2), &month); | 122 base::StringToInt(suffix.substr(5, 2), &month); |
123 | 123 |
124 return year * 100 + month; | 124 return year * 100 + month; |
125 } | 125 } |
126 | 126 |
127 bool TextDatabase::Init() { | 127 bool TextDatabase::Init() { |
128 // Make sure, if we're not allowed to create the file, that it exists. | 128 // Make sure, if we're not allowed to create the file, that it exists. |
129 if (!allow_create_) { | 129 if (!allow_create_) { |
130 if (!file_util::PathExists(file_name_)) | 130 if (!base::PathExists(file_name_)) |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 db_.set_histogram_tag("Text"); | 134 db_.set_histogram_tag("Text"); |
135 | 135 |
136 // Set the database page size to something a little larger to give us | 136 // Set the database page size to something a little larger to give us |
137 // better performance (we're typically seek rather than bandwidth limited). | 137 // better performance (we're typically seek rather than bandwidth limited). |
138 // This only has an effect before any tables have been created, otherwise | 138 // This only has an effect before any tables have been created, otherwise |
139 // this is a NOP. Must be a power of 2 and a max of 8192. | 139 // this is a NOP. Must be a power of 2 and a max of 8192. |
140 db_.set_page_size(4096); | 140 db_.set_page_size(4096); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 // Compute the snippet based on those matches. | 345 // Compute the snippet based on those matches. |
346 std::string body = statement.ColumnString(4); | 346 std::string body = statement.ColumnString(4); |
347 match.snippet.ComputeSnippet(match_positions, body); | 347 match.snippet.ComputeSnippet(match_positions, body); |
348 } | 348 } |
349 statement.Reset(true); | 349 statement.Reset(true); |
350 return result_count > options.EffectiveMaxCount(); | 350 return result_count > options.EffectiveMaxCount(); |
351 } | 351 } |
352 | 352 |
353 } // namespace history | 353 } // namespace history |
OLD | NEW |