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 : error_code_(error_code) {} | 183 : error_code_(error_code) {} |
184 | 184 |
185 FileError::ErrorCode& error_code_; | 185 FileError::ErrorCode& error_code_; |
186 }; | 186 }; |
187 | 187 |
188 } // namespace | 188 } // namespace |
189 | 189 |
190 FileWriterSync* DOMFileSystemSync::CreateWriter( | 190 FileWriterSync* DOMFileSystemSync::CreateWriter( |
191 const FileEntrySync* file_entry, | 191 const FileEntrySync* file_entry, |
192 ExceptionState& exception_state) { | 192 ExceptionState& exception_state) { |
193 ASSERT(file_entry); | 193 DCHECK(file_entry); |
194 | 194 |
195 FileWriterSync* file_writer = FileWriterSync::Create(); | 195 FileWriterSync* file_writer = FileWriterSync::Create(); |
196 ReceiveFileWriterCallback* success_callback = | 196 ReceiveFileWriterCallback* success_callback = |
197 ReceiveFileWriterCallback::Create(); | 197 ReceiveFileWriterCallback::Create(); |
198 FileError::ErrorCode error_code = FileError::kOK; | 198 FileError::ErrorCode error_code = FileError::kOK; |
199 LocalErrorCallback* error_callback = LocalErrorCallback::Create(error_code); | 199 LocalErrorCallback* error_callback = LocalErrorCallback::Create(error_code); |
200 | 200 |
201 std::unique_ptr<AsyncFileSystemCallbacks> callbacks = | 201 std::unique_ptr<AsyncFileSystemCallbacks> callbacks = |
202 FileWriterBaseCallbacks::Create(file_writer, success_callback, | 202 FileWriterBaseCallbacks::Create(file_writer, success_callback, |
203 error_callback, context_); | 203 error_callback, context_); |
204 callbacks->SetShouldBlockUntilCompletion(true); | 204 callbacks->SetShouldBlockUntilCompletion(true); |
205 | 205 |
206 FileSystem()->CreateFileWriter(CreateFileSystemURL(file_entry), file_writer, | 206 FileSystem()->CreateFileWriter(CreateFileSystemURL(file_entry), file_writer, |
207 std::move(callbacks)); | 207 std::move(callbacks)); |
208 if (error_code != FileError::kOK) { | 208 if (error_code != FileError::kOK) { |
209 FileError::ThrowDOMException(exception_state, error_code); | 209 FileError::ThrowDOMException(exception_state, error_code); |
210 return 0; | 210 return 0; |
211 } | 211 } |
212 return file_writer; | 212 return file_writer; |
213 } | 213 } |
214 | 214 |
215 DEFINE_TRACE(DOMFileSystemSync) { | 215 DEFINE_TRACE(DOMFileSystemSync) { |
216 DOMFileSystemBase::Trace(visitor); | 216 DOMFileSystemBase::Trace(visitor); |
217 visitor->Trace(root_entry_); | 217 visitor->Trace(root_entry_); |
218 } | 218 } |
219 | 219 |
220 } // namespace blink | 220 } // namespace blink |
OLD | NEW |