| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 class LocalErrorCallback final : public ErrorCallbackBase { | 184 class LocalErrorCallback final : public ErrorCallbackBase { |
| 185 public: | 185 public: |
| 186 static LocalErrorCallback* create(FileError::ErrorCode& errorCode) | 186 static LocalErrorCallback* create(FileError::ErrorCode& errorCode) |
| 187 { | 187 { |
| 188 return new LocalErrorCallback(errorCode); | 188 return new LocalErrorCallback(errorCode); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void invoke(FileError::ErrorCode error) override | 191 void invoke(FileError::ErrorCode error) override |
| 192 { | 192 { |
| 193 DCHECK_NE(error, FileError::OK); | 193 DCHECK_NE(error, FileError::kOK); |
| 194 m_errorCode = error; | 194 m_errorCode = error; |
| 195 } | 195 } |
| 196 | 196 |
| 197 private: | 197 private: |
| 198 explicit LocalErrorCallback(FileError::ErrorCode& errorCode) | 198 explicit LocalErrorCallback(FileError::ErrorCode& errorCode) |
| 199 : m_errorCode(errorCode) | 199 : m_errorCode(errorCode) |
| 200 { | 200 { |
| 201 } | 201 } |
| 202 | 202 |
| 203 FileError::ErrorCode& m_errorCode; | 203 FileError::ErrorCode& m_errorCode; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 } // namespace | 206 } // namespace |
| 207 | 207 |
| 208 FileWriterSync* DOMFileSystemSync::createWriter(const FileEntrySync* fileEntry,
ExceptionState& exceptionState) | 208 FileWriterSync* DOMFileSystemSync::createWriter(const FileEntrySync* fileEntry,
ExceptionState& exceptionState) |
| 209 { | 209 { |
| 210 ASSERT(fileEntry); | 210 ASSERT(fileEntry); |
| 211 | 211 |
| 212 FileWriterSync* fileWriter = FileWriterSync::create(); | 212 FileWriterSync* fileWriter = FileWriterSync::create(); |
| 213 ReceiveFileWriterCallback* successCallback = ReceiveFileWriterCallback::crea
te(); | 213 ReceiveFileWriterCallback* successCallback = ReceiveFileWriterCallback::crea
te(); |
| 214 FileError::ErrorCode errorCode = FileError::OK; | 214 FileError::ErrorCode errorCode = FileError::kOK; |
| 215 LocalErrorCallback* errorCallback = LocalErrorCallback::create(errorCode); | 215 LocalErrorCallback* errorCallback = LocalErrorCallback::create(errorCode); |
| 216 | 216 |
| 217 std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallback
s::create(fileWriter, successCallback, errorCallback, m_context); | 217 std::unique_ptr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallback
s::create(fileWriter, successCallback, errorCallback, m_context); |
| 218 callbacks->setShouldBlockUntilCompletion(true); | 218 callbacks->setShouldBlockUntilCompletion(true); |
| 219 | 219 |
| 220 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, s
td::move(callbacks)); | 220 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, s
td::move(callbacks)); |
| 221 if (errorCode != FileError::OK) { | 221 if (errorCode != FileError::kOK) { |
| 222 FileError::throwDOMException(exceptionState, errorCode); | 222 FileError::throwDOMException(exceptionState, errorCode); |
| 223 return 0; | 223 return 0; |
| 224 } | 224 } |
| 225 return fileWriter; | 225 return fileWriter; |
| 226 } | 226 } |
| 227 | 227 |
| 228 DEFINE_TRACE(DOMFileSystemSync) | 228 DEFINE_TRACE(DOMFileSystemSync) |
| 229 { | 229 { |
| 230 DOMFileSystemBase::trace(visitor); | 230 DOMFileSystemBase::trace(visitor); |
| 231 visitor->trace(m_rootEntry); | 231 visitor->trace(m_rootEntry); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace blink | 234 } // namespace blink |
| OLD | NEW |