Jonah Williams 811d365669 [Impeller] make host buffer state internally ref counted. (flutter/engine#48303)
std::shared_from_this is actually incredibly slow, and dominates the cost of host buffer allocation at 20x more expensive than the memcpy. We can remove the usage of shared_from_this by making an internal class hold the actual allocation/buffer state instead.

### Before

![image](https://github.com/flutter/engine/assets/8975114/d6cd69c7-de1d-4b05-bd76-1d9a3353e350)

146 ms / 647ms = ~20%
### After

33 ms / 540 ms = ~6%

![image](https://github.com/flutter/engine/assets/8975114/e624dd94-9718-404a-a0f8-b359df9f0109)
2023-11-22 03:24:18 +00:00
..