OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
6 #define CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/synchronization/lock.h" |
9 #include "chrome/browser/speech/tts_controller.h" | 10 #include "chrome/browser/speech/tts_controller.h" |
10 #include "chrome/common/tts_messages.h" | 11 #include "chrome/common/tts_messages.h" |
11 #include "content/public/browser/browser_message_filter.h" | 12 #include "content/public/browser/browser_message_filter.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class BrowserContext; | 15 class BrowserContext; |
15 } | 16 } |
16 | 17 |
17 class TtsMessageFilter | 18 class TtsMessageFilter |
18 : public content::BrowserMessageFilter, | 19 : public content::BrowserMessageFilter, |
(...skipping 26 matching lines...) Expand all Loading... |
45 ~TtsMessageFilter() override; | 46 ~TtsMessageFilter() override; |
46 | 47 |
47 void OnInitializeVoiceList(); | 48 void OnInitializeVoiceList(); |
48 void OnSpeak(const TtsUtteranceRequest& utterance); | 49 void OnSpeak(const TtsUtteranceRequest& utterance); |
49 void OnPause(); | 50 void OnPause(); |
50 void OnResume(); | 51 void OnResume(); |
51 void OnCancel(); | 52 void OnCancel(); |
52 | 53 |
53 void OnChannelClosingInUIThread(); | 54 void OnChannelClosingInUIThread(); |
54 | 55 |
| 56 void Cleanup(); |
| 57 |
| 58 // Thread-safe check to make sure this class is still valid and not |
| 59 // about to be deleted. |
| 60 bool Valid(); |
| 61 |
55 int render_process_id_; | 62 int render_process_id_; |
56 content::BrowserContext* browser_context_; | 63 content::BrowserContext* browser_context_; |
57 | 64 mutable base::Lock mutex_; |
58 base::WeakPtrFactory<TtsMessageFilter> weak_ptr_factory_; | 65 mutable bool valid_; |
59 | 66 |
60 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); | 67 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); |
61 }; | 68 }; |
62 | 69 |
63 #endif // CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 70 #endif // CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
OLD | NEW |