refactor: add EmitWarning(v8::Isolate*)
helper (#43736)
refactor: add `EmitWarning(v8::Isolate*)` helper (#43722) * refactor: add EmitWarning(Isolate*, ...) warning * chore: remove EmitWarning(node::Environment*, ...) * chore: add code comments * fixup! refactor: add EmitWarning(Isolate*, ...) warning * chore: remove unused node #includes
This commit is contained in:
parent
18bd295873
commit
d11c840cf0
18 changed files with 69 additions and 84 deletions
|
@ -7,26 +7,9 @@
|
|||
#include <string_view>
|
||||
#include "base/command_line.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "gin/dictionary.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
void EmitWarning(node::Environment* env,
|
||||
const std::string& warning_msg,
|
||||
const std::string& warning_type) {
|
||||
v8::HandleScope scope(env->isolate());
|
||||
gin::Dictionary process(env->isolate(), env->process_object());
|
||||
|
||||
base::RepeatingCallback<void(std::string_view, std::string_view,
|
||||
std::string_view)>
|
||||
emit_warning;
|
||||
process.Get("emitWarning", &emit_warning);
|
||||
|
||||
emit_warning.Run(warning_msg, warning_type, "");
|
||||
}
|
||||
|
||||
std::string GetProcessType() {
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
return command_line->GetSwitchValueASCII(switches::kProcessType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue