OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gin/array_buffer.h" | 5 #include "gin/array_buffer.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 namespace gin { | 9 namespace gin { |
10 | 10 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 ArrayBuffer::ArrayBuffer(v8::Isolate* isolate, | 120 ArrayBuffer::ArrayBuffer(v8::Isolate* isolate, |
121 v8::Handle<v8::ArrayBuffer> array) { | 121 v8::Handle<v8::ArrayBuffer> array) { |
122 private_ = ArrayBuffer::Private::From(isolate, array); | 122 private_ = ArrayBuffer::Private::From(isolate, array); |
123 bytes_ = private_->buffer(); | 123 bytes_ = private_->buffer(); |
124 num_bytes_ = private_->length(); | 124 num_bytes_ = private_->length(); |
125 } | 125 } |
126 | 126 |
127 ArrayBuffer::~ArrayBuffer() { | 127 ArrayBuffer::~ArrayBuffer() { |
128 } | 128 } |
129 | 129 |
| 130 ArrayBuffer& ArrayBuffer::operator=(const ArrayBuffer& other) { |
| 131 private_ = other.private_; |
| 132 bytes_ = other.bytes_; |
| 133 num_bytes_ = other.num_bytes_; |
| 134 return *this; |
| 135 } |
| 136 |
130 // Converter<ArrayBuffer> ----------------------------------------------------- | 137 // Converter<ArrayBuffer> ----------------------------------------------------- |
131 | 138 |
132 bool Converter<ArrayBuffer>::FromV8(v8::Isolate* isolate, | 139 bool Converter<ArrayBuffer>::FromV8(v8::Isolate* isolate, |
133 v8::Handle<v8::Value> val, | 140 v8::Handle<v8::Value> val, |
134 ArrayBuffer* out) { | 141 ArrayBuffer* out) { |
135 if (!val->IsArrayBuffer()) | 142 if (!val->IsArrayBuffer()) |
136 return false; | 143 return false; |
137 *out = ArrayBuffer(isolate, v8::Handle<v8::ArrayBuffer>::Cast(val)); | 144 *out = ArrayBuffer(isolate, v8::Handle<v8::ArrayBuffer>::Cast(val)); |
138 return true; | 145 return true; |
139 } | 146 } |
(...skipping 20 matching lines...) Expand all Loading... |
160 bool Converter<ArrayBufferView>::FromV8(v8::Isolate* isolate, | 167 bool Converter<ArrayBufferView>::FromV8(v8::Isolate* isolate, |
161 v8::Handle<v8::Value> val, | 168 v8::Handle<v8::Value> val, |
162 ArrayBufferView* out) { | 169 ArrayBufferView* out) { |
163 if (!val->IsArrayBufferView()) | 170 if (!val->IsArrayBufferView()) |
164 return false; | 171 return false; |
165 *out = ArrayBufferView(isolate, v8::Handle<v8::ArrayBufferView>::Cast(val)); | 172 *out = ArrayBufferView(isolate, v8::Handle<v8::ArrayBufferView>::Cast(val)); |
166 return true; | 173 return true; |
167 } | 174 } |
168 | 175 |
169 } // namespace gin | 176 } // namespace gin |
OLD | NEW |