refactor: use WeakRef on main process side of remote (#24115)

This commit is contained in:
Jeremy Rose 2020-06-16 14:34:08 -07:00 committed by GitHub
parent 09c0ee8f87
commit e1e73fa5f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 181 deletions

View file

@ -209,33 +209,6 @@ void ElectronApiServiceImpl::ReceivePostMessage(
0);
}
#if BUILDFLAG(ENABLE_REMOTE_MODULE)
void ElectronApiServiceImpl::DereferenceRemoteJSCallback(
const std::string& context_id,
int32_t object_id) {
const auto* channel = "ELECTRON_RENDERER_RELEASE_CALLBACK";
if (!document_created_)
return;
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
if (!frame)
return;
v8::Isolate* isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = renderer_client_->GetContext(frame, isolate);
v8::Context::Scope context_scope(context);
base::ListValue args;
args.AppendString(context_id);
args.AppendInteger(object_id);
v8::Local<v8::Value> v8_args = gin::ConvertToV8(isolate, args);
EmitIPCEvent(context, true /* internal */, channel, {}, v8_args,
0 /* sender_id */);
}
#endif
void ElectronApiServiceImpl::NotifyUserActivation() {
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
if (frame)