OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // If true, prints all messages sent and received by inspector. | 7 // If true, prints all messages sent and received by inspector. |
8 const printProtocolMessages = false; | 8 const printProtocolMessages = false; |
9 | 9 |
10 // The active wrapper instance. | 10 // The active wrapper instance. |
11 let activeWrapper = undefined; | 11 let activeWrapper = undefined; |
12 | 12 |
13 // Receiver function called by inspector, delegating to active wrapper. | 13 // Receiver function called by inspector, delegating to active wrapper. |
14 function receive(message) { | 14 function receive(message) { |
15 activeWrapper.receiveMessage(message); | 15 activeWrapper.receiveMessage(message); |
16 } | 16 } |
17 | 17 |
18 class DebugWrapper { | 18 class DebugWrapper { |
19 constructor() { | 19 constructor() { |
20 // Message dictionary storing {id, message} pairs. | 20 // Message dictionary storing {id, message} pairs. |
21 this.receivedMessages = new Map(); | 21 this.receivedMessages = new Map(); |
22 | 22 |
23 // Each message dispatched by the Debug wrapper is assigned a unique number | 23 // Each message dispatched by the Debug wrapper is assigned a unique number |
24 // using nextMessageId. | 24 // using nextMessageId. |
25 this.nextMessageId = 0; | 25 this.nextMessageId = 0; |
26 | 26 |
27 // The listener method called on certain events. | 27 // The listener method called on certain events. |
28 this.listener = undefined; | 28 this.listener = undefined; |
29 | 29 |
30 // TODO(jgruber): Determine which of these are still required and possible. | |
31 // Debug events which can occur in the V8 JavaScript engine. | 30 // Debug events which can occur in the V8 JavaScript engine. |
32 this.DebugEvent = { Break: 1, | 31 this.DebugEvent = { Break: 1, |
33 Exception: 2, | 32 Exception: 2, |
34 AfterCompile: 3, | 33 AfterCompile: 3, |
35 CompileError: 4, | 34 CompileError: 4, |
36 AsyncTaskEvent: 5 | |
37 }; | 35 }; |
38 | 36 |
39 // The different types of steps. | 37 // The different types of steps. |
40 this.StepAction = { StepOut: 0, | 38 this.StepAction = { StepOut: 0, |
41 StepNext: 1, | 39 StepNext: 1, |
42 StepIn: 2, | 40 StepIn: 2, |
43 StepFrame: 3, | 41 StepFrame: 3, |
44 }; | 42 }; |
45 | 43 |
46 // The different types of scripts matching enum ScriptType in objects.h. | 44 // The different types of scripts matching enum ScriptType in objects.h. |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 debug.instance = new DebugWrapper(); | 830 debug.instance = new DebugWrapper(); |
833 debug.instance.enable(); | 831 debug.instance.enable(); |
834 } | 832 } |
835 return debug.instance; | 833 return debug.instance; |
836 }}); | 834 }}); |
837 | 835 |
838 Object.defineProperty(debug, 'ScopeType', { get: function() { | 836 Object.defineProperty(debug, 'ScopeType', { get: function() { |
839 const instance = debug.Debug; | 837 const instance = debug.Debug; |
840 return instance.ScopeType; | 838 return instance.ScopeType; |
841 }}); | 839 }}); |
OLD | NEW |