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 "components/html_viewer/stats_collection_observer.h" | |
| 9 #include "gin/wrappable.h" | 10 #include "gin/wrappable.h" |
| 11 #include "mojo/services/tracing/tracing.mojom.h" | |
| 10 | 12 |
| 11 namespace blink { | 13 namespace blink { |
| 12 class WebFrame; | 14 class WebFrame; |
| 13 } | 15 } |
| 14 | 16 |
| 15 namespace content { | 17 namespace mojo { |
| 18 class ApplicationImpl; | |
| 19 } | |
| 20 | |
| 21 namespace html_viewer { | |
| 16 | 22 |
| 17 // This class is exposed in JS as window.statsCollectionController and provides | 23 // This class is exposed in JS as window.statsCollectionController and provides |
| 18 // functionality to read out statistics from the browser. | 24 // functionality to read out statistics from the browser. |
| 19 // Its use must be enabled specifically via the | 25 // Its use must be enabled specifically via the |
| 20 // --enable-stats-collection-bindings command line flag. | 26 // --enable-stats-collection-bindings command line flag. |
| 21 class StatsCollectionController | 27 class StatsCollectionController |
| 22 : public gin::Wrappable<StatsCollectionController> { | 28 : public gin::Wrappable<StatsCollectionController> { |
| 23 public: | 29 public: |
| 24 static gin::WrapperInfo kWrapperInfo; | 30 static gin::WrapperInfo kWrapperInfo; |
| 25 | 31 |
| 26 static void Install(blink::WebFrame* frame); | 32 static StatsCollectionController* Install(HTMLDocument* html_document, |
|
sky
2015/08/12 23:54:36
Can you make this take WebFrame, which would work
yzshen1
2015/08/13 15:59:12
Please comment about the lifespan and ownership of
msw
2015/08/14 23:20:35
Done.
msw
2015/08/14 23:20:35
Done.
| |
| 33 mojo::ApplicationImpl* app); | |
| 34 | |
| 35 // Record timing for various blink::WebFrameClient events. | |
| 36 void DidHandleOnloadEvents(const base::Time& time); | |
| 37 void DidFirstVisuallyNonEmptyLayout(const base::Time& time); | |
| 27 | 38 |
| 28 private: | 39 private: |
| 29 StatsCollectionController(); | 40 StatsCollectionController(HTMLDocument* html_document, |
| 41 mojo::ApplicationImpl* app); | |
| 30 ~StatsCollectionController() override; | 42 ~StatsCollectionController() override; |
| 31 | 43 |
| 32 // gin::WrappableBase | 44 // gin::WrappableBase |
| 33 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 45 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 34 v8::Isolate* isolate) override; | 46 v8::Isolate* isolate) override; |
| 35 | 47 |
| 36 // Retrieves a histogram and returns a JSON representation of it. | 48 // Retrieves a histogram and returns a JSON representation of it. |
| 37 std::string GetHistogram(const std::string& histogram_name); | 49 std::string GetHistogram(const std::string& histogram_name); |
| 38 | 50 |
| 39 // Retrieves a histogram from the browser process and returns a JSON | 51 // Retrieves a browser histogram and returns a JSON representation of it. |
| 40 // representation of it. | |
| 41 std::string GetBrowserHistogram(const std::string& histogram_name); | 52 std::string GetBrowserHistogram(const std::string& histogram_name); |
| 42 | 53 |
| 43 // Returns JSON representation of tab timing information for the current tab. | 54 // Returns JSON representation of tab timing information for the current tab. |
| 44 std::string GetTabLoadTiming(); | 55 std::string GetTabLoadTiming(); |
| 45 | 56 |
| 57 StatsCollectionObserver observer_; | |
|
yzshen1
2015/08/13 15:59:12
Maybe consider merging the observer into this clas
msw
2015/08/14 23:20:34
Removed.
| |
| 58 tracing::StartupPerformanceControllerPtr startup_performance_controller_; | |
| 59 | |
| 46 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController); | 60 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController); |
| 47 }; | 61 }; |
| 48 | 62 |
| 49 } // namespace content | 63 } // namespace html_viewer |
| 50 | 64 |
| 51 #endif // CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_ | 65 #endif // COMPONENTS_HTML_VIEWER_STATS_COLLECTION_CONTROLLER_H_ |
| OLD | NEW |