OLD | NEW |
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 package org.chromium.chrome.browser.invalidation; | 5 package org.chromium.chrome.browser.invalidation; |
6 | 6 |
7 import android.content.Context; | |
8 | |
9 import org.chromium.base.ThreadUtils; | 7 import org.chromium.base.ThreadUtils; |
10 import org.chromium.base.VisibleForTesting; | 8 import org.chromium.base.VisibleForTesting; |
11 import org.chromium.base.annotations.JNINamespace; | 9 import org.chromium.base.annotations.JNINamespace; |
12 import org.chromium.chrome.browser.profiles.Profile; | 10 import org.chromium.chrome.browser.profiles.Profile; |
13 import org.chromium.components.invalidation.InvalidationService; | 11 import org.chromium.components.invalidation.InvalidationService; |
14 | 12 |
15 import java.util.HashMap; | 13 import java.util.HashMap; |
16 import java.util.Map; | 14 import java.util.Map; |
17 | 15 |
18 /** | 16 /** |
(...skipping 17 matching lines...) Expand all Loading... |
36 ThreadUtils.assertOnUiThread(); | 34 ThreadUtils.assertOnUiThread(); |
37 InvalidationService service = sServiceMap.get(profile); | 35 InvalidationService service = sServiceMap.get(profile); |
38 if (service == null) { | 36 if (service == null) { |
39 service = nativeGetForProfile(profile); | 37 service = nativeGetForProfile(profile); |
40 sServiceMap.put(profile, service); | 38 sServiceMap.put(profile, service); |
41 } | 39 } |
42 return service; | 40 return service; |
43 } | 41 } |
44 | 42 |
45 @VisibleForTesting | 43 @VisibleForTesting |
46 public static InvalidationService getForTest(Context context) { | 44 public static InvalidationService getForTest() { |
47 return nativeGetForTest(context); | 45 return nativeGetForTest(); |
48 } | 46 } |
49 | 47 |
50 private static native InvalidationService nativeGetForProfile(Profile profil
e); | 48 private static native InvalidationService nativeGetForProfile(Profile profil
e); |
51 private static native InvalidationService nativeGetForTest(Context context); | 49 private static native InvalidationService nativeGetForTest(); |
52 } | 50 } |
OLD | NEW |