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

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2730943002: XMLHttpRequest: return null upon failing responseArrayBuffer allocation. (Closed)
Patch Set: Created 3 years, 9 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
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 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 bool Internals::cursorUpdatePending() const { 2598 bool Internals::cursorUpdatePending() const {
2599 if (!frame()) 2599 if (!frame())
2600 return false; 2600 return false;
2601 2601
2602 return frame()->eventHandler().cursorUpdatePending(); 2602 return frame()->eventHandler().cursorUpdatePending();
2603 } 2603 }
2604 2604
2605 DOMArrayBuffer* Internals::serializeObject( 2605 DOMArrayBuffer* Internals::serializeObject(
2606 PassRefPtr<SerializedScriptValue> value) const { 2606 PassRefPtr<SerializedScriptValue> value) const {
2607 String stringValue = value->toWireString(); 2607 String stringValue = value->toWireString();
2608 DOMArrayBuffer* buffer = 2608 DOMArrayBuffer* buffer = DOMArrayBuffer::createUninitializedOrNull(
2609 DOMArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar)); 2609 stringValue.length(), sizeof(UChar));
2610 stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0, 2610 if (buffer) {
2611 stringValue.length()); 2611 stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0,
2612 stringValue.length());
2613 }
2612 return buffer; 2614 return buffer;
2613 } 2615 }
2614 2616
2615 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer( 2617 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(
2616 DOMArrayBuffer* buffer) const { 2618 DOMArrayBuffer* buffer) const {
2617 String value(static_cast<const UChar*>(buffer->data()), 2619 String value(static_cast<const UChar*>(buffer->data()),
2618 buffer->byteLength() / sizeof(UChar)); 2620 buffer->byteLength() / sizeof(UChar));
2619 return SerializedScriptValue::create(value); 2621 return SerializedScriptValue::create(value);
2620 } 2622 }
2621 2623
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 3178
3177 void Internals::crash() { 3179 void Internals::crash() {
3178 CHECK(false) << "Intentional crash"; 3180 CHECK(false) << "Intentional crash";
3179 } 3181 }
3180 3182
3181 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3183 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3182 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3184 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3183 } 3185 }
3184 3186
3185 } // namespace blink 3187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698