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

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

Issue 352423005: Add ServiceWorker InstallPhaseEvent.waitUntil() layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add FIXME Created 6 years, 5 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
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 #include "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/WaitUntilObserver.h" 6 #include "modules/serviceworkers/WaitUntilObserver.h"
7 7
8 #include "bindings/core/v8/ScriptFunction.h" 8 #include "bindings/core/v8/ScriptFunction.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ResolveType m_resolveType; 55 ResolveType m_resolveType;
56 }; 56 };
57 57
58 PassRefPtr<WaitUntilObserver> WaitUntilObserver::create(ExecutionContext* contex t, EventType type, int eventID) 58 PassRefPtr<WaitUntilObserver> WaitUntilObserver::create(ExecutionContext* contex t, EventType type, int eventID)
59 { 59 {
60 return adoptRef(new WaitUntilObserver(context, type, eventID)); 60 return adoptRef(new WaitUntilObserver(context, type, eventID));
61 } 61 }
62 62
63 WaitUntilObserver::~WaitUntilObserver() 63 WaitUntilObserver::~WaitUntilObserver()
64 { 64 {
65 ASSERT(!m_pendingActivity);
66 } 65 }
67 66
68 void WaitUntilObserver::willDispatchEvent() 67 void WaitUntilObserver::willDispatchEvent()
69 { 68 {
70 incrementPendingActivity(); 69 incrementPendingActivity();
71 } 70 }
72 71
73 void WaitUntilObserver::didDispatchEvent() 72 void WaitUntilObserver::didDispatchEvent()
74 { 73 {
75 decrementPendingActivity(); 74 decrementPendingActivity();
(...skipping 25 matching lines...) Expand all
101 } 100 }
102 101
103 void WaitUntilObserver::incrementPendingActivity() 102 void WaitUntilObserver::incrementPendingActivity()
104 { 103 {
105 ++m_pendingActivity; 104 ++m_pendingActivity;
106 } 105 }
107 106
108 void WaitUntilObserver::decrementPendingActivity() 107 void WaitUntilObserver::decrementPendingActivity()
109 { 108 {
110 ASSERT(m_pendingActivity > 0); 109 ASSERT(m_pendingActivity > 0);
111 if (--m_pendingActivity || !executionContext()) 110 if (!executionContext() || (!m_hasError && --m_pendingActivity))
112 return; 111 return;
113 112
114 ServiceWorkerGlobalScopeClient* client = ServiceWorkerGlobalScopeClient::fro m(executionContext()); 113 ServiceWorkerGlobalScopeClient* client = ServiceWorkerGlobalScopeClient::fro m(executionContext());
115 blink::WebServiceWorkerEventResult result = m_hasError ? blink::WebServiceWo rkerEventResultRejected : blink::WebServiceWorkerEventResultCompleted; 114 blink::WebServiceWorkerEventResult result = m_hasError ? blink::WebServiceWo rkerEventResultRejected : blink::WebServiceWorkerEventResultCompleted;
116 switch (m_type) { 115 switch (m_type) {
117 case Activate: 116 case Activate:
118 client->didHandleActivateEvent(m_eventID, result); 117 client->didHandleActivateEvent(m_eventID, result);
119 break; 118 break;
120 case Install: 119 case Install:
121 client->didHandleInstallEvent(m_eventID, result); 120 client->didHandleInstallEvent(m_eventID, result);
122 break; 121 break;
123 } 122 }
124 observeContext(0); 123 observeContext(0);
125 } 124 }
126 125
127 } // namespace WebCore 126 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorker.cpp ('k') | public/platform/WebServiceWorkerState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698