|
1 | 1 | import * as vscode from 'vscode';
|
2 | 2 |
|
3 |
| -import { UnboundReference, Designation, Reference } from './model/sample'; |
4 |
| -import { CXXRTLDebugger } from './debugger'; |
5 |
| -import { TimeInterval } from './model/time'; |
| 3 | +import { UnboundReference, Designation, Reference } from '../model/sample'; |
| 4 | +import { TimeInterval } from '../model/time'; |
| 5 | +import { Session } from './session'; |
6 | 6 |
|
7 | 7 | class Observable<T> {
|
8 | 8 | private callbacks: ((value: T) => void)[] = [];
|
@@ -42,14 +42,15 @@ export class Observer {
|
42 | 42 | private subscription: vscode.Disposable;
|
43 | 43 |
|
44 | 44 | constructor(
|
45 |
| - private rtlDebugger: CXXRTLDebugger, |
| 45 | + private session: Session, |
46 | 46 | private referenceName: string,
|
47 | 47 | ) {
|
48 |
| - this.subscription = rtlDebugger.onDidChangeCurrentTime((_time) => |
| 48 | + this.subscription = this.session.onDidChangeTimeCursor((_time) => |
49 | 49 | this.invalidate());
|
50 | 50 | }
|
51 | 51 |
|
52 | 52 | dispose() {
|
| 53 | + this.observables.clear(); |
53 | 54 | this.subscription.dispose();
|
54 | 55 | }
|
55 | 56 |
|
@@ -84,11 +85,11 @@ export class Observer {
|
84 | 85 | for (const observable of this.observables.values()) {
|
85 | 86 | unboundReference.add(observable.designation);
|
86 | 87 | }
|
87 |
| - this.reference = this.rtlDebugger.bindReference(this.referenceName, unboundReference); |
| 88 | + this.reference = this.session.bindReference(this.referenceName, unboundReference); |
88 | 89 | }
|
89 |
| - const interval = new TimeInterval(this.rtlDebugger.currentTime, this.rtlDebugger.currentTime); |
| 90 | + const interval = new TimeInterval(this.session.timeCursor, this.session.timeCursor); |
90 | 91 | const reference = this.reference; // could get invalidated in the meantime
|
91 |
| - const [sample] = await this.rtlDebugger.queryInterval(interval, reference); |
| 92 | + const [sample] = await this.session.queryInterval(interval, reference); |
92 | 93 | for (const [designation, handle] of reference.allHandles()) {
|
93 | 94 | const observable = this.observables.get(designation.canonicalKey)!;
|
94 | 95 | observable.update(sample.extract(handle));
|
|
0 commit comments