Chromium Code Reviews| Index: content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
| diff --git a/content/browser/screen_orientation/screen_orientation_message_filter_android.cc b/content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
| index cd7bd186a22fadbcaba9f140079363aba1250d1d..fc3dd7a4da358f7917fc5f21cc523fbd6284157c 100644 |
| --- a/content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
| +++ b/content/browser/screen_orientation/screen_orientation_message_filter_android.cc |
| @@ -6,40 +6,38 @@ |
| #include "content/browser/screen_orientation/screen_orientation_delegate_android.h" |
| #include "content/common/screen_orientation_messages.h" |
| +#include "content/public/browser/browser_thread.h" |
| namespace content { |
| ScreenOrientationMessageFilterAndroid::ScreenOrientationMessageFilterAndroid() |
| - : BrowserMessageFilter(ScreenOrientationMsgStart) |
| - , listeners_count_(0) { |
| -} |
| + : BrowserMessageFilter(ScreenOrientationMsgStart), |
| + BrowserAssociatedInterface<device::mojom::ScreenOrientationAccurate>( |
| + this, |
| + this), |
| + listeners_count_(0) {} |
| ScreenOrientationMessageFilterAndroid::~ScreenOrientationMessageFilterAndroid() |
| { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
|
blundell
2016/12/20 13:39:18
Let's use a base::ThreadChecker instead since we'l
leonhsl(Using Gerrit)
2016/12/21 02:48:36
Done.
Because ScreenOrientationMessageFilterAndroi
|
| if (listeners_count_ > 0) |
| ScreenOrientationDelegateAndroid::StopAccurateListening(); |
| } |
| bool ScreenOrientationMessageFilterAndroid::OnMessageReceived( |
| const IPC::Message& message) { |
| - bool handled = true; |
| - IPC_BEGIN_MESSAGE_MAP(ScreenOrientationMessageFilterAndroid, message) |
| - IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_StartListening, |
| - OnStartListening) |
| - IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_StopListening, |
| - OnStopListening) |
| - IPC_MESSAGE_UNHANDLED(handled = false) |
| - IPC_END_MESSAGE_MAP() |
| - return handled; |
| + return false; |
| } |
| -void ScreenOrientationMessageFilterAndroid::OnStartListening() { |
| +void ScreenOrientationMessageFilterAndroid::StartListening() { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| ++listeners_count_; |
| if (listeners_count_ == 1) |
| ScreenOrientationDelegateAndroid::StartAccurateListening(); |
| } |
| -void ScreenOrientationMessageFilterAndroid::OnStopListening() { |
| +void ScreenOrientationMessageFilterAndroid::StopListening() { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| DCHECK(listeners_count_ > 0); |
| --listeners_count_; |
| if (listeners_count_ == 0) |