| 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 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | |
| 33 #include "core/fileapi/FileReader.h" | 32 #include "core/fileapi/FileReader.h" |
| 34 | 33 |
| 35 #include "core/dom/CrossThreadTask.h" | 34 #include "core/dom/CrossThreadTask.h" |
| 36 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/dom/ProgressEvent.h" | 36 #include "core/dom/ProgressEvent.h" |
| 38 #include "core/dom/ScriptExecutionContext.h" | 37 #include "core/dom/ScriptExecutionContext.h" |
| 39 #include "core/fileapi/File.h" | 38 #include "core/fileapi/File.h" |
| 40 #include "core/platform/Logging.h" | 39 #include "core/platform/Logging.h" |
| 41 #include <wtf/ArrayBuffer.h> | 40 #include <wtf/ArrayBuffer.h> |
| 42 #include <wtf/CurrentTime.h> | 41 #include <wtf/CurrentTime.h> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 m_state = DONE; | 234 m_state = DONE; |
| 236 | 235 |
| 237 fireEvent(eventNames().progressEvent); | 236 fireEvent(eventNames().progressEvent); |
| 238 fireEvent(eventNames().loadEvent); | 237 fireEvent(eventNames().loadEvent); |
| 239 fireEvent(eventNames().loadendEvent); | 238 fireEvent(eventNames().loadendEvent); |
| 240 | 239 |
| 241 // All possible events have fired and we're done, no more pending activity. | 240 // All possible events have fired and we're done, no more pending activity. |
| 242 unsetPendingActivity(this); | 241 unsetPendingActivity(this); |
| 243 } | 242 } |
| 244 | 243 |
| 245 void FileReader::didFail(int errorCode) | 244 void FileReader::didFail(FileError::ErrorCode errorCode) |
| 246 { | 245 { |
| 247 // If we're aborting, do not proceed with normal error handling since it is
covered in aborting code. | 246 // If we're aborting, do not proceed with normal error handling since it is
covered in aborting code. |
| 248 if (m_aborting) | 247 if (m_aborting) |
| 249 return; | 248 return; |
| 250 | 249 |
| 251 ASSERT(m_state != DONE); | 250 ASSERT(m_state != DONE); |
| 252 m_state = DONE; | 251 m_state = DONE; |
| 253 | 252 |
| 254 m_error = FileError::create(static_cast<FileError::ErrorCode>(errorCode)); | 253 m_error = FileError::create(static_cast<FileError::ErrorCode>(errorCode)); |
| 255 fireEvent(eventNames().errorEvent); | 254 fireEvent(eventNames().errorEvent); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 272 } | 271 } |
| 273 | 272 |
| 274 String FileReader::stringResult() | 273 String FileReader::stringResult() |
| 275 { | 274 { |
| 276 if (!m_loader || m_error) | 275 if (!m_loader || m_error) |
| 277 return String(); | 276 return String(); |
| 278 return m_loader->stringResult(); | 277 return m_loader->stringResult(); |
| 279 } | 278 } |
| 280 | 279 |
| 281 } // namespace WebCore | 280 } // namespace WebCore |
| OLD | NEW |