| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // being detached, so don't dispatch an event. | 141 // being detached, so don't dispatch an event. |
| 142 if (m_controller) | 142 if (m_controller) |
| 143 dispatchEvent(Event::create(EventTypeNames::end)); | 143 dispatchEvent(Event::create(EventTypeNames::end)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 const AtomicString& SpeechRecognition::interfaceName() const { | 146 const AtomicString& SpeechRecognition::interfaceName() const { |
| 147 return EventTargetNames::SpeechRecognition; | 147 return EventTargetNames::SpeechRecognition; |
| 148 } | 148 } |
| 149 | 149 |
| 150 ExecutionContext* SpeechRecognition::getExecutionContext() const { | 150 ExecutionContext* SpeechRecognition::getExecutionContext() const { |
| 151 return ActiveDOMObject::getExecutionContext(); | 151 return SuspendableObject::getExecutionContext(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void SpeechRecognition::contextDestroyed() { | 154 void SpeechRecognition::contextDestroyed() { |
| 155 m_controller = nullptr; | 155 m_controller = nullptr; |
| 156 if (hasPendingActivity()) | 156 if (hasPendingActivity()) |
| 157 abort(); | 157 abort(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool SpeechRecognition::hasPendingActivity() const { | 160 bool SpeechRecognition::hasPendingActivity() const { |
| 161 return m_started; | 161 return m_started; |
| 162 } | 162 } |
| 163 | 163 |
| 164 SpeechRecognition::SpeechRecognition(Page* page, ExecutionContext* context) | 164 SpeechRecognition::SpeechRecognition(Page* page, ExecutionContext* context) |
| 165 : ActiveScriptWrappable(this), | 165 : ActiveScriptWrappable(this), |
| 166 ActiveDOMObject(context), | 166 SuspendableObject(context), |
| 167 m_grammars(SpeechGrammarList::create()), // FIXME: The spec is not clear | 167 m_grammars(SpeechGrammarList::create()), // FIXME: The spec is not clear |
| 168 // on the default value for the | 168 // on the default value for the |
| 169 // grammars attribute. | 169 // grammars attribute. |
| 170 m_audioTrack(nullptr), | 170 m_audioTrack(nullptr), |
| 171 m_continuous(false), | 171 m_continuous(false), |
| 172 m_interimResults(false), | 172 m_interimResults(false), |
| 173 m_maxAlternatives(1), | 173 m_maxAlternatives(1), |
| 174 m_controller(SpeechRecognitionController::from(page)), | 174 m_controller(SpeechRecognitionController::from(page)), |
| 175 m_started(false), | 175 m_started(false), |
| 176 m_stopping(false) { | 176 m_stopping(false) { |
| 177 // FIXME: Need to hook up with Page to get notified when the visibility | 177 // FIXME: Need to hook up with Page to get notified when the visibility |
| 178 // changes. | 178 // changes. |
| 179 } | 179 } |
| 180 | 180 |
| 181 SpeechRecognition::~SpeechRecognition() {} | 181 SpeechRecognition::~SpeechRecognition() {} |
| 182 | 182 |
| 183 DEFINE_TRACE(SpeechRecognition) { | 183 DEFINE_TRACE(SpeechRecognition) { |
| 184 visitor->trace(m_grammars); | 184 visitor->trace(m_grammars); |
| 185 visitor->trace(m_audioTrack); | 185 visitor->trace(m_audioTrack); |
| 186 visitor->trace(m_controller); | 186 visitor->trace(m_controller); |
| 187 visitor->trace(m_finalResults); | 187 visitor->trace(m_finalResults); |
| 188 EventTargetWithInlineData::trace(visitor); | 188 EventTargetWithInlineData::trace(visitor); |
| 189 ActiveDOMObject::trace(visitor); | 189 SuspendableObject::trace(visitor); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |