summaryrefslogtreecommitdiffstats
path: root/third_party/cacheinvalidation/overrides
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 09:51:42 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 09:51:42 +0000
commitb5d1f3f32f08c4d58e58a3214e527e2a3e191d43 (patch)
tree7dad3407978cfdb921fd4a72c4bf26a56bf58ef0 /third_party/cacheinvalidation/overrides
parentff3b3624419bbdab28faf021566b22c1fa3660f5 (diff)
downloadchromium_src-b5d1f3f32f08c4d58e58a3214e527e2a3e191d43.zip
chromium_src-b5d1f3f32f08c4d58e58a3214e527e2a3e191d43.tar.gz
chromium_src-b5d1f3f32f08c4d58e58a3214e527e2a3e191d43.tar.bz2
Summary of changes to cacheinvalidation client:
- adds ResourceComponent and BasicSystemResources - adds unit tests for ProtocolHandler - adds delay before sending first message after restart, to avoid unnecessary and expensive invocation of registration sync protocol - adds a check to prevent Start() from being called multiple times - deletes all v1 code and overrides - various internal cleanups and minor refactorings Review URL: https://chromiumcodereview.appspot.com/9185038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/cacheinvalidation/overrides')
-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
19 files changed, 264 insertions, 317 deletions
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_