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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_BINDINGS_JS_V8_ARRAY_BUFFER_H_
6 #define MOJO_PUBLIC_BINDINGS_JS_V8_ARRAY_BUFFER_H_
7
8 #include "mojo/public/system/macros.h"
9 #include "v8/include/v8.h"
10
11 namespace mojo {
12 namespace js {
13
14 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
15 public:
16 virtual void* Allocate(size_t length) MOJO_OVERRIDE;
17 virtual void* AllocateUninitialized(size_t length) MOJO_OVERRIDE;
18 virtual void Free(void* data, size_t length) MOJO_OVERRIDE;
19
20 static ArrayBufferAllocator* SharedInstance();
21 };
22
23 class BufferView {
24 public:
25 BufferView(v8::Isolate* isolate, v8::Handle<v8::ArrayBufferView> view);
26 BufferView(v8::Isolate* isolate, v8::Handle<v8::ArrayBuffer> buffer);
27 ~BufferView();
28
29 void* bytes() const { return bytes_; }
30 size_t num_bytes() const { return num_bytes_; }
31
32 private:
33 class Private;
34
35 void Initialize(v8::Isolate* isolate, v8::Handle<v8::ArrayBuffer> buffer);
36
37 Private* private_;
38 void* bytes_;
39 size_t num_bytes_;
40
41 MOJO_DISALLOW_COPY_AND_ASSIGN(BufferView);
42 };
43
44 } // js
45 } // mojo
46
47 #endif // MOJO_PUBLIC_BINDINGS_JS_V8_ARRAY_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698