• Paul Miller's avatar
    WebView: Fix "previously registered pref" crash in variations setup · 6aad9a04
    Paul Miller authored
    Commit 37dac0ef fixed the DCHECK crash
    where variations_safe_compressed_seed was not registered, by calling
    VariationsService::RegisterPrefs to register it. However, that
    conflicted with some other prefs (variations_compressed_seed being the
    first to fail) which were already being individually registered by
    AwFieldTrialCreator. Registering them again caused a 2nd DCHECK crash.
    
    To fix the 2nd crash, don't register any of those prefs individually;
    they're all covered by VariationsService::RegisterPrefs.
    
    Fixing the 2nd crash reveals yet a 3rd DCHECK crash, where FeatureList
    is created twice: first in BrowserMainLoop::EarlyInitialization and then
    in AwFieldTrialCreator. The second fails in FeatureList::SetInstance,
    which requires that there be only one global FeatureList. This bug is
    unrelated to the 1st and 2nd crashes; it just didn't appear because the
    previous crashes prevented us from getting that far.
    
    Since variations is always enabled in Chrome, Chrome always creates the
    FeatureList during field trial setup, and always skips creating it in
    BrowserMainLoop::EarlyInitialization. In WebView, variations may or may
    not be enabled, so we must create FeatureList in exactly one of those
    two places, depending on kEnableWebViewVariations.
    
    BUG=842934
    
    Change-Id: Ia592db3710a1f996729aa318853e7339bb3dff4f
    Reviewed-on: https://chromium-review.googlesource.com/1069770
    Commit-Queue: Paul Miller <paulmiller@chromium.org>
    Reviewed-by: default avatarBo <boliu@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#560850}
    6aad9a04
aw_browser_main_parts.cc 6.59 KB