| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/frame/LocalFrame.h" | 34 #include "core/frame/LocalFrame.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 DOMWindowSpeechSynthesis::DOMWindowSpeechSynthesis(LocalDOMWindow& window) | 39 DOMWindowSpeechSynthesis::DOMWindowSpeechSynthesis(LocalDOMWindow& window) |
| 40 : DOMWindowProperty(window.frame()) | 40 : DOMWindowProperty(window.frame()) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowSpeechSynthesis); | |
| 45 | |
| 46 const char* DOMWindowSpeechSynthesis::supplementName() | 44 const char* DOMWindowSpeechSynthesis::supplementName() |
| 47 { | 45 { |
| 48 return "DOMWindowSpeechSynthesis"; | 46 return "DOMWindowSpeechSynthesis"; |
| 49 } | 47 } |
| 50 | 48 |
| 51 // static | 49 // static |
| 52 DOMWindowSpeechSynthesis& DOMWindowSpeechSynthesis::from(LocalDOMWindow& window) | 50 DOMWindowSpeechSynthesis& DOMWindowSpeechSynthesis::from(LocalDOMWindow& window) |
| 53 { | 51 { |
| 54 DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*
>(WillBeHeapSupplement<LocalDOMWindow>::from(window, supplementName())); | 52 DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*
>(HeapSupplement<LocalDOMWindow>::from(window, supplementName())); |
| 55 if (!supplement) { | 53 if (!supplement) { |
| 56 supplement = new DOMWindowSpeechSynthesis(window); | 54 supplement = new DOMWindowSpeechSynthesis(window); |
| 57 provideTo(window, supplementName(), adoptPtrWillBeNoop(supplement)); | 55 provideTo(window, supplementName(), (supplement)); |
| 58 } | 56 } |
| 59 return *supplement; | 57 return *supplement; |
| 60 } | 58 } |
| 61 | 59 |
| 62 // static | 60 // static |
| 63 SpeechSynthesis* DOMWindowSpeechSynthesis::speechSynthesis(DOMWindow& window) | 61 SpeechSynthesis* DOMWindowSpeechSynthesis::speechSynthesis(DOMWindow& window) |
| 64 { | 62 { |
| 65 return DOMWindowSpeechSynthesis::from(toLocalDOMWindow(window)).speechSynthe
sis(); | 63 return DOMWindowSpeechSynthesis::from(toLocalDOMWindow(window)).speechSynthe
sis(); |
| 66 } | 64 } |
| 67 | 65 |
| 68 SpeechSynthesis* DOMWindowSpeechSynthesis::speechSynthesis() | 66 SpeechSynthesis* DOMWindowSpeechSynthesis::speechSynthesis() |
| 69 { | 67 { |
| 70 if (!m_speechSynthesis && frame()) | 68 if (!m_speechSynthesis && frame()) |
| 71 m_speechSynthesis = SpeechSynthesis::create(frame()->domWindow()->execut
ionContext()); | 69 m_speechSynthesis = SpeechSynthesis::create(frame()->domWindow()->execut
ionContext()); |
| 72 return m_speechSynthesis; | 70 return m_speechSynthesis; |
| 73 } | 71 } |
| 74 | 72 |
| 75 DEFINE_TRACE(DOMWindowSpeechSynthesis) | 73 DEFINE_TRACE(DOMWindowSpeechSynthesis) |
| 76 { | 74 { |
| 77 visitor->trace(m_speechSynthesis); | 75 visitor->trace(m_speechSynthesis); |
| 78 WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); | 76 HeapSupplement<LocalDOMWindow>::trace(visitor); |
| 79 DOMWindowProperty::trace(visitor); | 77 DOMWindowProperty::trace(visitor); |
| 80 } | 78 } |
| 81 | 79 |
| 82 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |