OLD | NEW |
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.chrome.browser.precache; | 5 package org.chromium.chrome.browser.precache; |
6 | 6 |
| 7 import android.annotation.SuppressLint; |
7 import android.content.BroadcastReceiver; | 8 import android.content.BroadcastReceiver; |
8 import android.content.Context; | 9 import android.content.Context; |
9 import android.content.Intent; | 10 import android.content.Intent; |
10 import android.content.IntentFilter; | 11 import android.content.IntentFilter; |
11 import android.content.SharedPreferences; | 12 import android.content.SharedPreferences; |
12 import android.net.ConnectivityManager; | 13 import android.net.ConnectivityManager; |
13 import android.os.Handler; | 14 import android.os.Handler; |
14 import android.os.Looper; | 15 import android.os.Looper; |
15 import android.os.PowerManager; | 16 import android.os.PowerManager; |
16 import android.os.PowerManager.WakeLock; | 17 import android.os.PowerManager.WakeLock; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 Collections.unmodifiableSet(new HashSet<Integer>(Arrays.asList(Model
Type.SESSIONS))); | 75 Collections.unmodifiableSet(new HashSet<Integer>(Arrays.asList(Model
Type.SESSIONS))); |
75 | 76 |
76 private static final String PREF_PRECACHE_PERIODIC_TASK_START_TIME_MS = | 77 private static final String PREF_PRECACHE_PERIODIC_TASK_START_TIME_MS = |
77 "precache.periodic_task_start_time_ms"; | 78 "precache.periodic_task_start_time_ms"; |
78 | 79 |
79 /** | 80 /** |
80 * Singleton instance of the PrecacheController. PrecacheController is a | 81 * Singleton instance of the PrecacheController. PrecacheController is a |
81 * singleton so that there is a single handle by which to determine if | 82 * singleton so that there is a single handle by which to determine if |
82 * precaching is underway, and to cancel it if necessary. | 83 * precaching is underway, and to cancel it if necessary. |
83 */ | 84 */ |
| 85 @SuppressLint("StaticFieldLeak") |
84 private static PrecacheController sInstance; | 86 private static PrecacheController sInstance; |
85 | 87 |
86 /** | 88 /** |
87 * The default task scheduler. Overridden for tests. | 89 * The default task scheduler. Overridden for tests. |
88 */ | 90 */ |
89 private static PrecacheTaskScheduler sTaskScheduler = new PrecacheTaskSchedu
ler(); | 91 private static PrecacheTaskScheduler sTaskScheduler = new PrecacheTaskSchedu
ler(); |
90 | 92 |
91 /** | 93 /** |
92 * Listener for syncservice backend. | 94 * Listener for syncservice backend. |
93 */ | 95 */ |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 563 |
562 private void recordBatteryLevelAtEnd() { | 564 private void recordBatteryLevelAtEnd() { |
563 int delta_percentage = mDeviceState.getCurrentBatteryPercentage(mAppCont
ext) | 565 int delta_percentage = mDeviceState.getCurrentBatteryPercentage(mAppCont
ext) |
564 - mDeviceState.getSavedBatteryPercentage(); | 566 - mDeviceState.getSavedBatteryPercentage(); |
565 if (delta_percentage >= 0) { | 567 if (delta_percentage >= 0) { |
566 RecordHistogram.recordPercentageHistogram( | 568 RecordHistogram.recordPercentageHistogram( |
567 "Precache.BatteryPercentageDiff.End", delta_percentage); | 569 "Precache.BatteryPercentageDiff.End", delta_percentage); |
568 } | 570 } |
569 } | 571 } |
570 } | 572 } |
OLD | NEW |