| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // If multiple concurrent read methods are called on the same FileReader, In
validStateError should be thrown when the state is LOADING. | 217 // If multiple concurrent read methods are called on the same FileReader, In
validStateError should be thrown when the state is LOADING. |
| 218 if (m_state == LOADING) { | 218 if (m_state == LOADING) { |
| 219 exceptionState.throwDOMException(InvalidStateError, "The object is alrea
dy busy reading Blobs."); | 219 exceptionState.throwDOMException(InvalidStateError, "The object is alrea
dy busy reading Blobs."); |
| 220 return; | 220 return; |
| 221 } | 221 } |
| 222 | 222 |
| 223 m_blob = blob; | 223 m_blob = blob; |
| 224 m_readType = type; | 224 m_readType = type; |
| 225 m_state = LOADING; | 225 m_state = LOADING; |
| 226 m_loadingState = LoadingStatePending; | 226 m_loadingState = LoadingStatePending; |
| 227 m_error = 0; | 227 m_error = nullptr; |
| 228 throttlingController()->pushReader(this); | 228 throttlingController()->pushReader(this); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void FileReader::executePendingRead() | 231 void FileReader::executePendingRead() |
| 232 { | 232 { |
| 233 ASSERT(m_loadingState == LoadingStatePending); | 233 ASSERT(m_loadingState == LoadingStatePending); |
| 234 m_loadingState = LoadingStateLoading; | 234 m_loadingState = LoadingStateLoading; |
| 235 | 235 |
| 236 m_loader = adoptPtr(new FileReaderLoader(m_readType, this)); | 236 m_loader = adoptPtr(new FileReaderLoader(m_readType, this)); |
| 237 m_loader->setEncoding(m_encoding); | 237 m_loader->setEncoding(m_encoding); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 ThreadSpecific<FileReader::ThrottlingController>& FileReader::throttlingControll
er() | 359 ThreadSpecific<FileReader::ThrottlingController>& FileReader::throttlingControll
er() |
| 360 { | 360 { |
| 361 AtomicallyInitializedStatic(ThreadSpecific<FileReader::ThrottlingController>
*, controller = new ThreadSpecific<FileReader::ThrottlingController>); | 361 AtomicallyInitializedStatic(ThreadSpecific<FileReader::ThrottlingController>
*, controller = new ThreadSpecific<FileReader::ThrottlingController>); |
| 362 return *controller; | 362 return *controller; |
| 363 } | 363 } |
| 364 | 364 |
| 365 PassRefPtr<ArrayBuffer> FileReader::arrayBufferResult() const | 365 PassRefPtr<ArrayBuffer> FileReader::arrayBufferResult() const |
| 366 { | 366 { |
| 367 if (!m_loader || m_error) | 367 if (!m_loader || m_error) |
| 368 return 0; | 368 return nullptr; |
| 369 return m_loader->arrayBufferResult(); | 369 return m_loader->arrayBufferResult(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 String FileReader::stringResult() | 372 String FileReader::stringResult() |
| 373 { | 373 { |
| 374 if (!m_loader || m_error) | 374 if (!m_loader || m_error) |
| 375 return String(); | 375 return String(); |
| 376 return m_loader->stringResult(); | 376 return m_loader->stringResult(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace WebCore | 379 } // namespace WebCore |
| OLD | NEW |