| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (m_readType != ReadByClient) { | 211 if (m_readType != ReadByClient) { |
| 212 // Check that we can cast to unsigned since we have to do | 212 // Check that we can cast to unsigned since we have to do |
| 213 // so to call ArrayBuffer's create function. | 213 // so to call ArrayBuffer's create function. |
| 214 // FIXME: Support reading more than the current size limit of ArrayBuffer. | 214 // FIXME: Support reading more than the current size limit of ArrayBuffer. |
| 215 if (initialBufferLength > std::numeric_limits<unsigned>::max()) { | 215 if (initialBufferLength > std::numeric_limits<unsigned>::max()) { |
| 216 failed(FileError::kNotReadableErr); | 216 failed(FileError::kNotReadableErr); |
| 217 return; | 217 return; |
| 218 } | 218 } |
| 219 | 219 |
| 220 if (initialBufferLength < 0) | 220 if (initialBufferLength < 0) |
| 221 m_rawData = makeUnique<ArrayBufferBuilder>(); | 221 m_rawData = WTF::makeUnique<ArrayBufferBuilder>(); |
| 222 else | 222 else |
| 223 m_rawData = wrapUnique( | 223 m_rawData = WTF::wrapUnique( |
| 224 new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength))); | 224 new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength))); |
| 225 | 225 |
| 226 if (!m_rawData || !m_rawData->isValid()) { | 226 if (!m_rawData || !m_rawData->isValid()) { |
| 227 failed(FileError::kNotReadableErr); | 227 failed(FileError::kNotReadableErr); |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 if (initialBufferLength >= 0) { | 231 if (initialBufferLength >= 0) { |
| 232 // Total size is known. Set m_rawData to ignore overflowed data. | 232 // Total size is known. Set m_rawData to ignore overflowed data. |
| 233 m_rawData->setVariableCapacity(false); | 233 m_rawData->setVariableCapacity(false); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 m_stringResult = builder.toString(); | 416 m_stringResult = builder.toString(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void FileReaderLoader::setEncoding(const String& encoding) { | 419 void FileReaderLoader::setEncoding(const String& encoding) { |
| 420 if (!encoding.isEmpty()) | 420 if (!encoding.isEmpty()) |
| 421 m_encoding = WTF::TextEncoding(encoding); | 421 m_encoding = WTF::TextEncoding(encoding); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace blink | 424 } // namespace blink |
| OLD | NEW |