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.app.ActivityManager; | 7 import android.app.ActivityManager; |
8 import android.app.Application; | 8 import android.app.Application; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 cancelPrerender(session); | 125 cancelPrerender(session); |
126 } | 126 } |
127 }; | 127 }; |
128 return mClientManager.newSession(callback, Binder.getCallingUid(), onDis
connect); | 128 return mClientManager.newSession(callback, Binder.getCallingUid(), onDis
connect); |
129 } | 129 } |
130 | 130 |
131 @Override | 131 @Override |
132 public boolean warmup(long flags) { | 132 public boolean warmup(long flags) { |
133 // Here and in mayLaunchUrl(), don't do expensive work for background ap
plications. | 133 // Here and in mayLaunchUrl(), don't do expensive work for background ap
plications. |
134 if (!isCallerForegroundOrSelf()) return false; | 134 if (!isCallerForegroundOrSelf()) return false; |
| 135 mClientManager.recordUidHasCalledWarmup(Binder.getCallingUid()); |
135 if (!mWarmupHasBeenCalled.compareAndSet(false, true)) return true; | 136 if (!mWarmupHasBeenCalled.compareAndSet(false, true)) return true; |
136 // The call is non-blocking and this must execute on the UI thread, post
a task. | 137 // The call is non-blocking and this must execute on the UI thread, post
a task. |
137 ThreadUtils.postOnUiThread(new Runnable() { | 138 ThreadUtils.postOnUiThread(new Runnable() { |
138 @Override | 139 @Override |
139 @SuppressFBWarnings("DM_EXIT") | 140 @SuppressFBWarnings("DM_EXIT") |
140 public void run() { | 141 public void run() { |
141 ChromeApplication app = (ChromeApplication) mApplication; | 142 ChromeApplication app = (ChromeApplication) mApplication; |
142 try { | 143 try { |
143 app.startBrowserProcessesAndLoadLibrariesSync(true); | 144 app.startBrowserProcessesAndLoadLibrariesSync(true); |
144 } catch (ProcessInitException e) { | 145 } catch (ProcessInitException e) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 screenSize.x /= density; | 524 screenSize.x /= density; |
524 screenSize.y /= density; | 525 screenSize.y /= density; |
525 return screenSize; | 526 return screenSize; |
526 } | 527 } |
527 | 528 |
528 @VisibleForTesting | 529 @VisibleForTesting |
529 void resetThrottling(Context context, int uid) { | 530 void resetThrottling(Context context, int uid) { |
530 mClientManager.resetThrottling(uid); | 531 mClientManager.resetThrottling(uid); |
531 } | 532 } |
532 } | 533 } |
OLD | NEW |