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

Side by Side Diff: Source/modules/serviceworkers/WaitUntilObserver.h

Issue 214413004: Dispatch the ServiceWorker "activate" event during activation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Workers, activate! Created 6 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WaitUntilObserver_h 5 #ifndef WaitUntilObserver_h
6 #define WaitUntilObserver_h 6 #define WaitUntilObserver_h
7 7
8 #include "core/dom/ContextLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 9 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
10 #include "wtf/Forward.h" 10 #include "wtf/Forward.h"
11 #include "wtf/RefCounted.h" 11 #include "wtf/RefCounted.h"
12 12
13 namespace WebCore { 13 namespace WebCore {
14 14
15 class ExecutionContext; 15 class ExecutionContext;
16 class ScriptValue; 16 class ScriptValue;
17 17
18 // Created for each InstallPhaseEvent instance. 18 // Created for each InstallPhaseEvent instance.
19 class WaitUntilObserver FINAL : 19 class WaitUntilObserver FINAL :
20 public ContextLifecycleObserver, 20 public ContextLifecycleObserver,
21 public RefCounted<WaitUntilObserver> { 21 public RefCounted<WaitUntilObserver> {
22 public: 22 public:
23 static PassRefPtr<WaitUntilObserver> create(ExecutionContext*, int eventID); 23 enum EventType {
24 Activate,
25 Install
26 };
27
28 static PassRefPtr<WaitUntilObserver> create(ExecutionContext*, EventType, in t eventID);
24 29
25 ~WaitUntilObserver(); 30 ~WaitUntilObserver();
26 31
27 // Must be called before and after dispatching the event. 32 // Must be called before and after dispatching the event.
28 void willDispatchEvent(); 33 void willDispatchEvent();
29 void didDispatchEvent(); 34 void didDispatchEvent();
30 35
31 // Observes the promise and delays calling didHandleInstallEvent() until 36 // Observes the promise and delays calling the continuation until
32 // the given promise is resolved or rejected. 37 // the given promise is resolved or rejected.
33 void waitUntil(const ScriptValue&); 38 void waitUntil(const ScriptValue&);
34 39
35 private: 40 private:
36 class ThenFunction; 41 class ThenFunction;
37 42
38 WaitUntilObserver(ExecutionContext*, int eventID); 43 WaitUntilObserver(ExecutionContext*, EventType, int eventID);
39 44
40 void reportError(const ScriptValue&); 45 void reportError(const ScriptValue&);
41 46
42 void incrementPendingActivity(); 47 void incrementPendingActivity();
43 void decrementPendingActivity(); 48 void decrementPendingActivity();
44 49
50 EventType m_type;
45 int m_eventID; 51 int m_eventID;
46 int m_pendingActivity; 52 int m_pendingActivity;
47 bool m_hasError; 53 bool m_hasError;
48 }; 54 };
49 55
50 } // namespace WebCore 56 } // namespace WebCore
51 57
52 #endif // WaitUntilObserver_h 58 #endif // WaitUntilObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698