| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void SpeechRecognition::didEndSound() | 101 void SpeechRecognition::didEndSound() |
| 102 { | 102 { |
| 103 dispatchEvent(Event::create(EventTypeNames::soundend)); | 103 dispatchEvent(Event::create(EventTypeNames::soundend)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SpeechRecognition::didEndAudio() | 106 void SpeechRecognition::didEndAudio() |
| 107 { | 107 { |
| 108 dispatchEvent(Event::create(EventTypeNames::audioend)); | 108 dispatchEvent(Event::create(EventTypeNames::audioend)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SpeechRecognition::didReceiveResults(const Vector<RefPtr<SpeechRecognitionR
esult> >& newFinalResults, const Vector<RefPtr<SpeechRecognitionResult> >& curre
ntInterimResults) | 111 void SpeechRecognition::didReceiveResults(const WillBeHeapVector<RefPtrWillBeMem
ber<SpeechRecognitionResult> >& newFinalResults, const WillBeHeapVector<RefPtrWi
llBeMember<SpeechRecognitionResult> >& currentInterimResults) |
| 112 { | 112 { |
| 113 unsigned long resultIndex = m_finalResults.size(); | 113 unsigned long resultIndex = m_finalResults.size(); |
| 114 | 114 |
| 115 for (size_t i = 0; i < newFinalResults.size(); ++i) | 115 for (size_t i = 0; i < newFinalResults.size(); ++i) |
| 116 m_finalResults.append(newFinalResults[i]); | 116 m_finalResults.append(newFinalResults[i]); |
| 117 | 117 |
| 118 Vector<RefPtr<SpeechRecognitionResult> > results = m_finalResults; | 118 WillBeHeapVector<RefPtrWillBeMember<SpeechRecognitionResult> > results = m_f
inalResults; |
| 119 for (size_t i = 0; i < currentInterimResults.size(); ++i) | 119 for (size_t i = 0; i < currentInterimResults.size(); ++i) |
| 120 results.append(currentInterimResults[i]); | 120 results.append(currentInterimResults[i]); |
| 121 | 121 |
| 122 dispatchEvent(SpeechRecognitionEvent::createResult(resultIndex, results)); | 122 dispatchEvent(SpeechRecognitionEvent::createResult(resultIndex, results)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SpeechRecognition::didReceiveNoMatch(PassRefPtr<SpeechRecognitionResult> re
sult) | 125 void SpeechRecognition::didReceiveNoMatch(PassRefPtrWillBeRawPtr<SpeechRecogniti
onResult> result) |
| 126 { | 126 { |
| 127 dispatchEvent(SpeechRecognitionEvent::createNoMatch(result)); | 127 dispatchEvent(SpeechRecognitionEvent::createNoMatch(result)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void SpeechRecognition::didReceiveError(PassRefPtr<SpeechRecognitionError> error
) | 130 void SpeechRecognition::didReceiveError(PassRefPtr<SpeechRecognitionError> error
) |
| 131 { | 131 { |
| 132 dispatchEvent(error); | 132 dispatchEvent(error); |
| 133 m_started = false; | 133 m_started = false; |
| 134 } | 134 } |
| 135 | 135 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // FIXME: Need to hook up with Page to get notified when the visibility chan
ges. | 187 // FIXME: Need to hook up with Page to get notified when the visibility chan
ges. |
| 188 } | 188 } |
| 189 | 189 |
| 190 SpeechRecognition::~SpeechRecognition() | 190 SpeechRecognition::~SpeechRecognition() |
| 191 { | 191 { |
| 192 } | 192 } |
| 193 | 193 |
| 194 void SpeechRecognition::trace(Visitor* visitor) | 194 void SpeechRecognition::trace(Visitor* visitor) |
| 195 { | 195 { |
| 196 visitor->trace(m_grammars); | 196 visitor->trace(m_grammars); |
| 197 visitor->trace(m_finalResults); |
| 197 } | 198 } |
| 198 | 199 |
| 199 } // namespace WebCore | 200 } // namespace WebCore |
| OLD | NEW |