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

Side by Side Diff: third_party/WebKit/Source/core/dom/DOMDataView.cpp

Issue 2277603005: Implement tex{Sub}Image{2|3}D with ArrayBufferView sub source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tiny improvement Created 4 years, 3 months 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
OLDNEW
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/typed_arrays/ArrayBufferView.h" 10 #include "wtf/typed_arrays/ArrayBufferView.h"
(...skipping 10 matching lines...) Expand all
21 CheckedInt<uint32_t> checkedOffset(byteOffset); 21 CheckedInt<uint32_t> checkedOffset(byteOffset);
22 CheckedInt<uint32_t> checkedLength(byteLength); 22 CheckedInt<uint32_t> checkedLength(byteLength);
23 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength; 23 CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength;
24 RELEASE_ASSERT(checkedMax.isValid()); 24 RELEASE_ASSERT(checkedMax.isValid());
25 RELEASE_ASSERT(checkedMax.value() <= buffer->byteLength()); 25 RELEASE_ASSERT(checkedMax.value() <= buffer->byteLength());
26 return adoptRef(new DataView(buffer, byteOffset, byteLength)); 26 return adoptRef(new DataView(buffer, byteOffset, byteLength));
27 } 27 }
28 28
29 unsigned byteLength() const override { return m_byteLength; } 29 unsigned byteLength() const override { return m_byteLength; }
30 ViewType type() const override { return TypeDataView; } 30 ViewType type() const override { return TypeDataView; }
31 unsigned typeSize() const override { return 1; }
31 32
32 protected: 33 protected:
33 void neuter() override 34 void neuter() override
34 { 35 {
35 ArrayBufferView::neuter(); 36 ArrayBufferView::neuter();
36 m_byteLength = 0; 37 m_byteLength = 0;
37 } 38 }
38 39
39 private: 40 private:
40 DataView(ArrayBuffer* buffer, unsigned byteOffset, unsigned byteLength) 41 DataView(ArrayBuffer* buffer, unsigned byteOffset, unsigned byteLength)
(...skipping 20 matching lines...) Expand all
61 if (v8Buffer.IsEmpty()) 62 if (v8Buffer.IsEmpty())
62 return v8::Local<v8::Object>(); 63 return v8::Local<v8::Object>();
63 DCHECK(v8Buffer->IsArrayBuffer()); 64 DCHECK(v8Buffer->IsArrayBuffer());
64 65
65 v8::Local<v8::Object> wrapper = v8::DataView::New(v8Buffer.As<v8::ArrayBuffe r>(), byteOffset(), byteLength()); 66 v8::Local<v8::Object> wrapper = v8::DataView::New(v8Buffer.As<v8::ArrayBuffe r>(), byteOffset(), byteLength());
66 67
67 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper); 68 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper);
68 } 69 }
69 70
70 } // namespace blink 71 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698