| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 namespace WebCore { | 49 namespace WebCore { |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 // Specialized callback class for createSnapshotFileAndReadMetadata. | 53 // Specialized callback class for createSnapshotFileAndReadMetadata. |
| 54 class SnapshotFileCallbacks : public AsyncFileSystemCallbacks { | 54 class SnapshotFileCallbacks : public AsyncFileSystemCallbacks { |
| 55 public: | 55 public: |
| 56 static PassOwnPtr<SnapshotFileCallbacks> create(const KURL& internalBlobURL,
PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks) | 56 static PassOwnPtr<SnapshotFileCallbacks> create(const KURL& internalBlobURL,
PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks) |
| 57 { | 57 { |
| 58 // TODO: BlobDataHandles, what about the internal url jazz? |
| 58 return adoptPtr(new SnapshotFileCallbacks(internalBlobURL, callbacks)); | 59 return adoptPtr(new SnapshotFileCallbacks(internalBlobURL, callbacks)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 virtual void didReadMetadata(const FileMetadata& metadata) | 62 virtual void didReadMetadata(const FileMetadata& metadata) |
| 62 { | 63 { |
| 63 ASSERT(m_callbacks); | 64 ASSERT(m_callbacks); |
| 64 | 65 |
| 65 // This will create a new File object using the metadata. | 66 // This will create a new File object using the metadata. |
| 66 m_callbacks->didReadMetadata(metadata); | 67 m_callbacks->didReadMetadata(metadata); |
| 67 | 68 |
| 68 // Now that we've registered the snapshot file, we can unregister our in
ternalBlobURL which has played a placeholder for the file during the IPC. | 69 // Now that we've registered the snapshot file, we can unregister our in
ternalBlobURL which has played a placeholder for the file during the IPC. |
| 69 ThreadableBlobRegistry::unregisterBlobURL(m_internalBlobURL); | 70 // TODO: BlobDataHandles |
| 71 // ThreadableBlobRegistry::unregisterBlobURL(m_internalBlobURL); |
| 70 } | 72 } |
| 71 | 73 |
| 72 virtual void didFail(int error) | 74 virtual void didFail(int error) |
| 73 { | 75 { |
| 74 ASSERT(m_callbacks); | 76 ASSERT(m_callbacks); |
| 75 m_callbacks->didFail(error); | 77 m_callbacks->didFail(error); |
| 76 } | 78 } |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 SnapshotFileCallbacks(const KURL& internalBlobURL, PassOwnPtr<WebCore::Async
FileSystemCallbacks> callbacks) | 81 SnapshotFileCallbacks(const KURL& internalBlobURL, PassOwnPtr<WebCore::Async
FileSystemCallbacks> callbacks) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; | 214 OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; |
| 213 }; | 215 }; |
| 214 | 216 |
| 215 void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const
KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) | 217 void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const
KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) |
| 216 { | 218 { |
| 217 m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, pa
th, m_webFileSystem, callbacks)); | 219 m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, pa
th, m_webFileSystem, callbacks)); |
| 218 } | 220 } |
| 219 | 221 |
| 220 void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path
, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) | 222 void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path
, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) |
| 221 { | 223 { |
| 222 KURL internalBlobURL = BlobURL::createInternalURL(); | 224 // TODO: BlobDataHandles and uuids |
| 225 KURL internalBlobURL = KURL(); //BlobURL::createInternalURL(); |
| 223 | 226 |
| 224 // This will create a snapshot file and register the file to a blob using th
e given internalBlobURL. | 227 // This will create a snapshot file and register the file to a blob using th
e given internalBlobURL. |
| 225 m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, ne
w WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL,
callbacks))); | 228 m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, ne
w WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL,
callbacks))); |
| 226 } | 229 } |
| 227 | 230 |
| 228 PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFile
Callback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callb
acks) const | 231 PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFile
Callback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callb
acks) const |
| 229 { | 232 { |
| 230 return SnapshotFileCallbacks::create(internalBlobURL, callbacks); | 233 return SnapshotFileCallbacks::create(internalBlobURL, callbacks); |
| 231 } | 234 } |
| 232 | 235 |
| 233 } // namespace WebCore | 236 } // namespace WebCore |
| 234 | 237 |
| 235 #endif | 238 #endif |
| OLD | NEW |