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

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

Issue 2855223002: Use constexpr TaskTraits constructor in components. (Closed)
Patch Set: Created 3 years, 7 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 | « components/nacl/browser/pnacl_host.cc ('k') | components/wallpaper/wallpaper_manager_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/translate/core/browser/ranker_model_loader.h" 5 #include "components/translate/core/browser/ranker_model_loader.h"
6 6
7 #include <utility> 7 #include <utility>
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 } // namespace 94 } // namespace
95 95
96 RankerModelLoader::RankerModelLoader( 96 RankerModelLoader::RankerModelLoader(
97 ValidateModelCallback validate_model_cb, 97 ValidateModelCallback validate_model_cb,
98 OnModelAvailableCallback on_model_available_cb, 98 OnModelAvailableCallback on_model_available_cb,
99 base::FilePath model_path, 99 base::FilePath model_path,
100 GURL model_url, 100 GURL model_url,
101 std::string uma_prefix) 101 std::string uma_prefix)
102 : background_task_runner_(base::CreateSequencedTaskRunnerWithTraits( 102 : background_task_runner_(base::CreateSequencedTaskRunnerWithTraits(
103 base::TaskTraits() 103 {base::MayBlock(), base::TaskPriority::BACKGROUND,
104 .MayBlock() 104 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})),
105 .WithPriority(base::TaskPriority::BACKGROUND)
106 .WithShutdownBehavior(
107 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN))),
108 validate_model_cb_(std::move(validate_model_cb)), 105 validate_model_cb_(std::move(validate_model_cb)),
109 on_model_available_cb_(std::move(on_model_available_cb)), 106 on_model_available_cb_(std::move(on_model_available_cb)),
110 model_path_(std::move(model_path)), 107 model_path_(std::move(model_path)),
111 model_url_(std::move(model_url)), 108 model_url_(std::move(model_url)),
112 uma_prefix_(std::move(uma_prefix)), 109 uma_prefix_(std::move(uma_prefix)),
113 url_fetcher_(base::MakeUnique<TranslateURLFetcher>(kUrlFetcherId)), 110 url_fetcher_(base::MakeUnique<TranslateURLFetcher>(kUrlFetcherId)),
114 weak_ptr_factory_(this) {} 111 weak_ptr_factory_(this) {}
115 112
116 RankerModelLoader::~RankerModelLoader() { 113 RankerModelLoader::~RankerModelLoader() {
117 DCHECK(sequence_checker_.CalledOnValidSequence()); 114 DCHECK(sequence_checker_.CalledOnValidSequence());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 uma_prefix_ + kModelStatusHistogram, 1, 300 uma_prefix_ + kModelStatusHistogram, 1,
304 static_cast<int>(RankerModelStatus::MAX), 301 static_cast<int>(RankerModelStatus::MAX),
305 static_cast<int>(RankerModelStatus::MAX) + 1, 302 static_cast<int>(RankerModelStatus::MAX) + 1,
306 base::HistogramBase::kUmaTargetedHistogramFlag); 303 base::HistogramBase::kUmaTargetedHistogramFlag);
307 if (histogram) 304 if (histogram)
308 histogram->Add(static_cast<int>(model_status)); 305 histogram->Add(static_cast<int>(model_status));
309 return model_status; 306 return model_status;
310 } 307 }
311 308
312 } // namespace translate 309 } // namespace translate
OLDNEW
« no previous file with comments | « components/nacl/browser/pnacl_host.cc ('k') | components/wallpaper/wallpaper_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698