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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include <memory> | 33 #include <memory> |
34 #include <utility> | 34 #include <utility> |
35 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 35 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
36 #include "bindings/core/v8/ScriptPromise.h" | 36 #include "bindings/core/v8/ScriptPromise.h" |
37 #include "bindings/core/v8/ScriptPromiseResolver.h" | 37 #include "bindings/core/v8/ScriptPromiseResolver.h" |
38 #include "bindings/core/v8/ScriptState.h" | 38 #include "bindings/core/v8/ScriptState.h" |
39 #include "bindings/core/v8/SourceLocation.h" | 39 #include "bindings/core/v8/SourceLocation.h" |
40 #include "bindings/core/v8/V8ThrowException.h" | 40 #include "bindings/core/v8/V8ThrowException.h" |
41 #include "core/dom/ExceptionCode.h" | 41 #include "core/dom/ExceptionCode.h" |
| 42 #include "core/dom/ExecutionContext.h" |
42 #include "core/events/Event.h" | 43 #include "core/events/Event.h" |
43 #include "core/inspector/ConsoleMessage.h" | 44 #include "core/inspector/ConsoleMessage.h" |
44 #include "core/inspector/WorkerInspectorController.h" | 45 #include "core/inspector/WorkerInspectorController.h" |
45 #include "core/inspector/WorkerThreadDebugger.h" | 46 #include "core/inspector/WorkerThreadDebugger.h" |
46 #include "core/loader/ThreadableLoader.h" | 47 #include "core/loader/ThreadableLoader.h" |
47 #include "core/origin_trials/OriginTrialContext.h" | 48 #include "core/origin_trials/OriginTrialContext.h" |
48 #include "core/workers/WorkerClients.h" | 49 #include "core/workers/WorkerClients.h" |
49 #include "core/workers/WorkerThreadStartupData.h" | 50 #include "core/workers/WorkerThreadStartupData.h" |
50 #include "modules/EventTargetModules.h" | 51 #include "modules/EventTargetModules.h" |
51 #include "modules/fetch/GlobalFetch.h" | 52 #include "modules/fetch/GlobalFetch.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (!clients_) | 151 if (!clients_) |
151 clients_ = ServiceWorkerClients::Create(); | 152 clients_ = ServiceWorkerClients::Create(); |
152 return clients_; | 153 return clients_; |
153 } | 154 } |
154 | 155 |
155 ServiceWorkerRegistration* ServiceWorkerGlobalScope::registration() { | 156 ServiceWorkerRegistration* ServiceWorkerGlobalScope::registration() { |
156 return registration_; | 157 return registration_; |
157 } | 158 } |
158 | 159 |
159 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* script_state) { | 160 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* script_state) { |
160 ExecutionContext* execution_context = script_state->GetExecutionContext(); | 161 ExecutionContext* execution_context = ExecutionContext::From(script_state); |
161 // FIXME: short-term fix, see details at: | 162 // FIXME: short-term fix, see details at: |
162 // https://codereview.chromium.org/535193002/. | 163 // https://codereview.chromium.org/535193002/. |
163 if (!execution_context) | 164 if (!execution_context) |
164 return ScriptPromise(); | 165 return ScriptPromise(); |
165 | 166 |
166 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); | 167 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); |
167 ScriptPromise promise = resolver->Promise(); | 168 ScriptPromise promise = resolver->Promise(); |
168 | 169 |
169 ServiceWorkerGlobalScopeClient::From(execution_context) | 170 ServiceWorkerGlobalScopeClient::From(execution_context) |
170 ->SkipWaiting( | 171 ->SkipWaiting( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 237 } |
237 | 238 |
238 void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) { | 239 void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) { |
239 WorkerGlobalScope::ExceptionThrown(event); | 240 WorkerGlobalScope::ExceptionThrown(event); |
240 if (WorkerThreadDebugger* debugger = | 241 if (WorkerThreadDebugger* debugger = |
241 WorkerThreadDebugger::From(GetThread()->GetIsolate())) | 242 WorkerThreadDebugger::From(GetThread()->GetIsolate())) |
242 debugger->ExceptionThrown(GetThread(), event); | 243 debugger->ExceptionThrown(GetThread(), event); |
243 } | 244 } |
244 | 245 |
245 } // namespace blink | 246 } // namespace blink |
OLD | NEW |