| 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/nfc/NFC.h" | 5 #include "modules/nfc/NFC.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/V8ArrayBuffer.h" | 8 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 9 #include "bindings/core/v8/V8StringResource.h" | 9 #include "bindings/core/v8/V8StringResource.h" |
| 10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 NFC::~NFC() { | 591 NFC::~NFC() { |
| 592 // |m_nfc| may hold persistent handle to |this| object, therefore, there | 592 // |m_nfc| may hold persistent handle to |this| object, therefore, there |
| 593 // should be no more outstanding requests when NFC object is destructed. | 593 // should be no more outstanding requests when NFC object is destructed. |
| 594 DCHECK(m_requests.isEmpty()); | 594 DCHECK(m_requests.isEmpty()); |
| 595 } | 595 } |
| 596 | 596 |
| 597 void NFC::dispose() { | 597 void NFC::dispose() { |
| 598 m_client.Close(); | 598 m_client.Close(); |
| 599 } | 599 } |
| 600 | 600 |
| 601 void NFC::contextDestroyed() { | 601 void NFC::contextDestroyed(ExecutionContext*) { |
| 602 m_nfc.reset(); | 602 m_nfc.reset(); |
| 603 m_requests.clear(); | 603 m_requests.clear(); |
| 604 m_callbacks.clear(); | 604 m_callbacks.clear(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 void NFC::contextDestroyed(Page*) {} |
| 608 |
| 607 // https://w3c.github.io/web-nfc/#writing-or-pushing-content | 609 // https://w3c.github.io/web-nfc/#writing-or-pushing-content |
| 608 // https://w3c.github.io/web-nfc/#dom-nfc-push | 610 // https://w3c.github.io/web-nfc/#dom-nfc-push |
| 609 ScriptPromise NFC::push(ScriptState* scriptState, | 611 ScriptPromise NFC::push(ScriptState* scriptState, |
| 610 const NFCPushMessage& pushMessage, | 612 const NFCPushMessage& pushMessage, |
| 611 const NFCPushOptions& options) { | 613 const NFCPushOptions& options) { |
| 612 ScriptPromise promise = rejectIfNotSupported(scriptState); | 614 ScriptPromise promise = rejectIfNotSupported(scriptState); |
| 613 if (!promise.isEmpty()) | 615 if (!promise.isEmpty()) |
| 614 return promise; | 616 return promise; |
| 615 | 617 |
| 616 DOMException* exception = isValidNFCPushMessage(pushMessage); | 618 DOMException* exception = isValidNFCPushMessage(pushMessage); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 } | 820 } |
| 819 | 821 |
| 820 DEFINE_TRACE(NFC) { | 822 DEFINE_TRACE(NFC) { |
| 821 PageVisibilityObserver::trace(visitor); | 823 PageVisibilityObserver::trace(visitor); |
| 822 ContextLifecycleObserver::trace(visitor); | 824 ContextLifecycleObserver::trace(visitor); |
| 823 visitor->trace(m_requests); | 825 visitor->trace(m_requests); |
| 824 visitor->trace(m_callbacks); | 826 visitor->trace(m_callbacks); |
| 825 } | 827 } |
| 826 | 828 |
| 827 } // namespace blink | 829 } // namespace blink |
| OLD | NEW |