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

v8bindings: Remove custom bindings of MessageChannel

After the unified heap, lifetime control in
v8_message_channel_custom.cc should be no longer needed.  Removes
the custom bindings.

Change-Id: Icc0228509a490efc3bc53afd3db1d2019eef185d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993070Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729721}
parent d703173d
......@@ -29,7 +29,6 @@ bindings_core_v8_files =
"core/v8/custom/v8_event_target_custom.cc",
"core/v8/custom/v8_html_all_collection_custom.cc",
"core/v8/custom/v8_html_plugin_element_custom.cc",
"core/v8/custom/v8_message_channel_custom.cc",
"core/v8/custom/v8_pop_state_event_custom.cc",
"core/v8/custom/v8_promise_rejection_event_custom.cc",
"core/v8/custom/v8_shadow_root_custom.cc",
......
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/renderer/bindings/core/v8/v8_message_channel.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_message_port.h"
#include "third_party/blink/renderer/core/messaging/message_channel.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
namespace blink {
const V8PrivateProperty::SymbolKey kPrivatePropertyPort1;
const V8PrivateProperty::SymbolKey kPrivatePropertyPort2;
void V8MessageChannel::ConstructorCustom(
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ExecutionContext* context = CurrentExecutionContext(isolate);
auto* channel = MakeGarbageCollected<MessageChannel>(context);
v8::Local<v8::Object> wrapper = info.Holder();
// Create references from the MessageChannel wrapper to the two
// MessagePort wrappers to make sure that the MessagePort wrappers
// stay alive as long as the MessageChannel wrapper is around.
V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyPort1)
.Set(wrapper, ToV8(channel->port1(), wrapper, isolate));
V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyPort2)
.Set(wrapper, ToV8(channel->port2(), wrapper, isolate));
V8SetReturnValue(info, V8DOMWrapper::AssociateObjectWithWrapper(
isolate, channel, GetWrapperTypeInfo(), wrapper));
}
} // namespace blink
......@@ -40,6 +40,10 @@ class CORE_EXPORT MessageChannel final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
static MessageChannel* Create(ExecutionContext* execution_context) {
return MakeGarbageCollected<MessageChannel>(execution_context);
}
explicit MessageChannel(ExecutionContext*);
MessagePort* port1() const { return port1_; }
......
......@@ -27,10 +27,9 @@
// https://html.spec.whatwg.org/C/#message-channels
[
Exposed=(Window,Worker),
Measure
Exposed=(Window, Worker)
] interface MessageChannel {
[Custom] constructor();
[CallWith=ExecutionContext, Measure] constructor();
readonly attribute MessagePort port1;
readonly attribute MessagePort port2;
};
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