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

Side by Side Diff: third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp

Issue 1981233003: Finish migration from sameThreadBindForMojo to createBaseCallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/geolocation/Geolocation.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "modules/battery/BatteryDispatcher.h" 5 #include "modules/battery/BatteryDispatcher.h"
6 6
7 #include "platform/mojo/MojoHelper.h" 7 #include "platform/mojo/MojoHelper.h"
8 #include "public/platform/Platform.h" 8 #include "public/platform/Platform.h"
9 #include "public/platform/ServiceRegistry.h" 9 #include "public/platform/ServiceRegistry.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
11 #include "wtf/PassOwnPtr.h" 11 #include "wtf/PassOwnPtr.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 BatteryDispatcher& BatteryDispatcher::instance() 15 BatteryDispatcher& BatteryDispatcher::instance()
16 { 16 {
17 DEFINE_STATIC_LOCAL(BatteryDispatcher, batteryDispatcher, (new BatteryDispat cher)); 17 DEFINE_STATIC_LOCAL(BatteryDispatcher, batteryDispatcher, (new BatteryDispat cher));
18 return batteryDispatcher; 18 return batteryDispatcher;
19 } 19 }
20 20
21 BatteryDispatcher::BatteryDispatcher() 21 BatteryDispatcher::BatteryDispatcher()
22 : m_hasLatestData(false) 22 : m_hasLatestData(false)
23 { 23 {
24 } 24 }
25 25
26 void BatteryDispatcher::queryNextStatus() 26 void BatteryDispatcher::queryNextStatus()
27 { 27 {
28 m_monitor->QueryNextStatus( 28 m_monitor->QueryNextStatus(createBaseCallback(bind<device::blink::BatterySta tusPtr>(&BatteryDispatcher::onDidChange, this)));
29 sameThreadBindForMojo(&BatteryDispatcher::onDidChange, this));
30 } 29 }
31 30
32 void BatteryDispatcher::onDidChange(device::blink::BatteryStatusPtr batteryStatu s) 31 void BatteryDispatcher::onDidChange(device::blink::BatteryStatusPtr batteryStatu s)
33 { 32 {
34 queryNextStatus(); 33 queryNextStatus();
35 34
36 ASSERT(batteryStatus); 35 ASSERT(batteryStatus);
37 36
38 updateBatteryStatus(BatteryStatus( 37 updateBatteryStatus(BatteryStatus(
39 batteryStatus->charging, 38 batteryStatus->charging,
(...skipping 17 matching lines...) Expand all
57 queryNextStatus(); 56 queryNextStatus();
58 } 57 }
59 58
60 void BatteryDispatcher::stopListening() 59 void BatteryDispatcher::stopListening()
61 { 60 {
62 m_monitor.reset(); 61 m_monitor.reset();
63 m_hasLatestData = false; 62 m_hasLatestData = false;
64 } 63 }
65 64
66 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/geolocation/Geolocation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698