refactor: eliminate duplicate code (#29174)
This commit is contained in:
parent
6330f8be9f
commit
241cceb2c9
10 changed files with 66 additions and 151 deletions
|
@ -35,6 +35,8 @@ const base::Feature kContextBridgeMutability{"ContextBridgeMutability",
|
|||
|
||||
namespace electron {
|
||||
|
||||
content::RenderFrame* GetRenderFrame(v8::Local<v8::Object> value);
|
||||
|
||||
namespace api {
|
||||
|
||||
namespace context_bridge {
|
||||
|
@ -56,16 +58,6 @@ inline bool IsTrue(v8::Maybe<bool> maybe) {
|
|||
return maybe.IsJust() && maybe.FromJust();
|
||||
}
|
||||
|
||||
content::RenderFrame* GetRenderFrame(const v8::Local<v8::Object>& value) {
|
||||
v8::Local<v8::Context> context = value->CreationContext();
|
||||
if (context.IsEmpty())
|
||||
return nullptr;
|
||||
blink::WebLocalFrame* frame = blink::WebLocalFrame::FrameForContext(context);
|
||||
if (!frame)
|
||||
return nullptr;
|
||||
return content::RenderFrame::FromWebFrame(frame);
|
||||
}
|
||||
|
||||
// Sourced from "extensions/renderer/v8_schema_registry.cc"
|
||||
// Recursively freezes every v8 object on |object|.
|
||||
bool DeepFreeze(const v8::Local<v8::Object>& object,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue