process_util.cc 802 B

1234567891011121314151617181920212223242526
  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. namespace electron {
  8. void EmitWarning(node::Environment* env,
  9. const std::string& warning_msg,
  10. const std::string& warning_type) {
  11. v8::HandleScope scope(env->isolate());
  12. gin::Dictionary process(env->isolate(), env->process_object());
  13. base::RepeatingCallback<void(base::StringPiece, base::StringPiece,
  14. base::StringPiece)>
  15. emit_warning;
  16. process.Get("emitWarning", &emit_warning);
  17. emit_warning.Run(warning_msg, warning_type, "");
  18. }
  19. } // namespace electron