| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/installer/test/resource_updater.h" | 5 #include "chrome/installer/test/resource_updater.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const base::FilePath& input_file) { | 41 const base::FilePath& input_file) { |
| 42 DCHECK(handle_ != NULL); | 42 DCHECK(handle_ != NULL); |
| 43 base::MemoryMappedFile input; | 43 base::MemoryMappedFile input; |
| 44 | 44 |
| 45 if (input.Initialize(input_file)) { | 45 if (input.Initialize(input_file)) { |
| 46 if (UpdateResource(handle_, type.c_str(), name.c_str(), language_id, | 46 if (UpdateResource(handle_, type.c_str(), name.c_str(), language_id, |
| 47 const_cast<uint8_t*>(input.data()), | 47 const_cast<uint8_t*>(input.data()), |
| 48 static_cast<DWORD>(input.length())) != FALSE) { | 48 static_cast<DWORD>(input.length())) != FALSE) { |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 PLOG(DFATAL) << "UpdateResource failed for resource \"" << name << "\""; | 51 PLOG(ERROR) << "UpdateResource failed for resource \"" << name |
| 52 << "\" of size " << input.length() << " bytes"; |
| 52 } else { | 53 } else { |
| 53 PLOG(DFATAL) << "Failed mapping \"" << input_file.value() << "\""; | 54 PLOG(DFATAL) << "Failed mapping \"" << input_file.value() << "\""; |
| 54 } | 55 } |
| 55 return false; | 56 return false; |
| 56 } | 57 } |
| 57 | 58 |
| 58 bool ResourceUpdater::Commit() { | 59 bool ResourceUpdater::Commit() { |
| 59 DCHECK(handle_ != NULL); | 60 DCHECK(handle_ != NULL); |
| 60 bool result = true; | 61 bool result = true; |
| 61 if (EndUpdateResource(handle_, FALSE) == FALSE) { | 62 if (EndUpdateResource(handle_, FALSE) == FALSE) { |
| 62 PLOG(DFATAL) << "EndUpdateResource failed"; | 63 PLOG(DFATAL) << "EndUpdateResource failed"; |
| 63 result = false; | 64 result = false; |
| 64 } | 65 } |
| 65 handle_ = NULL; | 66 handle_ = NULL; |
| 66 return result; | 67 return result; |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace upgrade_test | 70 } // namespace upgrade_test |
| OLD | NEW |