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

Unified Diff: src/api.cc

Issue 1084513002: Expose ArrayBufferView::HasBuffer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-typedarrays.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 733214ec076712b31538853fe24fcc03162f80b9..9d4356c5140777598b0c67ebc3d293fc3bcacc37 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6471,6 +6471,15 @@ size_t v8::ArrayBufferView::CopyContents(void* dest, size_t byte_length) {
}
+bool v8::ArrayBufferView::HasBuffer() const {
+ i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this);
+ if (obj->IsJSDataView()) return true;
+ DCHECK(obj->IsJSTypedArray());
+ i::Handle<i::JSTypedArray> typed_array(i::JSTypedArray::cast(*obj));
+ return !typed_array->buffer()->IsSmi();
+}
+
+
size_t v8::ArrayBufferView::ByteOffset() {
i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this);
return static_cast<size_t>(obj->byte_offset()->Number());
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-typedarrays.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698