Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Windows] Fix incorrect public C API argument type #35106

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented Aug 2, 2022

FlutterDesktopEngineGetTextureRegistrar is used to get the texture
registrar associated with an engine object and therefore should take a
FlutterDesktopEngineRef parameter.

This bug was initially identified and fixed by @knopp in:
#27522

This patch replaces that one and adds the simplest possible unit test to
get it landed.

This also adds an initial unit test for the public Windows C API used to
implement the C++ client wrapper. In order to fully test this API, we'll
want to support test fixtures similar to what we do in the embedder API
tests. See: flutter/flutter#87299

Fixes: flutter/flutter#86617

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@cbracken cbracken force-pushed the fix-argument-type branch from 1cfa86c to 273f66d Compare August 2, 2022 22:23
FlutterDesktopEngineGetTextureRegistrar is used to get the texture
registrar associated with an engine object and therefore should take a
FlutterDesktopEngineRef parameter.

This bug was initially identified and fixed by @knopp in:
flutter#27522

This patch replaces that one and adds the simplest possible unit test to
get it landed.

This also adds an initial unit test for the public Windows C API used to
implement the C++ client wrapper. In order to fully test this API, we'll
want to support test fixtures similar to what we do in the embedder API
tests. See: flutter/flutter#87299

Fixes: flutter/flutter#86617
@cbracken cbracken force-pushed the fix-argument-type branch from 273f66d to ef8772f Compare August 2, 2022 22:39
@cbracken cbracken merged commit ccf6cee into flutter:main Aug 3, 2022
@cbracken cbracken deleted the fix-argument-type branch August 3, 2022 00:09
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 3, 2022
cbracken added a commit to cbracken/flutter_engine that referenced this pull request Aug 3, 2022
flutter_windows_unittests.cc had its tests inside the flutter namespace
rather than the flutter:testing namespace. This adds the missing
namespace and makes one namespace-related cleanup in one of the key
event unit tests as well.

This is a post-landing cleanup for PR:
flutter#35106

Issue: flutter/flutter#86617
cbracken added a commit that referenced this pull request Aug 3, 2022
flutter_windows_unittests.cc had its tests inside the flutter namespace
rather than the flutter:testing namespace. This adds the missing
namespace and makes one namespace-related cleanup in one of the key
event unit tests as well.

This is a post-landing cleanup for PR:
#35106

Issue: flutter/flutter#86617
betrevisan pushed a commit to betrevisan/engine that referenced this pull request Aug 5, 2022
FlutterDesktopEngineGetTextureRegistrar is used to get the texture
registrar associated with an engine object and therefore should take a
FlutterDesktopEngineRef parameter.

This bug was initially identified and fixed by @knopp in:
flutter#27522

This patch replaces that one and adds the simplest possible unit test to
get it landed.

This also adds an initial unit test for the public Windows C API used to
implement the C++ client wrapper. In order to fully test this API, we'll
want to support test fixtures similar to what we do in the embedder API
tests. See: flutter/flutter#87299

Fixes: flutter/flutter#86617
betrevisan pushed a commit to betrevisan/engine that referenced this pull request Aug 5, 2022
flutter_windows_unittests.cc had its tests inside the flutter namespace
rather than the flutter:testing namespace. This adds the missing
namespace and makes one namespace-related cleanup in one of the key
event unit tests as well.

This is a post-landing cleanup for PR:
flutter#35106

Issue: flutter/flutter#86617
cbracken added a commit to cbracken/flutter_engine that referenced this pull request Aug 8, 2022
In flutter#35106, I landed a parameter type fix for the
declaration of FlutterDesktopEngineGetTextureRegistrar in our public
Windows C API. I also added a unit test that called this function.

That function (and all others) in our public Windows API is marked
FLUTTER_EXPORT, which resolves to __declspec(dllexport) or
__declspec(dllimport) depending on whether FLUTTER_DESKTOP_LIBRARY is
defined. It can be defined by adding the following build config:
//flutter/shell/platform/common:desktop_library_implementation

If the function is marked as an import, we get linker warnings that
we're importing a function that's defined in the same executable image.
This patch resolves this by marking the functions as export.

An alternative fix would be to support a third macro resolution that
resolves to nothing in the presence of some definition like
FLUTTER_NO_EXPORT; however, since flutter_export.h is a public header,
I'd prefer not to complicate it further.

See: https://github.com/flutter/engine/blob/main/shell/platform/common/public/flutter_export.h
See: https://github.com/flutter/engine/blob/a51c7638e702b086dffaae3ce92f52130a2c23ff/shell/platform/common/BUILD.gn#L8-L10
cbracken added a commit to cbracken/flutter_engine that referenced this pull request Aug 8, 2022
In flutter#35106, I landed a parameter type fix for the
declaration of FlutterDesktopEngineGetTextureRegistrar in our public
Windows C API. I also added a unit test that called this function.

That function (and all others) in our public Windows API is marked
FLUTTER_EXPORT, which resolves to __declspec(dllexport) or
__declspec(dllimport) depending on whether FLUTTER_DESKTOP_LIBRARY is
defined. It can be defined by adding the following build config:
//flutter/shell/platform/common:desktop_library_implementation

If the function is marked as an import, we get linker warnings that
we're importing a function that's defined in the same executable image.
This patch resolves this by marking the functions as export.

An alternative fix would be to support a third macro resolution that
resolves to nothing in the presence of some definition like
FLUTTER_NO_EXPORT; however, since flutter_export.h is a public header,
I'd prefer not to complicate it further.

See: https://github.com/flutter/engine/blob/main/shell/platform/common/public/flutter_export.h
See: https://github.com/flutter/engine/blob/a51c7638e702b086dffaae3ce92f52130a2c23ff/shell/platform/common/BUILD.gn#L8-L10
cbracken added a commit that referenced this pull request Aug 9, 2022
In #35106, I landed a parameter type fix for the
declaration of FlutterDesktopEngineGetTextureRegistrar in our public
Windows C API. I also added a unit test that called this function.

That function (and all others) in our public Windows API is marked
FLUTTER_EXPORT, which resolves to __declspec(dllexport) or
__declspec(dllimport) depending on whether FLUTTER_DESKTOP_LIBRARY is
defined. It can be defined by adding the following build config:
//flutter/shell/platform/common:desktop_library_implementation

If the function is marked as an import, we get linker warnings that
we're importing a function that's defined in the same executable image.
This patch resolves this by marking the functions as export.

An alternative fix would be to support a third macro resolution that
resolves to nothing in the presence of some definition like
FLUTTER_NO_EXPORT; however, since flutter_export.h is a public header,
I'd prefer not to complicate it further, and this is a unit test that
can't be linked against either way.

Issue: flutter/flutter#109184
Original issue: flutter/flutter#86617

See: https://github.com/flutter/engine/blob/main/shell/platform/common/public/flutter_export.h
See: https://github.com/flutter/engine/blob/a51c7638e702b086dffaae3ce92f52130a2c23ff/shell/platform/common/BUILD.gn#L8-L10

No new tests since this simply fixes a link warning message in unit tests.
emilyabest pushed a commit to emilyabest/engine that referenced this pull request Aug 12, 2022
FlutterDesktopEngineGetTextureRegistrar is used to get the texture
registrar associated with an engine object and therefore should take a
FlutterDesktopEngineRef parameter.

This bug was initially identified and fixed by @knopp in:
flutter#27522

This patch replaces that one and adds the simplest possible unit test to
get it landed.

This also adds an initial unit test for the public Windows C API used to
implement the C++ client wrapper. In order to fully test this API, we'll
want to support test fixtures similar to what we do in the embedder API
tests. See: flutter/flutter#87299

Fixes: flutter/flutter#86617
emilyabest pushed a commit to emilyabest/engine that referenced this pull request Aug 12, 2022
flutter_windows_unittests.cc had its tests inside the flutter namespace
rather than the flutter:testing namespace. This adds the missing
namespace and makes one namespace-related cleanup in one of the key
event unit tests as well.

This is a post-landing cleanup for PR:
flutter#35106

Issue: flutter/flutter#86617
emilyabest pushed a commit to emilyabest/engine that referenced this pull request Aug 12, 2022
In flutter#35106, I landed a parameter type fix for the
declaration of FlutterDesktopEngineGetTextureRegistrar in our public
Windows C API. I also added a unit test that called this function.

That function (and all others) in our public Windows API is marked
FLUTTER_EXPORT, which resolves to __declspec(dllexport) or
__declspec(dllimport) depending on whether FLUTTER_DESKTOP_LIBRARY is
defined. It can be defined by adding the following build config:
//flutter/shell/platform/common:desktop_library_implementation

If the function is marked as an import, we get linker warnings that
we're importing a function that's defined in the same executable image.
This patch resolves this by marking the functions as export.

An alternative fix would be to support a third macro resolution that
resolves to nothing in the presence of some definition like
FLUTTER_NO_EXPORT; however, since flutter_export.h is a public header,
I'd prefer not to complicate it further, and this is a unit test that
can't be linked against either way.

Issue: flutter/flutter#109184
Original issue: flutter/flutter#86617

See: https://github.com/flutter/engine/blob/main/shell/platform/common/public/flutter_export.h
See: https://github.com/flutter/engine/blob/a51c7638e702b086dffaae3ce92f52130a2c23ff/shell/platform/common/BUILD.gn#L8-L10

No new tests since this simply fixes a link warning message in unit tests.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FlutterDesktopEngineGetTextureRegistrar declaration has invalid argument
2 participants