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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 2669
2670 bool Internals::cursorUpdatePending() const { 2670 bool Internals::cursorUpdatePending() const {
2671 if (!GetFrame()) 2671 if (!GetFrame())
2672 return false; 2672 return false;
2673 2673
2674 return GetFrame()->GetEventHandler().CursorUpdatePending(); 2674 return GetFrame()->GetEventHandler().CursorUpdatePending();
2675 } 2675 }
2676 2676
2677 DOMArrayBuffer* Internals::serializeObject( 2677 DOMArrayBuffer* Internals::serializeObject(
2678 PassRefPtr<SerializedScriptValue> value) const { 2678 PassRefPtr<SerializedScriptValue> value) const {
2679 String string_value = value->ToWireString(); 2679 StringView view = value->GetWireData();
2680 DOMArrayBuffer* buffer = DOMArrayBuffer::CreateUninitializedOrNull( 2680 DCHECK(view.Is8Bit());
2681 string_value.length(), sizeof(UChar)); 2681 DOMArrayBuffer* buffer =
2682 if (buffer) { 2682 DOMArrayBuffer::CreateUninitializedOrNull(view.length(), sizeof(LChar));
2683 string_value.CopyTo(static_cast<UChar*>(buffer->Data()), 0, 2683 if (buffer)
2684 string_value.length()); 2684 memcpy(buffer->Data(), view.Characters8(), view.length());
2685 }
2686 return buffer; 2685 return buffer;
2687 } 2686 }
2688 2687
2689 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer( 2688 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(
2690 DOMArrayBuffer* buffer) const { 2689 DOMArrayBuffer* buffer) const {
2691 String value(static_cast<const UChar*>(buffer->Data()), 2690 String value(static_cast<const UChar*>(buffer->Data()),
2692 buffer->ByteLength() / sizeof(UChar)); 2691 buffer->ByteLength() / sizeof(UChar));
2693 return SerializedScriptValue::Create(value); 2692 return SerializedScriptValue::Create(value);
2694 } 2693 }
2695 2694
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 3278
3280 void Internals::crash() { 3279 void Internals::crash() {
3281 CHECK(false) << "Intentional crash"; 3280 CHECK(false) << "Intentional crash";
3282 } 3281 }
3283 3282
3284 void Internals::setIsLowEndDevice(bool is_low_end_device) { 3283 void Internals::setIsLowEndDevice(bool is_low_end_device) {
3285 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); 3284 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device);
3286 } 3285 }
3287 3286
3288 } // namespace blink 3287 } // namespace blink
OLDNEW
« 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