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

Side by Side Diff: download_action.h

Issue 5009009: AU: Fix potential issues with premature destruction of HTTP fetchers. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: review comments Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | download_action.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 (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
7 7
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Debugging/logging 82 // Debugging/logging
83 static std::string StaticType() { return "DownloadAction"; } 83 static std::string StaticType() { return "DownloadAction"; }
84 std::string Type() const { return StaticType(); } 84 std::string Type() const { return StaticType(); }
85 85
86 // HttpFetcherDelegate methods (see http_fetcher.h) 86 // HttpFetcherDelegate methods (see http_fetcher.h)
87 virtual void ReceivedBytes(HttpFetcher *fetcher, 87 virtual void ReceivedBytes(HttpFetcher *fetcher,
88 const char* bytes, int length); 88 const char* bytes, int length);
89 virtual void SeekToOffset(off_t offset); 89 virtual void SeekToOffset(off_t offset);
90 virtual void TransferComplete(HttpFetcher *fetcher, bool successful); 90 virtual void TransferComplete(HttpFetcher *fetcher, bool successful);
91 virtual void TransferTerminated(HttpFetcher *fetcher);
91 92
92 DownloadActionDelegate* delegate() const { return delegate_; } 93 DownloadActionDelegate* delegate() const { return delegate_; }
93 void set_delegate(DownloadActionDelegate* delegate) { 94 void set_delegate(DownloadActionDelegate* delegate) {
94 delegate_ = delegate; 95 delegate_ = delegate;
95 } 96 }
96 97
97 HttpFetcher* http_fetcher() { return http_fetcher_.get(); } 98 HttpFetcher* http_fetcher() { return http_fetcher_.get(); }
98 99
99 private: 100 private:
100 // The InstallPlan passed in 101 // The InstallPlan passed in
(...skipping 16 matching lines...) Expand all
117 118
118 // Used to apply a delta update: 119 // Used to apply a delta update:
119 scoped_ptr<DeltaPerformer> delta_performer_; 120 scoped_ptr<DeltaPerformer> delta_performer_;
120 121
121 // Pointer to the HttpFetcher that does the http work. 122 // Pointer to the HttpFetcher that does the http work.
122 scoped_ptr<HttpFetcher> http_fetcher_; 123 scoped_ptr<HttpFetcher> http_fetcher_;
123 124
124 // Used to find the hash of the bytes downloaded 125 // Used to find the hash of the bytes downloaded
125 OmahaHashCalculator omaha_hash_calculator_; 126 OmahaHashCalculator omaha_hash_calculator_;
126 127
128 // Used by TransferTerminated to figure if this action terminated itself or
129 // was terminated by the action processor.
130 ActionExitCode code_;
131
127 // For reporting status to outsiders 132 // For reporting status to outsiders
128 DownloadActionDelegate* delegate_; 133 DownloadActionDelegate* delegate_;
129 uint64_t bytes_received_; 134 uint64_t bytes_received_;
130 135
131 DISALLOW_COPY_AND_ASSIGN(DownloadAction); 136 DISALLOW_COPY_AND_ASSIGN(DownloadAction);
132 }; 137 };
133 138
134 // We want to be sure that we're compiled with large file support on linux, 139 // We want to be sure that we're compiled with large file support on linux,
135 // just in case we find ourselves downloading large images. 140 // just in case we find ourselves downloading large images.
136 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit); 141 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit);
137 142
138 } // namespace chromeos_update_engine 143 } // namespace chromeos_update_engine
139 144
140 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ 145 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
OLDNEW
« no previous file with comments | « no previous file | download_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698