From 794db8c01bd24bcf74fba0ea2cbe1e498af2bd32 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 13 Oct 2021 12:58:01 -0700 Subject: [PATCH] Correct file line-endings from CRLF to LF (flutter/engine#29164) --- .../platform/windows/task_runner_winuwp.cc | 102 ++++++++--------- .../platform/windows/task_runner_winuwp.h | 104 +++++++++--------- .../testing/mock_window_binding_handler.cc | 30 ++--- .../testing/mock_window_binding_handler.h | 86 +++++++-------- 4 files changed, 161 insertions(+), 161 deletions(-) diff --git a/engine/src/flutter/shell/platform/windows/task_runner_winuwp.cc b/engine/src/flutter/shell/platform/windows/task_runner_winuwp.cc index d6c5c6bc70d..9f8ebaf3bbd 100644 --- a/engine/src/flutter/shell/platform/windows/task_runner_winuwp.cc +++ b/engine/src/flutter/shell/platform/windows/task_runner_winuwp.cc @@ -1,51 +1,51 @@ -// 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/task_runner_winuwp.h" - -#include -#include - -namespace flutter { - -// static -std::unique_ptr TaskRunner::Create( - DWORD main_thread_id, - CurrentTimeProc get_current_time, - const TaskExpiredCallback& on_task_expired) { - return std::make_unique(main_thread_id, on_task_expired); -} - -TaskRunnerWinUwp::TaskRunnerWinUwp(DWORD main_thread_id, - const TaskExpiredCallback& on_task_expired) - : main_thread_id_(main_thread_id), - on_task_expired_(std::move(on_task_expired)) { - dispatcher_ = - winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread().Dispatcher(); -} - -TaskRunnerWinUwp::~TaskRunnerWinUwp() = default; - -bool TaskRunnerWinUwp::RunsTasksOnCurrentThread() const { - return GetCurrentThreadId() == main_thread_id_; -} - -void TaskRunnerWinUwp::PostFlutterTask(FlutterTask flutter_task, - uint64_t flutter_target_time_nanos) { - // TODO: Handle the target time. See - // https://github.com/flutter/flutter/issues/70890. - - dispatcher_.RunAsync( - winrt::Windows::UI::Core::CoreDispatcherPriority::Normal, - [this, flutter_task]() { on_task_expired_(&flutter_task); }); -} - -void TaskRunnerWinUwp::PostTask(TaskClosure task) { - // TODO: Handle the target time. See PostFlutterTask() - - dispatcher_.RunAsync(winrt::Windows::UI::Core::CoreDispatcherPriority::Normal, - [task]() { task(); }); -} - -} // namespace flutter +// 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/task_runner_winuwp.h" + +#include +#include + +namespace flutter { + +// static +std::unique_ptr TaskRunner::Create( + DWORD main_thread_id, + CurrentTimeProc get_current_time, + const TaskExpiredCallback& on_task_expired) { + return std::make_unique(main_thread_id, on_task_expired); +} + +TaskRunnerWinUwp::TaskRunnerWinUwp(DWORD main_thread_id, + const TaskExpiredCallback& on_task_expired) + : main_thread_id_(main_thread_id), + on_task_expired_(std::move(on_task_expired)) { + dispatcher_ = + winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread().Dispatcher(); +} + +TaskRunnerWinUwp::~TaskRunnerWinUwp() = default; + +bool TaskRunnerWinUwp::RunsTasksOnCurrentThread() const { + return GetCurrentThreadId() == main_thread_id_; +} + +void TaskRunnerWinUwp::PostFlutterTask(FlutterTask flutter_task, + uint64_t flutter_target_time_nanos) { + // TODO: Handle the target time. See + // https://github.com/flutter/flutter/issues/70890. + + dispatcher_.RunAsync( + winrt::Windows::UI::Core::CoreDispatcherPriority::Normal, + [this, flutter_task]() { on_task_expired_(&flutter_task); }); +} + +void TaskRunnerWinUwp::PostTask(TaskClosure task) { + // TODO: Handle the target time. See PostFlutterTask() + + dispatcher_.RunAsync(winrt::Windows::UI::Core::CoreDispatcherPriority::Normal, + [task]() { task(); }); +} + +} // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/task_runner_winuwp.h b/engine/src/flutter/shell/platform/windows/task_runner_winuwp.h index d411a4c2c38..7ee6d196ed9 100644 --- a/engine/src/flutter/shell/platform/windows/task_runner_winuwp.h +++ b/engine/src/flutter/shell/platform/windows/task_runner_winuwp.h @@ -1,52 +1,52 @@ -// 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. - -#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WINRT_TASK_RUNNER_H_ -#define FLUTTER_SHELL_PLATFORM_WINDOWS_WINRT_TASK_RUNNER_H_ - -#include - -#include - -#include -#include -#include - -#include "flutter/shell/platform/embedder/embedder.h" -#include "flutter/shell/platform/windows/task_runner.h" - -namespace flutter { - -// A custom task runner that uses a CoreDispatcher to schedule -// flutter tasks. -class TaskRunnerWinUwp : public TaskRunner { - public: - TaskRunnerWinUwp(DWORD main_thread_id, - const TaskExpiredCallback& on_task_expired); - - ~TaskRunnerWinUwp(); - - TaskRunnerWinUwp(const TaskRunnerWinUwp&) = delete; - TaskRunnerWinUwp& operator=(const TaskRunnerWinUwp&) = delete; - - // |TaskRunner| - bool RunsTasksOnCurrentThread() const override; - - // |TaskRunner| - void PostFlutterTask(FlutterTask flutter_task, - uint64_t flutter_target_time_nanos) override; - - // |TaskRunner| - void PostTask(TaskClosure task) override; - - private: - DWORD main_thread_id_; - TaskExpiredCallback on_task_expired_; - - winrt::Windows::UI::Core::CoreDispatcher dispatcher_{nullptr}; -}; - -} // namespace flutter - -#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINRT_TASK_RUNNER_H_ +// 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. + +#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WINRT_TASK_RUNNER_H_ +#define FLUTTER_SHELL_PLATFORM_WINDOWS_WINRT_TASK_RUNNER_H_ + +#include + +#include + +#include +#include +#include + +#include "flutter/shell/platform/embedder/embedder.h" +#include "flutter/shell/platform/windows/task_runner.h" + +namespace flutter { + +// A custom task runner that uses a CoreDispatcher to schedule +// flutter tasks. +class TaskRunnerWinUwp : public TaskRunner { + public: + TaskRunnerWinUwp(DWORD main_thread_id, + const TaskExpiredCallback& on_task_expired); + + ~TaskRunnerWinUwp(); + + TaskRunnerWinUwp(const TaskRunnerWinUwp&) = delete; + TaskRunnerWinUwp& operator=(const TaskRunnerWinUwp&) = delete; + + // |TaskRunner| + bool RunsTasksOnCurrentThread() const override; + + // |TaskRunner| + void PostFlutterTask(FlutterTask flutter_task, + uint64_t flutter_target_time_nanos) override; + + // |TaskRunner| + void PostTask(TaskClosure task) override; + + private: + DWORD main_thread_id_; + TaskExpiredCallback on_task_expired_; + + winrt::Windows::UI::Core::CoreDispatcher dispatcher_{nullptr}; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINRT_TASK_RUNNER_H_ diff --git a/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.cc b/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.cc index 7b7f0e17fda..c0449152beb 100644 --- a/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.cc +++ b/engine/src/flutter/shell/platform/windows/testing/mock_window_binding_handler.cc @@ -1,15 +1,15 @@ -// 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/testing/mock_window_binding_handler.h" - -namespace flutter { -namespace testing { - -MockWindowBindingHandler::MockWindowBindingHandler() : WindowBindingHandler(){}; - -MockWindowBindingHandler::~MockWindowBindingHandler() = default; - -} // namespace testing -} // namespace flutter +// 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/testing/mock_window_binding_handler.h" + +namespace flutter { +namespace testing { + +MockWindowBindingHandler::MockWindowBindingHandler() : WindowBindingHandler(){}; + +MockWindowBindingHandler::~MockWindowBindingHandler() = default; + +} // namespace testing +} // namespace flutter 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 2a664348141..a5395c96cca 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 @@ -1,43 +1,43 @@ -// 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. - -#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ -#define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ - -#include - -#include "flutter/shell/platform/windows/window_binding_handler.h" -#include "gmock/gmock.h" - -namespace flutter { -namespace testing { - -/// Mock for the |WindowWin32| base class. -class MockWindowBindingHandler : public WindowBindingHandler { - public: - 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()); - MOCK_METHOD0(GetDpiScale, float()); - MOCK_METHOD0(IsVisible, bool()); - MOCK_METHOD0(OnWindowResized, void()); - MOCK_METHOD0(GetPhysicalWindowBounds, PhysicalWindowBounds()); - MOCK_METHOD1(UpdateFlutterCursor, void(const std::string& cursor_name)); - MOCK_METHOD1(OnCursorRectUpdated, void(const Rect& rect)); - MOCK_METHOD0(OnResetImeComposing, void()); - MOCK_METHOD3(OnBitmapSurfaceUpdated, - bool(const void* allocation, size_t row_bytes, size_t height)); -}; - -} // namespace testing -} // namespace flutter - -#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ +// 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. + +#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ +#define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_ + +#include + +#include "flutter/shell/platform/windows/window_binding_handler.h" +#include "gmock/gmock.h" + +namespace flutter { +namespace testing { + +/// Mock for the |WindowWin32| base class. +class MockWindowBindingHandler : public WindowBindingHandler { + public: + 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()); + MOCK_METHOD0(GetDpiScale, float()); + MOCK_METHOD0(IsVisible, bool()); + MOCK_METHOD0(OnWindowResized, void()); + MOCK_METHOD0(GetPhysicalWindowBounds, PhysicalWindowBounds()); + MOCK_METHOD1(UpdateFlutterCursor, void(const std::string& cursor_name)); + MOCK_METHOD1(OnCursorRectUpdated, void(const Rect& rect)); + MOCK_METHOD0(OnResetImeComposing, void()); + MOCK_METHOD3(OnBitmapSurfaceUpdated, + bool(const void* allocation, size_t row_bytes, size_t height)); +}; + +} // namespace testing +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_BINDING_HANDLER_H_