OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The file contains the implementation of the mini_installer re-versioner. | 5 // The file contains the implementation of the mini_installer re-versioner. |
6 // The main function (GenerateNextVersion) does the following in a temp dir: | 6 // The main function (GenerateNextVersion) does the following in a temp dir: |
7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from | 7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from |
8 // mini_installer.exe. | 8 // mini_installer.exe. |
9 // - Inspects setup.exe to determine the current version. | 9 // - Inspects setup.exe to determine the current version. |
10 // - Runs through all .dll and .exe files: | 10 // - Runs through all .dll and .exe files: |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 bool MappedFile::Initialize(base::PlatformFile file) { | 175 bool MappedFile::Initialize(base::PlatformFile file) { |
176 DCHECK(mapping_ == NULL); | 176 DCHECK(mapping_ == NULL); |
177 bool result = false; | 177 bool result = false; |
178 base::PlatformFileInfo file_info; | 178 base::PlatformFileInfo file_info; |
179 | 179 |
180 if (base::GetPlatformFileInfo(file, &file_info)) { | 180 if (base::GetPlatformFileInfo(file, &file_info)) { |
181 if (file_info.size <= | 181 if (file_info.size <= |
182 static_cast<int64>(std::numeric_limits<size_t>::max())) { | 182 static_cast<int64>(std::numeric_limits<DWORD>::max())) { |
robertshield
2013/04/29 20:04:45
Really curious: how does this fix the test?
| |
183 mapping_ = CreateFileMapping(file, NULL, PAGE_READWRITE, 0, | 183 mapping_ = CreateFileMapping(file, NULL, PAGE_READWRITE, 0, |
184 static_cast<DWORD>(file_info.size), NULL); | 184 static_cast<DWORD>(file_info.size), NULL); |
185 if (mapping_ != NULL) { | 185 if (mapping_ != NULL) { |
186 view_ = MapViewOfFile(mapping_, FILE_MAP_WRITE, 0, 0, | 186 view_ = MapViewOfFile(mapping_, FILE_MAP_WRITE, 0, 0, |
187 static_cast<size_t>(file_info.size)); | 187 static_cast<size_t>(file_info.size)); |
188 if (view_ != NULL) { | 188 if (view_ != NULL) { |
189 result = true; | 189 result = true; |
190 } else { | 190 } else { |
191 PLOG(DFATAL) << "MapViewOfFile failed"; | 191 PLOG(DFATAL) << "MapViewOfFile failed"; |
192 } | 192 } |
193 } else { | 193 } else { |
194 PLOG(DFATAL) << "CreateFileMapping failed"; | 194 PLOG(DFATAL) << "CreateFileMapping failed"; |
195 } | 195 } |
196 } else { | 196 } else { |
197 LOG(DFATAL) << "Files larger than " << std::numeric_limits<size_t>::max() | 197 LOG(DFATAL) << "Files larger than " << std::numeric_limits<DWORD>::max() |
198 << " are not supported."; | 198 << " are not supported."; |
199 } | 199 } |
200 } else { | 200 } else { |
201 PLOG(DFATAL) << "GetPlatformFileInfo failed"; | 201 PLOG(DFATAL) << "GetPlatformFileInfo failed"; |
202 } | 202 } |
203 return result; | 203 return result; |
204 } | 204 } |
205 | 205 |
206 // Calls CreateProcess with good default parameters and waits for the process | 206 // Calls CreateProcess with good default parameters and waits for the process |
207 // to terminate returning the process exit code. | 207 // to terminate returning the process exit code. |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
692 return false; | 692 return false; |
693 } | 693 } |
694 ctx.current_version_str = ctx.current_version.ToString(); | 694 ctx.current_version_str = ctx.current_version.ToString(); |
695 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 695 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
696 ctx.new_version_str = ctx.new_version.ToString(); | 696 ctx.new_version_str = ctx.new_version.ToString(); |
697 | 697 |
698 return UpdateVersionIfMatch(target_file, &ctx); | 698 return UpdateVersionIfMatch(target_file, &ctx); |
699 } | 699 } |
700 | 700 |
701 } // namespace upgrade_test | 701 } // namespace upgrade_test |
OLD | NEW |