| OLD | NEW |
| 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 "chrome/app/breakpad_win.h" | 5 #include "chrome/app/breakpad_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <tchar.h> | 9 #include <tchar.h> |
| 10 #include <userenv.h> | 10 #include <userenv.h> |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return 0; | 123 return 0; |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Injects a thread into a remote process to dump state when there is no crash. | 126 // Injects a thread into a remote process to dump state when there is no crash. |
| 127 extern "C" HANDLE __declspec(dllexport) __cdecl | 127 extern "C" HANDLE __declspec(dllexport) __cdecl |
| 128 InjectDumpProcessWithoutCrash(HANDLE process) { | 128 InjectDumpProcessWithoutCrash(HANDLE process) { |
| 129 return CreateRemoteThread(process, NULL, 0, DumpProcessWithoutCrashThread, | 129 return CreateRemoteThread(process, NULL, 0, DumpProcessWithoutCrashThread, |
| 130 0, 0, NULL); | 130 0, 0, NULL); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // The following two functions do exactly the same thing as the two above. But |
| 134 // we want the signatures to be different so that we can easily track them in |
| 135 // crash reports. |
| 136 // TODO(yzshen): Remove when enough information is collected and the hang rate |
| 137 // of pepper/renderer processes is reduced. |
| 138 DWORD WINAPI DumpForHangDebuggingThread(void*) { |
| 139 DumpProcessWithoutCrash(); |
| 140 return 0; |
| 141 } |
| 142 |
| 143 extern "C" HANDLE __declspec(dllexport) __cdecl |
| 144 InjectDumpForHangDebugging(HANDLE process) { |
| 145 return CreateRemoteThread(process, NULL, 0, DumpForHangDebuggingThread, |
| 146 0, 0, NULL); |
| 147 } |
| 148 |
| 133 // Reduces the size of the string |str| to a max of 64 chars. Required because | 149 // Reduces the size of the string |str| to a max of 64 chars. Required because |
| 134 // breakpad's CustomInfoEntry raises an invalid_parameter error if the string | 150 // breakpad's CustomInfoEntry raises an invalid_parameter error if the string |
| 135 // we want to set is longer. | 151 // we want to set is longer. |
| 136 std::wstring TrimToBreakpadMax(const std::wstring& str) { | 152 std::wstring TrimToBreakpadMax(const std::wstring& str) { |
| 137 std::wstring shorter(str); | 153 std::wstring shorter(str); |
| 138 return shorter.substr(0, | 154 return shorter.substr(0, |
| 139 google_breakpad::CustomInfoEntry::kValueMaxLength - 1); | 155 google_breakpad::CustomInfoEntry::kValueMaxLength - 1); |
| 140 } | 156 } |
| 141 | 157 |
| 142 static void SetIntegerValue(size_t offset, int value) { | 158 static void SetIntegerValue(size_t offset, int value) { |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 previous_filter = SetUnhandledExceptionFilter(filter); | 930 previous_filter = SetUnhandledExceptionFilter(filter); |
| 915 } | 931 } |
| 916 | 932 |
| 917 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, | 933 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, |
| 918 std::vector<const wchar_t*>* cstrings) { | 934 std::vector<const wchar_t*>* cstrings) { |
| 919 cstrings->clear(); | 935 cstrings->clear(); |
| 920 cstrings->reserve(wstrings.size()); | 936 cstrings->reserve(wstrings.size()); |
| 921 for (size_t i = 0; i < wstrings.size(); ++i) | 937 for (size_t i = 0; i < wstrings.size(); ++i) |
| 922 cstrings->push_back(wstrings[i].c_str()); | 938 cstrings->push_back(wstrings[i].c_str()); |
| 923 } | 939 } |
| OLD | NEW |