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

Unified Diff: Source/bindings/v8/V8AnyCallback.h

Issue 15786003: WIP don't review: Implement Future (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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/bindings/v8/V8AnyCallback.h
diff --git a/Source/bindings/v8/ScriptInstance.h b/Source/bindings/v8/V8AnyCallback.h
similarity index 64%
copy from Source/bindings/v8/ScriptInstance.h
copy to Source/bindings/v8/V8AnyCallback.h
index 25afc379e5cad65d4a822d50105274d9a5df9488..a3a804ca0229945fc73869d66ad4615f979c32e1 100644
--- a/Source/bindings/v8/ScriptInstance.h
+++ b/Source/bindings/v8/V8AnyCallback.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -28,32 +28,41 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScriptInstance_h
-#define ScriptInstance_h
+#ifndef V8AnyCallback_h
+#define V8AnyCallback_h
+#include "bindings/v8/ActiveDOMCallback.h"
+#include "bindings/v8/DOMWrapperWorld.h"
#include "bindings/v8/ScopedPersistent.h"
-#include <v8.h>
+#include "bindings/v8/ScriptValue.h"
+#include "core/dom/AnyCallback.h"
+#include "core/dom/Future.h"
+#include "core/dom/ScriptExecutionContext.h"
+#include "core/platform/Logging.h"
#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
+#include <v8.h>
+
namespace WebCore {
-class V8ScriptInstance : public RefCounted<V8ScriptInstance> {
+class V8AnyCallback : public AnyCallback, public ActiveDOMCallback {
public:
- static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) { return adoptRef(new V8ScriptInstance(instance)); }
+ static PassRefPtr<V8AnyCallback> create(v8::Handle<v8::Function> callback, ScriptExecutionContext* context)
+ {
+ ASSERT(context);
+ return adoptRef(new V8AnyCallback(callback, context));
+ }
- v8::Persistent<v8::Object> instance() { return m_instance.get(); }
+ virtual ScriptValue call(const ScriptValue&, PassRefPtr<Future>, bool*) OVERRIDE;
private:
- explicit V8ScriptInstance(v8::Handle<v8::Object>);
+ V8AnyCallback(v8::Handle<v8::Function>, ScriptExecutionContext*);
- ScopedPersistent<v8::Object> m_instance;
+ ScopedPersistent<v8::Function> m_callback;
+ RefPtr<DOMWrapperWorld> m_world;
};
-typedef RefPtr<V8ScriptInstance> ScriptInstance;
-typedef PassRefPtr<V8ScriptInstance> PassScriptInstance;
-
-} // namespace WebCore
+}
-#endif // ScriptInstance_h
+#endif // V8AnyCallback_h

Powered by Google App Engine
This is Rietveld 408576698