refactor: make node Buffers more friendly to base::span
/ std::span
(#46778)
* refactor: add electron::Buffer namespace; move the Buffer as_byte_span() into it Co-authored-by: Charles Kerr <charles@charleskerr.com> * feat: add electron::Buffer::Copy() a span-friendly version of node::Buffer::Copy() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in electron_api_base_window.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in electron_api_data_pipe_holder.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in electron_api_safe_storage.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in electron_api_clipboard.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in osr_converter.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in electron_api_native_image.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in net_converter.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use electron::Buffer::Copy() in electron_api_web_contents.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: make NewEmptyBuffer() return a Local<Value> Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
4e8c09f46a
commit
5a4ef1cc33
10 changed files with 93 additions and 72 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/node_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -72,8 +73,7 @@ v8::Local<v8::Value> EncryptString(v8::Isolate* isolate,
|
|||
return {};
|
||||
}
|
||||
|
||||
return node::Buffer::Copy(isolate, ciphertext.c_str(), ciphertext.size())
|
||||
.ToLocalChecked();
|
||||
return electron::Buffer::Copy(isolate, ciphertext).ToLocalChecked();
|
||||
}
|
||||
|
||||
std::string DecryptString(v8::Isolate* isolate, v8::Local<v8::Value> buffer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue