| OLD | NEW |
| 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/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/ToV8.h" | 8 #include "bindings/core/v8/ToV8.h" |
| 9 #include "bindings/core/v8/V8HiddenValue.h" | 9 #include "bindings/core/v8/V8HiddenValue.h" |
| 10 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" | 10 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // TODO(horo): This behavior is still under the spec discussion. | 80 // TODO(horo): This behavior is still under the spec discussion. |
| 81 // https://github.com/w3c/ServiceWorker/issues/920#issuecomment-255874864 | 81 // https://github.com/w3c/ServiceWorker/issues/920#issuecomment-255874864 |
| 82 m_preloadResponseProperty->resolve(nullptr); | 82 m_preloadResponseProperty->resolve(nullptr); |
| 83 } | 83 } |
| 84 | 84 |
| 85 m_clientId = initializer.clientId(); | 85 m_clientId = initializer.clientId(); |
| 86 m_isReload = initializer.isReload(); | 86 m_isReload = initializer.isReload(); |
| 87 if (initializer.hasRequest()) { | 87 if (initializer.hasRequest()) { |
| 88 ScriptState::Scope scope(scriptState); | 88 ScriptState::Scope scope(scriptState); |
| 89 m_request = initializer.request(); | 89 m_request = initializer.request(); |
| 90 v8::Local<v8::Value> request = toV8(m_request, scriptState); | 90 v8::Local<v8::Value> request = ToV8(m_request, scriptState); |
| 91 v8::Local<v8::Value> event = toV8(this, scriptState); | 91 v8::Local<v8::Value> event = ToV8(this, scriptState); |
| 92 if (event.IsEmpty()) { | 92 if (event.IsEmpty()) { |
| 93 // |toV8| can return an empty handle when the worker is terminating. | 93 // |toV8| can return an empty handle when the worker is terminating. |
| 94 // We don't want the renderer to crash in such cases. | 94 // We don't want the renderer to crash in such cases. |
| 95 // TODO(yhirano): Replace this branch with an assertion when the | 95 // TODO(yhirano): Replace this branch with an assertion when the |
| 96 // graceful shutdown mechanism is introduced. | 96 // graceful shutdown mechanism is introduced. |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 DCHECK(event->IsObject()); | 99 DCHECK(event->IsObject()); |
| 100 // Sets a hidden value in order to teach V8 the dependency from | 100 // Sets a hidden value in order to teach V8 the dependency from |
| 101 // the event to the request. | 101 // the event to the request. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 DEFINE_TRACE(FetchEvent) { | 150 DEFINE_TRACE(FetchEvent) { |
| 151 visitor->trace(m_observer); | 151 visitor->trace(m_observer); |
| 152 visitor->trace(m_request); | 152 visitor->trace(m_request); |
| 153 visitor->trace(m_preloadResponseProperty); | 153 visitor->trace(m_preloadResponseProperty); |
| 154 ExtendableEvent::trace(visitor); | 154 ExtendableEvent::trace(visitor); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace blink | 157 } // namespace blink |
| OLD | NEW |