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

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: review update 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/v8/ScriptFunction.h" 8 #include "bindings/v8/ScriptFunction.h"
9 #include "bindings/v8/ScriptPromise.h" 9 #include "bindings/v8/ScriptPromise.h"
10 #include "bindings/v8/ScriptValue.h" 10 #include "bindings/v8/ScriptValue.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 void WaitUntilObserver::incrementPendingActivity() 103 void WaitUntilObserver::incrementPendingActivity()
104 { 104 {
105 ++m_pendingActivity; 105 ++m_pendingActivity;
106 } 106 }
107 107
108 void WaitUntilObserver::decrementPendingActivity() 108 void WaitUntilObserver::decrementPendingActivity()
109 { 109 {
110 ASSERT(m_pendingActivity > 0); 110 ASSERT(m_pendingActivity > 0);
111 if (--m_pendingActivity || !executionContext()) 111 if (!executionContext() || (!m_hasError && --m_pendingActivity))
jsbell 2014/07/01 16:16:48 Is the assertion in the destructor still valid if
xiang 2014/07/02 05:10:43 I will remove assertion in desctructor as it's not
112 return; 112 return;
113 113
114 ServiceWorkerGlobalScopeClient* client = ServiceWorkerGlobalScopeClient::fro m(executionContext()); 114 ServiceWorkerGlobalScopeClient* client = ServiceWorkerGlobalScopeClient::fro m(executionContext());
115 blink::WebServiceWorkerEventResult result = m_hasError ? blink::WebServiceWo rkerEventResultRejected : blink::WebServiceWorkerEventResultCompleted; 115 blink::WebServiceWorkerEventResult result = m_hasError ? blink::WebServiceWo rkerEventResultRejected : blink::WebServiceWorkerEventResultCompleted;
116 switch (m_type) { 116 switch (m_type) {
117 case Activate: 117 case Activate:
118 client->didHandleActivateEvent(m_eventID, result); 118 client->didHandleActivateEvent(m_eventID, result);
119 break; 119 break;
120 case Install: 120 case Install:
121 client->didHandleInstallEvent(m_eventID, result); 121 client->didHandleInstallEvent(m_eventID, result);
122 break; 122 break;
123 } 123 }
124 observeContext(0); 124 observeContext(0);
125 } 125 }
126 126
127 } // namespace WebCore 127 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698