summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-13 02:04:22 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-13 02:04:22 +0000
commit5bfa2566e4d2cfbf651df5bb7b76177d3429ae61 (patch)
treee6f6b0d08e2b7ce77ae01cad4ec5c0699cb15d7d /third_party
parent7a3a965742838666dbfb3665783d08f3976f1d6c (diff)
downloadchromium_src-5bfa2566e4d2cfbf651df5bb7b76177d3429ae61.zip
chromium_src-5bfa2566e4d2cfbf651df5bb7b76177d3429ae61.tar.gz
chromium_src-5bfa2566e4d2cfbf651df5bb7b76177d3429ae61.tar.bz2
[Sync] Rolled cache invalidation API to @49.
Made changes to reflect API changes. Added more partially-applied callback implementations. Added more needed includes. BUG=58556 TEST=Existing unit tests Review URL: http://codereview.chromium.org/3665003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/cacheinvalidation/cacheinvalidation.gyp13
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h60
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h10
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h18
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h16
6 files changed, 133 insertions, 0 deletions
diff --git a/third_party/cacheinvalidation/cacheinvalidation.gyp b/third_party/cacheinvalidation/cacheinvalidation.gyp
index 5cadd54..60d64cb 100644
--- a/third_party/cacheinvalidation/cacheinvalidation.gyp
+++ b/third_party/cacheinvalidation/cacheinvalidation.gyp
@@ -24,6 +24,7 @@
'target_name': 'cacheinvalidation_proto',
'type': 'none',
'sources': [
+ '<(proto_dir_root)/google/cacheinvalidation/ticl_persistence.proto',
'<(proto_dir_root)/google/cacheinvalidation/types.proto',
],
# TODO(akalin): This block was copied from the sync_proto target
@@ -63,14 +64,20 @@
'target_name': 'cacheinvalidation',
'type': '<(library)',
'sources': [
+ '<(protoc_out_dir)/<(proto_dir_relpath)/ticl_persistence.pb.h',
+ '<(protoc_out_dir)/<(proto_dir_relpath)/ticl_persistence.pb.cc',
'<(protoc_out_dir)/<(proto_dir_relpath)/types.pb.h',
'<(protoc_out_dir)/<(proto_dir_relpath)/types.pb.cc',
'overrides/google/cacheinvalidation/callback.h',
'overrides/google/cacheinvalidation/compiler-specific.h',
+ 'overrides/google/cacheinvalidation/gmock.h',
'overrides/google/cacheinvalidation/googletest.h',
+ 'overrides/google/cacheinvalidation/hash_map.h',
'overrides/google/cacheinvalidation/logging.h',
+ 'overrides/google/cacheinvalidation/md5.h',
'overrides/google/cacheinvalidation/mutex.h',
'overrides/google/cacheinvalidation/random.h',
+ 'overrides/google/cacheinvalidation/scoped_ptr.h',
'overrides/google/cacheinvalidation/stl-namespace.h'
'overrides/google/cacheinvalidation/string_util.h'
'overrides/google/cacheinvalidation/time.h',
@@ -81,6 +88,10 @@
'files/src/google/cacheinvalidation/log-macro.h',
'files/src/google/cacheinvalidation/network-manager.cc',
'files/src/google/cacheinvalidation/network-manager.h',
+ 'files/src/google/cacheinvalidation/persistence-manager.cc',
+ 'files/src/google/cacheinvalidation/persistence-manager.h',
+ 'files/src/google/cacheinvalidation/persistence-utils.cc',
+ 'files/src/google/cacheinvalidation/persistence-utils.h',
'files/src/google/cacheinvalidation/registration-update-manager.cc',
'files/src/google/cacheinvalidation/registration-update-manager.h',
'files/src/google/cacheinvalidation/session-manager.cc',
@@ -123,11 +134,13 @@
'../../base/test/run_all_unittests.cc',
'files/src/google/cacheinvalidation/system-resources-for-test.h',
'files/src/google/cacheinvalidation/invalidation-client-impl_test.cc',
+ 'files/src/google/cacheinvalidation/persistence-utils_test.cc',
'files/src/google/cacheinvalidation/throttle_test.cc',
],
'dependencies': [
'../../base/base.gyp:base',
'../../base/base.gyp:test_support_base',
+ '../../testing/gmock.gyp:gmock',
'../../testing/gtest.gyp:gtest',
'cacheinvalidation',
],
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
index d0ec702..5f41f64 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
@@ -139,6 +139,46 @@ class TwoArgCallbackRunner : public CallbackRunner<Tuple0> {
typename internal::remove_reference<Arg2>::type arg2_;
};
+template <class T, typename Arg1, typename Arg2>
+class TwoArgOnePartialCallbackRunner : public CallbackRunner<Tuple1<Arg2> > {
+ public:
+ TwoArgOnePartialCallbackRunner(T* obj, void (T::*meth)(Arg1, Arg2),
+ Arg1 arg1)
+ : obj_(obj), meth_(meth), arg1_(arg1) {}
+
+ virtual ~TwoArgOnePartialCallbackRunner() {}
+
+ virtual void RunWithParams(const Tuple1<Arg2>& params) {
+ (obj_->*meth_)(arg1_, params.a);
+ }
+
+ private:
+ T* obj_;
+ void (T::*meth_)(Arg1, Arg2);
+ typename internal::remove_reference<Arg1>::type arg1_;
+};
+
+template <class T, typename Arg1, typename Arg2, typename Arg3>
+class ThreeArgCallbackRunner : public CallbackRunner<Tuple0> {
+ public:
+ ThreeArgCallbackRunner(T* obj, void (T::*meth)(Arg1, Arg2, Arg3),
+ Arg1 arg1, Arg2 arg2, Arg3 arg3)
+ : obj_(obj), meth_(meth), arg1_(arg1), arg2_(arg2), arg3_(arg3) {}
+
+ virtual ~ThreeArgCallbackRunner() {}
+
+ virtual void RunWithParams(const Tuple0& params) {
+ (obj_->*meth_)(arg1_, arg2_, arg3_);
+ }
+
+ private:
+ T* obj_;
+ void (T::*meth_)(Arg1, Arg2, Arg3);
+ typename internal::remove_reference<Arg1>::type arg1_;
+ typename internal::remove_reference<Arg2>::type arg2_;
+ typename internal::remove_reference<Arg3>::type arg3_;
+};
+
// Then route the appropriate overloads of NewPermanentCallback() to
// use the above.
@@ -177,6 +217,26 @@ typename Callback0::Type* NewPermanentCallback(
return new TwoArgCallbackRunner<T1, Arg1, Arg2>(object, method, arg1, arg2);
}
+template <class T1, class T2, typename Arg1, typename Arg2>
+typename Callback1<Arg2>::Type* NewPermanentCallback(
+ T1* object,
+ void (T2::*method)(Arg1, Arg2),
+ typename internal::Identity<Arg1>::type arg1) {
+ return new TwoArgOnePartialCallbackRunner<T1, Arg1, Arg2>(
+ object, method, arg1);
+}
+
+template <class T1, class T2, typename Arg1, typename Arg2, typename Arg3>
+typename Callback0::Type* 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 ThreeArgCallbackRunner<T1, Arg1, Arg2, Arg3>
+ (object, method, arg1, arg2, arg3);
+}
+
} // namespace invalidation
#endif // GOOGLE_CACHEINVALIDATION_CALLBACK_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h
new file mode 100644
index 0000000..8afb9fb
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/gmock.h
@@ -0,0 +1,10 @@
+// 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/hash_map.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h
new file mode 100644
index 0000000..3dbe724
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/hash_map.h
@@ -0,0 +1,16 @@
+// 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/md5.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h
new file mode 100644
index 0000000..5627db1
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/md5.h
@@ -0,0 +1,18 @@
+// 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/scoped_ptr.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h
new file mode 100644
index 0000000..021d2dd
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/scoped_ptr.h
@@ -0,0 +1,16 @@
+// 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_SCOPED_PTR_H_
+#define GOOGLE_CACHEINVALIDATION_SCOPED_PTR_H_
+
+#include "base/scoped_ptr.h"
+
+namespace invalidation {
+
+using ::scoped_ptr;
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_SCOPED_PTR_H_