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

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

Issue 2395253002: Send TranslateEventProtos to UMA. (Closed)
Patch Set: nit Created 4 years, 2 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.h" 5 #include "components/translate/core/browser/translate_ranker.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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/profiler/scoped_tracker.h" 13 #include "base/profiler/scoped_tracker.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "components/metrics/proto/translate_event.pb.h"
15 #include "components/translate/core/browser/proto/translate_ranker_model.pb.h" 16 #include "components/translate/core/browser/proto/translate_ranker_model.pb.h"
16 #include "components/translate/core/browser/translate_download_manager.h" 17 #include "components/translate/core/browser/translate_download_manager.h"
17 #include "components/translate/core/browser/translate_prefs.h" 18 #include "components/translate/core/browser/translate_prefs.h"
18 #include "components/translate/core/browser/translate_url_fetcher.h" 19 #include "components/translate/core/browser/translate_url_fetcher.h"
19 #include "components/translate/core/common/translate_switches.h" 20 #include "components/translate/core/common/translate_switches.h"
20 21
21 namespace translate { 22 namespace translate {
22 23
23 namespace { 24 namespace {
24 25
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 if (!is_valid) { 276 if (!is_valid) {
276 ReportModelStatus(MODEL_STATUS_VALIDATION_FAILED); 277 ReportModelStatus(MODEL_STATUS_VALIDATION_FAILED);
277 return; 278 return;
278 } 279 }
279 280
280 ReportModelStatus(MODEL_STATUS_OK); 281 ReportModelStatus(MODEL_STATUS_OK);
281 model_ = std::move(new_model); 282 model_ = std::move(new_model);
282 model_fetcher_.reset(); 283 model_fetcher_.reset();
283 } 284 }
284 285
286 void TranslateRanker::FlushTranslateEvents(
287 std::vector<metrics::TranslateEventProto>* translate_events) {
288 translate_events->swap(translate_events_cache_);
289 translate_events_cache_.clear();
290 }
291
292 void TranslateRanker::RecordTranslateEvent(
293 const metrics::TranslateEventProto& translate_event) {
294 translate_events_cache_.push_back(translate_event);
295 }
296
285 } // namespace translate 297 } // namespace translate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698