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

Side by Side Diff: Source/modules/background_sync/PeriodicSyncRegistration.cpp

Issue 1233173002: Have ScriptPromiseResolver on the Oilpan heap always. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix webusb ScriptPromiseResolver usage Created 5 years, 4 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 "config.h" 5 #include "config.h"
6 #include "modules/background_sync/PeriodicSyncRegistration.h" 6 #include "modules/background_sync/PeriodicSyncRegistration.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 PeriodicSyncRegistration::~PeriodicSyncRegistration() 67 PeriodicSyncRegistration::~PeriodicSyncRegistration()
68 { 68 {
69 } 69 }
70 70
71 ScriptPromise PeriodicSyncRegistration::unregister(ScriptState* scriptState) 71 ScriptPromise PeriodicSyncRegistration::unregister(ScriptState* scriptState)
72 { 72 {
73 if (m_id == WebSyncRegistration::UNREGISTERED_SYNC_ID) 73 if (m_id == WebSyncRegistration::UNREGISTERED_SYNC_ID)
74 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(AbortError, "Operation failed - not a valid registration object")); 74 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(AbortError, "Operation failed - not a valid registration object"));
75 75
76 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 76 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
77 ScriptPromise promise = resolver->promise(); 77 ScriptPromise promise = resolver->promise();
78 78
79 WebSyncProvider* webSyncProvider = Platform::current()->backgroundSyncProvid er(); 79 WebSyncProvider* webSyncProvider = Platform::current()->backgroundSyncProvid er();
80 ASSERT(webSyncProvider); 80 ASSERT(webSyncProvider);
81 81
82 webSyncProvider->unregisterBackgroundSync(WebSyncRegistration::PeriodicityPe riodic, m_id, m_tag, m_serviceWorkerRegistration->webRegistration(), new SyncUnr egistrationCallbacks(resolver, m_serviceWorkerRegistration)); 82 webSyncProvider->unregisterBackgroundSync(WebSyncRegistration::PeriodicityPe riodic, m_id, m_tag, m_serviceWorkerRegistration->webRegistration(), new SyncUnr egistrationCallbacks(resolver, m_serviceWorkerRegistration));
83 83
84 return promise; 84 return promise;
85 } 85 }
86 86
87 DEFINE_TRACE(PeriodicSyncRegistration) 87 DEFINE_TRACE(PeriodicSyncRegistration)
88 { 88 {
89 visitor->trace(m_serviceWorkerRegistration); 89 visitor->trace(m_serviceWorkerRegistration);
90 } 90 }
91 91
92 } // namespace blink 92 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/background_sync/PeriodicSyncManager.cpp ('k') | Source/modules/background_sync/SyncCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698