SRIOConsumerPool.h 1.0 KB

12345678910111213141516171819202122232425262728
  1. //
  2. // Copyright 2012 Square Inc.
  3. // Portions Copyright (c) 2016-present, Facebook, Inc.
  4. //
  5. // All rights reserved.
  6. //
  7. // This source code is licensed under the BSD-style license found in the
  8. // LICENSE file in the root directory of this source tree. An additional grant
  9. // of patent rights can be found in the PATENTS file in the same directory.
  10. //
  11. #import <Foundation/Foundation.h>
  12. #import "SRIOConsumer.h" // TODO: (nlutsenko) Convert to @class and constants file for block types
  13. // This class is not thread-safe, and is expected to always be run on the same queue.
  14. @interface SRIOConsumerPool : NSObject
  15. - (instancetype)initWithBufferCapacity:(NSUInteger)poolSize;
  16. - (SRIOConsumer *)consumerWithScanner:(stream_scanner)scanner
  17. handler:(data_callback)handler
  18. bytesNeeded:(size_t)bytesNeeded
  19. readToCurrentFrame:(BOOL)readToCurrentFrame
  20. unmaskBytes:(BOOL)unmaskBytes;
  21. - (void)returnConsumer:(SRIOConsumer *)consumer;
  22. @end