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

bindings: Relax return type of ScriptWrappable::Wrap to v8::Value

As a preparation of https://crrev.com/c/1996111 , relaxes the
return type of ScriptWrappable::Wrap from v8::Local<v8::Object>
to v8::Local<v8::Value> so that it can return v8::Null in
addition to v8::Object.

Change-Id: I453c405d62f4deef8bcf3bddcc59aa80a56c46d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032552Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737701}
parent 5fea9064
......@@ -44,10 +44,10 @@ DOMWindow::~DOMWindow() {
DCHECK(!frame_);
}
v8::Local<v8::Object> DOMWindow::Wrap(v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
v8::Local<v8::Value> DOMWindow::Wrap(v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
NOTREACHED();
return v8::Local<v8::Object>();
return v8::Local<v8::Value>();
}
v8::Local<v8::Object> DOMWindow::AssociateWithWrapper(
......
......@@ -64,8 +64,8 @@ class CORE_EXPORT DOMWindow : public EventTargetWithInlineData {
virtual bool IsRemoteDOMWindow() const = 0;
// ScriptWrappable overrides:
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) final;
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) final;
v8::Local<v8::Object> AssociateWithWrapper(
v8::Isolate*,
const WrapperTypeInfo*,
......
......@@ -70,7 +70,7 @@ DOMArrayBuffer* DOMArrayBuffer::CreateUninitializedOrNull(
return Create(std::move(buffer));
}
v8::Local<v8::Object> DOMArrayBuffer::Wrap(
v8::Local<v8::Value> DOMArrayBuffer::Wrap(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));
......
......@@ -56,8 +56,8 @@ class CORE_EXPORT DOMArrayBuffer final : public DOMArrayBufferBase {
return Buffer()->ShareNonSharedForInternalUse(result);
}
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
};
} // namespace blink
......
......@@ -35,8 +35,8 @@ class CORE_EXPORT DOMArrayBufferBase : public ScriptWrappable {
bool IsDetached() const { return Buffer()->IsDetached(); }
bool IsShared() const { return Buffer()->IsShared(); }
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override {
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override {
NOTREACHED();
return v8::Local<v8::Object>();
}
......
......@@ -80,8 +80,8 @@ class CORE_EXPORT DOMArrayBufferView : public ScriptWrappable {
return View()->BaseAddressMaybeShared();
}
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override {
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override {
NOTREACHED();
return v8::Local<v8::Object>();
}
......
......@@ -51,9 +51,8 @@ DOMDataView* DOMDataView::Create(DOMArrayBufferBase* buffer,
return MakeGarbageCollected<DOMDataView>(data_view, buffer);
}
v8::Local<v8::Object> DOMDataView::Wrap(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
v8::Local<v8::Value> DOMDataView::Wrap(v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));
const WrapperTypeInfo* wrapper_type_info = this->GetWrapperTypeInfo();
......
......@@ -24,8 +24,8 @@ class CORE_EXPORT DOMDataView final : public DOMArrayBufferView {
DOMArrayBufferBase* dom_array_buffer)
: DOMArrayBufferView(std::move(data_view), dom_array_buffer) {}
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
};
} // namespace blink
......
......@@ -8,7 +8,7 @@
namespace blink {
v8::Local<v8::Object> DOMSharedArrayBuffer::Wrap(
v8::Local<v8::Value> DOMSharedArrayBuffer::Wrap(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));
......
......@@ -39,8 +39,8 @@ class CORE_EXPORT DOMSharedArrayBuffer final : public DOMArrayBufferBase {
return Buffer()->ShareContentsWith(result);
}
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
};
} // namespace blink
......
......@@ -21,7 +21,7 @@
namespace blink {
template <typename TypedArray, typename V8TypedArray>
v8::Local<v8::Object> DOMTypedArray<TypedArray, V8TypedArray>::Wrap(
v8::Local<v8::Value> DOMTypedArray<TypedArray, V8TypedArray>::Wrap(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));
......
......@@ -76,8 +76,8 @@ class DOMTypedArray final : public DOMArrayBufferView {
// is responsible for doing so and returning undefined as necessary.
ValueType Item(size_t index) const { return View()->Item(index); }
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) override;
};
extern template class CORE_EXTERN_TEMPLATE_EXPORT
......
......@@ -207,7 +207,7 @@ const AtomicString& WorkerOrWorkletGlobalScope::InterfaceName() const {
return g_null_atom;
}
v8::Local<v8::Object> WorkerOrWorkletGlobalScope::Wrap(
v8::Local<v8::Value> WorkerOrWorkletGlobalScope::Wrap(
v8::Isolate*,
v8::Local<v8::Object> creation_context) {
LOG(FATAL) << "WorkerOrWorkletGlobalScope must never be wrapped with wrap "
......
......@@ -57,8 +57,8 @@ class CORE_EXPORT WorkerOrWorkletGlobalScope : public EventTargetWithInlineData,
const AtomicString& InterfaceName() const override;
// ScriptWrappable
v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) final;
v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context) final;
v8::Local<v8::Object> AssociateWithWrapper(
v8::Isolate*,
const WrapperTypeInfo*,
......
......@@ -17,7 +17,7 @@ struct SameSizeAsScriptWrappable {
static_assert(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable),
"ScriptWrappable should stay small");
v8::Local<v8::Object> ScriptWrappable::Wrap(
v8::Local<v8::Value> ScriptWrappable::Wrap(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context) {
const WrapperTypeInfo* wrapper_type_info = this->GetWrapperTypeInfo();
......
......@@ -95,8 +95,8 @@ class PLATFORM_EXPORT ScriptWrappable
virtual const WrapperTypeInfo* GetWrapperTypeInfo() const = 0;
// Creates and returns a new wrapper object.
virtual v8::Local<v8::Object> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context);
virtual v8::Local<v8::Value> Wrap(v8::Isolate*,
v8::Local<v8::Object> creation_context);
// Associates the instance with the given |wrapper| if this instance is not
// yet associated with any wrapper. Returns the wrapper already associated
......
......@@ -162,7 +162,7 @@ inline void V8SetReturnValue(const CallbackInfo& callback_info,
}
if (DOMDataStore::SetReturnValue(callback_info.GetReturnValue(), impl))
return;
v8::Local<v8::Object> wrapper =
v8::Local<v8::Value> wrapper =
impl->Wrap(callback_info.GetIsolate(), creation_context);
V8SetReturnValue(callback_info, wrapper);
}
......@@ -184,7 +184,7 @@ inline void V8SetReturnValueForMainWorld(const CallbackInfo& callback_info,
if (DOMDataStore::SetReturnValueForMainWorld(callback_info.GetReturnValue(),
impl))
return;
v8::Local<v8::Object> wrapper =
v8::Local<v8::Value> wrapper =
impl->Wrap(callback_info.GetIsolate(), callback_info.Holder());
V8SetReturnValue(callback_info, wrapper);
}
......@@ -200,7 +200,7 @@ inline void V8SetReturnValueFast(const CallbackInfo& callback_info,
if (DOMDataStore::SetReturnValueFast(callback_info.GetReturnValue(), impl,
callback_info.Holder(), wrappable))
return;
v8::Local<v8::Object> wrapper =
v8::Local<v8::Value> wrapper =
impl->Wrap(callback_info.GetIsolate(), callback_info.Holder());
V8SetReturnValue(callback_info, wrapper);
}
......
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