Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / serviceworkers / RespondWithObserver.h
index 7a3d22c..372a97b 100644 (file)
@@ -6,21 +6,23 @@
 #define RespondWithObserver_h
 
 #include "core/dom/ContextLifecycleObserver.h"
+#include "platform/heap/Handle.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
 
-namespace WebCore {
+namespace blink {
 
+class ExceptionState;
 class ExecutionContext;
 class Response;
+class ScriptState;
 class ScriptValue;
 
 // This class observes the service worker's handling of a FetchEvent and
 // notifies the client.
-class RespondWithObserver FINAL : public ContextLifecycleObserver, public RefCounted<RespondWithObserver> {
+class RespondWithObserver FINAL : public GarbageCollectedFinalized<RespondWithObserver>, public ContextLifecycleObserver {
 public:
-    static PassRefPtr<RespondWithObserver> create(ExecutionContext*, int eventID);
-    ~RespondWithObserver();
+    static RespondWithObserver* create(ExecutionContext*, int eventID);
 
     virtual void contextDestroyed() OVERRIDE;
 
@@ -28,26 +30,24 @@ public:
 
     // Observes the promise and delays calling didHandleFetchEvent() until the
     // given promise is resolved or rejected.
-    void respondWith(const ScriptValue&);
+    void respondWith(ScriptState*, const ScriptValue&, ExceptionState&);
 
     void responseWasRejected();
     void responseWasFulfilled(const ScriptValue&);
 
+    void trace(Visitor*) { }
+
 private:
     class ThenFunction;
 
     RespondWithObserver(ExecutionContext*, int eventID);
 
-    // Sends a response back to the client. The null response means to fallback
-    // to native.
-    void sendResponse(PassRefPtr<Response>);
-
     int m_eventID;
 
     enum State { Initial, Pending, Done };
     State m_state;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // RespondWithObserver_h