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

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

Issue 2458183002: Eagerly install Origin Trial features on window (Closed)
Patch Set: Addressing review comments Created 4 years, 1 month 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 25 matching lines...) Expand all
36 v8::Local<v8::Function> interfaceObject) { 36 v8::Local<v8::Function> interfaceObject) {
37 // TODO(iclelland): Generate all of this logic at compile-time, based on the 37 // TODO(iclelland): Generate all of this logic at compile-time, based on the
38 // configuration of origin trial enabled attibutes and interfaces in IDL 38 // configuration of origin trial enabled attibutes and interfaces in IDL
39 // files. (crbug.com/615060) 39 // files. (crbug.com/615060)
40 (*s_originalInstallConditionalFeaturesFunction)( 40 (*s_originalInstallConditionalFeaturesFunction)(
41 wrapperTypeInfo, scriptState, prototypeObject, interfaceObject); 41 wrapperTypeInfo, scriptState, prototypeObject, interfaceObject);
42 42
43 ExecutionContext* executionContext = scriptState->getExecutionContext(); 43 ExecutionContext* executionContext = scriptState->getExecutionContext();
44 if (!executionContext) 44 if (!executionContext)
45 return; 45 return;
46 v8::Isolate* isolate = scriptState->isolate();
47 const DOMWrapperWorld& world = scriptState->world();
48 v8::Local<v8::Object> global = scriptState->context()->Global(); 46 v8::Local<v8::Object> global = scriptState->context()->Global();
49 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) { 47 if (wrapperTypeInfo == &V8Navigator::wrapperTypeInfo) {
50 if (OriginTrials::webShareEnabled(executionContext)) { 48 if (OriginTrials::webShareEnabled(executionContext)) {
51 V8NavigatorPartial::installWebShare(isolate, world, 49 V8NavigatorPartial::installWebShare(scriptState, v8::Local<v8::Object>(),
52 v8::Local<v8::Object>(),
53 prototypeObject, interfaceObject); 50 prototypeObject, interfaceObject);
54 } 51 }
55 if (OriginTrials::webUSBEnabled(executionContext)) { 52 if (OriginTrials::webUSBEnabled(executionContext)) {
56 V8NavigatorPartial::installWebUSB(isolate, world, v8::Local<v8::Object>(), 53 V8NavigatorPartial::installWebUSB(scriptState, v8::Local<v8::Object>(),
57 prototypeObject, interfaceObject); 54 prototypeObject, interfaceObject);
58 } 55 }
59 if (OriginTrials::webVREnabled(executionContext)) { 56 if (OriginTrials::webVREnabled(executionContext)) {
60 V8NavigatorPartial::installWebVR(isolate, world, global, prototypeObject, 57 V8NavigatorPartial::installWebVR(scriptState, global, prototypeObject,
Yuki 2016/11/02 09:21:07 Hmm, I'm confused. V8NavigatorPartial::installWeb
iclelland 2016/11/02 13:49:38 Yes, that is right. I missed this when I reviewed
61 interfaceObject); 58 interfaceObject);
62 } 59 }
63 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) { 60 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) {
64 if (OriginTrials::webUSBEnabled(executionContext)) { 61 if (OriginTrials::webUSBEnabled(executionContext)) {
65 V8WindowPartial::installWebUSB(isolate, world, global, prototypeObject, 62 V8WindowPartial::installWebUSB(scriptState, global, prototypeObject,
66 interfaceObject); 63 interfaceObject);
67 } 64 }
68 if (OriginTrials::webVREnabled(executionContext)) { 65 if (OriginTrials::webVREnabled(executionContext)) {
69 V8WindowPartial::installWebVR(isolate, world, global, prototypeObject, 66 V8WindowPartial::installWebVR(scriptState, global, prototypeObject,
70 interfaceObject); 67 interfaceObject);
71 } 68 }
72 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { 69 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) {
73 V8WindowPartial::installGamepadExtensions( 70 V8WindowPartial::installGamepadExtensions(
74 isolate, world, global, prototypeObject, interfaceObject); 71 scriptState, global, prototypeObject, interfaceObject);
75 } 72 }
76 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { 73 } else if (wrapperTypeInfo == &V8ServiceWorkerGlobalScope::wrapperTypeInfo) {
77 if (OriginTrials::foreignFetchEnabled(executionContext)) { 74 if (OriginTrials::foreignFetchEnabled(executionContext)) {
78 V8ServiceWorkerGlobalScope::installForeignFetch( 75 V8ServiceWorkerGlobalScope::installForeignFetch(
79 isolate, world, global, prototypeObject, interfaceObject); 76 scriptState, global, prototypeObject, interfaceObject);
80 } 77 }
81 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) { 78 } else if (wrapperTypeInfo == &V8InstallEvent::wrapperTypeInfo) {
82 if (OriginTrials::foreignFetchEnabled(executionContext)) { 79 if (OriginTrials::foreignFetchEnabled(executionContext)) {
83 V8InstallEvent::installForeignFetch(isolate, world, 80 V8InstallEvent::installForeignFetch(scriptState, v8::Local<v8::Object>(),
84 v8::Local<v8::Object>(),
85 prototypeObject, interfaceObject); 81 prototypeObject, interfaceObject);
86 } 82 }
87 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) { 83 } else if (wrapperTypeInfo == &V8Gamepad::wrapperTypeInfo) {
88 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { 84 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) {
89 V8Gamepad::installGamepadExtensions(isolate, world, global, 85 V8Gamepad::installGamepadExtensions(scriptState, global, prototypeObject,
90 prototypeObject, interfaceObject); 86 interfaceObject);
91 } 87 }
92 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) { 88 } else if (wrapperTypeInfo == &V8GamepadButton::wrapperTypeInfo) {
93 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) { 89 if (OriginTrials::gamepadExtensionsEnabled(executionContext)) {
94 V8GamepadButton::installGamepadExtensions( 90 V8GamepadButton::installGamepadExtensions(
95 isolate, world, global, prototypeObject, interfaceObject); 91 scriptState, global, prototypeObject, interfaceObject);
96 } 92 }
97 } 93 }
98 } 94 }
99 95
100 void registerInstallConditionalFeaturesForModules() { 96 void registerInstallConditionalFeaturesForModules() {
101 s_originalInstallConditionalFeaturesFunction = 97 s_originalInstallConditionalFeaturesFunction =
102 setInstallConditionalFeaturesFunction( 98 setInstallConditionalFeaturesFunction(
103 &installConditionalFeaturesForModules); 99 &installConditionalFeaturesForModules);
104 } 100 }
105 101
106 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698