Revert "Move texture registry ownership to platform view (#4348)" (flutter/engine#4387)

This reverts commit 2c2ddf97d3.
This commit is contained in:
Sigurd Meldgaard
2017-11-22 14:12:25 +01:00
committed by GitHub
parent 2c2ddf97d3
commit f3bf571559
9 changed files with 6 additions and 27 deletions

View File

@@ -58,11 +58,11 @@ CompositorContext::ScopedFrame::~ScopedFrame() {
}
void CompositorContext::OnGrContextCreated() {
texture_registry_->OnGrContextCreated();
texture_registry_.OnGrContextCreated();
}
void CompositorContext::OnGrContextDestroyed() {
texture_registry_->OnGrContextDestroyed();
texture_registry_.OnGrContextDestroyed();
raster_cache_.Clear();
}

View File

@@ -62,7 +62,7 @@ class CompositorContext {
RasterCache& raster_cache() { return raster_cache_; }
TextureRegistry& texture_registry() { return *texture_registry_; }
TextureRegistry& texture_registry() { return texture_registry_; }
const Counter& frame_count() const { return frame_count_; }
@@ -72,13 +72,9 @@ class CompositorContext {
const CounterValues& memory_usage() const { return memory_usage_; }
void SetTextureRegistry(TextureRegistry* textureRegistry) {
texture_registry_ = textureRegistry;
}
private:
RasterCache raster_cache_;
TextureRegistry* texture_registry_;
TextureRegistry texture_registry_;
std::unique_ptr<ProcessInfo> process_info_;
Counter frame_count_;
Stopwatch frame_time_;

View File

@@ -38,7 +38,7 @@ void NullRasterizer::DrawLastLayerTree() {
}
flow::TextureRegistry& NullRasterizer::GetTextureRegistry() {
return *texture_registry_;
return texture_registry_;
}
void NullRasterizer::Clear(SkColor color, const SkISize& size) {
@@ -59,9 +59,4 @@ void NullRasterizer::AddNextFrameCallback(fxl::Closure nextFrameCallback) {
// Null rasterizer. Nothing to do.
}
void NullRasterizer::SetTextureRegistry(
flow::TextureRegistry* textureRegistry) {
texture_registry_ = textureRegistry;
}
} // namespace shell

View File

@@ -36,12 +36,10 @@ class NullRasterizer : public Rasterizer {
void AddNextFrameCallback(fxl::Closure nextFrameCallback) override;
void SetTextureRegistry(flow::TextureRegistry* textureRegistry) override;
private:
std::unique_ptr<Surface> surface_;
fml::WeakPtrFactory<NullRasterizer> weak_factory_;
flow::TextureRegistry* texture_registry_;
flow::TextureRegistry texture_registry_;
FXL_DISALLOW_COPY_AND_ASSIGN(NullRasterizer);
};

View File

@@ -35,7 +35,6 @@ void PlatformView::SetRasterizer(std::unique_ptr<Rasterizer> rasterizer) {
Rasterizer* r = rasterizer_.release();
blink::Threads::Gpu()->PostTask([r]() { delete r; });
rasterizer_ = std::move(rasterizer);
rasterizer_->SetTextureRegistry(&texture_registry_);
engine_->set_rasterizer(rasterizer_->GetWeakRasterizerPtr());
}

View File

@@ -90,7 +90,6 @@ class PlatformView : public std::enable_shared_from_this<PlatformView> {
SurfaceConfig surface_config_;
std::unique_ptr<Rasterizer> rasterizer_;
flow::TextureRegistry texture_registry_;
std::unique_ptr<Engine> engine_;
std::unique_ptr<VsyncWaiter> vsync_waiter_;
SkISize size_;

View File

@@ -42,8 +42,6 @@ class Rasterizer {
// Set a callback to be called once when the next frame is drawn.
virtual void AddNextFrameCallback(fxl::Closure nextFrameCallback) = 0;
virtual void SetTextureRegistry(flow::TextureRegistry* textureRegistry) = 0;
};
} // namespace shell

View File

@@ -161,8 +161,4 @@ void GPURasterizer::NotifyNextFrameOnce() {
}
}
void GPURasterizer::SetTextureRegistry(flow::TextureRegistry* textureRegistry) {
compositor_context_.SetTextureRegistry(std::move(textureRegistry));
}
} // namespace shell

View File

@@ -42,8 +42,6 @@ class GPURasterizer : public Rasterizer {
// Set a callback to be called once when the next frame is drawn.
void AddNextFrameCallback(fxl::Closure nextFrameCallback) override;
void SetTextureRegistry(flow::TextureRegistry* textureRegistry) override;
private:
std::unique_ptr<Surface> surface_;
flow::CompositorContext compositor_context_;