Skip to content
Snippets Groups Projects
Unverified Commit 975da07b authored by trop[bot]'s avatar trop[bot] Committed by GitHub
Browse files

chore: add a DCHECK to confirm the BigBuffer is full


Co-authored-by: default avatarCharles Kerr <charles@charleskerr.com>
......@@ -114,8 +114,10 @@ void Clipboard::WriteBuffer(const std::string& format,
CHECK(buffer->IsArrayBufferView());
v8::Local<v8::ArrayBufferView> buffer_view = buffer.As<v8::ArrayBufferView>();
const size_t n_bytes = buffer_view->ByteLength();
mojo_base::BigBuffer big_buffer(n_bytes);
buffer_view->CopyContents(big_buffer.data(), n_bytes);
mojo_base::BigBuffer big_buffer{n_bytes};
[[maybe_unused]] const size_t n_got =
buffer_view->CopyContents(big_buffer.data(), n_bytes);
DCHECK_EQ(n_got, n_bytes);
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
writer.WriteUnsafeRawData(base::UTF8ToUTF16(format), std::move(big_buffer));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment