Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_HTML_VIEWER_STATS_COLLECTION_CONTROLLER_H_ |
| 6 #define CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ | 6 #define COMPONENTS_HTML_VIEWER_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 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 class WebFrame; | 13 class WebFrame; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace content { | 16 namespace mojo { |
| 17 class ApplicationImpl; | |
| 18 } | |
| 19 | |
| 20 namespace html_viewer { | |
| 16 | 21 |
| 17 // This class is exposed in JS as window.statsCollectionController and provides | 22 // This class is exposed in JS as window.statsCollectionController and provides |
| 18 // functionality to read out statistics from the browser. | 23 // functionality to read out statistics from the browser. |
| 19 // Its use must be enabled specifically via the | 24 // Its use must be enabled specifically via the |
| 20 // --enable-stats-collection-bindings command line flag. | 25 // --enable-stats-collection-bindings command line flag. |
| 21 class StatsCollectionController | 26 class StatsCollectionController |
| 22 : public gin::Wrappable<StatsCollectionController> { | 27 : public gin::Wrappable<StatsCollectionController> { |
| 23 public: | 28 public: |
| 24 static gin::WrapperInfo kWrapperInfo; | 29 static gin::WrapperInfo kWrapperInfo; |
| 25 | 30 |
| 26 static void Install(blink::WebFrame* frame); | 31 // Install the JS and return a mojo:tracing InterfacePtr for stats reporting. |
| 32 // This bails and returns an invalid pointer without the command line flag. | |
|
sky
2015/08/17 20:09:30
'invalid pointer' makes it sounds like the pointer
msw
2015/08/17 21:25:50
Done.
| |
| 33 static tracing::StartupPerformanceDataCollectorPtr Install( | |
| 34 blink::WebFrame* frame, | |
| 35 mojo::ApplicationImpl* app); | |
| 27 | 36 |
| 28 private: | 37 private: |
| 29 StatsCollectionController(); | 38 explicit StatsCollectionController( |
| 39 tracing::StartupPerformanceDataCollectorPtr collector); | |
| 30 ~StatsCollectionController() override; | 40 ~StatsCollectionController() override; |
| 31 | 41 |
| 32 // gin::WrappableBase | 42 // gin::WrappableBase |
| 33 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 43 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 34 v8::Isolate* isolate) override; | 44 v8::Isolate* isolate) override; |
| 35 | 45 |
| 36 // Retrieves a histogram and returns a JSON representation of it. | 46 // Retrieves a histogram and returns a JSON representation of it. |
| 37 std::string GetHistogram(const std::string& histogram_name); | 47 std::string GetHistogram(const std::string& histogram_name); |
| 38 | 48 |
| 39 // Retrieves a histogram from the browser process and returns a JSON | 49 // Retrieves a browser histogram and returns a JSON representation of it. |
| 40 // representation of it. | |
| 41 std::string GetBrowserHistogram(const std::string& histogram_name); | 50 std::string GetBrowserHistogram(const std::string& histogram_name); |
| 42 | 51 |
| 43 // Returns JSON representation of tab timing information for the current tab. | 52 tracing::StartupPerformanceDataCollectorPtr |
| 44 std::string GetTabLoadTiming(); | 53 startup_performance_data_collector_; |
| 45 | 54 |
| 46 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController); | 55 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController); |
| 47 }; | 56 }; |
| 48 | 57 |
| 49 } // namespace content | 58 } // namespace html_viewer |
| 50 | 59 |
| 51 #endif // CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ | 60 #endif // COMPONENTS_HTML_VIEWER_STATS_COLLECTION_CONTROLLER_H_ |
| OLD | NEW |