Commit f8646e5e authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bindings: Apply NotShared<T> to DOMDataView

DataView is also an ArrayBufferView as well as Int32Array, etc.
NotShared/AllowShared should be applied to DataView, too.

Bug: 839389
Change-Id: I0d4848fb4a1e2046ac447bb002b7963c011fa602
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2060349Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742026}
parent c0b9eeea
......@@ -470,6 +470,8 @@ def is_keep_alive_for_gc(interface, attribute):
extended_attributes = attribute.extended_attributes
if attribute.is_static:
return False
if idl_type.is_array_buffer_or_view:
return False
return (
# For readonly attributes, for performance reasons we keep the attribute
# wrapper alive while the owner wrapper is alive, because the attribute
......
......@@ -246,7 +246,7 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_
return 'FlexibleArrayBufferView'
if base_idl_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes:
return 'Flexible' + base_idl_type
if base_idl_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES:
if base_idl_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES or base_idl_type == 'DataView':
if not used_in_cpp_sequence:
if 'AllowShared' in extended_attributes:
return cpp_template_type('MaybeShared', idl_type.implemented_as)
......@@ -686,7 +686,7 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name
cpp_expression_format = (
'{v8_value}->Is{idl_type}() ? '
'V8{idl_type}::ToImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) : 0')
elif idl_type.is_array_buffer_view_or_typed_array:
elif idl_type.is_array_buffer_view_or_typed_array or base_idl_type == 'DataView':
this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes)
if 'AllowShared' in extended_attributes:
cpp_expression_format = ('ToMaybeShared<%s>({isolate}, {v8_value}, exception_state)' % this_cpp_type)
......
......@@ -35,7 +35,6 @@
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/scheduler/public/cooperative_scheduling_manager.h"
#include "third_party/blink/renderer/platform/wtf/get_ptr.h"
......
......@@ -1059,7 +1059,8 @@ void USBDevice::AsyncIsochronousTransferIn(
DOMDataView::Create(buffer, byte_offset, packet->transferred_length);
}
packets.push_back(USBIsochronousInTransferPacket::Create(
ConvertTransferStatus(packet->status), data_view));
ConvertTransferStatus(packet->status),
NotShared<DOMDataView>(data_view)));
byte_offset += packet->length;
}
resolver->Resolve(USBIsochronousInTransferResult::Create(buffer, packets));
......
......@@ -29,8 +29,9 @@ class USBInTransferResult final : public ScriptWrappable {
return MakeGarbageCollected<USBInTransferResult>(status, nullptr);
}
static USBInTransferResult* Create(const String& status, DOMDataView* data) {
return MakeGarbageCollected<USBInTransferResult>(status, data);
static USBInTransferResult* Create(const String& status,
NotShared<DOMDataView> data) {
return MakeGarbageCollected<USBInTransferResult>(status, data.View());
}
USBInTransferResult(const String& status, DOMDataView* data)
......
......@@ -22,8 +22,9 @@ class USBIsochronousInTransferPacket final : public ScriptWrappable {
}
static USBIsochronousInTransferPacket* Create(const String& status,
DOMDataView* data) {
return MakeGarbageCollected<USBIsochronousInTransferPacket>(status, data);
NotShared<DOMDataView> data) {
return MakeGarbageCollected<USBIsochronousInTransferPacket>(status,
data.View());
}
USBIsochronousInTransferPacket(const String& status, DOMDataView* data)
......
......@@ -29,8 +29,9 @@ class USBIsochronousInTransferResult final : public ScriptWrappable {
static USBIsochronousInTransferResult* Create(
const HeapVector<Member<USBIsochronousInTransferPacket>>& packets,
DOMDataView* data) {
return MakeGarbageCollected<USBIsochronousInTransferResult>(data, packets);
NotShared<DOMDataView> data) {
return MakeGarbageCollected<USBIsochronousInTransferResult>(data.View(),
packets);
}
static USBIsochronousInTransferResult* Create(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment