Commit 05de3663 authored by Irina Yatsenko's avatar Irina Yatsenko Committed by Commit Bot

Implement adding crash keys for v8

The current integration of crash keys into v8 got the dependencies
wrong: it introduced into v8 a dependency on components and base. This
change is the second half of fixing the design to keep the dependencies
in the embedder. The change depends on
https://chromium-review.googlesource.com/c/v8/v8/+/1699102.

Bug: v8:9323
Change-Id: Ib5b497a50718c451ab38b2bf32c4d68f5a9e22e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1690003
Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Reviewed-by: default avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686502}
parent 022b777b
......@@ -15,6 +15,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
......@@ -275,6 +276,35 @@ void AddHistogramSample(void* hist, int sample) {
histogram->Add(sample);
}
void AddCrashKey(v8::CrashKeyId id, const std::string& value) {
namespace bd = base::debug;
switch (id) {
case v8::CrashKeyId::kIsolateAddress:
static bd::CrashKeyString* isolate_address = bd::AllocateCrashKeyString(
"v8_isolate_address", bd::CrashKeySize::Size32);
bd::SetCrashKeyString(isolate_address, value);
break;
case v8::CrashKeyId::kReadonlySpaceFirstPageAddress:
static bd::CrashKeyString* ro_space_firstpage_address =
bd::AllocateCrashKeyString("v8_ro_space_firstpage_address",
bd::CrashKeySize::Size32);
bd::SetCrashKeyString(ro_space_firstpage_address, value);
break;
case v8::CrashKeyId::kMapSpaceFirstPageAddress:
static bd::CrashKeyString* map_space_firstpage_address =
bd::AllocateCrashKeyString("v8_map_space_firstpage_address",
bd::CrashKeySize::Size32);
bd::SetCrashKeyString(map_space_firstpage_address, value);
break;
case v8::CrashKeyId::kCodeSpaceFirstPageAddress:
static bd::CrashKeyString* code_space_firstpage_address =
bd::AllocateCrashKeyString("v8_code_space_firstpage_address",
bd::CrashKeySize::Size32);
bd::SetCrashKeyString(code_space_firstpage_address, value);
break;
}
}
class FrameFactoryImpl : public mojom::FrameFactory {
public:
explicit FrameFactoryImpl(const service_manager::BindSourceInfo& source_info)
......@@ -1174,6 +1204,7 @@ void RenderThreadImpl::InitializeWebKit(
v8::Isolate* isolate = blink::MainThreadIsolate();
isolate->SetCreateHistogramFunction(CreateHistogram);
isolate->SetAddHistogramSampleFunction(AddHistogramSample);
isolate->SetAddCrashKeyCallback(AddCrashKey);
main_thread_compositor_task_runner_ =
main_thread_scheduler_->CompositorTaskRunner();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment