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

Side by Side Diff: Source/modules/geolocation/GeolocationController.h

Issue 37863002: Update GeolocationController to call startUpdating() / stopUpdating() only if needed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Unskip test Created 7 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/modules/geolocation/GeolocationController.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 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void removeObserver(Geolocation*); 51 void removeObserver(Geolocation*);
52 52
53 void requestPermission(Geolocation*); 53 void requestPermission(Geolocation*);
54 void cancelPermissionRequest(Geolocation*); 54 void cancelPermissionRequest(Geolocation*);
55 55
56 void positionChanged(GeolocationPosition*); 56 void positionChanged(GeolocationPosition*);
57 void errorOccurred(GeolocationError*); 57 void errorOccurred(GeolocationError*);
58 58
59 GeolocationPosition* lastPosition(); 59 GeolocationPosition* lastPosition();
60 60
61 GeolocationClient* client() { return m_client; }
62
63 // Inherited from PageLifecycleObserver. 61 // Inherited from PageLifecycleObserver.
64 virtual void pageVisibilityChanged() OVERRIDE; 62 virtual void pageVisibilityChanged() OVERRIDE;
65 63
66 static const char* supplementName(); 64 static const char* supplementName();
67 static GeolocationController* from(Page* page) { return static_cast<Geolocat ionController*>(Supplement<Page>::from(page, supplementName())); } 65 static GeolocationController* from(Page* page) { return static_cast<Geolocat ionController*>(Supplement<Page>::from(page, supplementName())); }
68 66
69 private: 67 private:
70 GeolocationController(Page*, GeolocationClient*); 68 GeolocationController(Page*, GeolocationClient*);
71 69
70 void startUpdatingIfNeeded();
71 void stopUpdatingIfNeeded();
72
72 GeolocationClient* m_client; 73 GeolocationClient* m_client;
73 74
74 RefPtr<GeolocationPosition> m_lastPosition; 75 RefPtr<GeolocationPosition> m_lastPosition;
75 typedef HashSet<RefPtr<Geolocation> > ObserversSet; 76 typedef HashSet<RefPtr<Geolocation> > ObserversSet;
76 // All observers; both those requesting high accuracy and those not. 77 // All observers; both those requesting high accuracy and those not.
77 ObserversSet m_observers; 78 ObserversSet m_observers;
78 ObserversSet m_highAccuracyObservers; 79 ObserversSet m_highAccuracyObservers;
80 bool m_isClientUpdating;
79 }; 81 };
80 82
81 } // namespace WebCore 83 } // namespace WebCore
82 84
83 #endif // GeolocationController_h 85 #endif // GeolocationController_h
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/modules/geolocation/GeolocationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698