Index: mojo/public/bindings/js/v8_array_buffer.h |
diff --git a/mojo/public/bindings/js/v8_array_buffer.h b/mojo/public/bindings/js/v8_array_buffer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eb328d5c0bbd75aa1ff4f89ac6d5f9e05fd74aff |
--- /dev/null |
+++ b/mojo/public/bindings/js/v8_array_buffer.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MOJO_PUBLIC_BINDINGS_JS_V8_ARRAY_BUFFER_H_ |
+#define MOJO_PUBLIC_BINDINGS_JS_V8_ARRAY_BUFFER_H_ |
+ |
+#include "mojo/public/system/macros.h" |
+#include "v8/include/v8.h" |
+ |
+namespace mojo { |
+namespace js { |
+ |
+class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
+ public: |
+ virtual void* Allocate(size_t length) MOJO_OVERRIDE; |
+ virtual void* AllocateUninitialized(size_t length) MOJO_OVERRIDE; |
+ virtual void Free(void* data, size_t length) MOJO_OVERRIDE; |
+ |
+ static ArrayBufferAllocator* SharedInstance(); |
+}; |
+ |
+class BufferView { |
+ public: |
+ BufferView(v8::Isolate* isolate, v8::Handle<v8::ArrayBufferView> view); |
+ BufferView(v8::Isolate* isolate, v8::Handle<v8::ArrayBuffer> buffer); |
+ ~BufferView(); |
+ |
+ void* bytes() const { return bytes_; } |
+ size_t num_bytes() const { return num_bytes_; } |
+ |
+ private: |
+ class Private; |
+ |
+ void Initialize(v8::Isolate* isolate, v8::Handle<v8::ArrayBuffer> buffer); |
+ |
+ Private* private_; |
+ void* bytes_; |
+ size_t num_bytes_; |
+ |
+ MOJO_DISALLOW_COPY_AND_ASSIGN(BufferView); |
+}; |
+ |
+} // js |
+} // mojo |
+ |
+#endif // MOJO_PUBLIC_BINDINGS_JS_V8_ARRAY_BUFFER_H_ |