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

Issue 1044273002: Improve map insertions (Closed)

Created:
5 years, 8 months ago by Mark Mentovai
Modified:
5 years, 8 months ago
Reviewers:
scottmg
CC:
crashpad-dev_chromium.org
Base URL:
https://chromium.googlesource.com/crashpad/crashpad@master
Target Ref:
refs/heads/master
Project:
crashpad
Visibility:
Public.

Description

Improve map insertion operations. Add MapInsertOrReplace<>() to insert a key-value pair into a map if the key is not already present, or replace the existing value for key if the key is present. The original value can optionally be returned to the caller in this case. Map insertions now use either MapInsertOrReplace<>() or std::map<>::insert() directly. Use MapInsertOrReplace<>() when the map should be updated to contain a mapping from a key to a value regardless of whether the key is already present. Use std::map<>::insert() to insert a mapping from a key to a value without replacing any existing mapping from a key, if present. If it is important to know whether an existing mapping from a key was present, use the returned std::pair<>.second. If it is important to know the existing value, use the returned std::pair<>.first->second. This change has a slight positive impact on performance. TEST=crashpad_util_test MapInsert.MapInsertOrReplace and others BUG= R=scottmg@chromium.org Committed: https://chromium.googlesource.com/crashpad/crashpad/+/d5ddd14ee1c14ad65bfc82188aac0ca24c412892

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+154 lines, -55 lines) Patch
M handler/mac/crash_report_upload_thread.cc View 1 4 chunks +5 lines, -10 lines 0 comments Download
M handler/mac/main.cc View 1 3 chunks +4 lines, -7 lines 0 comments Download
M minidump/minidump_thread_id_map.cc View 1 chunk +1 line, -2 lines 0 comments Download
M snapshot/mac/mach_o_image_annotations_reader.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M snapshot/mac/mach_o_image_reader.cc View 2 chunks +5 lines, -4 lines 0 comments Download
M snapshot/mac/mach_o_image_segment_reader.cc View 2 chunks +7 lines, -5 lines 0 comments Download
M snapshot/mac/mach_o_image_symbol_table_reader.cc View 2 chunks +7 lines, -6 lines 0 comments Download
M snapshot/minidump/minidump_simple_string_dictionary_reader.cc View 1 2 1 chunk +2 lines, -4 lines 2 comments Download
M snapshot/minidump/process_snapshot_minidump.cc View 1 chunk +3 lines, -6 lines 0 comments Download
M tools/mac/run_with_crashpad.cc View 1 2 chunks +4 lines, -6 lines 0 comments Download
M util/net/http_transport_test.cc View 1 chunk +1 line, -1 line 0 comments Download
A util/stdlib/map_insert.h View 1 1 chunk +56 lines, -0 lines 0 comments Download
A util/stdlib/map_insert_test.cc View 1 1 chunk +54 lines, -0 lines 0 comments Download
M util/util.gyp View 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
Mark Mentovai
5 years, 8 months ago (2015-03-31 17:56:52 UTC) #2
scottmg
lgtm, the ->first.second are a bit ugly, but hey, C++. https://codereview.chromium.org/1044273002/diff/40001/snapshot/minidump/minidump_simple_string_dictionary_reader.cc File snapshot/minidump/minidump_simple_string_dictionary_reader.cc (right): https://codereview.chromium.org/1044273002/diff/40001/snapshot/minidump/minidump_simple_string_dictionary_reader.cc#newcode76 ...
5 years, 8 months ago (2015-03-31 18:16:15 UTC) #3
Mark Mentovai
> lgtm, the ->first.second are a bit ugly, but hey, C++. I had a MapInsert<>() ...
5 years, 8 months ago (2015-03-31 18:21:32 UTC) #4
Mark Mentovai
5 years, 8 months ago (2015-03-31 18:29:38 UTC) #5
Message was sent while issue was closed.
Committed patchset #3 (id:40001) manually as
d5ddd14ee1c14ad65bfc82188aac0ca24c412892 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698