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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 void SpeechRecognition::start(ExceptionState& exceptionState) | 47 void SpeechRecognition::start(ExceptionState& exceptionState) |
48 { | 48 { |
49 ASSERT(m_controller); | 49 ASSERT(m_controller); |
50 if (m_started) { | 50 if (m_started) { |
51 exceptionState.throwDOMException(InvalidStateError, "recognition has alr eady started."); | 51 exceptionState.throwDOMException(InvalidStateError, "recognition has alr eady started."); |
52 return; | 52 return; |
53 } | 53 } |
54 | 54 |
55 m_finalResults.clear(); | 55 m_finalResults.clear(); |
56 | |
57 if (m_audioTrack) | |
58 m_controller->setAudioTrack(this, m_audioTrack); | |
59 else | |
60 m_controller->clearAudioTrack(this); | |
no longer working on chromium
2014/08/14 15:41:34
you don't need clearAudioTrack, just do m_controll
burnik
2014/08/14 16:35:14
Done.
| |
61 | |
56 m_controller->start(this, m_grammars.get(), m_lang, m_continuous, m_interimR esults, m_maxAlternatives); | 62 m_controller->start(this, m_grammars.get(), m_lang, m_continuous, m_interimR esults, m_maxAlternatives); |
57 m_started = true; | 63 m_started = true; |
58 } | 64 } |
59 | 65 |
60 void SpeechRecognition::stopFunction() | 66 void SpeechRecognition::stopFunction() |
61 { | 67 { |
62 ASSERT(m_controller); | 68 ASSERT(m_controller); |
63 if (m_started && !m_stopping) { | 69 if (m_started && !m_stopping) { |
64 m_stopping = true; | 70 m_stopping = true; |
65 m_controller->stop(this); | 71 m_controller->stop(this); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 | 173 |
168 SpeechRecognition::SpeechRecognition(ExecutionContext* context) | 174 SpeechRecognition::SpeechRecognition(ExecutionContext* context) |
169 : ActiveDOMObject(context) | 175 : ActiveDOMObject(context) |
170 , m_grammars(SpeechGrammarList::create()) // FIXME: The spec is not clear on the default value for the grammars attribute. | 176 , m_grammars(SpeechGrammarList::create()) // FIXME: The spec is not clear on the default value for the grammars attribute. |
171 , m_continuous(false) | 177 , m_continuous(false) |
172 , m_interimResults(false) | 178 , m_interimResults(false) |
173 , m_maxAlternatives(1) | 179 , m_maxAlternatives(1) |
174 , m_controller(nullptr) | 180 , m_controller(nullptr) |
175 , m_stoppedByActiveDOMObject(false) | 181 , m_stoppedByActiveDOMObject(false) |
176 , m_started(false) | 182 , m_started(false) |
177 , m_stopping(false) | 183 , m_stopping(false) |
no longer working on chromium
2014/08/14 15:41:34
initialize m_audioTrack to null here.
burnik
2014/08/14 16:38:44
Done.
| |
178 { | 184 { |
179 ScriptWrappable::init(this); | 185 ScriptWrappable::init(this); |
180 Document* document = toDocument(executionContext()); | 186 Document* document = toDocument(executionContext()); |
181 | 187 |
182 Page* page = document->page(); | 188 Page* page = document->page(); |
183 ASSERT(page); | 189 ASSERT(page); |
184 | 190 |
185 m_controller = SpeechRecognitionController::from(page); | 191 m_controller = SpeechRecognitionController::from(page); |
186 ASSERT(m_controller); | 192 ASSERT(m_controller); |
187 | 193 |
188 // FIXME: Need to hook up with Page to get notified when the visibility chan ges. | 194 // FIXME: Need to hook up with Page to get notified when the visibility chan ges. |
189 } | 195 } |
190 | 196 |
191 SpeechRecognition::~SpeechRecognition() | 197 SpeechRecognition::~SpeechRecognition() |
192 { | 198 { |
193 } | 199 } |
194 | 200 |
195 void SpeechRecognition::trace(Visitor* visitor) | 201 void SpeechRecognition::trace(Visitor* visitor) |
196 { | 202 { |
197 visitor->trace(m_grammars); | 203 visitor->trace(m_grammars); |
204 visitor->trace(m_audioTrack); | |
198 #if ENABLE(OILPAN) | 205 #if ENABLE(OILPAN) |
199 visitor->trace(m_controller); | 206 visitor->trace(m_controller); |
200 #endif | 207 #endif |
201 visitor->trace(m_finalResults); | 208 visitor->trace(m_finalResults); |
202 EventTargetWithInlineData::trace(visitor); | 209 EventTargetWithInlineData::trace(visitor); |
203 } | 210 } |
204 | 211 |
205 } // namespace blink | 212 } // namespace blink |
OLD | NEW |