Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: src/debug/debug-interface.h

Issue 2423713003: [inspector] introduce debug-interface.h (Closed)
Patch Set: move impl to api.cc Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug/debug.cc ('k') | src/inspector/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project 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 V8_DEBUG_DEBUG_INTERFACE_H_
6 #define V8_DEBUG_DEBUG_INTERFACE_H_
7
8 #include "include/v8-debug.h"
9 #include "include/v8.h"
10
11 namespace v8 {
12
13 class DebugInterface {
14 public:
15 /**
16 * An event details object passed to the debug event listener.
17 */
18 class EventDetails : public v8::Debug::EventDetails {
19 public:
20 /**
21 * Event type.
22 */
23 virtual v8::DebugEvent GetEvent() const = 0;
24
25 /**
26 * Access to execution state and event data of the debug event. Don't store
27 * these cross callbacks as their content becomes invalid.
28 */
29 virtual Local<Object> GetExecutionState() const = 0;
30 virtual Local<Object> GetEventData() const = 0;
31
32 /**
33 * Get the context active when the debug event happened. Note this is not
34 * the current active context as the JavaScript part of the debugger is
35 * running in its own context which is entered at this point.
36 */
37 virtual Local<Context> GetEventContext() const = 0;
38
39 /**
40 * Client data passed with the corresponding callback when it was
41 * registered.
42 */
43 virtual Local<Value> GetCallbackData() const = 0;
44
45 virtual ~EventDetails() {}
46 };
47
48 /**
49 * Debug event callback function.
50 *
51 * \param event_details object providing information about the debug event
52 *
53 * A EventCallback does not take possession of the event data,
54 * and must not rely on the data persisting after the handler returns.
55 */
56 typedef void (*EventCallback)(const EventDetails& event_details);
57
58 static bool SetDebugEventListener(Isolate* isolate, EventCallback that,
59 Local<Value> data = Local<Value>());
60
61 /**
62 * Debugger is running in its own context which is entered while debugger
63 * messages are being dispatched. This is an explicit getter for this
64 * debugger context. Note that the content of the debugger context is subject
65 * to change. The Context exists only when the debugger is active, i.e. at
66 * least one DebugEventListener or MessageHandler is set.
67 */
68 static Local<Context> GetDebugContext(Isolate* isolate);
69
70 /**
71 * Run a JavaScript function in the debugger.
72 * \param fun the function to call
73 * \param data passed as second argument to the function
74 * With this call the debugger is entered and the function specified is called
75 * with the execution state as the first argument. This makes it possible to
76 * get access to information otherwise not available during normal JavaScript
77 * execution e.g. details on stack frames. Receiver of the function call will
78 * be the debugger context global object, however this is a subject to change.
79 * The following example shows a JavaScript function which when passed to
80 * v8::Debug::Call will return the current line of JavaScript execution.
81 *
82 * \code
83 * function frame_source_line(exec_state) {
84 * return exec_state.frame(0).sourceLine();
85 * }
86 * \endcode
87 */
88 // TODO(dcarney): data arg should be a MaybeLocal
89 static MaybeLocal<Value> Call(Local<Context> context,
90 v8::Local<v8::Function> fun,
91 Local<Value> data = Local<Value>());
92
93 /**
94 * Enable/disable LiveEdit functionality for the given Isolate
95 * (default Isolate if not provided). V8 will abort if LiveEdit is
96 * unexpectedly used. LiveEdit is enabled by default.
97 */
98 static void SetLiveEditEnabled(Isolate* isolate, bool enable);
99
100 // Schedule a debugger break to happen when JavaScript code is run
101 // in the given isolate.
102 static void DebugBreak(Isolate* isolate);
103
104 // Remove scheduled debugger break in given isolate if it has not
105 // happened yet.
106 static void CancelDebugBreak(Isolate* isolate);
107
108 /**
109 * Returns array of internal properties specific to the value type. Result has
110 * the following format: [<name>, <value>,...,<name>, <value>]. Result array
111 * will be allocated in the current context.
112 */
113 static MaybeLocal<Array> GetInternalProperties(Isolate* isolate,
114 Local<Value> value);
115 };
116
117 } // namespace v8
118
119 #endif // V8_DEBUG_DEBUG_INTERFACE_H_
OLDNEW
« no previous file with comments | « src/debug/debug.cc ('k') | src/inspector/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698