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 "config.h" | 5 #include "config.h" |
6 #include "core/dom/DOMDataView.h" | 6 #include "core/dom/DOMDataView.h" |
7 | 7 |
8 #include "bindings/core/v8/DOMDataStore.h" | 8 #include "bindings/core/v8/DOMDataStore.h" |
9 #include "bindings/core/v8/V8ArrayBuffer.h" | 9 #include "bindings/core/v8/V8ArrayBuffer.h" |
10 #include "bindings/core/v8/V8DOMWrapper.h" | 10 #include "bindings/core/v8/V8DOMWrapper.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 private: | 41 private: |
42 DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteL
ength) | 42 DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteL
ength) |
43 : ArrayBufferView(buffer, byteOffset) | 43 : ArrayBufferView(buffer, byteOffset) |
44 , m_byteLength(byteLength) { } | 44 , m_byteLength(byteLength) { } |
45 | 45 |
46 unsigned m_byteLength; | 46 unsigned m_byteLength; |
47 }; | 47 }; |
48 | 48 |
49 } // anonymous namespace | 49 } // anonymous namespace |
50 | 50 |
51 PassRefPtr<DOMDataView> DOMDataView::create(PassRefPtr<DOMArrayBuffer> prpBuffer
, unsigned byteOffset, unsigned byteLength) | 51 PassRefPtr<DOMDataView> DOMDataView::create(PassRefPtr<DOMArrayBufferBase> prpBu
ffer, unsigned byteOffset, unsigned byteLength) |
52 { | 52 { |
53 RefPtr<DOMArrayBuffer> buffer = prpBuffer; | 53 RefPtr<DOMArrayBufferBase> buffer = prpBuffer; |
54 RefPtr<DataView> dataView = DataView::create(buffer->buffer(), byteOffset, b
yteLength); | 54 RefPtr<DataView> dataView = DataView::create(buffer->buffer(), byteOffset, b
yteLength); |
55 return adoptRef(new DOMDataView(dataView.release(), buffer.release())); | 55 return adoptRef(new DOMDataView(dataView.release(), buffer.release())); |
56 } | 56 } |
57 | 57 |
58 v8::Local<v8::Object> DOMDataView::wrap(v8::Isolate* isolate, v8::Local<v8::Obje
ct> creationContext) | 58 v8::Local<v8::Object> DOMDataView::wrap(v8::Isolate* isolate, v8::Local<v8::Obje
ct> creationContext) |
59 { | 59 { |
60 // It's possible that no one except for the new wrapper owns this object at | 60 // It's possible that no one except for the new wrapper owns this object at |
61 // this moment, so we have to prevent GC to collect this object until the | 61 // this moment, so we have to prevent GC to collect this object until the |
62 // object gets associated with the wrapper. | 62 // object gets associated with the wrapper. |
63 RefPtr<DOMDataView> protect(this); | 63 RefPtr<DOMDataView> protect(this); |
(...skipping 16 matching lines...) Expand all Loading... |
80 | 80 |
81 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper); | 81 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper); |
82 } | 82 } |
83 | 83 |
84 v8::Local<v8::Object> DOMDataView::associateWithWrapper(v8::Isolate* isolate, co
nst WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper) | 84 v8::Local<v8::Object> DOMDataView::associateWithWrapper(v8::Isolate* isolate, co
nst WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper) |
85 { | 85 { |
86 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperTypeIn
fo, wrapper); | 86 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperTypeIn
fo, wrapper); |
87 } | 87 } |
88 | 88 |
89 } // namespace blink | 89 } // namespace blink |
OLD | NEW |