5#include "flutter/common/graphics/texture.h"
28 std::weak_ptr<ContextListener>
image) {
29 size_t next_id = image_counter_++;
32 ordered_images_.erase(
result.first->second);
39 auto found = mapping_.find(
id);
40 if (found == mapping_.end()) {
43 found->second->OnTextureUnregistered();
44 mapping_.erase(found);
48 ordered_images_.erase(image_indices_[
id]);
49 image_indices_.erase(
id);
53 for (
auto& it : mapping_) {
54 it.second->OnGrContextCreated();
59 std::vector<InsertionOrderMap::value_type> ordered_images(
60 ordered_images_.begin(), ordered_images_.end());
62 for (
const auto& [
id, pair] : ordered_images) {
63 auto index_id = pair.first;
64 auto weak_image = pair.second;
65 if (
auto image = weak_image.lock()) {
66 image->OnGrContextCreated();
68 image_indices_.erase(index_id);
69 ordered_images_.erase(
id);
75 for (
auto& it : mapping_) {
76 it.second->OnGrContextDestroyed();
79 auto it = ordered_images_.begin();
80 while (it != ordered_images_.end()) {
81 auto index_id = it->second.first;
82 auto weak_image = it->second.second;
83 if (
auto image = weak_image.lock()) {
84 image->OnGrContextDestroyed();
87 image_indices_.erase(index_id);
88 it = ordered_images_.erase(it);
94 auto it = mapping_.find(
id);
95 return it != mapping_.end() ? it->second :
nullptr;
static uint32_t next_id()
void OnGrContextDestroyed()
void OnGrContextCreated()
void RegisterTexture(const std::shared_ptr< Texture > &texture)
void UnregisterContextListener(uintptr_t id)
void RegisterContextListener(uintptr_t id, std::weak_ptr< ContextListener > image)
std::shared_ptr< Texture > GetTexture(int64_t id)
void UnregisterTexture(int64_t id)
sk_sp< const SkImage > image