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

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

Issue 2730943002: XMLHttpRequest: return null upon failing responseArrayBuffer allocation. (Closed)
Patch Set: mirror updated spec, and return |null| for failed allocs 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 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 bool Internals::cursorUpdatePending() const { 2637 bool Internals::cursorUpdatePending() const {
2638 if (!frame()) 2638 if (!frame())
2639 return false; 2639 return false;
2640 2640
2641 return frame()->eventHandler().cursorUpdatePending(); 2641 return frame()->eventHandler().cursorUpdatePending();
2642 } 2642 }
2643 2643
2644 DOMArrayBuffer* Internals::serializeObject( 2644 DOMArrayBuffer* Internals::serializeObject(
2645 PassRefPtr<SerializedScriptValue> value) const { 2645 PassRefPtr<SerializedScriptValue> value) const {
2646 String stringValue = value->toWireString(); 2646 String stringValue = value->toWireString();
2647 DOMArrayBuffer* buffer = 2647 DOMArrayBuffer* buffer = DOMArrayBuffer::createUninitializedOrNull(
2648 DOMArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar)); 2648 stringValue.length(), sizeof(UChar));
2649 stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0, 2649 if (buffer) {
2650 stringValue.length()); 2650 stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0,
2651 stringValue.length());
2652 }
2651 return buffer; 2653 return buffer;
2652 } 2654 }
2653 2655
2654 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer( 2656 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(
2655 DOMArrayBuffer* buffer) const { 2657 DOMArrayBuffer* buffer) const {
2656 String value(static_cast<const UChar*>(buffer->data()), 2658 String value(static_cast<const UChar*>(buffer->data()),
2657 buffer->byteLength() / sizeof(UChar)); 2659 buffer->byteLength() / sizeof(UChar));
2658 return SerializedScriptValue::create(value); 2660 return SerializedScriptValue::create(value);
2659 } 2661 }
2660 2662
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
3215 3217
3216 void Internals::crash() { 3218 void Internals::crash() {
3217 CHECK(false) << "Intentional crash"; 3219 CHECK(false) << "Intentional crash";
3218 } 3220 }
3219 3221
3220 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3222 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3221 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3223 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3222 } 3224 }
3223 3225
3224 } // namespace blink 3226 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/mojo/MojoHandle.cpp ('k') | third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698