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

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

Issue 2956053003: Revert of [translate] Defer start of translate ranker model load to first use. (patchset #2 id:4000… (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 is_decision_override_enabled_(base::FeatureList::IsEnabled( 140 is_decision_override_enabled_(base::FeatureList::IsEnabled(
141 translate::kTranslateRankerDecisionOverride)), 141 translate::kTranslateRankerDecisionOverride)),
142 weak_ptr_factory_(this) { 142 weak_ptr_factory_(this) {
143 if (is_query_enabled_ || is_enforcement_enabled_ || 143 if (is_query_enabled_ || is_enforcement_enabled_ ||
144 is_decision_override_enabled_) { 144 is_decision_override_enabled_) {
145 model_loader_ = base::MakeUnique<RankerModelLoader>( 145 model_loader_ = base::MakeUnique<RankerModelLoader>(
146 base::Bind(&ValidateModel), 146 base::Bind(&ValidateModel),
147 base::Bind(&TranslateRankerImpl::OnModelAvailable, 147 base::Bind(&TranslateRankerImpl::OnModelAvailable,
148 weak_ptr_factory_.GetWeakPtr()), 148 weak_ptr_factory_.GetWeakPtr()),
149 model_path, model_url, kUmaPrefix); 149 model_path, model_url, kUmaPrefix);
150 // Kick off the initial load from cache.
151 model_loader_->NotifyOfRankerActivity();
150 } 152 }
151 } 153 }
152 154
153 TranslateRankerImpl::~TranslateRankerImpl() {} 155 TranslateRankerImpl::~TranslateRankerImpl() {}
154 156
155 // static 157 // static
156 base::FilePath TranslateRankerImpl::GetModelPath( 158 base::FilePath TranslateRankerImpl::GetModelPath(
157 const base::FilePath& data_dir) { 159 const base::FilePath& data_dir) {
158 if (data_dir.empty()) 160 if (data_dir.empty())
159 return base::FilePath(); 161 return base::FilePath();
(...skipping 205 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698