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

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

Issue 2891953002: Ship and experiment with the Budget API (Closed)
Patch Set: one more result file Created 3 years, 6 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/ConditionalFeaturesForCore.h" 7 #include "bindings/core/v8/ConditionalFeaturesForCore.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"
11 #include "bindings/core/v8/V8Window.h" 11 #include "bindings/core/v8/V8Window.h"
12 #include "bindings/core/v8/V8WorkerNavigator.h" 12 #include "bindings/core/v8/V8WorkerNavigator.h"
13 #include "bindings/modules/v8/V8BudgetService.h"
13 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h" 14 #include "bindings/modules/v8/V8DedicatedWorkerGlobalScopePartial.h"
14 #include "bindings/modules/v8/V8Gamepad.h" 15 #include "bindings/modules/v8/V8Gamepad.h"
15 #include "bindings/modules/v8/V8GamepadButton.h" 16 #include "bindings/modules/v8/V8GamepadButton.h"
16 #include "bindings/modules/v8/V8InstallEvent.h" 17 #include "bindings/modules/v8/V8InstallEvent.h"
17 #include "bindings/modules/v8/V8NavigatorPartial.h" 18 #include "bindings/modules/v8/V8NavigatorPartial.h"
18 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h" 19 #include "bindings/modules/v8/V8ServiceWorkerGlobalScope.h"
19 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h" 20 #include "bindings/modules/v8/V8SharedWorkerGlobalScopePartial.h"
20 #include "bindings/modules/v8/V8WindowPartial.h" 21 #include "bindings/modules/v8/V8WindowPartial.h"
21 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h" 22 #include "bindings/modules/v8/V8WorkerNavigatorPartial.h"
22 #include "core/dom/ExecutionContext.h" 23 #include "core/dom/ExecutionContext.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 prototype_object, interface_object); 80 prototype_object, interface_object);
80 } 81 }
81 if (OriginTrials::webVREnabled(execution_context)) { 82 if (OriginTrials::webVREnabled(execution_context)) {
82 V8WindowPartial::installWebVR(isolate, world, instance_object, 83 V8WindowPartial::installWebVR(isolate, world, instance_object,
83 prototype_object, interface_object); 84 prototype_object, interface_object);
84 } 85 }
85 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { 86 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) {
86 V8WindowPartial::installGamepadExtensions( 87 V8WindowPartial::installGamepadExtensions(
87 isolate, world, instance_object, prototype_object, interface_object); 88 isolate, world, instance_object, prototype_object, interface_object);
88 } 89 }
90 if (OriginTrials::budgetQueryEnabled(execution_context)) {
91 V8WindowPartial::installBudgetQuery(isolate, world, instance_object,
92 prototype_object, interface_object);
93 }
94 } else if (wrapper_type_info ==
95 &V8DedicatedWorkerGlobalScope::wrapperTypeInfo) {
96 v8::Local<v8::Object> instance_object =
97 script_state->GetContext()->Global();
98 if (OriginTrials::budgetQueryEnabled(execution_context)) {
99 V8DedicatedWorkerGlobalScopePartial::installBudgetQuery(
100 isolate, world, instance_object, prototype_object, interface_object);
101 }
102 } else if (wrapper_type_info == &V8SharedWorkerGlobalScope::wrapperTypeInfo) {
103 v8::Local<v8::Object> instance_object =
104 script_state->GetContext()->Global();
105 if (OriginTrials::budgetQueryEnabled(execution_context)) {
106 V8SharedWorkerGlobalScopePartial::installBudgetQuery(
107 isolate, world, instance_object, prototype_object, interface_object);
108 }
89 } else if (wrapper_type_info == 109 } else if (wrapper_type_info ==
90 &V8ServiceWorkerGlobalScope::wrapperTypeInfo) { 110 &V8ServiceWorkerGlobalScope::wrapperTypeInfo) {
91 v8::Local<v8::Object> instance_object = 111 v8::Local<v8::Object> instance_object =
92 script_state->GetContext()->Global(); 112 script_state->GetContext()->Global();
93 if (OriginTrials::foreignFetchEnabled(execution_context)) { 113 if (OriginTrials::foreignFetchEnabled(execution_context)) {
94 V8ServiceWorkerGlobalScope::installForeignFetch( 114 V8ServiceWorkerGlobalScope::installForeignFetch(
95 isolate, world, instance_object, prototype_object, interface_object); 115 isolate, world, instance_object, prototype_object, interface_object);
96 } 116 }
117 if (OriginTrials::budgetQueryEnabled(execution_context)) {
118 V8ServiceWorkerGlobalScope::installBudgetQuery(
119 isolate, world, instance_object, prototype_object, interface_object);
120 }
97 } else if (wrapper_type_info == &V8InstallEvent::wrapperTypeInfo) { 121 } else if (wrapper_type_info == &V8InstallEvent::wrapperTypeInfo) {
98 if (OriginTrials::foreignFetchEnabled(execution_context)) { 122 if (OriginTrials::foreignFetchEnabled(execution_context)) {
99 V8InstallEvent::installForeignFetch(isolate, world, 123 V8InstallEvent::installForeignFetch(isolate, world,
100 v8::Local<v8::Object>(), 124 v8::Local<v8::Object>(),
101 prototype_object, interface_object); 125 prototype_object, interface_object);
102 } 126 }
127 } else if (wrapper_type_info == &V8BudgetService::wrapperTypeInfo) {
128 if (OriginTrials::budgetQueryEnabled(execution_context)) {
129 V8BudgetService::installBudgetQuery(isolate, world,
130 v8::Local<v8::Object>(),
131 prototype_object, interface_object);
132 }
103 } else if (wrapper_type_info == &V8Gamepad::wrapperTypeInfo) { 133 } else if (wrapper_type_info == &V8Gamepad::wrapperTypeInfo) {
104 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { 134 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) {
105 V8Gamepad::installGamepadExtensions(isolate, world, 135 V8Gamepad::installGamepadExtensions(isolate, world,
106 v8::Local<v8::Object>(), 136 v8::Local<v8::Object>(),
107 prototype_object, interface_object); 137 prototype_object, interface_object);
108 } 138 }
109 } else if (wrapper_type_info == &V8GamepadButton::wrapperTypeInfo) { 139 } else if (wrapper_type_info == &V8GamepadButton::wrapperTypeInfo) {
110 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) { 140 if (OriginTrials::gamepadExtensionsEnabled(execution_context)) {
111 V8GamepadButton::installGamepadExtensions( 141 V8GamepadButton::installGamepadExtensions(
112 isolate, world, v8::Local<v8::Object>(), prototype_object, 142 isolate, world, v8::Local<v8::Object>(), prototype_object,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 interface_object); 225 interface_object);
196 } 226 }
197 if (context_data->GetExistingConstructorAndPrototypeForType( 227 if (context_data->GetExistingConstructorAndPrototypeForType(
198 &V8Navigator::wrapperTypeInfo, &prototype_object, 228 &V8Navigator::wrapperTypeInfo, &prototype_object,
199 &interface_object)) { 229 &interface_object)) {
200 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(), 230 V8NavigatorPartial::installWebVR(isolate, world, v8::Local<v8::Object>(),
201 prototype_object, interface_object); 231 prototype_object, interface_object);
202 } 232 }
203 return; 233 return;
204 } 234 }
235 if (feature == "BudgetQuery") {
236 global_instance_object = script_state->GetContext()->Global();
237
238 ExecutionContext* execution_context = ExecutionContext::From(script_state);
239 if (execution_context->IsDocument()) {
240 V8WindowPartial::installBudgetQuery(
241 isolate, world, global_instance_object, v8::Local<v8::Object>(),
242 v8::Local<v8::Function>());
243 } else if (execution_context->IsDedicatedWorkerGlobalScope()) {
244 V8DedicatedWorkerGlobalScopePartial::installBudgetQuery(
245 isolate, world, global_instance_object, v8::Local<v8::Object>(),
246 v8::Local<v8::Function>());
247 } else if (execution_context->IsSharedWorkerGlobalScope()) {
248 V8SharedWorkerGlobalScopePartial::installBudgetQuery(
249 isolate, world, global_instance_object, v8::Local<v8::Object>(),
250 v8::Local<v8::Function>());
251 } else if (execution_context->IsServiceWorkerGlobalScope()) {
252 V8ServiceWorkerGlobalScope::installBudgetQuery(
253 isolate, world, global_instance_object, v8::Local<v8::Object>(),
254 v8::Local<v8::Function>());
255 }
256
257 if (context_data->GetExistingConstructorAndPrototypeForType(
258 &V8BudgetService::wrapperTypeInfo, &prototype_object,
259 &interface_object)) {
260 V8BudgetService::installBudgetQuery(isolate, world,
261 v8::Local<v8::Object>(),
262 prototype_object, interface_object);
263 }
264 return;
265 }
205 } 266 }
206 267
207 void RegisterInstallConditionalFeaturesForModules() { 268 void RegisterInstallConditionalFeaturesForModules() {
208 RegisterInstallConditionalFeaturesForCore(); 269 RegisterInstallConditionalFeaturesForCore();
209 g_original_install_conditional_features_function = 270 g_original_install_conditional_features_function =
210 SetInstallConditionalFeaturesFunction( 271 SetInstallConditionalFeaturesFunction(
211 &InstallConditionalFeaturesForModules); 272 &InstallConditionalFeaturesForModules);
212 g_original_install_pending_conditional_feature_function = 273 g_original_install_pending_conditional_feature_function =
213 SetInstallPendingConditionalFeatureFunction( 274 SetInstallPendingConditionalFeatureFunction(
214 &InstallPendingConditionalFeatureForModules); 275 &InstallPendingConditionalFeatureForModules);
215 } 276 }
216 277
217 } // namespace blink 278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698