Pass distillability updates from renderer to browser
The current distillability test does the following:
- In WebContentsObserver, wait for didFinishLoad and didFailLoad events.
(Was didFinishLoad and documentLoadedInFrame earlier. Read more on
http://crbug.com/510254.)
- In these events, send feature extraction JavaScript code to renderer.
The problems are:
- Mobile-friendliness detection might not be accurate because layout might
not have been done in these WebContentsObserver events.
- Executing JavaScript in an isolated world costs extra 8MB of memory.
With the new mechanism added in this CL, the problems can be solved.
- DidMeaningfulLayout guarantees layout is done, so mobile-friendliness
hint would be accurate.
- Features are extracted in native code (in http://crrev.com/1419033004/).
The reader mode switch kReaderModeHeuristics is passed to the renderer
process for it to use GetDistillerHeuristicsType().
BUG=509869, 525797
Review URL: https://codereview.chromium.org/1434433002
Cr-Commit-Position: refs/heads/master@{#359607}
11 files changed