| 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 10 matching lines...) Expand all Loading... |
| 21 { | 21 { |
| 22 RELEASE_ASSERT(byteOffset <= buffer->byteLength()); | 22 RELEASE_ASSERT(byteOffset <= buffer->byteLength()); |
| 23 CheckedInt<uint32_t> checkedOffset(byteOffset); | 23 CheckedInt<uint32_t> checkedOffset(byteOffset); |
| 24 CheckedInt<uint32_t> checkedLength(byteLength); | 24 CheckedInt<uint32_t> checkedLength(byteLength); |
| 25 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength; | 25 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength; |
| 26 RELEASE_ASSERT(checkedMax.isValid()); | 26 RELEASE_ASSERT(checkedMax.isValid()); |
| 27 RELEASE_ASSERT(checkedMax.value() <= buffer->byteLength()); | 27 RELEASE_ASSERT(checkedMax.value() <= buffer->byteLength()); |
| 28 return adoptRef(new DataView(buffer, byteOffset, byteLength)); | 28 return adoptRef(new DataView(buffer, byteOffset, byteLength)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual unsigned byteLength() const override { return m_byteLength; } | 31 unsigned byteLength() const override { return m_byteLength; } |
| 32 virtual ViewType type() const override { return TypeDataView; } | 32 ViewType type() const override { return TypeDataView; } |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 virtual void neuter() override | 35 void neuter() override |
| 36 { | 36 { |
| 37 ArrayBufferView::neuter(); | 37 ArrayBufferView::neuter(); |
| 38 m_byteLength = 0; | 38 m_byteLength = 0; |
| 39 } | 39 } |
| 40 | 40 |
| 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |