OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 { | 105 { |
106 DEFINE_STATIC_LOCAL(AtomicString, unknown, ("unknown", AtomicString::Constru
ctFromLiteral)); | 106 DEFINE_STATIC_LOCAL(AtomicString, unknown, ("unknown", AtomicString::Constru
ctFromLiteral)); |
107 DEFINE_STATIC_LOCAL(AtomicString, parsed, ("parsed", AtomicString::Construct
FromLiteral)); | 107 DEFINE_STATIC_LOCAL(AtomicString, parsed, ("parsed", AtomicString::Construct
FromLiteral)); |
108 DEFINE_STATIC_LOCAL(AtomicString, installing, ("installing", AtomicString::C
onstructFromLiteral)); | 108 DEFINE_STATIC_LOCAL(AtomicString, installing, ("installing", AtomicString::C
onstructFromLiteral)); |
109 DEFINE_STATIC_LOCAL(AtomicString, installed, ("installed", AtomicString::Con
structFromLiteral)); | 109 DEFINE_STATIC_LOCAL(AtomicString, installed, ("installed", AtomicString::Con
structFromLiteral)); |
110 DEFINE_STATIC_LOCAL(AtomicString, activating, ("activating", AtomicString::C
onstructFromLiteral)); | 110 DEFINE_STATIC_LOCAL(AtomicString, activating, ("activating", AtomicString::C
onstructFromLiteral)); |
111 DEFINE_STATIC_LOCAL(AtomicString, activated, ("activated", AtomicString::Con
structFromLiteral)); | 111 DEFINE_STATIC_LOCAL(AtomicString, activated, ("activated", AtomicString::Con
structFromLiteral)); |
112 DEFINE_STATIC_LOCAL(AtomicString, redundant, ("redundant", AtomicString::Con
structFromLiteral)); | 112 DEFINE_STATIC_LOCAL(AtomicString, redundant, ("redundant", AtomicString::Con
structFromLiteral)); |
113 | 113 |
114 switch (m_outerWorker->state()) { | 114 switch (m_outerWorker->state()) { |
115 case blink::WebServiceWorkerStateUnknown: | 115 case WebServiceWorkerStateUnknown: |
116 // The web platform should never see this internal state | 116 // The web platform should never see this internal state |
117 ASSERT_NOT_REACHED(); | 117 ASSERT_NOT_REACHED(); |
118 return unknown; | 118 return unknown; |
119 case blink::WebServiceWorkerStateParsed: | 119 case WebServiceWorkerStateParsed: |
120 return parsed; | 120 return parsed; |
121 case blink::WebServiceWorkerStateInstalling: | 121 case WebServiceWorkerStateInstalling: |
122 return installing; | 122 return installing; |
123 case blink::WebServiceWorkerStateInstalled: | 123 case WebServiceWorkerStateInstalled: |
124 return installed; | 124 return installed; |
125 case blink::WebServiceWorkerStateActivating: | 125 case WebServiceWorkerStateActivating: |
126 return activating; | 126 return activating; |
127 case blink::WebServiceWorkerStateActivated: | 127 case WebServiceWorkerStateActivated: |
128 return activated; | 128 return activated; |
129 case blink::WebServiceWorkerStateRedundant: | 129 case WebServiceWorkerStateRedundant: |
130 return redundant; | 130 return redundant; |
131 default: | 131 default: |
132 ASSERT_NOT_REACHED(); | 132 ASSERT_NOT_REACHED(); |
133 return nullAtom; | 133 return nullAtom; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::from(ExecutionContext* exec
utionContext, WebType* worker) | 137 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::from(ExecutionContext* exec
utionContext, WebType* worker) |
138 { | 138 { |
139 if (!worker) | 139 if (!worker) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 setProxyState(RegisterPromisePending); | 206 setProxyState(RegisterPromisePending); |
207 promise.then(ThenFunction::create(this)); | 207 promise.then(ThenFunction::create(this)); |
208 } | 208 } |
209 | 209 |
210 bool ServiceWorker::hasPendingActivity() const | 210 bool ServiceWorker::hasPendingActivity() const |
211 { | 211 { |
212 if (AbstractWorker::hasPendingActivity()) | 212 if (AbstractWorker::hasPendingActivity()) |
213 return true; | 213 return true; |
214 if (m_proxyState == ContextStopped) | 214 if (m_proxyState == ContextStopped) |
215 return false; | 215 return false; |
216 return m_outerWorker->state() != blink::WebServiceWorkerStateRedundant; | 216 return m_outerWorker->state() != WebServiceWorkerStateRedundant; |
217 } | 217 } |
218 | 218 |
219 void ServiceWorker::stop() | 219 void ServiceWorker::stop() |
220 { | 220 { |
221 setProxyState(ContextStopped); | 221 setProxyState(ContextStopped); |
222 } | 222 } |
223 | 223 |
224 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::getOrCreate(ExecutionContex
t* executionContext, WebType* outerWorker) | 224 PassRefPtrWillBeRawPtr<ServiceWorker> ServiceWorker::getOrCreate(ExecutionContex
t* executionContext, WebType* outerWorker) |
225 { | 225 { |
226 if (!outerWorker) | 226 if (!outerWorker) |
(...skipping 16 matching lines...) Expand all Loading... |
243 , WebServiceWorkerProxy(this) | 243 , WebServiceWorkerProxy(this) |
244 , m_outerWorker(worker) | 244 , m_outerWorker(worker) |
245 , m_proxyState(Initial) | 245 , m_proxyState(Initial) |
246 { | 246 { |
247 ScriptWrappable::init(this); | 247 ScriptWrappable::init(this); |
248 ASSERT(m_outerWorker); | 248 ASSERT(m_outerWorker); |
249 m_outerWorker->setProxy(this); | 249 m_outerWorker->setProxy(this); |
250 } | 250 } |
251 | 251 |
252 } // namespace blink | 252 } // namespace blink |
OLD | NEW |