Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.cc

Issue 2916163002: [MediaRouter] Record DIAL device counts in DialMediaSinkServiceImpl (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/media/router/discovery/dial/dial_media_sink_service_imp l.h" 5 #include "chrome/browser/media/router/discovery/dial/dial_media_sink_service_imp l.h"
6 6
7 #include "chrome/browser/media/router/discovery/dial/dial_device_data.h" 7 #include "chrome/browser/media/router/discovery/dial/dial_device_data.h"
8 #include "chrome/browser/media/router/media_router_metrics.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
10 #include "net/url_request/url_request_context_getter.h" 11 #include "net/url_request/url_request_context_getter.h"
11 12
12 using content::BrowserThread; 13 using content::BrowserThread;
13 14
15 namespace {
16 // How long to wait between device counts metrics are recorded. Set to 1 hour.
17 const int kDeviceCountMetricThresholdMins = 60 * 60;
imcheng 2017/06/02 21:34:51 I think this should be just 60?
zhaobin 2017/06/05 23:20:55 Fixed in media_router_metrics.cc
18 }
19
14 namespace media_router { 20 namespace media_router {
15 21
16 DialMediaSinkServiceImpl::DialMediaSinkServiceImpl( 22 DialMediaSinkServiceImpl::DialMediaSinkServiceImpl(
17 const OnSinksDiscoveredCallback& callback, 23 const OnSinksDiscoveredCallback& callback,
18 net::URLRequestContextGetter* request_context) 24 net::URLRequestContextGetter* request_context)
19 : MediaSinkServiceBase(callback), request_context_(request_context) { 25 : MediaSinkServiceBase(callback), request_context_(request_context) {
20 DCHECK_CURRENTLY_ON(BrowserThread::IO); 26 DCHECK_CURRENTLY_ON(BrowserThread::IO);
21 DCHECK(request_context_); 27 DCHECK(request_context_);
22 } 28 }
23 29
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 MediaSinkServiceBase::RestartTimer(); 128 MediaSinkServiceBase::RestartTimer();
123 } 129 }
124 130
125 void DialMediaSinkServiceImpl::OnDeviceDescriptionError( 131 void DialMediaSinkServiceImpl::OnDeviceDescriptionError(
126 const DialDeviceData& device, 132 const DialDeviceData& device,
127 const std::string& error_message) { 133 const std::string& error_message) {
128 DCHECK_CURRENTLY_ON(BrowserThread::IO); 134 DCHECK_CURRENTLY_ON(BrowserThread::IO);
129 DVLOG(2) << "OnDescriptionFetchesError [message]: " << error_message; 135 DVLOG(2) << "OnDescriptionFetchesError [message]: " << error_message;
130 } 136 }
131 137
138 void DialMediaSinkServiceImpl::RecordDeviceCounts() {
139 if (base::Time::Now() - device_count_metrics_record_time_ <
imcheng 2017/06/02 21:34:51 Can the time check logic be part of MediaSinkServi
mark a. foltz 2017/06/02 22:06:40 I would rather bookkeeping for recording UMA live
zhaobin 2017/06/05 23:20:55 Done.
140 base::TimeDelta::FromMinutes(kDeviceCountMetricThresholdMins)) {
141 return;
142 }
143 MediaRouterMetrics::RecordDialDeviceCounts(current_sinks_.size(),
144 current_devices_.size());
145 device_count_metrics_record_time_ = base::Time::Now();
146 }
147
132 } // namespace media_router 148 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698