Summary: Moves SKTigonNetwork internal plugin to xplat leaving behind a stub buck target in litho Reviewed By: passy Differential Revision: D9082339 fbshipit-source-id: d98eeef4e64458586403c01937f6d48ad82e27aa
49 lines
810 B
Objective-C
49 lines
810 B
Objective-C
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#if FB_SONARKIT_ENABLED
|
|
|
|
#pragma once
|
|
|
|
#import <SonarKitNetworkPlugin/SKDispatchQueue.h>
|
|
|
|
#import <vector>
|
|
|
|
namespace facebook {
|
|
namespace sonar {
|
|
class SyncQueue: public DispatchQueue
|
|
{
|
|
public:
|
|
SyncQueue()
|
|
:_isSuspended(NO){}
|
|
|
|
void async(dispatch_block_t block) override
|
|
{
|
|
if (_isSuspended) {
|
|
_blockArray.push_back(block);
|
|
} else {
|
|
block();
|
|
}
|
|
}
|
|
|
|
void suspend()
|
|
{
|
|
_isSuspended = YES;
|
|
}
|
|
|
|
void resume()
|
|
{
|
|
_isSuspended = NO;
|
|
for (const auto &block : _blockArray) {
|
|
block();
|
|
}
|
|
}
|
|
|
|
private:
|
|
std::vector<dispatch_block_t> _blockArray;
|
|
bool _isSuspended;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|