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

Side by Side Diff: content/renderer/screen_orientation/screen_orientation_observer.cc

Issue 613203002: Have PlatformEventObserver implementations orderly stop on destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/screen_orientation/screen_orientation_observer.h" 5 #include "content/renderer/screen_orientation/screen_orientation_observer.h"
6 6
7 #include "content/common/screen_orientation_messages.h" 7 #include "content/common/screen_orientation_messages.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 ScreenOrientationObserver::ScreenOrientationObserver() { 11 ScreenOrientationObserver::ScreenOrientationObserver() {
12 } 12 }
13 13
14 ScreenOrientationObserver::~ScreenOrientationObserver() {
15 StopIfObserving();
16 }
17
14 void ScreenOrientationObserver::Start( 18 void ScreenOrientationObserver::Start(
15 blink::WebPlatformEventListener* listener) { 19 blink::WebPlatformEventListener* listener) {
16 // This should never be called with a proper listener. 20 // This should never be called with a proper listener.
17 CHECK(listener == 0); 21 CHECK(listener == 0);
18 PlatformEventObserver<blink::WebPlatformEventListener>::Start(0); 22 PlatformEventObserver<blink::WebPlatformEventListener>::Start(0);
19 } 23 }
20 24
21 void ScreenOrientationObserver::SendStartMessage() { 25 void ScreenOrientationObserver::SendStartMessage() {
22 RenderThread::Get()->Send(new ScreenOrientationHostMsg_StartListening()); 26 RenderThread::Get()->Send(new ScreenOrientationHostMsg_StartListening());
23 } 27 }
24 28
25 void ScreenOrientationObserver::SendStopMessage() { 29 void ScreenOrientationObserver::SendStopMessage() {
26 RenderThread::Get()->Send(new ScreenOrientationHostMsg_StopListening()); 30 RenderThread::Get()->Send(new ScreenOrientationHostMsg_StopListening());
27 } 31 }
28 32
29 } // namespace content 33 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698