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

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

Issue 4106014: Tweaks to improve memory consumption by TopSites. The biggest culprit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 10 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 | « no previous file | chrome/browser/history/top_sites.h » ('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) 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/history/thumbnail_database.h" 5 #include "chrome/browser/history/thumbnail_database.h"
6 6
7 #include "app/sql/statement.h" 7 #include "app/sql/statement.h"
8 #include "app/sql/transaction.h" 8 #include "app/sql/transaction.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 return sql::INIT_OK; 99 return sql::INIT_OK;
100 } 100 }
101 101
102 sql::InitStatus ThumbnailDatabase::OpenDatabase(sql::Connection* db, 102 sql::InitStatus ThumbnailDatabase::OpenDatabase(sql::Connection* db,
103 const FilePath& db_name) { 103 const FilePath& db_name) {
104 // Set the exceptional sqlite error handler. 104 // Set the exceptional sqlite error handler.
105 db->set_error_delegate(GetErrorHandlerForThumbnailDb()); 105 db->set_error_delegate(GetErrorHandlerForThumbnailDb());
106 106
107 // Set the database page size to something larger to give us 107 // Thumbnails db now only stores favicons, so we don't need that big a page
108 // better performance (we're typically seek rather than bandwidth limited). 108 // size or cache.
109 // This only has an effect before any tables have been created, otherwise 109 db->set_page_size(2048);
110 // this is a NOP. Must be a power of 2 and a max of 8192. We use a bigger 110 db->set_cache_size(32);
111 // one because we're storing larger data (4-16K) in it, so we want a few
112 // blocks per element.
113 db->set_page_size(4096);
114
115 // The UI is generally designed to work well when the thumbnail database is
116 // slow, so we can tolerate much less caching. The file is also very large
117 // and so caching won't save a significant percentage of it for us,
118 // reducing the benefit of caching in the first place. With the default cache
119 // size of 2000 pages, it will take >8MB of memory, so reducing it can be a
120 // big savings.
121 db->set_cache_size(64);
122 111
123 // Run the database in exclusive mode. Nobody else should be accessing the 112 // Run the database in exclusive mode. Nobody else should be accessing the
124 // database while we're running, and this will give somewhat improved perf. 113 // database while we're running, and this will give somewhat improved perf.
125 db->set_exclusive_locking(); 114 db->set_exclusive_locking();
126 115
127 if (!db->Open(db_name)) 116 if (!db->Open(db_name))
128 return sql::INIT_FAILURE; 117 return sql::INIT_FAILURE;
129 118
130 return sql::INIT_OK; 119 return sql::INIT_OK;
131 } 120 }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 541
553 InitFavIconsIndex(); 542 InitFavIconsIndex();
554 543
555 // Reopen the transaction. 544 // Reopen the transaction.
556 BeginTransaction(); 545 BeginTransaction();
557 use_top_sites_ = true; 546 use_top_sites_ = true;
558 return true; 547 return true;
559 } 548 }
560 549
561 } // namespace history 550 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/top_sites.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698