Index: Source/core/speech/SpeechInput.cpp |
diff --git a/Source/core/speech/SpeechInput.cpp b/Source/core/speech/SpeechInput.cpp |
index ea7c449b276e4fa121579b717bf5cef04f6fdf0f..8870b7c7ba39b381294b9a7fe118e3b29e88979b 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 (WillBeHeapHashMap<int, RawPtrWillBeWeakMember<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); |
+} |
+ |
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); |