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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 void SnapshotFileCallback::didCreateSnapshotFile(const FileMetadata& metadata, P
assRefPtr<BlobDataHandle> snapshot) | 305 void SnapshotFileCallback::didCreateSnapshotFile(const FileMetadata& metadata, P
assRefPtr<BlobDataHandle> snapshot) |
306 { | 306 { |
307 if (!m_successCallback) | 307 if (!m_successCallback) |
308 return; | 308 return; |
309 | 309 |
310 // We can't directly use the snapshot blob data handle because the content t
ype on it hasn't been set. | 310 // We can't directly use the snapshot blob data handle because the content t
ype on it hasn't been set. |
311 // The |snapshot| param is here to provide a a chain of custody thru thread
bridging that is held onto until | 311 // The |snapshot| param is here to provide a a chain of custody thru thread
bridging that is held onto until |
312 // *after* we've coined a File with a new handle that has the correct type s
et on it. This allows the | 312 // *after* we've coined a File with a new handle that has the correct type s
et on it. This allows the |
313 // blob storage system to track when a temp file can and can't be safely del
eted. | 313 // blob storage system to track when a temp file can and can't be safely del
eted. |
314 | 314 |
315 // For regular filesystem types (temporary or persistent), we should not cac
he file metadata as it could change File semantics. | 315 handleEventOrScheduleCallback(m_successCallback.release(), DOMFileSystemBase
::createFile(metadata, m_url, m_fileSystem->type(), m_name)); |
316 // For other filesystem types (which could be platform-specific ones), there
's a chance that the files are on remote filesystem. If the port has returned me
tadata just pass it to File constructor (so we may cache the metadata). | |
317 // FIXME: We should use the snapshot metadata for all files. | |
318 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 | |
319 if (m_fileSystem->type() == FileSystemTypeTemporary || m_fileSystem->type()
== FileSystemTypePersistent) { | |
320 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(metadata.platformPath, m_name)); | |
321 } else if (!metadata.platformPath.isEmpty()) { | |
322 // If the platformPath in the returned metadata is given, we create a Fi
le object for the path. | |
323 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(m_name, metadata)); | |
324 } else { | |
325 // Otherwise create a File from the FileSystem URL. | |
326 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(m_url, metadata)); | |
327 } | |
328 } | 316 } |
329 | 317 |
330 // VoidCallbacks -------------------------------------------------------------- | 318 // VoidCallbacks -------------------------------------------------------------- |
331 | 319 |
332 PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(PassOwnPtrWillBeRawPt
r<VoidCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCall
back, ExecutionContext* context, DOMFileSystemBase* fileSystem) | 320 PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(PassOwnPtrWillBeRawPt
r<VoidCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCall
back, ExecutionContext* context, DOMFileSystemBase* fileSystem) |
333 { | 321 { |
334 return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, f
ileSystem)); | 322 return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, f
ileSystem)); |
335 } | 323 } |
336 | 324 |
337 VoidCallbacks::VoidCallbacks(PassOwnPtrWillBeRawPtr<VoidCallback> successCallbac
k, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCallback, ExecutionContext* contex
t, DOMFileSystemBase* fileSystem) | 325 VoidCallbacks::VoidCallbacks(PassOwnPtrWillBeRawPtr<VoidCallback> successCallbac
k, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCallback, ExecutionContext* contex
t, DOMFileSystemBase* fileSystem) |
338 : FileSystemCallbacksBase(errorCallback, fileSystem, context) | 326 : FileSystemCallbacksBase(errorCallback, fileSystem, context) |
339 , m_successCallback(successCallback) | 327 , m_successCallback(successCallback) |
340 { | 328 { |
341 } | 329 } |
342 | 330 |
343 void VoidCallbacks::didSucceed() | 331 void VoidCallbacks::didSucceed() |
344 { | 332 { |
345 if (m_successCallback) | 333 if (m_successCallback) |
346 handleEventOrScheduleCallback(m_successCallback.release()); | 334 handleEventOrScheduleCallback(m_successCallback.release()); |
347 } | 335 } |
348 | 336 |
349 } // namespace blink | 337 } // namespace blink |
OLD | NEW |