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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp

Issue 2034663002: ServiceWorker: Keep the worker alive until FetchEvent.waitUntil settles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 "modules/serviceworkers/FetchEvent.h" 5 #include "modules/serviceworkers/FetchEvent.h"
6 6
7 #include "bindings/core/v8/ToV8.h" 7 #include "bindings/core/v8/ToV8.h"
8 #include "bindings/core/v8/V8HiddenValue.h" 8 #include "bindings/core/v8/V8HiddenValue.h"
9 #include "modules/fetch/Request.h" 9 #include "modules/fetch/Request.h"
10 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 10 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
11 #include "wtf/RefPtr.h" 11 #include "wtf/RefPtr.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 FetchEvent* FetchEvent::create() 15 FetchEvent* FetchEvent::create()
16 { 16 {
17 return new FetchEvent(); 17 return new FetchEvent();
18 } 18 }
19 19
20 FetchEvent* FetchEvent::create(ScriptState* scriptState, const AtomicString& typ e, const FetchEventInit& initializer) 20 FetchEvent* FetchEvent::create(ScriptState* scriptState, const AtomicString& typ e, const FetchEventInit& initializer)
21 { 21 {
22 return new FetchEvent(scriptState, type, initializer, nullptr); 22 return new FetchEvent(scriptState, type, initializer, nullptr, nullptr);
23 } 23 }
24 24
25 FetchEvent* FetchEvent::create(ScriptState* scriptState, const AtomicString& typ e, const FetchEventInit& initializer, RespondWithObserver* observer) 25 FetchEvent* FetchEvent::create(ScriptState* scriptState, const AtomicString& typ e, const FetchEventInit& initializer, RespondWithObserver* respondWithObserver, WaitUntilObserver* waitUntilObserver)
26 { 26 {
27 return new FetchEvent(scriptState, type, initializer, observer); 27 return new FetchEvent(scriptState, type, initializer, respondWithObserver, w aitUntilObserver);
28 } 28 }
29 29
30 Request* FetchEvent::request() const 30 Request* FetchEvent::request() const
31 { 31 {
32 return m_request; 32 return m_request;
33 } 33 }
34 34
35 String FetchEvent::clientId() const 35 String FetchEvent::clientId() const
36 { 36 {
37 return m_clientId; 37 return m_clientId;
(...skipping 14 matching lines...) Expand all
52 const AtomicString& FetchEvent::interfaceName() const 52 const AtomicString& FetchEvent::interfaceName() const
53 { 53 {
54 return EventNames::FetchEvent; 54 return EventNames::FetchEvent;
55 } 55 }
56 56
57 FetchEvent::FetchEvent() 57 FetchEvent::FetchEvent()
58 : m_isReload(false) 58 : m_isReload(false)
59 { 59 {
60 } 60 }
61 61
62 FetchEvent::FetchEvent(ScriptState* scriptState, const AtomicString& type, const FetchEventInit& initializer, RespondWithObserver* observer) 62 FetchEvent::FetchEvent(ScriptState* scriptState, const AtomicString& type, const FetchEventInit& initializer, RespondWithObserver* respondWithObserver, WaitUnti lObserver* waitUntilObserver)
63 : ExtendableEvent(type, initializer) 63 : ExtendableEvent(type, initializer, waitUntilObserver)
64 , m_observer(observer) 64 , m_observer(respondWithObserver)
65 { 65 {
66 m_clientId = initializer.clientId(); 66 m_clientId = initializer.clientId();
67 m_isReload = initializer.isReload(); 67 m_isReload = initializer.isReload();
68 if (initializer.hasRequest()) { 68 if (initializer.hasRequest()) {
69 ScriptState::Scope scope(scriptState); 69 ScriptState::Scope scope(scriptState);
70 m_request = initializer.request(); 70 m_request = initializer.request();
71 v8::Local<v8::Value> request = toV8(m_request, scriptState); 71 v8::Local<v8::Value> request = toV8(m_request, scriptState);
72 v8::Local<v8::Value> event = toV8(this, scriptState); 72 v8::Local<v8::Value> event = toV8(this, scriptState);
73 if (event.IsEmpty()) { 73 if (event.IsEmpty()) {
74 // |toV8| can return an empty handle when the worker is terminating. 74 // |toV8| can return an empty handle when the worker is terminating.
(...skipping 13 matching lines...) Expand all
88 } 88 }
89 89
90 DEFINE_TRACE(FetchEvent) 90 DEFINE_TRACE(FetchEvent)
91 { 91 {
92 visitor->trace(m_observer); 92 visitor->trace(m_observer);
93 visitor->trace(m_request); 93 visitor->trace(m_request);
94 ExtendableEvent::trace(visitor); 94 ExtendableEvent::trace(visitor);
95 } 95 }
96 96
97 } // namespace blink 97 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698