Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: components/invalidation/impl/invalidation_service_android.cc

Issue 2201503002: [sync] Transient_invalidation_error in chrome://invalidations on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/invalidation/impl/invalidation_service_android.h" 5 #include "components/invalidation/impl/invalidation_service_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "components/invalidation/public/object_id_invalidation_map.h" 11 #include "components/invalidation/public/object_id_invalidation_map.h"
12 #include "google/cacheinvalidation/types.pb.h" 12 #include "google/cacheinvalidation/types.pb.h"
13 #include "jni/InvalidationService_jni.h" 13 #include "jni/InvalidationService_jni.h"
14 14
15 using base::android::ConvertJavaStringToUTF8; 15 using base::android::ConvertJavaStringToUTF8;
16 using base::android::ConvertUTF8ToJavaString; 16 using base::android::ConvertUTF8ToJavaString;
17 17
18 namespace invalidation { 18 namespace invalidation {
19 19
20 InvalidationServiceAndroid::InvalidationServiceAndroid(jobject context) 20 InvalidationServiceAndroid::InvalidationServiceAndroid(jobject context)
21 : invalidator_state_(syncer::INVALIDATIONS_ENABLED), 21 : invalidator_state_(syncer::INVALIDATIONS_ENABLED),
22 logger_() { 22 logger_() {
23 DCHECK(CalledOnValidThread()); 23 DCHECK(CalledOnValidThread());
24 JNIEnv* env = base::android::AttachCurrentThread(); 24 JNIEnv* env = base::android::AttachCurrentThread();
25 base::android::ScopedJavaLocalRef<jobject> local_java_ref = 25 base::android::ScopedJavaLocalRef<jobject> local_java_ref =
26 Java_InvalidationService_create(env, 26 Java_InvalidationService_create(env,
27 context, 27 context,
28 reinterpret_cast<intptr_t>(this)); 28 reinterpret_cast<intptr_t>(this));
29 java_ref_.Reset(env, local_java_ref.obj()); 29 java_ref_.Reset(env, local_java_ref.obj());
30 logger_.OnStateChange(invalidator_state_);
30 } 31 }
31 32
32 InvalidationServiceAndroid::~InvalidationServiceAndroid() { } 33 InvalidationServiceAndroid::~InvalidationServiceAndroid() { }
33 34
34 void InvalidationServiceAndroid::RegisterInvalidationHandler( 35 void InvalidationServiceAndroid::RegisterInvalidationHandler(
35 syncer::InvalidationHandler* handler) { 36 syncer::InvalidationHandler* handler) {
36 DCHECK(CalledOnValidThread()); 37 DCHECK(CalledOnValidThread());
37 invalidator_registrar_.RegisterHandler(handler); 38 invalidator_registrar_.RegisterHandler(handler);
38 logger_.OnRegistration(handler->GetOwnerName()); 39 logger_.OnRegistration(handler->GetOwnerName());
39 } 40 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 object_invalidation_map); 168 object_invalidation_map);
168 logger_.OnInvalidation(object_invalidation_map); 169 logger_.OnInvalidation(object_invalidation_map);
169 } 170 }
170 171
171 // static 172 // static
172 bool InvalidationServiceAndroid::RegisterJni(JNIEnv* env) { 173 bool InvalidationServiceAndroid::RegisterJni(JNIEnv* env) {
173 return RegisterNativesImpl(env); 174 return RegisterNativesImpl(env);
174 } 175 }
175 176
176 } // namespace invalidation 177 } // namespace invalidation
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698