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

Side by Side Diff: statsreport/aggregator-win32.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 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 | « statsreport/aggregator.cc ('k') | statsreport/aggregator-win32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2006-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15 //
16 // Win32 aggregator, which aggregates counters to registry under a named
17 // Mutex lock.
18 #ifndef OMAHA_STATSREPORT_AGGREGATOR_WIN32_H__
19 #define OMAHA_STATSREPORT_AGGREGATOR_WIN32_H__
20
21 #include "aggregator.h"
22 #include <atlbase.h>
23 #include <atlstr.h>
24
25 namespace stats_report {
26
27 class MetricsAggregatorWin32: public MetricsAggregator {
28 public:
29 /// @param coll the metrics collection to aggregate, most usually this
30 /// is g_global_metrics.
31 /// @param app_name name of the subkey under HKCU\Software\Google we
32 /// aggregate to.
33 MetricsAggregatorWin32(MetricCollection &coll,
34 const wchar_t *app_name);
35
36 /// @param is_machine specifies the registry hive where the stats are
37 /// aggregated to.
38 MetricsAggregatorWin32(MetricCollection &coll,
39 const wchar_t *app_name,
40 bool is_machine);
41 virtual ~MetricsAggregatorWin32();
42
43 protected:
44 virtual bool StartAggregation();
45 virtual void EndAggregation();
46
47 virtual void Aggregate(CountMetric &metric);
48 virtual void Aggregate(TimingMetric &metric);
49 virtual void Aggregate(IntegerMetric &metric);
50 virtual void Aggregate(BoolMetric &metric);
51 private:
52 enum {
53 /// Max length of time we wait for the mutex on StartAggregation.
54 kMaxMutexWaitMs = 1000, // 1 second for now
55 };
56
57 /// Ensures that *key is open, opening it if it's NULL
58 /// @return true on success, false on failure to open key
59 bool EnsureKey(const wchar_t *name, CRegKey *key);
60
61 /// Mutex name for locking access to key
62 CString mutex_name_;
63
64 /// Subkey name, as per constructor docs
65 CString key_name_;
66
67 /// Handle to our subkey under HKCU\Software\Google
68 CRegKey key_;
69
70 /// Subkeys under the above
71 /// @{
72 CRegKey count_key_;
73 CRegKey timing_key_;
74 CRegKey integer_key_;
75 CRegKey bool_key_;
76 /// @}
77
78 /// Specifies HKLM or HKCU, respectively.
79 bool is_machine_;
80
81 DISALLOW_EVIL_CONSTRUCTORS(MetricsAggregatorWin32);
82 };
83
84 } // namespace stats_report
85
86 #endif // OMAHA_STATSREPORT_AGGREGATOR_WIN32_H__
OLDNEW
« no previous file with comments | « statsreport/aggregator.cc ('k') | statsreport/aggregator-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698