Skip to content

Commit

Permalink
Make the naming more consistent. Use “cleanup” instead of “teardown” …
Browse files Browse the repository at this point in the history
…when possible
  • Loading branch information
jmnavarro committed Oct 21, 2016
1 parent 7270a76 commit fdcbe46
Show file tree
Hide file tree
Showing 36 changed files with 55 additions and 55 deletions.
Expand Up @@ -31,7 +31,7 @@
|init| The init method is up to you. There's no specific signature you'll need, but do pass in all the information you'll want to run quickly in updateForFrame.|
|(bool)hasUpdate| Returns true if there's an update to be processed. |
|(void)updateForFrame:(id)frameInfo | This is where you do your work. Remove the objects that need to be removed, add the objects that need to be added and be sure to use the MaplyThreadCurrent mode to make the changes happen immediately.|
|teardown| This method is called when the active object is to be removed. Clean up all your visible objects.|
|cleanup| This method is called when the active object is to be removed. Clean up all your visible objects.|
@details Active Objects are run on the main thread and you're probably going to be asking the view controller to add and remove objects on the main thread. As such, this can be slow. Be sure to precalculate whatever you might need to make this run faster. Also consider implementing your changes another way. If it can be done on another thread, do it on another thread.
Expand Down
Expand Up @@ -861,7 +861,7 @@ typedef NS_ENUM(NSInteger, MaplyThreadMode) {
/** @brief This shuts down the rendering and it cannot be restarted.
@details There are times we need to explicitly shut down the rendering rather than wait for an unload or release. This will do that.
*/
- (void)teardown;
- (void)cleanup;

/** @brief Add a compiled shader. We'll refer to it by the scene name.
@details Once you've create a MaplyShader, you'll need to add it to the scene to use it.
Expand Down
Expand Up @@ -56,7 +56,7 @@
/** @brief Called when the update layer is shutting down.
@details Clean up your own data here.
*/
- (void)teardown:(MaplyUpdateLayer *__nonnull)layer;
- (void)cleanup:(MaplyUpdateLayer *__nonnull)layer;

@end

Expand Down
Expand Up @@ -28,6 +28,6 @@
- (WhirlyKit::SimpleIdentity)getShaderID;

/// Called by the view controller to clear out the shader program
- (void)teardown;
- (void)cleanup;

@end
Expand Up @@ -47,7 +47,7 @@ - (void)updateForFrame:(WhirlyKitRendererFrameInfo *)frameInfo

}

- (void)teardown
- (void)cleanup
{

}
Expand Down
Expand Up @@ -279,7 +279,7 @@ - (void)startWithThread:(WhirlyKitLayerThread *)inLayerThread scene:(WhirlyKit::
}
}

- (void)teardown
- (void)cleanup
{
layerThread = nil;
scene = NULL;
Expand All @@ -304,7 +304,7 @@ - (void)lockingShutdown
while (numActiveWorkers > 0)
pthread_cond_wait(&workWait, &workLock);

[self teardown];
[self cleanup];

pthread_mutex_unlock(&workLock);
}
Expand Down
Expand Up @@ -64,12 +64,12 @@ - (void) clear
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(periodicPerfOutput) object:nil];

[glView stopAnimation];
[glView teardown];
[glView cleanup];

EAGLContext *oldContext = [EAGLContext currentContext];
[sceneRenderer useContext];
for (MaplyShader *shader in shaders)
[shader teardown];
[shader cleanup];
if (oldContext)
[EAGLContext setCurrentContext:oldContext];
sceneRenderer.scene = nil;
Expand Down Expand Up @@ -121,7 +121,7 @@ - (void) clear
- (void) dealloc
{
if (scene)
[self teardown];
[self cleanup];
}

- (WhirlyKitView *) loadSetup_view
Expand Down Expand Up @@ -296,12 +296,12 @@ - (void)stopAnimation
[glView stopAnimation];
}

- (void)teardown
- (void)cleanup
{
[interactLayer lockingShutdown];

if (glView)
[glView teardown];
[glView cleanup];

[self clear];
}
Expand Down
Expand Up @@ -63,9 +63,9 @@ - (void)dealloc

/// Called by the layer thread to shut a layer down.
/// Clean all your stuff out of the scenegraph and so forth.
- (void)teardown
- (void)cleanup
{
[super teardown];
[super cleanup];
}

// Do the logic for a selection
Expand Down Expand Up @@ -115,4 +115,4 @@ - (void) userDidTap:(MaplyTapMessage *)msg
[self performSelector:@selector(userDidTapLayerThread:) onThread:layerThread withObject:msg waitUntilDone:NO];
}

@end
@end
Expand Up @@ -543,7 +543,7 @@ - (void)mergeTile:(NSArray *)args
}

/// Called when the layer is shutting down. Clean up any drawable data and clear out caches.
- (void)teardown
- (void)cleanup
{
super.layerThread = nil;
}
Expand Down
Expand Up @@ -813,7 +813,7 @@ - (double)importanceForTile:(WhirlyKit::Quadtree::Identifier)ident mbr:(WhirlyKi
}

/// Called when the layer is shutting down. Clean up any drawable data and clear out caches.
- (void)teardown
- (void)cleanup
{
super.layerThread = nil;
}
Expand Down
Expand Up @@ -583,7 +583,7 @@ - (double)importanceForTile:(WhirlyKit::Quadtree::Identifier)ident mbr:(WhirlyKi
}

/// Called when the layer is shutting down. Clean up any drawable data and clear out caches.
- (void)teardown
- (void)cleanup
{
super.layerThread = nil;
quadLayer = nil;
Expand Down
Expand Up @@ -242,7 +242,7 @@ - (bool)setUniformVector4Named:(NSString *)uniName x:(float)x y:(float)y z:(floa
}

// We're assuming the view controller has set the proper context
- (void)teardown
- (void)cleanup
{
if (_program)
{
Expand Down
Expand Up @@ -119,7 +119,7 @@ - (void)cleanupLayers:(WhirlyKitLayerThread *)inLayerThread scene:(WhirlyKit::Sc
if (layerThread.viewWatcher)
[(WhirlyGlobeLayerViewWatcher *)layerThread.viewWatcher removeWatcherTarget:self selector:@selector(viewUpdate:)];

[delegate teardown:self];
[delegate cleanup:self];
}

@end
Expand Up @@ -58,9 +58,9 @@ - (void)startWithThread:(WhirlyKitLayerThread *)inLayerThread scene:(WhirlyKit::

/// Called by the layer thread to shut a layer down.
/// Clean all your stuff out of the scenegraph and so forth.
- (void)teardown
- (void)cleanup
{
[super teardown];
[super cleanup];
}

- (void)setAutoRotateInterval:(float)inAutoRotateInterval degrees:(float)inAutoRotateDegrees
Expand Down Expand Up @@ -190,4 +190,4 @@ - (NSMutableArray*)selectMultipleLabelsAndMarkersForScreenPoint:(CGPoint)screenP
}


@end
@end
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/ActiveModel.h
Expand Up @@ -43,6 +43,6 @@
- (void)updateForFrame:(WhirlyKitRendererFrameInfo *)frameInfo;

/// Time to clean up your toys
- (void)teardown;
- (void)cleanup;

@end
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/DataLayer.h
Expand Up @@ -45,7 +45,7 @@

/// Called by the layer thread to shut a layer down.
/// Clean all your stuff out of the scenegraph and so forth.
- (void)teardown;
- (void)cleanup;

@optional

Expand Down
Expand Up @@ -96,7 +96,7 @@ class DynamicDrawableAtlas
void addSwapChanges(const ChangeSet &swapChanges);

/// Remove anything associated with the drawable atlas
void teardown(ChangeSet &changes);
void cleanup(ChangeSet &changes);

/// Print some status info to the log
void log();
Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/EAGLView.h
Expand Up @@ -50,7 +50,7 @@
/// Stop animating. It can be restarted or destroyed after this.
- (void) stopAnimation;
/// Destroy the display link. Cannot be restarted.
- (void) teardown;
- (void) cleanup;

/// Draw into the actual view
- (void) drawView:(id)sender;
Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/LayoutLayer.h
Expand Up @@ -44,7 +44,7 @@
- (void)startWithThread:(WhirlyKitLayerThread *)layerThread scene:(WhirlyKit::Scene *)scene;

/// Called in the layer thread
- (void)teardown;
- (void)cleanup;

/// Add a whole bunch of objects to track with the layout engine.
- (void)addLayoutObjects:(const std::vector<WhirlyKit::LayoutObject> &)layoutObjects;
Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/MBTileQuadSource.h
Expand Up @@ -52,7 +52,7 @@
@property (nonatomic,assign) int maxZoom;

/// Called by the layer to shut things down
- (void)teardown;
- (void)cleanup;

@end

Expand Up @@ -39,6 +39,6 @@
- (void)startWithThread:(WhirlyKitLayerThread *)layerThread scene:(WhirlyKit::Scene *)scene;

/// Called in the layer thread
- (void)teardown;
- (void)cleanup;

@end
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/QuadDisplayLayer.h
Expand Up @@ -80,7 +80,7 @@ class FrameLoadStatus
- (double)importanceForTile:(WhirlyKit::Quadtree::Identifier)ident mbr:(WhirlyKit::Mbr)mbr viewInfo:(WhirlyKitViewState *) viewState frameSize:(WhirlyKit::Point2f)frameSize attrs:(NSMutableDictionary *)attrs;

/// Called when the layer is shutting down. Clean up any drawable data and clear out caches.
- (void)teardown;
- (void)cleanup;

@optional

Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/include/UpdateDisplayLayer.h
Expand Up @@ -41,7 +41,7 @@
- (void)viewerDidUpdate:(WhirlyGlobeViewState *)viewState scene:(WhirlyKit::Scene *)scene;

/// Called when the layer needs to shutdown. Clean up your objects.
- (void)teardown;
- (void)cleanup;

@end

Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/src/DynamicDrawableAtlas.mm
Expand Up @@ -350,7 +350,7 @@
swapChanges.insert(swapChanges.end(), inSwapChanges.begin(), inSwapChanges.end());
}

void DynamicDrawableAtlas::teardown(ChangeSet &changes)
void DynamicDrawableAtlas::cleanup(ChangeSet &changes)
{
hasChanges = true;

Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/src/EAGLView.mm
Expand Up @@ -124,7 +124,7 @@ - (void)stopAnimation
}
}

- (void) teardown
- (void) cleanup
{
if (_animating)
{
Expand Down
4 changes: 2 additions & 2 deletions WhirlyGlobeSrc/WhirlyGlobeLib/src/LayerThread.mm
Expand Up @@ -129,7 +129,7 @@ - (void)removeLayerThread:(NSObject<WhirlyKitLayer> *)layer
{
// If we're done, we won't bother shutting down things nicely
if (![self isCancelled])
[layer teardown];
[layer cleanup];
[layers removeObject:layer];
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ - (void)main
if (!_mainLayerThread)
{
for (NSObject<WhirlyKitLayer> *layer in layers)
[layer teardown];
[layer cleanup];

[self runAddChangeRequests];
}
Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/src/LayoutLayer.mm
Expand Up @@ -68,7 +68,7 @@ - (void)startWithThread:(WhirlyKitLayerThread *)inLayerThread scene:(WhirlyKit::
[self checkUpdate];
}

- (void)teardown
- (void)cleanup
{
scene = NULL;
if (layerThread.viewWatcher)
Expand Down
4 changes: 2 additions & 2 deletions WhirlyGlobeSrc/WhirlyGlobeLib/src/LoadedTile.mm
Expand Up @@ -359,14 +359,14 @@ - (bool)convertToRawData:(int)borderTexel

if (drawAtlas)
{
drawAtlas->teardown(theChangeRequests);
drawAtlas->cleanup(theChangeRequests);
delete drawAtlas;
drawAtlas = NULL;
}

if (poleDrawAtlas)
{
poleDrawAtlas->teardown(theChangeRequests);
poleDrawAtlas->cleanup(theChangeRequests);
delete poleDrawAtlas;
poleDrawAtlas = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/src/MBTileQuadSource.mm
Expand Up @@ -114,7 +114,7 @@ - (void)dealloc
sqlite3_close(_sqlDb);
}

- (void)teardown
- (void)cleanup
{
// Nothing much to do here
}
Expand Down
6 changes: 3 additions & 3 deletions WhirlyGlobeSrc/WhirlyGlobeLib/src/NetworkTileQuadSource.mm
Expand Up @@ -44,7 +44,7 @@ - (void)dealloc
coordSys = nil;
}

- (void)teardown
- (void)cleanup
{
// Nothing much to do here
}
Expand Down Expand Up @@ -116,7 +116,7 @@ - (id)initWithBaseURL:(NSString *)base ext:(NSString *)imageExt
return self;
}

- (void)teardown
- (void)cleanup
{
// Nothing much to do here
}
Expand Down Expand Up @@ -256,7 +256,7 @@ - (id)initWithTileSpec:(NSDictionary *)jsonDict;
return self;
}

- (void)teardown
- (void)cleanup
{
// Nothing much to do here
}
Expand Down
6 changes: 3 additions & 3 deletions WhirlyGlobeSrc/WhirlyGlobeLib/src/QuadDisplayLayer.mm
Expand Up @@ -209,7 +209,7 @@ - (void)startWithThread:(WhirlyKitLayerThread *)inLayerThread scene:(Scene *)inS
// [self performSelector:@selector(dumpInfo) withObject:nil afterDelay:15.0];
}

- (void)teardown
- (void)cleanup
{
[_renderer removeFrameObserver:self];
[_loader quadDisplayLayerEndUpdates:self];
Expand All @@ -221,7 +221,7 @@ - (void)teardown
[(WhirlyGlobeLayerViewWatcher *)_layerThread.viewWatcher removeWatcherTarget:self selector:@selector(viewUpdate:)];
}

[_dataStructure teardown];
[_dataStructure cleanup];
_dataStructure = nil;
[_loader shutdownLayer:self scene:_scene];
_loader = nil;
Expand Down Expand Up @@ -274,7 +274,7 @@ - (void)viewUpdate:(WhirlyKitViewState *)inViewState

if (!_scene)
{
NSLog(@"GlobeQuadDisplayLayer: Called viewUpdate: after being teardown.");
NSLog(@"GlobeQuadDisplayLayer: Called viewUpdate: after being cleaned up.");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion WhirlyGlobeSrc/WhirlyGlobeLib/src/Scene.mm
Expand Up @@ -301,7 +301,7 @@
if ([activeModels containsObject:activeModel])
{
[activeModels removeObject:activeModel];
[activeModel teardown];
[activeModel cleanup];
}
}

Expand Down

0 comments on commit fdcbe46

Please sign in to comment.