| 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 #include "chrome/browser/sync/engine/syncer_thread.h" | 4 #include "chrome/browser/sync/engine/syncer_thread.h" |
| 5 | 5 |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 | 7 |
| 8 #ifdef OS_MACOSX | 8 #ifdef OS_MACOSX |
| 9 #include <CoreFoundation/CFNumber.h> | 9 #include <CoreFoundation/CFNumber.h> |
| 10 #include <IOKit/IOTypes.h> | 10 #include <IOKit/IOTypes.h> |
| 11 #include <IOKit/IOKitLib.h> | 11 #include <IOKit/IOKitLib.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <queue> | 16 #include <queue> |
| 17 | 17 |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "chrome/browser/sync/engine/auth_watcher.h" | 19 #include "chrome/browser/sync/engine/auth_watcher.h" |
| 20 #include "chrome/browser/sync/engine/model_safe_worker.h" | 20 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| 22 #include "chrome/browser/sync/engine/syncer.h" | 22 #include "chrome/browser/sync/engine/syncer.h" |
| 23 #include "chrome/browser/sync/engine/syncer_thread_pthreads.h" | |
| 24 #include "chrome/browser/sync/engine/syncer_thread_timed_stop.h" | 23 #include "chrome/browser/sync/engine/syncer_thread_timed_stop.h" |
| 25 #include "chrome/browser/sync/notifier/listener/talk_mediator.h" | 24 #include "chrome/browser/sync/notifier/listener/talk_mediator.h" |
| 26 #include "chrome/browser/sync/notifier/listener/talk_mediator_impl.h" | 25 #include "chrome/browser/sync/notifier/listener/talk_mediator_impl.h" |
| 27 #include "chrome/browser/sync/syncable/directory_manager.h" | 26 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 28 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 29 | 28 |
| 30 using std::priority_queue; | 29 using std::priority_queue; |
| 31 using std::min; | 30 using std::min; |
| 32 using base::Time; | 31 using base::Time; |
| 33 using base::TimeDelta; | 32 using base::TimeDelta; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 111 |
| 113 SyncerThread* SyncerThreadFactory::Create( | 112 SyncerThread* SyncerThreadFactory::Create( |
| 114 ClientCommandChannel* command_channel, | 113 ClientCommandChannel* command_channel, |
| 115 syncable::DirectoryManager* mgr, | 114 syncable::DirectoryManager* mgr, |
| 116 ServerConnectionManager* connection_manager, AllStatus* all_status, | 115 ServerConnectionManager* connection_manager, AllStatus* all_status, |
| 117 ModelSafeWorker* model_safe_worker) { | 116 ModelSafeWorker* model_safe_worker) { |
| 118 const CommandLine* cmd = CommandLine::ForCurrentProcess(); | 117 const CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 119 if (cmd->HasSwitch(switches::kSyncerThreadTimedStop)) { | 118 if (cmd->HasSwitch(switches::kSyncerThreadTimedStop)) { |
| 120 return new SyncerThreadTimedStop(command_channel, mgr, connection_manager, | 119 return new SyncerThreadTimedStop(command_channel, mgr, connection_manager, |
| 121 all_status, model_safe_worker); | 120 all_status, model_safe_worker); |
| 122 } else if (cmd->HasSwitch(switches::kSyncerThreadPthreads)) { | |
| 123 return new SyncerThreadPthreads(command_channel, mgr, connection_manager, | |
| 124 all_status, model_safe_worker); | |
| 125 } else { | 121 } else { |
| 126 // The default SyncerThread implementation, which does not time-out when | 122 // The default SyncerThread implementation, which does not time-out when |
| 127 // Stop is called. | 123 // Stop is called. |
| 128 return new SyncerThread(command_channel, mgr, connection_manager, | 124 return new SyncerThread(command_channel, mgr, connection_manager, |
| 129 all_status, model_safe_worker); | 125 all_status, model_safe_worker); |
| 130 } | 126 } |
| 131 } | 127 } |
| 132 | 128 |
| 133 bool SyncerThread::NudgeSyncer(int milliseconds_from_now, NudgeSource source) { | 129 bool SyncerThread::NudgeSyncer(int milliseconds_from_now, NudgeSource source) { |
| 134 AutoLock lock(lock_); | 130 AutoLock lock(lock_); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 break; | 636 break; |
| 641 } | 637 } |
| 642 | 638 |
| 643 if (NULL != vault_.syncer_) { | 639 if (NULL != vault_.syncer_) { |
| 644 vault_.syncer_->set_notifications_enabled( | 640 vault_.syncer_->set_notifications_enabled( |
| 645 p2p_authenticated_ && p2p_subscribed_); | 641 p2p_authenticated_ && p2p_subscribed_); |
| 646 } | 642 } |
| 647 } | 643 } |
| 648 | 644 |
| 649 } // namespace browser_sync | 645 } // namespace browser_sync |
| OLD | NEW |