Index: content/browser/device_orientation/provider_impl.h |
diff --git a/content/browser/device_orientation/provider_impl.h b/content/browser/device_orientation/provider_impl.h |
index c7c12eb4dce6651e6dc315caa3a91e08a239ffd5..286a61fade3388682e2812f5b1652c1e55cf7cd5 100644 |
--- a/content/browser/device_orientation/provider_impl.h |
+++ b/content/browser/device_orientation/provider_impl.h |
@@ -8,11 +8,12 @@ |
#include <set> |
#include <vector> |
+#include "base/id_map.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "base/time.h" |
#include "content/browser/device_orientation/data_fetcher.h" |
-#include "content/browser/device_orientation/orientation.h" |
+#include "content/browser/device_orientation/device_data.h" |
#include "content/browser/device_orientation/provider.h" |
#include "content/common/content_export.h" |
@@ -29,7 +30,7 @@ class ProviderImpl : public Provider { |
typedef DataFetcher* (*DataFetcherFactory)(); |
// Create a ProviderImpl that uses the NULL-terminated factories array to find |
- // a DataFetcher that can provide orientation data. |
+ // a DataFetcher that can provide data. |
CONTENT_EXPORT ProviderImpl(const DataFetcherFactory factories[]); |
// From Provider. |
@@ -43,23 +44,27 @@ class ProviderImpl : public Provider { |
void Start(); |
void Stop(); |
+ // Method for adding a type of observer to poll. Runs on the polling_thread_. |
hans
2012/07/18 17:21:02
we're not really polling the observers, though? Ma
aousterh
2012/07/20 11:18:52
Done. I also renamed the function and member obser
|
+ void DoAddObserverType(DeviceData::Type device_data_type); |
+ void ScheduleDoAddObserverType(DeviceData::Type device_data_type); |
+ |
// Method for finding a suitable DataFetcher and starting the polling. |
// Runs on the polling_thread_. |
void DoInitializePollingThread( |
- const std::vector<DataFetcherFactory>& factories); |
- void ScheduleInitializePollingThread(); |
+ const std::vector<DataFetcherFactory>& factories, |
+ DeviceData::Type device_data_type); |
+ void ScheduleInitializePollingThread(DeviceData::Type device_data_type); |
// Method for polling a DataFetcher. Runs on the polling_thread_. |
void DoPoll(); |
void ScheduleDoPoll(); |
- // Method for notifying observers of an orientation update. |
+ // Method for notifying observers of a data update. |
// Runs on the creator_thread_. |
- void DoNotify(const Orientation& orientation); |
- void ScheduleDoNotify(const Orientation& orientation); |
- |
- static bool SignificantlyDifferent(const Orientation& orientation1, |
- const Orientation& orientation2); |
+ void DoNotify(const DeviceData* device_data, |
+ DeviceData::Type device_data_type); |
+ void ScheduleDoNotify(const DeviceData* device_data, |
+ DeviceData::Type device_data_type); |
enum { kDesiredSamplingIntervalMs = 100 }; |
base::TimeDelta SamplingInterval() const; |
@@ -71,13 +76,14 @@ class ProviderImpl : public Provider { |
// Members below are only to be used from the creator_loop_. |
std::vector<DataFetcherFactory> factories_; |
std::set<Observer*> observers_; |
- Orientation last_notification_; |
+ IDMap<DeviceData, IDMapOwnPointer> last_notifications_map_; |
hans
2012/07/18 17:21:02
I'm not sure IDMap is the best for this. Could we
aousterh
2012/07/20 11:18:52
I used IDMap because it's not possible to use std:
|
// When polling_thread_ is running, members below are only to be used |
// from that thread. |
scoped_ptr<DataFetcher> data_fetcher_; |
- Orientation last_orientation_; |
+ scoped_ptr<IDMap<DeviceData, IDMapOwnPointer> > last_device_data_map_; |
hans
2012/07/18 17:21:02
same here
aousterh
2012/07/20 11:18:52
Done.
|
base::WeakPtrFactory<ProviderImpl> weak_factory_; |
+ std::set<DeviceData::Type> observer_types_; |
// Polling is done on this background thread. |
scoped_ptr<base::Thread> polling_thread_; |