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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 switch (httpStatusCode) { 301 switch (httpStatusCode) {
302 case 403: 302 case 403:
303 return FileError::SECURITY_ERR; 303 return FileError::SECURITY_ERR;
304 case 404: 304 case 404:
305 return FileError::NOT_FOUND_ERR; 305 return FileError::NOT_FOUND_ERR;
306 default: 306 default:
307 return FileError::NOT_READABLE_ERR; 307 return FileError::NOT_READABLE_ERR;
308 } 308 }
309 } 309 }
310 310
311 PassRefPtr<DOMArrayBuffer> FileReaderLoader::arrayBufferResult() const 311 DOMArrayBuffer* FileReaderLoader::arrayBufferResult() const
312 { 312 {
313 ASSERT(m_readType == ReadAsArrayBuffer); 313 ASSERT(m_readType == ReadAsArrayBuffer);
314 314
315 // If the loading is not started or an error occurs, return an empty result. 315 // If the loading is not started or an error occurs, return an empty result.
316 if (!m_rawData || m_errorCode) 316 if (!m_rawData || m_errorCode)
317 return nullptr; 317 return nullptr;
318 318
319 return DOMArrayBuffer::create(m_rawData->toArrayBuffer()); 319 return DOMArrayBuffer::create(m_rawData->toArrayBuffer());
320 } 320 }
321 321
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 m_stringResult = builder.toString(); 402 m_stringResult = builder.toString();
403 } 403 }
404 404
405 void FileReaderLoader::setEncoding(const String& encoding) 405 void FileReaderLoader::setEncoding(const String& encoding)
406 { 406 {
407 if (!encoding.isEmpty()) 407 if (!encoding.isEmpty())
408 m_encoding = WTF::TextEncoding(encoding); 408 m_encoding = WTF::TextEncoding(encoding);
409 } 409 }
410 410
411 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698