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 16 matching lines...) Expand all Loading... |
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 "platform/FileMetadata.h" | 35 #include "platform/FileMetadata.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "wtf/RefCounted.h" | |
38 | 37 |
39 namespace WebCore { | 38 namespace WebCore { |
40 | 39 |
41 class Metadata : public RefCountedWillBeGarbageCollectedFinalized<Metadata>, pub
lic ScriptWrappable { | 40 class Metadata : public GarbageCollectedFinalized<Metadata>, public ScriptWrappa
ble { |
42 public: | 41 public: |
43 static PassRefPtrWillBeRawPtr<Metadata> create(const FileMetadata& platformM
etadata) | 42 static Metadata* create(const FileMetadata& platformMetadata) |
44 { | 43 { |
45 return adoptRefWillBeNoop(new Metadata(platformMetadata)); | 44 return new Metadata(platformMetadata); |
46 } | 45 } |
47 | 46 |
48 static PassRefPtrWillBeRawPtr<Metadata> create(Metadata* metadata) | 47 static Metadata* create(Metadata* metadata) |
49 { | 48 { |
50 return adoptRefWillBeNoop(new Metadata(metadata->m_platformMetadata)); | 49 return new Metadata(metadata->m_platformMetadata); |
51 } | 50 } |
52 | 51 |
53 // Needs to return epoch time in milliseconds for Date while FileMetadata's
modificationTime is in seconds. | 52 // Needs to return epoch time in milliseconds for Date while FileMetadata's
modificationTime is in seconds. |
54 double modificationTime() const { return m_platformMetadata.modificationTime
* 1000.0; } | 53 double modificationTime() const { return m_platformMetadata.modificationTime
* 1000.0; } |
55 unsigned long long size() const { return static_cast<unsigned long long>(m_p
latformMetadata.length); } | 54 unsigned long long size() const { return static_cast<unsigned long long>(m_p
latformMetadata.length); } |
56 | 55 |
57 void trace(Visitor*) { } | 56 void trace(Visitor*) { } |
58 | 57 |
59 private: | 58 private: |
60 explicit Metadata(const FileMetadata& platformMetadata) | 59 explicit Metadata(const FileMetadata& platformMetadata) |
61 : m_platformMetadata(platformMetadata) | 60 : m_platformMetadata(platformMetadata) |
62 { | 61 { |
63 ScriptWrappable::init(this); | 62 ScriptWrappable::init(this); |
64 } | 63 } |
65 | 64 |
66 FileMetadata m_platformMetadata; | 65 FileMetadata m_platformMetadata; |
67 }; | 66 }; |
68 | 67 |
69 } // namespace | 68 } // namespace |
70 | 69 |
71 #endif // Metadata_h | 70 #endif // Metadata_h |
OLD | NEW |