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

Side by Side Diff: sql/connection.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « printing/emf_win_unittest.cc ('k') | sql/test/test_helpers.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) 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 "sql/connection.h" 5 #include "sql/connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 poisoned_(false) { 206 poisoned_(false) {
207 } 207 }
208 208
209 Connection::~Connection() { 209 Connection::~Connection() {
210 Close(); 210 Close();
211 } 211 }
212 212
213 bool Connection::Open(const base::FilePath& path) { 213 bool Connection::Open(const base::FilePath& path) {
214 if (!histogram_tag_.empty()) { 214 if (!histogram_tag_.empty()) {
215 int64 size_64 = 0; 215 int64 size_64 = 0;
216 if (file_util::GetFileSize(path, &size_64)) { 216 if (base::GetFileSize(path, &size_64)) {
217 size_t sample = static_cast<size_t>(size_64 / 1024); 217 size_t sample = static_cast<size_t>(size_64 / 1024);
218 std::string full_histogram_name = "Sqlite.SizeKB." + histogram_tag_; 218 std::string full_histogram_name = "Sqlite.SizeKB." + histogram_tag_;
219 base::HistogramBase* histogram = 219 base::HistogramBase* histogram =
220 base::Histogram::FactoryGet( 220 base::Histogram::FactoryGet(
221 full_histogram_name, 1, 1000000, 50, 221 full_histogram_name, 1, 1000000, 50,
222 base::HistogramBase::kUmaTargetedHistogramFlag); 222 base::HistogramBase::kUmaTargetedHistogramFlag);
223 if (histogram) 223 if (histogram)
224 histogram->Add(sample); 224 histogram->Add(sample);
225 } 225 }
226 } 226 }
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } 1079 }
1080 1080
1081 // Best effort to put things back as they were before. 1081 // Best effort to put things back as they were before.
1082 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; 1082 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF";
1083 ignore_result(Execute(kNoWritableSchema)); 1083 ignore_result(Execute(kNoWritableSchema));
1084 1084
1085 return ret; 1085 return ret;
1086 } 1086 }
1087 1087
1088 } // namespace sql 1088 } // namespace sql
OLDNEW
« no previous file with comments | « printing/emf_win_unittest.cc ('k') | sql/test/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698