Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/sync/syncable/directory_backing_store.h" | 5 #include "components/sync/syncable/directory_backing_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| 11 #include <utility> | |
| 11 | 12 |
| 12 #include "base/base64.h" | 13 #include "base/base64.h" |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
| 17 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 bool SaveEntryToDB(sql::Statement* save_statement, const EntryKernel& entry) { | 229 bool SaveEntryToDB(sql::Statement* save_statement, const EntryKernel& entry) { |
| 229 save_statement->Reset(true); | 230 save_statement->Reset(true); |
| 230 BindFields(entry, save_statement); | 231 BindFields(entry, save_statement); |
| 231 return save_statement->Run(); | 232 return save_statement->Run(); |
| 232 } | 233 } |
| 233 | 234 |
| 234 // total_specifics_copies : Total copies of entries in memory, include extra | 235 // total_specifics_copies : Total copies of entries in memory, include extra |
| 235 // copy for some entries which create by copy-on-write mechanism. | 236 // copy for some entries which create by copy-on-write mechanism. |
| 236 // entries_counts : entry counts for each model type. | 237 // entries_counts : entry counts for each model type. |
| 237 void UploadModelTypeEntryCount(const int total_specifics_copies, | 238 void UploadModelTypeEntryCount(const int total_specifics_copies, |
| 238 const int(&entries_counts)[MODEL_TYPE_COUNT]) { | 239 const int entries_counts[MODEL_TYPE_COUNT]) { |
|
maxbogue
2016/10/04 00:11:51
Wat. Was this previously accepting a reference to
skym
2016/10/04 15:57:35
Whoops, okay after Googling to try to better expla
maxbogue
2016/10/04 16:24:45
Ah, cool!
| |
| 239 int total_entry_counts = 0; | 240 int total_entry_counts = 0; |
| 240 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 241 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 241 std::string model_type; | 242 std::string model_type; |
| 242 if (RealModelTypeToNotificationType((ModelType)i, &model_type)) { | 243 if (RealModelTypeToNotificationType((ModelType)i, &model_type)) { |
| 243 std::string full_histogram_name = "Sync.ModelTypeCount." + model_type; | 244 std::string full_histogram_name = "Sync.ModelTypeCount." + model_type; |
| 244 base::HistogramBase* histogram = base::Histogram::FactoryGet( | 245 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
| 245 full_histogram_name, 1, 1000000, 50, | 246 full_histogram_name, 1, 1000000, 50, |
| 246 base::HistogramBase::kUmaTargetedHistogramFlag); | 247 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 247 if (histogram) | 248 if (histogram) |
| 248 histogram->Add(entries_counts[i]); | 249 histogram->Add(entries_counts[i]); |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1761 DCHECK(CalledOnValidThread()); | 1762 DCHECK(CalledOnValidThread()); |
| 1762 DCHECK(!catastrophic_error_handler.is_null()); | 1763 DCHECK(!catastrophic_error_handler.is_null()); |
| 1763 catastrophic_error_handler_ = catastrophic_error_handler; | 1764 catastrophic_error_handler_ = catastrophic_error_handler; |
| 1764 sql::Connection::ErrorCallback error_callback = | 1765 sql::Connection::ErrorCallback error_callback = |
| 1765 base::Bind(&OnSqliteError, catastrophic_error_handler_); | 1766 base::Bind(&OnSqliteError, catastrophic_error_handler_); |
| 1766 db_->set_error_callback(error_callback); | 1767 db_->set_error_callback(error_callback); |
| 1767 } | 1768 } |
| 1768 | 1769 |
| 1769 } // namespace syncable | 1770 } // namespace syncable |
| 1770 } // namespace syncer | 1771 } // namespace syncer |
| OLD | NEW |