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

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

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Make changes requested by danakj, fix a few more headers Created 4 years 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "modules/serviceworkers/ServiceWorkerThread.h" 56 #include "modules/serviceworkers/ServiceWorkerThread.h"
57 #include "modules/serviceworkers/WaitUntilObserver.h" 57 #include "modules/serviceworkers/WaitUntilObserver.h"
58 #include "platform/Histogram.h" 58 #include "platform/Histogram.h"
59 #include "platform/network/ResourceRequest.h" 59 #include "platform/network/ResourceRequest.h"
60 #include "platform/weborigin/KURL.h" 60 #include "platform/weborigin/KURL.h"
61 #include "public/platform/Platform.h" 61 #include "public/platform/Platform.h"
62 #include "public/platform/WebURL.h" 62 #include "public/platform/WebURL.h"
63 #include "wtf/CurrentTime.h" 63 #include "wtf/CurrentTime.h"
64 #include "wtf/PtrUtil.h" 64 #include "wtf/PtrUtil.h"
65 #include <memory> 65 #include <memory>
66 #include <utility>
66 67
67 namespace blink { 68 namespace blink {
68 69
69 ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::create( 70 ServiceWorkerGlobalScope* ServiceWorkerGlobalScope::create(
70 ServiceWorkerThread* thread, 71 ServiceWorkerThread* thread,
71 std::unique_ptr<WorkerThreadStartupData> startupData) { 72 std::unique_ptr<WorkerThreadStartupData> startupData) {
72 // Note: startupData is finalized on return. After the relevant parts has been 73 // Note: startupData is finalized on return. After the relevant parts has been
73 // passed along to the created 'context'. 74 // passed along to the created 'context'.
74 ServiceWorkerGlobalScope* context = new ServiceWorkerGlobalScope( 75 ServiceWorkerGlobalScope* context = new ServiceWorkerGlobalScope(
75 startupData->m_scriptURL, startupData->m_userAgent, thread, 76 startupData->m_scriptURL, startupData->m_userAgent, thread,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ExecutionContext* executionContext = scriptState->getExecutionContext(); 160 ExecutionContext* executionContext = scriptState->getExecutionContext();
160 // FIXME: short-term fix, see details at: 161 // FIXME: short-term fix, see details at:
161 // https://codereview.chromium.org/535193002/. 162 // https://codereview.chromium.org/535193002/.
162 if (!executionContext) 163 if (!executionContext)
163 return ScriptPromise(); 164 return ScriptPromise();
164 165
165 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 166 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
166 ScriptPromise promise = resolver->promise(); 167 ScriptPromise promise = resolver->promise();
167 168
168 ServiceWorkerGlobalScopeClient::from(executionContext) 169 ServiceWorkerGlobalScopeClient::from(executionContext)
169 ->skipWaiting(new CallbackPromiseAdapter<void, void>(resolver)); 170 ->skipWaiting(
171 WTF::makeUnique<CallbackPromiseAdapter<void, void>>(resolver));
170 return promise; 172 return promise;
171 } 173 }
172 174
173 void ServiceWorkerGlobalScope::setRegistration( 175 void ServiceWorkerGlobalScope::setRegistration(
174 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) { 176 std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) {
175 if (!getExecutionContext()) 177 if (!getExecutionContext())
176 return; 178 return;
177 m_registration = ServiceWorkerRegistration::getOrCreate( 179 m_registration = ServiceWorkerRegistration::getOrCreate(
178 getExecutionContext(), wrapUnique(handle.release())); 180 getExecutionContext(), wrapUnique(handle.release()));
179 } 181 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 254 }
253 255
254 void ServiceWorkerGlobalScope::exceptionThrown(ErrorEvent* event) { 256 void ServiceWorkerGlobalScope::exceptionThrown(ErrorEvent* event) {
255 WorkerGlobalScope::exceptionThrown(event); 257 WorkerGlobalScope::exceptionThrown(event);
256 if (WorkerThreadDebugger* debugger = 258 if (WorkerThreadDebugger* debugger =
257 WorkerThreadDebugger::from(thread()->isolate())) 259 WorkerThreadDebugger::from(thread()->isolate()))
258 debugger->exceptionThrown(thread(), event); 260 debugger->exceptionThrown(thread(), event);
259 } 261 }
260 262
261 } // namespace blink 263 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698