| Index: content/browser/speech/speech_recognition_dispatcher_host.h
|
| diff --git a/content/browser/speech/speech_recognition_dispatcher_host.h b/content/browser/speech/speech_recognition_dispatcher_host.h
|
| index b50f260958d5156c00b690992de672d3c6ec18a9..e74447139a9e76e57ea7e982a6dc53ab86b729e3 100644
|
| --- a/content/browser/speech/speech_recognition_dispatcher_host.h
|
| +++ b/content/browser/speech/speech_recognition_dispatcher_host.h
|
| @@ -6,6 +6,7 @@
|
| #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "content/common/content_export.h"
|
| #include "content/public/browser/browser_message_filter.h"
|
| #include "content/public/browser/speech_recognition_event_listener.h"
|
| @@ -31,6 +32,8 @@ class CONTENT_EXPORT SpeechRecognitionDispatcherHost
|
| int render_process_id,
|
| net::URLRequestContextGetter* context_getter);
|
|
|
| + base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr();
|
| +
|
| // SpeechRecognitionEventListener methods.
|
| virtual void OnRecognitionStart(int session_id) OVERRIDE;
|
| virtual void OnAudioStart(int session_id) OVERRIDE;
|
| @@ -56,6 +59,8 @@ class CONTENT_EXPORT SpeechRecognitionDispatcherHost
|
| const IPC::Message& message,
|
| BrowserThread::ID* thread) OVERRIDE;
|
|
|
| + virtual void OnChannelClosing() OVERRIDE;
|
| +
|
| private:
|
| virtual ~SpeechRecognitionDispatcherHost();
|
|
|
| @@ -73,6 +78,11 @@ class CONTENT_EXPORT SpeechRecognitionDispatcherHost
|
| int render_process_id_;
|
| scoped_refptr<net::URLRequestContextGetter> context_getter_;
|
|
|
| + // Used for posting asynchronous tasks (on the IO thread) without worrying
|
| + // about this class being destroyed in the meanwhile (due to browser shutdown)
|
| + // since tasks pending on a destroyed WeakPtr are automatically discarded.
|
| + base::WeakPtrFactory<SpeechRecognitionDispatcherHost> weak_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcherHost);
|
| };
|
|
|
|
|