Chromium Code Reviews| Index: Source/core/speech/SpeechInput.cpp |
| diff --git a/Source/core/speech/SpeechInput.cpp b/Source/core/speech/SpeechInput.cpp |
| index ea7c449b276e4fa121579b717bf5cef04f6fdf0f..a8f637328764bbf729bc886a39446b366f4f288d 100644 |
| --- a/Source/core/speech/SpeechInput.cpp |
| +++ b/Source/core/speech/SpeechInput.cpp |
| @@ -51,16 +51,16 @@ SpeechInput::~SpeechInput() |
| m_client->setListener(0); |
| } |
| -PassOwnPtr<SpeechInput> SpeechInput::create(PassOwnPtr<SpeechInputClient> client) |
| +PassOwnPtrWillBeRawPtr<SpeechInput> SpeechInput::create(PassOwnPtr<SpeechInputClient> client) |
| { |
| - return adoptPtr(new SpeechInput(client)); |
| + return adoptPtrWillBeNoop(new SpeechInput(client)); |
| } |
| -int SpeechInput::registerListener(InputFieldSpeechButtonElement* listener) |
| +int SpeechInput::registerListener(SpeechInputListener* listener) |
| { |
| #if defined(DEBUG) |
| // Check if already present. |
| - for (HashMap<int, InputFieldSpeechButtonElement*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) |
| + for (HashMap<int, SpeechInputListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) |
| ASSERT(it->value != listener); |
| #endif |
| @@ -121,6 +121,11 @@ const char* SpeechInput::supplementName() |
| return "SpeechInput"; |
| } |
| +void SpeechInput::trace(Visitor* visitor) |
| +{ |
| + visitor->registerWeakMembers<SpeechInput, &SpeechInput::clearWeakMembers>(this); |
|
Mads Ager (chromium)
2014/04/29 14:56:09
Thanks for moving this to the right place. :)
|
| +} |
| + |
| void provideSpeechInputTo(Page& page, PassOwnPtr<SpeechInputClient> client) |
| { |
| SpeechInput::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client)); |
| @@ -129,8 +134,8 @@ void provideSpeechInputTo(Page& page, PassOwnPtr<SpeechInputClient> client) |
| void SpeechInput::clearWeakMembers(Visitor* visitor) |
| { |
| Vector<int> deadListenerIds; |
| - HashMap<int, InputFieldSpeechButtonElement*>::const_iterator end = m_listeners.end(); |
| - for (HashMap<int, InputFieldSpeechButtonElement*>::const_iterator it = m_listeners.begin(); it != end; ++it) { |
| + WillBeHeapHashMap<int, RawPtrWillBeWeakMember<SpeechInputListener> >::const_iterator end = m_listeners.end(); |
| + for (WillBeHeapHashMap<int, RawPtrWillBeWeakMember<SpeechInputListener> >::const_iterator it = m_listeners.begin(); it != end; ++it) { |
| if (!visitor->isAlive(it->value)) { |
| deadListenerIds.append(it->key); |
| m_client->cancelRecognition(it->key); |