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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp

Issue 2533793003: Fix V8 bindings for LongTaskObserver origin trial (Closed)
Patch Set: Add recent attributes to test expectations Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/core/v8/ConditionalFeatures.h" 5 #include "bindings/core/v8/ConditionalFeatures.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8Document.h" 8 #include "bindings/core/v8/V8Document.h"
9 #include "bindings/core/v8/V8HTMLLinkElement.h" 9 #include "bindings/core/v8/V8HTMLLinkElement.h"
10 #include "bindings/core/v8/V8Navigator.h" 10 #include "bindings/core/v8/V8Navigator.h"
11 #include "bindings/core/v8/V8Window.h" 11 #include "bindings/core/v8/V8Window.h"
12 #include "core/dom/ExecutionContext.h" 12 #include "core/dom/ExecutionContext.h"
13 #include "core/frame/LocalFrame.h" 13 #include "core/frame/LocalFrame.h"
14 #include "core/origin_trials/OriginTrialContext.h" 14 #include "core/origin_trials/OriginTrialContext.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 void installConditionalFeaturesCore(const WrapperTypeInfo* wrapperTypeInfo, 18 void installConditionalFeaturesCore(const WrapperTypeInfo* wrapperTypeInfo,
19 const ScriptState* scriptState, 19 const ScriptState* scriptState,
20 v8::Local<v8::Object> prototypeObject, 20 v8::Local<v8::Object> prototypeObject,
21 v8::Local<v8::Function> interfaceObject) { 21 v8::Local<v8::Function> interfaceObject) {
22 // TODO(iclelland): Generate all of this logic at compile-time, based on the 22 // TODO(iclelland): Generate all of this logic at compile-time, based on the
23 // configuration of origin trial enabled attibutes and interfaces in IDL 23 // configuration of origin trial enabled attributes and interfaces in IDL
24 // files. (crbug.com/615060) 24 // files. (crbug.com/615060)
25 ExecutionContext* executionContext = scriptState->getExecutionContext(); 25 ExecutionContext* executionContext = scriptState->getExecutionContext();
26 if (!executionContext) 26 if (!executionContext)
27 return; 27 return;
28 OriginTrialContext* originTrialContext = OriginTrialContext::from( 28 OriginTrialContext* originTrialContext = OriginTrialContext::from(
29 executionContext, OriginTrialContext::DontCreateIfNotExists); 29 executionContext, OriginTrialContext::DontCreateIfNotExists);
30 v8::Isolate* isolate = scriptState->isolate(); 30 v8::Isolate* isolate = scriptState->isolate();
31 const DOMWrapperWorld& world = scriptState->world(); 31 const DOMWrapperWorld& world = scriptState->world();
32 if (wrapperTypeInfo == &V8HTMLLinkElement::wrapperTypeInfo) { 32 if (wrapperTypeInfo == &V8HTMLLinkElement::wrapperTypeInfo) {
33 if (RuntimeEnabledFeatures::linkServiceWorkerEnabled() || 33 if (RuntimeEnabledFeatures::linkServiceWorkerEnabled() ||
34 (originTrialContext && 34 (originTrialContext &&
35 originTrialContext->isTrialEnabled("ForeignFetch"))) { 35 originTrialContext->isTrialEnabled("ForeignFetch"))) {
36 V8HTMLLinkElement::installLinkServiceWorker( 36 V8HTMLLinkElement::installLinkServiceWorker(
37 isolate, world, v8::Local<v8::Object>(), prototypeObject, 37 isolate, world, v8::Local<v8::Object>(), prototypeObject,
38 interfaceObject); 38 interfaceObject);
39 } 39 }
40 } else if (wrapperTypeInfo == &V8Window::wrapperTypeInfo) {
41 v8::Local<v8::Object> instanceObject = scriptState->context()->Global();
42 if (RuntimeEnabledFeatures::longTaskObserverEnabled() ||
43 (originTrialContext &&
44 originTrialContext->isTrialEnabled("LongTaskObserver"))) {
45 V8Window::installLongTaskObserver(isolate, world, instanceObject,
46 prototypeObject, interfaceObject);
47 }
40 } 48 }
41 } 49 }
42 50
43 namespace { 51 namespace {
44 52
45 InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction = 53 InstallConditionalFeaturesFunction s_installConditionalFeaturesFunction =
46 &installConditionalFeaturesCore; 54 &installConditionalFeaturesCore;
47 } 55 }
48 56
49 InstallConditionalFeaturesFunction setInstallConditionalFeaturesFunction( 57 InstallConditionalFeaturesFunction setInstallConditionalFeaturesFunction(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); 92 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy();
85 // The policy should always be initialized before checking it to ensure we 93 // The policy should always be initialized before checking it to ensure we
86 // properly inherit the parent policy. 94 // properly inherit the parent policy.
87 DCHECK(featurePolicy); 95 DCHECK(featurePolicy);
88 96
89 // Otherwise, check policy. 97 // Otherwise, check policy.
90 return featurePolicy->isFeatureEnabled(feature); 98 return featurePolicy->isFeatureEnabled(feature);
91 } 99 }
92 100
93 } // namespace blink 101 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698