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

Side by Side Diff: components/sync/android/java/src/org/chromium/components/sync/ModelTypeHelper.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.components.sync; 5 package org.chromium.components.sync;
6 6
7 import com.google.ipc.invalidation.external.client.types.ObjectId; 7 import com.google.ipc.invalidation.external.client.types.ObjectId;
8 import com.google.protos.ipc.invalidation.Types; 8 import com.google.protos.ipc.invalidation.Types;
9 9
10 import org.chromium.base.VisibleForTesting; 10 import org.chromium.base.VisibleForTesting;
(...skipping 18 matching lines...) Expand all
29 * {@link ModelTypeHelper#toNotificationType()} for tests. 29 * {@link ModelTypeHelper#toNotificationType()} for tests.
30 */ 30 */
31 public interface TestDelegate { public String toNotificationType(int modelTy pe); } 31 public interface TestDelegate { public String toNotificationType(int modelTy pe); }
32 32
33 private static final String TAG = "ModelTypeHelper"; 33 private static final String TAG = "ModelTypeHelper";
34 34
35 private static final Object sLock = new Object(); 35 private static final Object sLock = new Object();
36 36
37 private static final int[] NON_INVALIDATION_TYPES_ARRAY = new int[] {ModelTy pe.PROXY_TABS}; 37 private static final int[] NON_INVALIDATION_TYPES_ARRAY = new int[] {ModelTy pe.PROXY_TABS};
38 38
39 private static TestDelegate sDelegate = null; 39 private static TestDelegate sDelegate;
40 40
41 // Convenience sets for checking whether a type can have invalidations. Some ModelTypes 41 // Convenience sets for checking whether a type can have invalidations. Some ModelTypes
42 // such as PROXY_TABS are not real types and can't be registered. Initializi ng these 42 // such as PROXY_TABS are not real types and can't be registered. Initializi ng these
43 // once reduces toNotificationType() calls in the isInvalidationType() metho d. 43 // once reduces toNotificationType() calls in the isInvalidationType() metho d.
44 private static Set<String> sNonInvalidationTypes = null; 44 private static Set<String> sNonInvalidationTypes;
45 45
46 /** 46 /**
47 * Initializes the non-invalidation sets. Called lazily the first time they' re needed. 47 * Initializes the non-invalidation sets. Called lazily the first time they' re needed.
48 */ 48 */
49 private static void initNonInvalidationTypes() { 49 private static void initNonInvalidationTypes() {
50 synchronized (sLock) { 50 synchronized (sLock) {
51 if (sNonInvalidationTypes != null) return; 51 if (sNonInvalidationTypes != null) return;
52 52
53 sNonInvalidationTypes = new HashSet<String>(); 53 sNonInvalidationTypes = new HashSet<String>();
54 for (int i = 0; i < NON_INVALIDATION_TYPES_ARRAY.length; i++) { 54 for (int i = 0; i < NON_INVALIDATION_TYPES_ARRAY.length; i++) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return objectIds; 118 return objectIds;
119 } 119 }
120 120
121 @VisibleForTesting 121 @VisibleForTesting
122 public static void setTestDelegate(TestDelegate delegate) { 122 public static void setTestDelegate(TestDelegate delegate) {
123 sDelegate = delegate; 123 sDelegate = delegate;
124 } 124 }
125 125
126 private static native String nativeModelTypeToNotificationType(int modelType ); 126 private static native String nativeModelTypeToNotificationType(int modelType );
127 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698