New issue
Advanced search Search tips

Issue 636048 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocking:
issue 684592



Sign in to add a comment

OfflinePageCache caches pages from CCT but not using them later

Project Member Reported by dim...@chromium.org, Aug 9 2016

Issue description

- In GSA, search for something and open a landing page. It opens in CCT.
- Observe that chrome://offline-internals confirms that page was snapshotted.
- Go "back" in GSA so it lands on search results page
- enable airplane mode
- click on the same search result for the landing page you visited before

Expected: see the offline snapshot of the page
Observerd: dino page with "Internet is disconnected"
 
Labels: OS-Android
Owner: dewittj@chromium.org
re-verify this behavior
tab-ID is invalid for CCTs.
Status: Assigndd (was: Untriaged)
Cc: yus...@chromium.org lizeb@chromium.org
Hi CCT folks,
Is there a way to determine if a tab is a CCT?  Bonus points if it's reachable from a TabHelper, but I can plumb what I need through if necessary.
Status: Assigned (was: Assigndd)

Comment 6 by lizeb@chromium.org, Oct 14 2016

Hacky way:
Tab#getActivity() gives you the activity. From there you can check the type of the returned activity.

Note however that this is a package private method, so it might not work for you.
Blocking: 684592
Cc: carlosk@chromium.org
Labels: Hotlist-Fixit
Cc: -carlosk@chromium.org dewittj@chromium.org
Owner: carlosk@chromium.org
Status: Started (was: Assigned)
I started working on this because we should not in fact generate OPC/last_n snapshots for custom tabs. Those tabs are generally short lived and even when the same URL is opened twice with CCT, the tab itself is not the same. Saving a snapshot in this situation is a waste of resources as it will immediately be interrupted or deleted upon tab closure.

My proposed solution will dynamically detect if a tab is a custom tab and avoid saving snapshots if that's the case. As tabs can be moved between different activities so that a custom tab can suddenly become a "normal" tab, if this happens saving a snapshot is then allowed.

User requested snapshots (download offline page) will not be affected.
Project Member

Comment 10 by bugdroid1@chromium.org, Mar 28 2017

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

commit 6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56
Author: carlosk <carlosk@chromium.org>
Date: Tue Mar 28 23:50:50 2017

Last_n: do not save snapshot of custom tabs.

Custom tabs are run almost exactly as regular tabs and last_n was saving
snapshots of them when they were being hidden. This is not the right thing
to do because these tabs are tabs are generally short lived unless they
are transferred into Chrome by the user.

This change adds the ability for native code to check if an Android tab
is a custom tab and uses this new functionality to avoid saving last_n
snapshots if that's the case.

BUG= 636048 

Review-Url: https://codereview.chromium.org/2773273002
Cr-Commit-Position: refs/heads/master@{#460242}

[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTestBase.java
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/offline_pages/offline_page_utils.cc
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/offline_pages/offline_page_utils.h
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/offline_pages/recent_tab_helper.cc
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/offline_pages/recent_tab_helper.h
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/tab_android.cc
[modify] https://crrev.com/6619bb4ebd6d8a47b7a0a0185d86bc90d7f80f56/chrome/browser/android/tab_android.h

Status: Fixed (was: Started)
I misinterpreted this issue when I took over it. Now I'm re-reading it and it seems to me the original reported issue is deprecated. It seems it assumed that

a) We would be snapshotting more than only the last/current page on each tab (N > 1) but right now we settled for only the last/current page (N = 1).

And/or that:

b) When we come back from a custom tab it is not closed. I confirmed that once we come back to the app from the CCT the tab is indeed closed (observers do get the close event).

So I'm marking this as fixed. Please reopen if you think otherwise.

Sign in to add a comment