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

Side by Side Diff: components/sync/syncable/directory_backing_store.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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
OLDNEW
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 #include <utility>
12 12
13 #include "base/base64.h" 13 #include "base/base64.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ptr_util.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 #include "base/rand_util.h" 18 #include "base/rand_util.h"
18 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/time/time.h" 22 #include "base/time/time.h"
22 #include "base/trace_event/trace_event.h" 23 #include "base/trace_event/trace_event.h"
23 #include "build/build_config.h" 24 #include "build/build_config.h"
24 #include "components/sync/base/node_ordinal.h" 25 #include "components/sync/base/node_ordinal.h"
25 #include "components/sync/base/time.h" 26 #include "components/sync/base/time.h"
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 return false; 1737 return false;
1737 } 1738 }
1738 return true; 1739 return true;
1739 } 1740 }
1740 1741
1741 bool DirectoryBackingStore::needs_column_refresh() const { 1742 bool DirectoryBackingStore::needs_column_refresh() const {
1742 return needs_metas_column_refresh_ || needs_share_info_column_refresh_; 1743 return needs_metas_column_refresh_ || needs_share_info_column_refresh_;
1743 } 1744 }
1744 1745
1745 void DirectoryBackingStore::ResetAndCreateConnection() { 1746 void DirectoryBackingStore::ResetAndCreateConnection() {
1746 db_.reset(new sql::Connection()); 1747 db_ = base::MakeUnique<sql::Connection>();
1747 db_->set_histogram_tag("SyncDirectory"); 1748 db_->set_histogram_tag("SyncDirectory");
1748 db_->set_exclusive_locking(); 1749 db_->set_exclusive_locking();
1749 db_->set_cache_size(32); 1750 db_->set_cache_size(32);
1750 db_->set_page_size(database_page_size_); 1751 db_->set_page_size(database_page_size_);
1751 1752
1752 // TODO(shess): The current mitigation for http://crbug.com/537742 stores 1753 // TODO(shess): The current mitigation for http://crbug.com/537742 stores
1753 // state in the meta table, which this database does not use. 1754 // state in the meta table, which this database does not use.
1754 db_->set_mmap_disabled(); 1755 db_->set_mmap_disabled();
1755 1756
1756 if (!catastrophic_error_handler_.is_null()) 1757 if (!catastrophic_error_handler_.is_null())
1757 SetCatastrophicErrorHandler(catastrophic_error_handler_); 1758 SetCatastrophicErrorHandler(catastrophic_error_handler_);
1758 } 1759 }
1759 1760
1760 void DirectoryBackingStore::SetCatastrophicErrorHandler( 1761 void DirectoryBackingStore::SetCatastrophicErrorHandler(
1761 const base::Closure& catastrophic_error_handler) { 1762 const base::Closure& catastrophic_error_handler) {
1762 DCHECK(CalledOnValidThread()); 1763 DCHECK(CalledOnValidThread());
1763 DCHECK(!catastrophic_error_handler.is_null()); 1764 DCHECK(!catastrophic_error_handler.is_null());
1764 catastrophic_error_handler_ = catastrophic_error_handler; 1765 catastrophic_error_handler_ = catastrophic_error_handler;
1765 sql::Connection::ErrorCallback error_callback = 1766 sql::Connection::ErrorCallback error_callback =
1766 base::Bind(&OnSqliteError, catastrophic_error_handler_); 1767 base::Bind(&OnSqliteError, catastrophic_error_handler_);
1767 db_->set_error_callback(error_callback); 1768 db_->set_error_callback(error_callback);
1768 } 1769 }
1769 1770
1770 } // namespace syncable 1771 } // namespace syncable
1771 } // namespace syncer 1772 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/model_impl/shared_model_type_processor_unittest.cc ('k') | components/sync/syncable/directory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698