OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |