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

Side by Side Diff: third_party/WebKit/Source/modules/background_sync/SyncCallbacks.cpp

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/background_sync/SyncCallbacks.h" 5 #include "modules/background_sync/SyncCallbacks.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "modules/background_sync/SyncError.h" 8 #include "modules/background_sync/SyncError.h"
9 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 9 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
10 #include "wtf/OwnPtr.h" 10 #include "wtf/OwnPtr.h"
11 #include "wtf/PassOwnPtr.h" 11 #include "wtf/PassOwnPtr.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 SyncRegistrationCallbacks::SyncRegistrationCallbacks(ScriptPromiseResolver* reso lver, ServiceWorkerRegistration* serviceWorkerRegistration) 15 SyncRegistrationCallbacks::SyncRegistrationCallbacks(ScriptPromiseResolver* reso lver, ServiceWorkerRegistration* serviceWorkerRegistration)
16 : m_resolver(resolver) 16 : m_resolver(resolver)
17 , m_serviceWorkerRegistration(serviceWorkerRegistration) 17 , m_serviceWorkerRegistration(serviceWorkerRegistration)
18 { 18 {
19 ASSERT(m_resolver); 19 ASSERT(m_resolver);
20 ASSERT(m_serviceWorkerRegistration); 20 ASSERT(m_serviceWorkerRegistration);
21 } 21 }
22 22
23 SyncRegistrationCallbacks::~SyncRegistrationCallbacks() 23 SyncRegistrationCallbacks::~SyncRegistrationCallbacks()
24 { 24 {
25 } 25 }
26 26
27 void SyncRegistrationCallbacks::onSuccess(WebPassOwnPtr<WebSyncRegistration> web SyncRegistration) 27 void SyncRegistrationCallbacks::onSuccess(std::unique_ptr<WebSyncRegistration> w ebSyncRegistration)
28 { 28 {
29 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) { 29 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) {
30 return; 30 return;
31 } 31 }
32 32
33 OwnPtr<WebSyncRegistration> registration = webSyncRegistration.release(); 33 OwnPtr<WebSyncRegistration> registration = adoptPtr(webSyncRegistration.rele ase());
dcheng 2016/04/07 00:26:12 FWIW, I think we'd be saving ourself trouble down
34 if (!registration) { 34 if (!registration) {
35 m_resolver->resolve(v8::Null(m_resolver->getScriptState()->isolate())); 35 m_resolver->resolve(v8::Null(m_resolver->getScriptState()->isolate()));
36 return; 36 return;
37 } 37 }
38 m_resolver->resolve(); 38 m_resolver->resolve();
39 } 39 }
40 40
41 void SyncRegistrationCallbacks::onError(const WebSyncError& error) 41 void SyncRegistrationCallbacks::onError(const WebSyncError& error)
42 { 42 {
43 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) { 43 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) {
(...skipping 28 matching lines...) Expand all
72 72
73 void SyncGetRegistrationsCallbacks::onError(const WebSyncError& error) 73 void SyncGetRegistrationsCallbacks::onError(const WebSyncError& error)
74 { 74 {
75 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) { 75 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) {
76 return; 76 return;
77 } 77 }
78 m_resolver->reject(SyncError::take(m_resolver.get(), error)); 78 m_resolver->reject(SyncError::take(m_resolver.get(), error));
79 } 79 }
80 80
81 } // namespace blink 81 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698