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

Commit 563946c

Browse files
committed
Address feedback
1 parent d7e20e0 commit 563946c

8 files changed

Lines changed: 18 additions & 16 deletions

shell/platform/windows/flutter_window.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ ui::AXPlatformNodeWin* FlutterWindow::GetAlert() {
373373
return alert_node_.get();
374374
}
375375

376-
bool FlutterWindow::NeedsVSync() {
376+
bool FlutterWindow::NeedsVSync() const {
377377
// If the Desktop Window Manager composition is enabled,
378378
// the system itself synchronizes with v-sync.
379379
// See: https://learn.microsoft.com/windows/win32/dwm/composition-ovw

shell/platform/windows/flutter_window.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class FlutterWindow : public KeyboardManager::WindowDelegate,
196196
virtual ui::AXPlatformNodeWin* GetAlert() override;
197197

198198
// |WindowBindingHandler|
199-
virtual bool NeedsVSync() override;
199+
virtual bool NeedsVSync() const override;
200200

201201
// Called to obtain a pointer to the fragment root delegate.
202202
virtual ui::AXFragmentRootDelegateWin* GetAxFragmentRootDelegate();

shell/platform/windows/flutter_windows_engine.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ bool FlutterWindowsEngine::MarkExternalTextureFrameAvailable(
685685
engine_, texture_id) == kSuccess);
686686
}
687687

688-
bool FlutterWindowsEngine::PostRasterThreadTask(fml::closure callback) {
688+
bool FlutterWindowsEngine::PostRasterThreadTask(fml::closure callback) const {
689689
struct Captures {
690690
fml::closure callback;
691691
};

shell/platform/windows/flutter_windows_engine.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class FlutterWindowsEngine {
102102
bool Run(std::string_view entrypoint);
103103

104104
// Returns true if the engine is currently running.
105-
virtual bool running() { return engine_ != nullptr; }
105+
virtual bool running() const { return engine_ != nullptr; }
106106

107107
// Stops the engine. This invalidates the pointer returned by engine().
108108
//
@@ -141,7 +141,9 @@ class FlutterWindowsEngine {
141141

142142
// The ANGLE surface manager object. If this is nullptr, then we are
143143
// rendering using software instead of OpenGL.
144-
AngleSurfaceManager* surface_manager() { return surface_manager_.get(); }
144+
AngleSurfaceManager* surface_manager() const {
145+
return surface_manager_.get();
146+
}
145147

146148
WindowProcDelegateManager* window_proc_delegate_manager() {
147149
return window_proc_delegate_manager_.get();
@@ -201,7 +203,7 @@ class FlutterWindowsEngine {
201203
bool MarkExternalTextureFrameAvailable(int64_t texture_id);
202204

203205
// Posts the given callback onto the raster thread.
204-
virtual bool PostRasterThreadTask(fml::closure callback);
206+
virtual bool PostRasterThreadTask(fml::closure callback) const;
205207

206208
// Invoke on the embedder's vsync callback to schedule a frame.
207209
void OnVsync(intptr_t baton);

shell/platform/windows/flutter_windows_view.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ constexpr std::chrono::milliseconds kWindowResizeTimeout{100};
2525
/// to be blocked until the frame with the right size has been rendered. It
2626
/// should be kept in-sync with how the engine deals with a new surface request
2727
/// as seen in `CreateOrUpdateSurface` in `GPUSurfaceGL`.
28-
static bool SurfaceWillUpdate(size_t cur_width,
29-
size_t cur_height,
30-
size_t target_width,
31-
size_t target_height) {
28+
bool SurfaceWillUpdate(size_t cur_width,
29+
size_t cur_height,
30+
size_t target_width,
31+
size_t target_height) {
3232
// TODO (https://github.com/flutter/flutter/issues/65061) : Avoid special
3333
// handling for zero dimensions.
3434
bool non_zero_target_dims = target_height > 0 && target_width > 0;
@@ -39,8 +39,8 @@ static bool SurfaceWillUpdate(size_t cur_width,
3939

4040
/// Update the surface's swap interval to block until the v-blank iff
4141
/// the system compositor is disabled.
42-
static void UpdateVsync(FlutterWindowsEngine& engine,
43-
WindowBindingHandler& window) {
42+
void UpdateVsync(const FlutterWindowsEngine& engine,
43+
const WindowBindingHandler& window) {
4444
AngleSurfaceManager* surface_manager = engine.surface_manager();
4545
if (!surface_manager) {
4646
return;

shell/platform/windows/flutter_windows_view_unittests.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ class MockFlutterWindowsEngine : public FlutterWindowsEngine {
110110
public:
111111
MockFlutterWindowsEngine() : FlutterWindowsEngine(GetTestProject()) {}
112112

113-
MOCK_METHOD(bool, running, (), ());
113+
MOCK_METHOD(bool, running, (), (const));
114114
MOCK_METHOD(bool, Stop, (), ());
115-
MOCK_METHOD(bool, PostRasterThreadTask, (fml::closure), ());
115+
MOCK_METHOD(bool, PostRasterThreadTask, (fml::closure), (const));
116116

117117
private:
118118
FML_DISALLOW_COPY_AND_ASSIGN(MockFlutterWindowsEngine);

shell/platform/windows/testing/mock_window_binding_handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MockWindowBindingHandler : public WindowBindingHandler {
4040
MOCK_METHOD(PointerLocation, GetPrimaryPointerLocation, (), (override));
4141
MOCK_METHOD(AlertPlatformNodeDelegate*, GetAlertDelegate, (), (override));
4242
MOCK_METHOD(ui::AXPlatformNodeWin*, GetAlert, (), (override));
43-
MOCK_METHOD(bool, NeedsVSync, (), (override));
43+
MOCK_METHOD(bool, NeedsVSync, (), (const override));
4444

4545
private:
4646
FML_DISALLOW_COPY_AND_ASSIGN(MockWindowBindingHandler);

shell/platform/windows/window_binding_handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class WindowBindingHandler {
106106

107107
// If true, rendering to the window should synchronize with the vsync
108108
// to prevent screen tearing.
109-
virtual bool NeedsVSync() = 0;
109+
virtual bool NeedsVSync() const = 0;
110110
};
111111

112112
} // namespace flutter

0 commit comments

Comments
 (0)