OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.background_task_scheduler; | 5 package org.chromium.components.background_task_scheduler; |
6 | 6 |
7 import android.os.Build; | 7 import android.os.Build; |
8 | 8 |
9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
(...skipping 19 matching lines...) Expand all Loading... |
30 public static BackgroundTaskScheduler getScheduler() { | 30 public static BackgroundTaskScheduler getScheduler() { |
31 ThreadUtils.assertOnUiThread(); | 31 ThreadUtils.assertOnUiThread(); |
32 if (sInstance == null) { | 32 if (sInstance == null) { |
33 sInstance = | 33 sInstance = |
34 new BackgroundTaskScheduler(getSchedulerDelegateForSdk(Build
.VERSION.SDK_INT)); | 34 new BackgroundTaskScheduler(getSchedulerDelegateForSdk(Build
.VERSION.SDK_INT)); |
35 } | 35 } |
36 return sInstance; | 36 return sInstance; |
37 } | 37 } |
38 | 38 |
39 @VisibleForTesting | 39 @VisibleForTesting |
40 static void setSchedulerForTesting(BackgroundTaskScheduler scheduler) { | 40 public static void setSchedulerForTesting(BackgroundTaskScheduler scheduler)
{ |
41 sInstance = scheduler; | 41 sInstance = scheduler; |
42 } | 42 } |
43 | 43 |
44 // Do not instantiate. | 44 // Do not instantiate. |
45 private BackgroundTaskSchedulerFactory() {} | 45 private BackgroundTaskSchedulerFactory() {} |
46 } | 46 } |
OLD | NEW |