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

Side by Side Diff: chrome/browser/chromeos/contacts/contact_database.cc

Issue 16950027: Move ComputeDirectorySize to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 6 months 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) 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 "chrome/browser/chromeos/contacts/contact_database.h" 5 #include "chrome/browser/chromeos/contacts/contact_database.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 callback.Run(*success, contacts.Pass(), metadata.Pass()); 168 callback.Run(*success, contacts.Pass(), metadata.Pass());
169 } 169 }
170 170
171 void ContactDatabase::InitFromTaskRunner(const base::FilePath& database_dir, 171 void ContactDatabase::InitFromTaskRunner(const base::FilePath& database_dir,
172 bool* success) { 172 bool* success) {
173 DCHECK(IsRunByTaskRunner()); 173 DCHECK(IsRunByTaskRunner());
174 DCHECK(success); 174 DCHECK(success);
175 175
176 VLOG(1) << "Opening " << database_dir.value(); 176 VLOG(1) << "Opening " << database_dir.value();
177 UMA_HISTOGRAM_MEMORY_KB("Contacts.DatabaseSizeBytes", 177 UMA_HISTOGRAM_MEMORY_KB("Contacts.DatabaseSizeBytes",
178 file_util::ComputeDirectorySize(database_dir)); 178 base::ComputeDirectorySize(database_dir));
179 *success = false; 179 *success = false;
180 HistogramInitResult histogram_result = HISTOGRAM_INIT_RESULT_SUCCESS; 180 HistogramInitResult histogram_result = HISTOGRAM_INIT_RESULT_SUCCESS;
181 181
182 leveldb::Options options; 182 leveldb::Options options;
183 options.create_if_missing = true; 183 options.create_if_missing = true;
184 bool delete_and_retry_on_corruption = true; 184 bool delete_and_retry_on_corruption = true;
185 185
186 while (true) { 186 while (true) {
187 leveldb::DB* db = NULL; 187 leveldb::DB* db = NULL;
188 leveldb::Status status = 188 leveldb::Status status =
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 db_iterator->Next(); 333 db_iterator->Next();
334 } 334 }
335 335
336 *success = true; 336 *success = true;
337 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseLoadResult", 337 UMA_HISTOGRAM_ENUMERATION("Contacts.DatabaseLoadResult",
338 HISTOGRAM_LOAD_RESULT_SUCCESS, 338 HISTOGRAM_LOAD_RESULT_SUCCESS,
339 HISTOGRAM_LOAD_RESULT_MAX_VALUE); 339 HISTOGRAM_LOAD_RESULT_MAX_VALUE);
340 } 340 }
341 341
342 } // namespace contacts 342 } // namespace contacts
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698