| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 m_readyState = DONE; | 88 m_readyState = DONE; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool FileWriter::hasPendingActivity() const | 91 bool FileWriter::hasPendingActivity() const |
| 92 { | 92 { |
| 93 return m_operationInProgress != OperationNone || m_queuedOperation != Operat
ionNone || m_readyState == WRITING; | 93 return m_operationInProgress != OperationNone || m_queuedOperation != Operat
ionNone || m_readyState == WRITING; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void FileWriter::write(Blob* data, ExceptionState& exceptionState) | 96 void FileWriter::write(Blob* data, ExceptionState& exceptionState) |
| 97 { | 97 { |
| 98 ASSERT(data); |
| 98 ASSERT(writer()); | 99 ASSERT(writer()); |
| 99 ASSERT(m_truncateLength == -1); | 100 ASSERT(m_truncateLength == -1); |
| 100 if (m_readyState == WRITING) { | 101 if (m_readyState == WRITING) { |
| 101 setError(FileError::INVALID_STATE_ERR, exceptionState); | 102 setError(FileError::INVALID_STATE_ERR, exceptionState); |
| 102 return; | 103 return; |
| 103 } | 104 } |
| 104 if (!data) { | |
| 105 setError(FileError::TYPE_MISMATCH_ERR, exceptionState); | |
| 106 return; | |
| 107 } | |
| 108 if (m_recursionDepth > kMaxRecursionDepth) { | 105 if (m_recursionDepth > kMaxRecursionDepth) { |
| 109 setError(FileError::SECURITY_ERR, exceptionState); | 106 setError(FileError::SECURITY_ERR, exceptionState); |
| 110 return; | 107 return; |
| 111 } | 108 } |
| 112 | 109 |
| 113 m_blobBeingWritten = data; | 110 m_blobBeingWritten = data; |
| 114 m_readyState = WRITING; | 111 m_readyState = WRITING; |
| 115 m_bytesWritten = 0; | 112 m_bytesWritten = 0; |
| 116 m_bytesToWrite = data->size(); | 113 m_bytesToWrite = data->size(); |
| 117 ASSERT(m_queuedOperation == OperationNone); | 114 ASSERT(m_queuedOperation == OperationNone); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 DEFINE_TRACE(FileWriter) | 323 DEFINE_TRACE(FileWriter) |
| 327 { | 324 { |
| 328 visitor->trace(m_error); | 325 visitor->trace(m_error); |
| 329 visitor->trace(m_blobBeingWritten); | 326 visitor->trace(m_blobBeingWritten); |
| 330 EventTargetWithInlineData::trace(visitor); | 327 EventTargetWithInlineData::trace(visitor); |
| 331 FileWriterBase::trace(visitor); | 328 FileWriterBase::trace(visitor); |
| 332 ActiveDOMObject::trace(visitor); | 329 ActiveDOMObject::trace(visitor); |
| 333 } | 330 } |
| 334 | 331 |
| 335 } // namespace blink | 332 } // namespace blink |
| OLD | NEW |