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

Side by Side Diff: chrome/browser/conflicts/module_database_win.cc

Issue 2714873002: Fix 2 issues that were hitting dchecks when enabling ModuleDatabase (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.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 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
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
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;
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698