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

Unified Diff: Source/core/dom/Promise.js

Issue 17035004: [ABANDONED] Introduce Promise example implementation written in JavaScript. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Promise.js
diff --git a/Source/core/platform/Task.h b/Source/core/dom/Promise.js
similarity index 80%
copy from Source/core/platform/Task.h
copy to Source/core/dom/Promise.js
index b9d2e46802aebf6391df4ec3dabb580d43b2483c..26562d4298b2f85b6650de9dc4d2490f2665e798 100644
--- a/Source/core/platform/Task.h
+++ b/Source/core/dom/Promise.js
@@ -28,30 +28,27 @@
* 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;
-};
-
-} // namespace WebCore
+ function $Promise(value)
abarth-chromium 2013/06/17 18:05:06 Why $Promise? Should we just call this function P
yhirano 2013/06/18 08:56:15 In fear of confusing with window.Promise. We use w
+ {
+ this.value = value;
abarth-chromium 2013/06/17 18:05:06 I don't see a "value" property on Promise instance
yhirano 2013/06/18 08:56:15 As noted above, this is a mere example.
+ }
-#endif // Task_h
+ $Promise.prototype = {
+ get: get
+ };
+ $Promise.getStatic = getStatic;
+ return $Promise;
+});

Powered by Google App Engine
This is Rietveld 408576698