1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 8eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/time/time.h" 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/public/renderer/render_view_observer.h" 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace content { 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class RenderViewImpl; 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Collect timing information for page loads. 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// If a Renderview performs multiple loads, only the first one is recorded. 17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class StatsCollectionObserver : public RenderViewObserver { 18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) explicit StatsCollectionObserver(RenderViewImpl* render_view); 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~StatsCollectionObserver(); 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // RenderViewObserver implementation 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual void DidStartLoading() OVERRIDE; 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual void DidStopLoading() OVERRIDE; 25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Timing for the page load start and stop. These functions may return 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // a null time value under various circumstances. 28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const base::Time& load_start_time() { return start_time_; } 29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const base::Time& load_stop_time() { return stop_time_; } 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private: 32f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) base::Time start_time_; 33f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) base::Time stop_time_; 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(StatsCollectionObserver); 36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} // namespace content 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif // CONTENT_RENDERER_STATS_COLLECTION_OBSERVER_H_ 41