| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 } // namespace | 164 } // namespace |
| 165 | 165 |
| 166 PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, E
xceptionState& exceptionState) | 166 PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, E
xceptionState& exceptionState) |
| 167 { | 167 { |
| 168 KURL fileSystemURL = createFileSystemURL(fileEntry); | 168 KURL fileSystemURL = createFileSystemURL(fileEntry); |
| 169 RefPtr<CreateFileHelper::CreateFileResult> result(CreateFileHelper::CreateFi
leResult::create()); | 169 RefPtr<CreateFileHelper::CreateFileResult> result(CreateFileHelper::CreateFi
leResult::create()); |
| 170 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, CreateFileHel
per::create(result, fileEntry->name(), fileSystemURL, type())); | 170 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, CreateFileHel
per::create(result, fileEntry->name(), fileSystemURL, type())); |
| 171 if (result->m_failed) { | 171 if (result->m_failed) { |
| 172 exceptionState.throwDOMException(result->m_code, "Could not create '" +
fileEntry->name() + "'."); | 172 exceptionState.throwDOMException(result->m_code, "Could not create '" +
fileEntry->name() + "'."); |
| 173 return 0; | 173 return nullptr; |
| 174 } | 174 } |
| 175 return result->m_file; | 175 return result->m_file; |
| 176 } | 176 } |
| 177 | 177 |
| 178 namespace { | 178 namespace { |
| 179 | 179 |
| 180 class ReceiveFileWriterCallback FINAL : public FileWriterBaseCallback { | 180 class ReceiveFileWriterCallback FINAL : public FileWriterBaseCallback { |
| 181 public: | 181 public: |
| 182 static PassOwnPtr<ReceiveFileWriterCallback> create() | 182 static PassOwnPtr<ReceiveFileWriterCallback> create() |
| 183 { | 183 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 OwnPtr<ReceiveFileWriterCallback> successCallback = ReceiveFileWriterCallbac
k::create(); | 226 OwnPtr<ReceiveFileWriterCallback> successCallback = ReceiveFileWriterCallbac
k::create(); |
| 227 FileError::ErrorCode errorCode = FileError::OK; | 227 FileError::ErrorCode errorCode = FileError::OK; |
| 228 OwnPtr<LocalErrorCallback> errorCallback = LocalErrorCallback::create(errorC
ode); | 228 OwnPtr<LocalErrorCallback> errorCallback = LocalErrorCallback::create(errorC
ode); |
| 229 | 229 |
| 230 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create
(fileWriter, successCallback.release(), errorCallback.release()); | 230 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create
(fileWriter, successCallback.release(), errorCallback.release()); |
| 231 callbacks->setShouldBlockUntilCompletion(true); | 231 callbacks->setShouldBlockUntilCompletion(true); |
| 232 | 232 |
| 233 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter.ge
t(), callbacks.release()); | 233 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter.ge
t(), callbacks.release()); |
| 234 if (errorCode != FileError::OK) { | 234 if (errorCode != FileError::OK) { |
| 235 FileError::throwDOMException(exceptionState, errorCode); | 235 FileError::throwDOMException(exceptionState, errorCode); |
| 236 return 0; | 236 return nullptr; |
| 237 } | 237 } |
| 238 return fileWriter.release(); | 238 return fileWriter.release(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } | 241 } |
| OLD | NEW |