| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_ANDROID_H_ | 5 #ifndef COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_ANDROID_H_ |
| 6 #define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_ANDROID_H_ | 6 #define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stdint.h> |
| 10 |
| 9 #include <map> | 11 #include <map> |
| 10 | 12 |
| 11 #include "base/android/jni_android.h" | 13 #include "base/android/jni_android.h" |
| 12 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 17 #include "components/invalidation/impl/invalidation_logger.h" | 19 #include "components/invalidation/impl/invalidation_logger.h" |
| 18 #include "components/invalidation/impl/invalidator_registrar.h" | 20 #include "components/invalidation/impl/invalidator_registrar.h" |
| 19 #include "components/invalidation/public/invalidation_service.h" | 21 #include "components/invalidation/public/invalidation_service.h" |
| 20 #include "components/keyed_service/core/keyed_service.h" | 22 #include "components/keyed_service/core/keyed_service.h" |
| 21 | 23 |
| 22 namespace invalidation { | 24 namespace invalidation { |
| 23 | 25 |
| 24 class InvalidationLogger; | 26 class InvalidationLogger; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 jlong version, | 59 jlong version, |
| 58 const base::android::JavaParamRef<jstring>& state); | 60 const base::android::JavaParamRef<jstring>& state); |
| 59 | 61 |
| 60 // The InvalidationServiceAndroid always reports that it is enabled. | 62 // The InvalidationServiceAndroid always reports that it is enabled. |
| 61 // This is used only by unit tests. | 63 // This is used only by unit tests. |
| 62 void TriggerStateChangeForTest(syncer::InvalidatorState state); | 64 void TriggerStateChangeForTest(syncer::InvalidatorState state); |
| 63 | 65 |
| 64 static bool RegisterJni(JNIEnv* env); | 66 static bool RegisterJni(JNIEnv* env); |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 typedef std::map<invalidation::ObjectId, | 69 typedef std::map<invalidation::ObjectId, int64_t, syncer::ObjectIdLessThan> |
| 68 int64, | 70 ObjectIdVersionMap; |
| 69 syncer::ObjectIdLessThan> ObjectIdVersionMap; | |
| 70 | 71 |
| 71 // Friend class so that InvalidationServiceFactoryAndroid has access to | 72 // Friend class so that InvalidationServiceFactoryAndroid has access to |
| 72 // private member object java_ref_. | 73 // private member object java_ref_. |
| 73 friend class InvalidationServiceFactoryAndroid; | 74 friend class InvalidationServiceFactoryAndroid; |
| 74 | 75 |
| 75 // Points to a Java instance of InvalidationService. | 76 // Points to a Java instance of InvalidationService. |
| 76 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 77 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 77 | 78 |
| 78 syncer::InvalidatorRegistrar invalidator_registrar_; | 79 syncer::InvalidatorRegistrar invalidator_registrar_; |
| 79 syncer::InvalidatorState invalidator_state_; | 80 syncer::InvalidatorState invalidator_state_; |
| 80 | 81 |
| 81 // The invalidation API spec allows for the possibility of redundant | 82 // The invalidation API spec allows for the possibility of redundant |
| 82 // invalidations, so keep track of the max versions and drop | 83 // invalidations, so keep track of the max versions and drop |
| 83 // invalidations with old versions. | 84 // invalidations with old versions. |
| 84 ObjectIdVersionMap max_invalidation_versions_; | 85 ObjectIdVersionMap max_invalidation_versions_; |
| 85 | 86 |
| 86 // The invalidation logger object we use to record state changes | 87 // The invalidation logger object we use to record state changes |
| 87 // and invalidations. | 88 // and invalidations. |
| 88 InvalidationLogger logger_; | 89 InvalidationLogger logger_; |
| 89 | 90 |
| 90 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid); | 91 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace invalidation | 94 } // namespace invalidation |
| 94 | 95 |
| 95 #endif // COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_ANDROID_H_ | 96 #endif // COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_ANDROID_H_ |
| OLD | NEW |