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

Unified Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 1091543002: IDL: Add [FlexibleArrayBufferView] and use for bufferSubData Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-includes-for-type-tuning
Patch Set: add warning about the storage's life-time Created 5 years, 8 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.h ('k') | Source/bindings/core/v8/V8BindingMacros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8Binding.cpp
diff --git a/Source/bindings/core/v8/V8Binding.cpp b/Source/bindings/core/v8/V8Binding.cpp
index 98801516839b96d5f65e0ae2df6f5e9eec9826dd..210c7797628a703a5305b473790550223314cf4f 100644
--- a/Source/bindings/core/v8/V8Binding.cpp
+++ b/Source/bindings/core/v8/V8Binding.cpp
@@ -33,6 +33,7 @@
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/V8AbstractEventListener.h"
+#include "bindings/core/v8/V8ArrayBufferView.h"
#include "bindings/core/v8/V8BindingMacros.h"
#include "bindings/core/v8/V8Element.h"
#include "bindings/core/v8/V8EventTarget.h"
@@ -47,6 +48,7 @@
#include "bindings/core/v8/custom/V8CustomXPathNSResolver.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
+#include "core/dom/FlexibleArrayBufferView.h"
#include "core/dom/NodeFilter.h"
#include "core/dom/QualifiedName.h"
#include "core/frame/LocalDOMWindow.h"
@@ -755,6 +757,20 @@ EventTarget* toEventTarget(v8::Isolate* isolate, v8::Handle<v8::Value> value)
return 0;
}
+void toFlexibleArrayBufferView(v8::Isolate* isolate, v8::Handle<v8::Value> value, FlexibleArrayBufferView& result, void* storage)
+{
+ if (!value->IsArrayBufferView())
+ return;
+ v8::Local<v8::ArrayBufferView> buffer = value.As<v8::ArrayBufferView>();
+ if (!storage) {
+ result.setFull(V8ArrayBufferView::toImpl(buffer));
+ return;
+ }
+ size_t length = buffer->ByteLength();
+ buffer->CopyContents(storage, length);
+ result.setSmall(storage, length);
+}
+
v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& world)
{
ASSERT(context);
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8BindingMacros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698