| 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.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.ServiceConnection; | 10 import android.content.ServiceConnection; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 * @return Whether the default parameters are used for this session. | 106 * @return Whether the default parameters are used for this session. |
| 107 */ | 107 */ |
| 108 public boolean isDefault() { | 108 public boolean isDefault() { |
| 109 return !mIgnoreFragments && !mShouldPrerenderOnCellular; | 109 return !mIgnoreFragments && !mShouldPrerenderOnCellular; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 private final Context mContext; | 113 private final Context mContext; |
| 114 private final Map<CustomTabsSessionToken, SessionParams> mSessionParams = ne
w HashMap<>(); | 114 private final Map<CustomTabsSessionToken, SessionParams> mSessionParams = ne
w HashMap<>(); |
| 115 private final SparseBooleanArray mUidHasCalledWarmup = new SparseBooleanArra
y(); | 115 private final SparseBooleanArray mUidHasCalledWarmup = new SparseBooleanArra
y(); |
| 116 private boolean mWarmupHasBeenCalled = false; | 116 private boolean mWarmupHasBeenCalled; |
| 117 | 117 |
| 118 public ClientManager(Context context) { | 118 public ClientManager(Context context) { |
| 119 mContext = context.getApplicationContext(); | 119 mContext = context.getApplicationContext(); |
| 120 RequestThrottler.loadInBackground(mContext); | 120 RequestThrottler.loadInBackground(mContext); |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** Creates a new session. | 123 /** Creates a new session. |
| 124 * | 124 * |
| 125 * @param session Session provided by the client. | 125 * @param session Session provided by the client. |
| 126 * @param uid Client UID, as returned by Binder.getCallingUid(), | 126 * @param uid Client UID, as returned by Binder.getCallingUid(), |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 * @param session The session that has been destroyed. | 421 * @param session The session that has been destroyed. |
| 422 */ | 422 */ |
| 423 public synchronized void cleanupSession(CustomTabsSessionToken session) { | 423 public synchronized void cleanupSession(CustomTabsSessionToken session) { |
| 424 SessionParams params = mSessionParams.get(session); | 424 SessionParams params = mSessionParams.get(session); |
| 425 if (params == null) return; | 425 if (params == null) return; |
| 426 mSessionParams.remove(session); | 426 mSessionParams.remove(session); |
| 427 if (params.disconnectCallback != null) params.disconnectCallback.run(ses
sion); | 427 if (params.disconnectCallback != null) params.disconnectCallback.run(ses
sion); |
| 428 mUidHasCalledWarmup.delete(params.uid); | 428 mUidHasCalledWarmup.delete(params.uid); |
| 429 } | 429 } |
| 430 } | 430 } |
| OLD | NEW |