mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-22 13:26:12 +03:00
base: Add Android stubs
This commit is contained in:
parent
f1b3f0089f
commit
a886d96513
@ -1134,63 +1134,18 @@ component("base") {
|
|||||||
# Android.
|
# Android.
|
||||||
if (is_android) {
|
if (is_android) {
|
||||||
sources += [
|
sources += [
|
||||||
"android/android_hardware_buffer_compat.cc",
|
|
||||||
"android/android_hardware_buffer_compat.h",
|
"android/android_hardware_buffer_compat.h",
|
||||||
"android/android_image_reader_abi.h",
|
|
||||||
"android/android_image_reader_compat.cc",
|
|
||||||
"android/android_image_reader_compat.h",
|
|
||||||
"android/apk_assets.cc",
|
|
||||||
"android/apk_assets.h",
|
|
||||||
"android/application_status_listener.cc",
|
|
||||||
"android/application_status_listener.h",
|
"android/application_status_listener.h",
|
||||||
"android/base_feature_map.cc",
|
"android/application_status_listener_stub.cc",
|
||||||
"android/base_features.cc",
|
|
||||||
"android/base_features.h",
|
|
||||||
"android/build_info.cc",
|
|
||||||
"android/build_info.h",
|
"android/build_info.h",
|
||||||
"android/bundle_utils.cc",
|
"android/build_info_stub.cc",
|
||||||
"android/bundle_utils.h",
|
|
||||||
"android/child_process_binding_types.h",
|
|
||||||
"android/child_process_service.cc",
|
|
||||||
"android/content_uri_utils.cc",
|
|
||||||
"android/content_uri_utils.h",
|
"android/content_uri_utils.h",
|
||||||
"android/cpu_features.cc",
|
"android/content_uri_utils_stub.cc",
|
||||||
"android/early_trace_event_binding.cc",
|
"android/jni_android.h",
|
||||||
"android/early_trace_event_binding.h",
|
"android/jni_android_stub.cc",
|
||||||
"android/event_log.cc",
|
|
||||||
"android/event_log.h",
|
|
||||||
"android/feature_list_jni.cc",
|
|
||||||
"android/feature_map.cc",
|
|
||||||
"android/feature_map.h",
|
|
||||||
"android/features_jni.cc",
|
|
||||||
"android/field_trial_list.cc",
|
|
||||||
"android/important_file_writer_android.cc",
|
|
||||||
"android/int_string_callback.cc",
|
|
||||||
"android/int_string_callback.h",
|
|
||||||
"android/jank_metric_uma_recorder.cc",
|
|
||||||
"android/jank_metric_uma_recorder.h",
|
|
||||||
"android/java_handler_thread.cc",
|
|
||||||
"android/java_handler_thread.h",
|
|
||||||
"android/java_heap_dump_generator.cc",
|
|
||||||
"android/java_heap_dump_generator.h",
|
|
||||||
"android/java_runtime.cc",
|
|
||||||
"android/java_runtime.h",
|
|
||||||
"android/library_loader/anchor_functions.cc",
|
|
||||||
"android/library_loader/anchor_functions.h",
|
"android/library_loader/anchor_functions.h",
|
||||||
"android/library_loader/library_prefetcher.cc",
|
"android/library_loader/library_loader_hooks.h",
|
||||||
"android/library_loader/library_prefetcher.h",
|
|
||||||
"android/library_loader/library_prefetcher_hooks.cc",
|
|
||||||
"android/locale_utils.cc",
|
|
||||||
"android/locale_utils.h",
|
|
||||||
"android/meminfo_dump_provider.cc",
|
|
||||||
"android/meminfo_dump_provider.h",
|
|
||||||
"android/memory_pressure_listener_android.cc",
|
|
||||||
"android/memory_pressure_listener_android.h",
|
|
||||||
"android/path_service_android.cc",
|
|
||||||
"android/path_utils.cc",
|
|
||||||
"android/path_utils.h",
|
"android/path_utils.h",
|
||||||
"android/radio_utils.cc",
|
|
||||||
"android/radio_utils.h",
|
|
||||||
"android/reached_addresses_bitset.cc",
|
"android/reached_addresses_bitset.cc",
|
||||||
"android/reached_addresses_bitset.h",
|
"android/reached_addresses_bitset.h",
|
||||||
"android/reached_code_profiler.cc",
|
"android/reached_code_profiler.cc",
|
||||||
@ -1199,22 +1154,9 @@ component("base") {
|
|||||||
"android/scoped_hardware_buffer_fence_sync.h",
|
"android/scoped_hardware_buffer_fence_sync.h",
|
||||||
"android/scoped_hardware_buffer_handle.cc",
|
"android/scoped_hardware_buffer_handle.cc",
|
||||||
"android/scoped_hardware_buffer_handle.h",
|
"android/scoped_hardware_buffer_handle.h",
|
||||||
"android/shared_preferences/shared_preferences_manager.cc",
|
"android/scoped_java_ref.cc",
|
||||||
"android/shared_preferences/shared_preferences_manager.h",
|
"android/scoped_java_ref.h",
|
||||||
"android/statistics_recorder_android.cc",
|
|
||||||
"android/sys_utils.cc",
|
|
||||||
"android/sys_utils.h",
|
"android/sys_utils.h",
|
||||||
"android/task_scheduler/post_task_android.cc",
|
|
||||||
"android/task_scheduler/post_task_android.h",
|
|
||||||
"android/task_scheduler/task_runner_android.cc",
|
|
||||||
"android/task_scheduler/task_runner_android.h",
|
|
||||||
"android/task_scheduler/task_traits_android.h",
|
|
||||||
"android/thread_instruction_count.cc",
|
|
||||||
"android/thread_instruction_count.h",
|
|
||||||
"android/timezone_utils.cc",
|
|
||||||
"android/timezone_utils.h",
|
|
||||||
"android/unguessable_token_android.cc",
|
|
||||||
"android/unguessable_token_android.h",
|
|
||||||
"debug/stack_trace_android.cc",
|
"debug/stack_trace_android.cc",
|
||||||
"files/file_util_android.cc",
|
"files/file_util_android.cc",
|
||||||
"files/scoped_file_android.cc",
|
"files/scoped_file_android.cc",
|
||||||
@ -1229,14 +1171,13 @@ component("base") {
|
|||||||
"profiler/native_unwinder_android_memory_regions_map.h",
|
"profiler/native_unwinder_android_memory_regions_map.h",
|
||||||
"profiler/stack_sampler_android.cc",
|
"profiler/stack_sampler_android.cc",
|
||||||
"system/sys_info_android.cc",
|
"system/sys_info_android.cc",
|
||||||
"threading/platform_thread_android.cc",
|
"threading/platform_thread_android_stub.cc",
|
||||||
|
|
||||||
# Android uses some Linux sources.
|
# Android uses some Linux sources.
|
||||||
"debug/elf_reader.cc",
|
"debug/elf_reader.cc",
|
||||||
"debug/elf_reader.h",
|
"debug/elf_reader.h",
|
||||||
"debug/proc_maps_linux.cc",
|
"debug/proc_maps_linux.cc",
|
||||||
"debug/proc_maps_linux.h",
|
"debug/proc_maps_linux.h",
|
||||||
"power_monitor/power_monitor_device_source_android.cc",
|
|
||||||
"process/internal_linux.cc",
|
"process/internal_linux.cc",
|
||||||
"process/internal_linux.h",
|
"process/internal_linux.h",
|
||||||
"process/memory_linux.cc",
|
"process/memory_linux.cc",
|
||||||
@ -1306,7 +1247,7 @@ component("base") {
|
|||||||
# Make jni.h available.
|
# Make jni.h available.
|
||||||
configs += [ "//third_party/jdk" ]
|
configs += [ "//third_party/jdk" ]
|
||||||
}
|
}
|
||||||
if (is_android || is_robolectric) {
|
if (is_robolectric) {
|
||||||
sources += [
|
sources += [
|
||||||
"android/base_jni_onload.cc",
|
"android/base_jni_onload.cc",
|
||||||
"android/base_jni_onload.h",
|
"android/base_jni_onload.h",
|
||||||
|
35
src/base/android/application_status_listener_stub.cc
Normal file
35
src/base/android/application_status_listener_stub.cc
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "base/android/application_status_listener.h"
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
ApplicationStatusListener::ApplicationStatusListener() = default;
|
||||||
|
ApplicationStatusListener::~ApplicationStatusListener() = default;
|
||||||
|
|
||||||
|
// static
|
||||||
|
std::unique_ptr<ApplicationStatusListener> ApplicationStatusListener::New(
|
||||||
|
const ApplicationStateChangeCallback& callback) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void ApplicationStatusListener::NotifyApplicationStateChange(
|
||||||
|
ApplicationState state) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
ApplicationState ApplicationStatusListener::GetState() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool ApplicationStatusListener::HasVisibleActivities() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace android
|
||||||
|
} // namespace base
|
74
src/base/android/build_info_stub.cc
Normal file
74
src/base/android/build_info_stub.cc
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "base/android/build_info.h"
|
||||||
|
#include "base/notreached.h"
|
||||||
|
|
||||||
|
int __system_property_get(const char* name, char* value);
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
int GetSdkInt() {
|
||||||
|
constexpr int kPropNameMax = 32;
|
||||||
|
char prop_info[kPropNameMax];
|
||||||
|
__system_property_get("ro.build.version.sdk", prop_info);
|
||||||
|
return std::atoi(prop_info);
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
struct BuildInfoSingletonTraits {
|
||||||
|
static BuildInfo* New() { return new BuildInfo({}); }
|
||||||
|
|
||||||
|
static void Delete(BuildInfo* x) {
|
||||||
|
// We're leaking this type, see kRegisterAtExit.
|
||||||
|
NOTREACHED();
|
||||||
|
}
|
||||||
|
|
||||||
|
static const bool kRegisterAtExit = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
BuildInfo::BuildInfo(const std::vector<std::string>& params)
|
||||||
|
: brand_(""),
|
||||||
|
device_(""),
|
||||||
|
android_build_id_(""),
|
||||||
|
manufacturer_(""),
|
||||||
|
model_(""),
|
||||||
|
sdk_int_(GetSdkInt()),
|
||||||
|
build_type_(""),
|
||||||
|
board_(""),
|
||||||
|
host_package_name_(""),
|
||||||
|
host_version_code_(""),
|
||||||
|
host_package_label_(""),
|
||||||
|
package_name_(""),
|
||||||
|
package_version_code_(""),
|
||||||
|
package_version_name_(""),
|
||||||
|
android_build_fp_(""),
|
||||||
|
gms_version_code_(""),
|
||||||
|
installer_package_name_(""),
|
||||||
|
abi_name_(""),
|
||||||
|
custom_themes_(""),
|
||||||
|
resources_version_(""),
|
||||||
|
target_sdk_version_(0),
|
||||||
|
is_debug_android_(false),
|
||||||
|
is_tv_(false),
|
||||||
|
version_incremental_(""),
|
||||||
|
hardware_(""),
|
||||||
|
is_at_least_t_(false),
|
||||||
|
is_automotive_(false),
|
||||||
|
is_at_least_u_(false),
|
||||||
|
targets_at_least_u_(false),
|
||||||
|
codename_(""),
|
||||||
|
vulkan_deqp_level_(0) {}
|
||||||
|
|
||||||
|
// static
|
||||||
|
BuildInfo* BuildInfo::GetInstance() {
|
||||||
|
return Singleton<BuildInfo, BuildInfoSingletonTraits>::get();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace android
|
||||||
|
} // namespace base
|
34
src/base/android/content_uri_utils_stub.cc
Normal file
34
src/base/android/content_uri_utils_stub.cc
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "base/android/content_uri_utils.h"
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
|
||||||
|
bool ContentUriExists(const FilePath& content_uri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
File OpenContentUriForRead(const FilePath& content_uri) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetContentUriMimeType(const FilePath& content_uri) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MaybeGetFileDisplayName(const FilePath& content_uri,
|
||||||
|
std::u16string* file_display_name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeleteContentUri(const FilePath& content_uri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePath GetContentUriFromFilePath(const FilePath& file_path) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace base
|
127
src/base/android/jni_android_stub.cc
Normal file
127
src/base/android/jni_android_stub.cc
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "base/android/jni_android.h"
|
||||||
|
|
||||||
|
#include "base/debug/debugging_buildflags.h"
|
||||||
|
#include "base/lazy_instance.h"
|
||||||
|
#include "base/threading/thread_local.h"
|
||||||
|
#include "third_party/abseil-cpp/absl/base/attributes.h"
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
namespace android {
|
||||||
|
JNIEnv* AttachCurrentThread() {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEnv* AttachCurrentThreadWithName(const std::string& thread_name) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DetachFromVM() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitVM(JavaVM* vm) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsVMInitialized() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
JavaVM* GetVM() {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableJvmForTesting() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitGlobalClassLoader(JNIEnv* env) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedJavaLocalRef<jclass> GetClass(JNIEnv* env,
|
||||||
|
const char* class_name,
|
||||||
|
const char* split_name) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedJavaLocalRef<jclass> GetClass(JNIEnv* env, const char* class_name) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is duplicated with LazyGetClass below because these are performance
|
||||||
|
// sensitive.
|
||||||
|
jclass LazyGetClass(JNIEnv* env,
|
||||||
|
const char* class_name,
|
||||||
|
const char* split_name,
|
||||||
|
std::atomic<jclass>* atomic_class_id) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is duplicated with LazyGetClass above because these are performance
|
||||||
|
// sensitive.
|
||||||
|
jclass LazyGetClass(JNIEnv* env,
|
||||||
|
const char* class_name,
|
||||||
|
std::atomic<jclass>* atomic_class_id) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<MethodID::Type type>
|
||||||
|
jmethodID MethodID::Get(JNIEnv* env,
|
||||||
|
jclass clazz,
|
||||||
|
const char* method_name,
|
||||||
|
const char* jni_signature) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If |atomic_method_id| set, it'll return immediately. Otherwise, it'll call
|
||||||
|
// into ::Get() above. If there's a race, it's ok since the values are the same
|
||||||
|
// (and the duplicated effort will happen only once).
|
||||||
|
template<MethodID::Type type>
|
||||||
|
jmethodID MethodID::LazyGet(JNIEnv* env,
|
||||||
|
jclass clazz,
|
||||||
|
const char* method_name,
|
||||||
|
const char* jni_signature,
|
||||||
|
std::atomic<jmethodID>* atomic_method_id) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Various template instantiations.
|
||||||
|
template jmethodID MethodID::Get<MethodID::TYPE_STATIC>(
|
||||||
|
JNIEnv* env, jclass clazz, const char* method_name,
|
||||||
|
const char* jni_signature);
|
||||||
|
|
||||||
|
template jmethodID MethodID::Get<MethodID::TYPE_INSTANCE>(
|
||||||
|
JNIEnv* env, jclass clazz, const char* method_name,
|
||||||
|
const char* jni_signature);
|
||||||
|
|
||||||
|
template jmethodID MethodID::LazyGet<MethodID::TYPE_STATIC>(
|
||||||
|
JNIEnv* env, jclass clazz, const char* method_name,
|
||||||
|
const char* jni_signature, std::atomic<jmethodID>* atomic_method_id);
|
||||||
|
|
||||||
|
template jmethodID MethodID::LazyGet<MethodID::TYPE_INSTANCE>(
|
||||||
|
JNIEnv* env, jclass clazz, const char* method_name,
|
||||||
|
const char* jni_signature, std::atomic<jmethodID>* atomic_method_id);
|
||||||
|
|
||||||
|
bool HasException(JNIEnv* env) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClearException(JNIEnv* env) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckException(JNIEnv* env) {
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetJavaExceptionInfo(JNIEnv* env,
|
||||||
|
const JavaRef<jthrowable>& java_throwable) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetJavaStackTraceIfPresent() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace android
|
||||||
|
} // namespace base
|
102
src/base/threading/platform_thread_android_stub.cc
Normal file
102
src/base/threading/platform_thread_android_stub.cc
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "base/threading/platform_thread.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/prctl.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "base/lazy_instance.h"
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "base/threading/platform_thread_internal_posix.h"
|
||||||
|
#include "base/threading/thread_id_name_manager.h"
|
||||||
|
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||||
|
|
||||||
|
namespace base {
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
// - kRealtimeAudio corresponds to Android's PRIORITY_AUDIO = -16 value.
|
||||||
|
// - kDisplay corresponds to Android's PRIORITY_DISPLAY = -4 value.
|
||||||
|
// - kBackground corresponds to Android's PRIORITY_BACKGROUND = 10 value and can
|
||||||
|
// result in heavy throttling and force the thread onto a little core on
|
||||||
|
// big.LITTLE devices.
|
||||||
|
const ThreadPriorityToNiceValuePairForTest
|
||||||
|
kThreadPriorityToNiceValueMapForTest[7] = {
|
||||||
|
{ThreadPriorityForTest::kRealtimeAudio, -16},
|
||||||
|
{ThreadPriorityForTest::kDisplay, -4},
|
||||||
|
{ThreadPriorityForTest::kCompositing, -4},
|
||||||
|
{ThreadPriorityForTest::kNormal, 0},
|
||||||
|
{ThreadPriorityForTest::kResourceEfficient, 0},
|
||||||
|
{ThreadPriorityForTest::kUtility, 1},
|
||||||
|
{ThreadPriorityForTest::kBackground, 10},
|
||||||
|
};
|
||||||
|
|
||||||
|
// - kBackground corresponds to Android's PRIORITY_BACKGROUND = 10 value and can
|
||||||
|
// result in heavy throttling and force the thread onto a little core on
|
||||||
|
// big.LITTLE devices.
|
||||||
|
// - kCompositing and kDisplayCritical corresponds to Android's PRIORITY_DISPLAY
|
||||||
|
// = -4 value.
|
||||||
|
// - kRealtimeAudio corresponds to Android's PRIORITY_AUDIO = -16 value.
|
||||||
|
const ThreadTypeToNiceValuePair kThreadTypeToNiceValueMap[7] = {
|
||||||
|
{ThreadType::kBackground, 10}, {ThreadType::kUtility, 1},
|
||||||
|
{ThreadType::kResourceEfficient, 0}, {ThreadType::kDefault, 0},
|
||||||
|
{ThreadType::kCompositing, -4}, {ThreadType::kDisplayCritical, -4},
|
||||||
|
{ThreadType::kRealtimeAudio, -16},
|
||||||
|
};
|
||||||
|
|
||||||
|
bool CanSetThreadTypeToRealtimeAudio() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SetCurrentThreadTypeForPlatform(ThreadType thread_type,
|
||||||
|
MessagePumpType pump_type_hint) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::optional<ThreadPriorityForTest>
|
||||||
|
GetCurrentThreadPriorityForPlatformForTest() {
|
||||||
|
return absl::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
|
void PlatformThread::SetName(const std::string& name) {
|
||||||
|
ThreadIdNameManager::GetInstance()->SetName(name);
|
||||||
|
|
||||||
|
// Like linux, on android we can get the thread names to show up in the
|
||||||
|
// debugger by setting the process name for the LWP.
|
||||||
|
// We don't want to do this for the main thread because that would rename
|
||||||
|
// the process, causing tools like killall to stop working.
|
||||||
|
if (PlatformThread::CurrentId() == getpid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Set the name for the LWP (which gets truncated to 15 characters).
|
||||||
|
int err = prctl(PR_SET_NAME, name.c_str());
|
||||||
|
if (err < 0 && errno != EPERM)
|
||||||
|
DPLOG(ERROR) << "prctl(PR_SET_NAME)";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InitThreading() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void TerminateOnThread() {
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
|
||||||
|
#if !defined(ADDRESS_SANITIZER)
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
// AddressSanitizer bloats the stack approximately 2x. Default stack size of
|
||||||
|
// 1Mb is not enough for some tests (see http://crbug.com/263749 for example).
|
||||||
|
return 2 * (1 << 20); // 2Mb
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace base
|
Loading…
Reference in New Issue
Block a user