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

Side by Side Diff: content/browser/device_orientation/provider_impl.h

Issue 13243003: Move MessageLoop to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/histogram_synchronizer.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_ 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "content/browser/device_orientation/data_fetcher.h" 14 #include "content/browser/device_orientation/data_fetcher.h"
15 #include "content/browser/device_orientation/device_data.h" 15 #include "content/browser/device_orientation/device_data.h"
16 #include "content/browser/device_orientation/provider.h" 16 #include "content/browser/device_orientation/provider.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 18
19 namespace base {
19 class MessageLoop; 20 class MessageLoop;
21 }
20 22
21 namespace content { 23 namespace content {
22 24
23 class ProviderImpl : public Provider { 25 class ProviderImpl : public Provider {
24 public: 26 public:
25 typedef DataFetcher* (*DataFetcherFactory)(); 27 typedef DataFetcher* (*DataFetcherFactory)();
26 28
27 // Create a ProviderImpl that uses the factory to create a DataFetcher that 29 // Create a ProviderImpl that uses the factory to create a DataFetcher that
28 // can provide data. A NULL DataFetcherFactory indicates that there are no 30 // can provide data. A NULL DataFetcherFactory indicates that there are no
29 // DataFetchers for this OS. 31 // DataFetchers for this OS.
(...skipping 18 matching lines...) Expand all
48 // Method for notifying observers of a data update. 50 // Method for notifying observers of a data update.
49 // Runs on the creator_thread_. 51 // Runs on the creator_thread_.
50 void DoNotify(const scoped_refptr<const DeviceData>& data, 52 void DoNotify(const scoped_refptr<const DeviceData>& data,
51 DeviceData::Type device_data_type); 53 DeviceData::Type device_data_type);
52 54
53 static bool ShouldFireEvent(const DeviceData* old_data, 55 static bool ShouldFireEvent(const DeviceData* old_data,
54 const DeviceData* new_data, DeviceData::Type device_data_type); 56 const DeviceData* new_data, DeviceData::Type device_data_type);
55 57
56 // The Message Loop on which this object was created. 58 // The Message Loop on which this object was created.
57 // Typically the I/O loop, but may be something else during testing. 59 // Typically the I/O loop, but may be something else during testing.
58 MessageLoop* creator_loop_; 60 base::MessageLoop* creator_loop_;
59 61
60 // Members below are only to be used from the creator_loop_. 62 // Members below are only to be used from the creator_loop_.
61 DataFetcherFactory factory_; 63 DataFetcherFactory factory_;
62 std::set<Observer*> observers_; 64 std::set<Observer*> observers_;
63 std::map<DeviceData::Type, scoped_refptr<const DeviceData> > 65 std::map<DeviceData::Type, scoped_refptr<const DeviceData> >
64 last_notifications_map_; 66 last_notifications_map_;
65 67
66 // When polling_thread_ is running, members below are only to be used 68 // When polling_thread_ is running, members below are only to be used
67 // from that thread. 69 // from that thread.
68 base::WeakPtrFactory<ProviderImpl> weak_factory_; 70 base::WeakPtrFactory<ProviderImpl> weak_factory_;
69 71
70 // Polling is done on this background thread. PollingThread is owned by 72 // Polling is done on this background thread. PollingThread is owned by
71 // the ProviderImpl object. But its deletion doesn't happen synchronously 73 // the ProviderImpl object. But its deletion doesn't happen synchronously
72 // along with deletion of the ProviderImpl. Thus this should be a raw 74 // along with deletion of the ProviderImpl. Thus this should be a raw
73 // pointer instead of scoped_ptr. 75 // pointer instead of scoped_ptr.
74 PollingThread* polling_thread_; 76 PollingThread* polling_thread_;
75 }; 77 };
76 78
77 } // namespace content 79 } // namespace content
78 80
79 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_ 81 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/histogram_synchronizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698