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 |
72 template <typename T> | 74 template <typename T> |
73 struct V8TypeOf { | 75 struct V8TypeOf { |
74 STATIC_ONLY(V8TypeOf); | 76 STATIC_ONLY(V8TypeOf); |
75 // |Type| provides C++ -> V8 type conversion for DOM wrappers. | 77 // |Type| provides C++ -> V8 type conversion for DOM wrappers. |
76 // The Blink binding code generator will generate specialized version of | 78 // The Blink binding code generator will generate specialized version of |
77 // V8TypeOf for each wrapper class. | 79 // V8TypeOf for each wrapper class. |
78 typedef void Type; | 80 typedef void Type; |
79 }; | 81 }; |
80 | 82 |
81 // Helpers for throwing JavaScript TypeErrors for arity mismatches. | 83 // Helpers for throwing JavaScript TypeErrors for arity mismatches. |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 // a context, if the window is currently being displayed in a Frame. | 856 // a context, if the window is currently being displayed in a Frame. |
855 CORE_EXPORT Frame* toFrameIfNotDetached(v8::Local<v8::Context>); | 857 CORE_EXPORT Frame* toFrameIfNotDetached(v8::Local<v8::Context>); |
856 | 858 |
857 CORE_EXPORT EventTarget* toEventTarget(v8::Isolate*, v8::Local<v8::Value>); | 859 CORE_EXPORT EventTarget* toEventTarget(v8::Isolate*, v8::Local<v8::Value>); |
858 | 860 |
859 // If 'storage' is non-null, it must be large enough to copy all bytes in the | 861 // If 'storage' is non-null, it must be large enough to copy all bytes in the |
860 // array buffer view into it. Use allocateFlexibleArrayBufferStorage(v8Value) | 862 // array buffer view into it. Use allocateFlexibleArrayBufferStorage(v8Value) |
861 // to allocate it using alloca() in the callers stack frame. | 863 // to allocate it using alloca() in the callers stack frame. |
862 CORE_EXPORT void toFlexibleArrayBufferView(v8::Isolate*, v8::Local<v8::Value>, F
lexibleArrayBufferView&, void* storage = nullptr); | 864 CORE_EXPORT void toFlexibleArrayBufferView(v8::Isolate*, v8::Local<v8::Value>, F
lexibleArrayBufferView&, void* storage = nullptr); |
863 | 865 |
| 866 // Installs all of the origin-trial-enabled V8 bindings for the given context |
| 867 // and world, based on the trial tokens which have been added to the |
| 868 // ExecutionContext. This should be called after the V8 context has been |
| 869 // installd, but may be called multiple times, as trial tokens are |
| 870 // encountered. It indirectly calls the function set by |
| 871 // |setInstallOriginTrialsFunction|. |
| 872 CORE_EXPORT void installOriginTrials(ScriptState*); |
| 873 |
| 874 // Sets the function to be called by |installOriginTrials|. The function is |
| 875 // initially set to the private |installOriginTrialsForCore| function, but |
| 876 // can be overridden by this function. A pointer to the previously set function |
| 877 // is returned, so that functions can be chained. |
| 878 CORE_EXPORT installOriginTrialsFunction setInstallOriginTrialsFunction(installOr
iginTrialsFunction); |
| 879 |
864 // If the current context causes out of memory, JavaScript setting | 880 // If the current context causes out of memory, JavaScript setting |
865 // is disabled and it returns true. | 881 // is disabled and it returns true. |
866 bool handleOutOfMemory(); | 882 bool handleOutOfMemory(); |
867 void crashIfIsolateIsDead(v8::Isolate*); | 883 void crashIfIsolateIsDead(v8::Isolate*); |
868 | 884 |
869 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) | 885 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) |
870 { | 886 { |
871 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); | 887 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); |
872 } | 888 } |
873 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); | 889 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); | 953 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); |
938 | 954 |
939 // Freeze a V8 object. The type of the first parameter and the return value is | 955 // Freeze a V8 object. The type of the first parameter and the return value is |
940 // intentionally v8::Value so that this function can wrap toV8(). | 956 // intentionally v8::Value so that this function can wrap toV8(). |
941 // If the argument isn't an object, this will crash. | 957 // If the argument isn't an object, this will crash. |
942 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolate*); | 958 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolate*); |
943 | 959 |
944 } // namespace blink | 960 } // namespace blink |
945 | 961 |
946 #endif // V8Binding_h | 962 #endif // V8Binding_h |
OLD | NEW |