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.content.BroadcastReceiver; | 7 import android.content.BroadcastReceiver; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.IntentFilter; | 10 import android.content.IntentFilter; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 * The default task scheduler. Overridden for tests. | 87 * The default task scheduler. Overridden for tests. |
88 */ | 88 */ |
89 private static PrecacheTaskScheduler sTaskScheduler = new PrecacheTaskSchedu
ler(); | 89 private static PrecacheTaskScheduler sTaskScheduler = new PrecacheTaskSchedu
ler(); |
90 | 90 |
91 /** | 91 /** |
92 * Listener for syncservice backend. | 92 * Listener for syncservice backend. |
93 */ | 93 */ |
94 SyncServiceInitializedNotifier mSyncServiceNotifier; | 94 SyncServiceInitializedNotifier mSyncServiceNotifier; |
95 | 95 |
96 /** True if a precache session is in progress. Threadsafe. */ | 96 /** True if a precache session is in progress. Threadsafe. */ |
97 private boolean mIsPrecaching = false; | 97 private boolean mIsPrecaching; |
98 | 98 |
99 /** Wakelock that is held while precaching is in progress. */ | 99 /** Wakelock that is held while precaching is in progress. */ |
100 private WakeLock mPrecachingWakeLock; | 100 private WakeLock mPrecachingWakeLock; |
101 | 101 |
102 private Context mAppContext; | 102 private Context mAppContext; |
103 private Queue<Integer> mFailureReasonsToRecord = new ArrayDeque<Integer>(); | 103 private Queue<Integer> mFailureReasonsToRecord = new ArrayDeque<Integer>(); |
104 private DeviceState mDeviceState = DeviceState.getInstance(); | 104 private DeviceState mDeviceState = DeviceState.getInstance(); |
105 | 105 |
106 /** Receiver that will be notified when conditions become wrong for precachi
ng. */ | 106 /** Receiver that will be notified when conditions become wrong for precachi
ng. */ |
107 private final BroadcastReceiver mDeviceStateReceiver = new BroadcastReceiver
() { | 107 private final BroadcastReceiver mDeviceStateReceiver = new BroadcastReceiver
() { |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 561 |
562 private void recordBatteryLevelAtEnd() { | 562 private void recordBatteryLevelAtEnd() { |
563 int delta_percentage = mDeviceState.getCurrentBatteryPercentage(mAppCont
ext) | 563 int delta_percentage = mDeviceState.getCurrentBatteryPercentage(mAppCont
ext) |
564 - mDeviceState.getSavedBatteryPercentage(); | 564 - mDeviceState.getSavedBatteryPercentage(); |
565 if (delta_percentage >= 0) { | 565 if (delta_percentage >= 0) { |
566 RecordHistogram.recordPercentageHistogram( | 566 RecordHistogram.recordPercentageHistogram( |
567 "Precache.BatteryPercentageDiff.End", delta_percentage); | 567 "Precache.BatteryPercentageDiff.End", delta_percentage); |
568 } | 568 } |
569 } | 569 } |
570 } | 570 } |
OLD | NEW |