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

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

Issue 255983003: Oilpan: Move all supplements of Page, Document, and WorkerClients to the managed heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review 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
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)
haraken 2014/04/30 11:18:08 This could be WillBeHeapHashMap<int, RawPtrWillBeW
zerny-chromium 2014/04/30 11:46:53 And it should be. Thanks for spotting 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);

Powered by Google App Engine
This is Rietveld 408576698