1 : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "chrome/common/chrome_counters.h"
6 :
7 : #include "base/stats_counters.h"
8 :
9 : namespace chrome {
10 :
11 : // Note: We use the construct-on-first-use pattern here, because we don't
12 : // want to fight with any static initializer ordering problems later.
13 : // The downside of this is that the objects don't ever get cleaned up.
14 : // But they are small and this is okay.
15 :
16 : // Note: Because these are constructed on-first-use, there is a slight
17 : // race condition - two threads could initialize the same counter.
18 : // If this happened, the stats table would still work just fine;
19 : // we'd leak the extraneous StatsCounter object once, and that
20 : // would be it. But these are small objects, so this is ok.
21 :
22 0 : StatsCounter& Counters::ipc_send_counter() {
23 0 : static StatsCounter* ctr = new StatsCounter("IPC.SendMsgCount");
24 0 : return *ctr;
25 : }
26 :
27 0 : StatsCounterTimer& Counters::chrome_main() {
28 0 : static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.Init");
29 0 : return *ctr;
30 : }
31 :
32 0 : StatsCounterTimer& Counters::renderer_main() {
33 0 : static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.RendererInit");
34 0 : return *ctr;
35 : }
36 :
37 0 : StatsCounterTimer& Counters::spellcheck_init() {
38 0 : static StatsCounterTimer* ctr = new StatsCounterTimer("SpellCheck.Init");
39 0 : return *ctr;
40 : }
41 :
42 0 : StatsRate& Counters::spellcheck_lookup() {
43 0 : static StatsRate* ctr = new StatsRate("SpellCheck.Lookup");
44 0 : return *ctr;
45 : }
46 :
47 0 : StatsCounterTimer& Counters::plugin_load() {
48 0 : static StatsCounterTimer* ctr = new StatsCounterTimer("ChromePlugin.Load");
49 0 : return *ctr;
50 : }
51 :
52 0 : StatsRate& Counters::plugin_intercept() {
53 0 : static StatsRate* ctr = new StatsRate("ChromePlugin.Intercept");
54 0 : return *ctr;
55 : }
56 :
57 : } // namespace chrome
|