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

Unified Diff: mojo/public/bindings/js/v8_array_buffer.h

Issue 59153005: Begin implementing V8 bindings for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: spelling Created 7 years, 1 month 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
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_

Powered by Google App Engine
This is Rietveld 408576698