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

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

Issue 271853004: Merge NetworkTimeNotifier to NetworkTimeTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" 11 #include "chrome/browser/invalidation/invalidation_service_factory.h"
11 #include "chrome/browser/network_time/network_time_tracker.h" 12 #include "chrome/browser/network_time/network_time_tracker.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sync/glue/sync_backend_host_core.h" 14 #include "chrome/browser/sync/glue/sync_backend_host_core.h"
14 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 15 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "components/invalidation/invalidation_service.h" 17 #include "components/invalidation/invalidation_service.h"
17 #include "components/sync_driver/sync_frontend.h" 18 #include "components/sync_driver/sync_frontend.h"
18 #include "components/sync_driver/sync_prefs.h" 19 #include "components/sync_driver/sync_prefs.h"
(...skipping 16 matching lines...) Expand all
35 // are multiple syncers involved. 36 // are multiple syncers involved.
36 37
37 #define SLOG(severity) LOG(severity) << name_ << ": " 38 #define SLOG(severity) LOG(severity) << name_ << ": "
38 39
39 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " 40 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": "
40 41
41 using syncer::InternalComponentsFactory; 42 using syncer::InternalComponentsFactory;
42 43
43 namespace browser_sync { 44 namespace browser_sync {
44 45
46 namespace {
47
48 void UpdateNetworkTimeOnUIThread(base::Time network_time,
49 base::TimeDelta resolution,
50 base::TimeDelta latency,
51 base::TimeTicks post_time) {
52 g_browser_process->network_time_tracker()->UpdateNetworkTime(
53 network_time, resolution, latency, post_time);
54 }
55
56 void UpdateNetworkTime(const base::Time& network_time,
57 const base::TimeDelta& resolution,
58 const base::TimeDelta& latency) {
59 content::BrowserThread::PostTask(
60 content::BrowserThread::UI,
61 FROM_HERE,
62 base::Bind(&UpdateNetworkTimeOnUIThread,
63 network_time, resolution, latency, base::TimeTicks::Now()));
64 }
65
66 } // namespace
67
45 SyncBackendHostImpl::SyncBackendHostImpl( 68 SyncBackendHostImpl::SyncBackendHostImpl(
46 const std::string& name, 69 const std::string& name,
47 Profile* profile, 70 Profile* profile,
48 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, 71 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
49 const base::FilePath& sync_folder) 72 const base::FilePath& sync_folder)
50 : frontend_loop_(base::MessageLoop::current()), 73 : frontend_loop_(base::MessageLoop::current()),
51 profile_(profile), 74 profile_(profile),
52 name_(name), 75 name_(name),
53 initialized_(false), 76 initialized_(false),
54 sync_prefs_(sync_prefs), 77 sync_prefs_(sync_prefs),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( 137 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions(
115 registrar_->sync_thread()->message_loop(), 138 registrar_->sync_thread()->message_loop(),
116 registrar_.get(), 139 registrar_.get(),
117 routing_info, 140 routing_info,
118 workers, 141 workers,
119 extensions_activity_monitor_.GetExtensionsActivity(), 142 extensions_activity_monitor_.GetExtensionsActivity(),
120 event_handler, 143 event_handler,
121 sync_service_url, 144 sync_service_url,
122 network_resources->GetHttpPostProviderFactory( 145 network_resources->GetHttpPostProviderFactory(
123 make_scoped_refptr(profile_->GetRequestContext()), 146 make_scoped_refptr(profile_->GetRequestContext()),
124 NetworkTimeTracker::BuildNotifierUpdateCallback(), 147 base::Bind(&UpdateNetworkTime),
125 core_->GetRequestContextCancelationSignal()), 148 core_->GetRequestContextCancelationSignal()),
126 credentials, 149 credentials,
127 invalidator_->GetInvalidatorClientId(), 150 invalidator_->GetInvalidatorClientId(),
128 sync_manager_factory.Pass(), 151 sync_manager_factory.Pass(),
129 delete_sync_data_folder, 152 delete_sync_data_folder,
130 sync_prefs_->GetEncryptionBootstrapToken(), 153 sync_prefs_->GetEncryptionBootstrapToken(),
131 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), 154 sync_prefs_->GetKeystoreEncryptionBootstrapToken(),
132 scoped_ptr<InternalComponentsFactory>( 155 scoped_ptr<InternalComponentsFactory>(
133 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), 156 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(),
134 unrecoverable_error_handler.Pass(), 157 unrecoverable_error_handler.Pass(),
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 861
839 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { 862 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() {
840 return registrar_->sync_thread()->message_loop(); 863 return registrar_->sync_thread()->message_loop();
841 } 864 }
842 865
843 } // namespace browser_sync 866 } // namespace browser_sync
844 867
845 #undef SDVLOG 868 #undef SDVLOG
846 869
847 #undef SLOG 870 #undef SLOG
848
OLDNEW
« no previous file with comments | « chrome/browser/network_time/network_time_tracker_unittest.cc ('k') | chrome/browser/upgrade_detector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698