Commit b00fc4fd authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Instantiate FieldTrialList for ios WebView

ios WebView does not integrate with variations, but the actual
production code WebView relies on may assume that there an instance,
leading to DCHECK failures.

This was surfaced by integration tests where, despite base::TestSuite's
attempts to instantiate FieldTrialList via FeatureListScopedToEachTest,
and due to shared libraries leading to ODR violations affecting
FieldTrialList::global_, DCHECKs could fire (mostly prevented landing
additional DCHECKs).

Bug: 1011088,1018667

Change-Id: I7ff3b356bd246c5f0a9b8776ae6d372bfd4a9df9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1950518Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarJohn Wu <jzw@chromium.org>
Auto-Submit: Mikel Astiz <mastiz@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721563}
parent 8cef970e
......@@ -8,6 +8,7 @@
#include <memory>
#include "base/macros.h"
#include "base/metrics/field_trial.h"
#include "ios/web/public/init/web_main_parts.h"
namespace ios_web_view {
......@@ -31,6 +32,10 @@ class WebViewWebMainParts : public web::WebMainParts {
// Loads resources that can be scaled. f.e. png images for @1x, @2x, and @3x.
void LoadScalableResources();
// Dummy FieldTrialList instance for code that consumes variations data,
// although ios WebView does not support variations.
base::FieldTrialList field_trial_list_;
DISALLOW_COPY_AND_ASSIGN(WebViewWebMainParts);
};
......
......@@ -26,7 +26,8 @@
namespace ios_web_view {
WebViewWebMainParts::WebViewWebMainParts() {}
WebViewWebMainParts::WebViewWebMainParts()
: field_trial_list_(/*entropy_provider=*/nullptr) {}
WebViewWebMainParts::~WebViewWebMainParts() = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment