New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 696720 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

See if we can avoid using WebApkInfo#create() in both WebappLauncherActivity and WebApkActivity

Project Member Reported by pkotw...@chromium.org, Feb 27 2017

Issue description

See if we can avoid using WebApkInfo#create() in both WebappLauncherActivity and WebApkActivity

 
Owner: ranj@chromium.org
Status: Assigned (was: Untriaged)
I suggest we store it in memory while we bounce b/w chromelauncheractivity and Web{app,Apk}Activity. This is similar (but different) to how AsyncTabParamsManager is used in tab reparenting
AsyncTabParamsManager is effectively a static singleton that stores a map of tabId -> params. If you really wanted to avoid the second create() call you could make WebappInfo work the same way - make WebappInfoManager store a static map of webappid -> WebappInfo.

What is the motivation for trying to reduce the calls to create()? Efficiency? Having a static singleton may use more memory.
When I filed the bug, I was concerned about efficiency. I took some measurements and the second WebappInfo#create() / WebApkInfo#create() takes about 10ms on an Android One device so the reason for doing this now is fixing  Issue 739927 
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a3a25ad9a49976a552f5ed9221446c1c58f2e2a3

commit a3a25ad9a49976a552f5ed9221446c1c58f2e2a3
Author: Ran Ji <ranj@chromium.org>
Date: Fri Aug 11 15:37:38 2017

Make a static map to store webappInfo by id

A WebappActivity is in a special state when it is present in recents but has
been killed by the Android OS. The WebappActivity can be brought back to life
via:
A) The user tapping recents. In this case:
   - WebappActivity is created with intent with which it was previously created
   - Bundle is passed to WebappActivity#onCreate() with data from
     WebappActivity#onSaveInstanceState()
B) The activity getting launched via an intent from WebappLauncherActivity. In
  this case:
  - WebappActivity is created with intent with which it was previously created.
    The intent sent from WebappLauncherActivity is ignored.
  - Bundle is passed to WebappActivity#onCreate() with data from
    WebappActivity#onSaveInstanceState().

This CL fixes the "intent from WebappLauncherActivity being ignored." in
scenario (B). The CL introduces a static map which stores the desired WebappInfo
for a WebappActivity. The map is populated by WebappLauncherActivity.
WebappActivity prefers using WebappInfo from the static map over creating
WebappInfo from the (potentially incorrect) WebappActivity intent.

Bug:  696720 
Change-Id: I06a2eecdbd769e771aac82ba1a4006aa3f9031ec
Reviewed-on: https://chromium-review.googlesource.com/579572
Commit-Queue: Ran Ji <ranj@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493752}
[modify] https://crrev.com/a3a25ad9a49976a552f5ed9221446c1c58f2e2a3/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java
[modify] https://crrev.com/a3a25ad9a49976a552f5ed9221446c1c58f2e2a3/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
[modify] https://crrev.com/a3a25ad9a49976a552f5ed9221446c1c58f2e2a3/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
[modify] https://crrev.com/a3a25ad9a49976a552f5ed9221446c1c58f2e2a3/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
[modify] https://crrev.com/a3a25ad9a49976a552f5ed9221446c1c58f2e2a3/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java

Comment 5 by ranj@chromium.org, Aug 11 2017

Status: Fixed (was: Assigned)

Sign in to add a comment