OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/update_client/background_downloader_win.h" | 5 #include "components/update_client/background_downloader_win.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 #include <functional> | 11 #include <functional> |
12 #include <iomanip> | 12 #include <iomanip> |
13 #include <limits> | 13 #include <limits> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/bind_helpers.h" | 17 #include "base/bind_helpers.h" |
18 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
19 #include "base/message_loop/message_loop_proxy.h" | |
20 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
21 #include "base/strings/sys_string_conversions.h" | 20 #include "base/strings/sys_string_conversions.h" |
| 21 #include "base/thread_task_runner_handle.h" |
22 #include "base/win/scoped_co_mem.h" | 22 #include "base/win/scoped_co_mem.h" |
23 #include "components/update_client/utils.h" | 23 #include "components/update_client/utils.h" |
24 #include "ui/base/win/atl_module.h" | 24 #include "ui/base/win/atl_module.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 using base::win::ScopedCoMem; | 27 using base::win::ScopedCoMem; |
28 using base::win::ScopedComPtr; | 28 using base::win::ScopedComPtr; |
29 | 29 |
30 // The class BackgroundDownloader in this module is an adapter between | 30 // The class BackgroundDownloader in this module is an adapter between |
31 // the CrxDownloader interface and the BITS service interfaces. | 31 // the CrxDownloader interface and the BITS service interfaces. |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 return S_OK; | 386 return S_OK; |
387 } | 387 } |
388 | 388 |
389 } // namespace | 389 } // namespace |
390 | 390 |
391 BackgroundDownloader::BackgroundDownloader( | 391 BackgroundDownloader::BackgroundDownloader( |
392 scoped_ptr<CrxDownloader> successor, | 392 scoped_ptr<CrxDownloader> successor, |
393 net::URLRequestContextGetter* context_getter, | 393 net::URLRequestContextGetter* context_getter, |
394 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 394 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
395 : CrxDownloader(successor.Pass()), | 395 : CrxDownloader(successor.Pass()), |
396 main_task_runner_(base::MessageLoopProxy::current()), | 396 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
397 context_getter_(context_getter), | 397 context_getter_(context_getter), |
398 task_runner_(task_runner), | 398 task_runner_(task_runner), |
399 is_completed_(false) { | 399 is_completed_(false) { |
400 } | 400 } |
401 | 401 |
402 BackgroundDownloader::~BackgroundDownloader() { | 402 BackgroundDownloader::~BackgroundDownloader() { |
403 DCHECK(thread_checker_.CalledOnValidThread()); | 403 DCHECK(thread_checker_.CalledOnValidThread()); |
404 | 404 |
405 // The following objects have thread affinity and can't be destroyed on the | 405 // The following objects have thread affinity and can't be destroyed on the |
406 // main thread. The resources managed by these objects are acquired at the | 406 // main thread. The resources managed by these objects are acquired at the |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 // must match as a job only contains one file. | 753 // must match as a job only contains one file. |
754 DCHECK(progress.Completed); | 754 DCHECK(progress.Completed); |
755 DCHECK_EQ(progress.BytesTotal, progress.BytesTransferred); | 755 DCHECK_EQ(progress.BytesTotal, progress.BytesTransferred); |
756 | 756 |
757 response_ = base::FilePath(local_name); | 757 response_ = base::FilePath(local_name); |
758 | 758 |
759 return S_OK; | 759 return S_OK; |
760 } | 760 } |
761 | 761 |
762 } // namespace update_client | 762 } // namespace update_client |
OLD | NEW |