Index: Source/core/dom/Promise.js |
diff --git a/Source/core/platform/Task.h b/Source/core/dom/Promise.js |
similarity index 74% |
copy from Source/core/platform/Task.h |
copy to Source/core/dom/Promise.js |
index b9d2e46802aebf6391df4ec3dabb580d43b2483c..2d8a74e38bf4ec45c3c0b68b7187f7bccbb25c5d 100644 |
--- a/Source/core/platform/Task.h |
+++ b/Source/core/dom/Promise.js |
@@ -28,30 +28,34 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef Task_h |
-#define Task_h |
- |
-#include "wtf/Functional.h" |
-#include "public/platform/WebThread.h" |
- |
-namespace WebCore { |
- |
-class Task : public WebKit::WebThread::Task { |
-public: |
- explicit Task(const Closure& closure) |
- : m_closure(closure) |
+(function() { |
+ function get(value) |
{ |
+ var old = this.value; |
+ this.value = value; |
+ return old; |
} |
- virtual void run() OVERRIDE |
+ function getStatic(value) |
{ |
- m_closure(); |
+ return new Promise(value); |
} |
-private: |
- Closure m_closure; |
-}; |
+ function concat(a, b) |
+ { |
+ // We must not use the method of |a|, since its prototype object can be modified. |
+ return [].concat(a, b); |
+ } |
-} // namespace WebCore |
+ function $Promise(value) |
+ { |
+ this.value = value; |
+ } |
-#endif // Task_h |
+ $Promise.prototype = { |
+ get: get |
+ }; |
+ $Promise.getStatic = getStatic; |
+ $Promise.concat = concat; |
+ return $Promise; |
+}); |