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

Side by Side Diff: minidump/minidump_thread_id_map.cc

Issue 983103004: win: fixes for Windows x64 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: mac Created 5 years, 9 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 | « minidump/minidump_simple_string_dictionary_writer_test.cc ('k') | minidump/minidump_writable.h » ('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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "minidump/minidump_thread_id_map.h" 15 #include "minidump/minidump_thread_id_map.h"
16 16
17 #include <limits> 17 #include <limits>
18 #include <set> 18 #include <set>
19 #include <utility> 19 #include <utility>
20 20
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/numerics/safe_conversions.h"
22 #include "snapshot/thread_snapshot.h" 23 #include "snapshot/thread_snapshot.h"
23 24
24 namespace crashpad { 25 namespace crashpad {
25 26
26 void BuildMinidumpThreadIDMap( 27 void BuildMinidumpThreadIDMap(
27 const std::vector<const ThreadSnapshot*>& thread_snapshots, 28 const std::vector<const ThreadSnapshot*>& thread_snapshots,
28 MinidumpThreadIDMap* thread_id_map) { 29 MinidumpThreadIDMap* thread_id_map) {
29 DCHECK(thread_id_map->empty()); 30 DCHECK(thread_id_map->empty());
30 31
31 // First, try truncating each 64-bit thread ID to 32 bits. If that’s possible 32 // First, try truncating each 64-bit thread ID to 32 bits. If that’s possible
(...skipping 15 matching lines...) Expand all
47 } 48 }
48 49
49 if (collision) { 50 if (collision) {
50 // Since there was a collision, go back and assign each unique 64-bit thread 51 // Since there was a collision, go back and assign each unique 64-bit thread
51 // ID its own sequential 32-bit equivalent. The 32-bit thread IDs will not 52 // ID its own sequential 32-bit equivalent. The 32-bit thread IDs will not
52 // bear any resemblance to the original 64-bit thread IDs. 53 // bear any resemblance to the original 64-bit thread IDs.
53 thread_id_map->clear(); 54 thread_id_map->clear();
54 for (const ThreadSnapshot* thread_snapshot : thread_snapshots) { 55 for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
55 uint64_t thread_id_64 = thread_snapshot->ThreadID(); 56 uint64_t thread_id_64 = thread_snapshot->ThreadID();
56 if (thread_id_map->find(thread_id_64) == thread_id_map->end()) { 57 if (thread_id_map->find(thread_id_64) == thread_id_map->end()) {
57 uint32_t thread_id_32 = thread_id_map->size(); 58 uint32_t thread_id_32 =
59 base::checked_cast<uint32_t>(thread_id_map->size());
58 thread_id_map->insert(std::make_pair(thread_id_64, thread_id_32)); 60 thread_id_map->insert(std::make_pair(thread_id_64, thread_id_32));
59 } 61 }
60 } 62 }
61 63
62 DCHECK_LE(thread_id_map->size(), std::numeric_limits<uint32_t>::max()); 64 DCHECK_LE(thread_id_map->size(), std::numeric_limits<uint32_t>::max());
63 } 65 }
64 } 66 }
65 67
66 } // namespace crashpad 68 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_simple_string_dictionary_writer_test.cc ('k') | minidump/minidump_writable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698