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.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.Log; | 9 import org.chromium.base.Log; |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
(...skipping 19 matching lines...) Expand all Loading... |
30 return sInstance; | 30 return sInstance; |
31 } | 31 } |
32 | 32 |
33 /** Pointer to the native PrecacheLauncher object. Set to 0 when uninitializ
ed. */ | 33 /** Pointer to the native PrecacheLauncher object. Set to 0 when uninitializ
ed. */ |
34 private long mNativePrecacheLauncher; | 34 private long mNativePrecacheLauncher; |
35 | 35 |
36 /** | 36 /** |
37 * Initialized by updateEnabled to call updateEnabledSync when the sync back
end is initialized. | 37 * Initialized by updateEnabled to call updateEnabledSync when the sync back
end is initialized. |
38 * Only accessed on the UI thread. | 38 * Only accessed on the UI thread. |
39 */ | 39 */ |
40 private ProfileSyncService.SyncStateChangedListener mListener = null; | 40 private ProfileSyncService.SyncStateChangedListener mListener; |
41 | 41 |
42 /** | 42 /** |
43 * Boolean failure indicators, reflecting the state of the last call to upda
tePrecachingEnabled. | 43 * Boolean failure indicators, reflecting the state of the last call to upda
tePrecachingEnabled. |
44 * Access must occur on the UI thread. Values default to false -- so if mCal
led is false, the | 44 * Access must occur on the UI thread. Values default to false -- so if mCal
led is false, the |
45 * value of the other booleans is not necessarily valid. | 45 * value of the other booleans is not necessarily valid. |
46 */ | 46 */ |
47 private boolean mCalled = false; | 47 private boolean mCalled; |
48 private boolean mSyncInitialized = false; | 48 private boolean mSyncInitialized; |
49 private boolean mNetworkPredictionsAllowed = false; | 49 private boolean mNetworkPredictionsAllowed; |
50 private boolean mShouldRun = false; | 50 private boolean mShouldRun; |
51 | 51 |
52 /** Destroy the native PrecacheLauncher, releasing the memory that it was us
ing. */ | 52 /** Destroy the native PrecacheLauncher, releasing the memory that it was us
ing. */ |
53 public void destroy() { | 53 public void destroy() { |
54 if (mNativePrecacheLauncher != 0) { | 54 if (mNativePrecacheLauncher != 0) { |
55 nativeDestroy(mNativePrecacheLauncher); | 55 nativeDestroy(mNativePrecacheLauncher); |
56 mNativePrecacheLauncher = 0; | 56 mNativePrecacheLauncher = 0; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 /** Starts a precache cycle. */ | 60 /** Starts a precache cycle. */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return reasons; | 188 return reasons; |
189 } | 189 } |
190 | 190 |
191 private native long nativeInit(); | 191 private native long nativeInit(); |
192 private native void nativeDestroy(long nativePrecacheLauncher); | 192 private native void nativeDestroy(long nativePrecacheLauncher); |
193 private native void nativeStart(long nativePrecacheLauncher); | 193 private native void nativeStart(long nativePrecacheLauncher); |
194 private native void nativeCancel(long nativePrecacheLauncher); | 194 private native void nativeCancel(long nativePrecacheLauncher); |
195 | 195 |
196 @VisibleForTesting native boolean nativeShouldRun(); | 196 @VisibleForTesting native boolean nativeShouldRun(); |
197 } | 197 } |
OLD | NEW |