OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 fileMetadata.length = webFileInfo.length; | 87 fileMetadata.length = webFileInfo.length; |
88 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); | 88 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); |
89 fileMetadata.platformPath = webFileInfo.platformPath; | 89 fileMetadata.platformPath = webFileInfo.platformPath; |
90 m_private->callbacks()->didReadMetadata(fileMetadata); | 90 m_private->callbacks()->didReadMetadata(fileMetadata); |
91 m_private.reset(); | 91 m_private.reset(); |
92 } | 92 } |
93 | 93 |
94 void WebFileSystemCallbacks::didCreateSnapshotFile( | 94 void WebFileSystemCallbacks::didCreateSnapshotFile( |
95 const WebFileInfo& webFileInfo) { | 95 const WebFileInfo& webFileInfo) { |
96 ASSERT(!m_private.isNull()); | 96 ASSERT(!m_private.isNull()); |
97 // It's important to create a BlobDataHandle that refers to the platform file
path prior | 97 // It's important to create a BlobDataHandle that refers to the platform file |
98 // to return from this method so the underlying file will not be deleted. | 98 // path prior to return from this method so the underlying file will not be |
| 99 // deleted. |
99 std::unique_ptr<BlobData> blobData = BlobData::create(); | 100 std::unique_ptr<BlobData> blobData = BlobData::create(); |
100 blobData->appendFile(webFileInfo.platformPath, 0, webFileInfo.length, | 101 blobData->appendFile(webFileInfo.platformPath, 0, webFileInfo.length, |
101 invalidFileTime()); | 102 invalidFileTime()); |
102 RefPtr<BlobDataHandle> snapshotBlob = | 103 RefPtr<BlobDataHandle> snapshotBlob = |
103 BlobDataHandle::create(std::move(blobData), webFileInfo.length); | 104 BlobDataHandle::create(std::move(blobData), webFileInfo.length); |
104 | 105 |
105 FileMetadata fileMetadata; | 106 FileMetadata fileMetadata; |
106 fileMetadata.modificationTime = webFileInfo.modificationTime; | 107 fileMetadata.modificationTime = webFileInfo.modificationTime; |
107 fileMetadata.length = webFileInfo.length; | 108 fileMetadata.length = webFileInfo.length; |
108 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); | 109 fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 m_private->callbacks()->didFail(error); | 154 m_private->callbacks()->didFail(error); |
154 m_private.reset(); | 155 m_private.reset(); |
155 } | 156 } |
156 | 157 |
157 bool WebFileSystemCallbacks::shouldBlockUntilCompletion() const { | 158 bool WebFileSystemCallbacks::shouldBlockUntilCompletion() const { |
158 ASSERT(!m_private.isNull()); | 159 ASSERT(!m_private.isNull()); |
159 return m_private->callbacks()->shouldBlockUntilCompletion(); | 160 return m_private->callbacks()->shouldBlockUntilCompletion(); |
160 } | 161 } |
161 | 162 |
162 } // namespace blink | 163 } // namespace blink |
OLD | NEW |