You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
872B

  1. /*
  2. * Copyright (c) 2016 The ZLToolKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLToolKit(https://github.com/ZLMediaKit/ZLToolKit).
  5. *
  6. * Use of this source code is governed by MIT license that can be found in the
  7. * LICENSE file in the root of the source tree. All contributing project authors
  8. * may be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include <cstdlib>
  11. #include "Buffer.h"
  12. #include "Util/onceToken.h"
  13. namespace toolkit {
  14. StatisticImp(Buffer)
  15. StatisticImp(BufferRaw)
  16. StatisticImp(BufferLikeString)
  17. BufferRaw::Ptr BufferRaw::create() {
  18. #if 0
  19. static ResourcePool<BufferRaw> packet_pool;
  20. static onceToken token([]() {
  21. packet_pool.setSize(1024);
  22. });
  23. auto ret = packet_pool.obtain2();
  24. ret->setSize(0);
  25. return ret;
  26. #else
  27. return Ptr(new BufferRaw);
  28. #endif
  29. }
  30. }//namespace toolkit