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 "sync/internal_api/sync_manager_impl.h" | 5 #include "sync/internal_api/sync_manager_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/thread_task_runner_handle.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
19 #include "sync/engine/sync_scheduler.h" | 20 #include "sync/engine/sync_scheduler.h" |
20 #include "sync/engine/syncer_types.h" | 21 #include "sync/engine/syncer_types.h" |
21 #include "sync/internal_api/change_reorder_buffer.h" | 22 #include "sync/internal_api/change_reorder_buffer.h" |
22 #include "sync/internal_api/public/base/cancelation_signal.h" | 23 #include "sync/internal_api/public/base/cancelation_signal.h" |
23 #include "sync/internal_api/public/base/invalidation_interface.h" | 24 #include "sync/internal_api/public/base/invalidation_interface.h" |
24 #include "sync/internal_api/public/base/model_type.h" | 25 #include "sync/internal_api/public/base/model_type.h" |
25 #include "sync/internal_api/public/base_node.h" | 26 #include "sync/internal_api/public/base_node.h" |
26 #include "sync/internal_api/public/configure_reason.h" | 27 #include "sync/internal_api/public/configure_reason.h" |
27 #include "sync/internal_api/public/engine/polling_constants.h" | 28 #include "sync/internal_api/public/engine/polling_constants.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 allstatus_.SetInvalidatorClientId(invalidator_client_id); | 397 allstatus_.SetInvalidatorClientId(invalidator_client_id); |
397 | 398 |
398 model_type_registry_.reset(new ModelTypeRegistry(workers, directory())); | 399 model_type_registry_.reset(new ModelTypeRegistry(workers, directory())); |
399 | 400 |
400 // Bind the SyncContext WeakPtr to this thread. This helps us crash earlier | 401 // Bind the SyncContext WeakPtr to this thread. This helps us crash earlier |
401 // if the pointer is misused in debug mode. | 402 // if the pointer is misused in debug mode. |
402 base::WeakPtr<SyncContext> weak_core = model_type_registry_->AsWeakPtr(); | 403 base::WeakPtr<SyncContext> weak_core = model_type_registry_->AsWeakPtr(); |
403 weak_core.get(); | 404 weak_core.get(); |
404 | 405 |
405 sync_context_proxy_.reset( | 406 sync_context_proxy_.reset( |
406 new SyncContextProxyImpl(base::MessageLoopProxy::current(), weak_core)); | 407 new SyncContextProxyImpl(base::ThreadTaskRunnerHandle::Get(), weak_core)); |
407 | 408 |
408 // Build a SyncSessionContext and store the worker in it. | 409 // Build a SyncSessionContext and store the worker in it. |
409 DVLOG(1) << "Sync is bringing up SyncSessionContext."; | 410 DVLOG(1) << "Sync is bringing up SyncSessionContext."; |
410 std::vector<SyncEngineEventListener*> listeners; | 411 std::vector<SyncEngineEventListener*> listeners; |
411 listeners.push_back(&allstatus_); | 412 listeners.push_back(&allstatus_); |
412 listeners.push_back(this); | 413 listeners.push_back(this); |
413 session_context_ = internal_components_factory->BuildContext( | 414 session_context_ = internal_components_factory->BuildContext( |
414 connection_manager_.get(), | 415 connection_manager_.get(), |
415 directory(), | 416 directory(), |
416 extensions_activity, | 417 extensions_activity, |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1136 int SyncManagerImpl::GetDefaultNudgeDelay() { |
1136 return kDefaultNudgeDelayMilliseconds; | 1137 return kDefaultNudgeDelayMilliseconds; |
1137 } | 1138 } |
1138 | 1139 |
1139 // static. | 1140 // static. |
1140 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1141 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
1141 return kPreferencesNudgeDelayMilliseconds; | 1142 return kPreferencesNudgeDelayMilliseconds; |
1142 } | 1143 } |
1143 | 1144 |
1144 } // namespace syncer | 1145 } // namespace syncer |
OLD | NEW |