From 2dfcaaa7e2c4aa762f2a7f5228127d64f2266e1a Mon Sep 17 00:00:00 2001 From: George Wright Date: Tue, 27 Apr 2021 15:06:21 -0700 Subject: [PATCH] Add a stub implementation of FlutterMetalCompositor (#25790) --- ci/licenses_golden/licenses_flutter | 2 + shell/platform/darwin/macos/BUILD.gn | 2 + .../framework/Source/FlutterMetalCompositor.h | 48 +++++++++++++++++++ .../Source/FlutterMetalCompositor.mm | 29 +++++++++++ 4 files changed, 81 insertions(+) create mode 100644 shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h create mode 100644 shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.mm diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 8833bbdc2..6e5121528 100755 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -1148,6 +1148,8 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterKeybo FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterKeyboardManager.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterKeyboardManagerUnittests.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMacOSExternalTexture.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMetalRenderer.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMetalRenderer.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMetalRendererTest.mm diff --git a/shell/platform/darwin/macos/BUILD.gn b/shell/platform/darwin/macos/BUILD.gn index 77c83bb7a..b868ff413 100644 --- a/shell/platform/darwin/macos/BUILD.gn +++ b/shell/platform/darwin/macos/BUILD.gn @@ -85,6 +85,8 @@ source_set("flutter_framework_source") { "framework/Source/FlutterKeyboardManager.mm", "framework/Source/FlutterMacOSExternalTexture.h", "framework/Source/FlutterMacOSExternalTexture.h", + "framework/Source/FlutterMetalCompositor.h", + "framework/Source/FlutterMetalCompositor.mm", "framework/Source/FlutterMetalRenderer.h", "framework/Source/FlutterMetalRenderer.mm", "framework/Source/FlutterMouseCursorPlugin.h", diff --git a/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h b/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h new file mode 100644 index 000000000..e3b7ee562 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h @@ -0,0 +1,48 @@ +// 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_METAL_COMPOSITOR_H_ +#define FLUTTER_METAL_COMPOSITOR_H_ + +#include "flutter/fml/macros.h" +#include "flutter/shell/platform/darwin/macos/framework/Source/FlutterCompositor.h" + +namespace flutter { + +class FlutterMetalCompositor : public FlutterCompositor { + public: + explicit FlutterMetalCompositor(FlutterViewController* view_controller); + + virtual ~FlutterMetalCompositor() = default; + + // Creates a BackingStore and sets backing_store_out to a + // FlutterBackingStore struct containing details of the new + // backing store. + // + // If the backing store is being requested for the first time + // for a given frame, we do not create a new backing store but + // rather return the backing store associated with the + // FlutterView's FlutterSurfaceManager. + // + // Any additional state allocated for the backing store and + // saved as user_data in the backing store must be collected + // in backing_store_out's destruction_callback field which will + // be called when the embedder collects the backing store. + bool CreateBackingStore(const FlutterBackingStoreConfig* config, + FlutterBackingStore* backing_store_out) override; + + // Releases and deallocates any and all resources that were allocated + // for this FlutterBackingStore object in CreateBackingStore. + bool CollectBackingStore(const FlutterBackingStore* backing_store) override; + + // Composites the provided FlutterLayer objects and presents the composited + // frame to the FlutterView(s). + bool Present(const FlutterLayer** layers, size_t layers_count) override; + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterMetalCompositor); +}; + +} // namespace flutter + +#endif // FLUTTER_METAL_COMPOSITOR_H_ diff --git a/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.mm b/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.mm new file mode 100644 index 000000000..56de5280e --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.mm @@ -0,0 +1,29 @@ +// 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. + +#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h" + +#include "flutter/fml/logging.h" + +namespace flutter { + +FlutterMetalCompositor::FlutterMetalCompositor(FlutterViewController* view_controller) + : FlutterCompositor(view_controller) {} + +bool FlutterMetalCompositor::CreateBackingStore(const FlutterBackingStoreConfig* config, + FlutterBackingStore* backing_store_out) { + FML_CHECK(false) << "Not implemented, see issue: https://github.com/flutter/flutter/issues/81320"; + return false; +} +bool FlutterMetalCompositor::CollectBackingStore(const FlutterBackingStore* backing_store) { + FML_CHECK(false) << "Not implemented, see issue: https://github.com/flutter/flutter/issues/81320"; + return false; +} + +bool FlutterMetalCompositor::Present(const FlutterLayer** layers, size_t layers_count) { + FML_CHECK(false) << "Not implemented, see issue: https://github.com/flutter/flutter/issues/81320"; + return false; +} + +} // namespace flutter -- GitLab