Try to work around that clang/win bug in another file.
[chromium-blink-merge.git] / components / update_client / task_update.cc
blobca8e35f699265cc04fea4609fad951e24819dfcd
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #include "components/update_client/task_update.h"
6 #include "base/bind.h"
7 #include "base/bind_helpers.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "components/update_client/update_engine.h"
13 namespace update_client {
15 TaskUpdate::TaskUpdate(UpdateEngine* update_engine,
16 bool is_foreground,
17 const std::vector<std::string>& ids,
18 const UpdateClient::CrxDataCallback& crx_data_callback,
19 const Callback& callback)
20 : update_engine_(update_engine),
21 is_foreground_(is_foreground),
22 ids_(ids),
23 crx_data_callback_(crx_data_callback),
24 callback_(callback) {
27 TaskUpdate::~TaskUpdate() {
28 DCHECK(thread_checker_.CalledOnValidThread());
31 void TaskUpdate::Run() {
32 DCHECK(thread_checker_.CalledOnValidThread());
34 if (ids_.empty())
35 RunComplete(-1);
37 update_engine_->Update(
38 is_foreground_, ids_, crx_data_callback_,
39 base::Bind(&TaskUpdate::RunComplete, base::Unretained(this)));
42 void TaskUpdate::RunComplete(int error) {
43 DCHECK(thread_checker_.CalledOnValidThread());
45 callback_.Run(this, error);
48 } // namespace update_client