refactor: omit redundant map searches (#19929)
* refactor: don't walk maps twice to remove elements * refactor: don't walk maps twice to read elements * refactor: don't walk maps twice to insert elements * refactor: don't walk map 3x on UvTaskRunner timeout * refactor: more don't-walk-maps-twice cleanup * fixup! refactor: don't walk maps twice to insert elements * refactor: don't walk containers twice when erasing * refactor: omit excess lookups in RemoteObjectFreer
This commit is contained in:
parent
27ce6a9cd3
commit
987300c97a
14 changed files with 88 additions and 86 deletions
|
@ -89,8 +89,9 @@ void GenerateAcceleratorTable(AcceleratorTable* table,
|
|||
|
||||
bool TriggerAcceleratorTableCommand(AcceleratorTable* table,
|
||||
const ui::Accelerator& accelerator) {
|
||||
if (base::Contains(*table, accelerator)) {
|
||||
const accelerator_util::MenuItem& item = (*table)[accelerator];
|
||||
const auto iter = table->find(accelerator);
|
||||
if (iter != std::end(*table)) {
|
||||
const accelerator_util::MenuItem& item = iter->second;
|
||||
if (item.model->IsEnabledAt(item.position)) {
|
||||
const auto event_flags =
|
||||
accelerator.MaskOutKeyEventFlags(accelerator.modifiers());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue