From 9961f99c0b88ae875f6c7ca76d24211672784915 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Mon, 23 Dec 2024 13:45:26 +0900 Subject: [PATCH] [engine] Sync Flutter 3.27.1 source code (#77) --- DEPS | 4 +- .../common/public/flutter_messenger.h | 8 +- flutter/shell/platform/embedder/embedder.h | 79 +++++++++++++++++-- .../platform/tizen/public/flutter_tizen.h | 8 +- 4 files changed, 84 insertions(+), 15 deletions(-) diff --git a/DEPS b/DEPS index b6c2dcc..20956ab 100644 --- a/DEPS +++ b/DEPS @@ -7,12 +7,12 @@ deps = { 'src/third_party/libcxx': 'https://llvm.googlesource.com/llvm-project/libcxx@44079a4cc04cdeffb9cfe8067bfb3c276fb2bab0', 'src/third_party/libcxxabi': 'https://llvm.googlesource.com/llvm-project/libcxxabi@2ce528fb5e0f92e57c97ec3ff53b75359d33af12', 'src/third_party/googletest': 'https://github.com/google/googletest@7f036c5563af7d0329f20e8bb42effb04629f0c0', - 'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@b9479eb440de7af2c9946931a1ecaabf457b31af', + 'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@ae7ca5199a0559db0ae60533e9cedd3ce0d6ab04', 'src/third_party/clang': { 'packages': [ { 'package': 'fuchsia/third_party/clang/linux-amd64', - 'version': 'git_revision:20d06c833d833ef6b2d0f519cc4a7998d49a2803' + 'version': 'git_revision:725656bdd885483c39f482a01ea25d67acf39c46' } ], 'dep_type': 'cipd', diff --git a/flutter/shell/platform/common/public/flutter_messenger.h b/flutter/shell/platform/common/public/flutter_messenger.h index b364a57..ddf800a 100644 --- a/flutter/shell/platform/common/public/flutter_messenger.h +++ b/flutter/shell/platform/common/public/flutter_messenger.h @@ -95,8 +95,8 @@ FLUTTER_EXPORT void FlutterDesktopMessengerSetCallback( // Operation is thread-safe. // // See also: |FlutterDesktopMessengerRelease| -FLUTTER_EXPORT FlutterDesktopMessengerRef -FlutterDesktopMessengerAddRef(FlutterDesktopMessengerRef messenger); +FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef( + FlutterDesktopMessengerRef messenger); // Decrements the reference count for the |messenger|. // @@ -126,8 +126,8 @@ FLUTTER_EXPORT bool FlutterDesktopMessengerIsAvailable( // Returns the |messenger| value. // // See also: |FlutterDesktopMessengerUnlock| -FLUTTER_EXPORT FlutterDesktopMessengerRef -FlutterDesktopMessengerLock(FlutterDesktopMessengerRef messenger); +FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopMessengerLock( + FlutterDesktopMessengerRef messenger); // Unlocks the `FlutterDesktopMessengerRef`. // diff --git a/flutter/shell/platform/embedder/embedder.h b/flutter/shell/platform/embedder/embedder.h index ad54c63..7001925 100644 --- a/flutter/shell/platform/embedder/embedder.h +++ b/flutter/shell/platform/embedder/embedder.h @@ -305,6 +305,9 @@ typedef enum { /// Specifies an OpenGL frame-buffer target type. Framebuffers are specified /// using the FlutterOpenGLFramebuffer struct. kFlutterOpenGLTargetTypeFramebuffer, + /// Specifies an OpenGL on-screen surface target type. Surfaces are specified + /// using the FlutterOpenGLSurface struct. + kFlutterOpenGLTargetTypeSurface, } FlutterOpenGLTargetType; /// A pixel format to be used for software rendering. @@ -401,9 +404,14 @@ typedef struct { } FlutterOpenGLTexture; typedef struct { - /// The target of the color attachment of the frame-buffer. For example, - /// GL_TEXTURE_2D or GL_RENDERBUFFER. In case of ambiguity when dealing with - /// Window bound frame-buffers, 0 may be used. + /// The format of the color attachment of the frame-buffer. For example, + /// GL_RGBA8. + /// + /// In case of ambiguity when dealing with Window bound frame-buffers, 0 may + /// be used. + /// + /// @bug This field is incorrectly named as "target" when it actually + /// refers to a format. uint32_t target; /// The name of the framebuffer. @@ -417,6 +425,62 @@ typedef struct { VoidCallback destruction_callback; } FlutterOpenGLFramebuffer; +typedef bool (*FlutterOpenGLSurfaceCallback)(void* /* user data */, + bool* /* opengl state changed */); + +typedef struct { + /// The size of this struct. Must be sizeof(FlutterOpenGLSurface). + size_t struct_size; + + /// User data to be passed to the make_current, clear_current and + /// destruction callbacks. + void* user_data; + + /// Callback invoked (on an engine-managed thread) that asks the embedder to + /// make the surface current. + /// + /// Should return true if the operation succeeded, false if the surface could + /// not be made current and rendering should be cancelled. + /// + /// The second parameter 'opengl state changed' should be set to true if + /// any OpenGL API state is different than before this callback was called. + /// In that case, Flutter will invalidate the internal OpenGL API state cache, + /// which is a somewhat expensive operation. + /// + /// @attention required. (non-null) + FlutterOpenGLSurfaceCallback make_current_callback; + + /// Callback invoked (on an engine-managed thread) when the current surface + /// can be cleared. + /// + /// Should return true if the operation succeeded, false if an error ocurred. + /// That error will be logged but otherwise not handled by the engine. + /// + /// The second parameter 'opengl state changed' is the same as with the + /// @ref make_current_callback. + /// + /// The embedder might clear the surface here after it was previously made + /// current. That's not required however, it's also possible to clear it in + /// the destruction callback. There's no way to signal OpenGL state + /// changes in the destruction callback though. + /// + /// @attention required. (non-null) + FlutterOpenGLSurfaceCallback clear_current_callback; + + /// Callback invoked (on an engine-managed thread) that asks the embedder to + /// collect the surface. + /// + /// @attention required. (non-null) + VoidCallback destruction_callback; + + /// The surface format. + /// + /// Allowed values: + /// - GL_RGBA8 + /// - GL_BGRA8_EXT + uint32_t format; +} FlutterOpenGLSurface; + typedef FlutterTransformation (*TransformationCallback)(void* /* user data */); typedef uint32_t (*UIntCallback)(void* /* user data */); typedef bool (*SoftwareSurfacePresentCallback)(void* /* user data */, @@ -1546,7 +1610,7 @@ typedef void (*FlutterUpdateSemanticsCallback2)( /// An update to whether a message channel has a listener set or not. typedef struct { - // The size of the struct. Must be sizeof(FlutterChannelUpdate). + /// The size of the struct. Must be sizeof(FlutterChannelUpdate). size_t struct_size; /// The name of the channel. const char* channel; @@ -1627,6 +1691,9 @@ typedef struct { /// A framebuffer for Flutter to render into. The embedder must ensure that /// the framebuffer is complete. FlutterOpenGLFramebuffer framebuffer; + /// A surface for Flutter to render into. Basically a wrapper around + /// a closure that'll be called when the surface should be made current. + FlutterOpenGLSurface surface; }; } FlutterOpenGLBackingStore; @@ -1648,6 +1715,7 @@ typedef struct { } FlutterSoftwareBackingStore; typedef struct { + /// The size of this struct. Must be sizeof(FlutterSoftwareBackingStore2). size_t struct_size; /// A pointer to the raw bytes of the allocation described by this software /// backing store. @@ -1821,6 +1889,7 @@ typedef struct { /// Contains additional information about the backing store provided /// during presentation to the embedder. typedef struct { + /// The size of this struct. Must be sizeof(FlutterBackingStorePresentInfo). size_t struct_size; /// The area of the backing store that contains Flutter contents. Pixels @@ -1982,7 +2051,7 @@ typedef const FlutterLocale* (*FlutterComputePlatformResolvedLocaleCallback)( size_t /* Number of locales*/); typedef struct { - /// This size of this struct. Must be sizeof(FlutterDisplay). + /// The size of this struct. Must be sizeof(FlutterEngineDisplay). size_t struct_size; FlutterEngineDisplayId display_id; diff --git a/flutter/shell/platform/tizen/public/flutter_tizen.h b/flutter/shell/platform/tizen/public/flutter_tizen.h index a516ae0..e51016a 100644 --- a/flutter/shell/platform/tizen/public/flutter_tizen.h +++ b/flutter/shell/platform/tizen/public/flutter_tizen.h @@ -126,8 +126,8 @@ FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine, const char* plugin_name); // Returns the messenger associated with the engine. -FLUTTER_EXPORT FlutterDesktopMessengerRef -FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine); +FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger( + FlutterDesktopEngineRef engine); // Posts an app control to the engine instance. FLUTTER_EXPORT void FlutterDesktopEngineNotifyAppControl( @@ -205,8 +205,8 @@ FLUTTER_EXPORT void* FlutterDesktopViewGetNativeHandle( FlutterDesktopViewRef view); // Returns the resource id of current window. -FLUTTER_EXPORT uint32_t -FlutterDesktopViewGetResourceId(FlutterDesktopViewRef view); +FLUTTER_EXPORT uint32_t FlutterDesktopViewGetResourceId( + FlutterDesktopViewRef view); // Resizes the view. // @warning This API is a work-in-progress and may change.