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

Side by Side Diff: base/profiler/native_stack_sampler_win.cc

Issue 1410333006: Enough hacks to make wstring printfs unneeded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <objbase.h> 5 #include <objbase.h>
6 #include <windows.h> 6 #include <windows.h>
7 #include <winternl.h> 7 #include <winternl.h>
8 8
9 #include <cstdlib> 9 #include <cstdlib>
10 #include <map> 10 #include <map>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 GUID guid; 201 GUID guid;
202 DWORD age; 202 DWORD age;
203 win::PEImage(module_handle).GetDebugId(&guid, &age); 203 win::PEImage(module_handle).GetDebugId(&guid, &age);
204 const int kGUIDSize = 39; 204 const int kGUIDSize = 39;
205 std::wstring build_id; 205 std::wstring build_id;
206 int result = 206 int result =
207 ::StringFromGUID2(guid, WriteInto(&build_id, kGUIDSize), kGUIDSize); 207 ::StringFromGUID2(guid, WriteInto(&build_id, kGUIDSize), kGUIDSize);
208 if (result != kGUIDSize) 208 if (result != kGUIDSize)
209 return std::string(); 209 return std::string();
210 RemoveChars(build_id, L"{}-", &build_id); 210 RemoveChars(build_id, L"{}-", &build_id);
211 build_id += StringPrintf(L"%d", age); 211 //build_id += StringPrintf(L"%d", age);
212 return WideToUTF8(build_id); 212 return WideToUTF8(build_id);
213 } 213 }
214 214
215 // ScopedDisablePriorityBoost ------------------------------------------------- 215 // ScopedDisablePriorityBoost -------------------------------------------------
216 216
217 // Disables priority boost on a thread for the lifetime of the object. 217 // Disables priority boost on a thread for the lifetime of the object.
218 class ScopedDisablePriorityBoost { 218 class ScopedDisablePriorityBoost {
219 public: 219 public:
220 ScopedDisablePriorityBoost(HANDLE thread_handle); 220 ScopedDisablePriorityBoost(HANDLE thread_handle);
221 ~ScopedDisablePriorityBoost(); 221 ~ScopedDisablePriorityBoost();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 511
512 if (thread_handle) { 512 if (thread_handle) {
513 return scoped_ptr<NativeStackSampler>(new NativeStackSamplerWin( 513 return scoped_ptr<NativeStackSampler>(new NativeStackSamplerWin(
514 win::ScopedHandle(thread_handle))); 514 win::ScopedHandle(thread_handle)));
515 } 515 }
516 #endif 516 #endif
517 return scoped_ptr<NativeStackSampler>(); 517 return scoped_ptr<NativeStackSampler>();
518 } 518 }
519 519
520 } // namespace base 520 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698