OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 MOJO_DART_EMBEDDER_DART_DEBUGGER_H_ | |
6 #define MOJO_DART_EMBEDDER_DART_DEBUGGER_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "dart/runtime/include/dart_api.h" | |
12 #include "dart/runtime/include/dart_native_api.h" | |
13 #include "dart/runtime/include/dart_tools_api.h" | |
14 #include "mojo/dart/embedder/monitor.h" | |
15 | |
16 namespace base { | |
17 class Lock; | |
18 } | |
19 | |
20 namespace mojo { | |
21 namespace dart { | |
22 | |
23 class DartDebuggerIsolate { | |
24 public: | |
25 DartDebuggerIsolate(Dart_IsolateId id) | |
26 : id_(id) { | |
27 } | |
28 | |
29 Dart_IsolateId id() const { | |
30 return id_; | |
31 } | |
32 | |
33 void Notify() { | |
34 monitor_.Notify(); | |
35 } | |
36 | |
37 void MessageLoop(); | |
38 | |
39 private: | |
40 const Dart_IsolateId id_; | |
41 Monitor monitor_; | |
42 }; | |
43 | |
44 class DartDebugger { | |
45 public: | |
46 static void InitDebugger(); | |
47 | |
48 private: | |
49 static void BptResolvedHandler(Dart_IsolateId isolate_id, | |
50 intptr_t bp_id, | |
51 const Dart_CodeLocation& location); | |
52 | |
53 static void PausedEventHandler(Dart_IsolateId isolate_id, | |
54 intptr_t bp_id, | |
55 const Dart_CodeLocation& loc); | |
56 | |
57 static void ExceptionThrownHandler(Dart_IsolateId isolate_id, | |
58 Dart_Handle exception, | |
59 Dart_StackTrace stack_trace); | |
60 | |
61 static void IsolateEventHandler(Dart_IsolateId isolate_id, | |
62 Dart_IsolateEvent kind); | |
63 | |
64 static void NotifyIsolate(Dart_Isolate isolate); | |
65 | |
66 static intptr_t FindIsolateIndexById(Dart_IsolateId id); | |
67 | |
68 static intptr_t FindIsolateIndexByIdLocked(Dart_IsolateId id); | |
69 | |
70 static void AddIsolate(Dart_IsolateId id); | |
71 | |
72 static void RemoveIsolate(Dart_IsolateId id); | |
73 | |
74 static base::Lock* lock_; | |
75 static std::vector<std::unique_ptr<DartDebuggerIsolate>>* isolates_; | |
76 | |
77 friend class DartDebuggerIsolate; | |
78 }; | |
79 | |
80 } // namespace dart | |
81 } // namespace mojo | |
82 | |
83 #endif // MOJO_DART_EMBEDDER_DART_DEBUGGER_H_ | |
OLD | NEW |