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

Side by Side Diff: base/debug/stack_trace_win.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 | « base/debug/stack_trace_posix.cc ('k') | base/environment.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/debug/stack_trace.h" 5 #include "base/debug/stack_trace.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <dbghelp.h> 8 #include <dbghelp.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // process). 64 // process).
65 DLOG(ERROR) << "SymInitialize failed: " << g_init_error; 65 DLOG(ERROR) << "SymInitialize failed: " << g_init_error;
66 return false; 66 return false;
67 } 67 }
68 68
69 // When transferring the binaries e.g. between bots, path put 69 // When transferring the binaries e.g. between bots, path put
70 // into the executable will get off. To still retrieve symbols correctly, 70 // into the executable will get off. To still retrieve symbols correctly,
71 // add the directory of the executable to symbol search path. 71 // add the directory of the executable to symbol search path.
72 // All following errors are non-fatal. 72 // All following errors are non-fatal.
73 const size_t kSymbolsArraySize = 1024; 73 const size_t kSymbolsArraySize = 1024;
74 scoped_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]); 74 std::unique_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]);
75 75
76 // Note: The below function takes buffer size as number of characters, 76 // Note: The below function takes buffer size as number of characters,
77 // not number of bytes! 77 // not number of bytes!
78 if (!SymGetSearchPathW(GetCurrentProcess(), 78 if (!SymGetSearchPathW(GetCurrentProcess(),
79 symbols_path.get(), 79 symbols_path.get(),
80 kSymbolsArraySize)) { 80 kSymbolsArraySize)) {
81 g_init_error = GetLastError(); 81 g_init_error = GetLastError();
82 DLOG(WARNING) << "SymGetSearchPath failed: " << g_init_error; 82 DLOG(WARNING) << "SymGetSearchPath failed: " << g_init_error;
83 return false; 83 return false;
84 } 84 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 (*os) << "\t" << trace_[i] << "\n"; 285 (*os) << "\t" << trace_[i] << "\n";
286 } 286 }
287 } else { 287 } else {
288 (*os) << "Backtrace:\n"; 288 (*os) << "Backtrace:\n";
289 context->OutputTraceToStream(trace_, count_, os); 289 context->OutputTraceToStream(trace_, count_, os);
290 } 290 }
291 } 291 }
292 292
293 } // namespace debug 293 } // namespace debug
294 } // namespace base 294 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/stack_trace_posix.cc ('k') | base/environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698