OLD | NEW |
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 308 } |
309 | 309 |
310 PassRefPtr<DOMArrayBuffer> FileReaderLoader::arrayBufferResult() const | 310 PassRefPtr<DOMArrayBuffer> FileReaderLoader::arrayBufferResult() const |
311 { | 311 { |
312 ASSERT(m_readType == ReadAsArrayBuffer); | 312 ASSERT(m_readType == ReadAsArrayBuffer); |
313 | 313 |
314 // If the loading is not started or an error occurs, return an empty result. | 314 // If the loading is not started or an error occurs, return an empty result. |
315 if (!m_rawData || m_errorCode) | 315 if (!m_rawData || m_errorCode) |
316 return nullptr; | 316 return nullptr; |
317 | 317 |
318 return DOMArrayBuffer::create(m_rawData->toArrayBuffer()); | 318 return DOMArrayBuffer::createOrNull(m_rawData->toArrayBuffer()); |
319 } | 319 } |
320 | 320 |
321 String FileReaderLoader::stringResult() | 321 String FileReaderLoader::stringResult() |
322 { | 322 { |
323 ASSERT(m_readType != ReadAsArrayBuffer && m_readType != ReadByClient); | 323 ASSERT(m_readType != ReadAsArrayBuffer && m_readType != ReadByClient); |
324 | 324 |
325 // If the loading is not started or an error occurs, return an empty result. | 325 // If the loading is not started or an error occurs, return an empty result. |
326 if (!m_rawData || m_errorCode) | 326 if (!m_rawData || m_errorCode) |
327 return m_stringResult; | 327 return m_stringResult; |
328 | 328 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 m_stringResult = builder.toString(); | 401 m_stringResult = builder.toString(); |
402 } | 402 } |
403 | 403 |
404 void FileReaderLoader::setEncoding(const String& encoding) | 404 void FileReaderLoader::setEncoding(const String& encoding) |
405 { | 405 { |
406 if (!encoding.isEmpty()) | 406 if (!encoding.isEmpty()) |
407 m_encoding = WTF::TextEncoding(encoding); | 407 m_encoding = WTF::TextEncoding(encoding); |
408 } | 408 } |
409 | 409 |
410 } // namespace blink | 410 } // namespace blink |
OLD | NEW |