process_util.cc 842 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "shell/common/process_util.h"
  5. #include "gin/dictionary.h"
  6. #include "shell/common/gin_converters/callback_converter.h"
  7. #include "shell/common/node_includes.h"
  8. namespace electron {
  9. void EmitWarning(node::Environment* env,
  10. const std::string& warning_msg,
  11. const std::string& warning_type) {
  12. v8::HandleScope scope(env->isolate());
  13. gin::Dictionary process(env->isolate(), env->process_object());
  14. base::RepeatingCallback<void(base::StringPiece, base::StringPiece,
  15. base::StringPiece)>
  16. emit_warning;
  17. process.Get("emitWarning", &emit_warning);
  18. emit_warning.Run(warning_msg, warning_type, "");
  19. }
  20. } // namespace electron