| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 virtual void didFail(int code) | 106 virtual void didFail(int code) |
| 107 { | 107 { |
| 108 m_result->m_failed = true; | 108 m_result->m_failed = true; |
| 109 m_result->m_code = code; | 109 m_result->m_code = code; |
| 110 } | 110 } |
| 111 | 111 |
| 112 virtual ~CreateFileHelper() | 112 virtual ~CreateFileHelper() |
| 113 { | 113 { |
| 114 } | 114 } |
| 115 | 115 |
| 116 void didReadMetadata(const FileMetadata& metadata) | 116 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<
BlobDataHandle> snapshot) |
| 117 { | 117 { |
| 118 // We can't directly use the snapshot blob data handle because the conte
nt type on it hasn't been set. |
| 119 // The |snapshot| param is here to provide a a chain of custody thru thr
ead bridging that is held onto until |
| 120 // *after* we've coined a File with a new handle that has the correct ty
pe set on it. This allows the |
| 121 // blob storage system to track when a temp file can and can't be safely
deleted. |
| 122 |
| 118 // For regular filesystem types (temporary or persistent), we should not
cache file metadata as it could change File semantics. | 123 // For regular filesystem types (temporary or persistent), we should not
cache file metadata as it could change File semantics. |
| 119 // For other filesystem types (which could be platform-specific ones), t
here's a chance that the files are on remote filesystem. If the port has returne
d metadata just pass it to File constructor (so we may cache the metadata). | 124 // For other filesystem types (which could be platform-specific ones), t
here's a chance that the files are on remote filesystem. |
| 125 // If the port has returned metadata just pass it to File constructor (s
o we may cache the metadata). |
| 120 // FIXME: We should use the snapshot metadata for all files. | 126 // FIXME: We should use the snapshot metadata for all files. |
| 121 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 | 127 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 |
| 122 if (m_type == FileSystemTypeTemporary || m_type == FileSystemTypePersist
ent) { | 128 if (m_type == FileSystemTypeTemporary || m_type == FileSystemTypePersist
ent) { |
| 123 m_result->m_file = File::createWithName(metadata.platformPath, m_nam
e); | 129 m_result->m_file = File::createWithName(metadata.platformPath, m_nam
e); |
| 124 } else if (!metadata.platformPath.isEmpty()) { | 130 } else if (!metadata.platformPath.isEmpty()) { |
| 125 // If the platformPath in the returned metadata is given, we create
a File object for the path. | 131 // If the platformPath in the returned metadata is given, we create
a File object for the path. |
| 126 m_result->m_file = File::createForFileSystemFile(m_name, metadata).g
et(); | 132 m_result->m_file = File::createForFileSystemFile(m_name, metadata).g
et(); |
| 127 } else { | 133 } else { |
| 128 // Otherwise create a File from the FileSystem URL. | 134 // Otherwise create a File from the FileSystem URL. |
| 129 m_result->m_file = File::createForFileSystemFile(m_url, metadata).ge
t(); | 135 m_result->m_file = File::createForFileSystemFile(m_url, metadata).ge
t(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 return 0; | 257 return 0; |
| 252 } | 258 } |
| 253 ASSERT(successCallback->fileWriterBase()); | 259 ASSERT(successCallback->fileWriterBase()); |
| 254 ASSERT(static_cast<FileWriterSync*>(successCallback->fileWriterBase()) == fi
leWriter.get()); | 260 ASSERT(static_cast<FileWriterSync*>(successCallback->fileWriterBase()) == fi
leWriter.get()); |
| 255 return fileWriter; | 261 return fileWriter; |
| 256 } | 262 } |
| 257 | 263 |
| 258 } | 264 } |
| 259 | 265 |
| 260 #endif // ENABLE(FILE_SYSTEM) | 266 #endif // ENABLE(FILE_SYSTEM) |
| OLD | NEW |