blob: 5657ec38e9b3bead9f31c7a5ef2db6080f09ad36 [file] [log] [blame]
James Robinsona9763132014-10-06 11:18:13 -07001// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "gin/debug_impl.h"
6
7namespace gin {
8
9namespace {
10v8::FunctionEntryHook g_entry_hook = NULL;
11v8::JitCodeEventHandler g_jit_code_event_handler = NULL;
12#if defined(OS_WIN)
13Debug::CodeRangeCreatedCallback g_code_range_created_callback = NULL;
14Debug::CodeRangeDeletedCallback g_code_range_deleted_callback = NULL;
15#endif
16} // namespace
17
18// static
19void Debug::SetFunctionEntryHook(v8::FunctionEntryHook entry_hook) {
20 g_entry_hook = entry_hook;
21}
22
23// static
24void Debug::SetJitCodeEventHandler(v8::JitCodeEventHandler event_handler) {
25 g_jit_code_event_handler = event_handler;
26}
27
28#if defined(OS_WIN)
29// static
30void Debug::SetCodeRangeCreatedCallback(CodeRangeCreatedCallback callback) {
31 g_code_range_created_callback = callback;
32}
33
34// static
35void Debug::SetCodeRangeDeletedCallback(CodeRangeDeletedCallback callback) {
36 g_code_range_deleted_callback = callback;
37}
38#endif
39
40// static
41v8::FunctionEntryHook DebugImpl::GetFunctionEntryHook() {
42 return g_entry_hook;
43}
44
45// static
46v8::JitCodeEventHandler DebugImpl::GetJitCodeEventHandler() {
47 return g_jit_code_event_handler;
48}
49
50#if defined(OS_WIN)
51// static
52Debug::CodeRangeCreatedCallback DebugImpl::GetCodeRangeCreatedCallback() {
53 return g_code_range_created_callback;
54}
55
56// static
57Debug::CodeRangeDeletedCallback DebugImpl::GetCodeRangeDeletedCallback() {
58 return g_code_range_deleted_callback;
59}
60#endif
61
62} // namespace gin