| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 { | 117 { |
| 118 } | 118 } |
| 119 | 119 |
| 120 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<
BlobDataHandle> snapshot) OVERRIDE | 120 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<
BlobDataHandle> snapshot) OVERRIDE |
| 121 { | 121 { |
| 122 // We can't directly use the snapshot blob data handle because the conte
nt type on it hasn't been set. | 122 // We can't directly use the snapshot blob data handle because the conte
nt type on it hasn't been set. |
| 123 // The |snapshot| param is here to provide a a chain of custody thru thr
ead bridging that is held onto until | 123 // The |snapshot| param is here to provide a a chain of custody thru thr
ead bridging that is held onto until |
| 124 // *after* we've coined a File with a new handle that has the correct ty
pe set on it. This allows the | 124 // *after* we've coined a File with a new handle that has the correct ty
pe set on it. This allows the |
| 125 // blob storage system to track when a temp file can and can't be safely
deleted. | 125 // blob storage system to track when a temp file can and can't be safely
deleted. |
| 126 | 126 |
| 127 // For regular filesystem types (temporary or persistent), we should not
cache file metadata as it could change File semantics. | 127 m_result->m_file = DOMFileSystemBase::createFile(metadata, m_url, m_type
, m_name); |
| 128 // For other filesystem types (which could be platform-specific ones), t
here's a chance that the files are on remote filesystem. | |
| 129 // If the port has returned metadata just pass it to File constructor (s
o we may cache the metadata). | |
| 130 // FIXME: We should use the snapshot metadata for all files. | |
| 131 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 | |
| 132 if (m_type == FileSystemTypeTemporary || m_type == FileSystemTypePersist
ent) { | |
| 133 m_result->m_file = File::createForFileSystemFile(metadata.platformPa
th, m_name); | |
| 134 } else if (!metadata.platformPath.isEmpty()) { | |
| 135 // If the platformPath in the returned metadata is given, we create
a File object for the path. | |
| 136 m_result->m_file = File::createForFileSystemFile(m_name, metadata).g
et(); | |
| 137 } else { | |
| 138 // Otherwise create a File from the FileSystem URL. | |
| 139 m_result->m_file = File::createForFileSystemFile(m_url, metadata).ge
t(); | |
| 140 } | |
| 141 } | 128 } |
| 142 | 129 |
| 143 virtual bool shouldBlockUntilCompletion() const OVERRIDE | 130 virtual bool shouldBlockUntilCompletion() const OVERRIDE |
| 144 { | 131 { |
| 145 return true; | 132 return true; |
| 146 } | 133 } |
| 147 | 134 |
| 148 private: | 135 private: |
| 149 CreateFileHelper(CreateFileResult* result, const String& name, const KURL& u
rl, FileSystemType type) | 136 CreateFileHelper(CreateFileResult* result, const String& name, const KURL& u
rl, FileSystemType type) |
| 150 : m_result(result) | 137 : m_result(result) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 218 |
| 232 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c
allbacks.release()); | 219 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c
allbacks.release()); |
| 233 if (errorCode != FileError::OK) { | 220 if (errorCode != FileError::OK) { |
| 234 FileError::throwDOMException(exceptionState, errorCode); | 221 FileError::throwDOMException(exceptionState, errorCode); |
| 235 return 0; | 222 return 0; |
| 236 } | 223 } |
| 237 return fileWriter; | 224 return fileWriter; |
| 238 } | 225 } |
| 239 | 226 |
| 240 } | 227 } |
| OLD | NEW |