| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void SpeechRecognition::didEndAudio() { | 102 void SpeechRecognition::didEndAudio() { |
| 103 dispatchEvent(Event::create(EventTypeNames::audioend)); | 103 dispatchEvent(Event::create(EventTypeNames::audioend)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SpeechRecognition::didReceiveResults( | 106 void SpeechRecognition::didReceiveResults( |
| 107 const HeapVector<Member<SpeechRecognitionResult>>& newFinalResults, | 107 const HeapVector<Member<SpeechRecognitionResult>>& newFinalResults, |
| 108 const HeapVector<Member<SpeechRecognitionResult>>& currentInterimResults) { | 108 const HeapVector<Member<SpeechRecognitionResult>>& currentInterimResults) { |
| 109 size_t resultIndex = m_finalResults.size(); | 109 size_t resultIndex = m_finalResults.size(); |
| 110 | 110 |
| 111 for (size_t i = 0; i < newFinalResults.size(); ++i) | 111 for (size_t i = 0; i < newFinalResults.size(); ++i) |
| 112 m_finalResults.append(newFinalResults[i]); | 112 m_finalResults.push_back(newFinalResults[i]); |
| 113 | 113 |
| 114 HeapVector<Member<SpeechRecognitionResult>> results = m_finalResults; | 114 HeapVector<Member<SpeechRecognitionResult>> results = m_finalResults; |
| 115 for (size_t i = 0; i < currentInterimResults.size(); ++i) | 115 for (size_t i = 0; i < currentInterimResults.size(); ++i) |
| 116 results.append(currentInterimResults[i]); | 116 results.push_back(currentInterimResults[i]); |
| 117 | 117 |
| 118 dispatchEvent(SpeechRecognitionEvent::createResult(resultIndex, results)); | 118 dispatchEvent(SpeechRecognitionEvent::createResult(resultIndex, results)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void SpeechRecognition::didReceiveNoMatch(SpeechRecognitionResult* result) { | 121 void SpeechRecognition::didReceiveNoMatch(SpeechRecognitionResult* result) { |
| 122 dispatchEvent(SpeechRecognitionEvent::createNoMatch(result)); | 122 dispatchEvent(SpeechRecognitionEvent::createNoMatch(result)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SpeechRecognition::didReceiveError(SpeechRecognitionError* error) { | 125 void SpeechRecognition::didReceiveError(SpeechRecognitionError* error) { |
| 126 dispatchEvent(error); | 126 dispatchEvent(error); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 DEFINE_TRACE(SpeechRecognition) { | 179 DEFINE_TRACE(SpeechRecognition) { |
| 180 visitor->trace(m_grammars); | 180 visitor->trace(m_grammars); |
| 181 visitor->trace(m_audioTrack); | 181 visitor->trace(m_audioTrack); |
| 182 visitor->trace(m_controller); | 182 visitor->trace(m_controller); |
| 183 visitor->trace(m_finalResults); | 183 visitor->trace(m_finalResults); |
| 184 EventTargetWithInlineData::trace(visitor); | 184 EventTargetWithInlineData::trace(visitor); |
| 185 ContextLifecycleObserver::trace(visitor); | 185 ContextLifecycleObserver::trace(visitor); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |