OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/engine/syncer_thread.h" | 5 #include "chrome/browser/sync/engine/syncer_thread.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #ifdef OS_MACOSX | 9 #ifdef OS_MACOSX |
10 #include <CoreFoundation/CFNumber.h> | 10 #include <CoreFoundation/CFNumber.h> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void* RunSyncerThread(void* syncer_thread) { | 120 void* RunSyncerThread(void* syncer_thread) { |
121 return (reinterpret_cast<SyncerThread*>(syncer_thread))->ThreadMain(); | 121 return (reinterpret_cast<SyncerThread*>(syncer_thread))->ThreadMain(); |
122 } | 122 } |
123 | 123 |
124 SyncerThread::SyncerThread( | 124 SyncerThread::SyncerThread( |
125 ClientCommandChannel* command_channel, | 125 ClientCommandChannel* command_channel, |
126 syncable::DirectoryManager* mgr, | 126 syncable::DirectoryManager* mgr, |
127 ServerConnectionManager* connection_manager, | 127 ServerConnectionManager* connection_manager, |
128 AllStatus* all_status, | 128 AllStatus* all_status, |
129 ModelSafeWorker* model_safe_worker) | 129 ModelSafeWorker* model_safe_worker) |
130 : dirman_(mgr), scm_(connection_manager), | 130 : stop_syncer_thread_(false), |
131 syncer_(NULL), syncer_events_(NULL), thread_running_(false), | 131 thread_running_(false), |
| 132 connected_(false), |
| 133 p2p_authenticated_(false), |
| 134 p2p_subscribed_(false), |
| 135 client_command_hookup_(NULL), |
| 136 conn_mgr_hookup_(NULL), |
| 137 allstatus_(all_status), |
| 138 syncer_(NULL), |
| 139 dirman_(mgr), |
| 140 scm_(connection_manager), |
132 syncer_short_poll_interval_seconds_(kDefaultShortPollIntervalSeconds), | 141 syncer_short_poll_interval_seconds_(kDefaultShortPollIntervalSeconds), |
133 syncer_long_poll_interval_seconds_(kDefaultLongPollIntervalSeconds), | 142 syncer_long_poll_interval_seconds_(kDefaultLongPollIntervalSeconds), |
134 syncer_polling_interval_(kDefaultShortPollIntervalSeconds), | 143 syncer_polling_interval_(kDefaultShortPollIntervalSeconds), |
135 syncer_max_interval_(kDefaultMaxPollIntervalMs), | 144 syncer_max_interval_(kDefaultMaxPollIntervalMs), |
136 stop_syncer_thread_(false), connected_(false), conn_mgr_hookup_(NULL), | 145 talk_mediator_hookup_(NULL), |
137 p2p_authenticated_(false), p2p_subscribed_(false), | 146 command_channel_(command_channel), |
138 allstatus_(all_status), talk_mediator_hookup_(NULL), | 147 directory_manager_hookup_(NULL), |
139 command_channel_(command_channel), directory_manager_hookup_(NULL), | 148 syncer_events_(NULL), |
140 model_safe_worker_(model_safe_worker), | 149 model_safe_worker_(model_safe_worker), |
141 client_command_hookup_(NULL), disable_idle_detection_(false) { | 150 disable_idle_detection_(false) { |
142 | 151 |
143 SyncerEvent shutdown = { SyncerEvent::SHUTDOWN_USE_WITH_CARE }; | 152 SyncerEvent shutdown = { SyncerEvent::SHUTDOWN_USE_WITH_CARE }; |
144 syncer_event_channel_.reset(new SyncerEventChannel(shutdown)); | 153 syncer_event_channel_.reset(new SyncerEventChannel(shutdown)); |
145 | 154 |
146 if (dirman_) { | 155 if (dirman_) { |
147 directory_manager_hookup_.reset(NewEventListenerHookup( | 156 directory_manager_hookup_.reset(NewEventListenerHookup( |
148 dirman_->channel(), this, &SyncerThread::HandleDirectoryManagerEvent)); | 157 dirman_->channel(), this, &SyncerThread::HandleDirectoryManagerEvent)); |
149 } | 158 } |
150 | 159 |
151 if (scm_) { | 160 if (scm_) { |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 default: | 559 default: |
551 break; | 560 break; |
552 } | 561 } |
553 | 562 |
554 if (NULL != syncer_) { | 563 if (NULL != syncer_) { |
555 syncer_->set_notifications_enabled(p2p_authenticated_ && p2p_subscribed_); | 564 syncer_->set_notifications_enabled(p2p_authenticated_ && p2p_subscribed_); |
556 } | 565 } |
557 } | 566 } |
558 | 567 |
559 } // namespace browser_sync | 568 } // namespace browser_sync |
OLD | NEW |