OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 class FlexibleArrayBufferView; | 62 class FlexibleArrayBufferView; |
63 class Frame; | 63 class Frame; |
64 class LocalDOMWindow; | 64 class LocalDOMWindow; |
65 class LocalFrame; | 65 class LocalFrame; |
66 class NodeFilter; | 66 class NodeFilter; |
67 class TracedValue; | 67 class TracedValue; |
68 class WorkerGlobalScope; | 68 class WorkerGlobalScope; |
69 class WorkerOrWorkletGlobalScope; | 69 class WorkerOrWorkletGlobalScope; |
70 class XPathNSResolver; | 70 class XPathNSResolver; |
71 | 71 |
72 using InstallOriginTrialsFunction = void (*)(ScriptState*); | |
73 | |
74 template <typename T> | 72 template <typename T> |
75 struct V8TypeOf { | 73 struct V8TypeOf { |
76 STATIC_ONLY(V8TypeOf); | 74 STATIC_ONLY(V8TypeOf); |
77 // |Type| provides C++ -> V8 type conversion for DOM wrappers. | 75 // |Type| provides C++ -> V8 type conversion for DOM wrappers. |
78 // The Blink binding code generator will generate specialized version of | 76 // The Blink binding code generator will generate specialized version of |
79 // V8TypeOf for each wrapper class. | 77 // V8TypeOf for each wrapper class. |
80 typedef void Type; | 78 typedef void Type; |
81 }; | 79 }; |
82 | 80 |
83 template<typename CallbackInfo, typename S> | 81 template<typename CallbackInfo, typename S> |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 v8::Local<v8::Boolean> doneBoolean; | 921 v8::Local<v8::Boolean> doneBoolean; |
924 if (!done->ToBoolean(context).ToLocal(&doneBoolean)) | 922 if (!done->ToBoolean(context).ToLocal(&doneBoolean)) |
925 return VectorType(); | 923 return VectorType(); |
926 if (doneBoolean->Value()) | 924 if (doneBoolean->Value()) |
927 break; | 925 break; |
928 result.append(NativeValueTraits<ValueType>::nativeValue(isolate, element
, exceptionState)); | 926 result.append(NativeValueTraits<ValueType>::nativeValue(isolate, element
, exceptionState)); |
929 } | 927 } |
930 return result; | 928 return result; |
931 } | 929 } |
932 | 930 |
933 // Installs all of the origin-trial-enabled V8 bindings for the given context | |
934 // and world, based on the trial tokens which have been added to the | |
935 // ExecutionContext. This should be called after the V8 context has been | |
936 // installed, but may be called multiple times, as trial tokens are | |
937 // encountered. It indirectly calls the function set by | |
938 // |setInstallOriginTrialsFunction|. | |
939 CORE_EXPORT void installOriginTrials(ScriptState*); | |
940 | |
941 // Sets the function to be called by |installOriginTrials|. The function is | |
942 // initially set to the private |installOriginTrialsForCore| function, but | |
943 // can be overridden by this function. A pointer to the previously set function | |
944 // is returned, so that functions can be chained. | |
945 CORE_EXPORT InstallOriginTrialsFunction setInstallOriginTrialsFunction(InstallOr
iginTrialsFunction); | |
946 | |
947 // If the current context causes out of memory, JavaScript setting | 931 // If the current context causes out of memory, JavaScript setting |
948 // is disabled and it returns true. | 932 // is disabled and it returns true. |
949 bool handleOutOfMemory(); | 933 bool handleOutOfMemory(); |
950 void crashIfIsolateIsDead(v8::Isolate*); | 934 void crashIfIsolateIsDead(v8::Isolate*); |
951 | 935 |
952 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) | 936 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) |
953 { | 937 { |
954 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); | 938 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); |
955 } | 939 } |
956 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); | 940 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); | 996 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); |
1013 | 997 |
1014 // Freeze a V8 object. The type of the first parameter and the return value is | 998 // Freeze a V8 object. The type of the first parameter and the return value is |
1015 // intentionally v8::Value so that this function can wrap toV8(). | 999 // intentionally v8::Value so that this function can wrap toV8(). |
1016 // If the argument isn't an object, this will crash. | 1000 // If the argument isn't an object, this will crash. |
1017 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); | 1001 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); |
1018 | 1002 |
1019 } // namespace blink | 1003 } // namespace blink |
1020 | 1004 |
1021 #endif // V8Binding_h | 1005 #endif // V8Binding_h |
OLD | NEW |