This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit e58764f authored Nov 22, 2017 Verified
1 parent fbd3843 commit e58764f Copy full SHA for e58764f
File tree 9 files changed +27
-6
lines changed
9 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -58,11 +58,11 @@ CompositorContext::ScopedFrame::~ScopedFrame() {
58
58
}
59
59
60
60
void CompositorContext::OnGrContextCreated () {
61
- texture_registry_. OnGrContextCreated ();
61
+ texture_registry_-> OnGrContextCreated ();
62
62
}
63
63
64
64
void CompositorContext::OnGrContextDestroyed () {
65
- texture_registry_. OnGrContextDestroyed ();
65
+ texture_registry_-> OnGrContextDestroyed ();
66
66
raster_cache_.Clear ();
67
67
}
68
68
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class CompositorContext {
62
62
63
63
RasterCache& raster_cache () { return raster_cache_; }
64
64
65
- TextureRegistry& texture_registry () { return texture_registry_; }
65
+ TextureRegistry& texture_registry () { return * texture_registry_; }
66
66
67
67
const Counter& frame_count () const { return frame_count_; }
68
68
@@ -72,9 +72,13 @@ class CompositorContext {
72
72
73
73
const CounterValues& memory_usage () const { return memory_usage_; }
74
74
75
+ void SetTextureRegistry (TextureRegistry* textureRegistry) {
76
+ texture_registry_ = textureRegistry;
77
+ }
78
+
75
79
private:
76
80
RasterCache raster_cache_;
77
- TextureRegistry texture_registry_;
81
+ TextureRegistry* texture_registry_;
78
82
std::unique_ptr<ProcessInfo> process_info_;
79
83
Counter frame_count_;
80
84
Stopwatch frame_time_;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ void NullRasterizer::DrawLastLayerTree() {
38
38
}
39
39
40
40
flow::TextureRegistry& NullRasterizer::GetTextureRegistry () {
41
- return texture_registry_;
41
+ return * texture_registry_;
42
42
}
43
43
44
44
void NullRasterizer::Clear (SkColor color, const SkISize& size) {
@@ -59,4 +59,9 @@ void NullRasterizer::AddNextFrameCallback(fxl::Closure nextFrameCallback) {
59
59
// Null rasterizer. Nothing to do.
60
60
}
61
61
62
+ void NullRasterizer::SetTextureRegistry (
63
+ flow::TextureRegistry* textureRegistry) {
64
+ texture_registry_ = textureRegistry;
65
+ }
66
+
62
67
} // namespace shell
Original file line number Diff line number Diff line change @@ -36,10 +36,12 @@ class NullRasterizer : public Rasterizer {
36
36
37
37
void AddNextFrameCallback (fxl::Closure nextFrameCallback) override ;
38
38
39
+ void SetTextureRegistry (flow::TextureRegistry* textureRegistry) override ;
40
+
39
41
private:
40
42
std::unique_ptr<Surface> surface_;
41
43
fml::WeakPtrFactory<NullRasterizer> weak_factory_;
42
- flow::TextureRegistry texture_registry_;
44
+ flow::TextureRegistry* texture_registry_;
43
45
44
46
FXL_DISALLOW_COPY_AND_ASSIGN (NullRasterizer);
45
47
};
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ void PlatformView::SetRasterizer(std::unique_ptr<Rasterizer> rasterizer) {
35
35
Rasterizer* r = rasterizer_.release ();
36
36
blink::Threads::Gpu ()->PostTask ([r]() { delete r; });
37
37
rasterizer_ = std::move (rasterizer);
38
+ rasterizer_->SetTextureRegistry (&texture_registry_);
38
39
engine_->set_rasterizer (rasterizer_->GetWeakRasterizerPtr ());
39
40
}
40
41
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ class PlatformView : public std::enable_shared_from_this<PlatformView> {
90
90
91
91
SurfaceConfig surface_config_;
92
92
std::unique_ptr<Rasterizer> rasterizer_;
93
+ flow::TextureRegistry texture_registry_;
93
94
std::unique_ptr<Engine> engine_;
94
95
std::unique_ptr<VsyncWaiter> vsync_waiter_;
95
96
SkISize size_;
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ class Rasterizer {
42
42
43
43
// Set a callback to be called once when the next frame is drawn.
44
44
virtual void AddNextFrameCallback (fxl::Closure nextFrameCallback) = 0;
45
+
46
+ virtual void SetTextureRegistry (flow::TextureRegistry* textureRegistry) = 0;
45
47
};
46
48
47
49
} // namespace shell
Original file line number Diff line number Diff line change @@ -161,4 +161,8 @@ void GPURasterizer::NotifyNextFrameOnce() {
161
161
}
162
162
}
163
163
164
+ void GPURasterizer::SetTextureRegistry (flow::TextureRegistry* textureRegistry) {
165
+ compositor_context_.SetTextureRegistry (std::move (textureRegistry));
166
+ }
167
+
164
168
} // namespace shell
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ class GPURasterizer : public Rasterizer {
42
42
// Set a callback to be called once when the next frame is drawn.
43
43
void AddNextFrameCallback (fxl::Closure nextFrameCallback) override ;
44
44
45
+ void SetTextureRegistry (flow::TextureRegistry* textureRegistry) override ;
46
+
45
47
private:
46
48
std::unique_ptr<Surface> surface_;
47
49
flow::CompositorContext compositor_context_;
You can’t perform that action at this time.
0 commit comments