mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Re-land "Support multiple shells in a single process. (#4932)" This reverts commit a9dd1abd80f9c5148c74d606302171fa260365ca.
43 lines
1000 B
C++
43 lines
1000 B
C++
// Copyright 2017 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "flutter/flow/texture.h"
|
|
|
|
namespace flow {
|
|
|
|
TextureRegistry::TextureRegistry() = default;
|
|
|
|
TextureRegistry::~TextureRegistry() = default;
|
|
|
|
void TextureRegistry::RegisterTexture(std::shared_ptr<Texture> texture) {
|
|
mapping_[texture->Id()] = texture;
|
|
}
|
|
|
|
void TextureRegistry::UnregisterTexture(int64_t id) {
|
|
mapping_.erase(id);
|
|
}
|
|
|
|
void TextureRegistry::OnGrContextCreated() {
|
|
for (auto& it : mapping_) {
|
|
it.second->OnGrContextCreated();
|
|
}
|
|
}
|
|
|
|
void TextureRegistry::OnGrContextDestroyed() {
|
|
for (auto& it : mapping_) {
|
|
it.second->OnGrContextDestroyed();
|
|
}
|
|
}
|
|
|
|
std::shared_ptr<Texture> TextureRegistry::GetTexture(int64_t id) {
|
|
auto it = mapping_.find(id);
|
|
return it != mapping_.end() ? it->second : nullptr;
|
|
}
|
|
|
|
Texture::Texture(int64_t id) : id_(id) {}
|
|
|
|
Texture::~Texture() = default;
|
|
|
|
} // namespace flow
|