OLD | NEW |
1 // Copyright 2015 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 #include "components/sync_sessions/revisit/sessions_page_revisit_observer.h" | 5 #include "components/sync_sessions/revisit/sessions_page_revisit_observer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "components/sessions/core/session_types.h" | 12 #include "components/sessions/core/session_types.h" |
13 #include "components/sync_sessions/revisit/current_tab_matcher.h" | 13 #include "components/sync_sessions/revisit/current_tab_matcher.h" |
14 #include "components/sync_sessions/revisit/offset_tab_matcher.h" | 14 #include "components/sync_sessions/revisit/offset_tab_matcher.h" |
15 #include "components/sync_sessions/revisit/page_equality.h" | 15 #include "components/sync_sessions/revisit/page_equality.h" |
16 #include "components/sync_sessions/synced_session.h" | 16 #include "components/sync_sessions/synced_session.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace sync_sessions { | 19 namespace sync_sessions { |
20 | 20 |
21 SessionsPageRevisitObserver::SessionsPageRevisitObserver( | 21 SessionsPageRevisitObserver::SessionsPageRevisitObserver( |
22 scoped_ptr<ForeignSessionsProvider> provider) | 22 scoped_ptr<ForeignSessionsProvider> provider) |
23 : provider_(provider.Pass()) {} | 23 : provider_(std::move(provider)) {} |
24 | 24 |
25 SessionsPageRevisitObserver::~SessionsPageRevisitObserver() {} | 25 SessionsPageRevisitObserver::~SessionsPageRevisitObserver() {} |
26 | 26 |
27 void SessionsPageRevisitObserver::OnPageVisit( | 27 void SessionsPageRevisitObserver::OnPageVisit( |
28 const GURL& url, | 28 const GURL& url, |
29 const PageVisitObserver::TransitionType transition) { | 29 const PageVisitObserver::TransitionType transition) { |
30 // We need to be invoked and eventually execute on the thread which owns the | 30 // We need to be invoked and eventually execute on the thread which owns the |
31 // session objects the provider will give us. However, this work is not | 31 // session objects the provider will give us. However, this work is not |
32 // especially time sensitive, and so we post a task to perform this to get out | 32 // especially time sensitive, and so we post a task to perform this to get out |
33 // of the way of any currently executing logic. | 33 // of the way of any currently executing logic. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // emit even if there are no foreign sessions so that that counts all match. | 75 // emit even if there are no foreign sessions so that that counts all match. |
76 current_matcher.Emit(transition); | 76 current_matcher.Emit(transition); |
77 offset_matcher.Emit(transition); | 77 offset_matcher.Emit(transition); |
78 | 78 |
79 base::TimeDelta duration(base::TimeTicks::Now() - start); | 79 base::TimeDelta duration(base::TimeTicks::Now() - start); |
80 UMA_HISTOGRAM_TIMES("Sync.PageRevisitSessionDuration", duration); | 80 UMA_HISTOGRAM_TIMES("Sync.PageRevisitSessionDuration", duration); |
81 } | 81 } |
82 | 82 |
83 } // namespace sync_sessions | 83 } // namespace sync_sessions |
OLD | NEW |