| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/browser/conflicts/module_database_win.h" | 5 #include "chrome/browser/conflicts/module_database_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // static | 219 // static |
| 220 void ModuleDatabase::RemoveLoadAddressById( | 220 void ModuleDatabase::RemoveLoadAddressById( |
| 221 ModuleId module_id, | 221 ModuleId module_id, |
| 222 ModuleLoadAddresses* load_addresses) { | 222 ModuleLoadAddresses* load_addresses) { |
| 223 if (load_addresses->empty()) | 223 if (load_addresses->empty()) |
| 224 return; | 224 return; |
| 225 | 225 |
| 226 // This handles the special case of removing the max element in O(1), as | 226 // This handles the special case of removing the max element in O(1), as |
| 227 // FindLoadAddressIndexById processes the elements in reverse order. | 227 // FindLoadAddressIndexById processes the elements in reverse order. |
| 228 size_t i = FindLoadAddressIndexById(module_id, *load_addresses); | 228 size_t i = FindLoadAddressIndexById(module_id, *load_addresses); |
| 229 RemoveLoadAddressByIndex(i, load_addresses); | 229 if (i != kInvalidIndex) |
| 230 RemoveLoadAddressByIndex(i, load_addresses); |
| 230 } | 231 } |
| 231 | 232 |
| 232 // static | 233 // static |
| 233 void ModuleDatabase::RemoveLoadAddressByIndex( | 234 void ModuleDatabase::RemoveLoadAddressByIndex( |
| 234 size_t index, | 235 size_t index, |
| 235 ModuleLoadAddresses* load_addresses) { | 236 ModuleLoadAddresses* load_addresses) { |
| 236 DCHECK_LT(index, load_addresses->size()); | 237 DCHECK_LT(index, load_addresses->size()); |
| 237 | 238 |
| 238 // Special case: removing the only remaining element. | 239 // Special case: removing the only remaining element. |
| 239 if (load_addresses->size() == 1) { | 240 if (load_addresses->size() == 1) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 375 } |
| 375 | 376 |
| 376 // ModuleDatabase::ProcessInfoData --------------------------------------------- | 377 // ModuleDatabase::ProcessInfoData --------------------------------------------- |
| 377 | 378 |
| 378 ModuleDatabase::ProcessInfoData::ProcessInfoData() = default; | 379 ModuleDatabase::ProcessInfoData::ProcessInfoData() = default; |
| 379 | 380 |
| 380 ModuleDatabase::ProcessInfoData::ProcessInfoData(const ProcessInfoData& other) = | 381 ModuleDatabase::ProcessInfoData::ProcessInfoData(const ProcessInfoData& other) = |
| 381 default; | 382 default; |
| 382 | 383 |
| 383 ModuleDatabase::ProcessInfoData::~ProcessInfoData() = default; | 384 ModuleDatabase::ProcessInfoData::~ProcessInfoData() = default; |
| OLD | NEW |