Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 #include "modules/speech/SpeechRecognitionEvent.h" | 28 #include "modules/speech/SpeechRecognitionEvent.h" |
| 29 | 29 |
| 30 namespace WebCore { | 30 namespace WebCore { |
| 31 | 31 |
| 32 SpeechRecognitionEventInit::SpeechRecognitionEventInit() | 32 SpeechRecognitionEventInit::SpeechRecognitionEventInit() |
| 33 : resultIndex(0) | 33 : resultIndex(0) |
| 34 { | 34 { |
| 35 } | 35 } |
| 36 | 36 |
| 37 PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::create() | 37 SpeechRecognitionEvent* SpeechRecognitionEvent::create() |
| 38 { | 38 { |
| 39 return adoptRefWillBeNoop(new SpeechRecognitionEvent()); | 39 return new SpeechRecognitionEvent; |
| 40 } | 40 } |
| 41 | 41 |
| 42 PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::create(co nst AtomicString& eventName, const SpeechRecognitionEventInit& initializer) | 42 SpeechRecognitionEvent* SpeechRecognitionEvent::create(const AtomicString& event Name, const SpeechRecognitionEventInit& initializer) |
| 43 { | 43 { |
| 44 return adoptRefWillBeNoop(new SpeechRecognitionEvent(eventName, initializer) ); | 44 return new SpeechRecognitionEvent(eventName, initializer); |
| 45 } | 45 } |
| 46 | 46 |
| 47 PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createRes ult(unsigned long resultIndex, const WillBeHeapVector<RefPtrWillBeMember<SpeechR ecognitionResult> >& results) | 47 SpeechRecognitionEvent* SpeechRecognitionEvent::createResult(unsigned long resul tIndex, const HeapVector<Member<SpeechRecognitionResult> >& results) |
| 48 { | 48 { |
| 49 return adoptRefWillBeNoop(new SpeechRecognitionEvent(EventTypeNames::result, resultIndex, SpeechRecognitionResultList::create(results))); | 49 return new SpeechRecognitionEvent(EventTypeNames::result, resultIndex, Speec hRecognitionResultList::create(results)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createNoM atch(PassRefPtrWillBeRawPtr<SpeechRecognitionResult> result) | 52 SpeechRecognitionEvent* SpeechRecognitionEvent::createNoMatch(SpeechRecognitionR esult* result) |
| 53 { | 53 { |
| 54 if (result) { | 54 if (result) { |
| 55 WillBeHeapVector<RefPtrWillBeMember<SpeechRecognitionResult> > results; | 55 HeapVector<Member<SpeechRecognitionResult> > results; |
| 56 results.append(result); | 56 results.append(result); |
| 57 return adoptRefWillBeNoop(new SpeechRecognitionEvent(EventTypeNames::nom atch, 0, SpeechRecognitionResultList::create(results))); | 57 return new SpeechRecognitionEvent(EventTypeNames::nomatch, 0, SpeechReco gnitionResultList::create(results)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 return adoptRefWillBeNoop(new SpeechRecognitionEvent(EventTypeNames::nomatch , 0, nullptr)); | 60 return new SpeechRecognitionEvent(EventTypeNames::nomatch, 0, nullptr); |
| 61 } | 61 } |
| 62 | 62 |
| 63 const AtomicString& SpeechRecognitionEvent::interfaceName() const | 63 const AtomicString& SpeechRecognitionEvent::interfaceName() const |
| 64 { | 64 { |
| 65 return EventNames::SpeechRecognitionEvent; | 65 return EventNames::SpeechRecognitionEvent; |
| 66 } | 66 } |
| 67 | 67 |
| 68 SpeechRecognitionEvent::SpeechRecognitionEvent() | 68 SpeechRecognitionEvent::SpeechRecognitionEvent() |
| 69 : m_resultIndex(0) | 69 : m_resultIndex(0) |
| 70 { | 70 { |
| 71 ScriptWrappable::init(this); | 71 ScriptWrappable::init(this); |
| 72 } | 72 } |
| 73 | 73 |
| 74 SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, co nst SpeechRecognitionEventInit& initializer) | 74 SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, co nst SpeechRecognitionEventInit& initializer) |
| 75 : Event(eventName, initializer) | 75 : Event(eventName, initializer) |
| 76 , m_resultIndex(initializer.resultIndex) | 76 , m_resultIndex(initializer.resultIndex) |
| 77 , m_results(initializer.results) | 77 , m_results(initializer.results) |
| 78 { | 78 { |
| 79 ScriptWrappable::init(this); | 79 ScriptWrappable::init(this); |
| 80 } | 80 } |
| 81 | 81 |
| 82 SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, un signed long resultIndex, PassRefPtrWillBeRawPtr<SpeechRecognitionResultList> res ults) | 82 SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, un signed long resultIndex, SpeechRecognitionResultList* results) |
| 83 : Event(eventName, /*canBubble=*/false, /*cancelable=*/false) | 83 : Event(eventName, /*canBubble=*/false, /*cancelable=*/false) |
| 84 , m_resultIndex(resultIndex) | 84 , m_resultIndex(resultIndex) |
| 85 , m_results(results) | 85 , m_results(results) |
| 86 { | 86 { |
| 87 ScriptWrappable::init(this); | 87 ScriptWrappable::init(this); |
| 88 } | 88 } |
| 89 | 89 |
| 90 SpeechRecognitionEvent::~SpeechRecognitionEvent() | 90 SpeechRecognitionEvent::~SpeechRecognitionEvent() |
| 91 { | 91 { |
| 92 ScriptWrappable::init(this); | |
|
haraken
2014/06/05 14:30:28
wow...
| |
| 93 } | 92 } |
| 94 | 93 |
| 95 void SpeechRecognitionEvent::trace(Visitor* visitor) | 94 void SpeechRecognitionEvent::trace(Visitor* visitor) |
| 96 { | 95 { |
| 97 visitor->trace(m_results); | 96 visitor->trace(m_results); |
| 98 Event::trace(visitor); | 97 Event::trace(visitor); |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace WebCore | 100 } // namespace WebCore |
| OLD | NEW |