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

Side by Side Diff: chrome/browser/history/top_sites_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 | « chrome/browser/history/top_sites_cache.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('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 "app/sql/connection.h" 5 #include "app/sql/connection.h"
6 #include "app/sql/transaction.h" 6 #include "app/sql/transaction.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" 9 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
10 #include "chrome/browser/history/history_types.h" 10 #include "chrome/browser/history/history_types.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // static 125 // static
126 std::string TopSitesDatabase::GetRedirects(const MostVisitedURL& url) { 126 std::string TopSitesDatabase::GetRedirects(const MostVisitedURL& url) {
127 std::vector<std::string> redirects; 127 std::vector<std::string> redirects;
128 for (size_t i = 0; i < url.redirects.size(); i++) 128 for (size_t i = 0; i < url.redirects.size(); i++)
129 redirects.push_back(url.redirects[i].spec()); 129 redirects.push_back(url.redirects[i].spec());
130 return JoinString(redirects, ' '); 130 return JoinString(redirects, ' ');
131 } 131 }
132 132
133 // static 133 // static
134 void TopSitesDatabase::SetRedirects(const std::string& redirects, 134 void TopSitesDatabase::SetRedirects(const std::string& redirects,
135 MostVisitedURL* url) { 135 MostVisitedURL* url) {
136 std::vector<std::string> redirects_vector; 136 std::vector<std::string> redirects_vector;
137 SplitStringAlongWhitespace(redirects, &redirects_vector); 137 SplitStringAlongWhitespace(redirects, &redirects_vector);
138 for (size_t i = 0; i < redirects_vector.size(); i++) 138 for (size_t i = 0; i < redirects_vector.size(); i++)
139 url->redirects.push_back(GURL(redirects_vector[i])); 139 url->redirects.push_back(GURL(redirects_vector[i]));
140 } 140 }
141 141
142 void TopSitesDatabase::SetPageThumbnail(const MostVisitedURL& url, 142 void TopSitesDatabase::SetPageThumbnail(const MostVisitedURL& url,
143 int new_rank, 143 int new_rank,
144 const Images& thumbnail) { 144 const Images& thumbnail) {
145 sql::Transaction transaction(db_.get()); 145 sql::Transaction transaction(db_.get());
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 delete_statement.Run(); 359 delete_statement.Run();
360 360
361 return transaction.Commit(); 361 return transaction.Commit();
362 } 362 }
363 363
364 sql::Connection* TopSitesDatabase::CreateDB(const FilePath& db_name) { 364 sql::Connection* TopSitesDatabase::CreateDB(const FilePath& db_name) {
365 scoped_ptr<sql::Connection> db(new sql::Connection()); 365 scoped_ptr<sql::Connection> db(new sql::Connection());
366 // Settings copied from ThumbnailDatabase. 366 // Settings copied from ThumbnailDatabase.
367 db->set_error_delegate(GetErrorHandlerForThumbnailDb()); 367 db->set_error_delegate(GetErrorHandlerForThumbnailDb());
368 db->set_page_size(4096); 368 db->set_page_size(4096);
369 db->set_cache_size(64); 369 db->set_cache_size(32);
370 370
371 if (!db->Open(db_name)) { 371 if (!db->Open(db_name)) {
372 LOG(ERROR) << db->GetErrorMessage(); 372 LOG(ERROR) << db->GetErrorMessage();
373 return NULL; 373 return NULL;
374 } 374 }
375 375
376 return db.release(); 376 return db.release();
377 } 377 }
378 378
379 } // namespace history 379 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_cache.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698