Skip to content

Update component runtime to pick up any one of the couroutine dispatcher interface #5300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 6, 2023

Conversation

VinayGuthal
Copy link
Contributor

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

Release note changes

The following had changelogs that were modified, but did not have any unreleased entries for release notes to generate from.

Changelogs

firebase-components

@VinayGuthal VinayGuthal changed the title update component runtime Update component runtime to pick up any one of the couroutine dispatcher interface Sep 6, 2023
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 6, 2023

Coverage Report 1

Affected Products

  • firebase-components

    Overall coverage changed from 55.34% (fe84885) to 55.74% (6b67ec8) by +0.40%.

    FilenameBase (fe84885)Merge (6b67ec8)Diff
    ComponentRuntime.java72.32%71.81%-0.51%
    Qualified.java76.47%88.24%+11.76%

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/4pOG81k54P.html

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

Unit Test Results

  24 files  +  18    24 suites  +18   16s ⏱️ -2s
115 tests +  97  115 ✔️ +  97  0 💤 ±0  0 ±0 
230 runs  +194  230 ✔️ +194  0 💤 ±0  0 ±0 

Results for commit 8a92f99. ± Comparison against base commit fe84885.

This pull request removes 18 and adds 115 tests. Note that renamed tests count towards both.
com.google.firebase.crashlytics.internal.common.CrashlyticsControllerRobolectricTest ‑ testDoCloseSession_disabledAnrs_doesNotPersistsAppExitInfo
com.google.firebase.crashlytics.internal.common.CrashlyticsControllerRobolectricTest ‑ testDoCloseSession_enabledAnrs_doesNotPersistsAppExitInfoIfItDoesntExist
com.google.firebase.crashlytics.internal.common.CrashlyticsControllerRobolectricTest ‑ testDoCloseSession_enabledAnrs_persistsAppExitInfoIfItExists
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_notPersistIfAnrBeforeSession
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_notPersistIfAppExitInfoNotAnrButWithinSession
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_persistIfAnrWithinSession
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testAppExitInfoEvent_persistIfAnrWithinSession_multipleAppExitInfo
com.google.firebase.crashlytics.internal.common.SessionReportingCoordinatorRobolectricTest ‑ testconvertInputStreamToString_worksSuccessfully
com.google.firebase.crashlytics.internal.model.CrashlyticsReportTest ‑ testGetBinaryImageUuidUtf8Bytes_returnsNullWhenUuidIsNull
com.google.firebase.crashlytics.internal.model.CrashlyticsReportTest ‑ testGetBinaryImageUuidUtf8Bytes_returnsProperBytes
…
com.google.firebase.components.ComponentDiscoveryTest ‑ discoverLazy_whenRegistrarClassDoesNotExist_shouldReturnProviderThatReturnsNull
com.google.firebase.components.ComponentDiscoveryTest ‑ discoverLazy_whenRegistrarClassesAreInvalid_shouldReturnThrowingProviders
com.google.firebase.components.ComponentDiscoveryTest ‑ discover_shouldCorrectlyInstantiateValidComponentRegistrars
com.google.firebase.components.ComponentDiscoveryTest ‑ discover_shouldSkipClassesThatDontImplementComponentRegistrarInterface
com.google.firebase.components.ComponentDiscoveryTest ‑ discover_shouldSkipClassesWithNoDefaultConstructors
com.google.firebase.components.ComponentDiscoveryTest ‑ discover_shouldSkipNonExistentClasses
com.google.firebase.components.ComponentDiscoveryTest ‑ discover_shouldSkipPrivateClasses
com.google.firebase.components.ComponentRuntimeTest ‑ container_shouldExposeAllProvidedInterfacesOfAComponent
com.google.firebase.components.ComponentRuntimeTest ‑ container_shouldExposeAllRegisteredSetValues
com.google.firebase.components.ComponentRuntimeTest ‑ container_withComponentProcessor_shouldDelegateToItForEachComponentRegistrar
…

♻️ This comment has been updated with latest results.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 6, 2023

Size Report 1

Affected Products

  • firebase-components

    TypeBase (fe84885)Merge (6b67ec8)Diff
    aar45.1 kB45.5 kB+368 B (+0.8%)
    apk (release)596 kB596 kB+4 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/qq5eehm7Wb.html

@@ -107,6 +108,8 @@ private void discoverComponents(List<Component<?>> componentsToAdd) {
// instead of executing such code in the synchronized block below, we store it in a list and
// execute right after the synchronized section.
List<Runnable> runAfterDiscovery = new ArrayList<>();
List<Component<?>> componentsAdding = new ArrayList<>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one small behavioural change which out of precaution I think we should restore. The current code works as follows

  1. Call discoverComponents with the list of componentsToAdd
  2. During execution, we process pending providers, and modify componentsToAdd
  3. We ensure the list is ok using the CycleDetector
  4. Do what needs to be done with the components

This change no longer updates componentsToAdd to include what is actually going to be processed.

. In the current version, we get as parameter componentsToAdd which is the list of things we have to add

}
}
}
for (int i = 0; i < componentsToAdd.size(); i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any idea how expensive these loops can be? Since this code runs during initialization and, AFAIR in the main thread, any extra work will impact start up for all apps.

An alternative would be to set a class field boolean that works as a flag of whether we have seen the dispatcher before. Then, we would only need to loop once, and we wouldn't need to create an additional list and copy over every component (componentsAdding) nor the list of interfaces already seen (existingInterfaces)

WDYT?

@rlazo
Copy link
Collaborator

rlazo commented Sep 6, 2023

Unit Test Results

  24 files  +  18    24 suites  +18   16s ⏱️ -2s 115 tests +  97  115 ✔️ +  97  0 💤 ±0  0 ±0  230 runs  +194  230 ✔️ +194  0 💤 ±0  0 ±0 

Results for commit e6481e2. ± Comparison against base commit fe84885.

This pull request removes 18 and adds 115 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results.

@VinayGuthal the "This pull request removes 18 and adds 115 tests. Note that renamed tests count towards both." sounds wrong, any ideas?

@rlazo
Copy link
Collaborator

rlazo commented Sep 6, 2023

@VinayGuthal VinayGuthal enabled auto-merge (squash) September 6, 2023 19:57
@VinayGuthal VinayGuthal disabled auto-merge September 6, 2023 20:09
@VinayGuthal VinayGuthal merged commit b7a34fb into master Sep 6, 2023
@VinayGuthal VinayGuthal deleted the component_update branch September 6, 2023 20:09
@firebase firebase locked and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants