Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1287)

Unified Diff: Source/core/speech/SpeechInput.cpp

Issue 235113002: Oilpan: Remove guardRef and guardDeref from TreeScope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/speech/SpeechInput.h ('k') | Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/speech/SpeechInput.cpp
diff --git a/Source/core/speech/SpeechInput.cpp b/Source/core/speech/SpeechInput.cpp
index 03aeb1c2c5a3c61b104a20353418e3386a447ccc..ea7c449b276e4fa121579b717bf5cef04f6fdf0f 100644
--- a/Source/core/speech/SpeechInput.cpp
+++ b/Source/core/speech/SpeechInput.cpp
@@ -33,6 +33,7 @@
#if ENABLE(INPUT_SPEECH)
+#include "core/html/shadow/TextControlInnerElements.h"
#include "core/speech/SpeechInputClient.h"
#include "wtf/PassOwnPtr.h"
@@ -55,11 +56,11 @@ PassOwnPtr<SpeechInput> SpeechInput::create(PassOwnPtr<SpeechInputClient> client
return adoptPtr(new SpeechInput(client));
}
-int SpeechInput::registerListener(SpeechInputListener* listener)
+int SpeechInput::registerListener(InputFieldSpeechButtonElement* listener)
{
#if defined(DEBUG)
// Check if already present.
- for (HashMap<int, SpeechInputListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
+ for (HashMap<int, InputFieldSpeechButtonElement*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
ASSERT(it->value != listener);
#endif
@@ -125,6 +126,20 @@ void provideSpeechInputTo(Page& page, PassOwnPtr<SpeechInputClient> client)
SpeechInput::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(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) {
+ if (!visitor->isAlive(it->value)) {
+ deadListenerIds.append(it->key);
+ m_client->cancelRecognition(it->key);
+ }
+ }
+ for (unsigned i = 0; i < deadListenerIds.size(); ++i)
+ m_listeners.remove(deadListenerIds[i]);
+}
+
} // namespace WebCore
#endif // ENABLE(INPUT_SPEECH)
« no previous file with comments | « Source/core/speech/SpeechInput.h ('k') | Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698