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

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

Issue 181173002: ScriptPromise should check the constructor paraemter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase 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
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 void WaitUntilObserver::didDispatchEvent() 70 void WaitUntilObserver::didDispatchEvent()
71 { 71 {
72 decrementPendingActivity(); 72 decrementPendingActivity();
73 } 73 }
74 74
75 void WaitUntilObserver::waitUntil(const ScriptValue& value) 75 void WaitUntilObserver::waitUntil(const ScriptValue& value)
76 { 76 {
77 incrementPendingActivity(); 77 incrementPendingActivity();
78 ScriptPromise(value).then( 78 ScriptPromise::cast(value).then(
79 ThenFunction::create(this, ThenFunction::Fulfilled), 79 ThenFunction::create(this, ThenFunction::Fulfilled),
80 ThenFunction::create(this, ThenFunction::Rejected)); 80 ThenFunction::create(this, ThenFunction::Rejected));
81 } 81 }
82 82
83 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, int eventID) 83 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, int eventID)
84 : ContextLifecycleObserver(context) 84 : ContextLifecycleObserver(context)
85 , m_eventID(eventID) 85 , m_eventID(eventID)
86 , m_pendingActivity(0) 86 , m_pendingActivity(0)
87 { 87 {
88 } 88 }
(...skipping 13 matching lines...) Expand all
102 { 102 {
103 ASSERT(m_pendingActivity > 0); 103 ASSERT(m_pendingActivity > 0);
104 if (--m_pendingActivity || !executionContext()) 104 if (--m_pendingActivity || !executionContext())
105 return; 105 return;
106 106
107 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleInstallEv ent(m_eventID); 107 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleInstallEv ent(m_eventID);
108 observeContext(0); 108 observeContext(0);
109 } 109 }
110 110
111 } // namespace WebCore 111 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698