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

Side by Side Diff: content/browser/download/save_file.h

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Add scoped COM initialization to quench a couple of assertion failures. 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "content/browser/download/base_file.h" 16 #include "content/browser/download/base_file.h"
17 #include "content/browser/download/save_types.h" 17 #include "content/browser/download/save_types.h"
18 18
19 namespace content { 19 namespace content {
20 // SaveFile ---------------------------------------------------------------- 20 // SaveFile ----------------------------------------------------------------
21 21
22 // These objects live exclusively on the file thread and handle the writing 22 // These objects live exclusively on the download task runner and handle the
23 // operations for one save item. These objects live only for the duration that 23 // writing operations for one save item. These objects live only for the
24 // the saving job is 'in progress': once the saving job has been completed or 24 // duration that the saving job is 'in progress': once the saving job has been
25 // canceled, the SaveFile is destroyed. One SaveFile object represents one item 25 // completed or canceled, the SaveFile is destroyed. One SaveFile object
26 // in a save session. 26 // represents one item in a save session.
27 class SaveFile { 27 class SaveFile {
28 public: 28 public:
29 explicit SaveFile(const SaveFileCreateInfo* info, bool calculate_hash); 29 explicit SaveFile(const SaveFileCreateInfo* info, bool calculate_hash);
30 virtual ~SaveFile(); 30 virtual ~SaveFile();
31 31
32 // BaseFile delegated functions. 32 // BaseFile delegated functions.
33 DownloadInterruptReason Initialize(); 33 DownloadInterruptReason Initialize();
34 DownloadInterruptReason AppendDataToFile(const char* data, size_t data_len); 34 DownloadInterruptReason AppendDataToFile(const char* data, size_t data_len);
35 DownloadInterruptReason Rename(const base::FilePath& full_path); 35 DownloadInterruptReason Rename(const base::FilePath& full_path);
36 void Detach(); 36 void Detach();
(...skipping 16 matching lines...) Expand all
53 private: 53 private:
54 BaseFile file_; 54 BaseFile file_;
55 std::unique_ptr<const SaveFileCreateInfo> info_; 55 std::unique_ptr<const SaveFileCreateInfo> info_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(SaveFile); 57 DISALLOW_COPY_AND_ASSIGN(SaveFile);
58 }; 58 };
59 59
60 } // namespace content 60 } // namespace content
61 61
62 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_ 62 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698