Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: content/child/runtime_features.cc

Issue 2627023002: Introduce Origin-Trial for Service Worker Navigation Preload (Closed)
Patch Set: s/an/a Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/runtime_features.h" 5 #include "content/child/runtime_features.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 WebRuntimeFeatures::enableSendBeaconThrowForBlobWithNonSimpleType(true); 307 WebRuntimeFeatures::enableSendBeaconThrowForBlobWithNonSimpleType(true);
308 308
309 #if defined(OS_ANDROID) 309 #if defined(OS_ANDROID)
310 if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) 310 if (command_line.HasSwitch(switches::kDisableMediaSessionAPI))
311 WebRuntimeFeatures::enableMediaSession(false); 311 WebRuntimeFeatures::enableMediaSession(false);
312 312
313 WebRuntimeFeatures::enablePaymentRequest( 313 WebRuntimeFeatures::enablePaymentRequest(
314 base::FeatureList::IsEnabled(features::kWebPayments)); 314 base::FeatureList::IsEnabled(features::kWebPayments));
315 #endif 315 #endif
316 316
317 if (base::FeatureList::IsEnabled(features::kServiceWorkerNavigationPreload)) 317 // We set the RuntimeEnabledFeatures for Navigation Preload feature only when
318 // it is set by "--enable-features" flag.
319 // While we are experimenting this feature using Origin Trial, we enable this
320 // feature using the field trial mechanism. So FeatureList::IsEnabled() always
321 // returns true. But, unless the command line explicitly enabled the feature,
322 // this feature should be available only when a valid origin trial token is
323 // set. This check is done by the generated code of
324 // blink::OriginTrials::serviceWorkerNavigationPreloadEnabled(). See the
325 // comments in service_worker_version.h for the details.
326 if (base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine(
327 features::kServiceWorkerNavigationPreload.name,
328 base::FeatureList::OVERRIDE_ENABLE_FEATURE)) {
318 WebRuntimeFeatures::enableServiceWorkerNavigationPreload(true); 329 WebRuntimeFeatures::enableServiceWorkerNavigationPreload(true);
330 }
319 331
320 if (base::FeatureList::IsEnabled(features::kSpeculativeLaunchServiceWorker)) 332 if (base::FeatureList::IsEnabled(features::kSpeculativeLaunchServiceWorker))
321 WebRuntimeFeatures::enableSpeculativeLaunchServiceWorker(true); 333 WebRuntimeFeatures::enableSpeculativeLaunchServiceWorker(true);
322 334
323 if (base::FeatureList::IsEnabled(features::kGamepadExtensions)) 335 if (base::FeatureList::IsEnabled(features::kGamepadExtensions))
324 WebRuntimeFeatures::enableGamepadExtensions(true); 336 WebRuntimeFeatures::enableGamepadExtensions(true);
325 337
326 if (!base::FeatureList::IsEnabled(features::kCompositeOpaqueFixedPosition)) 338 if (!base::FeatureList::IsEnabled(features::kCompositeOpaqueFixedPosition))
327 WebRuntimeFeatures::enableFeatureFromString("CompositeOpaqueFixedPosition", 339 WebRuntimeFeatures::enableFeatureFromString("CompositeOpaqueFixedPosition",
328 false); 340 false);
(...skipping 26 matching lines...) Expand all
355 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { 367 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) {
356 std::vector<std::string> disabled_features = base::SplitString( 368 std::vector<std::string> disabled_features = base::SplitString(
357 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), 369 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures),
358 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 370 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
359 for (const std::string& feature : disabled_features) 371 for (const std::string& feature : disabled_features)
360 WebRuntimeFeatures::enableFeatureFromString(feature, false); 372 WebRuntimeFeatures::enableFeatureFromString(feature, false);
361 } 373 }
362 } 374 }
363 375
364 } // namespace content 376 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | third_party/WebKit/LayoutTests/VirtualTestSuites » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698