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

Side by Side Diff: components/translate/core/browser/translate_ranker_impl.cc

Issue 2930433004: Send UMA recording state to TranslateRanker. (Closed)
Patch Set: Nit. 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/translate/core/browser/translate_ranker_impl.h" 5 #include "components/translate/core/browser/translate_ranker_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 kTranslateRankerQuery, switches::kTranslateRankerModelURL); 176 kTranslateRankerQuery, switches::kTranslateRankerModelURL);
177 } 177 }
178 178
179 DVLOG(3) << switches::kTranslateRankerModelURL << " = " << raw_url; 179 DVLOG(3) << switches::kTranslateRankerModelURL << " = " << raw_url;
180 180
181 return GURL(raw_url); 181 return GURL(raw_url);
182 } 182 }
183 183
184 void TranslateRankerImpl::EnableLogging(bool value) { 184 void TranslateRankerImpl::EnableLogging(bool value) {
185 is_logging_enabled_ = value; 185 is_logging_enabled_ = value;
186 if (!value)
Roger McFarlane (Chromium) 2017/06/06 19:28:27 if (!is_logging_enabled_)
hamelphi 2017/06/06 20:28:06 Done.
187 event_cache_.clear();
186 } 188 }
187 189
188 uint32_t TranslateRankerImpl::GetModelVersion() const { 190 uint32_t TranslateRankerImpl::GetModelVersion() const {
189 return model_ ? model_->proto().translate().version() : 0; 191 return model_ ? model_->proto().translate().version() : 0;
190 } 192 }
191 193
192 bool TranslateRankerImpl::ShouldOfferTranslation( 194 bool TranslateRankerImpl::ShouldOfferTranslation(
193 metrics::TranslateEventProto* translate_event) { 195 metrics::TranslateEventProto* translate_event) {
194 DCHECK(sequence_checker_.CalledOnValidSequence()); 196 DCHECK(sequence_checker_.CalledOnValidSequence());
195 // The ranker is a gate in the "show a translation prompt" flow. To retain 197 // The ranker is a gate in the "show a translation prompt" flow. To retain
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 367 }
366 } 368 }
367 369
368 } // namespace translate 370 } // namespace translate
369 371
370 std::ostream& operator<<(std::ostream& stream, 372 std::ostream& operator<<(std::ostream& stream,
371 const translate::TranslateRankerFeatures& features) { 373 const translate::TranslateRankerFeatures& features) {
372 features.WriteTo(stream); 374 features.WriteTo(stream);
373 return stream; 375 return stream;
374 } 376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698