Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2855123009: Expose SerializedScriptValue data through a non-copying view. (Closed)
Patch Set: update layout test results to not include padding Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index f8a6d3f97169e1c569da332dcb97d4948e2171d8..89b30e57fa6da30194f3ef4c32bef7fdeb163b30 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2676,13 +2676,12 @@ bool Internals::cursorUpdatePending() const {
DOMArrayBuffer* Internals::serializeObject(
PassRefPtr<SerializedScriptValue> value) const {
- String string_value = value->ToWireString();
- DOMArrayBuffer* buffer = DOMArrayBuffer::CreateUninitializedOrNull(
- string_value.length(), sizeof(UChar));
- if (buffer) {
- string_value.CopyTo(static_cast<UChar*>(buffer->Data()), 0,
- string_value.length());
- }
+ StringView view = value->GetWireData();
+ DCHECK(view.Is8Bit());
+ DOMArrayBuffer* buffer =
+ DOMArrayBuffer::CreateUninitializedOrNull(view.length(), sizeof(LChar));
+ if (buffer)
+ memcpy(buffer->Data(), view.Characters8(), view.length());
return buffer;
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698