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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/ConditionalFeaturesForModules.cpp

Issue 2398793003: [Origin Trials] Clarify the distinction between trials and features (Closed)
Patch Set: Rebase; -DurableStorage, +WebVR Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "bindings/modules/v8/ConditionalFeaturesForModules.h" 5 #include "bindings/modules/v8/ConditionalFeaturesForModules.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h" 8 #include "bindings/core/v8/V8DedicatedWorkerGlobalScope.h"
9 #include "bindings/core/v8/V8Navigator.h" 9 #include "bindings/core/v8/V8Navigator.h"
10 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h" 10 #include "bindings/core/v8/V8SharedWorkerGlobalScope.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (!executionContext) 44 if (!executionContext)
45 return; 45 return;
46 OriginTrialContext* originTrialContext = OriginTrialContext::from( 46 OriginTrialContext* originTrialContext = OriginTrialContext::from(
47 executionContext, OriginTrialContext::DontCreateIfNotExists); 47 executionContext, OriginTrialContext::DontCreateIfNotExists);
48 v8::Isolate* isolate = scriptState->isolate(); 48 v8::Isolate* isolate = scriptState->isolate();
49 const DOMWrapperWorld& world = scriptState->world(); 49 const DOMWrapperWorld& world = scriptState->world();
50 v8::Local<v8::Object> global = scriptState->context()->Global(); 50 v8::Local<v8::Object> global = scriptState->context()->Global();
51 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { 51 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) {
52 if (RuntimeEnabledFeatures::webBluetoothEnabled() || 52 if (RuntimeEnabledFeatures::webBluetoothEnabled() ||
53 (originTrialContext && 53 (originTrialContext &&
54 originTrialContext->isFeatureEnabled("WebBluetooth"))) { 54 originTrialContext->isTrialEnabled("WebBluetooth"))) {
55 V8NavigatorPartial::installWebBluetooth(isolate, world, 55 V8NavigatorPartial::installWebBluetooth(isolate, world,
56 v8::Local<v8::Object>(), 56 v8::Local<v8::Object>(),
57 prototypeObject, interfaceObject); 57 prototypeObject, interfaceObject);
58 } 58 }
59 if (RuntimeEnabledFeatures::webShareEnabled() || 59 if (RuntimeEnabledFeatures::webShareEnabled() ||
60 (originTrialContext && 60 (originTrialContext &&
61 originTrialContext->isFeatureEnabled("WebShare"))) { 61 originTrialContext->isTrialEnabled("WebShare"))) {
62 V8NavigatorPartial::installWebShare(isolate, world, 62 V8NavigatorPartial::installWebShare(isolate, world,
63 v8::Local<v8::Object>(), 63 v8::Local<v8::Object>(),
64 prototypeObject, interfaceObject); 64 prototypeObject, interfaceObject);
65 } 65 }
66 if (RuntimeEnabledFeatures::webUSBEnabled() || 66 if (RuntimeEnabledFeatures::webUSBEnabled() ||
67 (originTrialContext && 67 (originTrialContext && originTrialContext->isTrialEnabled("WebUSB"))) {
68 originTrialContext->isFeatureEnabled("WebUSB"))) {
69 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), 68 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(),
70 prototypeObject, interfaceObject); 69 prototypeObject, interfaceObject);
71 } 70 }
72 if (RuntimeEnabledFeatures::webVREnabled() || 71 if (RuntimeEnabledFeatures::webVREnabled() ||
73 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { 72 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) {
74 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, 73 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject,
75 interfaceObject); 74 interfaceObject);
76 } 75 }
77 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { 76 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) {
78 if (RuntimeEnabledFeatures::webBluetoothEnabled() || 77 if (RuntimeEnabledFeatures::webBluetoothEnabled() ||
79 (originTrialContext && 78 (originTrialContext &&
80 originTrialContext->isFeatureEnabled("WebBluetooth"))) { 79 originTrialContext->isTrialEnabled("WebBluetooth"))) {
81 V8WindowPartial::installWebBluetooth(isolate, world, global, 80 V8WindowPartial::installWebBluetooth(isolate, world, global,
82 prototypeObject, interfaceObject); 81 prototypeObject, interfaceObject);
83 } 82 }
84 if (RuntimeEnabledFeatures::webUSBEnabled() || 83 if (RuntimeEnabledFeatures::webUSBEnabled() ||
85 (originTrialContext && 84 (originTrialContext && originTrialContext->isTrialEnabled("WebUSB"))) {
86 originTrialContext->isFeatureEnabled("WebUSB"))) {
87 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, 85 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject,
88 interfaceObject); 86 interfaceObject);
89 } 87 }
90 if (RuntimeEnabledFeatures::webVREnabled() || 88 if (RuntimeEnabledFeatures::webVREnabled() ||
91 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { 89 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) {
92 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, 90 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject,
93 interfaceObject); 91 interfaceObject);
94 } 92 }
95 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() || 93 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() ||
96 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { 94 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) {
97 V8WindowPartial::installGamepadExtensions( 95 V8WindowPartial::installGamepadExtensions(
98 isolate, world, global, prototypeObject, interfaceObject); 96 isolate, world, global, prototypeObject, interfaceObject);
99 } 97 }
100 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { 98 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) {
101 if (RuntimeEnabledFeatures::foreignFetchEnabled() || 99 if (RuntimeEnabledFeatures::foreignFetchEnabled() ||
102 (originTrialContext && 100 (originTrialContext &&
103 originTrialContext->isFeatureEnabled("ForeignFetch"))) { 101 originTrialContext->isTrialEnabled("ForeignFetch"))) {
104 V8ServiceWorkerGlobalScope::installForeignFetch( 102 V8ServiceWorkerGlobalScope::installForeignFetch(
105 isolate, world, global, prototypeObject, interfaceObject); 103 isolate, world, global, prototypeObject, interfaceObject);
106 } 104 }
107 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) { 105 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) {
108 if (RuntimeEnabledFeatures::foreignFetchEnabled() || 106 if (RuntimeEnabledFeatures::foreignFetchEnabled() ||
109 (originTrialContext && 107 (originTrialContext &&
110 originTrialContext->isFeatureEnabled("ForeignFetch"))) { 108 originTrialContext->isTrialEnabled("ForeignFetch"))) {
111 V8InstallEvent::installForeignFetch(isolate, world, 109 V8InstallEvent::installForeignFetch(isolate, world,
112 v8::Local<v8::Object>(), 110 v8::Local<v8::Object>(),
113 prototypeObject, interfaceObject); 111 prototypeObject, interfaceObject);
114 } 112 }
115 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) { 113 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) {
116 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() || 114 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() ||
117 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { 115 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) {
118 V8Gamepad::installGamepadExtensions(isolate, world, global, 116 V8Gamepad::installGamepadExtensions(isolate, world, global,
119 prototypeObject, interfaceObject); 117 prototypeObject, interfaceObject);
120 } 118 }
121 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) { 119 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) {
122 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() || 120 if (RuntimeEnabledFeatures::gamepadExtensionsEnabled() ||
123 (originTrialContext && originTrialContext->isFeatureEnabled("WebVR"))) { 121 (originTrialContext && originTrialContext->isTrialEnabled("WebVR"))) {
124 V8GamepadButton::installGamepadExtensions( 122 V8GamepadButton::installGamepadExtensions(
125 isolate, world, global, prototypeObject, interfaceObject); 123 isolate, world, global, prototypeObject, interfaceObject);
126 } 124 }
127 } 125 }
128 } 126 }
129 127
130 void registerInstallConditionalFeaturesForModules() { 128 void registerInstallConditionalFeaturesForModules() {
131 s_originalInstallConditionalFeaturesFunction = 129 s_originalInstallConditionalFeaturesFunction =
132 setInstallConditionalFeaturesFunction( 130 setInstallConditionalFeaturesFunction(
133 &installConditionalFeaturesForModules); 131 &installConditionalFeaturesForModules);
134 } 132 }
135 133
136 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698