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 26 matching lines...) Expand all Loading... |
37 #include "modules/filesystem/DirectoryEntrySync.h" | 37 #include "modules/filesystem/DirectoryEntrySync.h" |
38 #include "modules/filesystem/EntriesCallback.h" | 38 #include "modules/filesystem/EntriesCallback.h" |
39 #include "modules/filesystem/EntrySync.h" | 39 #include "modules/filesystem/EntrySync.h" |
40 #include "modules/filesystem/ErrorCallback.h" | 40 #include "modules/filesystem/ErrorCallback.h" |
41 #include "modules/filesystem/FileEntrySync.h" | 41 #include "modules/filesystem/FileEntrySync.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 class DirectoryReaderSync::EntriesCallbackHelper : public EntriesCallback { | 45 class DirectoryReaderSync::EntriesCallbackHelper : public EntriesCallback { |
46 public: | 46 public: |
47 EntriesCallbackHelper(PassRefPtrWillBeRawPtr<DirectoryReaderSync> reader) | 47 explicit EntriesCallbackHelper(DirectoryReaderSync* reader) |
48 : m_reader(reader) | 48 : m_reader(reader) |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 virtual void handleEvent(const EntryHeapVector& entries) OVERRIDE | 52 virtual void handleEvent(const EntryHeapVector& entries) OVERRIDE |
53 { | 53 { |
54 EntrySyncHeapVector syncEntries; | 54 EntrySyncHeapVector syncEntries; |
55 syncEntries.reserveInitialCapacity(entries.size()); | 55 syncEntries.reserveInitialCapacity(entries.size()); |
56 for (size_t i = 0; i < entries.size(); ++i) | 56 for (size_t i = 0; i < entries.size(); ++i) |
57 syncEntries.uncheckedAppend(EntrySync::create(entries[i].get())); | 57 syncEntries.uncheckedAppend(EntrySync::create(entries[i].get())); |
58 m_reader->addEntries(syncEntries); | 58 m_reader->addEntries(syncEntries); |
59 } | 59 } |
60 | 60 |
61 private: | 61 private: |
62 RefPtrWillBePersistent<DirectoryReaderSync> m_reader; | 62 Persistent<DirectoryReaderSync> m_reader; |
63 }; | 63 }; |
64 | 64 |
65 class DirectoryReaderSync::ErrorCallbackHelper : public ErrorCallback { | 65 class DirectoryReaderSync::ErrorCallbackHelper : public ErrorCallback { |
66 public: | 66 public: |
67 ErrorCallbackHelper(PassRefPtrWillBeRawPtr<DirectoryReaderSync> reader) | 67 explicit ErrorCallbackHelper(DirectoryReaderSync* reader) |
68 : m_reader(reader) | 68 : m_reader(reader) |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 virtual void handleEvent(FileError* error) OVERRIDE | 72 virtual void handleEvent(FileError* error) OVERRIDE |
73 { | 73 { |
74 m_reader->setError(error->code()); | 74 m_reader->setError(error->code()); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 RefPtrWillBePersistent<DirectoryReaderSync> m_reader; | 78 Persistent<DirectoryReaderSync> m_reader; |
79 }; | 79 }; |
80 | 80 |
81 DirectoryReaderSync::DirectoryReaderSync(PassRefPtrWillBeRawPtr<DOMFileSystemBas
e> fileSystem, const String& fullPath) | 81 DirectoryReaderSync::DirectoryReaderSync(DOMFileSystemBase* fileSystem, const St
ring& fullPath) |
82 : DirectoryReaderBase(fileSystem, fullPath) | 82 : DirectoryReaderBase(fileSystem, fullPath) |
83 , m_callbacksId(0) | 83 , m_callbacksId(0) |
84 , m_errorCode(FileError::OK) | 84 , m_errorCode(FileError::OK) |
85 { | 85 { |
86 ScriptWrappable::init(this); | 86 ScriptWrappable::init(this); |
87 } | 87 } |
88 | 88 |
89 DirectoryReaderSync::~DirectoryReaderSync() | 89 DirectoryReaderSync::~DirectoryReaderSync() |
90 { | 90 { |
91 } | 91 } |
(...skipping 17 matching lines...) Expand all Loading... |
109 return result; | 109 return result; |
110 } | 110 } |
111 | 111 |
112 void DirectoryReaderSync::trace(Visitor* visitor) | 112 void DirectoryReaderSync::trace(Visitor* visitor) |
113 { | 113 { |
114 visitor->trace(m_entries); | 114 visitor->trace(m_entries); |
115 DirectoryReaderBase::trace(visitor); | 115 DirectoryReaderBase::trace(visitor); |
116 } | 116 } |
117 | 117 |
118 } // namespace | 118 } // namespace |
OLD | NEW |