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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 6111012: sync: avoid creating a HistoryModelWorker unless it is needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (!core_thread_.Start()) 90 if (!core_thread_.Start())
91 return; 91 return;
92 92
93 // Create a worker for the UI thread and route bookmark changes to it. 93 // Create a worker for the UI thread and route bookmark changes to it.
94 // TODO(tim): Pull this into a method to reuse. For now we don't even 94 // TODO(tim): Pull this into a method to reuse. For now we don't even
95 // need to lock because we init before the syncapi exists and we tear down 95 // need to lock because we init before the syncapi exists and we tear down
96 // after the syncapi is destroyed. Make sure to NULL-check workers_ indices 96 // after the syncapi is destroyed. Make sure to NULL-check workers_ indices
97 // when a new type is synced as the worker may already exist and you just 97 // when a new type is synced as the worker may already exist and you just
98 // need to update routing_info_. 98 // need to update routing_info_.
99 registrar_.workers[GROUP_DB] = new DatabaseModelWorker(); 99 registrar_.workers[GROUP_DB] = new DatabaseModelWorker();
100 registrar_.workers[GROUP_HISTORY] =
101 new HistoryModelWorker(
102 profile_->GetHistoryService(Profile::IMPLICIT_ACCESS));
103 registrar_.workers[GROUP_UI] = new UIModelWorker(frontend_loop_); 100 registrar_.workers[GROUP_UI] = new UIModelWorker(frontend_loop_);
104 registrar_.workers[GROUP_PASSIVE] = new ModelSafeWorker(); 101 registrar_.workers[GROUP_PASSIVE] = new ModelSafeWorker();
105 102
103 if (CommandLine::ForCurrentProcess()->HasSwitch(
104 switches::kEnableSyncTypedUrls || types.count(syncable::TYPED_URLS))) {
lipalani 2011/01/12 22:06:51 Also is this code compiling. It looks like you nee
tim (not reviewing) 2011/01/12 23:41:28 Doh. Hadn't uploaded the patch set with this fixed
105 // TODO(tim): Bug 53916. HistoryModelWorker crashes, so avoid adding it
106 // unless specifically requested until bug is fixed.
107 registrar_.workers[GROUP_HISTORY] =
108 new HistoryModelWorker(
109 profile_->GetHistoryService(Profile::IMPLICIT_ACCESS));
110 }
lipalani 2011/01/12 22:02:53 may be HasSwitch check alone is sufficient. The ty
tim (not reviewing) 2011/01/12 23:41:28 The reason for the types check is unittests. See t
lipalani 2011/01/13 00:31:46 sounds good. On 2011/01/12 23:41:28, timsteele wro
111
106 PasswordStore* password_store = 112 PasswordStore* password_store =
107 profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS); 113 profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
108 if (password_store) { 114 if (password_store) {
109 registrar_.workers[GROUP_PASSWORD] = 115 registrar_.workers[GROUP_PASSWORD] =
110 new PasswordModelWorker(password_store); 116 new PasswordModelWorker(password_store);
111 } else { 117 } else {
112 LOG(WARNING) << "Password store not initialized, cannot sync passwords"; 118 LOG(WARNING) << "Password store not initialized, cannot sync passwords";
113 } 119 }
114 120
115 // Any datatypes that we want the syncer to pull down must 121 // Any datatypes that we want the syncer to pull down must
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 } 888 }
883 889
884 void SyncBackendHost::Core::DeleteSyncDataFolder() { 890 void SyncBackendHost::Core::DeleteSyncDataFolder() {
885 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { 891 if (file_util::DirectoryExists(host_->sync_data_folder_path())) {
886 if (!file_util::Delete(host_->sync_data_folder_path(), true)) 892 if (!file_util::Delete(host_->sync_data_folder_path(), true))
887 LOG(DFATAL) << "Could not delete the Sync Data folder."; 893 LOG(DFATAL) << "Could not delete the Sync Data folder.";
888 } 894 }
889 } 895 }
890 896
891 } // namespace browser_sync 897 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698