refactor: eliminate duplicate code (#29174)

This commit is contained in:
Milan Burda 2021-05-24 04:32:55 +02:00 committed by GitHub
parent 6330f8be9f
commit 241cceb2c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 66 additions and 151 deletions

View file

@ -86,9 +86,13 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
}
v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
v8::Local<v8::String> preloadSrc) {
return RendererClientBase::RunScript(isolate->GetCurrentContext(),
preloadSrc);
v8::Local<v8::String> source) {
auto context = isolate->GetCurrentContext();
auto maybe_script = v8::Script::Compile(context, source);
v8::Local<v8::Script> script;
if (!maybe_script.ToLocal(&script))
return v8::Local<v8::Value>();
return script->Run(context).ToLocalChecked();
}
double Uptime() {
@ -157,11 +161,6 @@ void ElectronSandboxedRendererClient::RenderFrameCreated(
RendererClientBase::RenderFrameCreated(render_frame);
}
void ElectronSandboxedRendererClient::RenderViewCreated(
content::RenderView* render_view) {
RendererClientBase::RenderViewCreated(render_view);
}
void ElectronSandboxedRendererClient::RunScriptsAtDocumentStart(
content::RenderFrame* render_frame) {
RendererClientBase::RunScriptsAtDocumentStart(render_frame);