| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/dom/DOMDataView.h" | 5 #include "core/dom/DOMDataView.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMDataStore.h" | 7 #include "bindings/core/v8/DOMDataStore.h" |
| 8 #include "bindings/core/v8/V8ArrayBuffer.h" | 8 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 9 #include "platform/CheckedInt.h" | 9 #include "platform/CheckedInt.h" |
| 10 #include "wtf/ArrayBufferView.h" | 10 #include "wtf/ArrayBufferView.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return adoptRef(new DOMDataView(dataView.release(), buffer.release())); | 53 return adoptRef(new DOMDataView(dataView.release(), buffer.release())); |
| 54 } | 54 } |
| 55 | 55 |
| 56 v8::Local<v8::Object> DOMDataView::wrap(v8::Isolate* isolate, v8::Local<v8::Obje
ct> creationContext) | 56 v8::Local<v8::Object> DOMDataView::wrap(v8::Isolate* isolate, v8::Local<v8::Obje
ct> creationContext) |
| 57 { | 57 { |
| 58 // It's possible that no one except for the new wrapper owns this object at | 58 // It's possible that no one except for the new wrapper owns this object at |
| 59 // this moment, so we have to prevent GC to collect this object until the | 59 // this moment, so we have to prevent GC to collect this object until the |
| 60 // object gets associated with the wrapper. | 60 // object gets associated with the wrapper. |
| 61 RefPtr<DOMDataView> protect(this); | 61 RefPtr<DOMDataView> protect(this); |
| 62 | 62 |
| 63 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); | 63 DCHECK(!DOMDataStore::containsWrapper(this, isolate)); |
| 64 | 64 |
| 65 const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo(); | 65 const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo(); |
| 66 v8::Local<v8::Value> v8Buffer = toV8(buffer(), creationContext, isolate); | 66 v8::Local<v8::Value> v8Buffer = toV8(buffer(), creationContext, isolate); |
| 67 if (v8Buffer.IsEmpty()) | 67 if (v8Buffer.IsEmpty()) |
| 68 return v8::Local<v8::Object>(); | 68 return v8::Local<v8::Object>(); |
| 69 ASSERT(v8Buffer->IsArrayBuffer()); | 69 DCHECK(v8Buffer->IsArrayBuffer()); |
| 70 | 70 |
| 71 v8::Local<v8::Object> wrapper = v8::DataView::New(v8Buffer.As<v8::ArrayBuffe
r>(), byteOffset(), byteLength()); | 71 v8::Local<v8::Object> wrapper = v8::DataView::New(v8Buffer.As<v8::ArrayBuffe
r>(), byteOffset(), byteLength()); |
| 72 | 72 |
| 73 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper); | 73 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |