Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / gin / public / debug.h
1 // 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 #ifndef GIN_PUBLIC_DEBUG_H_
6 #define GIN_PUBLIC_DEBUG_H_
7
8 #include "build/build_config.h"
9 #include "gin/gin_export.h"
10 #include "v8/include/v8.h"
11
12 namespace gin {
13
14 class GIN_EXPORT Debug {
15  public:
16   /* Installs a callback that is invoked on entry to every V8-generated
17    * function.
18    *
19    * This only affects IsolateHolder instances created after
20    * SetFunctionEntryHook was invoked.
21    */
22   static void SetFunctionEntryHook(v8::FunctionEntryHook entry_hook);
23
24   /* Installs a callback that is invoked each time jit code is added, moved,
25    * or removed.
26    *
27    * This only affects IsolateHolder instances created after
28    * SetJitCodeEventHandler was invoked.
29    */
30   static void SetJitCodeEventHandler(v8::JitCodeEventHandler event_handler);
31
32 #if defined(OS_WIN)
33   typedef void (__cdecl *CodeRangeCreatedCallback)(void*, size_t);
34
35   /* Sets a callback that is invoked for every new code range being created.
36    *
37    * On Win64, exception handling in jitted code is broken due to the fact
38    * that JS stack frames are not ABI compliant. It is possible to install
39    * custom handlers for the code range which holds the jitted code to work
40    * around this issue.
41    *
42    * https://code.google.com/p/v8/issues/detail?id=3598
43    */
44   static void SetCodeRangeCreatedCallback(CodeRangeCreatedCallback callback);
45
46   typedef void (__cdecl *CodeRangeDeletedCallback)(void*);
47
48   /* Sets a callback that is invoked for every previously registered code range
49    * when it is deleted.
50    */
51   static void SetCodeRangeDeletedCallback(CodeRangeDeletedCallback callback);
52 #endif
53 };
54
55 }  // namespace gin
56
57 #endif  // GIN_PUBLIC_DEBUG_H_