summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/engine
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-24 16:24:13 +0100
committerKristian Monsen <kristianm@google.com>2011-05-25 14:13:32 +0100
commit3f50c38dc070f4bb515c1b64450dae14f316474e (patch)
tree29f309f9534e05c47244eedb438fc612578d133b /chrome/browser/sync/engine
parente23bef148f7be2bdf9c3cb2cd3aa5ceebf1190fb (diff)
downloadexternal_chromium-3f50c38dc070f4bb515c1b64450dae14f316474e.zip
external_chromium-3f50c38dc070f4bb515c1b64450dae14f316474e.tar.gz
external_chromium-3f50c38dc070f4bb515c1b64450dae14f316474e.tar.bz2
Merge Chromium at r10.0.634.0: Initial merge by git.
Change-Id: Iac2af492818d119bcc2562eb5fdabf5ab0b6df9c
Diffstat (limited to 'chrome/browser/sync/engine')
-rw-r--r--chrome/browser/sync/engine/read_node_mock.h6
-rw-r--r--chrome/browser/sync/engine/syncapi.cc5
-rw-r--r--chrome/browser/sync/engine/syncapi.h3
-rw-r--r--chrome/browser/sync/engine/syncer_thread.cc22
-rw-r--r--chrome/browser/sync/engine/syncer_thread.h17
-rw-r--r--chrome/browser/sync/engine/syncer_thread_unittest.cc2
6 files changed, 32 insertions, 23 deletions
diff --git a/chrome/browser/sync/engine/read_node_mock.h b/chrome/browser/sync/engine/read_node_mock.h
index f13eddd..564f01d 100644
--- a/chrome/browser/sync/engine/read_node_mock.h
+++ b/chrome/browser/sync/engine/read_node_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -13,8 +13,9 @@
class ReadNodeMock : public sync_api::ReadNode {
public:
- ReadNodeMock() { }
+ ReadNodeMock() {}
virtual ~ReadNodeMock() {}
+
MOCK_METHOD2(InitByClientTagLookup,
bool(syncable::ModelType model_type, const std::string& tag));
MOCK_CONST_METHOD0(GetAutofillProfileSpecifics,
@@ -25,5 +26,6 @@ class ReadNodeMock : public sync_api::ReadNode {
MOCK_CONST_METHOD0(GetSuccessorId, int64());
MOCK_METHOD1(InitByIdLookup, bool(int64 id));
};
+
#endif // CHROME_BROWSER_SYNC_ENGINE_READ_NODE_MOCK_H_
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 112878d..206125b 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -14,7 +14,6 @@
#include "base/lock.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
#include "base/sha1.h"
#include "base/string_util.h"
@@ -217,6 +216,10 @@ int64 BaseNode::GetId() const {
return GetEntry()->Get(syncable::META_HANDLE);
}
+int64 BaseNode::GetModificationTime() const {
+ return GetEntry()->Get(syncable::MTIME);
+}
+
bool BaseNode::GetIsFolder() const {
return GetEntry()->Get(syncable::IS_DIR);
}
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index e2503cb..d86ed71 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -153,6 +153,9 @@ class BaseNode {
// different ID value.
virtual int64 GetId() const;
+ // Returns the modification time of the object (in TimeTicks internal format).
+ int64 GetModificationTime() const;
+
// Nodes are hierarchically arranged into a single-rooted tree.
// InitByRootLookup on ReadNode allows access to the root. GetParentId is
// how you find a node's parent.
diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc
index 501577d..3c0cd06 100644
--- a/chrome/browser/sync/engine/syncer_thread.cc
+++ b/chrome/browser/sync/engine/syncer_thread.cc
@@ -59,7 +59,7 @@ void SyncerThread::NudgeSyncerWithDataTypes(
int milliseconds_from_now,
NudgeSource source,
const syncable::ModelTypeBitSet& model_types) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (vault_.syncer_ == NULL) {
return;
}
@@ -70,7 +70,7 @@ void SyncerThread::NudgeSyncerWithDataTypes(
void SyncerThread::NudgeSyncer(
int milliseconds_from_now,
NudgeSource source) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (vault_.syncer_ == NULL) {
return;
}
@@ -107,7 +107,7 @@ SyncerThread::~SyncerThread() {
// and false otherwise.
bool SyncerThread::Start() {
{
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (thread_.IsRunning()) {
return true;
}
@@ -141,7 +141,7 @@ bool SyncerThread::Stop(int max_wait) {
void SyncerThread::RequestSyncerExitAndSetThreadStopConditions() {
{
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// If the thread has been started, then we either already have or are about
// to enter ThreadMainLoop so we have to proceed with shutdown and wait for
// it to finish. If the thread has not been started --and we now own the
@@ -170,7 +170,7 @@ void SyncerThread::RequestSyncerExitAndSetThreadStopConditions() {
}
bool SyncerThread::RequestPause() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (vault_.pause_requested_ || vault_.paused_)
return false;
@@ -195,7 +195,7 @@ void SyncerThread::Notify(SyncEngineEvent::EventCause cause) {
}
bool SyncerThread::RequestResume() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// Only valid to request a resume when we are already paused or we
// have a pause pending.
if (!(vault_.paused_ || vault_.pause_requested_))
@@ -530,7 +530,7 @@ SyncerThread::WaitInterval SyncerThread::CalculatePollingWaitTime(
}
void SyncerThread::ThreadMain() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// Signal Start() to let it know we've made it safely onto the message loop,
// and unblock it's caller.
thread_main_started_.Signal();
@@ -637,7 +637,7 @@ SyncSourceInfo SyncerThread::MakeSyncSourceInfo(bool nudged,
}
void SyncerThread::CreateSyncer(const std::string& dirname) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
VLOG(1) << "Creating syncer up for: " << dirname;
// The underlying database structure is ready, and we should create
// the syncer.
@@ -655,7 +655,7 @@ void SyncerThread::CreateSyncer(const std::string& dirname) {
// server.
static inline void CheckConnected(bool* connected,
HttpResponse::ServerConnectionCode code,
- ConditionVariable* condvar) {
+ base::ConditionVariable* condvar) {
if (*connected) {
// Note, be careful when adding cases here because if the SyncerThread
// thinks there is no valid connection as determined by this method, it
@@ -686,7 +686,7 @@ void SyncerThread::WatchConnectionManager(ServerConnectionManager* conn_mgr) {
void SyncerThread::HandleServerConnectionEvent(
const ServerConnectionEvent& event) {
if (ServerConnectionEvent::STATUS_CHANGED == event.what_happened) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
CheckConnected(&vault_.connected_, event.connection_code,
&vault_field_changed_);
}
@@ -771,7 +771,7 @@ void SyncerThread::NudgeSyncImpl(int milliseconds_from_now,
}
void SyncerThread::SetNotificationsEnabled(bool notifications_enabled) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
session_context_->set_notifications_enabled(notifications_enabled);
}
diff --git a/chrome/browser/sync/engine/syncer_thread.h b/chrome/browser/sync/engine/syncer_thread.h
index 6681225..22531d8 100644
--- a/chrome/browser/sync/engine/syncer_thread.h
+++ b/chrome/browser/sync/engine/syncer_thread.h
@@ -14,21 +14,22 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/condition_variable.h"
#include "base/gtest_prod_util.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/threading/thread.h"
#include "base/time.h"
-#include "base/waitable_event.h"
-#if defined(OS_LINUX)
-#include "chrome/browser/sync/engine/idle_query_linux.h"
-#endif
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/engine/syncer_types.h"
#include "chrome/browser/sync/sessions/sync_session.h"
#include "chrome/browser/sync/syncable/model_type.h"
#include "chrome/common/deprecated/event_sys-inl.h"
+#if defined(OS_LINUX)
+#include "chrome/browser/sync/engine/idle_query_linux.h"
+#endif
+
class EventListenerHookup;
namespace browser_sync {
@@ -213,10 +214,10 @@ class SyncerThread : public base::RefCountedThreadSafe<SyncerThread>,
// Gets signaled whenever a thread outside of the syncer thread changes a
// protected field in the vault_.
- ConditionVariable vault_field_changed_;
+ base::ConditionVariable vault_field_changed_;
// Used to lock everything in |vault_|.
- Lock lock_;
+ base::Lock lock_;
private:
// Threshold multipler for how long before user should be considered idle.
diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc
index 887bcc1..df0733b 100644
--- a/chrome/browser/sync/engine/syncer_thread_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc
@@ -8,7 +8,7 @@
#include "base/lock.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/engine/syncer_thread.h"
#include "chrome/browser/sync/engine/syncer_types.h"