Commit b8b8e73e authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Inlined some kZeroTime constants in metrics/desktop_session_duration

In jumbo builds many cc files compile in the same translation
unit and then they share the same anonymous namespace. Having
the same constant twice with the same name will then result
in compilation failures.

In preparation for jumbo in chrome/browser, this patch inlines
the constants in chrome_visibility_observer.cc and
desktop_session_duration_tracker.cc.

Bug: 746957
Change-Id: I1b7d4b2f4a83a8a75c248f07199af6f4e72e87f5
Reviewed-on: https://chromium-review.googlesource.com/897533
Commit-Queue: Daniel Bratell <bratell@opera.com>
Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534198}
parent 915cbbca
......@@ -14,12 +14,6 @@
namespace metrics {
namespace {
const base::TimeDelta kZeroTime = base::TimeDelta::FromSeconds(0);
} // namespace
ChromeVisibilityObserver::ChromeVisibilityObserver() : weak_factory_(this) {
BrowserList::AddObserver(this);
InitVisibilityGapTimeout();
......@@ -43,7 +37,7 @@ void ChromeVisibilityObserver::OnBrowserSetLastActive(Browser* browser) {
if (weak_factory_.HasWeakPtrs())
CancelVisibilityChange();
else
SendVisibilityChangeEvent(true, kZeroTime);
SendVisibilityChangeEvent(true, base::TimeDelta());
}
void ChromeVisibilityObserver::OnBrowserNoLongerActive(Browser* browser) {
......@@ -60,7 +54,7 @@ void ChromeVisibilityObserver::OnBrowserRemoved(Browser* browser) {
// is not visible anymore immediately without waiting.
if (BrowserList::GetInstance()->empty()) {
CancelVisibilityChange();
SendVisibilityChangeEvent(false, kZeroTime);
SendVisibilityChangeEvent(false, base::TimeDelta());
}
}
......
......@@ -16,8 +16,6 @@ namespace {
DesktopSessionDurationTracker* g_desktop_session_duration_tracker_instance =
nullptr;
const base::TimeDelta kZeroTime = base::TimeDelta::FromSeconds(0);
} // namespace
// static
......@@ -101,7 +99,7 @@ void DesktopSessionDurationTracker::OnAudioEnd() {
// last 5 minutes so the session can be terminated.
if (!timer_.IsRunning()) {
DVLOG(4) << "Ending session due to audio ending";
EndSession(kZeroTime);
EndSession(base::TimeDelta());
}
}
......@@ -149,8 +147,8 @@ void DesktopSessionDurationTracker::EndSession(
// Trim any timeouts from the session length and lower bound to a session of
// length 0.
delta -= time_to_discount;
if (delta < kZeroTime)
delta = kZeroTime;
if (delta < base::TimeDelta())
delta = base::TimeDelta();
for (Observer& observer : observer_list_)
observer.OnSessionEnded(delta);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment