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/ToV8ForCore.h" | 7 #include "bindings/core/v8/ToV8ForCore.h" |
8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/timing/WorkerGlobalScopePerformance.h" | 9 #include "core/timing/WorkerGlobalScopePerformance.h" |
10 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" | 10 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 this, | 92 this, |
93 PreloadResponseProperty::kPreloadResponse)) { | 93 PreloadResponseProperty::kPreloadResponse)) { |
94 if (!navigation_preload_sent) | 94 if (!navigation_preload_sent) |
95 preload_response_property_->ResolveWithUndefined(); | 95 preload_response_property_->ResolveWithUndefined(); |
96 | 96 |
97 client_id_ = initializer.clientId(); | 97 client_id_ = initializer.clientId(); |
98 is_reload_ = initializer.isReload(); | 98 is_reload_ = initializer.isReload(); |
99 if (initializer.hasRequest()) { | 99 if (initializer.hasRequest()) { |
100 ScriptState::Scope scope(script_state); | 100 ScriptState::Scope scope(script_state); |
101 request_ = initializer.request(); | 101 request_ = initializer.request(); |
102 | |
xiaofengzhang
2017/06/19 03:17:05
rebase error, should be discarded
| |
102 v8::Local<v8::Value> request = ToV8(request_, script_state); | 103 v8::Local<v8::Value> request = ToV8(request_, script_state); |
103 v8::Local<v8::Value> event = ToV8(this, script_state); | 104 v8::Local<v8::Value> event = ToV8(this, script_state); |
104 if (event.IsEmpty()) { | 105 if (event.IsEmpty()) { |
105 // |toV8| can return an empty handle when the worker is terminating. | 106 // |toV8| can return an empty handle when the worker is terminating. |
106 // We don't want the renderer to crash in such cases. | 107 // We don't want the renderer to crash in such cases. |
107 // TODO(yhirano): Replace this branch with an assertion when the | 108 // TODO(yhirano): Replace this branch with an assertion when the |
108 // graceful shutdown mechanism is introduced. | 109 // graceful shutdown mechanism is introduced. |
109 return; | 110 return; |
110 } | 111 } |
111 DCHECK(event->IsObject()); | 112 DCHECK(event->IsObject()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 198 |
198 DEFINE_TRACE(FetchEvent) { | 199 DEFINE_TRACE(FetchEvent) { |
199 visitor->Trace(observer_); | 200 visitor->Trace(observer_); |
200 visitor->Trace(request_); | 201 visitor->Trace(request_); |
201 visitor->Trace(preload_response_property_); | 202 visitor->Trace(preload_response_property_); |
202 ExtendableEvent::Trace(visitor); | 203 ExtendableEvent::Trace(visitor); |
203 ContextClient::Trace(visitor); | 204 ContextClient::Trace(visitor); |
204 } | 205 } |
205 | 206 |
206 } // namespace blink | 207 } // namespace blink |
OLD | NEW |