summaryrefslogtreecommitdiffstats
path: root/third_party/cacheinvalidation
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-02 19:04:18 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-02 19:04:18 +0000
commit1bfd03f4d81e40af457dce0c8a6df4308dedf849 (patch)
treeecb9eb655f2c627bde57900ab6e4f49107843dd3 /third_party/cacheinvalidation
parent7c75b4ce3dab78609129944ee91131e62ca36085 (diff)
downloadchromium_src-1bfd03f4d81e40af457dce0c8a6df4308dedf849.zip
chromium_src-1bfd03f4d81e40af457dce0c8a6df4308dedf849.tar.gz
chromium_src-1bfd03f4d81e40af457dce0c8a6df4308dedf849.tar.bz2
Patch by ghc@google.com.
BUG=88262 Review URL: http://codereview.chromium.org/7272042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/cacheinvalidation')
-rw-r--r--third_party/cacheinvalidation/cacheinvalidation.gyp99
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h38
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/logging.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/mutex.h26
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/scoped_ptr.h16
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h46
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/string_util.h18
-rw-r--r--third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/time.h16
8 files changed, 234 insertions, 41 deletions
diff --git a/third_party/cacheinvalidation/cacheinvalidation.gyp b/third_party/cacheinvalidation/cacheinvalidation.gyp
index 608b8f0..0a6fc3b 100644
--- a/third_party/cacheinvalidation/cacheinvalidation.gyp
+++ b/third_party/cacheinvalidation/cacheinvalidation.gyp
@@ -13,7 +13,8 @@
# proto_dir_root.
# TODO(akalin): Add a RULE_INPUT_DIR predefined variable to gyp so
# we don't need this variable.
- 'proto_dir_relpath': 'google/cacheinvalidation',
+ # TODO(ghc): Remove v2/ dir and move all files up a level.
+ 'proto_dir_relpath': 'google/cacheinvalidation/v2',
# Where files generated from proto files are put.
'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
# The path to the protoc executable.
@@ -26,8 +27,9 @@
'target_name': 'cacheinvalidation_proto',
'type': 'none',
'sources': [
- '<(proto_dir_root)/<(proto_dir_relpath)/internal.proto',
- '<(proto_dir_root)/<(proto_dir_relpath)/ticl_persistence.proto',
+ '<(proto_dir_root)/<(proto_dir_relpath)/client.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',
],
# TODO(akalin): This block was copied from the sync_proto target
@@ -63,10 +65,12 @@
'target_name': 'cacheinvalidation_proto_cpp',
'type': 'static_library',
'sources': [
- '<(protoc_out_dir)/<(proto_dir_relpath)/internal.pb.h',
- '<(protoc_out_dir)/<(proto_dir_relpath)/internal.pb.cc',
- '<(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)/client.pb.h',
+ '<(protoc_out_dir)/<(proto_dir_relpath)/client.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',
+ '<(protoc_out_dir)/<(proto_dir_relpath)/client_test_internal.pb.cc',
'<(protoc_out_dir)/<(proto_dir_relpath)/types.pb.h',
'<(protoc_out_dir)/<(proto_dir_relpath)/types.pb.cc',
],
@@ -99,37 +103,56 @@
'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/v2/logging.h',
'overrides/google/cacheinvalidation/md5.h',
- 'overrides/google/cacheinvalidation/mutex.h',
+ 'overrides/google/cacheinvalidation/v2/mutex.h',
'overrides/google/cacheinvalidation/random.h',
- 'overrides/google/cacheinvalidation/scoped_ptr.h',
+ 'overrides/google/cacheinvalidation/v2/scoped_ptr.h',
'overrides/google/cacheinvalidation/stl-namespace.h',
- 'overrides/google/cacheinvalidation/string_util.h',
- 'overrides/google/cacheinvalidation/time.h',
- 'files/src/google/cacheinvalidation/invalidation-client-impl.cc',
- 'files/src/google/cacheinvalidation/invalidation-client-impl.h',
- 'files/src/google/cacheinvalidation/invalidation-client.cc',
- 'files/src/google/cacheinvalidation/invalidation-client.h',
- 'files/src/google/cacheinvalidation/invalidation-types.h',
- '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/proto-converter.cc',
- 'files/src/google/cacheinvalidation/proto-converter.h',
- 'files/src/google/cacheinvalidation/registration-update-manager.cc',
- 'files/src/google/cacheinvalidation/registration-update-manager.h',
- 'files/src/google/cacheinvalidation/session-manager.cc',
- 'files/src/google/cacheinvalidation/session-manager.h',
- 'files/src/google/cacheinvalidation/throttle.cc',
- 'files/src/google/cacheinvalidation/throttle.h',
- 'files/src/google/cacheinvalidation/version-manager.cc',
- 'files/src/google/cacheinvalidation/version-manager.h',
+ 'overrides/google/cacheinvalidation/v2/string_util.h',
+ 'overrides/google/cacheinvalidation/v2/time.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/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/invalidation-client-impl.cc',
+ 'files/src/google/cacheinvalidation/v2/invalidation-client-impl.h',
+ 'files/src/google/cacheinvalidation/v2/invalidation-client.h',
+ 'files/src/google/cacheinvalidation/v2/invalidation-client-util.h',
+ 'files/src/google/cacheinvalidation/v2/invalidation-listener.h',
+ 'files/src/google/cacheinvalidation/v2/log-macro.h',
+ 'files/src/google/cacheinvalidation/v2/logging.h',
+ 'files/src/google/cacheinvalidation/v2/mutex.h',
+ 'files/src/google/cacheinvalidation/v2/object-id-digest-utils.cc',
+ 'files/src/google/cacheinvalidation/v2/object-id-digest-utils.h',
+ 'files/src/google/cacheinvalidation/v2/operation-scheduler.cc',
+ 'files/src/google/cacheinvalidation/v2/operation-scheduler.h',
+ 'files/src/google/cacheinvalidation/v2/persistence-utils.cc',
+ 'files/src/google/cacheinvalidation/v2/persistence-utils.h',
+ 'files/src/google/cacheinvalidation/v2/proto-converter.cc',
+ 'files/src/google/cacheinvalidation/v2/proto-converter.h',
+ 'files/src/google/cacheinvalidation/v2/proto-helpers.h',
+ 'files/src/google/cacheinvalidation/v2/protocol-handler.cc',
+ 'files/src/google/cacheinvalidation/v2/protocol-handler.h',
+ 'files/src/google/cacheinvalidation/v2/registration-manager.cc',
+ 'files/src/google/cacheinvalidation/v2/registration-manager.h',
+ 'files/src/google/cacheinvalidation/v2/run-state.h',
+ 'files/src/google/cacheinvalidation/v2/sha1-digest-function.h',
+ 'files/src/google/cacheinvalidation/v2/simple-registration-store.cc',
+ 'files/src/google/cacheinvalidation/v2/simple-registration-store.h',
+ 'files/src/google/cacheinvalidation/v2/smearer.h',
+ 'files/src/google/cacheinvalidation/v2/statistics.cc',
+ 'files/src/google/cacheinvalidation/v2/statistics.h',
+ 'files/src/google/cacheinvalidation/v2/string_util.h',
+ 'files/src/google/cacheinvalidation/v2/system-resources.h',
+ 'files/src/google/cacheinvalidation/v2/ticl-message-validator.h',
+ 'files/src/google/cacheinvalidation/v2/time.h',
+ 'files/src/google/cacheinvalidation/v2/types.h',
],
'include_dirs': [
'./overrides',
@@ -155,16 +178,12 @@
],
},
# Unittests for the cache invalidation library.
+ # TODO(ghc): Write native tests and include them here.
{
'target_name': 'cacheinvalidation_unittests',
'type': 'executable',
'sources': [
'../../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-manager_test.cc',
- 'files/src/google/cacheinvalidation/persistence-utils_test.cc',
- 'files/src/google/cacheinvalidation/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 0f42a91..cc0267a 100644
--- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.h
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/callback.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.
@@ -179,6 +179,29 @@ class ThreeArgCallbackRunner : public CallbackRunner<Tuple0> {
typename internal::remove_reference<Arg3>::type arg3_;
};
+template <class T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+class FourArgCallbackRunner : public CallbackRunner<Tuple0> {
+ public:
+ FourArgCallbackRunner(T* obj, void (T::*meth)(Arg1, Arg2, Arg3, Arg4),
+ Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+ : obj_(obj), meth_(meth), arg1_(arg1), arg2_(arg2), arg3_(arg3),
+ arg4_(arg4) {}
+
+ virtual ~FourArgCallbackRunner() {}
+
+ virtual void RunWithParams(const Tuple0& params) {
+ (obj_->*meth_)(arg1_, arg2_, arg3_, arg4_);
+ }
+
+ private:
+ T* obj_;
+ void (T::*meth_)(Arg1, Arg2, Arg3, Arg4);
+ typename internal::remove_reference<Arg1>::type arg1_;
+ typename internal::remove_reference<Arg2>::type arg2_;
+ typename internal::remove_reference<Arg3>::type arg3_;
+ typename internal::remove_reference<Arg4>::type arg4_;
+};
+
// Then route the appropriate overloads of NewPermanentCallback() to
// use the above.
@@ -237,6 +260,19 @@ typename Callback0::Type* NewPermanentCallback(
(object, method, arg1, arg2, arg3);
}
+template <class T1, class T2, typename Arg1, typename Arg2, typename Arg3,
+ typename Arg4>
+typename Callback0::Type* 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 FourArgCallbackRunner<T1, Arg1, Arg2, Arg3, Arg4>
+ (object, method, arg1, arg2, arg3, arg4);
+}
+
} // namespace invalidation
#endif // GOOGLE_CACHEINVALIDATION_CALLBACK_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/logging.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/logging.h
new file mode 100644
index 0000000..a2f27f0
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/logging.h
@@ -0,0 +1,16 @@
+// 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_V2_LOGGING_H_
+#define GOOGLE_CACHEINVALIDATION_V2_LOGGING_H_
+
+#include "base/logging.h"
+
+namespace invalidation {
+
+using logging::LogMessage;
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_LOGGING_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/mutex.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/mutex.h
new file mode 100644
index 0000000..7eda283
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/mutex.h
@@ -0,0 +1,26 @@
+// 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_V2_MUTEX_H_
+#define GOOGLE_CACHEINVALIDATION_V2_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_V2_MUTEX_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/scoped_ptr.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/scoped_ptr.h
new file mode 100644
index 0000000..80ed3cc
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/scoped_ptr.h
@@ -0,0 +1,16 @@
+// 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_V2_SCOPED_PTR_H_
+#define GOOGLE_CACHEINVALIDATION_V2_SCOPED_PTR_H_
+
+#include "base/memory/scoped_ptr.h"
+
+namespace invalidation {
+
+using ::scoped_ptr;
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_SCOPED_PTR_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
new file mode 100644
index 0000000..62dee55
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/sha1-digest-function.h
@@ -0,0 +1,46 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+// Author: ghc@google.com (Greg Cooper)
+//
+// Interface to SHA1 digest computation.
+
+#ifndef GOOGLE_CACHEINVALIDATION_V2_SHA1_DIGEST_FUNCTION_H_
+#define GOOGLE_CACHEINVALIDATION_V2_SHA1_DIGEST_FUNCTION_H_
+
+#include <string>
+
+#include "base/sha1.h"
+#include "google/cacheinvalidation/stl-namespace.h"
+#include "google/cacheinvalidation/v2/digest-function.h"
+
+namespace invalidation {
+
+using ::INVALIDATION_STL_NAMESPACE::string;
+
+class Sha1DigestFunction : public DigestFunction {
+ public:
+ Sha1DigestFunction() : reset_needed_(false) {}
+
+ virtual void Reset() {
+ reset_needed_ = false;
+ buffer_.clear();
+ }
+
+ virtual void Update(const string& s) {
+ CHECK(!reset_needed_);
+ buffer_.append(s);
+ }
+
+ virtual string GetDigest() {
+ CHECK(!reset_needed_);
+ reset_needed_ = true;
+ return base::SHA1HashString(buffer_);
+ }
+
+ private:
+ string buffer_;
+ bool reset_needed_;
+};
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_SHA1_DIGEST_FUNCTION_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/string_util.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/string_util.h
new file mode 100644
index 0000000..1b7246d
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/string_util.h
@@ -0,0 +1,18 @@
+// 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_V2_STRING_UTIL_H_
+#define GOOGLE_CACHEINVALIDATION_V2_STRING_UTIL_H_
+
+#include "base/string_number_conversions.h"
+#include "base/stringprintf.h"
+
+namespace invalidation {
+
+using base::IntToString;
+using base::StringAppendV;
+
+} // namespace invalidation
+
+#endif // GOOGLE_CACHEINVALIDATION_V2_STRING_UTIL_H_
diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/time.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/time.h
new file mode 100644
index 0000000..b8644f5
--- /dev/null
+++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/v2/time.h
@@ -0,0 +1,16 @@
+// 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_V2_TIME_H_
+#define GOOGLE_CACHEINVALIDATION_V2_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_V2_TIME_H_