| OLD | NEW |
| 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 "android_webview/crash_reporter/aw_microdump_crash_reporter.h" | 5 #include "android_webview/crash_reporter/aw_microdump_crash_reporter.h" |
| 6 | 6 |
| 7 #include "android_webview/common/aw_version_info_values.h" | 7 #include "android_webview/common/aw_version_info_values.h" |
| 8 #include "base/android/build_info.h" |
| 8 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
| 9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 11 #include "base/scoped_native_library.h" | 12 #include "base/scoped_native_library.h" |
| 12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "components/crash/content/app/breakpad_linux.h" | 15 #include "components/crash/content/app/breakpad_linux.h" |
| 15 #include "components/crash/content/app/crash_reporter_client.h" | 16 #include "components/crash/content/app/crash_reporter_client.h" |
| 16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 17 | 18 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DISALLOW_COPY_AND_ASSIGN(AwCrashReporterClient); | 61 DISALLOW_COPY_AND_ASSIGN(AwCrashReporterClient); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 base::LazyInstance<AwCrashReporterClient>::Leaky g_crash_reporter_client = | 64 base::LazyInstance<AwCrashReporterClient>::Leaky g_crash_reporter_client = |
| 64 LAZY_INSTANCE_INITIALIZER; | 65 LAZY_INSTANCE_INITIALIZER; |
| 65 | 66 |
| 66 bool g_enabled = false; | 67 bool g_enabled = false; |
| 67 | 68 |
| 68 #if defined(ARCH_CPU_X86_FAMILY) | 69 #if defined(ARCH_CPU_X86_FAMILY) |
| 69 bool SafeToUseSignalHandler() { | 70 bool SafeToUseSignalHandler() { |
| 71 // N+ shared library namespacing means that we are unable to dlopen |
| 72 // libnativebridge (because it isn't in the NDK). However we know |
| 73 // that, were we able to, the tests below would pass, so just return |
| 74 // true here. |
| 75 if (base::android::BuildInfo::GetInstance()->sdk_int() >= |
| 76 base::android::SDK_VERSION_NOUGAT) { |
| 77 return true; |
| 78 } |
| 70 // On X86/64 there are binary translators that handle SIGSEGV in userspace and | 79 // On X86/64 there are binary translators that handle SIGSEGV in userspace and |
| 71 // may get chained after our handler - see http://crbug.com/477444 | 80 // may get chained after our handler - see http://crbug.com/477444 |
| 72 // We attempt to detect this to work out when it's safe to install breakpad. | 81 // We attempt to detect this to work out when it's safe to install breakpad. |
| 73 // If anything doesn't seem right we assume it's not safe. | 82 // If anything doesn't seem right we assume it's not safe. |
| 74 | 83 |
| 75 // type and mangled name of android::NativeBridgeInitialized | 84 // type and mangled name of android::NativeBridgeInitialized |
| 76 typedef bool (*InitializedFunc)(); | 85 typedef bool (*InitializedFunc)(); |
| 77 const char kInitializedSymbol[] = "_ZN7android23NativeBridgeInitializedEv"; | 86 const char kInitializedSymbol[] = "_ZN7android23NativeBridgeInitializedEv"; |
| 78 // type and mangled name of android::NativeBridgeGetVersion | 87 // type and mangled name of android::NativeBridgeGetVersion |
| 79 typedef uint32_t (*VersionFunc)(); | 88 typedef uint32_t (*VersionFunc)(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const std::string& gpu_fingerprint) { | 153 const std::string& gpu_fingerprint) { |
| 145 breakpad::AddGpuFingerprintToMicrodumpCrashHandler(gpu_fingerprint); | 154 breakpad::AddGpuFingerprintToMicrodumpCrashHandler(gpu_fingerprint); |
| 146 } | 155 } |
| 147 | 156 |
| 148 bool DumpWithoutCrashingToFd(int fd) { | 157 bool DumpWithoutCrashingToFd(int fd) { |
| 149 return g_crash_reporter_client.Pointer()->DumpWithoutCrashingToFd(fd); | 158 return g_crash_reporter_client.Pointer()->DumpWithoutCrashingToFd(fd); |
| 150 } | 159 } |
| 151 | 160 |
| 152 } // namespace crash_reporter | 161 } // namespace crash_reporter |
| 153 } // namespace android_webview | 162 } // namespace android_webview |
| OLD | NEW |