Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 namespace api { | |
| 17 namespace experimental_system_info_cpu { | |
|
benwells
2012/09/21 08:19:50
Nit: extra blank lines after each namespace statem
Hongbo Min
2012/09/21 09:00:23
Done.
| |
| 18 struct CpuUpdateInfo; | |
| 19 } | |
| 20 } | |
| 21 | |
| 16 // Event router for systemInfo API. It is a singleton instance shared by | 22 // Event router for systemInfo API. It is a singleton instance shared by |
| 17 // multiple profiles. | 23 // multiple profiles. |
| 18 // TODO(hongbo): It should derive from SystemMonitor::DevicesChangedObserver. | 24 // TODO(hongbo): It should derive from SystemMonitor::DevicesChangedObserver. |
| 19 // Since the system_monitor will be refactored along with media_gallery, once | 25 // Since the system_monitor will be refactored along with media_gallery, once |
| 20 // http://crbug.com/145400 is fixed, we need to update SystemInfoEventRouter | 26 // http://crbug.com/145400 is fixed, we need to update SystemInfoEventRouter |
| 21 // accordingly. | 27 // accordingly. |
| 22 class SystemInfoEventRouter { | 28 class SystemInfoEventRouter { |
| 23 public: | 29 public: |
| 24 static SystemInfoEventRouter* GetInstance(); | 30 static SystemInfoEventRouter* GetInstance(); |
| 25 | 31 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 39 const string16& name, | 45 const string16& name, |
| 40 const FilePath::StringType& location); | 46 const FilePath::StringType& location); |
| 41 void OnRemovableStorageDetached(const std::string& id); | 47 void OnRemovableStorageDetached(const std::string& id); |
| 42 | 48 |
| 43 private: | 49 private: |
| 44 friend struct DefaultSingletonTraits<SystemInfoEventRouter>; | 50 friend struct DefaultSingletonTraits<SystemInfoEventRouter>; |
| 45 | 51 |
| 46 SystemInfoEventRouter(); | 52 SystemInfoEventRouter(); |
| 47 virtual ~SystemInfoEventRouter(); | 53 virtual ~SystemInfoEventRouter(); |
| 48 | 54 |
| 49 // Called on the UI thread to dispatch the systemInfo event to all extension | 55 // Called from any thread to dispatch the systemInfo event to all extension |
| 50 // processes cross multiple profiles. | 56 // processes cross multiple profiles. |
| 51 void DispatchEvent(const std::string& event_name, | 57 void DispatchEvent(const std::string& event_name, |
| 52 scoped_ptr<base::ListValue> args); | 58 scoped_ptr<base::ListValue> args); |
| 53 | 59 |
| 60 // The callback for CPU sampling cycle. Can be called from any thread. | |
|
benwells
2012/09/21 08:19:50
Is this just called from the FILE thread now?
Hongbo Min
2012/09/21 09:00:23
Yes.
benwells
2012/09/25 17:32:13
Can you updated the comment then?
| |
| 61 void OnNextCpuSampling( | |
| 62 scoped_ptr<api::experimental_system_info_cpu::CpuUpdateInfo> info); | |
| 63 | |
| 54 // Used to record the event names being watched. | 64 // Used to record the event names being watched. |
| 55 std::multiset<std::string> watching_event_set_; | 65 std::multiset<std::string> watching_event_set_; |
| 56 | 66 |
| 57 DISALLOW_COPY_AND_ASSIGN(SystemInfoEventRouter); | 67 DISALLOW_COPY_AND_ASSIGN(SystemInfoEventRouter); |
| 58 }; | 68 }; |
| 59 | 69 |
| 60 } // namespace extensions | 70 } // namespace extensions |
| 61 | 71 |
| 62 #endif // CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ |
| OLD | NEW |