| 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_OBSERVER_H_ | 5 #ifndef CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ |
| 6 #define CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ | 6 #define CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/public/renderer/render_view_observer.h" | 9 #include "content/public/renderer/render_view_observer.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 class RenderViewImpl; | 13 class RenderViewImpl; |
| 14 | 14 |
| 15 // Collect timing information for page loads. | 15 // Collect timing information for page loads. |
| 16 // If a Renderview performs multiple loads, only the first one is recorded. | 16 // If a Renderview performs multiple loads, only the first one is recorded. |
| 17 class StatsCollectionObserver : public RenderViewObserver { | 17 class StatsCollectionObserver : public RenderViewObserver { |
| 18 public: | 18 public: |
| 19 explicit StatsCollectionObserver(RenderViewImpl* render_view); | 19 explicit StatsCollectionObserver(RenderViewImpl* render_view); |
| 20 virtual ~StatsCollectionObserver(); | 20 ~StatsCollectionObserver() override; |
| 21 | 21 |
| 22 // RenderViewObserver implementation | 22 // RenderViewObserver implementation |
| 23 virtual void DidStartLoading() override; | 23 void DidStartLoading() override; |
| 24 virtual void DidStopLoading() override; | 24 void DidStopLoading() override; |
| 25 | 25 |
| 26 // Timing for the page load start and stop. These functions may return | 26 // Timing for the page load start and stop. These functions may return |
| 27 // a null time value under various circumstances. | 27 // a null time value under various circumstances. |
| 28 const base::Time& load_start_time() { return start_time_; } | 28 const base::Time& load_start_time() { return start_time_; } |
| 29 const base::Time& load_stop_time() { return stop_time_; } | 29 const base::Time& load_stop_time() { return stop_time_; } |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 base::Time start_time_; | 32 base::Time start_time_; |
| 33 base::Time stop_time_; | 33 base::Time stop_time_; |
| 34 | 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(StatsCollectionObserver); | 35 DISALLOW_COPY_AND_ASSIGN(StatsCollectionObserver); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace content | 38 } // namespace content |
| 39 | 39 |
| 40 #endif // CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ | 40 #endif // CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ |
| OLD | NEW |