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

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

Issue 2821443002: Revert of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Revert Created 3 years, 8 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 /* 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
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"
43 #include "core/events/Event.h" 42 #include "core/events/Event.h"
44 #include "core/inspector/ConsoleMessage.h" 43 #include "core/inspector/ConsoleMessage.h"
45 #include "core/inspector/WorkerInspectorController.h" 44 #include "core/inspector/WorkerInspectorController.h"
46 #include "core/inspector/WorkerThreadDebugger.h" 45 #include "core/inspector/WorkerThreadDebugger.h"
47 #include "core/loader/ThreadableLoader.h" 46 #include "core/loader/ThreadableLoader.h"
48 #include "core/origin_trials/OriginTrialContext.h" 47 #include "core/origin_trials/OriginTrialContext.h"
49 #include "core/workers/WorkerClients.h" 48 #include "core/workers/WorkerClients.h"
50 #include "core/workers/WorkerThreadStartupData.h" 49 #include "core/workers/WorkerThreadStartupData.h"
51 #include "modules/EventTargetModules.h" 50 #include "modules/EventTargetModules.h"
52 #include "modules/fetch/GlobalFetch.h" 51 #include "modules/fetch/GlobalFetch.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (!clients_) 150 if (!clients_)
152 clients_ = ServiceWorkerClients::Create(); 151 clients_ = ServiceWorkerClients::Create();
153 return clients_; 152 return clients_;
154 } 153 }
155 154
156 ServiceWorkerRegistration* ServiceWorkerGlobalScope::registration() { 155 ServiceWorkerRegistration* ServiceWorkerGlobalScope::registration() {
157 return registration_; 156 return registration_;
158 } 157 }
159 158
160 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* script_state) { 159 ScriptPromise ServiceWorkerGlobalScope::skipWaiting(ScriptState* script_state) {
161 ExecutionContext* execution_context = ExecutionContext::From(script_state); 160 ExecutionContext* execution_context = script_state->GetExecutionContext();
162 // FIXME: short-term fix, see details at: 161 // FIXME: short-term fix, see details at:
163 // https://codereview.chromium.org/535193002/. 162 // https://codereview.chromium.org/535193002/.
164 if (!execution_context) 163 if (!execution_context)
165 return ScriptPromise(); 164 return ScriptPromise();
166 165
167 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); 166 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
168 ScriptPromise promise = resolver->Promise(); 167 ScriptPromise promise = resolver->Promise();
169 168
170 ServiceWorkerGlobalScopeClient::From(execution_context) 169 ServiceWorkerGlobalScopeClient::From(execution_context)
171 ->SkipWaiting( 170 ->SkipWaiting(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 236 }
238 237
239 void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) { 238 void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) {
240 WorkerGlobalScope::ExceptionThrown(event); 239 WorkerGlobalScope::ExceptionThrown(event);
241 if (WorkerThreadDebugger* debugger = 240 if (WorkerThreadDebugger* debugger =
242 WorkerThreadDebugger::From(GetThread()->GetIsolate())) 241 WorkerThreadDebugger::From(GetThread()->GetIsolate()))
243 debugger->ExceptionThrown(GetThread(), event); 242 debugger->ExceptionThrown(GetThread(), event);
244 } 243 }
245 244
246 } // namespace blink 245 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698