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

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

Issue 8379009: Add a field trial for using lower sqlite cache sizes. (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
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 "chrome/browser/history/in_memory_database.h" 5 #include "chrome/browser/history/in_memory_database.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/history/history_field_trial.h"
13 14
14 namespace history { 15 namespace history {
15 16
16 InMemoryDatabase::InMemoryDatabase() : URLDatabase() { 17 InMemoryDatabase::InMemoryDatabase() : URLDatabase() {
17 } 18 }
18 19
19 InMemoryDatabase::~InMemoryDatabase() { 20 InMemoryDatabase::~InMemoryDatabase() {
20 } 21 }
21 22
22 bool InMemoryDatabase::InitDB() { 23 bool InMemoryDatabase::InitDB() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 85 }
85 86
86 // Copy URL data to memory. 87 // Copy URL data to memory.
87 base::TimeTicks begin_load = base::TimeTicks::Now(); 88 base::TimeTicks begin_load = base::TimeTicks::Now();
88 if (!db_.Execute( 89 if (!db_.Execute(
89 "INSERT INTO urls SELECT * FROM history.urls WHERE typed_count > 0")) { 90 "INSERT INTO urls SELECT * FROM history.urls WHERE typed_count > 0")) {
90 // Unable to get data from the history database. This is OK, the file may 91 // Unable to get data from the history database. This is OK, the file may
91 // just not exist yet. 92 // just not exist yet.
92 } 93 }
93 base::TimeTicks end_load = base::TimeTicks::Now(); 94 base::TimeTicks end_load = base::TimeTicks::Now();
94 UMA_HISTOGRAM_MEDIUM_TIMES("History.InMemoryDBPopulate", 95 UMA_HISTOGRAM_MEDIUM_TIMES(
95 end_load - begin_load); 96 "History.InMemoryDBPopulate" + HistoryFieldTrial::GetGroupSuffix(),
jar (doing other things) 2011/10/24 18:40:55 There is a nicer(?) or at least common patterns fo
brettw 2011/10/25 01:55:02 I guess that sounds worse to my thinking. Wouldn't
Scott Hess - ex-Googler 2011/10/26 21:44:59 Can you have it both ways? Old histogram for non-
jar (doing other things) 2011/10/27 00:23:55 The usual pattern is to keep the old histogram unc
97 end_load - begin_load);
96 UMA_HISTOGRAM_COUNTS("History.InMemoryDBItemCount", db_.GetLastChangeCount()); 98 UMA_HISTOGRAM_COUNTS("History.InMemoryDBItemCount", db_.GetLastChangeCount());
97 99
98 { 100 {
99 // This calculation should be fast (since it's on an in-memory DB with 101 // This calculation should be fast (since it's on an in-memory DB with
100 // an average of only 35 rows). 102 // an average of only 35 rows).
101 sql::Statement visit_count(db_.GetUniqueStatement( 103 sql::Statement visit_count(db_.GetUniqueStatement(
102 "SELECT sum(visit_count) FROM urls")); 104 "SELECT sum(visit_count) FROM urls"));
103 if (visit_count && visit_count.Step()) { 105 if (visit_count && visit_count.Step()) {
104 UMA_HISTOGRAM_COUNTS("History.InMemoryTypedUrlVisitCount", 106 UMA_HISTOGRAM_COUNTS("History.InMemoryTypedUrlVisitCount",
105 visit_count.ColumnInt(0)); 107 visit_count.ColumnInt(0));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 CreateKeywordSearchTermsIndices(); 150 CreateKeywordSearchTermsIndices();
149 151
150 return true; 152 return true;
151 } 153 }
152 154
153 sql::Connection& InMemoryDatabase::GetDB() { 155 sql::Connection& InMemoryDatabase::GetDB() {
154 return db_; 156 return db_;
155 } 157 }
156 158
157 } // namespace history 159 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698