| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 FileError::throwDOMException(exceptionState, m_error); | 78 FileError::throwDOMException(exceptionState, m_error); |
| 79 return; | 79 return; |
| 80 } | 80 } |
| 81 if (offset < position()) | 81 if (offset < position()) |
| 82 setPosition(offset); | 82 setPosition(offset); |
| 83 setLength(offset); | 83 setLength(offset); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void FileWriterSync::didWrite(long long bytes, bool complete) | 86 void FileWriterSync::didWrite(long long bytes, bool complete) |
| 87 { | 87 { |
| 88 ASSERT(m_error == FileError::OK); | 88 DCHECK_EQ(FileError::kOK, m_error); |
| 89 ASSERT(!m_complete); | 89 #if DCHECK_IS_ON() |
| 90 #if ENABLE(ASSERT) | 90 DCHECK(!m_complete); |
| 91 m_complete = complete; | 91 m_complete = complete; |
| 92 #else | 92 #else |
| 93 ASSERT_UNUSED(complete, complete); | 93 ASSERT_UNUSED(complete, complete); |
| 94 #endif | 94 #endif |
| 95 } | 95 } |
| 96 | 96 |
| 97 void FileWriterSync::didTruncate() | 97 void FileWriterSync::didTruncate() |
| 98 { | 98 { |
| 99 ASSERT(m_error == FileError::OK); | 99 DCHECK_EQ(FileError::kOK, m_error); |
| 100 ASSERT(!m_complete); | 100 #if DCHECK_IS_ON() |
| 101 #if ENABLE(ASSERT) | 101 DCHECK(!m_complete); |
| 102 m_complete = true; | 102 m_complete = true; |
| 103 #endif | 103 #endif |
| 104 } | 104 } |
| 105 | 105 |
| 106 void FileWriterSync::didFail(WebFileError error) | 106 void FileWriterSync::didFail(WebFileError error) |
| 107 { | 107 { |
| 108 ASSERT(m_error == FileError::OK); | 108 DCHECK_EQ(FileError::kOK, m_error); |
| 109 m_error = static_cast<FileError::ErrorCode>(error); | 109 m_error = static_cast<FileError::ErrorCode>(error); |
| 110 ASSERT(!m_complete); | 110 #if DCHECK_IS_ON() |
| 111 #if ENABLE(ASSERT) | 111 DCHECK(!m_complete); |
| 112 m_complete = true; | 112 m_complete = true; |
| 113 #endif | 113 #endif |
| 114 } | 114 } |
| 115 | 115 |
| 116 FileWriterSync::FileWriterSync() | 116 FileWriterSync::FileWriterSync() |
| 117 : m_error(FileError::OK) | 117 : m_error(FileError::kOK) |
| 118 #if ENABLE(ASSERT) | 118 #if DCHECK_IS_ON() |
| 119 , m_complete(true) | 119 , m_complete(true) |
| 120 #endif | 120 #endif |
| 121 { | 121 { |
| 122 } | 122 } |
| 123 | 123 |
| 124 void FileWriterSync::prepareForWrite() | 124 void FileWriterSync::prepareForWrite() |
| 125 { | 125 { |
| 126 ASSERT(m_complete); | 126 #if DCHECK_IS_ON() |
| 127 m_error = FileError::OK; | 127 DCHECK(m_complete); |
| 128 #if ENABLE(ASSERT) | 128 #endif |
| 129 m_error = FileError::kOK; |
| 130 #if DCHECK_IS_ON() |
| 129 m_complete = false; | 131 m_complete = false; |
| 130 #endif | 132 #endif |
| 131 } | 133 } |
| 132 | 134 |
| 133 FileWriterSync::~FileWriterSync() | 135 FileWriterSync::~FileWriterSync() |
| 134 { | 136 { |
| 135 } | 137 } |
| 136 | 138 |
| 137 DEFINE_TRACE(FileWriterSync) | 139 DEFINE_TRACE(FileWriterSync) |
| 138 { | 140 { |
| 139 FileWriterBase::trace(visitor); | 141 FileWriterBase::trace(visitor); |
| 140 } | 142 } |
| 141 | 143 |
| 142 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |