| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/frame/LocalDOMWindow.h" | 33 #include "core/frame/LocalDOMWindow.h" |
| 34 #include "modules/crypto/Crypto.h" | 34 #include "modules/crypto/Crypto.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 DOMWindowCrypto::DOMWindowCrypto(LocalDOMWindow& window) | 38 DOMWindowCrypto::DOMWindowCrypto(LocalDOMWindow& window) |
| 39 : DOMWindowProperty(window.frame()) | 39 : DOMWindowProperty(window.frame()) |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowCrypto); | |
| 44 | |
| 45 const char* DOMWindowCrypto::supplementName() | 43 const char* DOMWindowCrypto::supplementName() |
| 46 { | 44 { |
| 47 return "DOMWindowCrypto"; | 45 return "DOMWindowCrypto"; |
| 48 } | 46 } |
| 49 | 47 |
| 50 DOMWindowCrypto& DOMWindowCrypto::from(LocalDOMWindow& window) | 48 DOMWindowCrypto& DOMWindowCrypto::from(LocalDOMWindow& window) |
| 51 { | 49 { |
| 52 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(WillBeHeapSupple
ment<LocalDOMWindow>::from(window, supplementName())); | 50 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(HeapSupplement<L
ocalDOMWindow>::from(window, supplementName())); |
| 53 if (!supplement) { | 51 if (!supplement) { |
| 54 supplement = new DOMWindowCrypto(window); | 52 supplement = new DOMWindowCrypto(window); |
| 55 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); | 53 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 56 } | 54 } |
| 57 return *supplement; | 55 return *supplement; |
| 58 } | 56 } |
| 59 | 57 |
| 60 Crypto* DOMWindowCrypto::crypto(DOMWindow& window) | 58 Crypto* DOMWindowCrypto::crypto(DOMWindow& window) |
| 61 { | 59 { |
| 62 return DOMWindowCrypto::from(toLocalDOMWindow(window)).crypto(); | 60 return DOMWindowCrypto::from(toLocalDOMWindow(window)).crypto(); |
| 63 } | 61 } |
| 64 | 62 |
| 65 Crypto* DOMWindowCrypto::crypto() const | 63 Crypto* DOMWindowCrypto::crypto() const |
| 66 { | 64 { |
| 67 if (!m_crypto && frame()) | 65 if (!m_crypto && frame()) |
| 68 m_crypto = Crypto::create(); | 66 m_crypto = Crypto::create(); |
| 69 return m_crypto.get(); | 67 return m_crypto.get(); |
| 70 } | 68 } |
| 71 | 69 |
| 72 DEFINE_TRACE(DOMWindowCrypto) | 70 DEFINE_TRACE(DOMWindowCrypto) |
| 73 { | 71 { |
| 74 visitor->trace(m_crypto); | 72 visitor->trace(m_crypto); |
| 75 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); | 73 HeapSupplement<LocalDOMWindow>::trace(visitor); |
| 76 DOMWindowProperty::trace(visitor); | 74 DOMWindowProperty::trace(visitor); |
| 77 } | 75 } |
| 78 | 76 |
| 79 } // namespace blink | 77 } // namespace blink |
| OLD | NEW |