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 28 matching lines...) Expand all Loading... |
39 #include "modules/filesystem/EntriesCallback.h" | 39 #include "modules/filesystem/EntriesCallback.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 class DirectoryEntry; | 43 class DirectoryEntry; |
44 class File; | 44 class File; |
45 class FileCallback; | 45 class FileCallback; |
46 class FileEntry; | 46 class FileEntry; |
47 class FileWriterCallback; | 47 class FileWriterCallback; |
48 | 48 |
49 class DOMFileSystem : public DOMFileSystemBase, public ScriptWrappable, public A
ctiveDOMObject { | 49 class DOMFileSystem FINAL : public DOMFileSystemBase, public ScriptWrappable, pu
blic ActiveDOMObject { |
50 public: | 50 public: |
51 static PassRefPtr<DOMFileSystem> create(ExecutionContext*, const String& nam
e, FileSystemType, const KURL& rootURL); | 51 static PassRefPtr<DOMFileSystem> create(ExecutionContext*, const String& nam
e, FileSystemType, const KURL& rootURL); |
52 | 52 |
53 // Creates a new isolated file system for the given filesystemId. | 53 // Creates a new isolated file system for the given filesystemId. |
54 static PassRefPtr<DOMFileSystem> createIsolatedFileSystem(ExecutionContext*,
const String& filesystemId); | 54 static PassRefPtr<DOMFileSystem> createIsolatedFileSystem(ExecutionContext*,
const String& filesystemId); |
55 | 55 |
56 PassRefPtr<DirectoryEntry> root(); | 56 PassRefPtr<DirectoryEntry> root(); |
57 | 57 |
58 // DOMFileSystemBase overrides. | 58 // DOMFileSystemBase overrides. |
59 virtual void addPendingCallbacks() OVERRIDE; | 59 virtual void addPendingCallbacks() OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
81 void scheduleCallback(PassOwnPtr<CB> callback, const CBArg& callbackArg) | 81 void scheduleCallback(PassOwnPtr<CB> callback, const CBArg& callbackArg) |
82 { | 82 { |
83 scheduleCallback(executionContext(), callback, callbackArg); | 83 scheduleCallback(executionContext(), callback, callbackArg); |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K
URL& rootURL); | 87 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K
URL& rootURL); |
88 | 88 |
89 // A helper template to schedule a callback task. | 89 // A helper template to schedule a callback task. |
90 template <typename CB, typename CBArg> | 90 template <typename CB, typename CBArg> |
91 class DispatchCallbacRefPtrArgTask : public ExecutionContextTask { | 91 class DispatchCallbacRefPtrArgTask FINAL : public ExecutionContextTask { |
92 public: | 92 public: |
93 DispatchCallbacRefPtrArgTask(PassOwnPtr<CB> callback, PassRefPtr<CBArg>
arg) | 93 DispatchCallbacRefPtrArgTask(PassOwnPtr<CB> callback, PassRefPtr<CBArg>
arg) |
94 : m_callback(callback) | 94 : m_callback(callback) |
95 , m_callbackArg(arg) | 95 , m_callbackArg(arg) |
96 { | 96 { |
97 } | 97 } |
98 | 98 |
99 virtual void performTask(ExecutionContext*) | 99 virtual void performTask(ExecutionContext*) OVERRIDE |
100 { | 100 { |
101 m_callback->handleEvent(m_callbackArg.get()); | 101 m_callback->handleEvent(m_callbackArg.get()); |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 OwnPtr<CB> m_callback; | 105 OwnPtr<CB> m_callback; |
106 RefPtr<CBArg> m_callbackArg; | 106 RefPtr<CBArg> m_callbackArg; |
107 }; | 107 }; |
108 | 108 |
109 template <typename CB, typename CBArg> | 109 template <typename CB, typename CBArg> |
110 class DispatchCallbackNonPtrArgTask : public ExecutionContextTask { | 110 class DispatchCallbackNonPtrArgTask FINAL : public ExecutionContextTask { |
111 public: | 111 public: |
112 DispatchCallbackNonPtrArgTask(PassOwnPtr<CB> callback, const CBArg& arg) | 112 DispatchCallbackNonPtrArgTask(PassOwnPtr<CB> callback, const CBArg& arg) |
113 : m_callback(callback) | 113 : m_callback(callback) |
114 , m_callbackArg(arg) | 114 , m_callbackArg(arg) |
115 { | 115 { |
116 } | 116 } |
117 | 117 |
118 virtual void performTask(ExecutionContext*) | 118 virtual void performTask(ExecutionContext*) OVERRIDE |
119 { | 119 { |
120 m_callback->handleEvent(m_callbackArg); | 120 m_callback->handleEvent(m_callbackArg); |
121 } | 121 } |
122 | 122 |
123 private: | 123 private: |
124 OwnPtr<CB> m_callback; | 124 OwnPtr<CB> m_callback; |
125 CBArg m_callbackArg; | 125 CBArg m_callbackArg; |
126 }; | 126 }; |
127 }; | 127 }; |
128 | 128 |
129 template <typename CB, typename CBArg> | 129 template <typename CB, typename CBArg> |
130 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, PassRefPtr<CBArg> arg) | 130 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, PassRefPtr<CBArg> arg) |
131 { | 131 { |
132 ASSERT(executionContext->isContextThread()); | 132 ASSERT(executionContext->isContextThread()); |
133 if (callback) | 133 if (callback) |
134 executionContext->postTask(adoptPtr(new DispatchCallbacRefPtrArgTask<CB,
CBArg>(callback, arg))); | 134 executionContext->postTask(adoptPtr(new DispatchCallbacRefPtrArgTask<CB,
CBArg>(callback, arg))); |
135 } | 135 } |
136 | 136 |
137 template <typename CB, typename CBArg> | 137 template <typename CB, typename CBArg> |
138 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, const CBArg& arg) | 138 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, const CBArg& arg) |
139 { | 139 { |
140 ASSERT(executionContext->isContextThread()); | 140 ASSERT(executionContext->isContextThread()); |
141 if (callback) | 141 if (callback) |
142 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB
, CBArg>(callback, arg))); | 142 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB
, CBArg>(callback, arg))); |
143 } | 143 } |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 #endif // DOMFileSystem_h | 147 #endif // DOMFileSystem_h |
OLD | NEW |