| 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 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/fileapi/Blob.h" | 37 #include "core/fileapi/Blob.h" |
| 38 #include "public/platform/WebFileWriter.h" | 38 #include "public/platform/WebFileWriter.h" |
| 39 #include "public/platform/WebURL.h" | 39 #include "public/platform/WebURL.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 void FileWriterSync::write(Blob* data, ExceptionState& exceptionState) | 43 void FileWriterSync::write(Blob* data, ExceptionState& exceptionState) |
| 44 { | 44 { |
| 45 ASSERT(data); |
| 45 ASSERT(writer()); | 46 ASSERT(writer()); |
| 46 ASSERT(m_complete); | 47 ASSERT(m_complete); |
| 47 if (!data) { | |
| 48 exceptionState.throwDOMException(TypeMismatchError, FileError::typeMisma
tchErrorMessage); | |
| 49 return; | |
| 50 } | |
| 51 | 48 |
| 52 prepareForWrite(); | 49 prepareForWrite(); |
| 53 writer()->write(position(), data->uuid()); | 50 writer()->write(position(), data->uuid()); |
| 54 ASSERT(m_complete); | 51 ASSERT(m_complete); |
| 55 if (m_error) { | 52 if (m_error) { |
| 56 FileError::throwDOMException(exceptionState, m_error); | 53 FileError::throwDOMException(exceptionState, m_error); |
| 57 return; | 54 return; |
| 58 } | 55 } |
| 59 setPosition(position() + data->size()); | 56 setPosition(position() + data->size()); |
| 60 if (position() > length()) | 57 if (position() > length()) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 FileWriterSync::~FileWriterSync() | 135 FileWriterSync::~FileWriterSync() |
| 139 { | 136 { |
| 140 } | 137 } |
| 141 | 138 |
| 142 DEFINE_TRACE(FileWriterSync) | 139 DEFINE_TRACE(FileWriterSync) |
| 143 { | 140 { |
| 144 FileWriterBase::trace(visitor); | 141 FileWriterBase::trace(visitor); |
| 145 } | 142 } |
| 146 | 143 |
| 147 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |