| 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 java.util.EnumSet; | 7 import java.util.EnumSet; |
| 8 | 8 |
| 9 /** A reason why prefetching failed to start. */ | 9 /** A reason why prefetching failed to start. */ |
| 10 enum FailureReason { | 10 enum FailureReason { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 NATIVE_SHOULD_RUN_IS_FALSE(3), | 21 NATIVE_SHOULD_RUN_IS_FALSE(3), |
| 22 | 22 |
| 23 /** DeviceState#isPowerConnected() returns false. */ | 23 /** DeviceState#isPowerConnected() returns false. */ |
| 24 NO_POWER(4), | 24 NO_POWER(4), |
| 25 | 25 |
| 26 /** DeviceState#isWifiAvailable() returns false. */ | 26 /** DeviceState#isWifiAvailable() returns false. */ |
| 27 NO_WIFI(5), | 27 NO_WIFI(5), |
| 28 | 28 |
| 29 // Deprecated: SCREEN_ON(6). | 29 // Deprecated: SCREEN_ON(6). |
| 30 | 30 |
| 31 /** PrecacheServiceLauncher#timeSinceLastPrecacheMs() is too recent. */ | 31 // Deprecated: NOT_ENOUGH_TIME_SINCE_LAST_PRECACHE(7), |
| 32 NOT_ENOUGH_TIME_SINCE_LAST_PRECACHE(7), | |
| 33 | 32 |
| 34 /** PrecacheService#isPrecaching() returns true. */ | 33 /** PrecacheController#isPrecaching() returns true. */ |
| 35 CURRENTLY_PRECACHING(8); | 34 CURRENTLY_PRECACHING(8); |
| 36 | 35 |
| 37 /** Returns the set of reasons as a bit vector. */ | 36 /** Returns the set of reasons as a bit vector. */ |
| 38 static int bitValue(EnumSet<FailureReason> reasons) { | 37 static int bitValue(EnumSet<FailureReason> reasons) { |
| 39 int value = 0; | 38 int value = 0; |
| 40 for (FailureReason reason : reasons) value |= 1 << reason.mPosition; | 39 for (FailureReason reason : reasons) value |= 1 << reason.mPosition; |
| 41 return value; | 40 return value; |
| 42 } | 41 } |
| 43 | 42 |
| 44 FailureReason(int position) { | 43 FailureReason(int position) { |
| 45 this.mPosition = position; | 44 this.mPosition = position; |
| 46 } | 45 } |
| 47 | 46 |
| 48 /** The bit position, to be set when computing the bit vector. */ | 47 /** The bit position, to be set when computing the bit vector. */ |
| 49 private final int mPosition; | 48 private final int mPosition; |
| 50 } | 49 } |
| OLD | NEW |