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

Unified Diff: Source/bindings/core/v8/V8BindingMacros.h

Issue 1269443002: Introduce FlexibleArrayBufferView and TypedFlexibleArrayBufferView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed typo Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8BindingMacros.h
diff --git a/Source/bindings/core/v8/V8BindingMacros.h b/Source/bindings/core/v8/V8BindingMacros.h
index 2377e9d0c1445e71a67a83ba53490c01fedf4887..9d68f90a667aa068d8a37935949567b05071ec0a 100644
--- a/Source/bindings/core/v8/V8BindingMacros.h
+++ b/Source/bindings/core/v8/V8BindingMacros.h
@@ -46,6 +46,14 @@ namespace blink {
if (UNLIKELY(!var.prepare())) \
return retVal;
+// Checks for a given v8::Value (value) whether it is an ArrayBufferView and
+// below a certain size limit. If below the limit, memory is allocated on the
+// stack to hold the actual payload. Keep the limit in sync with V8's
+// typed_array_max_size.
+#define allocateFlexibleArrayBufferViewStorage(value) \
+ (value->IsArrayBufferView() && (value.As<v8::ArrayBufferView>()->ByteLength() <= 64) ? \
+ alloca(value.As<v8::ArrayBufferView>()->ByteLength()) : nullptr)
+
template <typename T>
inline bool v8Call(v8::Maybe<T> maybe, T& outVariable)
{
« no previous file with comments | « Source/bindings/core/v8/V8Binding.cpp ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698