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

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

Issue 2843603002: Move ScriptWrappable and dependencies to platform/bindings (Closed)
Patch Set: Rebase and try again Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "bindings/core/v8/ConditionalFeatures.h"
6
7 #include "bindings/core/v8/DOMWrapperWorld.h"
8 #include "bindings/core/v8/ScriptState.h"
9
10 namespace blink {
11
12 void InstallConditionalFeaturesDefault(
13 const WrapperTypeInfo* wrapper_type_info,
14 const ScriptState* script_state,
15 v8::Local<v8::Object> prototype_object,
16 v8::Local<v8::Function> interface_object) {}
17
18 void InstallPendingConditionalFeatureDefault(const String& feature,
19 const ScriptState* script_state) {}
20
21 namespace {
22 InstallConditionalFeaturesFunction g_install_conditional_features_function =
23 &InstallConditionalFeaturesDefault;
24
25 InstallPendingConditionalFeatureFunction
26 g_install_pending_conditional_feature_function =
27 &InstallPendingConditionalFeatureDefault;
28 } // namespace
29
30 InstallConditionalFeaturesFunction SetInstallConditionalFeaturesFunction(
31 InstallConditionalFeaturesFunction
32 new_install_conditional_features_function) {
33 InstallConditionalFeaturesFunction original_function =
34 g_install_conditional_features_function;
35 g_install_conditional_features_function =
36 new_install_conditional_features_function;
37 return original_function;
38 }
39
40 InstallPendingConditionalFeatureFunction
41 SetInstallPendingConditionalFeatureFunction(
42 InstallPendingConditionalFeatureFunction
43 new_install_pending_conditional_feature_function) {
44 InstallPendingConditionalFeatureFunction original_function =
45 g_install_pending_conditional_feature_function;
46 g_install_pending_conditional_feature_function =
47 new_install_pending_conditional_feature_function;
48 return original_function;
49 }
50
51 void InstallConditionalFeatures(const WrapperTypeInfo* type,
52 const ScriptState* script_state,
53 v8::Local<v8::Object> prototype_object,
54 v8::Local<v8::Function> interface_object) {
55 (*g_install_conditional_features_function)(
56 type, script_state, prototype_object, interface_object);
57 }
58
59 void InstallPendingConditionalFeature(const String& feature,
60 const ScriptState* script_state) {
61 DCHECK(script_state);
62 DCHECK(script_state->GetContext() ==
63 script_state->GetIsolate()->GetCurrentContext());
64 DCHECK(script_state->PerContextData());
65 DCHECK(script_state->World().IsMainWorld());
66
67 (*g_install_pending_conditional_feature_function)(feature, script_state);
68 }
69
70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698