| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Metadata_h | 31 #ifndef Metadata_h |
| 32 #define Metadata_h | 32 #define Metadata_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "heap/Handle.h" |
| 35 #include "platform/FileMetadata.h" | 36 #include "platform/FileMetadata.h" |
| 36 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 40 class Metadata : public RefCounted<Metadata>, public ScriptWrappable { | 41 class Metadata : public RefCountedWillBeGarbageCollectedFinalized<Metadata>, pub
lic ScriptWrappable { |
| 41 public: | 42 public: |
| 42 static PassRefPtr<Metadata> create(const FileMetadata& platformMetadata) | 43 static PassRefPtrWillBeRawPtr<Metadata> create(const FileMetadata& platformM
etadata) |
| 43 { | 44 { |
| 44 return adoptRef(new Metadata(platformMetadata)); | 45 return adoptRefWillBeNoop(new Metadata(platformMetadata)); |
| 45 } | 46 } |
| 46 | 47 |
| 47 static PassRefPtr<Metadata> create(Metadata* metadata) | 48 static PassRefPtrWillBeRawPtr<Metadata> create(Metadata* metadata) |
| 48 { | 49 { |
| 49 return adoptRef(new Metadata(metadata->m_platformMetadata)); | 50 return adoptRefWillBeNoop(new Metadata(metadata->m_platformMetadata)); |
| 50 } | 51 } |
| 51 | 52 |
| 52 // Needs to return epoch time in milliseconds for Date while FileMetadata's
modificationTime is in seconds. | 53 // Needs to return epoch time in milliseconds for Date while FileMetadata's
modificationTime is in seconds. |
| 53 double modificationTime() const { return m_platformMetadata.modificationTime
* 1000.0; } | 54 double modificationTime() const { return m_platformMetadata.modificationTime
* 1000.0; } |
| 54 unsigned long long size() const { return static_cast<unsigned long long>(m_p
latformMetadata.length); } | 55 unsigned long long size() const { return static_cast<unsigned long long>(m_p
latformMetadata.length); } |
| 55 | 56 |
| 57 void trace(Visitor*) { } |
| 58 |
| 56 private: | 59 private: |
| 57 explicit Metadata(const FileMetadata& platformMetadata) | 60 explicit Metadata(const FileMetadata& platformMetadata) |
| 58 : m_platformMetadata(platformMetadata) | 61 : m_platformMetadata(platformMetadata) |
| 59 { | 62 { |
| 60 ScriptWrappable::init(this); | 63 ScriptWrappable::init(this); |
| 61 } | 64 } |
| 62 | 65 |
| 63 FileMetadata m_platformMetadata; | 66 FileMetadata m_platformMetadata; |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 } // namespace | 69 } // namespace |
| 67 | 70 |
| 68 #endif // Metadata_h | 71 #endif // Metadata_h |
| OLD | NEW |