From 512ea57b79f21045a09cc23592427297d73c188f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 7 Dec 2015 01:11:19 -0500 Subject: [PATCH] Remove -[DebuggerBackEnd isConnected]. --- Source/DebuggerBackEnd.h | 1 - Source/DebuggerBackEnd.m | 28 ++++------------------------ Source/DebuggerController.m | 4 ++-- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/Source/DebuggerBackEnd.h b/Source/DebuggerBackEnd.h index a0e8186..4fc834c 100644 --- a/Source/DebuggerBackEnd.h +++ b/Source/DebuggerBackEnd.h @@ -45,7 +45,6 @@ // getter - (NSUInteger)port; -- (BOOL)isConnected; // communication - (void)run; diff --git a/Source/DebuggerBackEnd.m b/Source/DebuggerBackEnd.m index 9c8e8f6..717f8b9 100644 --- a/Source/DebuggerBackEnd.m +++ b/Source/DebuggerBackEnd.m @@ -25,9 +25,6 @@ // The connection to the debugger engine. NSUInteger _port; ProtocolClient* _client; - - // Whether or not a debugging session is currently active. - BOOL _active; } @synthesize autoAttach = _autoAttach; @@ -63,13 +60,6 @@ return _port; } -/** - * Returns whether or not we have an active connection - */ -- (BOOL)isConnected { - return _active; -} - /** * Sets the attached state of the debugger. This will open and close the * connection as appropriate. @@ -130,7 +120,6 @@ */ - (void)stop { [_client disconnect]; - _active = NO; self.model.status = @"Stopped"; } @@ -139,7 +128,6 @@ */ - (void)detach { [_client sendCommandWithFormat:@"detach"]; - _active = NO; self.model.status = @"Stopped"; } @@ -214,7 +202,7 @@ * Send an add breakpoint command */ - (void)addBreakpoint:(Breakpoint*)bp { - if (!_active) + if (!self.model.connected) return; NSString* file = [ProtocolClient escapedFilePathURI:[bp transformedPath]]; @@ -228,7 +216,7 @@ * Removes a breakpoint */ - (void)removeBreakpoint:(Breakpoint*)bp { - if (!_active) + if (!self.model.connected) return; [_client sendCommandWithFormat:@"breakpoint_remove -d %i", [bp debuggerId]]; @@ -238,7 +226,7 @@ * Sends a string to be evaluated by the engine. */ - (void)evalScript:(NSString*)str callback:(void (^)(NSString*))callback { - if (!_active) + if (!self.model.connected) return; char* encodedString = malloc(modp_b64_encode_len([str length])); @@ -256,7 +244,6 @@ #pragma mark Protocol Client Delegate - (void)debuggerEngineConnected:(ProtocolClient*)client { - _active = YES; [_model onNewConnection]; } @@ -265,8 +252,6 @@ * socket if the debugger remains attached. */ - (void)debuggerEngineDisconnected:(ProtocolClient*)client { - _active = NO; - [_model onDisconnect]; if (self.autoAttach) @@ -298,8 +283,6 @@ return; } - _active = YES; - // Register any breakpoints that exist offline. for (Breakpoint* bp in [[BreakpointManager sharedManager] breakpoints]) [self addBreakpoint:bp]; @@ -313,13 +296,10 @@ - (void)updateStatus:(NSXMLDocument*)response { NSString* status = [[[[response rootElement] attributeForName:@"status"] stringValue] capitalizedString]; self.model.status = status; - _active = YES; if (!status || [status isEqualToString:@"Stopped"]) { [_model onDisconnect]; - _active = NO; } else if ([status isEqualToString:@"Stopping"]) { [_client sendCommandWithFormat:@"stop"]; - _active = NO; } } @@ -329,7 +309,7 @@ */ - (void)debuggerStep:(NSXMLDocument*)response { [self updateStatus:response]; - if (![self isConnected]) + if (!self.model.connected) return; [_client sendCommandWithFormat:@"stack_depth" handler:^(NSXMLDocument* message) { diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index a6a8d73..2f3b329 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -122,13 +122,13 @@ SEL action = [anItem action]; if (action == @selector(stepOut:)) { - return ([connection isConnected] && _model.stackDepth > 1); + return _model.connected && _model.stackDepth > 1; } else if (action == @selector(stepIn:) || action == @selector(stepOver:) || action == @selector(run:) || action == @selector(stop:) || action == @selector(showEvalWindow:)) { - return [connection isConnected]; + return _model.connected; } return [[self window] validateUserInterfaceItem:anItem]; } -- 2.22.5