Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1e6ebb3

Browse files
authored
Revert "Move texture registry ownership to platform view (#4348)" (#4387)
This reverts commit e58764f.
1 parent e58764f commit 1e6ebb3

9 files changed

+6
-27
lines changed

flow/compositor_context.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ CompositorContext::ScopedFrame::~ScopedFrame() {
5858
}
5959

6060
void CompositorContext::OnGrContextCreated() {
61-
texture_registry_->OnGrContextCreated();
61+
texture_registry_.OnGrContextCreated();
6262
}
6363

6464
void CompositorContext::OnGrContextDestroyed() {
65-
texture_registry_->OnGrContextDestroyed();
65+
texture_registry_.OnGrContextDestroyed();
6666
raster_cache_.Clear();
6767
}
6868

flow/compositor_context.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CompositorContext {
6262

6363
RasterCache& raster_cache() { return raster_cache_; }
6464

65-
TextureRegistry& texture_registry() { return *texture_registry_; }
65+
TextureRegistry& texture_registry() { return texture_registry_; }
6666

6767
const Counter& frame_count() const { return frame_count_; }
6868

@@ -72,13 +72,9 @@ class CompositorContext {
7272

7373
const CounterValues& memory_usage() const { return memory_usage_; }
7474

75-
void SetTextureRegistry(TextureRegistry* textureRegistry) {
76-
texture_registry_ = textureRegistry;
77-
}
78-
7975
private:
8076
RasterCache raster_cache_;
81-
TextureRegistry* texture_registry_;
77+
TextureRegistry texture_registry_;
8278
std::unique_ptr<ProcessInfo> process_info_;
8379
Counter frame_count_;
8480
Stopwatch frame_time_;

shell/common/null_rasterizer.cc

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void NullRasterizer::DrawLastLayerTree() {
3838
}
3939

4040
flow::TextureRegistry& NullRasterizer::GetTextureRegistry() {
41-
return *texture_registry_;
41+
return texture_registry_;
4242
}
4343

4444
void NullRasterizer::Clear(SkColor color, const SkISize& size) {
@@ -59,9 +59,4 @@ void NullRasterizer::AddNextFrameCallback(fxl::Closure nextFrameCallback) {
5959
// Null rasterizer. Nothing to do.
6060
}
6161

62-
void NullRasterizer::SetTextureRegistry(
63-
flow::TextureRegistry* textureRegistry) {
64-
texture_registry_ = textureRegistry;
65-
}
66-
6762
} // namespace shell

shell/common/null_rasterizer.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ class NullRasterizer : public Rasterizer {
3636

3737
void AddNextFrameCallback(fxl::Closure nextFrameCallback) override;
3838

39-
void SetTextureRegistry(flow::TextureRegistry* textureRegistry) override;
40-
4139
private:
4240
std::unique_ptr<Surface> surface_;
4341
fml::WeakPtrFactory<NullRasterizer> weak_factory_;
44-
flow::TextureRegistry* texture_registry_;
42+
flow::TextureRegistry texture_registry_;
4543

4644
FXL_DISALLOW_COPY_AND_ASSIGN(NullRasterizer);
4745
};

shell/common/platform_view.cc

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ void PlatformView::SetRasterizer(std::unique_ptr<Rasterizer> rasterizer) {
3535
Rasterizer* r = rasterizer_.release();
3636
blink::Threads::Gpu()->PostTask([r]() { delete r; });
3737
rasterizer_ = std::move(rasterizer);
38-
rasterizer_->SetTextureRegistry(&texture_registry_);
3938
engine_->set_rasterizer(rasterizer_->GetWeakRasterizerPtr());
4039
}
4140

shell/common/platform_view.h

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class PlatformView : public std::enable_shared_from_this<PlatformView> {
9090

9191
SurfaceConfig surface_config_;
9292
std::unique_ptr<Rasterizer> rasterizer_;
93-
flow::TextureRegistry texture_registry_;
9493
std::unique_ptr<Engine> engine_;
9594
std::unique_ptr<VsyncWaiter> vsync_waiter_;
9695
SkISize size_;

shell/common/rasterizer.h

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class Rasterizer {
4242

4343
// Set a callback to be called once when the next frame is drawn.
4444
virtual void AddNextFrameCallback(fxl::Closure nextFrameCallback) = 0;
45-
46-
virtual void SetTextureRegistry(flow::TextureRegistry* textureRegistry) = 0;
4745
};
4846

4947
} // namespace shell

shell/gpu/gpu_rasterizer.cc

-4
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,4 @@ void GPURasterizer::NotifyNextFrameOnce() {
161161
}
162162
}
163163

164-
void GPURasterizer::SetTextureRegistry(flow::TextureRegistry* textureRegistry) {
165-
compositor_context_.SetTextureRegistry(std::move(textureRegistry));
166-
}
167-
168164
} // namespace shell

shell/gpu/gpu_rasterizer.h

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class GPURasterizer : public Rasterizer {
4242
// Set a callback to be called once when the next frame is drawn.
4343
void AddNextFrameCallback(fxl::Closure nextFrameCallback) override;
4444

45-
void SetTextureRegistry(flow::TextureRegistry* textureRegistry) override;
46-
4745
private:
4846
std::unique_ptr<Surface> surface_;
4947
flow::CompositorContext compositor_context_;

0 commit comments

Comments
 (0)