| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // We can't directly use the snapshot blob data handle because the content t
ype on it hasn't been set. | 286 // We can't directly use the snapshot blob data handle because the content t
ype on it hasn't been set. |
| 287 // The |snapshot| param is here to provide a a chain of custody thru thread
bridging that is held onto until | 287 // The |snapshot| param is here to provide a a chain of custody thru thread
bridging that is held onto until |
| 288 // *after* we've coined a File with a new handle that has the correct type s
et on it. This allows the | 288 // *after* we've coined a File with a new handle that has the correct type s
et on it. This allows the |
| 289 // blob storage system to track when a temp file can and can't be safely del
eted. | 289 // blob storage system to track when a temp file can and can't be safely del
eted. |
| 290 | 290 |
| 291 // For regular filesystem types (temporary or persistent), we should not cac
he file metadata as it could change File semantics. | 291 // For regular filesystem types (temporary or persistent), we should not cac
he file metadata as it could change File semantics. |
| 292 // 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). | 292 // 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). |
| 293 // FIXME: We should use the snapshot metadata for all files. | 293 // FIXME: We should use the snapshot metadata for all files. |
| 294 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 | 294 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 |
| 295 if (m_fileSystem->type() == FileSystemTypeTemporary || m_fileSystem->type()
== FileSystemTypePersistent) { | 295 if (m_fileSystem->type() == FileSystemTypeTemporary || m_fileSystem->type()
== FileSystemTypePersistent) { |
| 296 handleEventOrScheduleCallback(m_successCallback.release(), File::createW
ithName(metadata.platformPath, m_name)); | 296 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(metadata.platformPath, m_name)); |
| 297 } else if (!metadata.platformPath.isEmpty()) { | 297 } else if (!metadata.platformPath.isEmpty()) { |
| 298 // If the platformPath in the returned metadata is given, we create a Fi
le object for the path. | 298 // If the platformPath in the returned metadata is given, we create a Fi
le object for the path. |
| 299 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(m_name, metadata)); | 299 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(m_name, metadata)); |
| 300 } else { | 300 } else { |
| 301 // Otherwise create a File from the FileSystem URL. | 301 // Otherwise create a File from the FileSystem URL. |
| 302 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(m_url, metadata)); | 302 handleEventOrScheduleCallback(m_successCallback.release(), File::createF
orFileSystemFile(m_url, metadata)); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 // VoidCallbacks -------------------------------------------------------------- | 306 // VoidCallbacks -------------------------------------------------------------- |
| 307 | 307 |
| 308 PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(PassOwnPtr<VoidCallba
ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback, ExecutionContext*
context, DOMFileSystemBase* fileSystem) | 308 PassOwnPtr<AsyncFileSystemCallbacks> VoidCallbacks::create(PassOwnPtr<VoidCallba
ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback, ExecutionContext*
context, DOMFileSystemBase* fileSystem) |
| 309 { | 309 { |
| 310 return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, f
ileSystem)); | 310 return adoptPtr(new VoidCallbacks(successCallback, errorCallback, context, f
ileSystem)); |
| 311 } | 311 } |
| 312 | 312 |
| 313 VoidCallbacks::VoidCallbacks(PassOwnPtr<VoidCallback> successCallback, PassOwnPt
r<ErrorCallback> errorCallback, ExecutionContext* context, DOMFileSystemBase* fi
leSystem) | 313 VoidCallbacks::VoidCallbacks(PassOwnPtr<VoidCallback> successCallback, PassOwnPt
r<ErrorCallback> errorCallback, ExecutionContext* context, DOMFileSystemBase* fi
leSystem) |
| 314 : FileSystemCallbacksBase(errorCallback, fileSystem, context) | 314 : FileSystemCallbacksBase(errorCallback, fileSystem, context) |
| 315 , m_successCallback(successCallback) | 315 , m_successCallback(successCallback) |
| 316 { | 316 { |
| 317 } | 317 } |
| 318 | 318 |
| 319 void VoidCallbacks::didSucceed() | 319 void VoidCallbacks::didSucceed() |
| 320 { | 320 { |
| 321 if (m_successCallback) | 321 if (m_successCallback) |
| 322 handleEventOrScheduleCallback(m_successCallback.release()); | 322 handleEventOrScheduleCallback(m_successCallback.release()); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace | 325 } // namespace |
| OLD | NEW |