summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc4
-rw-r--r--chrome/browser/sync/notifier/chrome_invalidation_client.cc13
-rw-r--r--chrome/browser/sync/notifier/chrome_system_resources.cc21
-rw-r--r--chrome/browser/sync/notifier/chrome_system_resources.h14
-rw-r--r--chrome/browser/sync/notifier/invalidation_util.h4
-rw-r--r--third_party/cacheinvalidation/cacheinvalidation.gyp31
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h126
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/compiler-specific.h10
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h10
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/googletest.h10
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/logging.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h18
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h26
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/random.h25
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/stl-namespace.h10
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/string_util.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/time.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/callback.h126
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/gmock.h91
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/googletest.h10
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/random.h25
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h4
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/stl-namespace.h10
26 files changed, 329 insertions, 341 deletions
diff --git a/DEPS b/DEPS
index afaa80c..7411bf5 100644
--- a/DEPS
+++ b/DEPS
@@ -91,7 +91,7 @@ deps = {
"src/third_party/cacheinvalidation/files/src/google":
(Var("googlecode_url") % "google-cache-invalidation-api") +
- "/trunk/src/google@151",
+ "/trunk/src/google@177",
"src/third_party/leveldatabase/src":
(Var("googlecode_url") % "leveldb") + "/trunk@55",
diff --git a/chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc b/chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc
index ce6f87e..08cdcb6 100644
--- a/chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc
+++ b/chrome/browser/sync/notifier/cache_invalidation_packet_handler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -7,7 +7,7 @@
#include "base/base64.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
-#include "google/cacheinvalidation/callback.h"
+#include "google/cacheinvalidation/v2/callback.h"
#include "google/cacheinvalidation/v2/system-resources.h"
#include "jingle/notifier/base/fake_base_task.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client.cc b/chrome/browser/sync/notifier/chrome_invalidation_client.cc
index a677be6..6faa537 100644
--- a/chrome/browser/sync/notifier/chrome_invalidation_client.cc
+++ b/chrome/browser/sync/notifier/chrome_invalidation_client.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -14,7 +14,9 @@
#include "chrome/browser/sync/notifier/invalidation_util.h"
#include "chrome/browser/sync/notifier/registration_manager.h"
#include "chrome/browser/sync/syncable/model_type.h"
-#include "google/cacheinvalidation/v2/invalidation-client-impl.h"
+#include "google/cacheinvalidation/v2/invalidation-client.h"
+#include "google/cacheinvalidation/v2/invalidation-client-factory.h"
+#include "google/cacheinvalidation/v2/types.pb.h"
namespace {
@@ -84,12 +86,9 @@ void ChromeInvalidationClient::Start(
state_writer_ = state_writer;
int client_type = ipc::invalidation::ClientType::CHROME_SYNC;
- // TODO(akalin): Use InvalidationClient::Create() once it supports
- // taking a ClientConfig.
- invalidation::InvalidationClientImpl::Config client_config;
invalidation_client_.reset(
- new invalidation::InvalidationClientImpl(
- &chrome_system_resources_, client_type, client_id, client_config,
+ invalidation::CreateInvalidationClient(
+ &chrome_system_resources_, client_type, client_id,
kApplicationName, this));
ChangeBaseTask(base_task);
invalidation_client_->Start();
diff --git a/chrome/browser/sync/notifier/chrome_system_resources.cc b/chrome/browser/sync/notifier/chrome_system_resources.cc
index 9d46c73..474d0b6 100644
--- a/chrome/browser/sync/notifier/chrome_system_resources.cc
+++ b/chrome/browser/sync/notifier/chrome_system_resources.cc
@@ -55,6 +55,11 @@ void ChromeLogger::Log(LogLevel level, const char* file, int line,
}
}
+void ChromeLogger::SetSystemResources(
+ invalidation::SystemResources* resources) {
+ // Do nothing.
+}
+
ChromeScheduler::ChromeScheduler()
: ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
created_on_loop_(MessageLoop::current()),
@@ -111,6 +116,11 @@ invalidation::Time ChromeScheduler::GetCurrentTime() const {
return base::Time::Now();
}
+void ChromeScheduler::SetSystemResources(
+ invalidation::SystemResources* resources) {
+ // Do nothing.
+}
+
void ChromeScheduler::RunPostedTask(invalidation::Closure* task) {
CHECK_EQ(created_on_loop_, MessageLoop::current());
RunAndDeleteClosure(task);
@@ -163,6 +173,11 @@ void ChromeStorage::ReadAllKeys(invalidation::ReadAllKeysCallback* done) {
LOG(WARNING) << "ignoring call to ReadAllKeys(callback)";
}
+void ChromeStorage::SetSystemResources(
+ invalidation::SystemResources* resources) {
+ // Do nothing.
+}
+
void ChromeStorage::RunAndDeleteWriteKeyCallback(
invalidation::WriteKeyCallback* callback) {
callback->Run(invalidation::Status(invalidation::Status::SUCCESS, ""));
@@ -201,6 +216,11 @@ void ChromeNetwork::AddNetworkStatusReceiver(
network_status_receivers_.push_back(network_status_receiver);
}
+void ChromeNetwork::SetSystemResources(
+ invalidation::SystemResources* resources) {
+ // Do nothing.
+}
+
void ChromeNetwork::UpdatePacketHandler(
CacheInvalidationPacketHandler* packet_handler) {
packet_handler_ = packet_handler;
@@ -234,6 +254,7 @@ ChromeSystemResources::~ChromeSystemResources() {
void ChromeSystemResources::Start() {
internal_scheduler_->Start();
listener_scheduler_->Start();
+ is_started_ = true;
}
void ChromeSystemResources::Stop() {
diff --git a/chrome/browser/sync/notifier/chrome_system_resources.h b/chrome/browser/sync/notifier/chrome_system_resources.h
index a92a6c6..8614bd4 100644
--- a/chrome/browser/sync/notifier/chrome_system_resources.h
+++ b/chrome/browser/sync/notifier/chrome_system_resources.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
//
@@ -35,6 +35,9 @@ class ChromeLogger : public invalidation::Logger {
// invalidation::Logger implementation.
virtual void Log(LogLevel level, const char* file, int line,
const char* format, ...) OVERRIDE;
+
+ virtual void SetSystemResources(
+ invalidation::SystemResources* resources) OVERRIDE;
};
class ChromeScheduler : public invalidation::Scheduler {
@@ -55,6 +58,9 @@ class ChromeScheduler : public invalidation::Scheduler {
virtual invalidation::Time GetCurrentTime() const OVERRIDE;
+ virtual void SetSystemResources(
+ invalidation::SystemResources* resources) OVERRIDE;
+
private:
base::WeakPtrFactory<ChromeScheduler> weak_factory_;
// Holds all posted tasks that have not yet been run.
@@ -91,6 +97,9 @@ class ChromeStorage : public invalidation::Storage {
virtual void ReadAllKeys(
invalidation::ReadAllKeysCallback* key_callback) OVERRIDE;
+ virtual void SetSystemResources(
+ invalidation::SystemResources* resources) OVERRIDE;
+
private:
// Runs the given storage callback with SUCCESS status and deletes it.
void RunAndDeleteWriteKeyCallback(
@@ -122,6 +131,9 @@ class ChromeNetwork : public invalidation::NetworkChannel {
virtual void AddNetworkStatusReceiver(
invalidation::NetworkStatusCallback* network_status_receiver) OVERRIDE;
+ virtual void SetSystemResources(
+ invalidation::SystemResources* resources) OVERRIDE;
+
private:
void HandleInboundMessage(const std::string& incoming_message);
diff --git a/chrome/browser/sync/notifier/invalidation_util.h b/chrome/browser/sync/notifier/invalidation_util.h
index a61c89b..86d58d96 100644
--- a/chrome/browser/sync/notifier/invalidation_util.h
+++ b/chrome/browser/sync/notifier/invalidation_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
//
@@ -11,7 +11,7 @@
#include <string>
#include "chrome/browser/sync/syncable/model_type.h"
-#include "google/cacheinvalidation/callback.h"
+#include "google/cacheinvalidation/v2/callback.h"
namespace invalidation {
diff --git a/third_party/cacheinvalidation/cacheinvalidation.gyp b/third_party/cacheinvalidation/cacheinvalidation.gyp
index 4e0ae02..5c5a2a7 100644
--- a/third_party/cacheinvalidation/cacheinvalidation.gyp
+++ b/third_party/cacheinvalidation/cacheinvalidation.gyp
@@ -28,6 +28,7 @@
'type': 'none',
'sources': [
'<(proto_dir_root)/<(proto_dir_relpath)/client.proto',
+ '<(proto_dir_root)/<(proto_dir_relpath)/client_gateway.proto',
'<(proto_dir_root)/<(proto_dir_relpath)/client_protocol.proto',
'<(proto_dir_root)/<(proto_dir_relpath)/client_test_internal.proto',
'<(proto_dir_root)/<(proto_dir_relpath)/types.proto',
@@ -67,6 +68,8 @@
'sources': [
'<(protoc_out_dir)/<(proto_dir_relpath)/client.pb.h',
'<(protoc_out_dir)/<(proto_dir_relpath)/client.pb.cc',
+ '<(protoc_out_dir)/<(proto_dir_relpath)/client_gateway.pb.h',
+ '<(protoc_out_dir)/<(proto_dir_relpath)/client_gateway.pb.cc',
'<(protoc_out_dir)/<(proto_dir_relpath)/client_protocol.pb.h',
'<(protoc_out_dir)/<(proto_dir_relpath)/client_protocol.pb.cc',
'<(protoc_out_dir)/<(proto_dir_relpath)/client_test_internal.pb.h',
@@ -99,27 +102,29 @@
'target_name': 'cacheinvalidation',
'type': 'static_library',
'sources': [
- 'overrides/google/cacheinvalidation/callback.h',
- 'overrides/google/cacheinvalidation/compiler-specific.h',
- 'overrides/google/cacheinvalidation/gmock.h',
- 'overrides/google/cacheinvalidation/googletest.h',
+ 'overrides/google/cacheinvalidation/v2/callback.h',
+ 'overrides/google/cacheinvalidation/v2/gmock.h',
+ 'overrides/google/cacheinvalidation/v2/googletest.h',
'overrides/google/cacheinvalidation/v2/logging.h',
- 'overrides/google/cacheinvalidation/md5.h',
'overrides/google/cacheinvalidation/v2/mutex.h',
- 'overrides/google/cacheinvalidation/random.h',
+ 'overrides/google/cacheinvalidation/v2/random.h',
'overrides/google/cacheinvalidation/v2/scoped_ptr.h',
- 'overrides/google/cacheinvalidation/stl-namespace.h',
+ 'overrides/google/cacheinvalidation/v2/stl-namespace.h',
'overrides/google/cacheinvalidation/v2/string_util.h',
'overrides/google/cacheinvalidation/v2/time.h',
+ 'files/src/google/cacheinvalidation/v2/basic-system-resources.cc',
+ 'files/src/google/cacheinvalidation/v2/basic-system-resources.h',
'files/src/google/cacheinvalidation/v2/checking-invalidation-listener.cc',
'files/src/google/cacheinvalidation/v2/checking-invalidation-listener.h',
'files/src/google/cacheinvalidation/v2/client-protocol-namespace-fix.h',
- 'files/src/google/cacheinvalidation/v2/constants.h',
'files/src/google/cacheinvalidation/v2/constants.cc',
+ 'files/src/google/cacheinvalidation/v2/constants.h',
'files/src/google/cacheinvalidation/v2/digest-function.h',
'files/src/google/cacheinvalidation/v2/digest-store.h',
- 'files/src/google/cacheinvalidation/v2/exponential-backoff-delay-generator.h',
'files/src/google/cacheinvalidation/v2/exponential-backoff-delay-generator.cc',
+ 'files/src/google/cacheinvalidation/v2/exponential-backoff-delay-generator.h',
+ 'files/src/google/cacheinvalidation/v2/invalidation-client-factory.cc',
+ 'files/src/google/cacheinvalidation/v2/invalidation-client-factory.h',
'files/src/google/cacheinvalidation/v2/invalidation-client-impl.cc',
'files/src/google/cacheinvalidation/v2/invalidation-client-impl.h',
'files/src/google/cacheinvalidation/v2/invalidation-client.h',
@@ -153,8 +158,8 @@
'files/src/google/cacheinvalidation/v2/system-resources.h',
'files/src/google/cacheinvalidation/v2/throttle.cc',
'files/src/google/cacheinvalidation/v2/throttle.h',
- 'files/src/google/cacheinvalidation/v2/ticl-message-validator.h',
'files/src/google/cacheinvalidation/v2/ticl-message-validator.cc',
+ 'files/src/google/cacheinvalidation/v2/ticl-message-validator.h',
'files/src/google/cacheinvalidation/v2/time.h',
'files/src/google/cacheinvalidation/v2/types.h',
],
@@ -188,8 +193,12 @@
'type': 'executable',
'sources': [
'../../base/test/run_all_unittests.cc',
+ 'files/src/google/cacheinvalidation/v2/test/deterministic-scheduler.cc',
'files/src/google/cacheinvalidation/v2/test/deterministic-scheduler.h',
- 'files/src/google/cacheinvalidation/v2/test/throttle_test.cc',
+ 'files/src/google/cacheinvalidation/v2/test/test-logger.cc',
+ 'files/src/google/cacheinvalidation/v2/test/test-logger.h',
+ 'files/src/google/cacheinvalidation/v2/protocol-handler_test.cc',
+ 'files/src/google/cacheinvalidation/v2/throttle_test.cc',
],
'dependencies': [
'../../base/base.gyp:base',
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
index ae09809..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
@@ -1,126 +0,0 @@
-// 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.
-
-#ifndef GOOGLE_CACHEINVALIDATION_CALLBACK_H_
-#define GOOGLE_CACHEINVALIDATION_CALLBACK_H_
-
-#include "base/bind.h"
-#include "base/callback.h"
-
-#define INVALIDATION_CALLBACK1_TYPE(Arg1) ::base::Callback<void(Arg1)>
-
-// Below are a collection of types and functions that adapt base::Callback's
-// pass-by-value semantics to the pointer-based callback system that
-// cacheinvalidation needs.
-
-namespace invalidation {
-
-typedef ::base::Closure Closure;
-
-static inline void DoNothing() {}
-
-template <class T>
-bool IsCallbackRepeatable(const T* callback) {
- // The default cacheinvalidation Callbacks may be self-deleting. We don't
- // support this behave, so we already return true to indicate that the
- // cacheinvalidation implementation should delete our Callbacks.
- return true;
-}
-
-namespace internal {
-
-// Identity<T>::type is a typedef of T. Useful for preventing the
-// compiler from inferring the type of an argument in templates.
-template <typename T>
-struct Identity {
- typedef T type;
-};
-
-} // namespace internal
-
-// The cacheinvalidation callback system expects to take the callback by
-// pointer and handle the ownership semantics itself. Adapting the
-// Chromium Callback system requires returning a dynamically allocated
-// copy of the result of Bind().
-
-inline Closure* NewPermanentCallback(void (*fn)()) {
- return new ::base::Closure(::base::Bind(fn));
-}
-
-template <class T1, class T2>
-Closure* NewPermanentCallback(
- T1* object, void (T2::*method)()) {
- return new ::base::Closure(::base::Bind(method, base::Unretained(object)));
-}
-
-template <class T1, class T2, typename Arg1>
-::base::Callback<void(Arg1)>* NewPermanentCallback(
- T1* object, void (T2::*method)(Arg1)) {
- return new ::base::Callback<void(Arg1)>(
- ::base::Bind(method, base::Unretained(object)));
-}
-
-template <class T1, class T2, typename Arg1>
-Closure* NewPermanentCallback(
- T1* object,
- void (T2::*method)(Arg1),
- typename internal::Identity<Arg1>::type arg1) {
- return new ::base::Closure(::base::Bind(method, base::Unretained(object),
- arg1));
-}
-
-template <typename Arg1, typename Arg2>
-Closure* NewPermanentCallback(
- void (*fn)(Arg1, Arg2),
- typename internal::Identity<Arg1>::type arg1,
- typename internal::Identity<Arg2>::type arg2) {
- return new ::base::Closure(::base::Bind(fn, arg1, arg2));
-}
-
-template <class T1, class T2, typename Arg1, typename Arg2>
-Closure* NewPermanentCallback(
- T1* object,
- void (T2::*method)(Arg1, Arg2),
- typename internal::Identity<Arg1>::type arg1,
- typename internal::Identity<Arg2>::type arg2) {
- return new ::base::Closure(::base::Bind(method, base::Unretained(object),
- arg1, arg2));
-}
-
-template <class T1, class T2, typename Arg1, typename Arg2>
-::base::Callback<void(Arg2)>* NewPermanentCallback(
- T1* object,
- void (T2::*method)(Arg1, Arg2),
- typename internal::Identity<Arg1>::type arg1) {
- return new ::base::Callback<void(Arg2)>(
- ::base::Bind(method, base::Unretained(object), arg1));
-}
-
-template <class T1, class T2, typename Arg1, typename Arg2, typename Arg3>
-Closure* NewPermanentCallback(
- T1* object,
- void (T2::*method)(Arg1, Arg2, Arg3),
- typename internal::Identity<Arg1>::type arg1,
- typename internal::Identity<Arg2>::type arg2,
- typename internal::Identity<Arg3>::type arg3) {
- return new ::base::Closure(::base::Bind(method, base::Unretained(object),
- arg1, arg2, arg3));
-}
-
-template <class T1, class T2, typename Arg1, typename Arg2, typename Arg3,
- typename Arg4>
-Closure* NewPermanentCallback(
- T1* object,
- void (T2::*method)(Arg1, Arg2, Arg3, Arg4),
- typename internal::Identity<Arg1>::type arg1,
- typename internal::Identity<Arg2>::type arg2,
- typename internal::Identity<Arg3>::type arg3,
- typename internal::Identity<Arg4>::type arg4) {
- return new ::base::Closure(::base::Bind(method, base::Unretained(object),
- arg1, arg2, arg3, arg4));
-}
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_CALLBACK_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/compiler-specific.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/compiler-specific.h
index 5ca6b57..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/compiler-specific.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/compiler-specific.h
@@ -1,10 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_COMPILER_SPECIFIC_H_
-#define GOOGLE_CACHEINVALIDATION_COMPILER_SPECIFIC_H_
-
-#include "base/compiler_specific.h"
-
-#endif // GOOGLE_CACHEINVALIDATION_COMPILER_SPECIFIC_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h
index 8afb9fb..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h
@@ -1,10 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_GMOCK_H_
-#define GOOGLE_CACHEINVALIDATION_GMOCK_H_
-
-#include "testing/gmock/include/gmock/gmock.h"
-
-#endif // GOOGLE_CACHEINVALIDATION_GMOCK_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/googletest.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/googletest.h
index f24bd56..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/googletest.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/googletest.h
@@ -1,10 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_GOOGLETEST_H_
-#define GOOGLE_CACHEINVALIDATION_GOOGLETEST_H_
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-#endif // GOOGLE_CACHEINVALIDATION_GOOGLETEST_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h
index 3dbe724..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h
@@ -1,16 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_HASH_MAP_H_
-#define GOOGLE_CACHEINVALIDATION_HASH_MAP_H_
-
-#include "base/hash_tables.h"
-
-namespace invalidation {
-
-using base::hash_map;
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_HASH_MAP_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/logging.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/logging.h
index b1c76cf..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/logging.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/logging.h
@@ -1,16 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_LOGGING_H_
-#define GOOGLE_CACHEINVALIDATION_LOGGING_H_
-
-#include "base/logging.h"
-
-namespace invalidation {
-
-using logging::LogMessage;
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_LOGGING_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h
index 5627db1..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h
@@ -1,18 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_MD5_H_
-#define GOOGLE_CACHEINVALIDATION_MD5_H_
-
-#include "base/md5.h"
-
-namespace invalidation {
-
-inline void ComputeMd5Digest(const string& data, string* digest) {
- *digest = MD5String(data);
-}
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_MD5_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h
index 4d64f0f..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h
@@ -1,26 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_MUTEX_H_
-#define GOOGLE_CACHEINVALIDATION_MUTEX_H_
-
-#include "base/logging.h"
-#include "base/synchronization/lock.h"
-
-namespace invalidation {
-
-typedef base::Lock Mutex;
-
-class MutexLock {
- public:
- explicit MutexLock(Mutex* m) : auto_lock_(*m) {}
-
- private:
- base::AutoLock auto_lock_;
- DISALLOW_COPY_AND_ASSIGN(MutexLock);
-};
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_MUTEX_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/random.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/random.h
index 89455f6..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/random.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/random.h
@@ -1,25 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_RANDOM_H_
-#define GOOGLE_CACHEINVALIDATION_RANDOM_H_
-
-#include "base/rand_util.h"
-
-namespace invalidation {
-
-class Random {
- public:
- // We don't actually use the seed.
- explicit Random(int64 seed) {}
-
- // Returns a pseudorandom value between(inclusive) and(exclusive).
- double RandDouble() {
- return base::RandDouble();
- }
-};
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_RANDOM_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h
index c31eb43e..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h
@@ -1,16 +0,0 @@
-// 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.
-
-#ifndef GOOGLE_CACHEINVALIDATION_SCOPED_PTR_H_
-#define GOOGLE_CACHEINVALIDATION_SCOPED_PTR_H_
-
-#include "base/memory/scoped_ptr.h"
-
-namespace invalidation {
-
-using ::scoped_ptr;
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_SCOPED_PTR_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/stl-namespace.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/stl-namespace.h
index fa6f031..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/stl-namespace.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/stl-namespace.h
@@ -1,10 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_STL_NAMESPACE_H_
-#define GOOGLE_CACHEINVALIDATION_STL_NAMESPACE_H_
-
-#define INVALIDATION_STL_NAMESPACE std
-
-#endif // GOOGLE_CACHEINVALIDATION_STL_NAMESPACE_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/string_util.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/string_util.h
index 36d3713..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/string_util.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/string_util.h
@@ -1,16 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_STRING_UTIL_H_
-#define GOOGLE_CACHEINVALIDATION_STRING_UTIL_H_
-
-#include "base/stringprintf.h"
-
-namespace invalidation {
-
-using base::StringAppendV;
-
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_STRING_UTIL_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/time.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/time.h
index 559b8b8..e69de29 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/time.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/time.h
@@ -1,16 +0,0 @@
-// Copyright (c) 2010 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 GOOGLE_CACHEINVALIDATION_TIME_H_
-#define GOOGLE_CACHEINVALIDATION_TIME_H_
-
-#include "base/time.h"
-
-namespace invalidation {
-typedef base::Time Time;
-typedef base::TimeTicks TimeTicks;
-typedef base::TimeDelta TimeDelta;
-} // namespace invalidation
-
-#endif // GOOGLE_CACHEINVALIDATION_TIME_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/callback.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/callback.h
new file mode 100644
index 0000000..d1e9274
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/callback.h
@@ -0,0 +1,126 @@
+// Copyright (c) 2012 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 GOOGLE_CACHEINVALIDATION_V2_CALLBACK_H_
+#define GOOGLE_CACHEINVALIDATION_V2_CALLBACK_H_
+
+#include "base/bind.h"
+#include "base/callback.h"
+
+#define INVALIDATION_CALLBACK1_TYPE(Arg1) ::base::Callback<void(Arg1)>
+
+// Below are a collection of types and functions that adapt base::Callback's
+// pass-by-value semantics to the pointer-based callback system that
+// cacheinvalidation needs.
+
+namespace invalidation {
+
+typedef ::base::Closure Closure;
+
+static inline void DoNothing() {}
+
+template <class T>
+bool IsCallbackRepeatable(const T* callback) {
+ // The default cacheinvalidation Callbacks may be self-deleting. We don't
+ // support this behave, so we already return true to indicate that the
+ // cacheinvalidation implementation should delete our Callbacks.
+ return true;
+}
+
+namespace internal {
+
+// Identity<T>::type is a typedef of T. Useful for preventing the
+// compiler from inferring the type of an argument in templates.
+template <typename T>
+struct Identity {
+ typedef T type;
+};
+
+} // namespace internal
+
+// The cacheinvalidation callback system expects to take the callback by
+// pointer and handle the ownership semantics itself. Adapting the
+// Chromium Callback system requires returning a dynamically allocated
+// copy of the result of Bind().
+
+inline Closure* NewPermanentCallback(void (*fn)()) {
+ return new ::base::Closure(::base::Bind(fn));
+}
+
+template <class T1, class T2>
+Closure* NewPermanentCallback(
+ T1* object, void (T2::*method)()) {
+ return new ::base::Closure(::base::Bind(method, base::Unretained(object)));
+}
+
+template <class T1, class T2, typename Arg1>
+::base::Callback<void(Arg1)>* NewPermanentCallback(
+ T1* object, void (T2::*method)(Arg1)) {
+ return new ::base::Callback<void(Arg1)>(
+ ::base::Bind(method, base::Unretained(object)));
+}
+
+template <class T1, class T2, typename Arg1>
+Closure* NewPermanentCallback(
+ T1* object,
+ void (T2::*method)(Arg1),
+ typename internal::Identity<Arg1>::type arg1) {
+ return new ::base::Closure(::base::Bind(method, base::Unretained(object),
+ arg1));
+}
+
+template <typename Arg1, typename Arg2>
+Closure* NewPermanentCallback(
+ void (*fn)(Arg1, Arg2),
+ typename internal::Identity<Arg1>::type arg1,
+ typename internal::Identity<Arg2>::type arg2) {
+ return new ::base::Closure(::base::Bind(fn, arg1, arg2));
+}
+
+template <class T1, class T2, typename Arg1, typename Arg2>
+Closure* NewPermanentCallback(
+ T1* object,
+ void (T2::*method)(Arg1, Arg2),
+ typename internal::Identity<Arg1>::type arg1,
+ typename internal::Identity<Arg2>::type arg2) {
+ return new ::base::Closure(::base::Bind(method, base::Unretained(object),
+ arg1, arg2));
+}
+
+template <class T1, class T2, typename Arg1, typename Arg2>
+::base::Callback<void(Arg2)>* NewPermanentCallback(
+ T1* object,
+ void (T2::*method)(Arg1, Arg2),
+ typename internal::Identity<Arg1>::type arg1) {
+ return new ::base::Callback<void(Arg2)>(
+ ::base::Bind(method, base::Unretained(object), arg1));
+}
+
+template <class T1, class T2, typename Arg1, typename Arg2, typename Arg3>
+Closure* NewPermanentCallback(
+ T1* object,
+ void (T2::*method)(Arg1, Arg2, Arg3),
+ typename internal::Identity<Arg1>::type arg1,
+ typename internal::Identity<Arg2>::type arg2,
+ typename internal::Identity<Arg3>::type arg3) {
+ return new ::base::Closure(::base::Bind(method, base::Unretained(object),
+ arg1, arg2, arg3));
+}
+
+template <class T1, class T2, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4>
+Closure* NewPermanentCallback(
+ T1* object,
+ void (T2::*method)(Arg1, Arg2, Arg3, Arg4),
+ typename internal::Identity<Arg1>::type arg1,
+ typename internal::Identity<Arg2>::type arg2,
+ typename internal::Identity<Arg3>::type arg3,
+ typename internal::Identity<Arg4>::type arg4) {
+ return new ::base::Closure(::base::Bind(method, base::Unretained(object),
+ arg1, arg2, arg3, arg4));
+}
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_CALLBACK_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/gmock.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/gmock.h
new file mode 100644
index 0000000..e6a121e
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/gmock.h
@@ -0,0 +1,91 @@
+// Copyright (c) 2012 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 GOOGLE_CACHEINVALIDATION_V2_GMOCK_H_
+#define GOOGLE_CACHEINVALIDATION_V2_GMOCK_H_
+
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace testing {
+namespace internal {
+
+// WhenDeserializedAs and EqualsProto are utilities that aren't part of gmock.
+
+// Implements WhenDeserializedAs<Proto>(proto_matcher).
+template <class Proto>
+class WhenDeserializedAsMatcher {
+ public:
+ typedef Matcher<const Proto&> InnerMatcher;
+
+ explicit WhenDeserializedAsMatcher(const InnerMatcher& proto_matcher)
+ : proto_matcher_(proto_matcher) {}
+
+ virtual ~WhenDeserializedAsMatcher() {}
+
+ // Deserializes the string as a protobuf of the same type as the expected
+ // protobuf.
+ Proto* Deserialize(const string& str) const {
+ Proto* proto = new Proto;
+ if (proto->ParsePartialFromString(str)) {
+ return proto;
+ } else {
+ delete proto;
+ return NULL;
+ }
+ }
+
+ void DescribeTo(::std::ostream* os) const {
+ *os << "can be deserialized as a protobuf that ";
+ proto_matcher_.DescribeTo(os);
+ }
+
+ void DescribeNegationTo(::std::ostream* os) const {
+ *os << "cannot be deserialized as a protobuf that ";
+ proto_matcher_.DescribeTo(os);
+ }
+
+ bool MatchAndExplain(const string& arg, MatchResultListener* listener) const {
+ // Deserializes the string arg as a protobuf of the same type as the
+ // expected protobuf.
+ scoped_ptr<const Proto> deserialized_arg(Deserialize(arg));
+ // No need to explain the match result.
+ return (deserialized_arg.get() != NULL) &&
+ proto_matcher_.Matches(*deserialized_arg);
+ }
+
+ private:
+ const InnerMatcher proto_matcher_;
+};
+
+} // namespace internal
+
+namespace proto {
+
+// WhenDeserializedAs<Proto>(m) is a matcher that matches a string
+// that can be deserialized as a protobuf of type Proto that matches
+// m, which can be any valid protobuf matcher.
+template <class Proto, class InnerMatcher>
+inline PolymorphicMatcher<internal::WhenDeserializedAsMatcher<Proto> >
+WhenDeserializedAs(const InnerMatcher& inner_matcher) {
+ return MakePolymorphicMatcher(
+ internal::WhenDeserializedAsMatcher<Proto>(
+ SafeMatcherCast<const Proto&>(inner_matcher)));
+}
+
+} // namespace proto
+
+MATCHER_P(EqualsProto, message, "") {
+ // TOOD(ghc): This implementation assume protobuf serialization is
+ // deterministic, which is true in practice but technically not something that
+ // code is supposed to rely on. However, it vastly simplifies the
+ // implementation...
+ std::string expected_serialized, actual_serialized;
+ message.SerializeToString(&expected_serialized);
+ arg.SerializeToString(&actual_serialized);
+ return expected_serialized == actual_serialized;
+}
+
+} // namespace testing
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_GMOCK_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/googletest.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/googletest.h
new file mode 100644
index 0000000..46bd071
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/googletest.h
@@ -0,0 +1,10 @@
+// Copyright (c) 2012 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 GOOGLE_CACHEINVALIDATION_V2_GOOGLETEST_H_
+#define GOOGLE_CACHEINVALIDATION_V2_GOOGLETEST_H_
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_GOOGLETEST_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/random.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/random.h
new file mode 100644
index 0000000..d8c586a
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/random.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 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 GOOGLE_CACHEINVALIDATION_V2_RANDOM_H_
+#define GOOGLE_CACHEINVALIDATION_V2_RANDOM_H_
+
+#include "base/rand_util.h"
+
+namespace invalidation {
+
+class Random {
+ public:
+ // We don't actually use the seed.
+ explicit Random(int64 seed) {}
+
+ // Returns a pseudorandom value between(inclusive) and(exclusive).
+ double RandDouble() {
+ return base::RandDouble();
+ }
+};
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_RANDOM_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h
index 8e15595..a22e3f2 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -10,8 +10,8 @@
#include <string>
#include "base/sha1.h"
-#include "google/cacheinvalidation/stl-namespace.h"
#include "google/cacheinvalidation/v2/digest-function.h"
+#include "google/cacheinvalidation/v2/stl-namespace.h"
namespace invalidation {
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/stl-namespace.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/stl-namespace.h
new file mode 100644
index 0000000..c660cbd
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/stl-namespace.h
@@ -0,0 +1,10 @@
+// Copyright (c) 2012 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 GOOGLE_CACHEINVALIDATION_V2_STL_NAMESPACE_H_
+#define GOOGLE_CACHEINVALIDATION_V2_STL_NAMESPACE_H_
+
+#define INVALIDATION_STL_NAMESPACE std
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_STL_NAMESPACE_H_