summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS3
-rw-r--r--chrome/browser/sync/engine/syncer_thread.cc4
-rw-r--r--chrome/browser/sync/engine/syncer_thread_pthreads.cc582
-rw-r--r--chrome/browser/sync/engine/syncer_thread_pthreads.h284
-rw-r--r--chrome/browser/sync/util/compat_pthread.h22
-rw-r--r--chrome/browser/sync/util/pthread_helpers.cc162
-rw-r--r--chrome/browser/sync/util/pthread_helpers.h133
-rw-r--r--chrome/browser/sync/util/pthread_helpers_fwd.h13
-rwxr-xr-xchrome/chrome.gyp25
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/installer/mini_installer/chrome.release1
-rw-r--r--chrome/tools/build/win/FILES2
13 files changed, 1 insertions, 1235 deletions
diff --git a/DEPS b/DEPS
index 2946e88..880bef9 100644
--- a/DEPS
+++ b/DEPS
@@ -107,9 +107,6 @@ deps_os = {
"src/third_party/ffmpeg/binaries/chromium/win/ia32":
"/trunk/deps/third_party/ffmpeg/binaries/win@" + Var("ffmpeg_revision"),
- "src/third_party/pthreads-win32":
- "/trunk/deps/third_party/pthreads-win32@26716",
-
# Chrome Frame related deps
"src/third_party/xulrunner-sdk":
"/trunk/deps/third_party/xulrunner-sdk@17887",
diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc
index 0ef436b..478e0f7 100644
--- a/chrome/browser/sync/engine/syncer_thread.cc
+++ b/chrome/browser/sync/engine/syncer_thread.cc
@@ -20,7 +20,6 @@
#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/engine/net/server_connection_manager.h"
#include "chrome/browser/sync/engine/syncer.h"
-#include "chrome/browser/sync/engine/syncer_thread_pthreads.h"
#include "chrome/browser/sync/engine/syncer_thread_timed_stop.h"
#include "chrome/browser/sync/notifier/listener/talk_mediator.h"
#include "chrome/browser/sync/notifier/listener/talk_mediator_impl.h"
@@ -119,9 +118,6 @@ SyncerThread* SyncerThreadFactory::Create(
if (cmd->HasSwitch(switches::kSyncerThreadTimedStop)) {
return new SyncerThreadTimedStop(command_channel, mgr, connection_manager,
all_status, model_safe_worker);
- } else if (cmd->HasSwitch(switches::kSyncerThreadPthreads)) {
- return new SyncerThreadPthreads(command_channel, mgr, connection_manager,
- all_status, model_safe_worker);
} else {
// The default SyncerThread implementation, which does not time-out when
// Stop is called.
diff --git a/chrome/browser/sync/engine/syncer_thread_pthreads.cc b/chrome/browser/sync/engine/syncer_thread_pthreads.cc
deleted file mode 100644
index 4088694..0000000
--- a/chrome/browser/sync/engine/syncer_thread_pthreads.cc
+++ /dev/null
@@ -1,582 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include "chrome/browser/sync/engine/syncer_thread_pthreads.h"
-
-#include "build/build_config.h"
-
-#ifdef OS_MACOSX
-#include <CoreFoundation/CFNumber.h>
-#include <IOKit/IOTypes.h>
-#include <IOKit/IOKitLib.h>
-#endif
-
-#include <algorithm>
-#include <map>
-#include <queue>
-
-#include "chrome/browser/sync/engine/auth_watcher.h"
-#include "chrome/browser/sync/engine/model_safe_worker.h"
-#include "chrome/browser/sync/engine/net/server_connection_manager.h"
-#include "chrome/browser/sync/engine/syncer.h"
-#include "chrome/browser/sync/notifier/listener/talk_mediator.h"
-#include "chrome/browser/sync/notifier/listener/talk_mediator_impl.h"
-#include "chrome/browser/sync/syncable/directory_manager.h"
-
-using std::priority_queue;
-using std::min;
-
-static inline bool operator < (const timespec& a, const timespec& b) {
- return a.tv_sec == b.tv_sec ? a.tv_nsec < b.tv_nsec : a.tv_sec < b.tv_sec;
-}
-
-namespace {
-
-// Returns the amount of time since the user last interacted with the computer,
-// in milliseconds
-int UserIdleTime() {
-#ifdef OS_WIN
- LASTINPUTINFO last_input_info;
- last_input_info.cbSize = sizeof(LASTINPUTINFO);
-
- // Get time in windows ticks since system start of last activity.
- BOOL b = ::GetLastInputInfo(&last_input_info);
- if (b == TRUE)
- return ::GetTickCount() - last_input_info.dwTime;
-#elif defined(OS_MACOSX)
- // It would be great to do something like:
- //
- // return 1000 *
- // CGEventSourceSecondsSinceLastEventType(
- // kCGEventSourceStateCombinedSessionState,
- // kCGAnyInputEventType);
- //
- // Unfortunately, CGEvent* lives in ApplicationServices, and we're a daemon
- // and can't link that high up the food chain. Thus this mucking in IOKit.
-
- io_service_t hid_service =
- IOServiceGetMatchingService(kIOMasterPortDefault,
- IOServiceMatching("IOHIDSystem"));
- if (!hid_service) {
- LOG(WARNING) << "Could not obtain IOHIDSystem";
- return 0;
- }
-
- CFTypeRef object = IORegistryEntryCreateCFProperty(hid_service,
- CFSTR("HIDIdleTime"),
- kCFAllocatorDefault,
- 0);
- if (!object) {
- LOG(WARNING) << "Could not get IOHIDSystem's HIDIdleTime property";
- IOObjectRelease(hid_service);
- return 0;
- }
-
- int64 idle_time; // in nanoseconds
- Boolean success;
- if (CFGetTypeID(object) == CFNumberGetTypeID()) {
- success = CFNumberGetValue((CFNumberRef)object,
- kCFNumberSInt64Type,
- &idle_time);
- } else {
- LOG(WARNING) << "IOHIDSystem's HIDIdleTime property isn't a number!";
- }
-
- CFRelease(object);
- IOObjectRelease(hid_service);
-
- if (!success) {
- LOG(WARNING) << "Could not get IOHIDSystem's HIDIdleTime property's value";
- return 0;
- } else {
- return idle_time / 1000000; // nano to milli
- }
-#else
- static bool was_logged = false;
- if (!was_logged) {
- was_logged = true;
- LOG(INFO) << "UserIdleTime unimplemented on this platform, "
- "synchronization will not throttle when user idle";
- }
-#endif
-
- return 0;
-}
-
-} // namespace
-
-namespace browser_sync {
-
-SyncerThreadPthreads::SyncerThreadPthreads(
- ClientCommandChannel* command_channel,
- syncable::DirectoryManager* mgr,
- ServerConnectionManager* connection_manager,
- AllStatus* all_status, ModelSafeWorker* model_safe_worker)
- : SyncerThread() {
- impl_.reset(new SyncerThreadPthreadImpl(command_channel, mgr,
- connection_manager, all_status, model_safe_worker));
-}
-
-bool SyncerThreadPthreadImpl::NudgeSyncer(int milliseconds_from_now,
- SyncerThread::NudgeSource source) {
- MutexLock lock(&mutex_);
- if (syncer_ == NULL) {
- return false;
- }
- NudgeSyncImpl(milliseconds_from_now, source);
- return true;
-}
-
-void* RunSyncerThread(void* syncer_thread) {
- return (reinterpret_cast<SyncerThreadPthreadImpl*>(
- syncer_thread))->ThreadMain();
-}
-
-SyncerThreadPthreadImpl::SyncerThreadPthreadImpl(
- ClientCommandChannel* command_channel,
- syncable::DirectoryManager* mgr,
- ServerConnectionManager* connection_manager,
- AllStatus* all_status,
- ModelSafeWorker* model_safe_worker)
- : stop_syncer_thread_(false),
- thread_running_(false),
- connected_(false),
- p2p_authenticated_(false),
- p2p_subscribed_(false),
- allstatus_(all_status),
- syncer_(NULL),
- dirman_(mgr),
- scm_(connection_manager),
- syncer_short_poll_interval_seconds_(
- SyncerThread::kDefaultShortPollIntervalSeconds),
- syncer_long_poll_interval_seconds_(
- SyncerThread::kDefaultLongPollIntervalSeconds),
- syncer_polling_interval_(SyncerThread::kDefaultShortPollIntervalSeconds),
- syncer_max_interval_(SyncerThread::kDefaultMaxPollIntervalMs),
- command_channel_(command_channel),
- model_safe_worker_(model_safe_worker),
- disable_idle_detection_(false) {
-
- SyncerEvent shutdown = { SyncerEvent::SHUTDOWN_USE_WITH_CARE };
- syncer_event_channel_.reset(new SyncerEventChannel(shutdown));
-
- if (dirman_) {
- directory_manager_hookup_.reset(NewEventListenerHookup(
- dirman_->channel(), this,
- &SyncerThreadPthreadImpl::HandleDirectoryManagerEvent));
- }
-
- if (scm_) {
- WatchConnectionManager(scm_);
- }
-
- if (command_channel_) {
- WatchClientCommands(command_channel_);
- }
-}
-
-SyncerThreadPthreadImpl::~SyncerThreadPthreadImpl() {
- client_command_hookup_.reset();
- conn_mgr_hookup_.reset();
- syncer_event_channel_.reset();
- directory_manager_hookup_.reset();
- syncer_events_.reset();
- delete syncer_;
- talk_mediator_hookup_.reset();
- CHECK(!thread_running_);
-}
-
-// Creates and starts a syncer thread.
-// Returns true if it creates a thread or if there's currently a thread running
-// and false otherwise.
-bool SyncerThreadPthreadImpl::Start() {
- MutexLock lock(&mutex_);
- if (thread_running_) {
- return true;
- }
- thread_running_ =
- (0 == pthread_create(&thread_, NULL, RunSyncerThread, this));
- if (thread_running_) {
- pthread_detach(thread_);
- }
- return thread_running_;
-}
-
-// Stop processing. A max wait of at least 2*server RTT time is recommended.
-// Returns true if we stopped, false otherwise.
-bool SyncerThreadPthreadImpl::Stop(int max_wait) {
- MutexLock lock(&mutex_);
- if (!thread_running_)
- return true;
- stop_syncer_thread_ = true;
- if (NULL != syncer_) {
- // Try to early exit the syncer.
- syncer_->RequestEarlyExit();
- }
- pthread_cond_broadcast(&changed_.condvar_);
- timespec deadline = { time(NULL) + (max_wait / 1000), 0 };
- do {
- const int wait_result = max_wait < 0 ?
- pthread_cond_wait(&changed_.condvar_, &mutex_.mutex_) :
- pthread_cond_timedwait(&changed_.condvar_, &mutex_.mutex_,
- &deadline);
- if (ETIMEDOUT == wait_result) {
- LOG(ERROR) << "SyncerThread::Stop timed out. Problems likely.";
- return false;
- }
- } while (thread_running_);
- return true;
-}
-
-void SyncerThreadPthreadImpl::WatchClientCommands(
- ClientCommandChannel* channel) {
- PThreadScopedLock<PThreadMutex> lock(&mutex_);
- client_command_hookup_.reset(NewEventListenerHookup(channel, this,
- &SyncerThreadPthreadImpl::HandleClientCommand));
-}
-
-void SyncerThreadPthreadImpl::HandleClientCommand(
- ClientCommandChannel::EventType event) {
- if (!event) {
- return;
- }
-
- // Mutex not really necessary for these.
- if (event->has_set_sync_poll_interval()) {
- syncer_short_poll_interval_seconds_ = event->set_sync_poll_interval();
- }
-
- if (event->has_set_sync_long_poll_interval()) {
- syncer_long_poll_interval_seconds_ = event->set_sync_long_poll_interval();
- }
-}
-
-void SyncerThreadPthreadImpl::ThreadMainLoop() {
- // Use the short poll value by default.
- int poll_seconds = syncer_short_poll_interval_seconds_;
- int user_idle_milliseconds = 0;
- timespec last_sync_time = { 0 };
- bool initial_sync_for_thread = true;
- bool continue_sync_cycle = false;
-
- while (!stop_syncer_thread_) {
- if (!connected_) {
- LOG(INFO) << "Syncer thread waiting for connection.";
- while (!connected_ && !stop_syncer_thread_)
- pthread_cond_wait(&changed_.condvar_, &mutex_.mutex_);
- LOG_IF(INFO, connected_) << "Syncer thread found connection.";
- continue;
- }
-
- if (syncer_ == NULL) {
- LOG(INFO) << "Syncer thread waiting for database initialization.";
- while (syncer_ == NULL && !stop_syncer_thread_)
- pthread_cond_wait(&changed_.condvar_, &mutex_.mutex_);
- LOG_IF(INFO, !(syncer_ == NULL)) << "Syncer was found after DB started.";
- continue;
- }
-
- timespec const next_poll = { last_sync_time.tv_sec + poll_seconds,
- last_sync_time.tv_nsec };
- const timespec wake_time =
- !nudge_queue_.empty() && nudge_queue_.top().first < next_poll ?
- nudge_queue_.top().first : next_poll;
- LOG(INFO) << "wake time is " << wake_time.tv_sec;
- LOG(INFO) << "next poll is " << next_poll.tv_sec;
-
- const int error = pthread_cond_timedwait(&changed_.condvar_, &mutex_.mutex_,
- &wake_time);
- if (ETIMEDOUT != error) {
- continue; // Check all the conditions again.
- }
-
- const timespec now = GetPThreadAbsoluteTime(0);
-
- // Handle a nudge, caused by either a notification or a local bookmark
- // event. This will also update the source of the following SyncMain call.
- UpdateNudgeSource(now, &continue_sync_cycle, &initial_sync_for_thread);
-
- LOG(INFO) << "Calling Sync Main at time " << now.tv_sec;
- SyncMain(syncer_);
- last_sync_time = now;
-
- LOG(INFO) << "Updating the next polling time after SyncMain";
- poll_seconds = CalculatePollingWaitTime(allstatus_->status(),
- poll_seconds,
- &user_idle_milliseconds,
- &continue_sync_cycle);
- }
-}
-
-// We check how long the user's been idle and sync less often if the machine is
-// not in use. The aim is to reduce server load.
-int SyncerThreadPthreadImpl::CalculatePollingWaitTime(
- const AllStatus::Status& status,
- int last_poll_wait, // in s
- int* user_idle_milliseconds,
- bool* continue_sync_cycle) {
- bool is_continuing_sync_cyle = *continue_sync_cycle;
- *continue_sync_cycle = false;
-
- // Determine if the syncer has unfinished work to do from allstatus_.
- const bool syncer_has_work_to_do =
- status.updates_available > status.updates_received
- || status.unsynced_count > 0;
- LOG(INFO) << "syncer_has_work_to_do is " << syncer_has_work_to_do;
-
- // First calculate the expected wait time, figuring in any backoff because of
- // user idle time. next_wait is in seconds
- syncer_polling_interval_ = (!status.notifications_enabled) ?
- syncer_short_poll_interval_seconds_ :
- syncer_long_poll_interval_seconds_;
- int default_next_wait = syncer_polling_interval_;
- int actual_next_wait = default_next_wait;
-
- if (syncer_has_work_to_do) {
- // Provide exponential backoff due to consecutive errors, else attempt to
- // complete the work as soon as possible.
- if (!is_continuing_sync_cyle) {
- actual_next_wait = AllStatus::GetRecommendedDelaySeconds(0);
- } else {
- actual_next_wait = AllStatus::GetRecommendedDelaySeconds(last_poll_wait);
- }
- *continue_sync_cycle = true;
- } else if (!status.notifications_enabled) {
- // Ensure that we start exponential backoff from our base polling
- // interval when we are not continuing a sync cycle.
- last_poll_wait = std::max(last_poll_wait, syncer_polling_interval_);
-
- // Did the user start interacting with the computer again?
- // If so, revise our idle time (and probably next_sync_time) downwards
- int new_idle_time = disable_idle_detection_ ? 0 : UserIdleTime();
- if (new_idle_time < *user_idle_milliseconds) {
- *user_idle_milliseconds = new_idle_time;
- }
- actual_next_wait = CalculateSyncWaitTime(last_poll_wait * 1000,
- *user_idle_milliseconds) / 1000;
- DCHECK_GE(actual_next_wait, default_next_wait);
- }
-
- LOG(INFO) << "Sync wait: idle " << default_next_wait
- << " non-idle or backoff " << actual_next_wait << ".";
-
- return actual_next_wait;
-}
-
-void* SyncerThreadPthreadImpl::ThreadMain() {
- NameCurrentThreadForDebugging("SyncEngine_SyncerThread");
- mutex_.Lock();
- ThreadMainLoop();
- thread_running_ = false;
- pthread_cond_broadcast(&changed_.condvar_);
- mutex_.Unlock();
- LOG(INFO) << "Syncer thread exiting.";
- return 0;
-}
-
-void SyncerThreadPthreadImpl::SyncMain(Syncer* syncer) {
- CHECK(syncer);
- mutex_.Unlock();
- while (syncer->SyncShare()) {
- LOG(INFO) << "Looping in sync share";
- }
- LOG(INFO) << "Done looping in sync share";
-
- mutex_.Lock();
-}
-
-void SyncerThreadPthreadImpl::UpdateNudgeSource(const timespec& now,
- bool* continue_sync_cycle,
- bool* initial_sync) {
- bool nudged = false;
- SyncerThread::NudgeSource nudge_source = SyncerThread::kUnknown;
- // Has the previous sync cycle completed?
- if (continue_sync_cycle) {
- nudge_source = SyncerThread::kContinuation;
- }
- // Update the nudge source if a new nudge has come through during the
- // previous sync cycle.
- while (!nudge_queue_.empty() && !(now < nudge_queue_.top().first)) {
- if (!nudged) {
- nudge_source = nudge_queue_.top().second;
- *continue_sync_cycle = false; // Reset the continuation token on nudge.
- nudged = true;
- }
- nudge_queue_.pop();
- }
- SetUpdatesSource(nudged, nudge_source, initial_sync);
-}
-
-void SyncerThreadPthreadImpl::SetUpdatesSource(bool nudged,
- SyncerThread::NudgeSource nudge_source, bool* initial_sync) {
- sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE updates_source =
- sync_pb::GetUpdatesCallerInfo::UNKNOWN;
- if (*initial_sync) {
- updates_source = sync_pb::GetUpdatesCallerInfo::FIRST_UPDATE;
- *initial_sync = false;
- } else if (!nudged) {
- updates_source = sync_pb::GetUpdatesCallerInfo::PERIODIC;
- } else {
- switch (nudge_source) {
- case SyncerThread::kNotification:
- updates_source = sync_pb::GetUpdatesCallerInfo::NOTIFICATION;
- break;
- case SyncerThread::kLocal:
- updates_source = sync_pb::GetUpdatesCallerInfo::LOCAL;
- break;
- case SyncerThread::kContinuation:
- updates_source = sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION;
- break;
- case SyncerThread::kUnknown:
- default:
- updates_source = sync_pb::GetUpdatesCallerInfo::UNKNOWN;
- break;
- }
- }
- syncer_->set_updates_source(updates_source);
-}
-
-void SyncerThreadPthreadImpl::HandleSyncerEvent(const SyncerEvent& event) {
- MutexLock lock(&mutex_);
- channel()->NotifyListeners(event);
- if (SyncerEvent::REQUEST_SYNC_NUDGE != event.what_happened) {
- return;
- }
- NudgeSyncImpl(event.nudge_delay_milliseconds, SyncerThread::kUnknown);
-}
-
-void SyncerThreadPthreadImpl::HandleDirectoryManagerEvent(
- const syncable::DirectoryManagerEvent& event) {
- LOG(INFO) << "Handling a directory manager event";
- if (syncable::DirectoryManagerEvent::OPENED == event.what_happened) {
- MutexLock lock(&mutex_);
- LOG(INFO) << "Syncer starting up for: " << event.dirname;
- // The underlying database structure is ready, and we should create
- // the syncer.
- CHECK(syncer_ == NULL);
- syncer_ =
- new Syncer(dirman_, event.dirname, scm_, model_safe_worker_.get());
-
- syncer_->set_command_channel(command_channel_);
- syncer_events_.reset(NewEventListenerHookup(
- syncer_->channel(), this, &SyncerThreadPthreadImpl::HandleSyncerEvent));
- pthread_cond_broadcast(&changed_.condvar_);
- }
-}
-
-static inline void CheckConnected(bool* connected,
- HttpResponse::ServerConnectionCode code,
- pthread_cond_t* condvar) {
- if (*connected) {
- if (HttpResponse::CONNECTION_UNAVAILABLE == code) {
- *connected = false;
- pthread_cond_broadcast(condvar);
- }
- } else {
- if (HttpResponse::SERVER_CONNECTION_OK == code) {
- *connected = true;
- pthread_cond_broadcast(condvar);
- }
- }
-}
-
-void SyncerThreadPthreadImpl::WatchConnectionManager(
- ServerConnectionManager* conn_mgr) {
- conn_mgr_hookup_.reset(NewEventListenerHookup(conn_mgr->channel(), this,
- &SyncerThreadPthreadImpl::HandleServerConnectionEvent));
- CheckConnected(&connected_, conn_mgr->server_status(),
- &changed_.condvar_);
-}
-
-void SyncerThreadPthreadImpl::HandleServerConnectionEvent(
- const ServerConnectionEvent& event) {
- if (ServerConnectionEvent::STATUS_CHANGED == event.what_happened) {
- MutexLock lock(&mutex_);
- CheckConnected(&connected_, event.connection_code,
- &changed_.condvar_);
- }
-}
-
-SyncerEventChannel* SyncerThreadPthreadImpl::channel() {
- return syncer_event_channel_.get();
-}
-
-// Inputs and return value in milliseconds.
-int SyncerThreadPthreadImpl::CalculateSyncWaitTime(int last_interval,
- int user_idle_ms) {
- // syncer_polling_interval_ is in seconds
- int syncer_polling_interval_ms = syncer_polling_interval_ * 1000;
-
- // This is our default and lower bound.
- int next_wait = syncer_polling_interval_ms;
-
- // Get idle time, bounded by max wait.
- int idle = min(user_idle_ms, syncer_max_interval_);
-
- // If the user has been idle for a while, we'll start decreasing the poll
- // rate.
- if (idle >= kPollBackoffThresholdMultiplier * syncer_polling_interval_ms) {
- next_wait = std::min(AllStatus::GetRecommendedDelaySeconds(
- last_interval / 1000), syncer_max_interval_ / 1000) * 1000;
- }
-
- return next_wait;
-}
-
-// Called with mutex_ already locked.
-void SyncerThreadPthreadImpl::NudgeSyncImpl(int milliseconds_from_now,
- SyncerThread::NudgeSource source) {
- const timespec nudge_time = GetPThreadAbsoluteTime(milliseconds_from_now);
- NudgeObject nudge_object(nudge_time, source);
- nudge_queue_.push(nudge_object);
- pthread_cond_broadcast(&changed_.condvar_);
-}
-
-void SyncerThreadPthreadImpl::WatchTalkMediator(TalkMediator* mediator) {
- talk_mediator_hookup_.reset(
- NewEventListenerHookup(
- mediator->channel(),
- this,
- &SyncerThreadPthreadImpl::HandleTalkMediatorEvent));
-}
-
-void SyncerThreadPthreadImpl::HandleTalkMediatorEvent(
- const TalkMediatorEvent& event) {
- MutexLock lock(&mutex_);
- switch (event.what_happened) {
- case TalkMediatorEvent::LOGIN_SUCCEEDED:
- LOG(INFO) << "P2P: Login succeeded.";
- p2p_authenticated_ = true;
- break;
- case TalkMediatorEvent::LOGOUT_SUCCEEDED:
- LOG(INFO) << "P2P: Login succeeded.";
- p2p_authenticated_ = false;
- break;
- case TalkMediatorEvent::SUBSCRIPTIONS_ON:
- LOG(INFO) << "P2P: Subscriptions successfully enabled.";
- p2p_subscribed_ = true;
- if (NULL != syncer_) {
- LOG(INFO) << "Subscriptions on. Nudging syncer for initial push.";
- NudgeSyncImpl(0, SyncerThread::kLocal);
- }
- break;
- case TalkMediatorEvent::SUBSCRIPTIONS_OFF:
- LOG(INFO) << "P2P: Subscriptions are not enabled.";
- p2p_subscribed_ = false;
- break;
- case TalkMediatorEvent::NOTIFICATION_RECEIVED:
- LOG(INFO) << "P2P: Updates on server, pushing syncer";
- if (NULL != syncer_) {
- NudgeSyncImpl(0, SyncerThread::kNotification);
- }
- break;
- default:
- break;
- }
-
- if (NULL != syncer_) {
- syncer_->set_notifications_enabled(p2p_authenticated_ && p2p_subscribed_);
- }
-}
-
-} // namespace browser_sync
diff --git a/chrome/browser/sync/engine/syncer_thread_pthreads.h b/chrome/browser/sync/engine/syncer_thread_pthreads.h
deleted file mode 100644
index fb70982..0000000
--- a/chrome/browser/sync/engine/syncer_thread_pthreads.h
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// *THIS EXISTS FOR EXPERIMENTATION AND TESTING WHILE WE REPLACE PTHREADS
-// WITH CHROME THREADS IN SYNC CODE*
-
-// A class to run the syncer on a thread. Uses PIMPL to wrap the old, original
-// pthreads implementation of SyncerThread.
-#ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_PTHREADS_H_
-#define CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_PTHREADS_H_
-
-#include <list>
-#include <map>
-#include <queue>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/sync/engine/all_status.h"
-#include "chrome/browser/sync/engine/client_command_channel.h"
-#include "chrome/browser/sync/util/event_sys-inl.h"
-#include "chrome/browser/sync/util/pthread_helpers.h"
-#include "chrome/browser/sync/engine/syncer_thread.h"
-#include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST
-
-class EventListenerHookup;
-
-namespace syncable {
-class DirectoryManager;
-struct DirectoryManagerEvent;
-}
-
-namespace browser_sync {
-
-class ModelSafeWorker;
-class ServerConnectionManager;
-class Syncer;
-class TalkMediator;
-class URLFactory;
-struct ServerConnectionEvent;
-struct SyncerEvent;
-struct SyncerShutdownEvent;
-struct TalkMediatorEvent;
-
-// The legacy implementation of SyncerThread using pthreads, kept around for
-// historical experimentation until a new version is finalized.
-class SyncerThreadPthreadImpl {
- public:
- virtual ~SyncerThreadPthreadImpl();
-
- virtual void WatchConnectionManager(ServerConnectionManager* conn_mgr);
- // Creates and starts a syncer thread.
- // Returns true if it creates a thread or if there's currently a thread
- // running and false otherwise.
- virtual bool Start();
-
- // Stop processing. A max wait of at least 2*server RTT time is recommended.
- // returns true if we stopped, false otherwise.
- virtual bool Stop(int max_wait);
-
- // Nudges the syncer to sync with a delay specified. This API is for access
- // from the SyncerThread's controller and will cause a mutex lock.
- virtual bool NudgeSyncer(int milliseconds_from_now,
- SyncerThread::NudgeSource source);
-
- // Registers this thread to watch talk mediator events.
- virtual void WatchTalkMediator(TalkMediator* talk_mediator);
-
- virtual void WatchClientCommands(ClientCommandChannel* channel);
-
- virtual SyncerEventChannel* channel();
-
- private:
- friend class SyncerThreadPthreads;
- SyncerThreadPthreadImpl(ClientCommandChannel* command_channel,
- syncable::DirectoryManager* mgr,
- ServerConnectionManager* connection_manager, AllStatus* all_status,
- ModelSafeWorker* model_safe_worker);
-
- // A few members to gate the rate at which we nudge the syncer.
- enum {
- kNudgeRateLimitCount = 6,
- kNudgeRateLimitTime = 180,
- };
-
- // A queue of all scheduled nudges. One insertion for every call to
- // NudgeQueue().
- typedef std::pair<timespec, SyncerThread::NudgeSource> NudgeObject;
-
- struct IsTimeSpecGreater {
- inline bool operator() (const NudgeObject& lhs, const NudgeObject& rhs) {
- return lhs.first.tv_sec == rhs.first.tv_sec ?
- lhs.first.tv_nsec > rhs.first.tv_nsec :
- lhs.first.tv_sec > rhs.first.tv_sec;
- }
- };
-
- typedef std::priority_queue<NudgeObject, std::vector<NudgeObject>,
- IsTimeSpecGreater> NudgeQueue;
-
- // Threshold multipler for how long before user should be considered idle.
- static const int kPollBackoffThresholdMultiplier = 10;
-
- friend void* RunSyncerThread(void* syncer_thread);
- void* Run();
- void HandleDirectoryManagerEvent(
- const syncable::DirectoryManagerEvent& event);
- void HandleSyncerEvent(const SyncerEvent& event);
- void HandleClientCommand(ClientCommandChannel::EventType event);
-
- void HandleServerConnectionEvent(const ServerConnectionEvent& event);
-
- void HandleTalkMediatorEvent(const TalkMediatorEvent& event);
-
- void* ThreadMain();
- void ThreadMainLoop();
-
- void SyncMain(Syncer* syncer);
-
- // Calculates the next sync wait time in seconds. last_poll_wait is the time
- // duration of the previous polling timeout which was used.
- // user_idle_milliseconds is updated by this method, and is a report of the
- // full amount of time since the last period of activity for the user. The
- // continue_sync_cycle parameter is used to determine whether or not we are
- // calculating a polling wait time that is a continuation of an sync cycle
- // which terminated while the syncer still had work to do.
- int CalculatePollingWaitTime(
- const AllStatus::Status& status,
- int last_poll_wait, // in s
- int* user_idle_milliseconds,
- bool* continue_sync_cycle);
- // Helper to above function, considers effect of user idle time.
- int CalculateSyncWaitTime(int last_wait, int user_idle_ms);
-
- // Sets the source value of the controlled syncer's updates_source value.
- // The initial sync boolean is updated if read as a sentinel. The following
- // two methods work in concert to achieve this goal.
- void UpdateNudgeSource(const timespec& now, bool* continue_sync_cycle,
- bool* initial_sync);
- void SetUpdatesSource(bool nudged, SyncerThread::NudgeSource nudge_source,
- bool* initial_sync);
-
- // For unit tests only.
- void DisableIdleDetection() { disable_idle_detection_ = true; }
-
- // False when we want to stop the thread.
- bool stop_syncer_thread_;
-
- // We use one mutex for all members except the channel.
- PThreadMutex mutex_;
- typedef PThreadScopedLock<PThreadMutex> MutexLock;
-
- // Handle of the running thread.
- pthread_t thread_;
- bool thread_running_;
-
- // Gets signaled whenever a thread outside of the syncer thread changes a
- // member variable.
- PThreadCondVar changed_;
-
- // State of the server connection.
- bool connected_;
-
- // State of the notification framework is tracked by these values.
- bool p2p_authenticated_;
- bool p2p_subscribed_;
-
- scoped_ptr<EventListenerHookup> client_command_hookup_;
- scoped_ptr<EventListenerHookup> conn_mgr_hookup_;
- const AllStatus* allstatus_;
-
- Syncer* syncer_;
-
- syncable::DirectoryManager* dirman_;
- ServerConnectionManager* scm_;
-
- // Modifiable versions of kDefaultLongPollIntervalSeconds which can be
- // updated by the server.
- int syncer_short_poll_interval_seconds_;
- int syncer_long_poll_interval_seconds_;
-
- // The time we wait between polls in seconds. This is used as lower bound on
- // our wait time. Updated once per loop from the command line flag.
- int syncer_polling_interval_;
-
- // The upper bound on the nominal wait between polls in seconds. Note that
- // this bounds the "nominal" poll interval, while the the actual interval
- // also takes previous failures into account.
- int syncer_max_interval_;
-
- scoped_ptr<SyncerEventChannel> syncer_event_channel_;
-
- // This causes syncer to start syncing ASAP. If the rate of requests is too
- // high the request will be silently dropped. mutex_ should be held when
- // this is called.
- void NudgeSyncImpl(int milliseconds_from_now,
- SyncerThread::NudgeSource source);
-
- NudgeQueue nudge_queue_;
-
- scoped_ptr<EventListenerHookup> talk_mediator_hookup_;
- ClientCommandChannel* const command_channel_;
- scoped_ptr<EventListenerHookup> directory_manager_hookup_;
- scoped_ptr<EventListenerHookup> syncer_events_;
-
- // Handles any tasks that will result in model changes (modifications of
- // syncable::Entries). Pass this to the syncer created and managed by |this|.
- // Only non-null in syncapi case.
- scoped_ptr<ModelSafeWorker> model_safe_worker_;
-
- // Useful for unit tests
- bool disable_idle_detection_;
-
- DISALLOW_COPY_AND_ASSIGN(SyncerThreadPthreadImpl);
-};
-
-// A new-version SyncerThread pimpl wrapper for the old legacy implementation.
-class SyncerThreadPthreads : public SyncerThread {
- FRIEND_TEST(SyncerThreadTest, CalculateSyncWaitTime);
- FRIEND_TEST(SyncerThreadTest, CalculatePollingWaitTime);
- FRIEND_TEST(SyncerThreadWithSyncerTest, Polling);
- FRIEND_TEST(SyncerThreadWithSyncerTest, Nudge);
- friend class SyncerThreadWithSyncerTest;
- friend class SyncerThreadFactory;
- public:
- virtual ~SyncerThreadPthreads() {}
-
- virtual void WatchConnectionManager(ServerConnectionManager* conn_mgr) {
- impl_->WatchConnectionManager(conn_mgr);
- }
- virtual bool Start() {
- return impl_->Start();
- }
- virtual bool Stop(int max_wait) {
- return impl_->Stop(max_wait);
- }
- virtual bool NudgeSyncer(int milliseconds_from_now, NudgeSource source) {
- return impl_->NudgeSyncer(milliseconds_from_now, source);
- }
- virtual void WatchTalkMediator(TalkMediator* talk_mediator) {
- impl_->WatchTalkMediator(talk_mediator);
- }
- virtual void WatchClientCommands(ClientCommandChannel* channel) {
- impl_->WatchClientCommands(channel);
- }
- virtual SyncerEventChannel* channel() {
- return impl_->channel();
- }
- protected:
- SyncerThreadPthreads(ClientCommandChannel* command_channel,
- syncable::DirectoryManager* mgr,
- ServerConnectionManager* connection_manager, AllStatus* all_status,
- ModelSafeWorker* model_safe_worker);
- virtual void SetConnected(bool connected) {
- impl_->connected_ = connected;
- }
- virtual void SetSyncerPollingInterval(int interval) {
- impl_->syncer_polling_interval_ = interval;
- }
- virtual void SetSyncerShortPollInterval(base::TimeDelta interval) {
- impl_->syncer_short_poll_interval_seconds_ = static_cast<int>(
- interval.InSeconds());
- }
- virtual void DisableIdleDetection() { impl_->disable_idle_detection_ = true; }
- virtual int CalculateSyncWaitTime(int last_wait, int user_idle_ms) {
- return impl_->CalculateSyncWaitTime(last_wait, user_idle_ms);
- }
- virtual int CalculatePollingWaitTime(
- const AllStatus::Status& status,
- int last_poll_wait, // in s
- int* user_idle_milliseconds,
- bool* continue_sync_cycle) {
- return impl_->CalculatePollingWaitTime(status, last_poll_wait,
- user_idle_milliseconds, continue_sync_cycle);
- }
- private:
- scoped_ptr<SyncerThreadPthreadImpl> impl_;
- DISALLOW_COPY_AND_ASSIGN(SyncerThreadPthreads);
-};
-
-} // namespace browser_sync
-
-#endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_PTHREADS_H_
diff --git a/chrome/browser/sync/util/compat_pthread.h b/chrome/browser/sync/util/compat_pthread.h
deleted file mode 100644
index 1bcc1f0..0000000
--- a/chrome/browser/sync/util/compat_pthread.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Pthread compatability routines.
-// TODO(timsteele): This file is deprecated. Use PlatformThread.
-
-#ifndef CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_
-#define CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_
-
-#include "base/platform_thread.h"
-#include "build/build_config.h"
-
-#define ThreadId PlatformThreadId
-
-#ifndef OS_WIN
-inline ThreadId GetCurrentThreadId() {
- return PlatformThread::CurrentId();
-}
-#endif // OS_WIN
-
-#endif // CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_
diff --git a/chrome/browser/sync/util/pthread_helpers.cc b/chrome/browser/sync/util/pthread_helpers.cc
deleted file mode 100644
index ff96409..0000000
--- a/chrome/browser/sync/util/pthread_helpers.cc
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/sync/util/pthread_helpers.h"
-
-#if (defined(OS_LINUX) || defined(OS_MACOSX))
-#include <sys/time.h>
-#endif // (defined(OS_LINUX) || defined(OS_MACOSX))
-
-#include "base/atomicops.h"
-#include "base/logging.h"
-#include "base/port.h"
-#include "base/scoped_ptr.h"
-#include "chrome/browser/sync/protocol/service_constants.h"
-
-#ifdef OS_WIN
-
-namespace {
-
-// Ensure that we don't bug the user more than once about the process being
-// terminated.
-base::subtle::AtomicWord g_process_terminating = 0;
-
-struct ThreadStartParams {
- void *(*start) (void* payload);
- void* param;
-};
-
-void* ThreadMainProc(void* parameter) {
- ThreadStartParams* tsp = reinterpret_cast<ThreadStartParams*>(parameter);
- void *(*start) (void *) = tsp->start;
- void* param = tsp->param;
-
- delete tsp;
-
- void* result = NULL;
- __try {
- result = start(param);
- } __except(EXCEPTION_CONTINUE_SEARCH) {
- // Make sure only one thread complains and exits the process. Other
- // faulting threads simply return.
- if (0 == base::subtle::NoBarrier_CompareAndSwap(
- &g_process_terminating, 0, 1)) {
- // Service notification means we don't have a recursive event loop inside
- // this call, and so won't suffer recursive exceptions.
- ::MessageBox(NULL,
- PRODUCT_NAME_STRING
- L" has suffered a non-recoverable\n"
- L"exception, and must exit immediately",
- L"Nonrecoverable Exception",
- MB_OK | MB_APPLMODAL | MB_SERVICE_NOTIFICATION);
-
- ::ExitProcess(GetExceptionCode());
- }
- }
-
- return result;
-}
-
-} // namespace
-
-#endif // OS_WIN
-
-thread_handle CreatePThread(void *(*start) (void *), void* parameter) {
-#ifdef OS_WIN
- scoped_ptr<ThreadStartParams> param(new ThreadStartParams);
- if (NULL == param.get())
- return NULL;
-
- param->start = start;
- param->param = parameter;
-
- pthread_t pthread;
- if (0 != pthread_create(&pthread, NULL, ThreadMainProc, param.get()))
- return NULL;
-
- // Ownership has passed to the new thread.
- param.release();
-
- const HANDLE thread_handle = pthread_getw32threadhandle_np(pthread);
- HANDLE thread_copy;
- // Have to duplicate the thread handle, because when we call
- // pthread_detach(), the handle will get closed as soon as the thread exits.
- // We want to keep the handle indefinitely.
- CHECK(DuplicateHandle(GetCurrentProcess(), thread_handle,
- GetCurrentProcess(), &thread_copy, 0, FALSE,
- DUPLICATE_SAME_ACCESS)) <<
- "DuplicateHandle() failed with error " << GetLastError();
- pthread_detach(pthread);
- return thread_copy;
-#else
- pthread_t handle;
-
- int result = pthread_create(&handle, NULL, start, parameter);
- if (result == 0) {
- return handle;
- } else {
- return 0;
- }
-#endif // OS_WIN
-}
-
-struct timespec GetPThreadAbsoluteTime(uint32 ms) {
-#ifdef OS_WIN
- FILETIME filenow;
- GetSystemTimeAsFileTime(&filenow);
- ULARGE_INTEGER n;
- n.LowPart = filenow.dwLowDateTime;
- n.HighPart = filenow.dwHighDateTime;
- // Filetime unit is 100-nanosecond intervals
- const int64 ms_ftime = 10000;
- n.QuadPart += ms_ftime * ms;
-
- // The number of 100 nanosecond intervals from Jan 1, 1601 'til Jan 1, 1970.
- const int64 kOffset = GG_LONGLONG(116444736000000000);
- timespec result;
- result.tv_sec = static_cast<long>((n.QuadPart - kOffset) / 10000000);
- result.tv_nsec = static_cast<long>((n.QuadPart - kOffset -
- (result.tv_sec * GG_LONGLONG(10000000))) * 100);
- return result;
-#else
- struct timeval now;
- struct timezone zone;
- gettimeofday(&now, &zone);
- struct timespec deadline = { now.tv_sec };
- // microseconds to nanoseconds.
- // and add the ms delay.
- ms += now.tv_usec / 1000;
- deadline.tv_sec += ms / 1000;
- deadline.tv_nsec = (ms % 1000) * 1000000;
- return deadline;
-#endif // OS_WIN
-}
-
-void NameCurrentThreadForDebugging(const char* name) {
-#if defined(OS_WIN)
- // This implementation is taken from Chromium's platform_thread framework.
- // The information on how to set the thread name comes from a MSDN article:
- // http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx
- const DWORD kVCThreadNameException = 0x406D1388;
- typedef struct tagTHREADNAME_INFO {
- DWORD dwType; // Must be 0x1000.
- LPCSTR szName; // Pointer to name (in user addr space).
- DWORD dwThreadID; // Thread ID (-1=caller thread).
- DWORD dwFlags; // Reserved for future use, must be zero.
- } THREADNAME_INFO;
-
- // The debugger needs to be around to catch the name in the exception. If
- // there isn't a debugger, we are just needlessly throwing an exception.
- if (!::IsDebuggerPresent())
- return;
-
- THREADNAME_INFO info = { 0x1000, name, GetCurrentThreadId(), 0 };
-
- __try {
- RaiseException(kVCThreadNameException, 0, sizeof(info)/sizeof(DWORD),
- reinterpret_cast<DWORD_PTR*>(&info));
- } __except(EXCEPTION_CONTINUE_EXECUTION) {
- }
-#endif // defined(OS_WIN)
-}
diff --git a/chrome/browser/sync/util/pthread_helpers.h b/chrome/browser/sync/util/pthread_helpers.h
deleted file mode 100644
index 7af08f4..0000000
--- a/chrome/browser/sync/util/pthread_helpers.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_
-#define CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_
-
-#include <pthread.h>
-#include "base/logging.h"
-#include "build/build_config.h"
-
-#ifdef OS_WIN
-typedef void* thread_handle;
-#else
-typedef pthread_t thread_handle;
-#endif
-
-// Creates a pthread, detaches from it, and returns a Win32 HANDLE for it that
-// the caller must CloseHandle().
-thread_handle CreatePThread(void* (*start)(void* payload), void* parameter);
-
-template <typename LockType>
-class PThreadScopedLock {
- public:
- explicit inline PThreadScopedLock(LockType* lock) : lock_(lock) {
- if (lock_)
- lock->Lock();
- }
- inline ~PThreadScopedLock() {
- Unlock();
- }
- inline void Unlock() {
- if (lock_) {
- lock_->Unlock();
- lock_ = NULL;
- }
- }
- LockType* lock_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PThreadScopedLock);
-};
-
-class PThreadNoLock {
- public:
- inline void Lock() { }
- inline void Unlock() { }
-};
-
-// On win32, the pthread mutex implementation is about as efficient a critical
-// section. It uses atomic operations and only needs kernel calls on
-// contention.
-class PThreadMutex {
- public:
- inline PThreadMutex() {
- pthread_mutexattr_t* attributes = NULL;
-#ifndef NDEBUG
- private_attributes_in_use_ = true;
- pthread_mutexattr_init(&mutex_attributes_);
- pthread_mutexattr_settype(&mutex_attributes_, PTHREAD_MUTEX_ERRORCHECK);
- attributes = &mutex_attributes_;
-#endif
- int result = pthread_mutex_init(&mutex_, attributes);
- DCHECK_EQ(0, result);
- }
- inline explicit PThreadMutex(const pthread_mutexattr_t* attr) {
-#ifndef NDEBUG
- private_attributes_in_use_ = false;
-#endif
- int result = pthread_mutex_init(&mutex_, attr);
- DCHECK_EQ(0, result);
- }
- inline ~PThreadMutex() {
- int result = pthread_mutex_destroy(&mutex_);
- DCHECK_EQ(0, result);
-#ifndef NDEBUG
- if (private_attributes_in_use_) {
- pthread_mutexattr_destroy(&mutex_attributes_);
- }
-#endif
- }
- inline void Lock() {
- int result = pthread_mutex_lock(&mutex_);
- DCHECK_EQ(0, result);
- }
- inline void Unlock() {
- int result = pthread_mutex_unlock(&mutex_);
- DCHECK_EQ(0, result);
- }
- pthread_mutex_t mutex_;
-
-#ifndef NDEBUG
- pthread_mutexattr_t mutex_attributes_;
- bool private_attributes_in_use_;
-#endif
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PThreadMutex);
-};
-
-class PThreadCondVar {
- public:
- inline PThreadCondVar() {
- int result = pthread_cond_init(&condvar_, 0);
- DCHECK_EQ(0, result);
- }
- ~PThreadCondVar() {
- int result = pthread_cond_destroy(&condvar_);
- DCHECK_EQ(0, result);
- }
- inline void Signal() {
- int result = pthread_cond_signal(&condvar_);
- DCHECK_EQ(0, result);
- }
- inline void Broadcast() {
- int result = pthread_cond_broadcast(&condvar_);
- DCHECK_EQ(0, result);
- }
- pthread_cond_t condvar_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PThreadCondVar);
-};
-
-// Returns the absolute time ms milliseconds from now. Useful for passing
-// result to pthread_cond_timedwait().
-struct timespec GetPThreadAbsoluteTime(uint32 ms_from_now);
-
-// Assign a descriptive label to the current thread. This is useful to see
-// in a GUI debugger, but may not be implementable on all platforms.
-void NameCurrentThreadForDebugging(const char* name);
-
-#endif // CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_
diff --git a/chrome/browser/sync/util/pthread_helpers_fwd.h b/chrome/browser/sync/util/pthread_helpers_fwd.h
deleted file mode 100644
index 2756fceb..0000000
--- a/chrome/browser/sync/util/pthread_helpers_fwd.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_FWD_H_
-#define CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_FWD_H_
-
-template <typename LockType>
-class PThreadScopedLock;
-class PThreadNoLock;
-class PThreadMutex;
-
-#endif // CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_FWD_H_
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 310e295..ff96123 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -4658,13 +4658,6 @@
'sync',
'sync_proto',
],
- 'conditions': [
- ['OS=="win"', {
- 'dependencies': [
- '../third_party/pthreads-win32/pthreads.gyp:pthreads',
- ],
- }],
- ],
}],
],
},
@@ -4879,7 +4872,6 @@
'urlmon.dll',
'imm32.dll',
'iphlpapi.dll',
- 'pthreads.dll',
],
'ImportLibrary': '$(OutDir)\\lib\\chrome_dll.lib',
'ProgramDatabaseFile': '$(OutDir)\\chrome_dll.pdb',
@@ -6402,11 +6394,6 @@
'sync_proto',
],
'conditions': [
- ['OS=="win"', {
- 'dependencies': [
- '../third_party/pthreads-win32/pthreads.gyp:pthreads',
- ],
- }],
['OS=="linux"', {
'defines': [
'POSIX',
@@ -6467,9 +6454,6 @@
],
'conditions': [
['OS=="win"', {
- 'dependencies': [
- '../third_party/pthreads-win32/pthreads.gyp:pthreads',
- ],
'link_settings': {
'libraries': [
'-lcrypt32.lib',
@@ -6553,8 +6537,6 @@
'browser/sync/engine/syncer_thread.h',
'browser/sync/engine/syncer_thread_timed_stop.cc',
'browser/sync/engine/syncer_thread_timed_stop.h',
- 'browser/sync/engine/syncer_thread_pthreads.cc',
- 'browser/sync/engine/syncer_thread_pthreads.h',
'browser/sync/engine/syncer_types.h',
'browser/sync/engine/syncer_util.cc',
'browser/sync/engine/syncer_util.h',
@@ -6587,7 +6569,6 @@
'browser/sync/util/compat_file.h',
'browser/sync/util/compat_file_posix.cc',
'browser/sync/util/compat_file_win.cc',
- 'browser/sync/util/compat_pthread.h',
'browser/sync/util/crypto_helpers.cc',
'browser/sync/util/crypto_helpers.h',
'browser/sync/util/dbgq.h',
@@ -6604,9 +6585,6 @@
'browser/sync/util/path_helpers.h',
'browser/sync/util/path_helpers_linux.cc',
'browser/sync/util/path_helpers_posix.cc',
- 'browser/sync/util/pthread_helpers.cc',
- 'browser/sync/util/pthread_helpers.h',
- 'browser/sync/util/pthread_helpers_fwd.h',
'browser/sync/util/query_helpers.cc',
'browser/sync/util/query_helpers.h',
'browser/sync/util/row_iterator.h',
@@ -6637,9 +6615,6 @@
'browser/sync/util/data_encryption.h',
'browser/sync/util/path_helpers.cc',
],
- 'dependencies': [
- '../third_party/pthreads-win32/pthreads.gyp:pthreads',
- ],
}],
['OS=="linux"', {
'defines': [
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index ae52818..04440a4 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -391,10 +391,6 @@ const wchar_t kDisableSync[] = L"disable-sync";
// Stop(). Should only use if you experience problems with the default.
const wchar_t kSyncerThreadTimedStop[] = L"syncer-thread-timed-stop";
-// Use the old pthreads SyncerThread implementation.
-// Should only use if you experience problems with the default.
-const wchar_t kSyncerThreadPthreads[] = L"syncer-thread-pthreads";
-
// Enable support for SDCH filtering (dictionary based expansion of content).
// Optional argument is *the* only domain name that will have SDCH suppport.
// Default is "-enable-sdch" to advertise SDCH on all domains.
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 8c43fc5..37c6b3a 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -144,7 +144,6 @@ extern const wchar_t kEnableFastback[];
extern const wchar_t kDisableSync[];
extern const wchar_t kSyncerThreadTimedStop[];
-extern const wchar_t kSyncerThreadPthreads[];
extern const wchar_t kSdchFilter[];
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release
index 7acbb0f..8237c65 100644
--- a/chrome/installer/mini_installer/chrome.release
+++ b/chrome/installer/mini_installer/chrome.release
@@ -42,7 +42,6 @@ servers\*.dll: %(VersionDir)s\
servers\*.exe: %(VersionDir)s\
Extensions\*.*: %(VersionDir)s\Extensions\
av*.dll: %(VersionDir)s\
-pthreads.dll: %(VersionDir)s\
[GOOGLE_CHROME]
rlz.dll: %(VersionDir)s\
diff --git a/chrome/tools/build/win/FILES b/chrome/tools/build/win/FILES
index 8f2ff0c..38c8ee9 100644
--- a/chrome/tools/build/win/FILES
+++ b/chrome/tools/build/win/FILES
@@ -61,4 +61,4 @@ themes/default.dll
resources
rlz.dll
wow_helper.exe
-pthreads.dll
+