Profiler Keybindings (#1801)

* Added default new profiler keybinding. Exposed profiler.start and profiler.stop so they can be used with keybindings

* Changing where session state gets set

* Cleaning up unnecessary code
This commit is contained in:
Madeline MacDonald
2018-06-29 16:34:40 -07:00
committed by GitHub
parent 4f76f116ac
commit 1819036d7d
6 changed files with 72 additions and 10 deletions

View File

@@ -96,7 +96,10 @@ export class ProfilerService implements IProfilerService {
}
public startSession(id: ProfilerSessionID): Thenable<boolean> {
return this._runAction(id, provider => provider.startSession(this._idMap.get(id)));
return this._runAction(id, provider => provider.startSession(this._idMap.get(id))).then(() => {
this._sessionMap.get(this._idMap.reverseGet(id)).onSessionStateChanged({ isRunning: true, isStopped: false, isPaused: false });
return true;
});
}
public pauseSession(id: ProfilerSessionID): Thenable<boolean> {
@@ -104,7 +107,10 @@ export class ProfilerService implements IProfilerService {
}
public stopSession(id: ProfilerSessionID): Thenable<boolean> {
return this._runAction(id, provider => provider.stopSession(this._idMap.get(id)));
return this._runAction(id, provider => provider.stopSession(this._idMap.get(id))).then(() => {
this._sessionMap.get(this._idMap.reverseGet(id)).onSessionStateChanged({ isStopped: true, isPaused: false, isRunning: false });
return true;
});
}
private _runAction<T>(id: ProfilerSessionID, action: (handler: sqlops.ProfilerProvider) => Thenable<T>): Thenable<T> {