Skip to content

Commit

Permalink
[engine] Sync Flutter 3.24.1 source code
Browse files Browse the repository at this point in the history
  • Loading branch information
JSUYA committed Aug 27, 2024
1 parent ee1afba commit 6d8869d
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 60 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ deps = {
'src/third_party/rapidjson': 'https://fuchsia.googlesource.com/third_party/rapidjson@ef3564c5c8824989393b87df25355baf35ff544b',
'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@054a986a8513149e8374fc669a5fe40117ca6b41',
'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@1618a775995ef6f862b9f05be61a6a8fc23f2e4d',
'src/third_party/googletest': 'https://github.com/google/googletest@7f036c5563af7d0329f20e8bb42effb04629f0c0',
'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@b9479eb440de7af2c9946931a1ecaabf457b31af',
'src/third_party/clang': {
'packages': [
{
Expand Down
37 changes: 15 additions & 22 deletions build/secondary/third_party/googletest/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@ static_library("gtest") {
public = [
"googletest/include/gtest/gtest-spi.h",
"googletest/include/gtest/gtest.h",
"googletest/include/gtest/gtest_prod.h",
]
sources = [
"googletest/src/gtest-all.cc",
"googletest/src/gtest-death-test.cc",
"googletest/src/gtest-filepath.cc",
"googletest/src/gtest-internal-inl.h",
"googletest/src/gtest-matchers.cc",
"googletest/src/gtest-port.cc",
"googletest/src/gtest-printers.cc",
"googletest/src/gtest-test-part.cc",
"googletest/src/gtest-typed-test.cc",
"googletest/src/gtest.cc",
]
sources -= [ "googletest/src/gtest-all.cc" ]

# Only add the "*-all.cc" files (and no headers) to improve maintainability
# from upstream refactoring. The "*-all.cc" files include the respective
# source files.
sources = [ "googletest/src/gtest-all.cc" ]

public_configs = [ ":gtest_config" ]
configs += [ ":gtest_private_config" ]
}

# Library that defines the FRIEND_TEST macro.
source_set("gtest_prod") {
testonly = false
public = [ "googletest/include/gtest/gtest_prod.h" ]
public_configs = [ ":gtest_config" ]
}

static_library("gtest_main") {
testonly = true
sources = [ "googletest/src/gtest_main.cc" ]
Expand Down Expand Up @@ -61,15 +62,7 @@ config("gmock_config") {
static_library("gmock") {
testonly = true
public = [ "googlemock/include/gmock/gmock.h" ]
sources = [
"googlemock/src/gmock-all.cc",
"googlemock/src/gmock-cardinalities.cc",
"googlemock/src/gmock-internal-utils.cc",
"googlemock/src/gmock-matchers.cc",
"googlemock/src/gmock-spec-builders.cc",
"googlemock/src/gmock.cc",
]
sources -= [ "googlemock/src/gmock-all.cc" ]
sources = [ "googlemock/src/gmock-all.cc" ]
public_configs = [ ":gmock_config" ]
configs += [ ":gmock_private_config" ]
deps = [ ":gtest" ]
Expand Down
194 changes: 158 additions & 36 deletions flutter/shell/platform/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ typedef enum {
kFlutterSemanticsActionMoveCursorBackwardByWord = 1 << 20,
/// Replace the current text in the text field.
kFlutterSemanticsActionSetText = 1 << 21,
/// Request that the respective focusable widget gain input focus.
kFlutterSemanticsActionFocus = 1 << 22,
} FlutterSemanticsAction;

/// The set of properties that may be associated with a semantics node.
Expand Down Expand Up @@ -844,6 +846,86 @@ typedef struct {
};
} FlutterRendererConfig;

/// Display refers to a graphics hardware system consisting of a framebuffer,
/// typically a monitor or a screen. This ID is unique per display and is
/// stable until the Flutter application restarts.
typedef uint64_t FlutterEngineDisplayId;

typedef struct {
/// The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
size_t struct_size;
/// Physical width of the window.
size_t width;
/// Physical height of the window.
size_t height;
/// Scale factor for the physical screen.
double pixel_ratio;
/// Horizontal physical location of the left side of the window on the screen.
size_t left;
/// Vertical physical location of the top of the window on the screen.
size_t top;
/// Top inset of window.
double physical_view_inset_top;
/// Right inset of window.
double physical_view_inset_right;
/// Bottom inset of window.
double physical_view_inset_bottom;
/// Left inset of window.
double physical_view_inset_left;
/// The identifier of the display the view is rendering on.
FlutterEngineDisplayId display_id;
/// The view that this event is describing.
int64_t view_id;
} FlutterWindowMetricsEvent;

typedef struct {
/// The size of this struct.
/// Must be sizeof(FlutterAddViewResult).
size_t struct_size;

/// True if the add view operation succeeded.
bool added;

/// The |FlutterAddViewInfo.user_data|.
void* user_data;
} FlutterAddViewResult;

/// The callback invoked by the engine when the engine has attempted to add a
/// view.
///
/// The |FlutterAddViewResult| is only guaranteed to be valid during this
/// callback.
typedef void (*FlutterAddViewCallback)(const FlutterAddViewResult* result);

typedef struct {
/// The size of this struct.
/// Must be sizeof(FlutterAddViewInfo).
size_t struct_size;

/// The identifier for the view to add. This must be unique.
FlutterViewId view_id;

/// The view's properties.
///
/// The metric's |view_id| must match this struct's |view_id|.
const FlutterWindowMetricsEvent* view_metrics;

/// A baton that is not interpreted by the engine in any way. It will be given
/// back to the embedder in |add_view_callback|. Embedder resources may be
/// associated with this baton.
void* user_data;

/// Called once the engine has attempted to add the view. This callback is
/// required.
///
/// The embedder/app must not use the view until the callback is invoked with
/// an `added` value of `true`.
///
/// This callback is invoked on an internal engine managed thread. Embedders
/// must re-thread if necessary.
FlutterAddViewCallback add_view_callback;
} FlutterAddViewInfo;

typedef struct {
/// The size of this struct.
/// Must be sizeof(FlutterRemoveViewResult).
Expand All @@ -859,7 +941,8 @@ typedef struct {
/// The callback invoked by the engine when the engine has attempted to remove
/// a view.
///
/// The |FlutterRemoveViewResult| will be deallocated once the callback returns.
/// The |FlutterRemoveViewResult| is only guaranteed to be valid during this
/// callback.
typedef void (*FlutterRemoveViewCallback)(
const FlutterRemoveViewResult* /* result */);

Expand Down Expand Up @@ -891,38 +974,6 @@ typedef struct {
FlutterRemoveViewCallback remove_view_callback;
} FlutterRemoveViewInfo;

/// Display refers to a graphics hardware system consisting of a framebuffer,
/// typically a monitor or a screen. This ID is unique per display and is
/// stable until the Flutter application restarts.
typedef uint64_t FlutterEngineDisplayId;

typedef struct {
/// The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
size_t struct_size;
/// Physical width of the window.
size_t width;
/// Physical height of the window.
size_t height;
/// Scale factor for the physical screen.
double pixel_ratio;
/// Horizontal physical location of the left side of the window on the screen.
size_t left;
/// Vertical physical location of the top of the window on the screen.
size_t top;
/// Top inset of window.
double physical_view_inset_top;
/// Right inset of window.
double physical_view_inset_right;
/// Bottom inset of window.
double physical_view_inset_bottom;
/// Left inset of window.
double physical_view_inset_left;
/// The identifier of the display the view is rendering on.
FlutterEngineDisplayId display_id;
/// The view that this event is describing.
int64_t view_id;
} FlutterWindowMetricsEvent;

/// The phase of the pointer event.
typedef enum {
kCancel,
Expand Down Expand Up @@ -1744,6 +1795,9 @@ typedef struct {
size_t struct_size;
/// The size of the render target the engine expects to render into.
FlutterSize size;
/// The identifier for the view that the engine will use this backing store to
/// render into.
FlutterViewId view_id;
} FlutterBackingStoreConfig;

typedef enum {
Expand Down Expand Up @@ -1857,18 +1911,26 @@ typedef struct {
/// `FlutterBackingStore::struct_size` when specifying a new backing store to
/// the engine. This only matters if the embedder expects to be used with
/// engines older than the version whose headers it used during compilation.
///
/// The callback should return true if the operation was successful.
FlutterBackingStoreCreateCallback create_backing_store_callback;
/// A callback invoked by the engine to release the backing store. The
/// embedder may collect any resources associated with the backing store.
///
/// The callback should return true if the operation was successful.
FlutterBackingStoreCollectCallback collect_backing_store_callback;
/// Callback invoked by the engine to composite the contents of each layer
/// onto the implicit view.
///
/// DEPRECATED: Use |present_view_callback| to support multiple views.
/// DEPRECATED: Use `present_view_callback` to support multiple views.
/// If this callback is provided, `FlutterEngineAddView` and
/// `FlutterEngineRemoveView` should not be used.
///
/// Only one of `present_layers_callback` and `present_view_callback` may be
/// provided. Providing both is an error and engine initialization will
/// terminate.
///
/// The callback should return true if the operation was successful.
FlutterLayersPresentCallback present_layers_callback;
/// Avoid caching backing stores provided by this compositor.
bool avoid_backing_store_cache;
Expand All @@ -1878,6 +1940,8 @@ typedef struct {
/// Only one of `present_layers_callback` and `present_view_callback` may be
/// provided. Providing both is an error and engine initialization will
/// terminate.
///
/// The callback should return true if the operation was successful.
FlutterPresentViewCallback present_view_callback;
} FlutterCompositor;

Expand Down Expand Up @@ -2188,6 +2252,10 @@ typedef struct {
/// `update_semantics_callback`, and
/// `update_semantics_callback2` may be provided; the others
/// should be set to null.
///
/// This callback is incompatible with multiple views. If this
/// callback is provided, `FlutterEngineAddView` and
/// `FlutterEngineRemoveView` should not be used.
FlutterUpdateSemanticsNodeCallback update_semantics_node_callback;
/// The legacy callback invoked by the engine in order to give the embedder
/// the chance to respond to updates to semantics custom actions from the Dart
Expand All @@ -2204,6 +2272,10 @@ typedef struct {
/// `update_semantics_callback`, and
/// `update_semantics_callback2` may be provided; the others
/// should be set to null.
///
/// This callback is incompatible with multiple views. If this
/// callback is provided, `FlutterEngineAddView` and
/// `FlutterEngineRemoveView` should not be used.
FlutterUpdateSemanticsCustomActionCallback
update_semantics_custom_action_callback;
/// Path to a directory used to store data that is cached across runs of a
Expand Down Expand Up @@ -2353,6 +2425,10 @@ typedef struct {
/// `update_semantics_callback`, and
/// `update_semantics_callback2` may be provided; the others
/// must be set to null.
///
/// This callback is incompatible with multiple views. If this
/// callback is provided, `FlutterEngineAddView` and
/// `FlutterEngineRemoveView` should not be used.
FlutterUpdateSemanticsCallback update_semantics_callback;

/// The callback invoked by the engine in order to give the embedder the
Expand Down Expand Up @@ -2518,12 +2594,50 @@ FLUTTER_EXPORT
FlutterEngineResult FlutterEngineRunInitialized(
FLUTTER_API_SYMBOL(FlutterEngine) engine);

//------------------------------------------------------------------------------
/// @brief Adds a view.
///
/// This is an asynchronous operation. The view should not be used
/// until the |info.add_view_callback| is invoked with an |added|
/// value of true. The embedder should prepare resources in advance
/// but be ready to clean up on failure.
///
/// A frame is scheduled if the operation succeeds.
///
/// The callback is invoked on a thread managed by the engine. The
/// embedder should re-thread if needed.
///
/// Attempting to add the implicit view will fail and will return
/// kInvalidArguments. Attempting to add a view with an already
/// existing view ID will fail, and |info.add_view_callback| will be
/// invoked with an |added| value of false.
///
/// @param[in] engine A running engine instance.
/// @param[in] info The add view arguments. This can be deallocated
/// once |FlutterEngineAddView| returns, before
/// |add_view_callback| is invoked.
///
/// @return The result of *starting* the asynchronous operation. If
/// `kSuccess`, the |add_view_callback| will be invoked.
FLUTTER_EXPORT
FlutterEngineResult FlutterEngineAddView(FLUTTER_API_SYMBOL(FlutterEngine)
engine,
const FlutterAddViewInfo* info);

//------------------------------------------------------------------------------
/// @brief Removes a view.
///
/// This is an asynchronous operation. The view's resources must not
/// be cleaned up until the |remove_view_callback| is invoked with
/// a |removed| value of `true`.
/// be cleaned up until |info.remove_view_callback| is invoked with
/// a |removed| value of true.
///
/// The callback is invoked on a thread managed by the engine. The
/// embedder should re-thread if needed.
///
/// Attempting to remove the implicit view will fail and will return
/// kInvalidArguments. Attempting to remove a view with a
/// non-existent view ID will fail, and |info.remove_view_callback|
/// will be invoked with a |removed| value of false.
///
/// @param[in] engine A running engine instance.
/// @param[in] info The remove view arguments. This can be deallocated
Expand Down Expand Up @@ -3207,6 +3321,12 @@ typedef FlutterEngineResult (*FlutterEngineSetNextFrameCallbackFnPtr)(
FLUTTER_API_SYMBOL(FlutterEngine) engine,
VoidCallback callback,
void* user_data);
typedef FlutterEngineResult (*FlutterEngineAddViewFnPtr)(
FLUTTER_API_SYMBOL(FlutterEngine) engine,
const FlutterAddViewInfo* info);
typedef FlutterEngineResult (*FlutterEngineRemoveViewFnPtr)(
FLUTTER_API_SYMBOL(FlutterEngine) engine,
const FlutterRemoveViewInfo* info);

/// Function-pointer-based versions of the APIs above.
typedef struct {
Expand Down Expand Up @@ -3253,6 +3373,8 @@ typedef struct {
FlutterEngineNotifyDisplayUpdateFnPtr NotifyDisplayUpdate;
FlutterEngineScheduleFrameFnPtr ScheduleFrame;
FlutterEngineSetNextFrameCallbackFnPtr SetNextFrameCallback;
FlutterEngineAddViewFnPtr AddView;
FlutterEngineRemoveViewFnPtr RemoveView;
} FlutterEngineProcTable;

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 6d8869d

Please sign in to comment.