OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_STATS_COLLECTION_CONTROLLER_H_ | 5 #ifndef CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ |
6 #define CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ | 6 #define CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "gin/wrappable.h" | 9 #include "gin/wrappable.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 class WebFrame; | 12 class WebFrame; |
13 } | 13 } |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 // This class is exposed in JS as window.statsCollectionController and provides | 17 // This class is exposed in JS as window.statsCollectionController and provides |
18 // functionality to read out statistics from the browser. | 18 // functionality to read out statistics from the browser. |
19 // Its use must be enabled specifically via the | 19 // Its use must be enabled specifically via the |
20 // --enable-stats-collection-bindings command line flag. | 20 // --enable-stats-collection-bindings command line flag. |
21 class StatsCollectionController | 21 class StatsCollectionController |
22 : public gin::Wrappable<StatsCollectionController> { | 22 : public gin::Wrappable<StatsCollectionController> { |
23 public: | 23 public: |
24 static gin::WrapperInfo kWrapperInfo; | 24 static gin::WrapperInfo kWrapperInfo; |
25 | 25 |
26 static void Install(blink::WebFrame* frame); | 26 static void Install(blink::WebFrame* frame); |
27 | 27 |
28 private: | 28 private: |
| 29 friend class gin::Wrappable<StatsCollectionController>; |
| 30 static v8::Local<v8::ObjectTemplate> GetObjectTemplate(v8::Isolate* isolate); |
| 31 |
29 StatsCollectionController(); | 32 StatsCollectionController(); |
30 virtual ~StatsCollectionController(); | 33 virtual ~StatsCollectionController(); |
31 | 34 |
32 // Retrieves a histogram and returns a JSON representation of it. | 35 // Retrieves a histogram and returns a JSON representation of it. |
33 std::string GetHistogram(const std::string& histogram_name); | 36 std::string GetHistogram(const std::string& histogram_name); |
34 | 37 |
35 // Retrieves a histogram from the browser process and returns a JSON | 38 // Retrieves a histogram from the browser process and returns a JSON |
36 // representation of it. | 39 // representation of it. |
37 std::string GetBrowserHistogram(const std::string& histogram_name); | 40 std::string GetBrowserHistogram(const std::string& histogram_name); |
38 | 41 |
39 // Returns JSON representation of tab timing information for the current tab. | 42 // Returns JSON representation of tab timing information for the current tab. |
40 std::string GetTabLoadTiming(); | 43 std::string GetTabLoadTiming(); |
41 | 44 |
42 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController); | 45 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController); |
43 }; | 46 }; |
44 | 47 |
45 } // namespace content | 48 } // namespace content |
46 | 49 |
47 #endif // CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ | 50 #endif // CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ |
OLD | NEW |