Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: chrome/browser/history/text_database.cc

Issue 8677025: Reverting based on discussions on #chromium with shess and rsleevi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/in_memory_database.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" 17 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
18 #include "chrome/browser/history/history_field_trial.h"
19 #include "sql/statement.h" 18 #include "sql/statement.h"
20 #include "sql/transaction.h" 19 #include "sql/transaction.h"
21 20
22 // There are two tables in each database, one full-text search (FTS) table which 21 // There are two tables in each database, one full-text search (FTS) table which
23 // indexes the contents and title of the pages. The other is a regular SQLITE 22 // indexes the contents and title of the pages. The other is a regular SQLITE
24 // table which contains non-indexed information about the page. All columns of 23 // table which contains non-indexed information about the page. All columns of
25 // a FTS table are indexed using the text search algorithm, which isn't what we 24 // a FTS table are indexed using the text search algorithm, which isn't what we
26 // want for things like times. If this were in the FTS table, there would be 25 // want for things like times. If this were in the FTS table, there would be
27 // different words in the index for each time number. 26 // different words in the index for each time number.
28 // 27 //
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Set the database page size to something a little larger to give us 131 // Set the database page size to something a little larger to give us
133 // better performance (we're typically seek rather than bandwidth limited). 132 // better performance (we're typically seek rather than bandwidth limited).
134 // This only has an effect before any tables have been created, otherwise 133 // This only has an effect before any tables have been created, otherwise
135 // this is a NOP. Must be a power of 2 and a max of 8192. 134 // this is a NOP. Must be a power of 2 and a max of 8192.
136 db_.set_page_size(4096); 135 db_.set_page_size(4096);
137 136
138 // The default cache size is 2000 which give >8MB of data. Since we will often 137 // The default cache size is 2000 which give >8MB of data. Since we will often
139 // have 2-3 of these objects, each with their own 8MB, this adds up very fast. 138 // have 2-3 of these objects, each with their own 8MB, this adds up very fast.
140 // We therefore reduce the size so when there are multiple objects, we're not 139 // We therefore reduce the size so when there are multiple objects, we're not
141 // too big. 140 // too big.
142 if (HistoryFieldTrial::IsLowMemFieldTrial()) { 141 db_.set_cache_size(512);
143 // FTS does merges of 16 pages at a time, so we need a working set size
144 // somewhat greater than that to prevent too much thrashing.
145 db_.set_cache_size(128);
146 } else {
147 db_.set_cache_size(512);
148 }
149 142
150 // Run the database in exclusive mode. Nobody else should be accessing the 143 // Run the database in exclusive mode. Nobody else should be accessing the
151 // database while we're running, and this will give somewhat improved perf. 144 // database while we're running, and this will give somewhat improved perf.
152 db_.set_exclusive_locking(); 145 db_.set_exclusive_locking();
153 146
154 // Attach the database to our index file. 147 // Attach the database to our index file.
155 if (!db_.Open(file_name_)) 148 if (!db_.Open(file_name_))
156 return false; 149 return false;
157 150
158 // Meta table tracking version information. 151 // Meta table tracking version information.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } else { 375 } else {
383 // Since we got the results in order, we know the last item is the last 376 // Since we got the results in order, we know the last item is the last
384 // time we considered. 377 // time we considered.
385 *first_time_searched = results->back().time; 378 *first_time_searched = results->back().time;
386 } 379 }
387 380
388 statement.Reset(); 381 statement.Reset();
389 } 382 }
390 383
391 } // namespace history 384 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/in_memory_database.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698