Chromium Code Reviews| 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.init; | 5 package org.chromium.chrome.browser.init; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.app.Activity; | 9 import android.app.Activity; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 // Time at which onCreate is called. This is uptime, to be sent to native co de. | 56 // Time at which onCreate is called. This is uptime, to be sent to native co de. |
| 57 private long mOnCreateTimestampUptimeMs; | 57 private long mOnCreateTimestampUptimeMs; |
| 58 private Bundle mSavedInstanceState; | 58 private Bundle mSavedInstanceState; |
| 59 private int mCurrentOrientation = Surface.ROTATION_0; | 59 private int mCurrentOrientation = Surface.ROTATION_0; |
| 60 private boolean mDestroyed; | 60 private boolean mDestroyed; |
| 61 private NativeInitializationController mNativeInitializationController; | 61 private NativeInitializationController mNativeInitializationController; |
| 62 private MemoryUma mMemoryUma; | 62 private MemoryUma mMemoryUma; |
| 63 private long mLastUserInteractionTime; | 63 private long mLastUserInteractionTime; |
| 64 private boolean mIsTablet; | 64 private boolean mIsTablet; |
| 65 private boolean mHadWarmStart; | 65 private boolean mHadWarmStart; |
| 66 private boolean mIsWarmOnResume; | |
| 67 private boolean mFirstResume = true; | |
|
Bernhard Bauer
2017/01/05 16:32:53
Can you document this member? Specifically, this s
fhorschig
2017/01/05 17:11:13
Done.
| |
| 66 | 68 |
| 67 public AsyncInitializationActivity() { | 69 public AsyncInitializationActivity() { |
| 68 mHandler = new Handler(); | 70 mHandler = new Handler(); |
| 69 } | 71 } |
| 70 | 72 |
| 71 @Override | 73 @Override |
| 72 protected void onDestroy() { | 74 protected void onDestroy() { |
| 73 mDestroyed = true; | 75 mDestroyed = true; |
| 74 super.onDestroy(); | 76 super.onDestroy(); |
| 75 } | 77 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 public void onStart() { | 289 public void onStart() { |
| 288 super.onStart(); | 290 super.onStart(); |
| 289 mNativeInitializationController.onStart(); | 291 mNativeInitializationController.onStart(); |
| 290 } | 292 } |
| 291 | 293 |
| 292 @Override | 294 @Override |
| 293 public void onResume() { | 295 public void onResume() { |
| 294 super.onResume(); | 296 super.onResume(); |
| 295 mNativeInitializationController.onResume(); | 297 mNativeInitializationController.onResume(); |
| 296 if (mLaunchBehindWorkaround != null) mLaunchBehindWorkaround.onResume(); | 298 if (mLaunchBehindWorkaround != null) mLaunchBehindWorkaround.onResume(); |
| 299 mIsWarmOnResume = !mFirstResume || hadWarmStart(); | |
| 300 mFirstResume = false; | |
| 297 } | 301 } |
| 298 | 302 |
| 299 @Override | 303 @Override |
| 300 public void onPause() { | 304 public void onPause() { |
| 301 mNativeInitializationController.onPause(); | 305 mNativeInitializationController.onPause(); |
| 302 super.onPause(); | 306 super.onPause(); |
| 303 if (mLaunchBehindWorkaround != null) mLaunchBehindWorkaround.onPause(); | 307 if (mLaunchBehindWorkaround != null) mLaunchBehindWorkaround.onPause(); |
| 304 } | 308 } |
| 305 | 309 |
| 306 @Override | 310 @Override |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 } | 405 } |
| 402 | 406 |
| 403 /** | 407 /** |
| 404 * @return Whether the activity had a warm start because the native library was already fully | 408 * @return Whether the activity had a warm start because the native library was already fully |
| 405 * loaded and initialized. | 409 * loaded and initialized. |
| 406 */ | 410 */ |
| 407 public boolean hadWarmStart() { | 411 public boolean hadWarmStart() { |
| 408 return mHadWarmStart; | 412 return mHadWarmStart; |
| 409 } | 413 } |
| 410 | 414 |
| 415 /** | |
| 416 * If the activity started warm or was at least resumed once, every followin g resume must be | |
| 417 * warm. | |
|
Bernhard Bauer
2017/01/05 16:32:53
It seems this comment should go to where we calcul
fhorschig
2017/01/05 17:11:13
Done.
Bernhard Bauer
2017/01/05 17:19:45
What do you mean by long enough? During which run?
fhorschig
2017/01/05 17:23:06
The first run (with first run experience) for exa
| |
| 418 * @return Whether the activity is warm in onResume. | |
| 419 */ | |
| 420 public boolean isWarmOnResume() { | |
| 421 return mIsWarmOnResume; | |
| 422 } | |
| 423 | |
| 411 @Override | 424 @Override |
| 412 public void onUserInteraction() { | 425 public void onUserInteraction() { |
| 413 mLastUserInteractionTime = SystemClock.elapsedRealtime(); | 426 mLastUserInteractionTime = SystemClock.elapsedRealtime(); |
| 414 } | 427 } |
| 415 | 428 |
| 416 /** | 429 /** |
| 417 * @return timestamp when the last user interaction was made. | 430 * @return timestamp when the last user interaction was made. |
| 418 */ | 431 */ |
| 419 public long getLastUserInteractionTime() { | 432 public long getLastUserInteractionTime() { |
| 420 return mLastUserInteractionTime; | 433 return mLastUserInteractionTime; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 getDecorView().setVisibility(View.GONE); | 545 getDecorView().setVisibility(View.GONE); |
| 533 } | 546 } |
| 534 getViewTreeObserver().removeOnPreDrawListener(mPreDrawLi stener); | 547 getViewTreeObserver().removeOnPreDrawListener(mPreDrawLi stener); |
| 535 } | 548 } |
| 536 }); | 549 }); |
| 537 return true; | 550 return true; |
| 538 } | 551 } |
| 539 }; | 552 }; |
| 540 } | 553 } |
| 541 } | 554 } |
| OLD | NEW |