Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: Source/modules/filesystem/DOMFileSystem.h

Issue 397843009: Revert of DevTools: Support async call stacks for FileSystem API (part 1). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 template <typename CB, typename CBArg> 99 template <typename CB, typename CBArg>
100 void scheduleCallback(PassOwnPtr<CB> callback, const CBArg& callbackArg) 100 void scheduleCallback(PassOwnPtr<CB> callback, const CBArg& callbackArg)
101 { 101 {
102 scheduleCallback(executionContext(), callback, callbackArg); 102 scheduleCallback(executionContext(), callback, callbackArg);
103 } 103 }
104 104
105 private: 105 private:
106 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K URL& rootURL); 106 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K URL& rootURL);
107 107
108 class DispatchCallbackTaskBase : public ExecutionContextTask {
109 public:
110 DispatchCallbackTaskBase()
111 : m_taskName("FileSystem")
112 {
113 }
114
115 virtual const String& taskNameForInstrumentation() const OVERRIDE
116 {
117 return m_taskName;
118 }
119
120 private:
121 const String m_taskName;
122 };
123
124 // A helper template to schedule a callback task. 108 // A helper template to schedule a callback task.
125 template <typename CB, typename CBArg> 109 template <typename CB, typename CBArg>
126 class DispatchCallbackRefPtrArgTask FINAL : public DispatchCallbackTaskBase { 110 class DispatchCallbackRefPtrArgTask FINAL : public ExecutionContextTask {
127 public: 111 public:
128 DispatchCallbackRefPtrArgTask(PassOwnPtr<CB> callback, PassRefPtrWillBeR awPtr<CBArg> arg) 112 DispatchCallbackRefPtrArgTask(PassOwnPtr<CB> callback, PassRefPtrWillBeR awPtr<CBArg> arg)
129 : m_callback(callback) 113 : m_callback(callback)
130 , m_callbackArg(arg) 114 , m_callbackArg(arg)
131 { 115 {
132 } 116 }
133 117
134 virtual void performTask(ExecutionContext*) OVERRIDE 118 virtual void performTask(ExecutionContext*) OVERRIDE
135 { 119 {
136 m_callback->handleEvent(m_callbackArg.get()); 120 m_callback->handleEvent(m_callbackArg.get());
137 } 121 }
138 122
139 private: 123 private:
140 OwnPtr<CB> m_callback; 124 OwnPtr<CB> m_callback;
141 RefPtrWillBePersistent<CBArg> m_callbackArg; 125 RefPtrWillBePersistent<CBArg> m_callbackArg;
142 }; 126 };
143 127
144 template <typename CB, typename CBArg> 128 template <typename CB, typename CBArg>
145 class DispatchCallbackPtrArgTask FINAL : public DispatchCallbackTaskBase { 129 class DispatchCallbackPtrArgTask FINAL : public ExecutionContextTask {
146 public: 130 public:
147 DispatchCallbackPtrArgTask(PassOwnPtr<CB> callback, CBArg* arg) 131 DispatchCallbackPtrArgTask(PassOwnPtr<CB> callback, CBArg* arg)
148 : m_callback(callback) 132 : m_callback(callback)
149 , m_callbackArg(arg) 133 , m_callbackArg(arg)
150 { 134 {
151 } 135 }
152 136
153 virtual void performTask(ExecutionContext*) OVERRIDE 137 virtual void performTask(ExecutionContext*) OVERRIDE
154 { 138 {
155 m_callback->handleEvent(m_callbackArg.get()); 139 m_callback->handleEvent(m_callbackArg.get());
156 } 140 }
157 141
158 private: 142 private:
159 OwnPtr<CB> m_callback; 143 OwnPtr<CB> m_callback;
160 Persistent<CBArg> m_callbackArg; 144 Persistent<CBArg> m_callbackArg;
161 }; 145 };
162 146
163 template <typename CB, typename CBArg> 147 template <typename CB, typename CBArg>
164 class DispatchCallbackNonPtrArgTask FINAL : public DispatchCallbackTaskBase { 148 class DispatchCallbackNonPtrArgTask FINAL : public ExecutionContextTask {
165 public: 149 public:
166 DispatchCallbackNonPtrArgTask(PassOwnPtr<CB> callback, const CBArg& arg) 150 DispatchCallbackNonPtrArgTask(PassOwnPtr<CB> callback, const CBArg& arg)
167 : m_callback(callback) 151 : m_callback(callback)
168 , m_callbackArg(arg) 152 , m_callbackArg(arg)
169 { 153 {
170 } 154 }
171 155
172 virtual void performTask(ExecutionContext*) OVERRIDE 156 virtual void performTask(ExecutionContext*) OVERRIDE
173 { 157 {
174 m_callback->handleEvent(m_callbackArg); 158 m_callback->handleEvent(m_callbackArg);
175 } 159 }
176 160
177 private: 161 private:
178 OwnPtr<CB> m_callback; 162 OwnPtr<CB> m_callback;
179 CBArg m_callbackArg; 163 CBArg m_callbackArg;
180 }; 164 };
181 165
182 template <typename CB> 166 template <typename CB>
183 class DispatchCallbackNoArgTask FINAL : public DispatchCallbackTaskBase { 167 class DispatchCallbackNoArgTask FINAL : public ExecutionContextTask {
184 public: 168 public:
185 DispatchCallbackNoArgTask(PassOwnPtr<CB> callback) 169 DispatchCallbackNoArgTask(PassOwnPtr<CB> callback)
186 : m_callback(callback) 170 : m_callback(callback)
187 { 171 {
188 } 172 }
189 173
190 virtual void performTask(ExecutionContext*) OVERRIDE 174 virtual void performTask(ExecutionContext*) OVERRIDE
191 { 175 {
192 m_callback->handleEvent(); 176 m_callback->handleEvent();
193 } 177 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn Ptr<CB> callback) 219 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn Ptr<CB> callback)
236 { 220 {
237 ASSERT(executionContext->isContextThread()); 221 ASSERT(executionContext->isContextThread());
238 if (callback) 222 if (callback)
239 executionContext->postTask(adoptPtr(new DispatchCallbackNoArgTask<CB>(ca llback))); 223 executionContext->postTask(adoptPtr(new DispatchCallbackNoArgTask<CB>(ca llback)));
240 } 224 }
241 225
242 } // namespace 226 } // namespace
243 227
244 #endif // DOMFileSystem_h 228 #endif // DOMFileSystem_h
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInstrumentation.idl ('k') | Source/modules/filesystem/FileSystemCallbacks.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698