diff --git a/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows.h b/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows.h index 9f32b5ed66..2655f1e3ef 100644 --- a/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows.h +++ b/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_ACCESSIBILITY_BRIDGE_WINDOWS_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_ACCESSIBILITY_BRIDGE_WINDOWS_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/accessibility_bridge.h" #include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_delegate_win.h" @@ -71,6 +72,8 @@ class AccessibilityBridgeWindows : public AccessibilityBridge, private: FlutterWindowsEngine* engine_; FlutterWindowsView* view_; + + FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeWindows); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows_unittests.cc b/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows_unittests.cc index ecada69ff8..d2d4d790cb 100644 --- a/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/accessibility_bridge_windows_unittests.cc @@ -10,6 +10,7 @@ #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h" #include "flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h" @@ -66,6 +67,8 @@ class AccessibilityBridgeWindowsSpy : public AccessibilityBridgeWindows { private: std::vector dispatched_events_; std::vector focused_nodes_; + + FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeWindowsSpy); }; // A FlutterWindowsEngine whose accessibility bridge is a @@ -81,6 +84,9 @@ class FlutterWindowsEngineSpy : public FlutterWindowsEngine { FlutterWindowsView* view) override { return std::make_shared(engine, view); } + + private: + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsEngineSpy); }; // Returns an engine instance configured with dummy project path values, and diff --git a/engine/src/flutter/shell/platform/windows/angle_surface_manager.h b/engine/src/flutter/shell/platform/windows/angle_surface_manager.h index 3e9f21262b..85cbe2df99 100644 --- a/engine/src/flutter/shell/platform/windows/angle_surface_manager.h +++ b/engine/src/flutter/shell/platform/windows/angle_surface_manager.h @@ -18,7 +18,8 @@ #include #include -#include "window_binding_handler.h" +#include "flutter/fml/macros.h" +#include "flutter/shell/platform/windows/window_binding_handler.h" namespace flutter { @@ -29,10 +30,6 @@ class AngleSurfaceManager { static std::unique_ptr Create(); ~AngleSurfaceManager(); - // Disallow copy/move. - AngleSurfaceManager(const AngleSurfaceManager&) = delete; - AngleSurfaceManager& operator=(const AngleSurfaceManager&) = delete; - // Creates an EGLSurface wrapper and backing DirectX 11 SwapChain // associated with window, in the appropriate format for display. // Target represents the visual entity to bind to. Width and @@ -125,6 +122,8 @@ class AngleSurfaceManager { // Number of active instances of AngleSurfaceManager static int instance_count_; + + FML_DISALLOW_COPY_AND_ASSIGN(AngleSurfaceManager); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/cursor_handler.h b/engine/src/flutter/shell/platform/windows/cursor_handler.h index df6d7a3df6..a01bc61c26 100644 --- a/engine/src/flutter/shell/platform/windows/cursor_handler.h +++ b/engine/src/flutter/shell/platform/windows/cursor_handler.h @@ -7,6 +7,7 @@ #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h" @@ -37,6 +38,8 @@ class CursorHandler { // The cache map for custom cursors. std::unordered_map custom_cursors_; + + FML_DISALLOW_COPY_AND_ASSIGN(CursorHandler); }; // Create a cursor from a rawBGRA buffer and the cursor info. diff --git a/engine/src/flutter/shell/platform/windows/cursor_handler_unittests.cc b/engine/src/flutter/shell/platform/windows/cursor_handler_unittests.cc index 358e9f368b..d3f4ed5928 100644 --- a/engine/src/flutter/shell/platform/windows/cursor_handler_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/cursor_handler_unittests.cc @@ -6,6 +6,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/method_result_functions.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_message_codec.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_method_codec.h" @@ -53,6 +54,10 @@ void SimulateCursorMessage(TestBinaryMessenger* messenger, } // namespace class CursorHandlerTest : public WindowsTest { + public: + CursorHandlerTest() = default; + virtual ~CursorHandlerTest() = default; + protected: FlutterWindowsEngine* engine() { return engine_.get(); } FlutterWindowsView* view() { return view_.get(); } @@ -83,6 +88,8 @@ class CursorHandlerTest : public WindowsTest { std::unique_ptr engine_; std::unique_ptr view_; MockWindowBindingHandler* window_; + + FML_DISALLOW_COPY_AND_ASSIGN(CursorHandlerTest); }; TEST_F(CursorHandlerTest, ActivateSystemCursor) { diff --git a/engine/src/flutter/shell/platform/windows/direct_manipulation_unittests.cc b/engine/src/flutter/shell/platform/windows/direct_manipulation_unittests.cc index 5b1e687ba5..323125141e 100644 --- a/engine/src/flutter/shell/platform/windows/direct_manipulation_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/direct_manipulation_unittests.cc @@ -3,8 +3,9 @@ // found in the LICENSE file. #include "flutter/shell/platform/windows/direct_manipulation.h" -#include "flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h" +#include "flutter/fml/macros.h" +#include "flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h" #include "gtest/gtest.h" using testing::_; @@ -16,11 +17,6 @@ class MockIDirectManipulationViewport : public IDirectManipulationViewport { public: MockIDirectManipulationViewport() {} - // Prevent copying. - MockIDirectManipulationViewport(MockIDirectManipulationViewport const&) = - delete; - MockIDirectManipulationViewport& operator=( - MockIDirectManipulationViewport const&) = delete; MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, AddRef, ULONG()); MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, Release, ULONG()); MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, @@ -101,17 +97,15 @@ class MockIDirectManipulationViewport : public IDirectManipulationViewport { STDMETHODCALLTYPE, ZoomToRect, HRESULT(const float, const float, const float, const float, BOOL)); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockIDirectManipulationViewport); }; class MockIDirectManipulationContent : public IDirectManipulationContent { public: MockIDirectManipulationContent() {} - // Prevent copying. - MockIDirectManipulationContent(MockIDirectManipulationContent const&) = - delete; - MockIDirectManipulationContent& operator=( - MockIDirectManipulationContent const&) = delete; MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, AddRef, ULONG()); MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, Release, ULONG()); MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, @@ -139,6 +133,9 @@ class MockIDirectManipulationContent : public IDirectManipulationContent { MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, SyncContentTransform, HRESULT(const float*, DWORD)); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockIDirectManipulationContent); }; TEST(DirectManipulationTest, TestGesture) { diff --git a/engine/src/flutter/shell/platform/windows/dpi_utils.cc b/engine/src/flutter/shell/platform/windows/dpi_utils.cc index cd147f0347..81fece664d 100644 --- a/engine/src/flutter/shell/platform/windows/dpi_utils.cc +++ b/engine/src/flutter/shell/platform/windows/dpi_utils.cc @@ -4,6 +4,8 @@ #include "dpi_utils.h" +#include "flutter/fml/macros.h" + namespace flutter { namespace { @@ -58,6 +60,8 @@ class DpiHelper { HMODULE shlib_module_ = nullptr; bool dpi_for_window_supported_ = false; bool dpi_for_monitor_supported_ = false; + + FML_DISALLOW_COPY_AND_ASSIGN(DpiHelper); }; DpiHelper::DpiHelper() { diff --git a/engine/src/flutter/shell/platform/windows/event_watcher.h b/engine/src/flutter/shell/platform/windows/event_watcher.h index b69ecb1d9d..ec0536b801 100644 --- a/engine/src/flutter/shell/platform/windows/event_watcher.h +++ b/engine/src/flutter/shell/platform/windows/event_watcher.h @@ -9,6 +9,8 @@ #include +#include "flutter/fml/macros.h" + namespace flutter { // A win32 `HANDLE` wrapper for use as a one-time callback. @@ -28,8 +30,7 @@ class EventWatcher { HANDLE handle_; HANDLE handle_for_wait_; - EventWatcher(const EventWatcher&) = delete; - EventWatcher& operator=(const EventWatcher&) = delete; + FML_DISALLOW_COPY_AND_ASSIGN(EventWatcher); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/external_texture_d3d.h b/engine/src/flutter/shell/platform/windows/external_texture_d3d.h index 007484296a..81b9434b1f 100644 --- a/engine/src/flutter/shell/platform/windows/external_texture_d3d.h +++ b/engine/src/flutter/shell/platform/windows/external_texture_d3d.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/angle_surface_manager.h" #include "flutter/shell/platform/windows/external_texture.h" @@ -42,6 +43,8 @@ class ExternalTextureD3d : public ExternalTexture { GLuint gl_texture_ = 0; EGLSurface egl_surface_ = EGL_NO_SURFACE; void* last_surface_handle_ = nullptr; + + FML_DISALLOW_COPY_AND_ASSIGN(ExternalTextureD3d); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h b/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h index 3e5e101046..38ac196130 100644 --- a/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h +++ b/engine/src/flutter/shell/platform/windows/external_texture_pixelbuffer.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_PIXELBUFFER_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/public/flutter_texture_registrar.h" #include "flutter/shell/platform/windows/external_texture.h" @@ -38,6 +39,8 @@ class ExternalTexturePixelBuffer : public ExternalTexture { void* const user_data_ = nullptr; const GlProcs& gl_; GLuint gl_texture_ = 0; + + FML_DISALLOW_COPY_AND_ASSIGN(ExternalTexturePixelBuffer); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/flutter_desktop_messenger.h b/engine/src/flutter/shell/platform/windows/flutter_desktop_messenger.h index 8920068e51..bfa13797c2 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_desktop_messenger.h +++ b/engine/src/flutter/shell/platform/windows/flutter_desktop_messenger.h @@ -8,6 +8,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/public/flutter_messenger.h" namespace flutter { @@ -68,16 +69,15 @@ class FlutterDesktopMessenger { /// |FlutterDesktopMessenger| (ie |engine|). std::mutex& GetMutex() { return mutex_; } - FlutterDesktopMessenger(const FlutterDesktopMessenger& value) = delete; - FlutterDesktopMessenger& operator=(const FlutterDesktopMessenger& value) = - delete; - private: // The engine that owns this state object. flutter::FlutterWindowsEngine* engine = nullptr; std::mutex mutex_; std::atomic ref_count_ = 0; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterDesktopMessenger); }; + } // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_STATE_H_ diff --git a/engine/src/flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h b/engine/src/flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h index 489ae4884d..af40d6cc24 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h +++ b/engine/src/flutter/shell/platform/windows/flutter_platform_node_delegate_windows.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PLATFORM_NODE_DELEGATE_WINDOWS_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PLATFORM_NODE_DELEGATE_WINDOWS_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/flutter_platform_node_delegate.h" #include "flutter/shell/platform/windows/flutter_windows_view.h" #include "flutter/third_party/accessibility/ax/platform/ax_platform_node.h" @@ -58,6 +59,8 @@ class FlutterPlatformNodeDelegateWindows : public FlutterPlatformNodeDelegate { ui::AXPlatformNode* ax_platform_node_; std::weak_ptr bridge_; FlutterWindowsView* view_; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformNodeDelegateWindows); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/flutter_window.h b/engine/src/flutter/shell/platform/windows/flutter_window.h index 5de8d9b1c0..b122f4a8c5 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_window.h +++ b/engine/src/flutter/shell/platform/windows/flutter_window.h @@ -8,6 +8,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/geometry.h" #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/windows/flutter_windows_view.h" @@ -168,6 +169,8 @@ class FlutterWindow : public Window, public WindowBindingHandler { // The cursor rect set by Flutter. RECT cursor_rect_; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindow); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/flutter_window_unittests.cc b/engine/src/flutter/shell/platform/windows/flutter_window_unittests.cc index 15b79db02b..a4dd8bc611 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_window_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_window_unittests.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/testing/flutter_window_test.h" #include "flutter/shell/platform/windows/testing/mock_window_binding_handler.h" #include "flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h" @@ -28,10 +29,6 @@ class MockFlutterWindow : public FlutterWindow { } virtual ~MockFlutterWindow() {} - // Prevent copying. - MockFlutterWindow(MockFlutterWindow const&) = delete; - MockFlutterWindow& operator=(MockFlutterWindow const&) = delete; - // Wrapper for GetCurrentDPI() which is a protected method. UINT GetDpi() { return GetCurrentDPI(); } @@ -73,6 +70,9 @@ class MockFlutterWindow : public FlutterWindow { LPARAM lParam) override { return kWmResultDefault; } + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockFlutterWindow); }; class MockFlutterWindowsView : public FlutterWindowsView { @@ -83,6 +83,9 @@ class MockFlutterWindowsView : public FlutterWindowsView { MOCK_METHOD2(NotifyWinEventWrapper, void(ui::AXPlatformNodeWin*, ax::mojom::Event)); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockFlutterWindowsView); }; } // namespace diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h index 9d12e93123..f09a8d4397 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.h @@ -14,6 +14,7 @@ #include #include "flutter/fml/closure.h" +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/accessibility_bridge.h" #include "flutter/shell/platform/common/client_wrapper/binary_messenger_impl.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h" @@ -84,10 +85,6 @@ class FlutterWindowsEngine { virtual ~FlutterWindowsEngine(); - // Prevent copying. - FlutterWindowsEngine(FlutterWindowsEngine const&) = delete; - FlutterWindowsEngine& operator=(FlutterWindowsEngine const&) = delete; - // Starts running the entrypoint function specifed in the project bundle. If // unspecified, defaults to main(). // @@ -396,6 +393,8 @@ class FlutterWindowsEngine { // Wrapper providing Windows registry access. std::unique_ptr windows_registry_; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsEngine); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc b/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc index 207734f9e2..7a503aae7b 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc @@ -4,6 +4,7 @@ #include "flutter/shell/platform/windows/flutter_windows_engine.h" +#include "flutter/fml/macros.h" #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h" #include "flutter/shell/platform/windows/flutter_windows_view.h" @@ -570,6 +571,9 @@ class MockFlutterWindowsView : public FlutterWindowsView { MOCK_METHOD2(NotifyWinEventWrapper, void(ui::AXPlatformNodeWin*, ax::mojom::Event)); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockFlutterWindowsView); }; TEST_F(FlutterWindowsEngineTest, AlertPlatformMessage) { diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_texture_registrar.h b/engine/src/flutter/shell/platform/windows/flutter_windows_texture_registrar.h index 60534328ee..45c1c1d39b 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_texture_registrar.h +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_texture_registrar.h @@ -10,6 +10,7 @@ #include #include "flutter/fml/closure.h" +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/public/flutter_texture_registrar.h" #include "flutter/shell/platform/windows/external_texture.h" @@ -56,6 +57,8 @@ class FlutterWindowsTextureRegistrar { std::mutex map_mutex_; int64_t EmplaceTexture(std::unique_ptr texture); + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsTextureRegistrar); }; }; // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_view.h b/engine/src/flutter/shell/platform/windows/flutter_windows_view.h index 9eed22ce8f..259d4cc2b8 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_view.h +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_view.h @@ -12,6 +12,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h" #include "flutter/shell/platform/common/geometry.h" #include "flutter/shell/platform/embedder/embedder.h" @@ -372,6 +373,8 @@ class FlutterWindowsView : public WindowBindingHandlerDelegate, // True when flutter's semantics tree is enabled. bool semantics_enabled_ = false; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsView); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/keyboard_key_channel_handler.h b/engine/src/flutter/shell/platform/windows/keyboard_key_channel_handler.h index 89efd5449b..3b2e899fe2 100644 --- a/engine/src/flutter/shell/platform/windows/keyboard_key_channel_handler.h +++ b/engine/src/flutter/shell/platform/windows/keyboard_key_channel_handler.h @@ -9,6 +9,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" #include "flutter/shell/platform/windows/keyboard_key_handler.h" @@ -43,6 +44,8 @@ class KeyboardKeyChannelHandler private: // The Flutter system channel for key event messages. std::unique_ptr> channel_; + + FML_DISALLOW_COPY_AND_ASSIGN(KeyboardKeyChannelHandler); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/keyboard_key_embedder_handler.h b/engine/src/flutter/shell/platform/windows/keyboard_key_embedder_handler.h index 9a027519de..a3537c3b23 100644 --- a/engine/src/flutter/shell/platform/windows/keyboard_key_embedder_handler.h +++ b/engine/src/flutter/shell/platform/windows/keyboard_key_embedder_handler.h @@ -10,6 +10,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/windows/keyboard_key_handler.h" @@ -191,6 +192,8 @@ class KeyboardKeyEmbedderHandler // The plane value for the private keys defined by the GTK embedding. static const uint64_t windowsPlane; + + FML_DISALLOW_COPY_AND_ASSIGN(KeyboardKeyEmbedderHandler); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/keyboard_key_handler.h b/engine/src/flutter/shell/platform/windows/keyboard_key_handler.h index 321fcabbe3..874ed0e15b 100644 --- a/engine/src/flutter/shell/platform/windows/keyboard_key_handler.h +++ b/engine/src/flutter/shell/platform/windows/keyboard_key_handler.h @@ -10,6 +10,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h" #include "flutter/shell/platform/windows/keyboard_handler_base.h" #include "rapidjson/document.h" @@ -121,6 +122,8 @@ class KeyboardKeyHandler : public KeyboardHandlerBase { // The sequence_id attached to the last event sent to the framework. uint64_t last_sequence_id_; + + FML_DISALLOW_COPY_AND_ASSIGN(KeyboardKeyHandler); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/keyboard_key_handler_unittests.cc b/engine/src/flutter/shell/platform/windows/keyboard_key_handler_unittests.cc index cdb41e6b50..72b5719642 100644 --- a/engine/src/flutter/shell/platform/windows/keyboard_key_handler_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/keyboard_key_handler_unittests.cc @@ -6,6 +6,7 @@ #include #include +#include "flutter/fml/macros.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -94,6 +95,9 @@ class MockKeyHandlerDelegate CallbackHandler callback_handler; int delegate_id; std::list* hook_history; + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockKeyHandlerDelegate); }; enum KeyEventResponse { diff --git a/engine/src/flutter/shell/platform/windows/keyboard_manager.h b/engine/src/flutter/shell/platform/windows/keyboard_manager.h index 07f0904965..9988fec4c4 100644 --- a/engine/src/flutter/shell/platform/windows/keyboard_manager.h +++ b/engine/src/flutter/shell/platform/windows/keyboard_manager.h @@ -6,11 +6,14 @@ #define FLUTTER_SHELL_PLATFORM_WINDOWS_KEYBOARD_MANAGER_H_ #include + #include #include #include #include +#include "flutter/fml/macros.h" + namespace flutter { // Handles keyboard and text messages on Win32. @@ -225,6 +228,8 @@ class KeyboardManager { // The queue of messages that have been redispatched to the system but have // not yet been received for a second time. std::deque pending_redispatches_; + + FML_DISALLOW_COPY_AND_ASSIGN(KeyboardManager); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/keyboard_unittests.cc b/engine/src/flutter/shell/platform/windows/keyboard_unittests.cc index abf5cdc1e1..d52742dc9e 100644 --- a/engine/src/flutter/shell/platform/windows/keyboard_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/keyboard_unittests.cc @@ -115,6 +115,8 @@ class TestKeyboardManager : public KeyboardManager { private: bool during_redispatch_ = false; + + FML_DISALLOW_COPY_AND_ASSIGN(TestKeyboardManager); }; // Injecting this kind of keyboard change means that a key state (the true @@ -314,6 +316,8 @@ class MockKeyboardManagerDelegate : public KeyboardManager::WindowDelegate, MapVirtualKeyToChar map_vk_to_char_; TestKeystate key_state_; std::list redispatched_messages_; + + FML_DISALLOW_COPY_AND_ASSIGN(MockKeyboardManagerDelegate); }; typedef struct { @@ -353,6 +357,9 @@ class TestFlutterWindowsView : public FlutterWindowsView { .text = text, }); } + + private: + FML_DISALLOW_COPY_AND_ASSIGN(TestFlutterWindowsView); }; class KeyboardTester { @@ -515,9 +522,19 @@ class KeyboardTester { callback(value); }; } + + private: + FML_DISALLOW_COPY_AND_ASSIGN(KeyboardTester); }; -class KeyboardTest : public WindowsTest {}; +class KeyboardTest : public WindowsTest { + public: + KeyboardTest() = default; + virtual ~KeyboardTest() = default; + + private: + FML_DISALLOW_COPY_AND_ASSIGN(KeyboardTest); +}; } // namespace diff --git a/engine/src/flutter/shell/platform/windows/platform_handler.cc b/engine/src/flutter/shell/platform/windows/platform_handler.cc index b7e93e3651..605094bdf2 100644 --- a/engine/src/flutter/shell/platform/windows/platform_handler.cc +++ b/engine/src/flutter/shell/platform/windows/platform_handler.cc @@ -10,6 +10,7 @@ #include #include "flutter/fml/logging.h" +#include "flutter/fml/macros.h" #include "flutter/fml/platform/win/wstring_conversion.h" #include "flutter/shell/platform/common/json_method_codec.h" #include "flutter/shell/platform/windows/flutter_windows_view.h" @@ -55,10 +56,6 @@ class ScopedGlobalMemory { } } - // Prevent copying. - ScopedGlobalMemory(ScopedGlobalMemory const&) = delete; - ScopedGlobalMemory& operator=(ScopedGlobalMemory const&) = delete; - // Returns the memory pointer, which will be nullptr if allocation failed. void* get() { return memory_; } @@ -70,6 +67,8 @@ class ScopedGlobalMemory { private: HGLOBAL memory_; + + FML_DISALLOW_COPY_AND_ASSIGN(ScopedGlobalMemory); }; // A scoped wrapper for GlobalLock/GlobalUnlock. @@ -98,10 +97,6 @@ class ScopedGlobalLock { } } - // Prevent copying. - ScopedGlobalLock(ScopedGlobalLock const&) = delete; - ScopedGlobalLock& operator=(ScopedGlobalLock const&) = delete; - // Returns the locked memory pointer, which will be nullptr if acquiring the // lock failed. void* get() { return locked_memory_; } @@ -109,6 +104,8 @@ class ScopedGlobalLock { private: HGLOBAL source_; void* locked_memory_; + + FML_DISALLOW_COPY_AND_ASSIGN(ScopedGlobalLock); }; // A Clipboard wrapper that automatically closes the clipboard when it goes out @@ -118,10 +115,6 @@ class ScopedClipboard : public ScopedClipboardInterface { ScopedClipboard(); virtual ~ScopedClipboard(); - // Prevent copying. - ScopedClipboard(ScopedClipboard const&) = delete; - ScopedClipboard& operator=(ScopedClipboard const&) = delete; - int Open(HWND window) override; bool HasString() override; @@ -132,6 +125,8 @@ class ScopedClipboard : public ScopedClipboardInterface { private: bool opened_ = false; + + FML_DISALLOW_COPY_AND_ASSIGN(ScopedClipboard); }; ScopedClipboard::ScopedClipboard() {} diff --git a/engine/src/flutter/shell/platform/windows/platform_handler.h b/engine/src/flutter/shell/platform/windows/platform_handler.h index a8104fea04..35f1cef14f 100644 --- a/engine/src/flutter/shell/platform/windows/platform_handler.h +++ b/engine/src/flutter/shell/platform/windows/platform_handler.h @@ -12,6 +12,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h" #include "rapidjson/document.h" @@ -76,6 +77,8 @@ class PlatformHandler { // unnecessarily. See flutter/flutter#103205. std::function()> scoped_clipboard_provider_; + + FML_DISALLOW_COPY_AND_ASSIGN(PlatformHandler); }; // A public interface for ScopedClipboard, so that it can be injected into diff --git a/engine/src/flutter/shell/platform/windows/platform_handler_unittests.cc b/engine/src/flutter/shell/platform/windows/platform_handler_unittests.cc index d695106674..2ae025b464 100644 --- a/engine/src/flutter/shell/platform/windows/platform_handler_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/platform_handler_unittests.cc @@ -6,6 +6,7 @@ #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/json_method_codec.h" #include "flutter/shell/platform/windows/flutter_windows_view.h" #include "flutter/shell/platform/windows/testing/flutter_windows_engine_builder.h" @@ -69,15 +70,24 @@ class MockPlatformHandler : public PlatformHandler { MOCK_METHOD2(SystemSoundPlay, void(const std::string&, std::unique_ptr>)); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockPlatformHandler); }; // A test version of the private ScopedClipboard. class MockScopedClipboard : public ScopedClipboardInterface { public: + MockScopedClipboard() = default; + virtual ~MockScopedClipboard() = default; + MOCK_METHOD(int, Open, (HWND window), (override)); MOCK_METHOD(bool, HasString, (), (override)); MOCK_METHOD((std::variant), GetString, (), (override)); MOCK_METHOD(int, SetString, (const std::wstring string), (override)); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockScopedClipboard); }; std::string SimulatePlatformMessage(TestBinaryMessenger* messenger, @@ -98,6 +108,10 @@ std::string SimulatePlatformMessage(TestBinaryMessenger* messenger, } // namespace class PlatformHandlerTest : public WindowsTest { + public: + PlatformHandlerTest() = default; + virtual ~PlatformHandlerTest() = default; + protected: FlutterWindowsEngine* engine() { return engine_.get(); } @@ -120,6 +134,8 @@ class PlatformHandlerTest : public WindowsTest { private: std::unique_ptr engine_; std::unique_ptr view_; + + FML_DISALLOW_COPY_AND_ASSIGN(PlatformHandlerTest); }; TEST_F(PlatformHandlerTest, GetClipboardData) { diff --git a/engine/src/flutter/shell/platform/windows/sequential_id_generator.h b/engine/src/flutter/shell/platform/windows/sequential_id_generator.h index 5efd6d78fe..7811656268 100644 --- a/engine/src/flutter/shell/platform/windows/sequential_id_generator.h +++ b/engine/src/flutter/shell/platform/windows/sequential_id_generator.h @@ -8,6 +8,8 @@ #include #include +#include "flutter/fml/macros.h" + namespace flutter { // This is used to generate a series of sequential ID numbers in a way that a @@ -52,6 +54,8 @@ class SequentialIdGenerator { const uint32_t min_id_; const uint32_t max_id_; uint32_t min_available_id_; + + FML_DISALLOW_COPY_AND_ASSIGN(SequentialIdGenerator); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/settings_plugin.h b/engine/src/flutter/shell/platform/windows/settings_plugin.h index dbd770fa5b..479a45c13c 100644 --- a/engine/src/flutter/shell/platform/windows/settings_plugin.h +++ b/engine/src/flutter/shell/platform/windows/settings_plugin.h @@ -9,6 +9,7 @@ #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/basic_message_channel.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" #include "flutter/shell/platform/windows/event_watcher.h" @@ -71,8 +72,7 @@ class SettingsPlugin { TaskRunner* task_runner_; - SettingsPlugin(const SettingsPlugin&) = delete; - SettingsPlugin& operator=(const SettingsPlugin&) = delete; + FML_DISALLOW_COPY_AND_ASSIGN(SettingsPlugin); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/settings_plugin_unittests.cc b/engine/src/flutter/shell/platform/windows/settings_plugin_unittests.cc index 2ca1711c8f..78060ad29c 100644 --- a/engine/src/flutter/shell/platform/windows/settings_plugin_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/settings_plugin_unittests.cc @@ -1,8 +1,10 @@ // Copyright 2013 The Flutter 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/shell/platform/windows/settings_plugin.h" +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/task_runner.h" #include "flutter/shell/platform/windows/testing/test_binary_messenger.h" #include "gmock/gmock.h" @@ -30,6 +32,9 @@ class MockSettingsPlugin : public SettingsPlugin { MOCK_METHOD0(WatchPreferredBrightnessChanged, void()); MOCK_METHOD0(WatchTextScaleFactorChanged, void()); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockSettingsPlugin); }; } // namespace diff --git a/engine/src/flutter/shell/platform/windows/system_utils_unittests.cc b/engine/src/flutter/shell/platform/windows/system_utils_unittests.cc index dad4bf729c..ba24493ba1 100644 --- a/engine/src/flutter/shell/platform/windows/system_utils_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/system_utils_unittests.cc @@ -5,6 +5,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/system_utils.h" #include "gtest/gtest.h" @@ -13,7 +14,8 @@ namespace testing { class MockWindowsRegistry : public WindowsRegistry { public: - virtual ~MockWindowsRegistry() {} + MockWindowsRegistry() = default; + virtual ~MockWindowsRegistry() = default; virtual LSTATUS GetRegistryValue(HKEY hkey, LPCWSTR key, @@ -37,6 +39,9 @@ class MockWindowsRegistry : public WindowsRegistry { } return ERROR_SUCCESS; } + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockWindowsRegistry); }; TEST(SystemUtils, GetPreferredLanguageInfo) { diff --git a/engine/src/flutter/shell/platform/windows/task_runner.h b/engine/src/flutter/shell/platform/windows/task_runner.h index b211dbedcd..14195b0c7f 100644 --- a/engine/src/flutter/shell/platform/windows/task_runner.h +++ b/engine/src/flutter/shell/platform/windows/task_runner.h @@ -102,8 +102,7 @@ class TaskRunner : public TaskRunnerWindow::Delegate { DWORD main_thread_id_; std::shared_ptr task_runner_window_; - TaskRunner(const TaskRunner&) = delete; - TaskRunner& operator=(const TaskRunner&) = delete; + FML_DISALLOW_COPY_AND_ASSIGN(TaskRunner); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/task_runner_unittests.cc b/engine/src/flutter/shell/platform/windows/task_runner_unittests.cc index d7d5cc7a41..74175e9d5b 100644 --- a/engine/src/flutter/shell/platform/windows/task_runner_unittests.cc +++ b/engine/src/flutter/shell/platform/windows/task_runner_unittests.cc @@ -4,6 +4,7 @@ #include "flutter/shell/platform/windows/task_runner.h" +#include "flutter/fml/macros.h" #include "gtest/gtest.h" namespace flutter { @@ -31,6 +32,9 @@ class MockTaskRunner : public TaskRunner { std::chrono::duration_cast( std::chrono::nanoseconds(10000))); } + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockTaskRunner); }; uint64_t MockGetCurrentTime() { diff --git a/engine/src/flutter/shell/platform/windows/task_runner_window.h b/engine/src/flutter/shell/platform/windows/task_runner_window.h index ae874f82af..a666987ae3 100644 --- a/engine/src/flutter/shell/platform/windows/task_runner_window.h +++ b/engine/src/flutter/shell/platform/windows/task_runner_window.h @@ -12,6 +12,8 @@ #include #include +#include "flutter/fml/macros.h" + namespace flutter { // Hidden HWND responsible for processing flutter tasks on main thread @@ -58,6 +60,8 @@ class TaskRunnerWindow { HWND window_handle_; std::wstring window_class_name_; std::vector delegates_; + + FML_DISALLOW_COPY_AND_ASSIGN(TaskRunnerWindow); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/testing/engine_modifier.h b/engine/src/flutter/shell/platform/windows/testing/engine_modifier.h index 7ff46cbe37..f49362ba6d 100644 --- a/engine/src/flutter/shell/platform/windows/testing/engine_modifier.h +++ b/engine/src/flutter/shell/platform/windows/testing/engine_modifier.h @@ -9,6 +9,8 @@ #include +#include "flutter/fml/macros.h" + namespace flutter { // A test utility class providing the ability to access and alter various @@ -66,6 +68,8 @@ class EngineModifier { private: FlutterWindowsEngine* engine_; + + FML_DISALLOW_COPY_AND_ASSIGN(EngineModifier); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/testing/flutter_window_test.h b/engine/src/flutter/shell/platform/windows/testing/flutter_window_test.h index cc1ec29453..c62f5abe7f 100644 --- a/engine/src/flutter/shell/platform/windows/testing/flutter_window_test.h +++ b/engine/src/flutter/shell/platform/windows/testing/flutter_window_test.h @@ -7,6 +7,8 @@ #include "flutter/shell/platform/windows/flutter_window.h" +#include "flutter/fml/macros.h" + namespace flutter { namespace testing { @@ -16,9 +18,8 @@ class FlutterWindowTest : public FlutterWindow { FlutterWindowTest(int width, int height); virtual ~FlutterWindowTest(); - // Prevent copying. - FlutterWindowTest(FlutterWindowTest const&) = delete; - FlutterWindowTest& operator=(FlutterWindowTest const&) = delete; + private: + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowTest); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.cc b/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.cc index 5898c5dcc5..d4f8086c89 100644 --- a/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.cc +++ b/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.cc @@ -4,6 +4,8 @@ #include "flutter/shell/platform/windows/testing/flutter_windows_engine_builder.h" +#include "flutter/fml/macros.h" + namespace flutter { namespace testing { @@ -17,10 +19,6 @@ class TestFlutterWindowsEngine : public FlutterWindowsEngine { get_key_state_(std::move(get_key_state)), map_vk_to_scan_(std::move(map_vk_to_scan)) {} - // Prevent copying. - TestFlutterWindowsEngine(TestFlutterWindowsEngine const&) = delete; - TestFlutterWindowsEngine& operator=(TestFlutterWindowsEngine const&) = delete; - protected: std::unique_ptr CreateKeyboardKeyHandler( BinaryMessenger* messenger, @@ -41,6 +39,8 @@ class TestFlutterWindowsEngine : public FlutterWindowsEngine { private: KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state_; KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan_; + + FML_DISALLOW_COPY_AND_ASSIGN(TestFlutterWindowsEngine); }; FlutterWindowsEngineBuilder::FlutterWindowsEngineBuilder( diff --git a/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.h b/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.h index 014da14765..ce3648a82a 100644 --- a/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.h +++ b/engine/src/flutter/shell/platform/windows/testing/flutter_windows_engine_builder.h @@ -7,6 +7,7 @@ #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/flutter_windows_engine.h" #include "flutter/shell/platform/windows/keyboard_key_embedder_handler.h" #include "flutter/shell/platform/windows/public/flutter_windows.h" @@ -30,11 +31,6 @@ class FlutterWindowsEngineBuilder { std::unique_ptr Build(); - // Prevent copying. - FlutterWindowsEngineBuilder(FlutterWindowsEngineBuilder const&) = delete; - FlutterWindowsEngineBuilder& operator=(FlutterWindowsEngineBuilder const&) = - delete; - private: WindowsTestContext& context_; FlutterDesktopEngineProperties properties_ = {}; @@ -42,6 +38,8 @@ class FlutterWindowsEngineBuilder { std::vector dart_entrypoint_arguments_; KeyboardKeyEmbedderHandler::GetKeyStateHandler get_key_state_; KeyboardKeyEmbedderHandler::MapVirtualKeyToScanCode map_vk_to_scan_; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterWindowsEngineBuilder); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_direct_manipulation.h b/engine/src/flutter/shell/platform/windows/testing/mock_direct_manipulation.h index be1fe35027..6b0faa9348 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_direct_manipulation.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_direct_manipulation.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_DIRECT_MANIPULATION_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_DIRECT_MANIPULATION_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/direct_manipulation.h" #include "gmock/gmock.h" diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_gl_functions.h b/engine/src/flutter/shell/platform/windows/testing/mock_gl_functions.h index 0d46cbb368..847d822ee8 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_gl_functions.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_gl_functions.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_GL_FUNCTIONS_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_GL_FUNCTIONS_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/external_texture.h" namespace flutter { @@ -46,6 +47,8 @@ class MockGlFunctions { private: GlProcs gl_procs_; + + FML_DISALLOW_COPY_AND_ASSIGN(MockGlFunctions); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_text_input_manager.h b/engine/src/flutter/shell/platform/windows/testing/mock_text_input_manager.h index e51d218273..a6f0d12bcf 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_text_input_manager.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_text_input_manager.h @@ -8,6 +8,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/text_input_manager.h" #include "gmock/gmock.h" @@ -20,13 +21,12 @@ class MockTextInputManager : public TextInputManager { MockTextInputManager(); virtual ~MockTextInputManager(); - // Prevent copying. - MockTextInputManager(MockTextInputManager const&) = delete; - MockTextInputManager& operator=(MockTextInputManager const&) = delete; - MOCK_CONST_METHOD0(GetComposingString, std::optional()); MOCK_CONST_METHOD0(GetResultString, std::optional()); MOCK_CONST_METHOD0(GetComposingCursorPosition, long()); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockTextInputManager); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_window.h b/engine/src/flutter/shell/platform/windows/testing/mock_window.h index 22429cf32a..53567b723d 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_window.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_window.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WIN32_WINDOW_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WIN32_WINDOW_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/testing/test_keyboard.h" #include "flutter/shell/platform/windows/window.h" #include "gmock/gmock.h" @@ -20,10 +21,6 @@ class MockWindow : public Window { std::unique_ptr text_input_manager); virtual ~MockWindow(); - // Prevent copying. - MockWindow(MockWindow const&) = delete; - MockWindow& operator=(MockWindow const&) = delete; - // Wrapper for GetCurrentDPI() which is a protected method. UINT GetDpi(); @@ -75,6 +72,9 @@ class MockWindow : public Window { protected: LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockWindow); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.h b/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.h index 709035b350..a2c9145ecc 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/window_binding_handler.h" #include "flutter/third_party/accessibility/ax/platform/ax_platform_node_win.h" #include "gmock/gmock.h" @@ -18,10 +19,6 @@ class MockWindowBindingHandler : public WindowBindingHandler { MockWindowBindingHandler(); virtual ~MockWindowBindingHandler(); - // Prevent copying. - MockWindowBindingHandler(MockWindowBindingHandler const&) = delete; - MockWindowBindingHandler& operator=(MockWindowBindingHandler const&) = delete; - MOCK_METHOD1(SetView, void(WindowBindingHandlerDelegate* view)); MOCK_METHOD0(GetRenderTarget, WindowsRenderTarget()); MOCK_METHOD0(GetPlatformWindow, PlatformWindow()); @@ -39,6 +36,9 @@ class MockWindowBindingHandler : public WindowBindingHandler { MOCK_METHOD0(SendInitialAccessibilityFeatures, void()); MOCK_METHOD0(GetAlertDelegate, AlertPlatformNodeDelegate*()); MOCK_METHOD0(GetAlert, ui::AXPlatformNodeWin*()); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockWindowBindingHandler); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h b/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h index 89ac5f5333..35147d4e09 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler_delegate.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_DELEGATE_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_DELEGATE_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/window_binding_handler_delegate.h" #include "gmock/gmock.h" @@ -15,12 +16,6 @@ class MockWindowBindingHandlerDelegate : public WindowBindingHandlerDelegate { public: MockWindowBindingHandlerDelegate() {} - // Prevent copying. - MockWindowBindingHandlerDelegate(MockWindowBindingHandlerDelegate const&) = - delete; - MockWindowBindingHandlerDelegate& operator=( - MockWindowBindingHandlerDelegate const&) = delete; - MOCK_METHOD2(OnWindowSizeChanged, void(size_t, size_t)); MOCK_METHOD0(OnWindowRepaint, void()); MOCK_METHOD5(OnPointerMove, @@ -65,6 +60,9 @@ class MockWindowBindingHandlerDelegate : public WindowBindingHandlerDelegate { MOCK_METHOD1(UpdateHighContrastEnabled, void(bool enabled)); MOCK_METHOD0(GetAxFragmentRootDelegate, ui::AXFragmentRootDelegateWin*()); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockWindowBindingHandlerDelegate); }; } // namespace testing diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_windows_proc_table.h b/engine/src/flutter/shell/platform/windows/testing/mock_windows_proc_table.h index 7c136def68..2bc6103523 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_windows_proc_table.h +++ b/engine/src/flutter/shell/platform/windows/testing/mock_windows_proc_table.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOWS_PROC_TABLE_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOWS_PROC_TABLE_H_ +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/windows_proc_table.h" #include "gmock/gmock.h" diff --git a/engine/src/flutter/shell/platform/windows/testing/test_binary_messenger.h b/engine/src/flutter/shell/platform/windows/testing/test_binary_messenger.h index b311c3ae17..9b7f2c9b04 100644 --- a/engine/src/flutter/shell/platform/windows/testing/test_binary_messenger.h +++ b/engine/src/flutter/shell/platform/windows/testing/test_binary_messenger.h @@ -10,6 +10,7 @@ #include #include "flutter/fml/logging.h" +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" namespace flutter { @@ -28,10 +29,6 @@ class TestBinaryMessenger : public BinaryMessenger { virtual ~TestBinaryMessenger() = default; - // Prevent copying. - TestBinaryMessenger(TestBinaryMessenger const&) = delete; - TestBinaryMessenger& operator=(TestBinaryMessenger const&) = delete; - // Simulates a message from the engine on the given channel. // // Returns false if no handler is registered on that channel. @@ -73,6 +70,8 @@ class TestBinaryMessenger : public BinaryMessenger { // Mapping of channel name to registered handlers. std::map registered_handlers_; + + FML_DISALLOW_COPY_AND_ASSIGN(TestBinaryMessenger); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/testing/test_keyboard.h b/engine/src/flutter/shell/platform/windows/testing/test_keyboard.h index 8eddff6bfc..1ec3a3b38c 100644 --- a/engine/src/flutter/shell/platform/windows/testing/test_keyboard.h +++ b/engine/src/flutter/shell/platform/windows/testing/test_keyboard.h @@ -10,6 +10,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/windows/testing/engine_modifier.h" #include "flutter/shell/platform/windows/testing/wm_builders.h" @@ -99,6 +100,8 @@ class MockKeyResponseController { ResponseCallback callback) { callback(false); } + + FML_DISALLOW_COPY_AND_ASSIGN(MockKeyResponseController); }; void MockEmbedderApiForKeyboard( diff --git a/engine/src/flutter/shell/platform/windows/text_input_manager.cc b/engine/src/flutter/shell/platform/windows/text_input_manager.cc index a270abcc98..bc31ac0e27 100644 --- a/engine/src/flutter/shell/platform/windows/text_input_manager.cc +++ b/engine/src/flutter/shell/platform/windows/text_input_manager.cc @@ -9,6 +9,7 @@ #include #include "flutter/fml/logging.h" +#include "flutter/fml/macros.h" namespace flutter { @@ -27,10 +28,6 @@ class ImmContext { } } - // Prevent copying. - ImmContext(const ImmContext& other) = delete; - ImmContext& operator=(const ImmContext& other) = delete; - // Returns true if a valid IMM context has been obtained. bool IsValid() const { return context_ != nullptr; } @@ -43,6 +40,8 @@ class ImmContext { private: HWND window_handle_; HIMC context_; + + FML_DISALLOW_COPY_AND_ASSIGN(ImmContext); }; void TextInputManager::SetWindowHandle(HWND window_handle) { diff --git a/engine/src/flutter/shell/platform/windows/text_input_manager.h b/engine/src/flutter/shell/platform/windows/text_input_manager.h index a283a5123e..4e1c262fa3 100644 --- a/engine/src/flutter/shell/platform/windows/text_input_manager.h +++ b/engine/src/flutter/shell/platform/windows/text_input_manager.h @@ -11,6 +11,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/geometry.h" namespace flutter { @@ -30,9 +31,6 @@ class TextInputManager { TextInputManager() noexcept = default; virtual ~TextInputManager() = default; - TextInputManager(const TextInputManager&) = delete; - TextInputManager& operator=(const TextInputManager&) = delete; - // Sets the window handle with which the IME is associated. void SetWindowHandle(HWND window_handle); @@ -100,6 +98,8 @@ class TextInputManager { // The system caret rect. Rect caret_rect_ = {{0, 0}, {0, 0}}; + + FML_DISALLOW_COPY_AND_ASSIGN(TextInputManager); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/text_input_plugin.h b/engine/src/flutter/shell/platform/windows/text_input_plugin.h index 17a2a3d7e8..a5ee04b08b 100644 --- a/engine/src/flutter/shell/platform/windows/text_input_plugin.h +++ b/engine/src/flutter/shell/platform/windows/text_input_plugin.h @@ -9,6 +9,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" #include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h" #include "flutter/shell/platform/common/geometry.h" @@ -107,6 +108,8 @@ class TextInputPlugin { 0.0, 0.0, 0.0, 0.0, // 0.0, 0.0, 0.0, 0.0, // 0.0, 0.0, 0.0, 0.0}; + + FML_DISALLOW_COPY_AND_ASSIGN(TextInputPlugin); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/text_input_plugin_unittest.cc b/engine/src/flutter/shell/platform/windows/text_input_plugin_unittest.cc index 9c254b9a58..91084c8074 100644 --- a/engine/src/flutter/shell/platform/windows/text_input_plugin_unittest.cc +++ b/engine/src/flutter/shell/platform/windows/text_input_plugin_unittest.cc @@ -7,6 +7,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/common/json_message_codec.h" #include "flutter/shell/platform/common/json_method_codec.h" #include "flutter/shell/platform/windows/testing/test_binary_messenger.h" @@ -40,13 +41,11 @@ class MockTextInputPluginDelegate : public TextInputPluginDelegate { MockTextInputPluginDelegate() {} virtual ~MockTextInputPluginDelegate() = default; - // Prevent copying. - MockTextInputPluginDelegate(MockTextInputPluginDelegate const&) = delete; - MockTextInputPluginDelegate& operator=(MockTextInputPluginDelegate const&) = - delete; - MOCK_METHOD1(OnCursorRectUpdated, void(const Rect&)); MOCK_METHOD0(OnResetImeComposing, void()); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(MockTextInputPluginDelegate); }; } // namespace diff --git a/engine/src/flutter/shell/platform/windows/window_proc_delegate_manager.h b/engine/src/flutter/shell/platform/windows/window_proc_delegate_manager.h index f4cef8f79e..36e9fb2333 100644 --- a/engine/src/flutter/shell/platform/windows/window_proc_delegate_manager.h +++ b/engine/src/flutter/shell/platform/windows/window_proc_delegate_manager.h @@ -10,6 +10,7 @@ #include #include +#include "flutter/fml/macros.h" #include "flutter/shell/platform/windows/public/flutter_windows.h" namespace flutter { @@ -21,11 +22,6 @@ class WindowProcDelegateManager { explicit WindowProcDelegateManager(); ~WindowProcDelegateManager(); - // Prevent copying. - WindowProcDelegateManager(WindowProcDelegateManager const&) = delete; - WindowProcDelegateManager& operator=(WindowProcDelegateManager const&) = - delete; - // Adds |delegate| as a delegate to be called for |OnTopLevelWindowProc|. // // Multiple calls with the same |delegate| will replace the previous @@ -50,6 +46,8 @@ class WindowProcDelegateManager { private: std::map top_level_window_proc_handlers_; + + FML_DISALLOW_COPY_AND_ASSIGN(WindowProcDelegateManager); }; } // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/windows_proc_table.h b/engine/src/flutter/shell/platform/windows/windows_proc_table.h index db6397d2e4..23c9b777a0 100644 --- a/engine/src/flutter/shell/platform/windows/windows_proc_table.h +++ b/engine/src/flutter/shell/platform/windows/windows_proc_table.h @@ -5,10 +5,11 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOWS_PROC_TABLE_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOWS_PROC_TABLE_H_ -#include "flutter/fml/native_library.h" - #include +#include "flutter/fml/macros.h" +#include "flutter/fml/native_library.h" + namespace flutter { // Lookup table for Windows APIs that aren't available on all versions of