Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / stats_collection_observer.cc
blob4c4b911ec8cbedb9cdf0858ec590b48701c0f73a
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
3 // found in the LICENSE file.
5 #include "content/renderer/stats_collection_observer.h"
7 #include "base/time/time.h"
8 #include "content/renderer/render_view_impl.h"
10 namespace content {
12 StatsCollectionObserver::StatsCollectionObserver(RenderViewImpl* render_view)
13 : RenderViewObserver(render_view) {
16 StatsCollectionObserver::~StatsCollectionObserver() {
19 void StatsCollectionObserver::DidStartLoading() {
20 DCHECK(start_time_.is_null());
21 start_time_ = base::Time::Now();
24 void StatsCollectionObserver::DidStopLoading() {
25 DCHECK(stop_time_.is_null());
26 stop_time_ = base::Time::Now();
28 // Stop observing so we don't get called again.
29 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view());
30 impl->RemoveObserver(this);
33 } // namespace content