| OLD | NEW |
| 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/SyncManager.h" | 5 #include "modules/background_sync/SyncManager.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 convertToBaseCallback(WTF::bind(&SyncManager::getRegistrationsCallback, | 63 convertToBaseCallback(WTF::bind(&SyncManager::getRegistrationsCallback, |
| 64 wrapPersistent(resolver)))); | 64 wrapPersistent(resolver)))); |
| 65 | 65 |
| 66 return promise; | 66 return promise; |
| 67 } | 67 } |
| 68 | 68 |
| 69 const mojom::blink::BackgroundSyncServicePtr& | 69 const mojom::blink::BackgroundSyncServicePtr& |
| 70 SyncManager::getBackgroundSyncServicePtr() { | 70 SyncManager::getBackgroundSyncServicePtr() { |
| 71 if (!m_backgroundSyncService.get()) { | 71 if (!m_backgroundSyncService.get()) { |
| 72 Platform::current()->interfaceProvider()->getInterface( | 72 Platform::current()->interfaceProvider()->getInterface( |
| 73 mojo::GetProxy(&m_backgroundSyncService)); | 73 mojo::MakeRequest(&m_backgroundSyncService)); |
| 74 } | 74 } |
| 75 return m_backgroundSyncService; | 75 return m_backgroundSyncService; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 void SyncManager::registerCallback(ScriptPromiseResolver* resolver, | 79 void SyncManager::registerCallback(ScriptPromiseResolver* resolver, |
| 80 mojom::blink::BackgroundSyncError error, | 80 mojom::blink::BackgroundSyncError error, |
| 81 mojom::blink::SyncRegistrationPtr options) { | 81 mojom::blink::SyncRegistrationPtr options) { |
| 82 // TODO(iclelland): Determine the correct error message to return in each case | 82 // TODO(iclelland): Determine the correct error message to return in each case |
| 83 switch (error) { | 83 switch (error) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DOMException::create(UnknownError, "No service worker is active.")); | 143 DOMException::create(UnknownError, "No service worker is active.")); |
| 144 break; | 144 break; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 DEFINE_TRACE(SyncManager) { | 148 DEFINE_TRACE(SyncManager) { |
| 149 visitor->trace(m_registration); | 149 visitor->trace(m_registration); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |