Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "chrome/app/breakpad_field_trial_win.h" | 29 #include "chrome/app/breakpad_field_trial_win.h" |
| 30 #include "chrome/app/hard_error_handler_win.h" | 30 #include "chrome/app/hard_error_handler_win.h" |
| 31 #include "chrome/common/child_process_logging.h" | 31 #include "chrome/common/child_process_logging.h" |
| 32 #include "chrome/common/chrome_result_codes.h" | 32 #include "chrome/common/chrome_result_codes.h" |
| 33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/env_vars.h" | 34 #include "chrome/common/env_vars.h" |
| 35 #include "chrome/installer/util/google_chrome_sxs_distribution.h" | 35 #include "chrome/installer/util/google_chrome_sxs_distribution.h" |
| 36 #include "chrome/installer/util/google_update_settings.h" | 36 #include "chrome/installer/util/google_update_settings.h" |
| 37 #include "chrome/installer/util/install_util.h" | 37 #include "chrome/installer/util/install_util.h" |
| 38 #include "policy/policy_constants.h" | 38 #include "policy/policy_constants.h" |
| 39 #include "ppapi/shared_impl/ppapi_message_tracker.h" | |
| 39 | 40 |
| 40 // userenv.dll is required for GetProfileType(). | 41 // userenv.dll is required for GetProfileType(). |
| 41 #pragma comment(lib, "userenv.lib") | 42 #pragma comment(lib, "userenv.lib") |
| 42 | 43 |
| 43 namespace breakpad_win { | 44 namespace breakpad_win { |
| 44 | 45 |
| 45 // TODO(raymes): Modify the way custom crash info is stored. g_custom_entries | 46 // TODO(raymes): Modify the way custom crash info is stored. g_custom_entries |
| 46 // is way too too fragile. See | 47 // is way too too fragile. See |
| 47 // https://code.google.com/p/chromium/issues/detail?id=137062. | 48 // https://code.google.com/p/chromium/issues/detail?id=137062. |
| 48 std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL; | 49 std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 return 0; | 124 return 0; |
| 124 } | 125 } |
| 125 | 126 |
| 126 // Injects a thread into a remote process to dump state when there is no crash. | 127 // Injects a thread into a remote process to dump state when there is no crash. |
| 127 extern "C" HANDLE __declspec(dllexport) __cdecl | 128 extern "C" HANDLE __declspec(dllexport) __cdecl |
| 128 InjectDumpProcessWithoutCrash(HANDLE process) { | 129 InjectDumpProcessWithoutCrash(HANDLE process) { |
| 129 return CreateRemoteThread(process, NULL, 0, DumpProcessWithoutCrashThread, | 130 return CreateRemoteThread(process, NULL, 0, DumpProcessWithoutCrashThread, |
| 130 0, 0, NULL); | 131 0, 0, NULL); |
| 131 } | 132 } |
| 132 | 133 |
| 134 DWORD WINAPI DumpProcessHandlingPepper(void*) { | |
|
brettw
2012/09/14 19:44:37
It would make more sense to me if this was called
yzshen1
2012/09/14 20:07:19
Done.
| |
| 135 if (ppapi::PpapiMessageTracker::GetInstance()->IsHandlingMessage()) | |
| 136 DumpProcessWithoutCrash(); | |
| 137 return 0; | |
| 138 } | |
| 139 | |
| 140 // Injects a thread into a remote process to dump state if the process is | |
| 141 // handling pepper messages. | |
| 142 extern "C" HANDLE __declspec(dllexport) __cdecl | |
| 143 InjectDumpProcessHandlingPepper(HANDLE process) { | |
| 144 return CreateRemoteThread(process, NULL, 0, DumpProcessHandlingPepper, 0, 0, | |
| 145 NULL); | |
| 146 } | |
| 147 | |
| 133 // Reduces the size of the string |str| to a max of 64 chars. Required because | 148 // 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 | 149 // breakpad's CustomInfoEntry raises an invalid_parameter error if the string |
| 135 // we want to set is longer. | 150 // we want to set is longer. |
| 136 std::wstring TrimToBreakpadMax(const std::wstring& str) { | 151 std::wstring TrimToBreakpadMax(const std::wstring& str) { |
| 137 std::wstring shorter(str); | 152 std::wstring shorter(str); |
| 138 return shorter.substr(0, | 153 return shorter.substr(0, |
| 139 google_breakpad::CustomInfoEntry::kValueMaxLength - 1); | 154 google_breakpad::CustomInfoEntry::kValueMaxLength - 1); |
| 140 } | 155 } |
| 141 | 156 |
| 142 static void SetIntegerValue(size_t offset, int value) { | 157 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); | 929 previous_filter = SetUnhandledExceptionFilter(filter); |
| 915 } | 930 } |
| 916 | 931 |
| 917 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, | 932 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, |
| 918 std::vector<const wchar_t*>* cstrings) { | 933 std::vector<const wchar_t*>* cstrings) { |
| 919 cstrings->clear(); | 934 cstrings->clear(); |
| 920 cstrings->reserve(wstrings.size()); | 935 cstrings->reserve(wstrings.size()); |
| 921 for (size_t i = 0; i < wstrings.size(); ++i) | 936 for (size_t i = 0; i < wstrings.size(); ++i) |
| 922 cstrings->push_back(wstrings[i].c_str()); | 937 cstrings->push_back(wstrings[i].c_str()); |
| 923 } | 938 } |
| OLD | NEW |