From 5ddf797512ee2dfd4701ee03b6a8b09b9b857b0b Mon Sep 17 00:00:00 2001 From: Alex Ilin Date: Wed, 15 Dec 2021 09:26:08 +0000 Subject: [PATCH 001/133] [signin] Extend expiring histograms This CL extends the expiry date for the following histograms: - Signin.Extensions.GaiaRemoteConsentFlowResult by 3 months because we are planning to experiment with chrome.identity API soon - Signin.OAuth2MintToken.ApiCallResult by 6 months because this histogram is generally useful to monitor mint token API health Fixed: 1265522, 1277108 Change-Id: Iecab259099b20eda1d35042ad194a8709f1f050a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3339971 Auto-Submit: Alex Ilin Reviewed-by: Mihai Sardarescu Commit-Queue: Mihai Sardarescu Cr-Commit-Position: refs/heads/main@{#951865} --- tools/metrics/histograms/metadata/signin/histograms.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/metrics/histograms/metadata/signin/histograms.xml b/tools/metrics/histograms/metadata/signin/histograms.xml index ee6008834a6782..0cdcca9a596295 100644 --- a/tools/metrics/histograms/metadata/signin/histograms.xml +++ b/tools/metrics/histograms/metadata/signin/histograms.xml @@ -509,7 +509,7 @@ prefs when the profile is loaded. --> + enum="GaiaRemoteConsentFlowResult" expires_after="2022-03-12"> alexilin@chromium.org droger@chromium.org @@ -964,7 +964,7 @@ the browser and content area. --> + enum="OAuth2MintTokenApiCallResult" expires_after="2022-06-12"> alexilin@chromium.org droger@chromium.org From 4047ab65fc308bae476d7d2e2290fd928a3035e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebel?= Date: Wed, 15 Dec 2021 09:31:52 +0000 Subject: [PATCH 002/133] [iOS] Fix TableCellCatalogViewController MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix DCHECK when scrolling through TableCellCatalogViewController. Change-Id: Ifce1ffdfdb5bb42fb1f0cb6675d7cb728fbf653c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338360 Reviewed-by: Gauthier Ambard Auto-Submit: Jérôme Lebel Commit-Queue: Jérôme Lebel Cr-Commit-Position: refs/heads/main@{#951866} --- .../browser/ui/settings/table_cell_catalog_view_controller.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm index 3792632314fa77..a51c940ce2b63d 100644 --- a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm +++ b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm @@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.h" #include "base/mac/foundation_util.h" +#import "ios/chrome/browser/net/crurl.h" #import "ios/chrome/browser/signin/constants.h" #import "ios/chrome/browser/signin/signin_util.h" #import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_configurator.h" @@ -482,6 +483,8 @@ - (void)loadModel { [[TableViewLinkHeaderFooterItem alloc] initWithType:ItemTypeLinkFooter]; linkFooter.text = @"This is a footer text view with a BEGIN_LINKlinkEND_LINK in the middle"; + linkFooter.urls = + @[ [[CrURL alloc] initWithGURL:GURL("http://www.example.com")] ]; [model setFooter:linkFooter forSectionWithIdentifier:SectionIdentifierSettings]; From 35c5646ed67f12a6f6ddb699c2887813600ff1ee Mon Sep 17 00:00:00 2001 From: Florian Gauger Date: Wed, 15 Dec 2021 09:34:10 +0000 Subject: [PATCH 003/133] [Autofill Assistant] Remove dependency on ChromePreferenceKeys We are in the process of moving all Autofill Assistant code to //components. For this we need to remove all dependencies on Chrome code. In the long term moving SharedPreferencesManager out of //chrome might be the best solution but due to time constraints we are removing our preferences from it for now. Bug: b/173103628 Change-Id: I25a5c8b4f89024832e2dcfdf63cac77cc9e11699 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3317417 Auto-Submit: Florian Gauger Reviewed-by: Sandro Maggi Reviewed-by: Maksim Moskvitin Reviewed-by: Henrique Nakashima Commit-Queue: Florian Gauger Cr-Commit-Position: refs/heads/main@{#951867} --- ...ofillAssistantDirectActionHandlerTest.java | 10 +- .../AutofillAssistantFacadeTest.java | 14 +- ...lAssistantHistoryDeletionObserverTest.java | 4 +- ...AssistantTriggerScriptIntegrationTest.java | 20 +- .../InCctTriggeringFromGsaTest.java | 6 +- .../InCctTriggeringFromNonGsaTest.java | 2 +- ...ofillAssistantHistoryDeletionObserver.java | 5 +- .../AutofillAssistantPreferencesUtil.java | 177 ++++++++++-------- .../browser/autofill_assistant/Starter.java | 5 +- .../AutofillAssistantPreferenceFragment.java | 17 +- .../sync/settings/GoogleServicesSettings.java | 15 +- ...tofillAssistantPreferenceFragmentTest.java | 12 +- .../sync/GoogleServicesSettingsTest.java | 6 +- .../preferences/ChromePreferenceKeys.java | 24 --- .../DeprecatedChromePreferenceKeys.java | 6 + .../LegacyChromePreferenceKeys.java | 3 - 16 files changed, 149 insertions(+), 177 deletions(-) diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java index 855238d1376de2..eb6861dc96d21e 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java @@ -39,8 +39,6 @@ import org.chromium.chrome.browser.directactions.DirectActionReporter.Type; import org.chromium.chrome.browser.directactions.FakeDirectActionReporter; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; @@ -57,8 +55,6 @@ public class AutofillAssistantDirectActionHandlerTest { private BottomSheetController mBottomSheetController; private DirectActionHandler mHandler; private TestingAutofillAssistantModuleEntryProvider mModuleEntryProvider; - private final SharedPreferencesManager mSharedPreferencesManager = - SharedPreferencesManager.getInstance(); @Before public void setUp() throws Exception { @@ -75,10 +71,8 @@ public void setUp() throws Exception { mActivity.getCompositorViewHolderForTesting(), mActivity.getActivityTabProvider(), mModuleEntryProvider); - mSharedPreferencesManager.removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED); - mSharedPreferencesManager.removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN); + AutofillAssistantPreferencesUtil.removeOnboardingAcceptedPreference(); + AutofillAssistantPreferencesUtil.removeSkipInitScreenPreference(); } @Test diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java index 8e5fbd03eddea5..326f58d4f52da2 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java @@ -18,8 +18,6 @@ import org.chromium.base.Function; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -67,20 +65,16 @@ public void testEnabled() { public void proactiveHelpConditions() { Assert.assertTrue(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(false); Assert.assertFalse(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, false); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(false); Assert.assertFalse(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); Assert.assertTrue(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); } diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java index c3c02d02b280f0..609a910b85f744 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java @@ -40,7 +40,7 @@ public void setUp() { @Test @SmallTest public void clearFirstTimeUserFlagOnAllTimeHistoryDeletion() { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser(false); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(false); when(mHistoryDeletionInfo.isTimeRangeForAllTime()).thenReturn(true); mHistoryDeletionObserver.onURLsDeleted(mHistoryDeletionInfo); @@ -51,7 +51,7 @@ public void clearFirstTimeUserFlagOnAllTimeHistoryDeletion() { @Test @SmallTest public void doesNotClearFirstTimeUserFlagOnPartialHistoryDeletion() { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser(false); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(false); when(mHistoryDeletionInfo.isTimeRangeForAllTime()).thenReturn(false); mHistoryDeletionObserver.onURLsDeleted(mHistoryDeletionInfo); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java index 9dc63badd51c30..503c2e1ea51d70 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java @@ -62,8 +62,6 @@ import org.chromium.chrome.browser.autofill_assistant.proto.TriggerScriptConditionsProto; import org.chromium.chrome.browser.autofill_assistant.proto.TriggerScriptProto; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -279,8 +277,7 @@ public void elementCondition() throws Exception { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -330,8 +327,7 @@ public void transitionToRegularScriptWithoutOnboarding() throws Exception { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, true); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(true); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -404,15 +400,13 @@ public void dontShowOnboardingIfAcceptedInDifferentTab() { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); // Simulate the user accepting the onboarding in a different tab. - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, true); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(true); ArrayList list = new ArrayList<>(); list.add(ActionProto.newBuilder() @@ -613,8 +607,7 @@ public void onScrollEnded(int scrollOffsetY, int scrollExtentY) { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -675,8 +668,7 @@ public void onScrollEnded(int scrollOffsetY, int scrollExtentY) { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java index 9ff57c016929a2..4ce25deb9406b4 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java @@ -72,7 +72,7 @@ public void setUp() { .putExtra(Browser.EXTRA_APPLICATION_ID, IntentHandler.PACKAGE_GSA)); // Enable MSBB. - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking(() -> { UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled( AutofillAssistantUiController.getProfile(), true); @@ -135,7 +135,7 @@ private GeneratedMessageLite createDefaultTriggerScriptResponse(String statusMes withText("TriggerScript"), isDisplayed(), 2 * DEFAULT_MAX_TIME_TO_POLL); // Disabling the proactive help setting should stop the trigger script. - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(false); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(false); TestThreadUtils.runOnUiThreadBlocking( () -> AutofillAssistantTabHelper @@ -149,7 +149,7 @@ private GeneratedMessageLite createDefaultTriggerScriptResponse(String statusMes // still on a supported URL. testServiceRequestSender.setNextResponse( /* httpStatus = */ 200, createDefaultTriggerScriptResponse("TriggerScript")); - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking( () -> AutofillAssistantTabHelper diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java index d9bba1bed65815..fa09b3c3894c48 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java @@ -51,7 +51,7 @@ private void setupTriggerScripts(GetTriggerScriptsResponseProto triggerScripts) } private void enableMsbb() { - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking(() -> { UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled( AutofillAssistantUiController.getProfile(), true); diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java index baf0255fb3157a..60ff30a4427ada 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java @@ -6,8 +6,6 @@ import org.chromium.chrome.browser.history.HistoryDeletionBridge; import org.chromium.chrome.browser.history.HistoryDeletionInfo; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; /** History deletion observer that clears autofill-assistant flags when necessary. */ public class AutofillAssistantHistoryDeletionObserver implements HistoryDeletionBridge.Observer { @@ -16,7 +14,6 @@ public void onURLsDeleted(HistoryDeletionInfo historyDeletionInfo) { if (!historyDeletionInfo.isTimeRangeForAllTime()) { return; } - SharedPreferencesManager.getInstance().removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER); + AutofillAssistantPreferencesUtil.onClearBrowserHistory(); } } diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java index 7c9f2c305a7d5b..4a59b0bf75e1ef 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java @@ -4,25 +4,35 @@ package org.chromium.chrome.browser.autofill_assistant; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; +import android.content.SharedPreferences; + +import org.chromium.base.ContextUtils; /** Autofill Assistant related preferences util class. */ +// TODO(crbug.com/1069897): Use SharedPreferencesManager again. public class AutofillAssistantPreferencesUtil { + /** Whether Autofill Assistant is enabled */ + private static final String ENABLED_PREFERENCE_KEY = "autofill_assistant_switch"; + /** Whether the Autofill Assistant onboarding has been accepted. */ + private static final String ONBOARDING_ACCEPTED_PREFERENCE_KEY = + "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED"; + /** Whether the user has seen a lite-script before or is a first-time user. */ + private static final String FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY = + "Chrome.AutofillAssistant.LiteScriptFirstTimeUser"; + /** Whether proactive help is enabled. */ + private static final String PROACTIVE_HELP_PREFERENCE_KEY = + "Chrome.AutofillAssistant.ProactiveHelp"; /** - * If a user explicitly cancels a lite script >= this number, they will implicitly opt-out of - * this experience and never see a lite script again. Note: this is only temporarily in place - * until we have a better and more user-friendly solution, see crbug.com/1110887. + * @Deprecated preference indicating whether "do not show again" was checked in the autofill + * assistant onboarding */ - private static final int LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT = 2; - - // Avoid instantiation by accident. - private AutofillAssistantPreferencesUtil() {} + @Deprecated + private static final String SKIP_INIT_SCREEN_PREFERENCE_KEY = + "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN"; /** Checks whether the Autofill Assistant switch preference in settings is on. */ static boolean isAutofillAssistantSwitchOn() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); + return getAssistantEnabledPreference(true); } /** Checks whether proactive help is enabled. */ @@ -40,70 +50,15 @@ private static boolean isProactiveHelpSwitchOn() { return false; } - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); - } - - /** Enables or disables the proactive help setting. */ - public static void setProactiveHelpSwitch(boolean enabled) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, enabled); - } - - /** Returns whether the user has seen a trigger script before or not. */ - public static boolean isAutofillAssistantFirstTimeTriggerScriptUser() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, true); - } - - /** Marks a user as having seen a trigger script at least once before. */ - public static void setAutofillAssistantFirstTimeTriggerScriptUser(boolean firstTimeUser) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, firstTimeUser); - } - - /** Returns the number of times a user has explicitly canceled a lite script. */ - private static int getAutofillAssistantNumberOfLiteScriptsCanceled() { - return SharedPreferencesManager.getInstance().readInt( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, 0); - } - - /** - * Returns whether the user has explicitly canceled the lite script at least {@code - * LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT} times. - */ - public static boolean isAutofillAssistantLiteScriptCancelThresholdReached() { - return getAutofillAssistantNumberOfLiteScriptsCanceled() - >= LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT; - } - - /** Increments the number of times a user has explicitly canceled a lite script. */ - public static void incrementAutofillAssistantNumberOfLiteScriptsCanceled() { - int numCanceled = getAutofillAssistantNumberOfLiteScriptsCanceled() + 1; - SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); - sharedPreferencesManager.writeInt( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, - numCanceled); - if (isAutofillAssistantLiteScriptCancelThresholdReached() - && !sharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED)) { - // Disable the flag, such that users will not see the lite script again. This will also - // create the setting in the Chrome settings, if it was not present before, which will - // allow users to opt back in. - sharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); - } + return getProactiveHelpPreference(true); } /** Checks whether the Autofill Assistant onboarding has been accepted. */ public static boolean isAutofillOnboardingAccepted() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false) - || + return getOnboardingAcceptedPreference(false) || /* Legacy treatment: users of earlier versions should not have to see the onboarding again if they checked the `do not show again' checkbox*/ - SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN, false); + getSkipInitScreenPreference(false); } /** Checks whether the Autofill Assistant onboarding screen should be shown. */ @@ -121,10 +76,86 @@ public static boolean getShowOnboarding() { */ public static void setInitialPreferences(boolean accept) { if (accept) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, accept); + setAssistantEnabledPreference(accept); } - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, accept); + setOnboardingAcceptedPreference(accept); + } + + public static boolean getAssistantEnabledPreference(boolean defaultValue) { + return readBoolean(ENABLED_PREFERENCE_KEY, defaultValue); + } + + public static void setAssistantEnabledPreference(boolean value) { + writeBoolean(ENABLED_PREFERENCE_KEY, value); + } + + public static boolean containsAssistantEnabledPreference() { + return contains(ENABLED_PREFERENCE_KEY); + } + + /* package */ static boolean getOnboardingAcceptedPreference(boolean defaultValue) { + return readBoolean(ONBOARDING_ACCEPTED_PREFERENCE_KEY, defaultValue); + } + + /* package */ static void setOnboardingAcceptedPreference(boolean value) { + writeBoolean(ONBOARDING_ACCEPTED_PREFERENCE_KEY, value); } + + /* package */ static void removeOnboardingAcceptedPreference() { + remove(ONBOARDING_ACCEPTED_PREFERENCE_KEY); + } + + /** Returns whether the user has seen a trigger script before or not. */ + /* package */ static boolean isAutofillAssistantFirstTimeTriggerScriptUser() { + return readBoolean(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY, true); + } + + /** Marks a user as having seen a trigger script at least once before. */ + /* package */ static void setFirstTimeTriggerScriptUserPreference(boolean firstTimeUser) { + writeBoolean(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY, firstTimeUser); + } + + /* package */ static void onClearBrowserHistory() { + remove(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY); + } + + /* package */ static boolean getProactiveHelpPreference(boolean defaultValue) { + return readBoolean(PROACTIVE_HELP_PREFERENCE_KEY, defaultValue); + } + + /** Enables or disables the proactive help setting. */ + /* package */ static void setProactiveHelpPreference(boolean enabled) { + writeBoolean(PROACTIVE_HELP_PREFERENCE_KEY, enabled); + } + + /* package */ static boolean getSkipInitScreenPreference(boolean defaultValue) { + return readBoolean(SKIP_INIT_SCREEN_PREFERENCE_KEY, defaultValue); + } + + /* package */ static void removeSkipInitScreenPreference() { + remove(SKIP_INIT_SCREEN_PREFERENCE_KEY); + } + + private static boolean readBoolean(String key, boolean defaultValue) { + return ContextUtils.getAppSharedPreferences().getBoolean(key, defaultValue); + } + + private static void writeBoolean(String key, boolean value) { + SharedPreferences.Editor ed = ContextUtils.getAppSharedPreferences().edit(); + ed.putBoolean(key, value); + ed.apply(); + } + + private static boolean contains(String key) { + return ContextUtils.getAppSharedPreferences().contains(key); + } + + private static void remove(String key) { + SharedPreferences.Editor ed = ContextUtils.getAppSharedPreferences().edit(); + ed.remove(key); + ed.apply(); + } + + // Avoid instantiation by accident. + private AutofillAssistantPreferencesUtil() {} } diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java index df189628b5c614..096fbe699d6316 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java @@ -218,8 +218,7 @@ private static boolean getIsFirstTimeUser() { @CalledByNative private static void setIsFirstTimeUser(boolean firstTimeUser) { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser( - firstTimeUser); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(firstTimeUser); } @CalledByNative @@ -270,7 +269,7 @@ static boolean getProactiveHelpSettingEnabled() { @CalledByNative private static void setProactiveHelpSettingEnabled(boolean enabled) { - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(enabled); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(enabled); } @CalledByNative diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java index 12874e1bf19ba3..5d7575d440a136 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java @@ -67,8 +67,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { (ChromeSwitchPreference) findPreference(PREF_AUTOFILL_ASSISTANT); if (shouldShowAutofillAssistantPreference()) { mAutofillAssistantPreference.setOnPreferenceChangeListener((preference, newValue) -> { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, (boolean) newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference((boolean) newValue); updatePreferencesState(); return true; }); @@ -80,8 +79,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { (ChromeSwitchPreference) findPreference(PREF_ASSISTANT_PROACTIVE_HELP_SWITCH); if (shouldShowAutofillAssistantProactiveHelpPreference()) { mProactiveHelpPreference.setOnPreferenceChangeListener((preference, newValue) -> { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, (boolean) newValue); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference((boolean) newValue); updatePreferencesState(); return true; }); @@ -126,8 +124,7 @@ public void onResume() { private boolean shouldShowAutofillAssistantPreference() { return AssistantFeatures.AUTOFILL_ASSISTANT.isEnabled() - && mSharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED); + && AutofillAssistantPreferencesUtil.containsAssistantEnabledPreference(); } private boolean shouldShowAutofillAssistantProactiveHelpPreference() { @@ -140,8 +137,8 @@ private boolean shouldShowWebAssistanceCategory() { } private void updatePreferencesState() { - boolean autofill_assistant_enabled = SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); + boolean autofill_assistant_enabled = + AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(true); mAutofillAssistantPreference.setChecked(autofill_assistant_enabled); boolean assistant_switch_on_or_missing = @@ -150,8 +147,8 @@ private void updatePreferencesState() { UnifiedConsentServiceBridge.isUrlKeyedAnonymizedDataCollectionEnabled( Profile.getLastUsedRegularProfile()); - boolean proactive_help_on = SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); + boolean proactive_help_on = + AutofillAssistantPreferencesUtil.getProactiveHelpPreference(true); boolean proactive_toggle_enabled; boolean show_disclaimer; if (AssistantFeatures.AUTOFILL_ASSISTANT_DISABLE_PROACTIVE_HELP_TIED_TO_MSBB.isEnabled()) { diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java index 8e8f6b246a73f0..40f8e75642da96 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java @@ -18,14 +18,13 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill_assistant.AssistantFeatures; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPreferencesUtil; import org.chromium.chrome.browser.contextualsearch.ContextualSearchFieldTrial; import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.metrics.UmaSessionStats; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; @@ -71,8 +70,6 @@ public class GoogleServicesSettings PrivacyPreferencesManagerImpl.getInstance(); private final ManagedPreferenceDelegate mManagedPreferenceDelegate = createManagedPreferenceDelegate(); - private final SharedPreferencesManager mSharedPreferencesManager = - SharedPreferencesManager.getInstance(); private ChromeSwitchPreference mAllowSignin; private ChromeSwitchPreference mSearchSuggestions; @@ -267,18 +264,16 @@ private ChromeManagedPreferenceDelegate createManagedPreferenceDelegate() { */ private boolean shouldShowAutofillAssistantPreference() { return AssistantFeatures.AUTOFILL_ASSISTANT.isEnabled() - && mSharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED); + && AutofillAssistantPreferencesUtil.containsAssistantEnabledPreference(); } public boolean isAutofillAssistantSwitchOn() { - return mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + return AutofillAssistantPreferencesUtil.getAssistantEnabledPreference( + /* defaultValue= */ false); } public void setAutofillAssistantSwitchValue(boolean newValue) { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } // SignOutDialogListener implementation: diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java index e76aeab7f3ff1f..1ea93d6c2a1315 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java @@ -117,11 +117,9 @@ public void testAutofillAssistantSwitchOn() { assertTrue(autofillAssistantSwitch.isChecked()); autofillAssistantSwitch.performClick(); - assertFalse(mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true)); + assertFalse(AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(true)); autofillAssistantSwitch.performClick(); - assertTrue(mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false)); + assertTrue(AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(false)); }); } @@ -288,8 +286,7 @@ public void testEnhancedVoiceSearch_Disabled() { } private void setAutofillAssistantSwitchValue(boolean newValue) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } private AutofillAssistantPreferenceFragment startAutofillAssistantPreferenceFragment() { @@ -298,7 +295,6 @@ private AutofillAssistantPreferenceFragment startAutofillAssistantPreferenceFrag } public boolean isAutofillAssistantSwitchOn() { - return mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + return AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(false); } } diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java index 56a49ab4d31114..4eef470a6baba5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java @@ -24,11 +24,10 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill_assistant.AssistantFeatures; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPreferencesUtil; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; @@ -331,8 +330,7 @@ public void testMetricsSettingsShownFlagOn() { } private void setAutofillAssistantSwitchValue(boolean newValue) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } private GoogleServicesSettings startGoogleServicesSettings() { diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java index 0a354a8fd3daea..5d73372b0387ae 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java @@ -95,27 +95,6 @@ public final class ChromePreferenceKeys { public static final String ATTRIBUTION_PROVIDER_LAST_BROWSER_START = "Chrome.Attribution.LastBrowserStart"; - /** Whether Autofill Assistant is enabled */ - public static final String AUTOFILL_ASSISTANT_ENABLED = "autofill_assistant_switch"; - /** Whether the Autofill Assistant onboarding has been accepted. */ - public static final String AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED = - "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED"; - /** Whether the user has seen a lite-script before or is a first-time user. */ - public static final String AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER = - "Chrome.AutofillAssistant.LiteScriptFirstTimeUser"; - /** The number of times a user has explicitly canceled a lite script. */ - public static final String AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED = - "Chrome.AutofillAssistant.NumberOfLiteScriptsCanceled"; - /** Whether proactive help is enabled. */ - public static final String AUTOFILL_ASSISTANT_PROACTIVE_HELP = - "Chrome.AutofillAssistant.ProactiveHelp"; - /** - * LEGACY preference indicating whether "do not show again" was checked in the autofill - * assistant onboarding - */ - public static final String AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN = - "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN"; - public static final String BACKUP_FIRST_BACKUP_DONE = "first_backup_done"; public static final String BOOKMARKS_LAST_MODIFIED_FOLDER_ID = "last_bookmark_folder_id"; @@ -1044,9 +1023,6 @@ static List getKeysInUse() { ASSISTANT_VOICE_CONSENT_OUTSIDE_TAPS, ASSISTANT_VOICE_SEARCH_ENABLED, ATTRIBUTION_PROVIDER_LAST_BROWSER_START, - AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, - AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, - AUTOFILL_ASSISTANT_PROACTIVE_HELP, APP_LAUNCH_LAST_KNOWN_ACTIVE_TAB_STATE, APP_LAUNCH_SEARCH_ENGINE_HAD_LOGO, APPLICATION_OVERRIDE_LANGUAGE, diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java index 94b022005a35ae..ca0d254ac27b08 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java @@ -19,7 +19,12 @@ public class DeprecatedChromePreferenceKeys { static List getKeysForTesting() { // clang-format off return Arrays.asList( + "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED", + "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN", "Chrome.AccountPickerBottomSheet.ShownCount", + "Chrome.AutofillAssistant.LiteScriptFirstTimeUser", + "Chrome.AutofillAssistant.NumberOfLiteScriptsCanceled", + "Chrome.AutofillAssistant.ProactiveHelp", "Chrome.Flags.PaintPreviewTestEnabled", "Chrome.Flags.SafeBool.*", "Chrome.Flags.SafeDouble.*", @@ -53,6 +58,7 @@ static List getKeysForTesting() { "allow_low_end_device_ui", "allow_prefetch", "allow_starting_service_manager_only", + "autofill_assistant_switch", "bookmark_search_history", "bottom_toolbar_enabled", "bottom_toolbar_variation", diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java index be841e85d600e8..ba3a98407fc0ae 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java @@ -25,9 +25,6 @@ static List getKeysInUse() { return Arrays.asList( ChromePreferenceKeys.ACCESSIBILITY_TAB_SWITCHER, ChromePreferenceKeys.APP_LOCALE, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN, ChromePreferenceKeys.BACKUP_FIRST_BACKUP_DONE, ChromePreferenceKeys.BOOKMARKS_LAST_MODIFIED_FOLDER_ID, ChromePreferenceKeys.BOOKMARKS_LAST_USED_URL, From 4ab8a1aed6443fa6dd71d9ed286427917a5b7930 Mon Sep 17 00:00:00 2001 From: chromium-internal-autoroll Date: Wed, 15 Dec 2021 09:42:42 +0000 Subject: [PATCH 004/133] Roll src-internal from 3772b4e1977a to 56b07585df4f (1 revision) https://chrome-internal.googlesource.com/chrome/src-internal.git/+log/3772b4e1977a..56b07585df4f If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://skia-autoroll.corp.goog/r/src-internal-chromium-autoroll Please CC on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome Bug: None Tbr: Change-Id: I304000452a46e28583054bf9efbe85bcd6a62037 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340820 Commit-Queue: chromium-internal-autoroll Bot-Commit: chromium-internal-autoroll Cr-Commit-Position: refs/heads/main@{#951868} --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index db1eea8fce595b..94e2f513dcfb79 100644 --- a/DEPS +++ b/DEPS @@ -1700,7 +1700,7 @@ deps = { Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3772b4e1977a26513f2da475016bd6912a1c9c65', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@56b07585df4fc40e1a052b075883ccf594ac20b2', 'condition': 'checkout_src_internal', }, From 48f99d5b8e29e40051d7d70318315c36c3623634 Mon Sep 17 00:00:00 2001 From: Robbie Gibson Date: Wed, 15 Dec 2021 09:45:39 +0000 Subject: [PATCH 005/133] [iOS] Allow new overflow menu destinations to wrap to 2 lines You'd think that in a VStack of image and text, SwiftUI would support some way to signal that you want the image to control the width of the stack and the text to just flow after that. But I couldn't find a way, so this CL just calculates the width of the icon and fixes the width of the entire Destination view at that width. Fixed: 1279876 Change-Id: I31d96baeb3220947b360ebbb8ca9900491f063b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338528 Reviewed-by: David Jean Commit-Queue: Robbie Gibson Cr-Commit-Position: refs/heads/main@{#951869} --- .../overflow_menu_destination_list.swift | 17 ++++++++++++----- .../overflow_menu_destination_view.swift | 11 ++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift index 9f2bdc8b862798..816d5e858ca2ac 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_list.swift @@ -32,6 +32,9 @@ struct OverflowMenuDestinationList: View { /// When the dynamic text size is large, the width of each item is the /// screen width minus a fixed space. static let largeTextSizeSpace: CGFloat = 120 + + /// Space above the list pushing them down from the grabber. + static let topMargin: CGFloat = 20 } /// The current dynamic type size. @@ -50,11 +53,15 @@ struct OverflowMenuDestinationList: View { : .vertical( iconSpacing: spacing.iconSpacing, iconPadding: spacing.iconPadding) - - LazyHStack(spacing: 0) { - ForEach(destinations) { destination in - OverflowMenuDestinationView( - destination: destination, layoutParameters: layoutParameters) + let alignment: VerticalAlignment = sizeCategory >= .accessibilityMedium ? .center : .top + + VStack { + Spacer(minLength: Constants.topMargin) + LazyHStack(alignment: alignment, spacing: 0) { + ForEach(destinations) { destination in + OverflowMenuDestinationView( + destination: destination, layoutParameters: layoutParameters) + } } } // Make sure the space to the first icon is constant, so add extra diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift index d0b6638eee782f..8e8a044871f1db 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_destination_view.swift @@ -24,6 +24,9 @@ struct OverflowMenuDestinationButton: ButtonStyle { /// The spacing between the icon and the text in horizontal layout. static let horizontalLayoutIconSpacing: CGFloat = 14 + + /// The image width, which controls the width of the overall view. + static let imageWidth: CGFloat = 54 } /// The destination for this view. @@ -35,11 +38,12 @@ struct OverflowMenuDestinationButton: ButtonStyle { func makeBody(configuration: Configuration) -> some View { Group { switch layoutParameters { - case .vertical: + case .vertical(let iconSpacing, let iconPadding): VStack { icon(configuration: configuration) text } + .frame(width: Dimensions.imageWidth + 2 * iconSpacing + 2 * iconPadding) case .horizontal(let itemWidth): HStack { icon(configuration: configuration) @@ -87,15 +91,20 @@ struct OverflowMenuDestinationButton: ButtonStyle { var text: some View { // Only the vertical layout has extra spacing around the text let textSpacing: CGFloat + let maximumLines: Int? switch layoutParameters { case .vertical: textSpacing = Dimensions.verticalLayoutTextPadding + maximumLines = nil case .horizontal: textSpacing = 0 + maximumLines = 1 } return Text(destination.name) .font(.caption2) .padding([.leading, .trailing], textSpacing) + .multilineTextAlignment(.center) + .lineLimit(maximumLines) } } From 4cc0ff9fd4f93ae309ea7744bcdf465bbce715ac Mon Sep 17 00:00:00 2001 From: Jana Grill Date: Wed, 15 Dec 2021 09:57:36 +0000 Subject: [PATCH 006/133] Remove usage of std::function Remove usage of std::function and replace it with raw function pointers, as std::function is banned by the Chromium C++ style guide. See also https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++11.md#function-objects Additionally remove the usage of base::NoDestructor as it "is not needed because the templated class has a trivial destructor". Bug: 1237044 Test: python3 generate_policy_source_test.py Test: components_unittests --gtest_filter=PolicyProtoDecodersTest.* Test: Check manually that the same policies set via YAPS still appear in chrome://policy Change-Id: I49804e69d3372d50bca59eecd6c51f6c4ee14216 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3332720 Reviewed-by: Maksim Ivanov Commit-Queue: Jana Grill Cr-Commit-Position: refs/heads/main@{#951870} --- .../core/common/policy_proto_decoders.cc | 8 +- .../policy/tools/generate_policy_source.py | 45 ++--- .../tools/generate_policy_source_test_data.py | 185 ++++++++---------- 3 files changed, 100 insertions(+), 138 deletions(-) diff --git a/components/policy/core/common/policy_proto_decoders.cc b/components/policy/core/common/policy_proto_decoders.cc index 1e631c5a49f1e8..11521b3b0831b3 100644 --- a/components/policy/core/common/policy_proto_decoders.cc +++ b/components/policy/core/common/policy_proto_decoders.cc @@ -129,7 +129,7 @@ void DecodeProtoFields( PolicyPerProfileFilter per_profile) { PolicyLevel level; - for (const BooleanPolicyAccess& access : GetBooleanPolicyAccess()) { + for (const BooleanPolicyAccess& access : kBooleanPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; @@ -142,7 +142,7 @@ void DecodeProtoFields( nullptr); } - for (const IntegerPolicyAccess& access : GetIntegerPolicyAccess()) { + for (const IntegerPolicyAccess& access : kIntegerPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; @@ -160,7 +160,7 @@ void DecodeProtoFields( {base::UTF8ToUTF16(error)}); } - for (const StringPolicyAccess& access : GetStringPolicyAccess()) { + for (const StringPolicyAccess& access : kStringPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; @@ -196,7 +196,7 @@ void DecodeProtoFields( {base::UTF8ToUTF16(error)}); } - for (const StringListPolicyAccess& access : GetStringListPolicyAccess()) { + for (const StringListPolicyAccess& access : kStringListPolicyAccess) { if (!PerProfileMatches(access.per_profile, per_profile) || !access.has_proto(policy)) continue; diff --git a/components/policy/tools/generate_policy_source.py b/components/policy/tools/generate_policy_source.py index c36b70da0b2f16..c1275d9e3489bf 100755 --- a/components/policy/tools/generate_policy_source.py +++ b/components/policy/tools/generate_policy_source.py @@ -502,7 +502,6 @@ def _WritePolicyConstantHeader(policies, policy_atomic_groups, target_platform, #include #include -#include "base/no_destructor.h" #include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/proto/cloud_policy.pb.h" @@ -597,15 +596,13 @@ def _WriteChromePolicyAccessHeader(policies, f, protobuf_type): f.write('struct %sPolicyAccess {\n' % protobuf_type) f.write(' const char* policy_key;\n' ' bool per_profile;\n' - ' std::function\n' - ' has_proto;\n' - ' std::function\n' - ' get_proto;\n' % protobuf_type) + ' bool (*has_proto)(const em::CloudPolicySettings& policy);\n' + ' const em::%sPolicyProto& (*get_proto)(\n' + ' const em::CloudPolicySettings& policy);\n' % protobuf_type) if protobuf_type == 'String': f.write(' const StringPolicyType type;\n') f.write('};\n') - f.write('const std::array<%sPolicyAccess, %d>& Get%sPolicyAccess();\n\n' % + f.write('extern const std::array<%sPolicyAccess, %d> k%sPolicyAccess;\n\n' % (protobuf_type, len(supported_user_policies), protobuf_type)) @@ -1341,31 +1338,25 @@ def _GetStringPolicyType(policy_type): def _WriteChromePolicyAccessSource(policies, f, protobuf_type): supported_user_policies = _GetSupportedChromeUserPolicies( policies, protobuf_type) - f.write('const std::array<%sPolicyAccess, %d>& Get%sPolicyAccess() {\n' % - (protobuf_type, len(supported_user_policies), protobuf_type)) - f.write(' static const base::NoDestructor>\n' - ' k%sPolicyAccess({{\n' % + f.write('const std::array<%sPolicyAccess, %d> k%sPolicyAccess {{\n' % (protobuf_type, len(supported_user_policies), protobuf_type)) extra_args = '' for policy in supported_user_policies: name = policy.name if protobuf_type == 'String': - extra_args = ',\n ' + _GetStringPolicyType(policy.policy_type) - f.write(' {key::k%s,\n' - ' %s,\n' - ' [](const em::CloudPolicySettings& policy) {\n' - ' return policy.has_%s();\n' - ' },\n' - ' [](const em::CloudPolicySettings& policy)\n' - ' -> const em::%sPolicyProto& {\n' - ' return policy.%s();\n' - ' }%s\n' - ' },\n' % (name, str(policy.per_profile).lower(), name.lower(), - protobuf_type, name.lower(), extra_args)) - f.write(' }});\n\n') - f.write(' return *k%sPolicyAccess;\n' % protobuf_type) - f.write('}\n\n') - + extra_args = ',\n ' + _GetStringPolicyType(policy.policy_type) + f.write(' {key::k%s,\n' + ' %s,\n' + ' [](const em::CloudPolicySettings& policy) {\n' + ' return policy.has_%s();\n' + ' },\n' + ' [](const em::CloudPolicySettings& policy)\n' + ' -> const em::%sPolicyProto& {\n' + ' return policy.%s();\n' + ' }%s\n' + ' },\n' % (name, str(policy.per_profile).lower(), name.lower(), + protobuf_type, name.lower(), extra_args)) + f.write('}};\n\n') #------------------ policy risk tag header -------------------------# diff --git a/components/policy/tools/generate_policy_source_test_data.py b/components/policy/tools/generate_policy_source_test_data.py index 3e883158c5afd1..add2c798d134f0 100644 --- a/components/policy/tools/generate_policy_source_test_data.py +++ b/components/policy/tools/generate_policy_source_test_data.py @@ -121,7 +121,6 @@ #include #include -#include "base/no_destructor.h" #include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/proto/cloud_policy.pb.h" @@ -196,50 +195,42 @@ struct BooleanPolicyAccess { const char* policy_key; bool per_profile; - std::function - has_proto; - std::function - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::BooleanPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); }; -const std::array& GetBooleanPolicyAccess(); +extern const std::array kBooleanPolicyAccess; // Read access to the protobufs of all supported integer user policies. struct IntegerPolicyAccess { const char* policy_key; bool per_profile; - std::function - has_proto; - std::function - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::IntegerPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); }; -const std::array& GetIntegerPolicyAccess(); +extern const std::array kIntegerPolicyAccess; // Read access to the protobufs of all supported string user policies. struct StringPolicyAccess { const char* policy_key; bool per_profile; - std::function - has_proto; - std::function - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::StringPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); const StringPolicyType type; }; -const std::array& GetStringPolicyAccess(); +extern const std::array kStringPolicyAccess; // Read access to the protobufs of all supported stringlist user policies. struct StringListPolicyAccess { const char* policy_key; bool per_profile; - std::function - has_proto; - std::function - get_proto; + bool (*has_proto)(const em::CloudPolicySettings& policy); + const em::StringListPolicyProto& (*get_proto)( + const em::CloudPolicySettings& policy); }; -const std::array& GetStringListPolicyAccess(); +extern const std::array kStringListPolicyAccess; constexpr int64_t kDevicePolicyExternalDataResourceCacheSize = 0; @@ -408,88 +399,68 @@ } // namespace metapolicy -const std::array& GetBooleanPolicyAccess() { - static const base::NoDestructor> - kBooleanPolicyAccess({{ - {key::kExampleBoolPolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_exampleboolpolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.exampleboolpolicy(); - } - }, - {key::kExampleBoolMergeMetapolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_exampleboolmergemetapolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.exampleboolmergemetapolicy(); - } - }, - {key::kExampleBoolPrecedenceMetapolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_exampleboolprecedencemetapolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.exampleboolprecedencemetapolicy(); - } - }, - {key::kCloudOnlyPolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_cloudonlypolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::BooleanPolicyProto& { - return policy.cloudonlypolicy(); - } - }, - }}); - - return *kBooleanPolicyAccess; -} - -const std::array& GetIntegerPolicyAccess() { - static const base::NoDestructor> - kIntegerPolicyAccess({{ - }}); - - return *kIntegerPolicyAccess; -} - -const std::array& GetStringPolicyAccess() { - static const base::NoDestructor> - kStringPolicyAccess({{ - {key::kExampleStringPolicy, - false, - [](const em::CloudPolicySettings& policy) { - return policy.has_examplestringpolicy(); - }, - [](const em::CloudPolicySettings& policy) - -> const em::StringPolicyProto& { - return policy.examplestringpolicy(); - }, - StringPolicyType::STRING - }, - }}); - - return *kStringPolicyAccess; -} - -const std::array& GetStringListPolicyAccess() { - static const base::NoDestructor> - kStringListPolicyAccess({{ - }}); - - return *kStringListPolicyAccess; -} +const std::array kBooleanPolicyAccess {{ + {key::kExampleBoolPolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_exampleboolpolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.exampleboolpolicy(); + } + }, + {key::kExampleBoolMergeMetapolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_exampleboolmergemetapolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.exampleboolmergemetapolicy(); + } + }, + {key::kExampleBoolPrecedenceMetapolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_exampleboolprecedencemetapolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.exampleboolprecedencemetapolicy(); + } + }, + {key::kCloudOnlyPolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_cloudonlypolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::BooleanPolicyProto& { + return policy.cloudonlypolicy(); + } + }, +}}; + +const std::array kIntegerPolicyAccess {{ +}}; + +const std::array kStringPolicyAccess {{ + {key::kExampleStringPolicy, + false, + [](const em::CloudPolicySettings& policy) { + return policy.has_examplestringpolicy(); + }, + [](const em::CloudPolicySettings& policy) + -> const em::StringPolicyProto& { + return policy.examplestringpolicy(); + }, + StringPolicyType::STRING + }, +}}; + +const std::array kStringListPolicyAccess {{ +}}; } // namespace policy From 777d701124536a9874aca5326d3ceae378c7a70c Mon Sep 17 00:00:00 2001 From: chromium-autoroll Date: Wed, 15 Dec 2021 10:01:31 +0000 Subject: [PATCH 007/133] Roll AFDO from 98.0.4758.7_rc-r1-merged to 98.0.4758.8_rc-r1-merged This CL may cause a small binary size increase, roughly proportional to how long it's been since our last AFDO profile roll. For larger increases (around or exceeding 100KB), please file a bug against gbiv@chromium.org. Additional context: https://crbug.com/805539 Please note that, despite rolling to chrome/android, this profile is used for both Linux and Android. If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/afdo-chromium-autoroll Please CC gbiv@chromium.org on the revert to ensure that a human is aware of the problem. To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: gbiv@chromium.org Change-Id: Ibfd38d2c6c7b47fb4cb6cfa2f2e2d2986d90167e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340823 Commit-Queue: chromium-autoroll Bot-Commit: chromium-autoroll Cr-Commit-Position: refs/heads/main@{#951871} --- chrome/android/profiles/newest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index a4a494ffe34ef8..bade16ec4ed98a 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt @@ -1 +1 @@ -chromeos-chrome-amd64-98.0.4758.7_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-98.0.4758.8_rc-r1-merged.afdo.bz2 From 8fe5ad9f9909f83c722cd1abff003db62dbfe81a Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 15 Dec 2021 10:02:19 +0000 Subject: [PATCH 008/133] Support empty fallback in var(). Most functions do not support empty arguments, but var() is an exception; we should support an empty fallback (ie., second argument). Fixing this is also a prerequisite for properly stripping spaces when parsing custom CSS properties (otherwise we would turn a valid case into an invalid case). R=andruud@chromium.org Bug: 1220148 Change-Id: Ie1aa875bdec91bc0f48b7fa47bae6c0ab9e35006 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338993 Reviewed-by: Anders Hartvoll Ruud Commit-Queue: Anders Hartvoll Ruud Cr-Commit-Position: refs/heads/main@{#951872} --- .../core/css/parser/css_variable_parser.cc | 2 -- third_party/blink/web_tests/TestExpectations | 9 -------- .../variable-reference-expected.txt | 21 ------------------- 3 files changed, 32 deletions(-) delete mode 100644 third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt diff --git a/third_party/blink/renderer/core/css/parser/css_variable_parser.cc b/third_party/blink/renderer/core/css/parser/css_variable_parser.cc index 4273110e2965dd..bbf68adeaf1d99 100644 --- a/third_party/blink/renderer/core/css/parser/css_variable_parser.cc +++ b/third_party/blink/renderer/core/css/parser/css_variable_parser.cc @@ -83,8 +83,6 @@ bool IsValidVariableReference(CSSParserTokenRange range) { if (range.Consume().GetType() != kCommaToken) return false; - if (range.AtEnd()) - return false; bool has_references = false; return ClassifyBlock(range, has_references); diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 8ee428c7cbbf07..c11711704d3115 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations @@ -1561,15 +1561,6 @@ crbug.com/891944 external/wpt/css/css-scrollbars/transparent-on-root.html [ Fail crbug.com/891944 [ Mac ] external/wpt/css/css-scrollbars/scrollbar-width-paint-001.html [ Failure ] # css-variables - -crbug.com/1220148 external/wpt/css/css-variables/variable-declaration-07.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-declaration-09.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-reference-06.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-reference-11.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-05.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-07.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-37.html [ Failure ] -crbug.com/1220148 external/wpt/css/css-variables/variable-supports-39.html [ Failure ] crbug.com/1220149 external/wpt/css/css-variables/variable-supports-57.html [ Failure ] # css-nesting diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt deleted file mode 100644 index 904ca589c18a9f..00000000000000 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt +++ /dev/null @@ -1,21 +0,0 @@ -This is a testharness.js-based test. -PASS width: var(--prop); -PASS width: var(--prop) !important; -PASS width: var(--prop, ); -PASS width: var(--prop, 20px); -PASS width: var(--prop, blue); -PASS width: var(--prop1, var(--prop2)); -PASS width: var(--prop1, var(--prop2, var(--prop3, auto))); -PASS width: var(--prop1) var(--prop2) -FAIL width: var(--prop,); assert_equals: expected "var(--prop,)" but got "" -PASS width: var(); -PASS width: var(prop); -PASS width: var(-prop); -PASS width: var(--prop 20px); -PASS width: var(--prop, var(prop)); -PASS width: var(--prop, var(-prop)); -PASS width: var(20px); -PASS width: var(var(--prop)); -PASS Variable reference left open at end of stylesheet -Harness: the test ran to completion. - From 636e509e95e9a43658cc9c317c85caa06f8e6cf7 Mon Sep 17 00:00:00 2001 From: Anastasiia N Date: Wed, 15 Dec 2021 10:13:32 +0000 Subject: [PATCH 009/133] cros: Update Lock screen string in OS Settings Update "Screen lock" string (that is shown for devices without PIN login support) to "Lock screen" to make it consistent with "Lock screen and sign-in" string (that is shown for devices with PIN login support). Bug: 1152711 Change-Id: If83740dc1cc05c473549b12b9ff195ea4cf5ff69 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338339 Reviewed-by: Jimmy Gong Commit-Queue: Anastasiia N Cr-Commit-Position: refs/heads/main@{#951873} --- chrome/app/os_settings_strings.grdp | 2 +- .../IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index 305341c6c96bb1..8d92a318689fe6 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp @@ -3327,7 +3327,7 @@ Press an assigned switch or key to remove assignment. Set up PIN - Screen lock + Lock screen Security and sign-in diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 new file mode 100644 index 00000000000000..8cfe1e2485b338 --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 @@ -0,0 +1 @@ +c849ef6602b8548be8461dc9da0f8d86ea51e0f5 \ No newline at end of file From 3b0bb9dd91607672b1f570f1585b4276aa92fe32 Mon Sep 17 00:00:00 2001 From: Marc Treib Date: Wed, 15 Dec 2021 10:18:01 +0000 Subject: [PATCH 010/133] Sheriff: Disable policy.AllowWakeLocks tast test Bug: 1279285 Change-Id: Ic04665eeff7548f1cb0605b39af3a8b8741c5fca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341312 Auto-Submit: Marc Treib Reviewed-by: Mikel Astiz Commit-Queue: Mikel Astiz Cr-Commit-Position: refs/heads/main@{#951874} --- chromeos/tast_control.gni | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index 798b840f8c5bd1..9125e21f44f1cd 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni @@ -99,6 +99,9 @@ tast_disabled_tests_from_chrome_all = [ # https://crbug.com/1273485: Flaky. "printer.ProxyAdd.epson_software_collate", + + # https://crbug.com/1279285: Flaky. + "policy.AllowWakeLocks", ] # To disable a specific test in lacros_all_tast_tests, add it the following From 41f191c9022a29c9bd6323f4ef84b5a1454dfc14 Mon Sep 17 00:00:00 2001 From: Andres Calderon Jaramillo Date: Wed, 15 Dec 2021 10:19:24 +0000 Subject: [PATCH 011/133] media: Allow render node, AMD, and libv4l2 in hw vd sandbox. This CL expands the hardware video decoding sandbox warm-up with rules that were missed by CL:3280671: 1) We allow out-of-process video decoders to open the render node (/dev/dri/renderD*). This is needed to let CL:3316246 work because it uses a path that opens the render node for reading [1]. This is restricted to builds with VA-API (i.e., Intel and AMD). Note that this is also in the GPU presandbox hook ([2], [3], [4], [5], [6]), except that there, reading and writing is allowed. 2) We dlopen() libv4l2 depending on the USE_LIBV4L2 build flag (not USE_V4L2_CODEC). This is to be consistent with the GPU presandbox hook [7]. 3) We add a few AMD-specific rules that were taken from the existing GPU presandbox by trial and error ([8], [9], [10], [11], [12]). [1] https://source.chromium.org/chromium/chromium/src/+/main:media/gpu/chromeos/platform_video_frame_utils.cc;l=116-117;drc=c9a3bec6c561e2a60757af4a8f765525e29c7f43 [2] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=375-382;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [3] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=221;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [4] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=257;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [5] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=209-210;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [6] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=193;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [7] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=493-494;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [8] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=539-546;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [9] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=205;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [10] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=234-240;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [11] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=193;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a [12] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_sandbox_hook_linux.cc;l=450-457;drc=96cbf5dfae36c13cfd464ef7035d7aa3a989b97a Bug: b:195769334 Test: arc.VideoDecodeAccel.h264_oopvd_vm on volteer with CL:3316832 Change-Id: I828e3ffbcb23c0ed74abc39fa252cf610aaab28b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3328443 Reviewed-by: Matthew Denton Auto-Submit: Andres Calderon Jaramillo Reviewed-by: Alex Gough Commit-Queue: Alex Gough Cr-Commit-Position: refs/heads/main@{#951875} --- ...dware_video_decoding_sandbox_hook_linux.cc | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc index 709f63eae5ed71..87f284c85d309c 100644 --- a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc +++ b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc @@ -5,7 +5,9 @@ #include "media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h" #include +#include +#include "base/strings/stringprintf.h" #include "media/gpu/buildflags.h" #if BUILDFLAG(USE_VAAPI) @@ -51,6 +53,38 @@ bool HardwareVideoDecodingPreSandboxHook( // platforms that need it. static const char kDevImageProc0Path[] = "/dev/image-proc0"; permissions.push_back(BrokerFilePermission::ReadWrite(kDevImageProc0Path)); +#elif BUILDFLAG(USE_VAAPI) + command_set.set(sandbox::syscall_broker::COMMAND_OPEN); + + if (options.use_amd_specific_policies) { + command_set.set(sandbox::syscall_broker::COMMAND_ACCESS); + command_set.set(sandbox::syscall_broker::COMMAND_STAT); + command_set.set(sandbox::syscall_broker::COMMAND_READLINK); + + permissions.push_back(BrokerFilePermission::ReadOnly("/dev/dri")); + + static const char* kDevices[] = {"/sys/dev/char", "/sys/devices"}; + for (const char* item : kDevices) { + std::string path(item); + permissions.push_back( + BrokerFilePermission::StatOnlyWithIntermediateDirs(path)); + permissions.push_back( + BrokerFilePermission::ReadOnlyRecursive(path + "/")); + } + } + + // TODO(b/195769334): for now, this is only needed for two use cases: the + // legacy VaapiVideoDecodeAccelerator and AMD. However, we'll likely need this + // unconditionally so that we can allocate dma-bufs. + for (int i = 128; i <= 137; ++i) { + const std::string path = base::StringPrintf("/dev/dri/renderD%d", i); + struct stat st; + if (stat(path.c_str(), &st) == 0) { + permissions.push_back(options.use_amd_specific_policies + ? BrokerFilePermission::ReadWrite(path) + : BrokerFilePermission::ReadOnly(path)); + } + } #endif // BUILDFLAG(USE_V4L2_CODEC) sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess( @@ -68,7 +102,19 @@ bool HardwareVideoDecodingPreSandboxHook( // that bots like linux-chromeos-rel end up reaching this presandbox hook. #if BUILDFLAG(USE_VAAPI) VaapiWrapper::PreSandboxInitialization(); -#elif BUILDFLAG(USE_V4L2_CODEC) + + if (options.use_amd_specific_policies) { + const char* radeonsi_lib = "/usr/lib64/dri/radeonsi_dri.so"; +#if defined(DRI_DRIVER_DIR) + radeonsi_lib = DRI_DRIVER_DIR "/radeonsi_dri.so"; +#endif + if (nullptr == + dlopen(radeonsi_lib, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { + LOG(ERROR) << "dlopen(radeonsi_dri.so) failed with error: " << dlerror(); + return false; + } + } +#elif BUILDFLAG(USE_LIBV4L2) dlopen("/usr/lib/libv4l2.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); #endif // BUILDFLAG(USE_VAAPI) From ee3d460836377773826dff17d034e4f1d8a9f978 Mon Sep 17 00:00:00 2001 From: chromium-autoroll Date: Wed, 15 Dec 2021 10:23:13 +0000 Subject: [PATCH 012/133] Roll androidx from 51KZuMRRe... to 22GLME4Ax... If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/androidx-chromium Please CC mheikal@google.com,clank-library-failures@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Cq-Include-Trybots: luci.chrome.try:android-internal-binary-size;luci.chrome.try:android-internal-rel Tbr: mheikal@google.com,clank-library-failures@google.com Change-Id: Id1a641da70b0353f2808065323a76bd24e14a9d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340815 Commit-Queue: chromium-autoroll Bot-Commit: chromium-autoroll Cr-Commit-Position: refs/heads/main@{#951876} --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 94e2f513dcfb79..4e3304b69e5ff9 100644 --- a/DEPS +++ b/DEPS @@ -799,7 +799,7 @@ deps = { 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': '51KZuMRReilT3sNyF1-vaB_9ciuTsRJxv8kUH1eLbDgC', + 'version': '22GLME4Ax-0a0SJo1MSxARBmZMMz-SMyTlRHX8fYhW8C', }, ], 'condition': 'checkout_android', From 6f0a7c8f5ce5c8b2bb47012824081e1293a4d471 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Wed, 15 Dec 2021 10:24:16 +0000 Subject: [PATCH 013/133] CCA: Handle case when ML service is not available If ML service is not available on the device, we should report document scanning as unsupported. Bug: b:209726834 Test: Manually Change-Id: I35091481b476608f88e2fac405ef9169d1c25881 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3327823 Reviewed-by: Shik Chen Commit-Queue: Wei Lee Cr-Commit-Position: refs/heads/main@{#951877} --- .../document_scanner_service_client.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ash/webui/camera_app_ui/document_scanner_service_client.cc b/ash/webui/camera_app_ui/document_scanner_service_client.cc index 92c69a11de1702..4df61ccdecd4ed 100644 --- a/ash/webui/camera_app_ui/document_scanner_service_client.cc +++ b/ash/webui/camera_app_ui/document_scanner_service_client.cc @@ -20,25 +20,30 @@ using chromeos::machine_learning::mojom::LoadModelResult; using chromeos::machine_learning::mojom::Rotation; constexpr char kOndeviceDocumentScanner[] = "ondevice_document_scanner"; +constexpr char kMLService[] = "ml_service"; // Returns whether the `value` is set for command line switch // kOndeviceDocumentScanner. -bool DocumentScannerSwitchHasValue(const std::string& value) { +bool HasCommandLineSwitch(const std::string& key, const std::string& value) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - return command_line->HasSwitch(kOndeviceDocumentScanner) && - command_line->GetSwitchValueASCII(kOndeviceDocumentScanner) == value; + return command_line->HasSwitch(key) && + command_line->GetSwitchValueASCII(key) == value; } // Returns true if switch kOndeviceDocumentScanner is set to use_rootfs. bool IsEnabledOnRootfs() { - return DocumentScannerSwitchHasValue("use_rootfs"); + return HasCommandLineSwitch(kOndeviceDocumentScanner, "use_rootfs"); +} + +bool IsMachineLearningServiceAvailable() { + return HasCommandLineSwitch(kMLService, "enabled"); } } // namespace // static bool DocumentScannerServiceClient::IsSupported() { - return IsEnabledOnRootfs(); + return IsMachineLearningServiceAvailable() && IsEnabledOnRootfs(); } // static From 5b59d2e057c946efa1b06cb660b7e26767c80635 Mon Sep 17 00:00:00 2001 From: Marc Treib Date: Wed, 15 Dec 2021 10:42:17 +0000 Subject: [PATCH 014/133] Sheriff: Attempt to fix SBNavigationObserverTest on TSan These tests are failing on TSan due to a data race related to FeatureList. This CL attempts to fix the issue by initializing the test's ScopedFeatureList earlier, in the test fixture constructor instead of in SetUp(). Bug: 1278500 Change-Id: Id14dd86bf362e8c4f8f1de98dfc9a295dc1b02c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341532 Commit-Queue: Marc Treib Owners-Override: Marc Treib Auto-Submit: Marc Treib Reviewed-by: Mikel Astiz Commit-Queue: Mikel Astiz Cr-Commit-Position: refs/heads/main@{#951878} --- .../safe_browsing_navigation_observer_unittest.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc b/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc index 7af7b7ff66aed7..a1c5ef46fda216 100644 --- a/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc +++ b/components/safe_browsing/content/browser/safe_browsing_navigation_observer_unittest.cc @@ -30,7 +30,10 @@ namespace safe_browsing { class SBNavigationObserverTest : public content::RenderViewHostTestHarness { public: - SBNavigationObserverTest() {} + SBNavigationObserverTest() { + scoped_feature_list_.InitAndEnableFeature( + kOmitNonUserGesturesFromReferrerChain); + } SBNavigationObserverTest(const SBNavigationObserverTest&) = delete; SBNavigationObserverTest& operator=(const SBNavigationObserverTest&) = delete; @@ -50,9 +53,6 @@ class SBNavigationObserverTest : public content::RenderViewHostTestHarness { navigation_observer_ = new SafeBrowsingNavigationObserver(web_contents(), settings_map_.get(), navigation_observer_manager_.get()); - - scoped_feature_list_.InitAndEnableFeature( - kOmitNonUserGesturesFromReferrerChain); } void TearDown() override { delete navigation_observer_; @@ -185,6 +185,8 @@ class SBNavigationObserverTest : public content::RenderViewHostTestHarness { std::unique_ptr navigation_observer_manager_; raw_ptr navigation_observer_; + + private: base::test::ScopedFeatureList scoped_feature_list_; }; From b114256f9385de4fba4ae2ede5c97d5f58c2335f Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 15 Dec 2021 10:44:12 +0000 Subject: [PATCH 015/133] Allow cross-thread use of RenderableGpuMemoryBufferVideoFramePool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For WebRtcVideoFrameAdapter, the RenderableGpuMemoryBufferVideoFramePool is created on one thread and used on another. Bug: 1278262 Change-Id: I3d535284418cf12dad1b8489c8cbfc6428229986 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3330362 Reviewed-by: ccameron chromium Reviewed-by: Frank Liberato Auto-Submit: Ben Wagner Reviewed-by: Henrik Boström Commit-Queue: Henrik Boström Cr-Commit-Position: refs/heads/main@{#951879} --- ...able_gpu_memory_buffer_video_frame_pool.cc | 12 ++++++--- ...memory_buffer_video_frame_pool_unittest.cc | 27 +++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc index 66719745221507..9c98492a3bd9ff 100644 --- a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc +++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc @@ -29,7 +29,7 @@ class InternalRefCountedPool; // The VideoFrame-backing resources that are reused by the pool, namely, a // GpuMemoryBuffer and a per-plane SharedImage. This retains a reference to -// the InternalRefCountedPool that created it. +// the InternalRefCountedPool that created it. Not safe for concurrent use. class FrameResources { public: FrameResources(scoped_refptr pool, @@ -72,7 +72,13 @@ class FrameResources { // The owner of the RenderableGpuMemoryBufferVideoFramePool::Client needs to be // reference counted to ensure that not be destroyed while there still exist any // FrameResources. -class InternalRefCountedPool : public base::RefCounted { +// Although this class is not generally safe for concurrent use, it extends +// RefCountedThreadSafe in order to allow destruction on a different thread. +// Specifically, blink::WebRtcVideoFrameAdapter::SharedResources lazily creates +// a RenderableGpuMemoryBufferVideoFramePool when it needs to convert a frame on +// the IO thread, but ends up destroying the object on the main thread. +class InternalRefCountedPool + : public base::RefCountedThreadSafe { public: explicit InternalRefCountedPool( std::unique_ptr @@ -95,7 +101,7 @@ class InternalRefCountedPool : public base::RefCounted { RenderableGpuMemoryBufferVideoFramePool::Context* GetContext() const; private: - friend class base::RefCounted; + friend class base::RefCountedThreadSafe; ~InternalRefCountedPool(); // Callback made whe a created VideoFrame is destroyed. Returns diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc index 6491f165cc5578..94db7f8228f1d7 100644 --- a/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc +++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc @@ -5,6 +5,8 @@ #include "media/video/renderable_gpu_memory_buffer_video_frame_pool.h" #include "base/memory/weak_ptr.h" +#include "base/task/thread_pool.h" +#include "base/test/bind.h" #include "base/test/task_environment.h" #include "media/base/video_frame.h" #include "media/video/fake_gpu_memory_buffer.h" @@ -167,6 +169,31 @@ TEST(RenderableGpuMemoryBufferVideoFramePool, FrameFreedAfterPool) { EXPECT_FALSE(!!context); } +TEST(RenderableGpuMemoryBufferVideoFramePool, CrossThread) { + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + const gfx::Size size0(128, 256); + const gfx::ColorSpace color_space0 = gfx::ColorSpace::CreateREC709(); + + // Create a pool on the main thread. + auto pool = RenderableGpuMemoryBufferVideoFramePool::Create( + std::make_unique()); + + base::ThreadPool::CreateSequencedTaskRunner({})->PostTaskAndReplyWithResult( + FROM_HERE, + // Create a frame on another thread. + base::BindLambdaForTesting( + [&]() { return pool->MaybeCreateVideoFrame(size0, color_space0); }), + // Destroy the video frame on the main thread. + base::BindLambdaForTesting( + [&](scoped_refptr video_frame0) {})); + task_environment.RunUntilIdle(); + + // Destroy the pool. + pool = nullptr; + task_environment.RunUntilIdle(); +} + TEST(RenderableGpuMemoryBufferVideoFramePool, RespectSizeAndColorSpace) { base::test::SingleThreadTaskEnvironment task_environment; const gfx::BufferFormat format = gfx::BufferFormat::YUV_420_BIPLANAR; From 6a204933138c9cc397abe1bd12d929df0943c9bd Mon Sep 17 00:00:00 2001 From: Chromium WPT Sync Date: Wed, 15 Dec 2021 10:45:02 +0000 Subject: [PATCH 016/133] Import wpt@bd81cda45784b2dfb12fd8487f01bc15ea9c0170 Using wpt-import in Chromium 0276eba8727fc646e16b3a5f079d5ca56b03fd32. With Chromium commits locally applied on WPT: 6ed69eb40e "Migrate cookie-test.js's httpRedirectCookieTest to test_driver.delete_all_cookies" 7cd9af914b "Always assume that non-auto 'columns' might create a multicol." Note to sheriffs: This CL imports external tests and adds expectations for those tests; if this CL is large and causes a few new failures, please fix the failures by adding new lines to TestExpectations rather than reverting. See: https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md Directory owners for changes in this CL: cbiesinger@chromium.org: external/wpt/css/css-sizing futhark@chromium.org, andruud@chromium.org, ericwilligers@chromium.org, shend@chromium.org: external/wpt/css/css-conditional NOAUTOREVERT=true R=rubber-stamper@appspot.gserviceaccount.com No-Export: true Change-Id: Id42e514070e7551cd146f00f3652b1332bdb5f17 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340752 Auto-Submit: WPT Autoroller Commit-Queue: Rubber Stamper Bot-Commit: Rubber Stamper Cr-Commit-Position: refs/heads/main@{#951880} --- third_party/blink/web_tests/TestExpectations | 47 +++- .../external/WPT_BASE_MANIFEST_8.json | 47 +++- .../css/css-color/parsing/color-computed.html | 3 + .../js/conditional-CSSGroupingRule.html | 244 ++++++++++++++++++ .../test_group_insertRule.html | 222 ---------------- ...ntage-height-with-border-box-expected.html | 38 +++ ...ild-percentage-height-with-border-box.html | 39 +++ .../external/wpt/dom/historical-expected.txt | 81 ------ 8 files changed, 407 insertions(+), 314 deletions(-) create mode 100644 third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html delete mode 100644 third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html create mode 100644 third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html create mode 100644 third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html delete mode 100644 third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index c11711704d3115..321a9d4d217ef9 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations @@ -2811,6 +2811,51 @@ crbug.com/626703 [ Mac ] external/wpt/css/css-text/line-breaking/segment-break-t crbug.com/626703 [ Fuchsia ] external/wpt/dom/historical.html [ Skip ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-color/xyz-d50-004.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-color/xyz-d65-004.html [ Failure ] +crbug.com/626703 [ Linux ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.14 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac11 ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Win ] external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-color-property-001a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-color-property-002.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-001b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003c.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-004d.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-001.html [ Timeout Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-001b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-002.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-003.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-003c.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005d.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005e.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-005f.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006b.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006c.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006f.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-position-property-006g.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-property-003.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-property-004a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-005.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-012a.html [ Failure Crash ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-013.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-013a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-014a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-015a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-016a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-017a.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-style-property-019.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-shadow/quirks-decor-noblur.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-007.html [ Failure Crash ] +crbug.com/626703 [ Mac11-arm64 ] virtual/system-color-compute/external/wpt/css/css-color/color-contrast-001.html [ Failure ] +crbug.com/626703 [ Mac11-arm64 ] virtual/system-color-compute/external/wpt/css/css-color/xyz-d50-004.html [ Failure ] crbug.com/626703 [ Linux ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-color/color-contrast-001.html [ Failure ] @@ -2861,7 +2906,7 @@ crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-text-decor/text-emphasis-line crbug.com/626703 [ Mac10.14 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure ] -crbug.com/626703 [ Mac11 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Timeout Failure ] +crbug.com/626703 [ Mac11 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Failure Timeout ] crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-text-decor/text-emphasis-line-height-003a.html [ Crash Failure ] crbug.com/626703 external/wpt/css/css-text-decor/text-emphasis-line-height-003b.html [ Failure ] crbug.com/626703 [ Linux ] external/wpt/css/css-text-decor/text-emphasis-line-height-003c.html [ Failure ] diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index 2a1bac8397ff5e..d0168031dba8c7 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json @@ -152163,6 +152163,19 @@ {} ] ], + "table-child-percentage-height-with-border-box.html": [ + "7700b00dc3239245e38f90c72df944ef04a36998", + [ + null, + [ + [ + "/css/css-sizing/table-child-percentage-height-with-border-box-expected.html", + "==" + ] + ], + {} + ] + ], "thin-element-render.html": [ "fa587360a6d2625c8f02cd7f0eba54b3bb09a1f1", [ @@ -334359,7 +334372,7 @@ ] ], "AmbientLightSensor.https.html": [ - "7d23896a6488f3fdfef6809f552a06f03fe427a3", + "0ccb899ec237a0de885622a66c26677193f749c5", [ null, { @@ -356502,7 +356515,7 @@ ], "parsing": { "color-computed.html": [ - "d78e92b81e106f52026aeeedbc2b104e987e5639", + "6d0a7074f76c086117c5b3a964003aa94f49e814", [ null, {} @@ -356729,15 +356742,15 @@ null, {} ] + ], + "conditional-CSSGroupingRule.html": [ + "bde92d7091bd0ace1320acb5d0d8f56c33def22e", + [ + null, + {} + ] ] - }, - "test_group_insertRule.html": [ - "e9e8cce8ffaeb983eed7a84e33da04cc4c3a5242", - [ - null, - {} - ] - ] + } }, "css-contain": { "contain-chrome-thcrash-001.html": [ @@ -462836,6 +462849,13 @@ {} ] ], + "intersection-ratio-with-fractional-bounds-2.html": [ + "1e250accd8e43e84050f735cdd42f30d1ef7f931", + [ + null, + {} + ] + ], "intersection-ratio-with-fractional-bounds.html": [ "9f54bef976782ad7ebb28b17b6e151a059840f49", [ @@ -558584,6 +558604,13 @@ null, {} ] + ], + "table-child-percentage-height-with-border-box-expected.html": [ + "2b0a2f451c59b21471d5b2984c2c01aae2cfa5ce", + [ + null, + {} + ] ] }, "css-text": { diff --git a/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html b/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html index d78e92b81e106f..6d0a7074f76c08 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html +++ b/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed.html @@ -4,6 +4,9 @@ CSS Color Module Level 3: getComputedStyle().color + + + diff --git a/third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html b/third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html new file mode 100644 index 00000000000000..bde92d7091bd0a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-conditional/js/conditional-CSSGroupingRule.html @@ -0,0 +1,244 @@ + + + CSSGroupingRule Conditional Rules Test + + + + + + + + + +
+
+ + + diff --git a/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html b/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html deleted file mode 100644 index e9e8cce8ffaeb9..00000000000000 --- a/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - CSS Variables Allowed Syntax - - - - - - - - - -
-
- - - diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html new file mode 100644 index 00000000000000..2b0a2f451c59b2 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html @@ -0,0 +1,38 @@ + + +Test if percentage height of table's child element with box-sizing: border-box is calculated correctly + + + +
+
+ wrapped content (height: 100%) +
+
+ diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html new file mode 100644 index 00000000000000..7700b00dc32392 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html @@ -0,0 +1,39 @@ + + +Test if percentage height of table's child element with box-sizing: border-box is calculated correctly + + + + +
+
+ wrapped content (height: 100%) +
+
+ diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt b/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt deleted file mode 100644 index 66cad48a780d6f..00000000000000 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/dom/historical-expected.txt +++ /dev/null @@ -1,81 +0,0 @@ -This is a testharness.js-based test. -Found 77 tests; 72 PASS, 5 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS Historical DOM features must be removed: DOMConfiguration -PASS Historical DOM features must be removed: DOMCursor -FAIL Historical DOM features must be removed: DOMError assert_false: expected false got true -PASS Historical DOM features must be removed: DOMErrorHandler -PASS Historical DOM features must be removed: DOMImplementationList -PASS Historical DOM features must be removed: DOMImplementationSource -PASS Historical DOM features must be removed: DOMLocator -PASS Historical DOM features must be removed: DOMObject -PASS Historical DOM features must be removed: DOMRequest -PASS Historical DOM features must be removed: DOMSettableTokenList -PASS Historical DOM features must be removed: DOMUserData -PASS Historical DOM features must be removed: Entity -PASS Historical DOM features must be removed: EntityReference -PASS Historical DOM features must be removed: EventException -PASS Historical DOM features must be removed: NameList -PASS Historical DOM features must be removed: Notation -PASS Historical DOM features must be removed: TypeInfo -PASS Historical DOM features must be removed: UserDataHandler -PASS Historical DOM features must be removed: RangeException -PASS Historical DOM features must be removed: createEntityReference -FAIL Historical DOM features must be removed: xmlEncoding assert_false: expected false got true -FAIL Historical DOM features must be removed: xmlStandalone assert_false: expected false got true -FAIL Historical DOM features must be removed: xmlVersion assert_false: expected false got true -PASS Historical DOM features must be removed: strictErrorChecking -PASS Historical DOM features must be removed: domConfig -PASS Historical DOM features must be removed: normalizeDocument -PASS Historical DOM features must be removed: renameNode -PASS Historical DOM features must be removed: defaultCharset -PASS Historical DOM features must be removed: height -PASS Historical DOM features must be removed: width -PASS Historical DOM features must be removed: commands -PASS Historical DOM features must be removed: cssElementMap -PASS Historical DOM features must be removed: async -PASS Historical DOM features must be removed: origin -PASS document.load -PASS XMLDocument.load -PASS DOMImplementation.getFeature() must be removed. -PASS Historical DOM features must be removed: schemaTypeInfo -PASS Historical DOM features must be removed: setIdAttribute -PASS Historical DOM features must be removed: setIdAttributeNS -PASS Historical DOM features must be removed: setIdAttributeNode -PASS Attr member must be removed: schemaTypeInfo -PASS Attr member must be removed: isId -PASS DocumentType member must be removed: entities -PASS DocumentType member must be removed: notations -PASS DocumentType member must be removed: internalSubset -PASS Text member must be removed: isElementContentWhitespace -PASS Text member must be removed: replaceWholeText -PASS Node member must be removed: hasAttributes -PASS Node member must be removed: attributes -PASS Node member must be removed: namespaceURI -PASS Node member must be removed: prefix -PASS Node member must be removed: localName -PASS Node member must be removed: isSupported -PASS Node member must be removed: getFeature -PASS Node member must be removed: getUserData -PASS Node member must be removed: setUserData -PASS Node member must be removed: rootNode -PASS Window member must be removed: attachEvent -PASS Event should not have this constant: MOUSEDOWN -PASS Event should not have this constant: MOUSEUP -PASS Event should not have this constant: MOUSEOVER -PASS Event should not have this constant: MOUSEOUT -PASS Event should not have this constant: MOUSEMOVE -PASS Event should not have this constant: MOUSEDRAG -PASS Event should not have this constant: CLICK -PASS Event should not have this constant: DBLCLICK -PASS Event should not have this constant: KEYDOWN -PASS Event should not have this constant: KEYUP -PASS Event should not have this constant: KEYPRESS -PASS Event should not have this constant: DRAGDROP -PASS Event should not have this constant: FOCUS -PASS Event should not have this constant: BLUR -PASS Event should not have this constant: SELECT -PASS Event should not have this constant: CHANGE -PASS Event.prototype should not have this property: getPreventDefault -FAIL Event.prototype should not have this property: path assert_false: expected false got true -Harness: the test ran to completion. - From 58ff6739f72e92447ec176edb75be054a7453230 Mon Sep 17 00:00:00 2001 From: Benedikt Meurer Date: Wed, 15 Dec 2021 10:49:43 +0000 Subject: [PATCH 017/133] [devtools] Migrate Database to use AsyncTaskContext Doc: https://goo.gle/devtools-async-tasks Bug: chromium:1275875 Change-Id: I00df0f8fb53aa833cb18a84f77e4e91db0c1f6fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3321547 Auto-Submit: Benedikt Meurer Reviewed-by: Mike West Commit-Queue: Mike West Cr-Commit-Position: refs/heads/main@{#951881} --- .../renderer/modules/webdatabase/database.cc | 18 ++++++++---------- .../renderer/modules/webdatabase/database.h | 6 ++++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/third_party/blink/renderer/modules/webdatabase/database.cc b/third_party/blink/renderer/modules/webdatabase/database.cc index 53bd54c3dc2015..455f8ad426aea2 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.cc +++ b/third_party/blink/renderer/modules/webdatabase/database.cc @@ -35,7 +35,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/inspector/console_message.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/modules/webdatabase/change_version_data.h" #include "third_party/blink/renderer/modules/webdatabase/change_version_wrapper.h" @@ -316,15 +315,14 @@ bool Database::OpenAndVerifyVersion(bool set_version_in_new_database, if (success && IsNew()) { STORAGE_DVLOG(1) << "Scheduling DatabaseCreationCallbackTask for database " << this; - auto task_id = std::make_unique(); - probe::AsyncTaskScheduled(GetExecutionContext(), "openDatabase", - task_id.get()); + auto async_task_context = std::make_unique(); + async_task_context->Schedule(GetExecutionContext(), "openDatabase"); GetExecutionContext() ->GetTaskRunner(TaskType::kDatabaseAccess) - ->PostTask( - FROM_HERE, - WTF::Bind(&Database::RunCreationCallback, WrapPersistent(this), - WrapPersistent(creation_callback), std::move(task_id))); + ->PostTask(FROM_HERE, WTF::Bind(&Database::RunCreationCallback, + WrapPersistent(this), + WrapPersistent(creation_callback), + std::move(async_task_context))); } } @@ -333,8 +331,8 @@ bool Database::OpenAndVerifyVersion(bool set_version_in_new_database, void Database::RunCreationCallback( V8DatabaseCallback* creation_callback, - std::unique_ptr task_id) { - probe::AsyncTask async_task(GetExecutionContext(), task_id.get()); + std::unique_ptr async_task_context) { + probe::AsyncTask async_task(GetExecutionContext(), async_task_context.get()); creation_callback->InvokeAndReportException(nullptr, this); } diff --git a/third_party/blink/renderer/modules/webdatabase/database.h b/third_party/blink/renderer/modules/webdatabase/database.h index 8d4bbe426f2052..bfbf4fcae66a21 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.h +++ b/third_party/blink/renderer/modules/webdatabase/database.h @@ -29,6 +29,7 @@ #include #include "base/task/single_thread_task_runner.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_database_callback.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/modules/webdatabase/database_authorizer.h" #include "third_party/blink/renderer/modules/webdatabase/database_basic_types.h" #include "third_party/blink/renderer/modules/webdatabase/database_error.h" @@ -135,8 +136,9 @@ class Database final : public ScriptWrappable { bool PerformOpenAndVerify(bool set_version_in_new_database, DatabaseError&, String& error_message); - void RunCreationCallback(V8DatabaseCallback* creation_callback, - std::unique_ptr task_id); + void RunCreationCallback( + V8DatabaseCallback* creation_callback, + std::unique_ptr async_task_context); void ScheduleTransaction(); From be1f0478546ac79c138ae925bf90988a8fc3dec7 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 15 Dec 2021 10:52:08 +0000 Subject: [PATCH 018/133] Add more threading tests for RenderableGpuMemoryBufferVideoFramePool The new tests pass with no code changes. Bug: 1278262 Change-Id: I000f4b635068f704fe83fdcc0bda3ac43294065f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338659 Reviewed-by: ccameron chromium Reviewed-by: Frank Liberato Commit-Queue: Ben Wagner Auto-Submit: Ben Wagner Cr-Commit-Position: refs/heads/main@{#951882} --- ...memory_buffer_video_frame_pool_unittest.cc | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc index 94db7f8228f1d7..95979460c382e5 100644 --- a/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc +++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc @@ -194,6 +194,80 @@ TEST(RenderableGpuMemoryBufferVideoFramePool, CrossThread) { task_environment.RunUntilIdle(); } +TEST(RenderableGpuMemoryBufferVideoFramePool, + VideoFramesDestroyedConcurrently) { + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + const gfx::BufferFormat format = gfx::BufferFormat::YUV_420_BIPLANAR; + const gfx::Size size0(128, 256); + const gfx::ColorSpace color_space0 = gfx::ColorSpace::CreateREC709(); + + // Create a pool and several frames on the main thread. + base::WeakPtr context; + std::unique_ptr pool; + { + auto context_strong = std::make_unique(); + context = context_strong->GetWeakPtr(); + pool = RenderableGpuMemoryBufferVideoFramePool::Create( + std::move(context_strong)); + } + + std::vector> frames; + static constexpr int kNumFrames = 3; + for (int i = 0; i < kNumFrames; i++) { + EXPECT_CALL(*context, DoCreateGpuMemoryBuffer(size0, format)); + EXPECT_CALL(*context, + DoCreateSharedImage(_, gfx::BufferPlane::Y, _, _, _, _)); + EXPECT_CALL(*context, + DoCreateSharedImage(_, gfx::BufferPlane::UV, _, _, _, _)); + frames.emplace_back(pool->MaybeCreateVideoFrame(size0, color_space0)); + } + task_environment.RunUntilIdle(); + + // Expect all frames to be destroyed eventually. + EXPECT_CALL(*context, DestroySharedImage(_, _)).Times(kNumFrames * 2); + + // Destroy frames on separate threads. TSAN will tell us if there's a problem. + for (int i = 0; i < kNumFrames; i++) { + base::ThreadPool::CreateSequencedTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce([](scoped_refptr video_frame0) {}, + std::move(frames[i]))); + } + + pool.reset(); + task_environment.RunUntilIdle(); + EXPECT_FALSE(!!context); +} + +TEST(RenderableGpuMemoryBufferVideoFramePool, ConcurrentCreateDestroy) { + base::test::TaskEnvironment task_environment{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + const gfx::Size size0(128, 256); + const gfx::ColorSpace color_space0 = gfx::ColorSpace::CreateREC709(); + + // Create a pool on the main thread. + auto pool = RenderableGpuMemoryBufferVideoFramePool::Create( + std::make_unique()); + + // Create a frame on the main thread. + auto video_frame0 = pool->MaybeCreateVideoFrame(size0, color_space0); + task_environment.RunUntilIdle(); + + // Destroy the frame on another thread. TSAN will tell us if there's a + // problem. + base::ThreadPool::CreateSequencedTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce([](scoped_refptr video_frame0) {}, + std::move(video_frame0))); + + // Create another frame on the main thread. + auto video_frame1 = pool->MaybeCreateVideoFrame(size0, color_space0); + task_environment.RunUntilIdle(); + + video_frame1 = nullptr; + pool.reset(); + task_environment.RunUntilIdle(); +} + TEST(RenderableGpuMemoryBufferVideoFramePool, RespectSizeAndColorSpace) { base::test::SingleThreadTaskEnvironment task_environment; const gfx::BufferFormat format = gfx::BufferFormat::YUV_420_BIPLANAR; From f10a6bf7db5683d31511597aa8e45f1f16fb70ec Mon Sep 17 00:00:00 2001 From: Yuki Shiino Date: Wed, 15 Dec 2021 10:52:52 +0000 Subject: [PATCH 019/133] bindings: Fix the undefined behavior of conversion to int16_t Fixes the negative case of range adjustment of the conversion from v8::Value to int16_t. Bug: 1269182 Change-Id: I43d14fb60512665441c2c624685372511d3380b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3293443 Reviewed-by: Raphael Kubo Da Costa Commit-Queue: Raphael Kubo Da Costa Cr-Commit-Position: refs/heads/main@{#951883} --- .../renderer/bindings/core/v8/v8_binding_for_core.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc index f7d6b2ab1138ff..93f3d02d704ad8 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc @@ -224,13 +224,18 @@ static inline T ToSmallerInt(v8::Isolate* isolate, if (std::isinf(number_value)) return 0; + // Confine number to (-kNumberOfValues, kNumberOfValues). number_value = number_value < 0 ? -floor(fabs(number_value)) : floor(fabs(number_value)); number_value = fmod(number_value, LimitsTrait::kNumberOfValues); - return static_cast(number_value > LimitsTrait::kMaxValue - ? number_value - LimitsTrait::kNumberOfValues - : number_value); + // Adjust range to [-kMinValue, kMaxValue]. + if (number_value < LimitsTrait::kMinValue) + number_value += LimitsTrait::kNumberOfValues; + else if (LimitsTrait::kMaxValue < number_value) + number_value -= LimitsTrait::kNumberOfValues; + + return static_cast(number_value); } template From 949fb8c63f01e3d2fc5ef38684fd65c959f07c42 Mon Sep 17 00:00:00 2001 From: Irem Uguz Date: Wed, 15 Dec 2021 10:53:21 +0000 Subject: [PATCH 020/133] support-tool: Add OWNERS file for Support Tool folders Add OWNERS files to Support Tool resource files as a follow-up to cl/3172793. Move support_tool* files under chrome/browser/ui/webui to their own dedicated folder. BUG=b:199691085 TEST-None. Change-Id: I08b30ae731fa31a86f89dd573b43ea0cb2344a8e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338912 Reviewed-by: Demetrios Papadopoulos Commit-Queue: Irem Uguz Cr-Commit-Position: refs/heads/main@{#951884} --- chrome/browser/resources/support_tool/OWNERS | 3 +++ chrome/browser/ui/BUILD.gn | 4 ++-- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc | 2 +- chrome/browser/ui/webui/support_tool/OWNERS | 3 +++ .../browser/ui/webui/{ => support_tool}/support_tool_ui.cc | 2 +- .../browser/ui/webui/{ => support_tool}/support_tool_ui.h | 6 +++--- .../webui/{ => support_tool}/support_tool_ui_browsertest.cc | 0 chrome/test/BUILD.gn | 6 ++---- chrome/test/data/webui/support_tool/OWNERS | 3 +++ 9 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 chrome/browser/resources/support_tool/OWNERS create mode 100644 chrome/browser/ui/webui/support_tool/OWNERS rename chrome/browser/ui/webui/{ => support_tool}/support_tool_ui.cc (94%) rename chrome/browser/ui/webui/{ => support_tool}/support_tool_ui.h (73%) rename chrome/browser/ui/webui/{ => support_tool}/support_tool_ui_browsertest.cc (100%) create mode 100644 chrome/test/data/webui/support_tool/OWNERS diff --git a/chrome/browser/resources/support_tool/OWNERS b/chrome/browser/resources/support_tool/OWNERS new file mode 100644 index 00000000000000..63381752696bb6 --- /dev/null +++ b/chrome/browser/resources/support_tool/OWNERS @@ -0,0 +1,3 @@ +iremuguz@google.com +pmarko@chromium.org +srad@google.com \ No newline at end of file diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 9947982f90d7d4..24f42338b55baa 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -312,8 +312,8 @@ static_library("ui") { "webui/segmentation_internals/segmentation_internals_ui.h", "webui/signin_internals_ui.cc", "webui/signin_internals_ui.h", - "webui/support_tool_ui.cc", - "webui/support_tool_ui.h", + "webui/support_tool/support_tool_ui.cc", + "webui/support_tool/support_tool_ui.h", "webui/sync_internals/sync_internals_message_handler.cc", "webui/sync_internals/sync_internals_message_handler.h", "webui/sync_internals/sync_internals_ui.cc", diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 916ae159d4a040..be000ef96cf216 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -57,7 +57,7 @@ #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" #include "chrome/browser/ui/webui/segmentation_internals/segmentation_internals_ui.h" #include "chrome/browser/ui/webui/signin_internals_ui.h" -#include "chrome/browser/ui/webui/support_tool_ui.h" +#include "chrome/browser/ui/webui/support_tool/support_tool_ui.h" #include "chrome/browser/ui/webui/sync_internals/sync_internals_ui.h" #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" #include "chrome/browser/ui/webui/usb_internals/usb_internals_ui.h" diff --git a/chrome/browser/ui/webui/support_tool/OWNERS b/chrome/browser/ui/webui/support_tool/OWNERS new file mode 100644 index 00000000000000..63381752696bb6 --- /dev/null +++ b/chrome/browser/ui/webui/support_tool/OWNERS @@ -0,0 +1,3 @@ +iremuguz@google.com +pmarko@chromium.org +srad@google.com \ No newline at end of file diff --git a/chrome/browser/ui/webui/support_tool_ui.cc b/chrome/browser/ui/webui/support_tool/support_tool_ui.cc similarity index 94% rename from chrome/browser/ui/webui/support_tool_ui.cc rename to chrome/browser/ui/webui/support_tool/support_tool_ui.cc index c6ca6a926438ca..a4d294e497c71b 100644 --- a/chrome/browser/ui/webui/support_tool_ui.cc +++ b/chrome/browser/ui/webui/support_tool/support_tool_ui.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/support_tool_ui.h" +#include "chrome/browser/ui/webui/support_tool/support_tool_ui.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/webui_util.h" diff --git a/chrome/browser/ui/webui/support_tool_ui.h b/chrome/browser/ui/webui/support_tool/support_tool_ui.h similarity index 73% rename from chrome/browser/ui/webui/support_tool_ui.h rename to chrome/browser/ui/webui/support_tool/support_tool_ui.h index 6170ff15ee1b29..df7ce474925ef7 100644 --- a/chrome/browser/ui/webui/support_tool_ui.h +++ b/chrome/browser/ui/webui/support_tool/support_tool_ui.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_UI_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_SUPPORT_TOOL_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_SUPPORT_TOOL_UI_H_ #include "content/public/browser/web_ui_controller.h" @@ -18,4 +18,4 @@ class SupportToolUI : public content::WebUIController { ~SupportToolUI() override; }; -#endif // CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_UI_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SUPPORT_TOOL_SUPPORT_TOOL_UI_H_ diff --git a/chrome/browser/ui/webui/support_tool_ui_browsertest.cc b/chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc similarity index 100% rename from chrome/browser/ui/webui/support_tool_ui_browsertest.cc rename to chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 9c0c0a19d616bb..5e93273199b781 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -2052,7 +2052,7 @@ if (!is_android && !is_fuchsia) { "../browser/ui/webui/settings/settings_clear_browsing_data_handler_browsertest.cc", "../browser/ui/webui/settings/settings_secure_dns_handler_browsertest.cc", "../browser/ui/webui/settings/settings_ui_browsertest.cc", - "../browser/ui/webui/support_tool_ui_browsertest.cc", + "../browser/ui/webui/support_tool/support_tool_ui_browsertest.cc", "../browser/ui/webui/tab_search/tab_search_ui_browsertest.cc", "../browser/ui/webui/webui_load_timer_browsertest.cc", "../browser/ui/zoom/zoom_controller_browsertest.cc", @@ -2122,9 +2122,7 @@ if (!is_android && !is_fuchsia) { # crbug.com/1279884 Flaky on CrOS if (!is_chromeos) { - sources += [ - "../browser/optimization_guide/page_content_annotations_service_browsertest.cc" - ] + sources += [ "../browser/optimization_guide/page_content_annotations_service_browsertest.cc" ] } if (enable_reporting) { diff --git a/chrome/test/data/webui/support_tool/OWNERS b/chrome/test/data/webui/support_tool/OWNERS new file mode 100644 index 00000000000000..63381752696bb6 --- /dev/null +++ b/chrome/test/data/webui/support_tool/OWNERS @@ -0,0 +1,3 @@ +iremuguz@google.com +pmarko@chromium.org +srad@google.com \ No newline at end of file From 854350ffd20d3a525be2ccee8aba908e75804dba Mon Sep 17 00:00:00 2001 From: Benedikt Meurer Date: Wed, 15 Dec 2021 11:01:02 +0000 Subject: [PATCH 021/133] [devtools] Migrate DOMTask to use AsyncTaskContext Doc: https://goo.gle/devtools-async-tasks Bug: chromium:1275875 Change-Id: I0e8c019bc0a7fd30afc55ee994c46083590efd30 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3320456 Auto-Submit: Benedikt Meurer Reviewed-by: Joey Arhar Reviewed-by: Mike West Commit-Queue: Mike West Cr-Commit-Position: refs/heads/main@{#951885} --- third_party/blink/renderer/modules/scheduler/dom_task.cc | 9 ++++----- third_party/blink/renderer/modules/scheduler/dom_task.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/third_party/blink/renderer/modules/scheduler/dom_task.cc b/third_party/blink/renderer/modules/scheduler/dom_task.cc index 2902880430bde4..a465f72646c7da 100644 --- a/third_party/blink/renderer/modules/scheduler/dom_task.cc +++ b/third_party/blink/renderer/modules/scheduler/dom_task.cc @@ -67,8 +67,8 @@ DOMTask::DOMTask(ScriptPromiseResolver* resolver, ScriptState* script_state = callback_->CallbackRelevantScriptStateOrReportError("DOMTask", "Create"); DCHECK(script_state && script_state->ContextIsValid()); - probe::AsyncTaskScheduled(ExecutionContext::From(script_state), "postTask", - &async_task_id_); + async_task_context_.Schedule(ExecutionContext::From(script_state), + "postTask"); } void DOMTask::Trace(Visitor* visitor) const { @@ -121,7 +121,7 @@ void DOMTask::InvokeInternal(ScriptState* script_state) { ExecutionContext* context = ExecutionContext::From(script_state); DCHECK(context); - probe::AsyncTask async_task(context, &async_task_id_); + probe::AsyncTask async_task(context, &async_task_context_); probe::UserCallback probe(context, "postTask", AtomicString(), true); v8::Local v8_context = script_state->GetContext(); @@ -148,8 +148,7 @@ void DOMTask::OnAbort() { ScriptState* script_state = callback_->CallbackRelevantScriptStateOrReportError("DOMTask", "Abort"); DCHECK(script_state && script_state->ContextIsValid()); - probe::AsyncTaskCanceled(ExecutionContext::From(script_state), - &async_task_id_); + async_task_context_.Cancel(); } void DOMTask::RecordTaskStartMetrics() { diff --git a/third_party/blink/renderer/modules/scheduler/dom_task.h b/third_party/blink/renderer/modules/scheduler/dom_task.h index f9c9b6e92167eb..d4a238fd586835 100644 --- a/third_party/blink/renderer/modules/scheduler/dom_task.h +++ b/third_party/blink/renderer/modules/scheduler/dom_task.h @@ -7,7 +7,7 @@ #include "base/time/time.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" @@ -42,7 +42,7 @@ class DOMTask final : public GarbageCollected { TaskHandle task_handle_; Member callback_; Member resolver_; - probe::AsyncTaskId async_task_id_; + probe::AsyncTaskContext async_task_context_; // Do not remove. For dynamic priority task queues, |signal_| ensures that the // associated WebSchedulingTaskQueue stays alive until after this task runs, // which is necessary to ensure throttling works correctly. From 2d70046f51abe4a5b75e7859527882d4ecef7e68 Mon Sep 17 00:00:00 2001 From: Pi-Hsun Shih Date: Wed, 15 Dec 2021 11:01:51 +0000 Subject: [PATCH 022/133] CCA: Migrate snackbar.js to TypeScript Bug: b:172340451 Test: tsc compiles Change-Id: I3a16cb498892b5e36ce35c6cc954af54c6a77ec5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3299753 Reviewed-by: Shik Chen Commit-Queue: Pi-Hsun Shih Cr-Commit-Position: refs/heads/main@{#951886} --- ash/webui/camera_app_ui/resources/js/js.gni | 2 +- .../resources/js/{snackbar.js => snackbar.ts} | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) rename ash/webui/camera_app_ui/resources/js/{snackbar.js => snackbar.ts} (73%) diff --git a/ash/webui/camera_app_ui/resources/js/js.gni b/ash/webui/camera_app_ui/resources/js/js.gni index c8971943ae1859..aed144cadb6670 100644 --- a/ash/webui/camera_app_ui/resources/js/js.gni +++ b/ash/webui/camera_app_ui/resources/js/js.gni @@ -56,7 +56,7 @@ compile_js_files = [ "nav.js", "new_feature_toast.js", "perf.js", - "snackbar.js", + "snackbar.ts", "sound.js", "state.js", "test_bridge.ts", diff --git a/ash/webui/camera_app_ui/resources/js/snackbar.js b/ash/webui/camera_app_ui/resources/js/snackbar.ts similarity index 73% rename from ash/webui/camera_app_ui/resources/js/snackbar.js rename to ash/webui/camera_app_ui/resources/js/snackbar.ts index 77a3872957cf9b..395baea65d4f82 100644 --- a/ash/webui/camera_app_ui/resources/js/snackbar.js +++ b/ash/webui/camera_app_ui/resources/js/snackbar.ts @@ -4,16 +4,15 @@ import * as animate from './animation.js'; import * as dom from './dom.js'; -// eslint-disable-next-line no-unused-vars import {I18nString} from './i18n_string.js'; import * as loadTimeData from './models/load_time_data.js'; /** * Shows a snackbar message. - * @param {!I18nString} label The label of the message to show. - * @param {...string} substitutions The substitutions for the label. + * @param label The label of the message to show. + * @param substitutions The substitutions for the label. */ -export function show(label, ...substitutions) { +export function show(label: I18nString, ...substitutions: string[]): void { const message = loadTimeData.getI18nMessage(label, ...substitutions); const el = dom.get('.snackbar', HTMLElement); el.textContent = ''; // Force reiterate the same message for a11y. From 20b69525ff5bbd5852dbfd17ddd70cac2c0a3eff Mon Sep 17 00:00:00 2001 From: sauski Date: Wed, 15 Dec 2021 11:18:53 +0000 Subject: [PATCH 023/133] CHIPS: Add partitioned cookie support to collected cookies view CL uses the existing auxiliary text functionality provided by the TreeView to expose the partitioned status of cookies within the CollectedCookiesViews. New functionality is added to the TreeView to support independently coloring the auxiliary text, and line-end padding is introduced to improve the view layout. Bug: 1279760 Change-Id: I44f46dc4c177c0559ecacfd4851ceb551183b27c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3307040 Reviewed-by: Mike Wasserman Commit-Queue: Theodore Olsauskas-Warren Cr-Commit-Position: refs/heads/main@{#951887} --- chrome/app/generated_resources.grd | 3 +++ ...OLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 | 1 + .../browser/ui/views/collected_cookies_views.cc | 17 +++++++++++++++++ ui/views/controls/tree/tree_view.cc | 17 +++++++++++------ .../controls/tree/tree_view_drawing_provider.cc | 7 +++++++ .../controls/tree/tree_view_drawing_provider.h | 2 ++ 6 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 7675eb1215d0b4..9848090c954e4d 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8330,6 +8330,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Reload + + Partitioned + diff --git a/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 b/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 new file mode 100644 index 00000000000000..649873ef137e48 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 @@ -0,0 +1 @@ +07d6d20a03040837c86612cc5fc57f339e14349b \ No newline at end of file diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index 40b31c522301ae..a5d4a518b27299 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc @@ -179,6 +179,8 @@ class CookiesTreeViewDrawingProvider : public views::TreeViewDrawingProvider { SkColor GetTextColorForNode(views::TreeView* tree_view, ui::TreeModelNode* node) override; + SkColor GetAuxiliaryTextColorForNode(views::TreeView* tree_view, + ui::TreeModelNode* node) override; std::u16string GetAuxiliaryTextForNode(views::TreeView* tree_view, ui::TreeModelNode* node) override; bool ShouldDrawIconForNode(views::TreeView* tree_view, @@ -202,11 +204,26 @@ SkColor CookiesTreeViewDrawingProvider::GetTextColorForNode( return color; } +SkColor CookiesTreeViewDrawingProvider::GetAuxiliaryTextColorForNode( + views::TreeView* tree_view, + ui::TreeModelNode* node) { + SkColor color = TreeViewDrawingProvider::GetTextColorForNode(tree_view, node); + return SkColorSetA(color, 0x80); +} + std::u16string CookiesTreeViewDrawingProvider::GetAuxiliaryTextForNode( views::TreeView* tree_view, ui::TreeModelNode* node) { if (annotations_.find(node) != annotations_.end()) return annotations_[node]; + + CookieTreeNode* cookie_node = static_cast(node); + if (cookie_node->GetDetailedInfo().node_type == + CookieTreeNode::DetailedInfo::TYPE_COOKIE && + cookie_node->GetDetailedInfo().cookie->IsPartitioned()) { + return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE); + } + return TreeViewDrawingProvider::GetAuxiliaryTextForNode(tree_view, node); } diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc index 500ccb2e567d34..9f6a3eeb107c9d 100644 --- a/ui/views/controls/tree/tree_view.cc +++ b/ui/views/controls/tree/tree_view.cc @@ -61,6 +61,8 @@ static constexpr int kArrowRegionSize = 12; // Padding around the text (on each side). static constexpr int kTextVerticalPadding = 3; static constexpr int kTextHorizontalPadding = 2; +// Padding between the auxiliary text and the end of the line, handles RTL. +static constexpr int kAuxiliaryTextLineEndPadding = 5; // How much children are indented from their parent. static constexpr int kIndent = 20; @@ -1127,7 +1129,8 @@ void TreeView::PaintRow(gfx::Canvas* canvas, : gfx::Canvas::TEXT_ALIGN_RIGHT; canvas->DrawStringRectWithFlags( aux_text, font_list_, - drawing_provider()->GetTextColorForNode(this, node->model_node()), + drawing_provider()->GetAuxiliaryTextColorForNode(this, + node->model_node()), aux_text_bounds, align); } } @@ -1257,14 +1260,16 @@ gfx::Rect TreeView::GetTextBoundsForNode(InternalNode* node) { // leading aligned. gfx::Rect TreeView::GetAuxiliaryTextBoundsForNode(InternalNode* node) { gfx::Rect text_bounds = GetTextBoundsForNode(node); - int width = base::i18n::IsRTL() ? text_bounds.x() - kTextHorizontalPadding * 2 - : bounds().width() - text_bounds.right() - - 2 * kTextHorizontalPadding; + int width = base::i18n::IsRTL() + ? text_bounds.x() - kTextHorizontalPadding - + kAuxiliaryTextLineEndPadding + : bounds().width() - text_bounds.right() - + kTextHorizontalPadding - kAuxiliaryTextLineEndPadding; if (width < 0) return gfx::Rect(); int x = base::i18n::IsRTL() - ? kTextHorizontalPadding - : bounds().right() - width - kTextHorizontalPadding; + ? kAuxiliaryTextLineEndPadding + : bounds().right() - width - kAuxiliaryTextLineEndPadding; return gfx::Rect(x, text_bounds.y(), width, text_bounds.height()); } diff --git a/ui/views/controls/tree/tree_view_drawing_provider.cc b/ui/views/controls/tree/tree_view_drawing_provider.cc index 846f90310db434..e79f66e004d0af 100644 --- a/ui/views/controls/tree/tree_view_drawing_provider.cc +++ b/ui/views/controls/tree/tree_view_drawing_provider.cc @@ -33,6 +33,13 @@ SkColor TreeViewDrawingProvider::GetTextColorForNode(TreeView* tree_view, return tree_view->GetColorProvider()->GetColor(color_id); } +SkColor TreeViewDrawingProvider::GetAuxiliaryTextColorForNode( + TreeView* tree_view, + ui::TreeModelNode* node) { + // Default to using the same color as the primary text. + return GetTextColorForNode(tree_view, node); +} + std::u16string TreeViewDrawingProvider::GetAuxiliaryTextForNode( TreeView* tree_view, ui::TreeModelNode* node) { diff --git a/ui/views/controls/tree/tree_view_drawing_provider.h b/ui/views/controls/tree/tree_view_drawing_provider.h index 7169e587cc45a7..626c6d814dc160 100644 --- a/ui/views/controls/tree/tree_view_drawing_provider.h +++ b/ui/views/controls/tree/tree_view_drawing_provider.h @@ -32,6 +32,8 @@ class VIEWS_EXPORT TreeViewDrawingProvider { ui::TreeModelNode* node); virtual SkColor GetTextColorForNode(TreeView* tree_view, ui::TreeModelNode* node); + virtual SkColor GetAuxiliaryTextColorForNode(TreeView* tree_view, + ui::TreeModelNode* node); // The auxiliary text for a node is descriptive text drawn on the trailing end // of the node's row in the treeview. From fbb060096cc87174c90ccf6dd9ba3051b86ac7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebel?= Date: Wed, 15 Dec 2021 11:19:03 +0000 Subject: [PATCH 024/133] [iOS] Better separator in the web sign-in dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes separator issue: https://screenshot.googleplex.com/8exAX9YE8uxyrzk Dark mode: before: https://drive.google.com/file/d/1XgVFxbu1R5NTl1pj-whQzqin37OhuokP/view?usp=sharing&resourcekey=0-4XAIKPp7gWGHMfJ6MLCwTg after: https://drive.google.com/file/d/1Ap9XqAKzq1M1q1AcFTnbypl9JqZOgVrW/view?usp=sharing&resourcekey=0-K6sWS7rWJU2O8c9D4jE7bA Light mode: before: https://drive.google.com/file/d/1J7Puy8knURtmGy9u9XAyIuJ8kK6kCX2T/view?usp=sharing&resourcekey=0---XGNqRbQ4CYIvlv1KVcwg after: https://drive.google.com/file/d/1BNJlRTWdBiLWvE6bzZ_wPUSOkfqaMwdx/view?usp=sharing&resourcekey=0-FYrWe93Z9HlpGcFdHNyo2A Fixed: 1261887 Change-Id: If37c571a7aaa50d2b947136caa3b85cce85686e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3339313 Auto-Submit: Jérôme Lebel Reviewed-by: Gauthier Ambard Commit-Queue: Jérôme Lebel Cr-Commit-Position: refs/heads/main@{#951888} --- .../consistency_account_chooser/identity_item_configurator.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm index 816b54cc2c141f..586b54342e7e28 100644 --- a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm +++ b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_account_chooser/identity_item_configurator.mm @@ -18,6 +18,7 @@ - (void)configureIdentityChooser:(TableViewIdentityItem*)item { item.email = self.email; item.avatar = self.avatar; item.selected = self.selected; + item.useCustomSeparator = NO; } - (NSString*)description { From 64b7127f7397d0af5c9bf9ecef5cfa4669198d0b Mon Sep 17 00:00:00 2001 From: chromium-autoroll Date: Wed, 15 Dec 2021 11:24:33 +0000 Subject: [PATCH 025/133] Roll ChromeOS Bigcore AFDO profile from 98-4744.1-1639397847-benchmark-98.0.4758.7-r1 to 98-4744.1-1639397847-benchmark-98.0.4758.8-r1 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/cros-afdo-bigcore-chromium Please CC c-compiler-chrome@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: c-compiler-chrome@google.com Change-Id: Iaca90e9732dbae4a0864ee66a9e9e819204e5d68 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341613 Commit-Queue: chromium-autoroll Bot-Commit: chromium-autoroll Cr-Commit-Position: refs/heads/main@{#951889} --- chromeos/profiles/bigcore.afdo.newest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromeos/profiles/bigcore.afdo.newest.txt b/chromeos/profiles/bigcore.afdo.newest.txt index ee4397a58dfec8..fecc011dfc8b32 100644 --- a/chromeos/profiles/bigcore.afdo.newest.txt +++ b/chromeos/profiles/bigcore.afdo.newest.txt @@ -1 +1 @@ -chromeos-chrome-amd64-bigcore-98-4744.1-1639397847-benchmark-98.0.4758.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-bigcore-98-4744.1-1639397847-benchmark-98.0.4758.8-r1-redacted.afdo.xz From d773dfc5f7821948f66c826d239e7218ae3e4eb9 Mon Sep 17 00:00:00 2001 From: Gauthier Ambard Date: Wed, 15 Dec 2021 11:26:02 +0000 Subject: [PATCH 026/133] [iOS] Increase the context menu lines number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The context menu should be displaying the full URL on more line to give more information to the user. Fixed: 1278734 Change-Id: I459a20b66ffaf80037a7039ad803b26de8e397de Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341053 Commit-Queue: Gauthier Ambard Auto-Submit: Gauthier Ambard Reviewed-by: Ewann Pellé Commit-Queue: Ewann Pellé Cr-Commit-Position: refs/heads/main@{#951890} --- ios/chrome/browser/ui/context_menu/link_no_preview_view.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm b/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm index bd22308973716b..05ab8e9f35a056 100644 --- a/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm +++ b/ios/chrome/browser/ui/context_menu/link_no_preview_view.mm @@ -24,6 +24,8 @@ const CGFloat kLeadingMargin = 15; // Margin between the favicon and the text. const CGFloat kFaviconToTextMargin = 14; +// Number of lines for the subtitle. +const CGFloat kNumberOfSubtitleLines = 3; } // namespace @@ -45,6 +47,7 @@ - (instancetype)initWithTitle:(NSString*)title subtitle:(NSString*)subtitle { _title = [[UILabel alloc] init]; _title.translatesAutoresizingMaskIntoConstraints = NO; _title.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; + _title.adjustsFontForContentSizeCategory = YES; _title.textColor = [UIColor colorNamed:kTextPrimaryColor]; _title.text = title; [self addSubview:_title]; @@ -52,6 +55,8 @@ - (instancetype)initWithTitle:(NSString*)title subtitle:(NSString*)subtitle { _subtitle = [[UILabel alloc] init]; _subtitle.translatesAutoresizingMaskIntoConstraints = NO; _subtitle.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; + _subtitle.adjustsFontForContentSizeCategory = YES; + _subtitle.numberOfLines = kNumberOfSubtitleLines; _subtitle.textColor = [UIColor colorNamed:kTextSecondaryColor]; _subtitle.text = subtitle; [self addSubview:_subtitle]; From 145de12b1bedc4fbd412ef58ca6c1d9f33903350 Mon Sep 17 00:00:00 2001 From: Georg Neis Date: Wed, 15 Dec 2021 11:31:42 +0000 Subject: [PATCH 027/133] crosapi: Remove two deprecated fields from BrowserInitParams Namely is_incognito_deprecated and restore_last_session_deprecated. They are unused (the information is encoded via initial_browser_action instead). Bug: chromium:1194304 Change-Id: Ia8f74d3eee6a4129782e09afaf41c2f093d3d968 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3329856 Reviewed-by: Nicolas Ouellet-Payeur Reviewed-by: Hidehiko Abe Reviewed-by: Ken Rockot Reviewed-by: Marc Treib Commit-Queue: Georg Neis Cr-Commit-Position: refs/heads/main@{#951891} --- chrome/browser/ash/crosapi/crosapi_util.cc | 6 ------ chrome/browser/prefs/incognito_mode_prefs.cc | 2 -- chrome/browser/ui/startup/startup_browser_creator.cc | 4 ---- chromeos/crosapi/mojom/crosapi.mojom | 11 ++--------- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index d8d89818c428ac..fd2906cb3f4121 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc @@ -300,12 +300,6 @@ mojom::BrowserInitParamsPtr GetBrowserInitParams( params->idle_info = IdleServiceAsh::ReadIdleInfoFromSystem(); params->native_theme_info = NativeThemeServiceAsh::GetNativeThemeInfo(); - params->is_incognito_deprecated = - initial_browser_action.action == - crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; - params->restore_last_session_deprecated = - initial_browser_action.action == - crosapi::mojom::InitialBrowserAction::kRestoreLastSession; params->initial_browser_action = initial_browser_action.action; if (initial_browser_action.action == crosapi::mojom::InitialBrowserAction::kOpenWindowWithUrls) { diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc index 9e58406d7e3a45..604ac3b918f817 100644 --- a/chrome/browser/prefs/incognito_mode_prefs.cc +++ b/chrome/browser/prefs/incognito_mode_prefs.cc @@ -82,8 +82,6 @@ bool IncognitoModePrefs::ShouldLaunchIncognito( IncognitoModePrefs::Availability::kForced; #if BUILDFLAG(IS_CHROMEOS_LACROS) auto* init_params = chromeos::LacrosService::Get()->init_params(); - // TODO(https://crbug.com/1194304): Remove in M93. - should_use_incognito |= init_params->is_incognito_deprecated; should_use_incognito |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 16ad496112587b..7b3d912fa3d7e3 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -516,8 +516,6 @@ Profile* StartupBrowserCreator::GetPrivateProfileIfRequested( bool expect_incognito = command_line.HasSwitch(switches::kIncognito); #if BUILDFLAG(IS_CHROMEOS_LACROS) auto* init_params = chromeos::LacrosService::Get()->init_params(); - // TODO(https://crbug.com/1194304): Remove in M93. - expect_incognito |= init_params->is_incognito_deprecated; expect_incognito |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; @@ -707,8 +705,6 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref( pref.type = SessionStartupPref::DEFAULT; return pref; } - // TODO(https://crbug.com/1194304): Remove in M93. - restore_last_session |= init_params->restore_last_session_deprecated; restore_last_session |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kRestoreLastSession; diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index 966421b49e17e8..ed64d770d33536 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom @@ -695,17 +695,10 @@ struct BrowserInitParams { [MinVersion=12] IdleInfo? idle_info@12; - // Launches an incognito window. - // Added in M91. - // TODO(https://crbug.com/1194304): Remove in M93. [MinVersion=13] - bool is_incognito_deprecated@13; - - // Restores tabs from the last session. - // Added in M91. - // TODO(https://crbug.com/1194304): Remove in M93. + bool REMOVED_13@13; [MinVersion=14] - bool restore_last_session_deprecated@14; + bool REMOVED_14@14; // Defines which windows or tabs to restore on launch. [MinVersion=15] From 537ed4eebe8c6b7791f8acdd6f2c77464199c570 Mon Sep 17 00:00:00 2001 From: Marc Treib Date: Wed, 15 Dec 2021 11:36:16 +0000 Subject: [PATCH 028/133] Sheriff: Disable flaky test NoAutofillSugggestionForCompanyName Bug: 1279102 Change-Id: Ic3305f4778ad436124c41316950ba2563504a664 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340935 Reviewed-by: Victor Vianna Commit-Queue: Marc Treib Cr-Commit-Position: refs/heads/main@{#951892} --- chrome/browser/autofill/autofill_interactive_uitest.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 3a84a5761ad356..3d02cc36032e40 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc @@ -2151,8 +2151,16 @@ IN_PROC_BROWSER_TEST_F(AutofillCompanyInteractiveTest, } // Test that Autofill does not fill in Company Name if disabled +// TODO(crbug.com/1279102): Flaky on Win and Mac. +#if defined(OS_WIN) || defined(OS_MAC) +#define MAYBE_NoAutofillSugggestionForCompanyName \ + DISABLED_NoAutofillSugggestionForCompanyName +#else +#define MAYBE_NoAutofillSugggestionForCompanyName \ + NoAutofillSugggestionForCompanyName +#endif IN_PROC_BROWSER_TEST_F(AutofillCompanyInteractiveTest, - NoAutofillSugggestionForCompanyName) { + MAYBE_NoAutofillSugggestionForCompanyName) { CreateTestProfile(); std::string company_name("Initech"); From de8c857c883dc8278c29ee8609adf5d900eeb446 Mon Sep 17 00:00:00 2001 From: chromium-autoroll Date: Wed, 15 Dec 2021 11:36:22 +0000 Subject: [PATCH 029/133] Roll ChromeOS Atom AFDO profile from 98-4744.1-1639393599-benchmark-98.0.4758.7-r1 to 98-4744.1-1639393599-benchmark-98.0.4758.8-r1 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/cros-afdo-atom-chromium Please CC c-compiler-chrome@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: c-compiler-chrome@google.com Change-Id: I986cd13090609858325037ff5d0cdc3ba43b64f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341615 Commit-Queue: chromium-autoroll Bot-Commit: chromium-autoroll Cr-Commit-Position: refs/heads/main@{#951893} --- chromeos/profiles/atom.afdo.newest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromeos/profiles/atom.afdo.newest.txt b/chromeos/profiles/atom.afdo.newest.txt index efa35adbebef6a..0819b762db56e3 100644 --- a/chromeos/profiles/atom.afdo.newest.txt +++ b/chromeos/profiles/atom.afdo.newest.txt @@ -1 +1 @@ -chromeos-chrome-amd64-atom-98-4744.1-1639393599-benchmark-98.0.4758.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-atom-98-4744.1-1639393599-benchmark-98.0.4758.8-r1-redacted.afdo.xz From 1b94b6b7c350d6bfb37d9147a5f43622e51d19be Mon Sep 17 00:00:00 2001 From: chromium-internal-autoroll Date: Wed, 15 Dec 2021 11:44:15 +0000 Subject: [PATCH 030/133] Roll Projector App from FchxTKMvf... to jZ1wDChdu... Release_Notes: http://go/projector_app-x20/relnotes/Main/projector_app_nightly_202112150100_RC00.html https://chrome-infra-packages.appspot.com/p/chromeos_internal/apps/projector_app/app/+/jZ1wDChducDMF-MWFvXLkLZpk_AWan76x5hDRvEhqLoC If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://skia-autoroll.corp.goog/r/projector-app-chromium-autoroll Please CC cros-projector-oncall@grotations.appspotmail.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Cq-Include-Trybots: luci.chrome.try:chromeos-betty-pi-arc-chrome;luci.chrome.try:linux-chromeos-chrome Bug: b/206375321,b/210012141,b/210057761 Tbr: cros-projector-oncall@grotations.appspotmail.com Change-Id: Ia5a46d789110e84c5def91580e907127dc49258d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341371 Commit-Queue: chromium-internal-autoroll Bot-Commit: chromium-internal-autoroll Cr-Commit-Position: refs/heads/main@{#951894} --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 4e3304b69e5ff9..9999451eb2e608 100644 --- a/DEPS +++ b/DEPS @@ -1741,7 +1741,7 @@ deps = { 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'FchxTKMvfxSkGTLMU23cSyqvexH52wHP-zPlLYF6QqUC', + 'version': 'jZ1wDChducDMF-MWFvXLkLZpk_AWan76x5hDRvEhqLoC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', From 528c7e62a4714037dd83978ca23ae77cd054b2af Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Wed, 15 Dec 2021 11:44:34 +0000 Subject: [PATCH 031/133] [sync] Leverage bookmark parent GUID for incremental updates With the recent https://crrev.com/c/3327210 the parent GUID in BookmarkSpecifics is considered mandatory, which is possible because legacy data downloaded from the server gets the field auto-populated client-side. This allows rewriting BookmarkRemoteUpdatesHandler to be GUID-centric rather than sync-id-centric, which unblocks the deprecation of the legacy field |SyncEntity.parent_id|, no longer consumed for incremental updates (with the exception of legacy data, which relies on this field for auto-populating the parent GUID). The rewrite should not lead to user-visible behavioral differences, at least for users in a non-corrupt state, but this is hard to prove so let's keep an eye on the various UMA metrics for incremental updates to rule out regressions. Bug: 1274122 Change-Id: Iacc125edfdaa53df7f0d868f8cfa438831d3a95d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3327034 Reviewed-by: Rushan Suleymanov Commit-Queue: Mikel Astiz Cr-Commit-Position: refs/heads/main@{#951895} --- .../bookmark_remote_updates_handler.cc | 117 +++++++++--------- ...ookmark_remote_updates_handler_unittest.cc | 6 - 2 files changed, 60 insertions(+), 63 deletions(-) diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.cc b/components/sync_bookmarks/bookmark_remote_updates_handler.cc index 7d43da7d240b3d..d200f351e78ce0 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.cc @@ -16,7 +16,6 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/strings/string_piece.h" #include "base/trace_event/trace_event.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_node.h" @@ -72,23 +71,26 @@ void LogProblematicBookmark(RemoteBookmarkUpdateError problem) { // emit updates in top-down order. |ordered_updates| must not be null because // traversed updates are appended to |*ordered_updates|. void TraverseAndAppendChildren( - const base::StringPiece& node_id, - const std::unordered_map& id_to_updates, - const std::unordered_map, - base::StringPieceHash>& node_to_children, + const base::GUID& node_guid, + const std::unordered_multimap& guid_to_updates, + const std::unordered_map, + base::GUIDHash>& node_to_children, std::vector* ordered_updates) { // If no children to traverse, we are done. - if (node_to_children.count(node_id) == 0) { + if (node_to_children.count(node_guid) == 0) { return; } // Recurse over all children. - for (const base::StringPiece& child : node_to_children.at(node_id)) { - DCHECK_NE(id_to_updates.count(child), 0U); - ordered_updates->push_back(id_to_updates.at(child)); - TraverseAndAppendChildren(child, id_to_updates, node_to_children, + for (const base::GUID& child : node_to_children.at(node_guid)) { + auto range = guid_to_updates.equal_range(child); + DCHECK(range.first != range.second); + for (auto it = range.first; it != range.second; ++it) { + ordered_updates->push_back(it->second); + } + TraverseAndAppendChildren(child, guid_to_updates, node_to_children, ordered_updates); } } @@ -163,6 +165,16 @@ bool IsValidUpdate(const syncer::EntityData& update_entity) { return true; } +// Determines the parent's GUID included in |update_entity|. |update_entity| +// must be a valid update as defined in IsValidUpdate(). +base::GUID GetParentGUIDInUpdate(const syncer::EntityData& update_entity) { + DCHECK(IsValidUpdate(update_entity)); + base::GUID parent_guid = base::GUID::ParseLowercase( + update_entity.specifics.bookmark().parent_guid()); + DCHECK(parent_guid.is_valid()); + return parent_guid; +} + void ApplyRemoteUpdate( const syncer::UpdateResponseData& update, const SyncedBookmarkTracker::Entity* tracked_entity, @@ -407,15 +419,15 @@ BookmarkRemoteUpdatesHandler::ReorderValidUpdates( // 3. Start at each root in |roots|, emit the update and recurse over its // children. - std::unordered_map - id_to_updates; - std::set roots; - std::unordered_map, - base::StringPieceHash> - parent_to_children; + // Normally there shouldn't be multiple updates for the same GUID, but let's + // avoiding dedupping here just in case (e.g. the could in theory be a + // combination of client-tagged and non-client-tagged updated that + // ModelTypeWorker failed to deduplicate. + std::unordered_multimap + guid_to_updates; - // Add only valid, non-deletions to |id_to_updates|. + // Add only valid, non-deletions to |guid_to_updates|. int invalid_updates_count = 0; int root_node_updates_count = 0; for (const syncer::UpdateResponseData& update : *updates) { @@ -432,35 +444,41 @@ BookmarkRemoteUpdatesHandler::ReorderValidUpdates( ++invalid_updates_count; continue; } - id_to_updates[update_entity.id] = &update; + base::GUID guid = + base::GUID::ParseLowercase(update_entity.specifics.bookmark().guid()); + DCHECK(guid.is_valid()); + guid_to_updates.emplace(std::move(guid), &update); } - // Iterate over |id_to_updates| and construct |roots| and + + // Iterate over |guid_to_updates| and construct |roots| and // |parent_to_children|. - for (const std::pair& pair : - id_to_updates) { + std::set roots; + std::unordered_map, base::GUIDHash> + parent_to_children; + for (const auto& pair : guid_to_updates) { const syncer::EntityData& update_entity = pair.second->entity; - parent_to_children[update_entity.parent_id].push_back(update_entity.id); + base::GUID parent_guid = GetParentGUIDInUpdate(update_entity); + base::GUID child_guid = + base::GUID::ParseLowercase(update_entity.specifics.bookmark().guid()); + DCHECK(child_guid.is_valid()); + + parent_to_children[parent_guid].emplace_back(std::move(child_guid)); // If this entity's parent has no pending update, add it to |roots|. - if (id_to_updates.count(update_entity.parent_id) == 0) { - roots.insert(update_entity.parent_id); + if (guid_to_updates.count(parent_guid) == 0) { + roots.insert(std::move(parent_guid)); } } // |roots| contains only root of all trees in the forest all of which are // ready to be processed because none has a pending update. std::vector ordered_updates; - for (const base::StringPiece& root : roots) { - TraverseAndAppendChildren(root, id_to_updates, parent_to_children, + for (const base::GUID& root : roots) { + TraverseAndAppendChildren(root, guid_to_updates, parent_to_children, &ordered_updates); } // Add deletions. for (const syncer::UpdateResponseData& update : *updates) { const syncer::EntityData& update_entity = update.entity; - // Ignore updates to root nodes. - if (IsPermanentNodeUpdate(update_entity)) { - continue; - } - if (update_entity.is_deleted()) { + if (!IsPermanentNodeUpdate(update_entity) && update_entity.is_deleted()) { ordered_updates.push_back(&update); } } @@ -543,21 +561,12 @@ BookmarkRemoteUpdatesHandler::ProcessCreate( const bookmarks::BookmarkNode* parent_node = GetParentNode(update_entity); if (!parent_node) { // If we cannot find the parent, we can do nothing. - DLOG(ERROR) - << "Could not find parent of node being added." - << " Node title: " - << update_entity.specifics.bookmark().legacy_canonicalized_title() - << ", parent id = " << update_entity.parent_id; LogProblematicBookmark(RemoteBookmarkUpdateError::kMissingParentNode); bookmark_tracker_->RecordIgnoredServerUpdateDueToMissingParent( update.response_version); return nullptr; } if (!parent_node->is_folder()) { - DLOG(ERROR) - << "Parent node is not a folder. Node title: " - << update_entity.specifics.bookmark().legacy_canonicalized_title() - << ", parent id: " << update_entity.parent_id; LogProblematicBookmark(RemoteBookmarkUpdateError::kParentNotFolder); return nullptr; } @@ -598,23 +607,18 @@ void BookmarkRemoteUpdatesHandler::ProcessUpdate( DCHECK(old_parent->is_folder()); const SyncedBookmarkTracker::Entity* new_parent_entity = - bookmark_tracker_->GetEntityForSyncId(update_entity.parent_id); + bookmark_tracker_->GetEntityForGUID(GetParentGUIDInUpdate(update_entity)); if (!new_parent_entity) { - DLOG(ERROR) << "Could not update node. Parent node doesn't exist: " - << update_entity.parent_id; LogProblematicBookmark(RemoteBookmarkUpdateError::kMissingParentEntity); return; } const bookmarks::BookmarkNode* new_parent = new_parent_entity->bookmark_node(); if (!new_parent) { - DLOG(ERROR) - << "Could not update node. Parent node has been deleted already."; LogProblematicBookmark(RemoteBookmarkUpdateError::kMissingParentNode); return; } if (!new_parent->is_folder()) { - DLOG(ERROR) << "Could not update node. Parent not is not a folder."; LogProblematicBookmark(RemoteBookmarkUpdateError::kParentNotFolder); return; } @@ -711,15 +715,14 @@ BookmarkRemoteUpdatesHandler::ProcessConflict( DCHECK(old_parent->is_folder()); const SyncedBookmarkTracker::Entity* new_parent_entity = - bookmark_tracker_->GetEntityForSyncId(update_entity.parent_id); + bookmark_tracker_->GetEntityForGUID(GetParentGUIDInUpdate(update_entity)); + // The |new_parent_entity| could be null in some racy conditions. For // example, when a client A moves a node and deletes the old parent and // commits, and then updates the node again, and at the same time client B // updates before receiving the move updates. The client B update will arrive // at client A after the parent entity has been deleted already. if (!new_parent_entity) { - DLOG(ERROR) << "Could not update node. Parent node doesn't exist: " - << update_entity.parent_id; LogProblematicBookmark( RemoteBookmarkUpdateError::kMissingParentEntityInConflict); return tracked_entity; @@ -731,8 +734,6 @@ BookmarkRemoteUpdatesHandler::ProcessConflict( // entails child deletion, and if this child has been updated on another // client, this would cause conflict. if (!new_parent) { - DLOG(ERROR) - << "Could not update node. Parent node has been deleted already."; LogProblematicBookmark( RemoteBookmarkUpdateError::kMissingParentNodeInConflict); return tracked_entity; @@ -780,8 +781,10 @@ void BookmarkRemoteUpdatesHandler::RemoveEntityAndChildrenFromTracker( const bookmarks::BookmarkNode* BookmarkRemoteUpdatesHandler::GetParentNode( const syncer::EntityData& update_entity) const { + DCHECK(IsValidBookmarkSpecifics(update_entity.specifics.bookmark())); + const SyncedBookmarkTracker::Entity* parent_entity = - bookmark_tracker_->GetEntityForSyncId(update_entity.parent_id); + bookmark_tracker_->GetEntityForGUID(GetParentGUIDInUpdate(update_entity)); if (!parent_entity) { return nullptr; } diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc index 0fe4b0057cfc93..1bdc0f307b6417 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc @@ -174,10 +174,7 @@ syncer::UpdateResponseData CreateUpdateResponseData( CreateTombstoneResponseData(guid, version); response_data.entity.originator_client_item_id = guid.AsLowercaseString(); - response_data.entity.parent_id = GetFakeServerIdFromGUID(parent_guid); - // Note that proto field |parent_guid| is currently only used to consider - // specifics valid. sync_pb::BookmarkSpecifics* bookmark_specifics = response_data.entity.specifics.mutable_bookmark(); bookmark_specifics->set_guid(guid.AsLowercaseString()); @@ -931,7 +928,6 @@ TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, syncer::UpdateResponseDataList updates; syncer::EntityData data; data.id = GetFakeServerIdFromGUID(kParentGuid); - data.parent_id = kBookmarkBarId; sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid(kParentGuid.AsLowercaseString()); @@ -983,7 +979,6 @@ TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, syncer::UpdateResponseDataList updates; syncer::EntityData data; data.id = "server_id"; - data.parent_id = kBookmarkBarId; sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid( @@ -1028,7 +1023,6 @@ TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, syncer::UpdateResponseDataList updates; syncer::EntityData data; data.id = "server_id"; - data.parent_id = kBookmarkBarId; sync_pb::BookmarkSpecifics* bookmark_specifics = data.specifics.mutable_bookmark(); bookmark_specifics->set_guid( From 8da7ce7a28b6df9c295088db98f950e37fd3fab4 Mon Sep 17 00:00:00 2001 From: Nohemi Fernandez Date: Wed, 15 Dec 2021 11:45:22 +0000 Subject: [PATCH 032/133] Update SyncedTabDelegate interface to use Profile::IsChild terminology. Refactor use cases of ProfileIsSupervised method to reflect supervised user terminology "child account". Bug: 1275169 Change-Id: I433ffa32dd321aaf27915349e09c02b20c3d5c16 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3339011 Reviewed-by: Marc Treib Commit-Queue: Nohemi Fernandez Cr-Commit-Position: refs/heads/main@{#951896} --- .../ui/sync/tab_contents_synced_tab_delegate.cc | 4 ++-- .../browser/ui/sync/tab_contents_synced_tab_delegate.h | 2 +- .../sync_sessions/local_session_event_handler_impl.cc | 6 +++--- .../local_session_event_handler_impl_unittest.cc | 6 +++--- components/sync_sessions/synced_tab_delegate.h | 4 ++-- .../test_synced_window_delegates_getter.cc | 10 +++++----- .../test_synced_window_delegates_getter.h | 8 ++++---- .../browser/sync/ios_chrome_synced_tab_delegate.h | 2 +- .../browser/sync/ios_chrome_synced_tab_delegate.mm | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc index ee3f89b8c4c2ed..fb471325f9c821 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc @@ -120,7 +120,7 @@ void TabContentsSyncedTabDelegate::GetSerializedNavigationAtIndex( } } -bool TabContentsSyncedTabDelegate::ProfileIsSupervised() const { +bool TabContentsSyncedTabDelegate::ProfileHasChildAccount() const { return Profile::FromBrowserContext(web_contents_->GetBrowserContext()) ->IsChild(); } @@ -145,7 +145,7 @@ bool TabContentsSyncedTabDelegate::ShouldSync( GetWindowId()) == nullptr) return false; - if (ProfileIsSupervised() && !GetBlockedNavigations()->empty()) + if (ProfileHasChildAccount() && !GetBlockedNavigations()->empty()) return true; if (IsInitialBlankNavigation()) diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h index d2b5d00916aeb5..6a8a71e7f13e14 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h @@ -46,7 +46,7 @@ class TabContentsSyncedTabDelegate : public sync_sessions::SyncedTabDelegate { void GetSerializedNavigationAtIndex( int i, sessions::SerializedNavigationEntry* serialized_entry) const override; - bool ProfileIsSupervised() const override; + bool ProfileHasChildAccount() const override; const std::vector>* GetBlockedNavigations() const override; bool ShouldSync(sync_sessions::SyncSessionsClient* sessions_client) override; diff --git a/components/sync_sessions/local_session_event_handler_impl.cc b/components/sync_sessions/local_session_event_handler_impl.cc index bd6668d2535fed..44f17cabd5d2f1 100644 --- a/components/sync_sessions/local_session_event_handler_impl.cc +++ b/components/sync_sessions/local_session_event_handler_impl.cc @@ -371,7 +371,7 @@ sync_pb::SessionTab LocalSessionEventHandlerImpl::GetTabSpecificsFromDelegate( const int min_index = std::max(0, current_index - kMaxSyncNavigationCount); const int max_index = std::min(current_index + kMaxSyncNavigationCount, tab_delegate.GetEntryCount()); - bool is_supervised = tab_delegate.ProfileIsSupervised(); + bool has_child_account = tab_delegate.ProfileHasChildAccount(); for (int i = min_index; i < max_index; ++i) { if (!tab_delegate.GetVirtualURLAtIndex(i).is_valid()) { @@ -391,7 +391,7 @@ sync_pb::SessionTab LocalSessionEventHandlerImpl::GetTabSpecificsFromDelegate( if (!page_language.empty()) navigation->set_page_language(page_language); - if (is_supervised) { + if (has_child_account) { navigation->set_blocked_state( sync_pb::TabNavigation_BlockedState_STATE_ALLOWED); } @@ -403,7 +403,7 @@ sync_pb::SessionTab LocalSessionEventHandlerImpl::GetTabSpecificsFromDelegate( specifics.set_current_navigation_index(specifics.navigation_size() - 1); } - if (is_supervised) { + if (has_child_account) { const std::vector>* blocked_navigations = tab_delegate.GetBlockedNavigations(); DCHECK(blocked_navigations); diff --git a/components/sync_sessions/local_session_event_handler_impl_unittest.cc b/components/sync_sessions/local_session_event_handler_impl_unittest.cc index 2957199c623a64..3b54002f0c534d 100644 --- a/components/sync_sessions/local_session_event_handler_impl_unittest.cc +++ b/components/sync_sessions/local_session_event_handler_impl_unittest.cc @@ -275,8 +275,8 @@ TEST_F(LocalSessionEventHandlerImplTest, ASSERT_EQ(3, session_tab.navigation_size()); } -// Tests that for supervised users blocked navigations are recorded and marked -// as such, while regular navigations are marked as allowed. +// Tests that for child account users blocked navigations are recorded and +// marked as such, while regular navigations are marked as allowed. TEST_F(LocalSessionEventHandlerImplTest, BlockedNavigations) { AddWindow(kWindowId1); TestSyncedTabDelegate* tab = AddTabWithTime(kWindowId1, kFoo1, kTime1); @@ -296,7 +296,7 @@ TEST_F(LocalSessionEventHandlerImplTest, BlockedNavigations) { blocked_navigations.push_back(std::move(entry2)); blocked_navigations.push_back(std::move(entry3)); - tab->set_is_supervised(true); + tab->set_has_child_account(true); tab->set_blocked_navigations(blocked_navigations); InitHandler(); diff --git a/components/sync_sessions/synced_tab_delegate.h b/components/sync_sessions/synced_tab_delegate.h index bf48b06207bd2e..142d4e89bf6ea1 100644 --- a/components/sync_sessions/synced_tab_delegate.h +++ b/components/sync_sessions/synced_tab_delegate.h @@ -50,8 +50,8 @@ class SyncedTabDelegate { int i, sessions::SerializedNavigationEntry* serialized_entry) const = 0; - // Supervised user related methods. - virtual bool ProfileIsSupervised() const = 0; + // Methods to restrict navigation for child account users. + virtual bool ProfileHasChildAccount() const = 0; virtual const std::vector< std::unique_ptr>* GetBlockedNavigations() const = 0; diff --git a/components/sync_sessions/test_synced_window_delegates_getter.cc b/components/sync_sessions/test_synced_window_delegates_getter.cc index 67146f0ca64004..7999045eaed949 100644 --- a/components/sync_sessions/test_synced_window_delegates_getter.cc +++ b/components/sync_sessions/test_synced_window_delegates_getter.cc @@ -128,12 +128,12 @@ std::string TestSyncedTabDelegate::GetExtensionAppId() const { return std::string(); } -bool TestSyncedTabDelegate::ProfileIsSupervised() const { - return is_supervised_; +bool TestSyncedTabDelegate::ProfileHasChildAccount() const { + return has_child_account_; } -void TestSyncedTabDelegate::set_is_supervised(bool is_supervised) { - is_supervised_ = is_supervised; +void TestSyncedTabDelegate::set_has_child_account(bool has_child_account) { + has_child_account_ = has_child_account; } const std::vector>* @@ -248,7 +248,7 @@ void PlaceholderTabDelegate::GetSerializedNavigationAtIndex( NOTREACHED(); } -bool PlaceholderTabDelegate::ProfileIsSupervised() const { +bool PlaceholderTabDelegate::ProfileHasChildAccount() const { NOTREACHED(); return false; } diff --git a/components/sync_sessions/test_synced_window_delegates_getter.h b/components/sync_sessions/test_synced_window_delegates_getter.h index 86c6b83fd7be1f..62dddb31fddfe2 100644 --- a/components/sync_sessions/test_synced_window_delegates_getter.h +++ b/components/sync_sessions/test_synced_window_delegates_getter.h @@ -61,8 +61,8 @@ class TestSyncedTabDelegate : public SyncedTabDelegate { SessionID GetSessionId() const override; bool IsBeingDestroyed() const override; std::string GetExtensionAppId() const override; - bool ProfileIsSupervised() const override; - void set_is_supervised(bool is_supervised); + bool ProfileHasChildAccount() const override; + void set_has_child_account(bool has_child_account); const std::vector>* GetBlockedNavigations() const override; bool IsPlaceholderTab() const override; @@ -77,7 +77,7 @@ class TestSyncedTabDelegate : public SyncedTabDelegate { const base::RepeatingCallback notify_cb_; int current_entry_index_ = -1; - bool is_supervised_ = false; + bool has_child_account_ = false; std::vector> blocked_navigations_; std::vector> @@ -115,7 +115,7 @@ class PlaceholderTabDelegate : public SyncedTabDelegate { void GetSerializedNavigationAtIndex( int i, sessions::SerializedNavigationEntry* serialized_entry) const override; - bool ProfileIsSupervised() const override; + bool ProfileHasChildAccount() const override; const std::vector>* GetBlockedNavigations() const override; bool ShouldSync(SyncSessionsClient* sessions_client) override; diff --git a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h index bbf3284535b32a..f68cda004ee830 100644 --- a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h +++ b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h @@ -42,7 +42,7 @@ class IOSChromeSyncedTabDelegate void GetSerializedNavigationAtIndex( int i, sessions::SerializedNavigationEntry* serialized_entry) const override; - bool ProfileIsSupervised() const override; + bool ProfileHasChildAccount() const override; const std::vector>* GetBlockedNavigations() const override; bool IsPlaceholderTab() const override; diff --git a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm index 31eb9167f23185..6748ae7a71b26c 100644 --- a/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm +++ b/ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm @@ -159,7 +159,7 @@ } } -bool IOSChromeSyncedTabDelegate::ProfileIsSupervised() const { +bool IOSChromeSyncedTabDelegate::ProfileHasChildAccount() const { return false; } From 7b06ca76362e9e3d497060981d9219376282fa4d Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 15 Dec 2021 11:59:07 +0000 Subject: [PATCH 033/133] [LayoutNG] Clearer name for RemovePositionedObjects's parameter The meaning of "o" is not obvious, so renaming to "stay_within". There should be no behaviour change. Bug: none Change-Id: I870b1d89a10c24b0e407e9af3055e751050417c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3338703 Reviewed-by: Morten Stenshorne Commit-Queue: Oriol Brufau Cr-Commit-Position: refs/heads/main@{#951897} --- third_party/blink/renderer/core/layout/layout_block.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/blink/renderer/core/layout/layout_block.cc b/third_party/blink/renderer/core/layout/layout_block.cc index 1b969bac5416fb..55810296c9aca6 100644 --- a/third_party/blink/renderer/core/layout/layout_block.cc +++ b/third_party/blink/renderer/core/layout/layout_block.cc @@ -1147,7 +1147,7 @@ static void ProcessPositionedObjectRemoval( } void LayoutBlock::RemovePositionedObjects( - LayoutObject* o, + LayoutObject* stay_within, ContainingBlockState containing_block_state) { NOT_DESTROYED(); TrackedLayoutBoxLinkedHashSet* positioned_descendants = PositionedObjects(); @@ -1156,8 +1156,8 @@ void LayoutBlock::RemovePositionedObjects( HeapVector, 16> dead_objects; for (LayoutBox* positioned_object : *positioned_descendants) { - if (!o || - (positioned_object->IsDescendantOf(o) && o != positioned_object)) { + if (!stay_within || (positioned_object->IsDescendantOf(stay_within) && + stay_within != positioned_object)) { ProcessPositionedObjectRemoval(containing_block_state, positioned_object); dead_objects.push_back(positioned_object); } From 078d9f4e633bf9d6fa6f8314a057d703d30fb519 Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Wed, 15 Dec 2021 11:59:14 +0000 Subject: [PATCH 034/133] Reland "[Passwords] Fix assertion failure when opening password settings" This is a reland of 293ef66ce69d271b8ff9288c6f0598688270ed0b, updated to avoid breaking PasswordSettingsTest#testManageAccountLinkSyncing() by making sure the test mimics sync having been fully initialized. Original change's description: > [Passwords] Fix assertion failure when opening password settings > > Method SyncService.isUsingExplicitPassphrase() has the precondition that > the sync engine must have initialized, as per isEngineInitialized(). To > avoiding running into assertion failures, PasswordManagerHelper must > first rule out ongoing initialization before invoking > isUsingExplicitPassphrase(). > > Change-Id: I8f519953c6d37aa4d9d54e6b043c24054fb46b45 > Fixed: 1276532 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3336879 > Reviewed-by: Ioana Pandele > Commit-Queue: Mikel Astiz > Cr-Commit-Position: refs/heads/main@{#951464} Change-Id: I280c58064ba674e1573c938002bdb301fc5d6533 Fixed: 1276532, 1279940 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341531 Reviewed-by: Ioana Pandele Commit-Queue: Mikel Astiz Cr-Commit-Position: refs/heads/main@{#951898} --- .../settings/PasswordSettingsTest.java | 1 + .../password_manager/PasswordManagerHelper.java | 3 ++- .../PasswordManagerHelperTest.java | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java index 3e6e593f603c18..e719a68aeee664 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java @@ -385,6 +385,7 @@ private void overrideSyncService( final boolean usingPassphrase, final boolean syncingPasswords) { TestThreadUtils.runOnUiThreadBlocking(() -> { when(mMockSyncService.hasSyncConsent()).thenReturn(syncingPasswords); + when(mMockSyncService.isEngineInitialized()).thenReturn(true); when(mMockSyncService.isUsingExplicitPassphrase()).thenReturn(usingPassphrase); when(mMockSyncService.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet( diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java index a8317123a12568..0fad594c3b401c 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java @@ -97,7 +97,7 @@ public static boolean hasChosenToSyncPasswords(SyncService syncService) { */ public static boolean hasChosenToSyncPasswordsWithNoCustomPassphrase(SyncService syncService) { return PasswordManagerHelper.hasChosenToSyncPasswords(syncService) - && !syncService.isUsingExplicitPassphrase(); + && syncService.isEngineInitialized() && !syncService.isUsingExplicitPassphrase(); } /** @@ -109,6 +109,7 @@ public static boolean hasChosenToSyncPasswordsWithNoCustomPassphrase(SyncService public static boolean isSyncingPasswordsWithNoCustomPassphrase(SyncService syncService) { if (syncService == null || !syncService.hasSyncConsent()) return false; if (!syncService.getActiveDataTypes().contains(ModelType.PASSWORDS)) return false; + if (!syncService.isEngineInitialized()) return false; if (syncService.isUsingExplicitPassphrase()) return false; return true; } diff --git a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java index 35b05a1f9e3a09..67940dc25e68dd 100644 --- a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java +++ b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java @@ -131,17 +131,31 @@ public void testSyncEnabledWithCustomPassphrase() { when(mSyncServiceMock.isSyncFeatureEnabled()).thenReturn(true); when(mSyncServiceMock.getChosenDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(true); Assert.assertTrue(PasswordManagerHelper.hasChosenToSyncPasswords(mSyncServiceMock)); Assert.assertFalse(PasswordManagerHelper.hasChosenToSyncPasswordsWithNoCustomPassphrase( mSyncServiceMock)); } + @Test + public void testSyncEnabledButInitializing() { + when(mSyncServiceMock.isSyncFeatureEnabled()).thenReturn(true); + when(mSyncServiceMock.getChosenDataTypes()) + .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(false); + Assert.assertTrue(PasswordManagerHelper.hasChosenToSyncPasswords(mSyncServiceMock)); + Assert.assertFalse(PasswordManagerHelper.hasChosenToSyncPasswordsWithNoCustomPassphrase( + mSyncServiceMock)); + verify(mSyncServiceMock, never()).isUsingExplicitPassphrase(); + } + @Test public void testActivelySyncingPasswordsWithNoCustomPassphrase() { when(mSyncServiceMock.hasSyncConsent()).thenReturn(true); when(mSyncServiceMock.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(false); Assert.assertTrue( PasswordManagerHelper.isSyncingPasswordsWithNoCustomPassphrase(mSyncServiceMock)); @@ -152,6 +166,7 @@ public void testActivelySyncingPasswordsWithCustomPassphrase() { when(mSyncServiceMock.hasSyncConsent()).thenReturn(true); when(mSyncServiceMock.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(true); Assert.assertFalse( PasswordManagerHelper.isSyncingPasswordsWithNoCustomPassphrase(mSyncServiceMock)); From 3549191010fb00cd6b3adc193587090d7e33668c Mon Sep 17 00:00:00 2001 From: Alex Ilin Date: Wed, 15 Dec 2021 12:00:14 +0000 Subject: [PATCH 035/133] Revert "[LR] Add fieldtrial config entry" This reverts commit b3dbfd3c68057c11ac05d6926c59aebb445440da. Reason for revert: causes test failures - https://crbug.com/1280165 - https://crbug.com/1280172 - https://crbug.com/1280173 - https://crbug.com/1280174 Please fix the tests before re-enabling this config. Original change's description: > [LR] Add fieldtrial config entry > > Adds a fieldtriel testing config entry for Lightweight Reactions in > preparation for ramping up the experiment to Beta. > > Change-Id: I97be1f7233637c5e4b316ddbb32ae39d7a93890f > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3331121 > Reviewed-by: Sebastien Seguin-Gagnon > Commit-Queue: Guillaume Jenkins > Cr-Commit-Position: refs/heads/main@{#951592} Change-Id: I393c2f72ee983e3509b9431d9a29b62077286a1f Fixed: 1280165, 1280172, 1280173, 1280174 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341057 Bot-Commit: Rubber Stamper Commit-Queue: Alex Ilin Cr-Commit-Position: refs/heads/main@{#951899} --- testing/variations/fieldtrial_testing_config.json | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 10a44134f30248..a31f480016dcfe 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json @@ -4820,21 +4820,6 @@ ] } ], - "LightweightReactions": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "LightweightReactions" - ] - } - ] - } - ], "LiteVideo": [ { "platforms": [ From 895853b2232144a6f3f46e007559d5fb989f1f45 Mon Sep 17 00:00:00 2001 From: Pi-Hsun Shih Date: Wed, 15 Dec 2021 12:00:46 +0000 Subject: [PATCH 036/133] CCA: Migrate animation.js to TypeScript Bug: b:172340451 Test: tsc compiles Change-Id: Iec72dce673bbde380fa2eaabaff450f5c3440d5f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3299883 Reviewed-by: Shik Chen Commit-Queue: Pi-Hsun Shih Cr-Commit-Position: refs/heads/main@{#951900} --- .../js/{animation.js => animation.ts} | 59 ++++++++----------- ash/webui/camera_app_ui/resources/js/js.gni | 2 +- 2 files changed, 24 insertions(+), 37 deletions(-) rename ash/webui/camera_app_ui/resources/js/{animation.js => animation.ts} (52%) diff --git a/ash/webui/camera_app_ui/resources/js/animation.js b/ash/webui/camera_app_ui/resources/js/animation.ts similarity index 52% rename from ash/webui/camera_app_ui/resources/js/animation.js rename to ash/webui/camera_app_ui/resources/js/animation.ts index 509be57bbd5c69..a4f3a52f150fce 100644 --- a/ash/webui/camera_app_ui/resources/js/animation.js +++ b/ash/webui/camera_app_ui/resources/js/animation.ts @@ -5,17 +5,12 @@ import {assertInstanceof} from './assert.js'; import {AsyncJobQueue} from './async_job_queue.js'; -/** - * @type {!Map} - */ -const jobQueueMap = new Map(); +const jobQueueMap = new Map(); /** * Gets the animation job queue for the element. - * @param {!HTMLElement} el - * @return {!AsyncJobQueue} */ -function getQueueFor(el) { +function getQueueFor(el: HTMLElement): AsyncJobQueue { if (!jobQueueMap.has(el)) { jobQueueMap.set(el, new AsyncJobQueue()); } @@ -25,13 +20,9 @@ function getQueueFor(el) { /** * Gets all the animations running or pending on the element and its * pseudo-elements. - * TODO(b/176879728): Remove @suppress once we fix the getAnimations() extern - * in upstream Closure compiler. - * @suppress {checkTypes} - * @param {{el: !HTMLElement, onChild: boolean}} param - * @return {!Array} */ -function getAnimations({el, onChild}) { +function getAnimations({el, onChild}: {el: HTMLElement, onChild: boolean}): + Animation[] { return el.getAnimations({subtree: true}) .filter( (a) => onChild || @@ -39,49 +30,47 @@ function getAnimations({el, onChild}) { } /** - * @param {{el: !HTMLElement, onChild: boolean}} param |el| is the - * target element to cancel animation. |onChild| specifies whether the - * cancelled animation is applied to all subtree children, false by default. - * @return {!Promise} Promise resolved when the animation is cancelled. + * @param param |el| is the target element to cancel animation. |onChild| + * specifies whether the cancelled animation is applied to all subtree + * children, false by default. + * @return Promise resolved when the animation is cancelled. */ -async function doCancel({el, onChild}) { +async function doCancel({el, onChild}: {el: HTMLElement, onChild: boolean}): + Promise { getAnimations({el, onChild}).forEach((a) => a.cancel()); await getQueueFor(el).flush(); } /** * Cancels the running animation on the element, if any. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the animation is cancelled. + * @return Promise resolved when the animation is cancelled. */ -export async function cancel(el) { +export async function cancel(el: HTMLElement): Promise { return doCancel({el, onChild: false}); } /** * Cancels all running animation on children of the element, if any. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when all animation is cancelled. + * @return Promise resolved when all animation is cancelled. */ -export async function cancelOnChild(el) { +export async function cancelOnChild(el: HTMLElement): Promise { return doCancel({el, onChild: true}); } /** * Animates the target element once by applying the "animate" class. If the * animation is already running, the previous one would be cancelled first. - * @param {{el: !HTMLElement, onChild: boolean}} param |el| is the - * target element to apply "animate" class. |onChild| specifies whether the - * animation is applied to all subtree children. - * @return {!Promise} Promise resolved when the animation is settled. + * @param param |el| is the target element to apply "animate" class. |onChild| + * specifies whether the animation is applied to all subtree children. + * @return Promise resolved when the animation is settled. */ -function doPlay({el, onChild}) { +function doPlay({el, onChild}: {el: HTMLElement, onChild: boolean}): + Promise { doCancel({el, onChild}); const queue = getQueueFor(el); const job = async () => { /** * Force repaint before applying the animation. - * @suppress {suspiciousCode} */ el.offsetWidth; el.classList.add('animate'); @@ -94,19 +83,17 @@ function doPlay({el, onChild}) { /** * Sets "animate" class on the element and waits for its animation settled. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the animation is settled. + * @return Promise resolved when the animation is settled. */ -export function play(el) { +export function play(el: HTMLElement): Promise { return doPlay({el, onChild: false}); } /** * Sets "animate" class on the element and waits for its child's animation * settled. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the child's animation is settled. + * @return Promise resolved when the child's animation is settled. */ -export function playOnChild(el) { +export function playOnChild(el: HTMLElement): Promise { return doPlay({el, onChild: true}); } diff --git a/ash/webui/camera_app_ui/resources/js/js.gni b/ash/webui/camera_app_ui/resources/js/js.gni index aed144cadb6670..29372572234b9a 100644 --- a/ash/webui/camera_app_ui/resources/js/js.gni +++ b/ash/webui/camera_app_ui/resources/js/js.gni @@ -3,7 +3,7 @@ # found in the LICENSE file. compile_js_files = [ - "animation.js", + "animation.ts", "app_window.ts", "assert.ts", "async_job_queue.ts", From a884462e6c4142a1232c0253f07a9531a923650b Mon Sep 17 00:00:00 2001 From: chromium-autoroll Date: Wed, 15 Dec 2021 12:03:43 +0000 Subject: [PATCH 037/133] Roll Chrome Win32 PGO Profile Roll Chrome Win32 PGO profile from chrome-win32-main-1639547758-c53f46e146f64fe801bea0f5145ea9a0eb37f478.profdata to chrome-win32-main-1639558498-bfc8cbd53a95441e4b362960336fa324f065b029.profdata If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/pgo-win32-chromium Please CC pgo-profile-sheriffs@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Chromium main branch: https://bugs.chromium.org/p/chromium/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Cq-Include-Trybots: luci.chrome.try:win-chrome Tbr: pgo-profile-sheriffs@google.com Change-Id: I25cf92784a8ae685bafebe38b2808d873e5a0738 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341471 Commit-Queue: chromium-autoroll Bot-Commit: chromium-autoroll Cr-Commit-Position: refs/heads/main@{#951901} --- chrome/build/win32.pgo.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index c09186a8fc5097..9dec62ad4bf5a9 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt @@ -1 +1 @@ -chrome-win32-main-1639547758-c53f46e146f64fe801bea0f5145ea9a0eb37f478.profdata +chrome-win32-main-1639558498-bfc8cbd53a95441e4b362960336fa324f065b029.profdata From a1f2c6eb56b07c38f48ca4565bc229d07d3d329f Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Wed, 15 Dec 2021 12:05:03 +0000 Subject: [PATCH 038/133] Roll abseil_revision 9336be04a2..1065514ef3 Change Log: https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+log/9336be04a2..1065514ef3 Full diff: https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+/9336be04a2..1065514ef3 Bug: None Change-Id: Ib32981a1f8775319d102530494d800fa5b65e9c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341051 Reviewed-by: Danil Chapovalov Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#951902} --- .../abseil-cpp/CMake/AbseilHelpers.cmake | 7 +- third_party/abseil-cpp/CMake/README.md | 13 ++- .../CMake/install_test_project/test.sh | 2 +- third_party/abseil-cpp/CMakeLists.txt | 9 +- third_party/abseil-cpp/README.chromium | 2 +- third_party/abseil-cpp/absl/base/config.h | 24 ++++- .../absl/base/internal/direct_mmap.h | 2 +- .../absl/container/internal/raw_hash_set.h | 27 ++--- .../internal/raw_hash_set_benchmark.cc | 20 +++- .../debugging/internal/address_is_readable.cc | 102 ++++++++---------- third_party/abseil-cpp/absl/flags/declare.h | 6 +- .../absl/random/internal/randen_detect.cc | 1 - third_party/abseil-cpp/absl/strings/ascii.h | 2 +- third_party/abseil-cpp/absl/strings/cord.cc | 19 ++-- third_party/abseil-cpp/absl/strings/cord.h | 34 +++--- .../abseil-cpp/absl/strings/cord_test.cc | 77 +++++++++---- .../abseil-cpp/absl/strings/substitute.h | 4 +- .../abseil-cpp/absl/synchronization/mutex.cc | 2 +- .../absl/synchronization/notification.h | 2 +- .../ci/linux_gcc-latest_libstdcxx_cmake.sh | 2 +- .../abseil-cpp/ci/linux_gcc_alpine_cmake.sh | 2 +- .../abseil-cpp/ci/macos_xcode_cmake.sh | 2 +- third_party/abseil-cpp/symbols_arm64_dbg.def | 5 +- third_party/abseil-cpp/symbols_x64_dbg.def | 5 +- third_party/abseil-cpp/symbols_x86_dbg.def | 5 +- 25 files changed, 219 insertions(+), 157 deletions(-) diff --git a/third_party/abseil-cpp/CMake/AbseilHelpers.cmake b/third_party/abseil-cpp/CMake/AbseilHelpers.cmake index 17c4f4499c8ae9..9ad2627dc4ac89 100644 --- a/third_party/abseil-cpp/CMake/AbseilHelpers.cmake +++ b/third_party/abseil-cpp/CMake/AbseilHelpers.cmake @@ -40,7 +40,8 @@ endif() # LINKOPTS: List of link options # PUBLIC: Add this so that this library will be exported under absl:: # Also in IDE, target will appear in Abseil folder while non PUBLIC will be in Abseil/internal. -# TESTONLY: When added, this target will only be built if BUILD_TESTING=ON. +# TESTONLY: When added, this target will only be built if both +# BUILD_TESTING=ON and ABSL_BUILD_TESTING=ON. # # Note: # By default, absl_cc_library will always create a library named absl_${NAME}, @@ -82,7 +83,7 @@ function(absl_cc_library) ${ARGN} ) - if(ABSL_CC_LIB_TESTONLY AND NOT BUILD_TESTING) + if(ABSL_CC_LIB_TESTONLY AND NOT (BUILD_TESTING AND ABSL_BUILD_TESTING)) return() endif() @@ -364,7 +365,7 @@ endfunction() # GTest::gtest_main # ) function(absl_cc_test) - if(NOT BUILD_TESTING) + if(NOT (BUILD_TESTING AND ABSL_BUILD_TESTING)) return() endif() diff --git a/third_party/abseil-cpp/CMake/README.md b/third_party/abseil-cpp/CMake/README.md index f8b27e63f60055..8134615e8a2495 100644 --- a/third_party/abseil-cpp/CMake/README.md +++ b/third_party/abseil-cpp/CMake/README.md @@ -20,8 +20,10 @@ googletest framework ### Step-by-Step Instructions 1. If you want to build the Abseil tests, integrate the Abseil dependency -[Google Test](https://github.com/google/googletest) into your CMake project. To disable Abseil tests, you have to pass -`-DBUILD_TESTING=OFF` when configuring your project with CMake. +[Google Test](https://github.com/google/googletest) into your CMake +project. To disable Abseil tests, you have to pass either +`-DBUILD_TESTING=OFF` or `-DABSL_BUILD_TESTING=OFF` when configuring your +project with CMake. 2. Download Abseil and copy it into a subdirectory in your CMake project or add Abseil as a [git submodule](https://git-scm.com/docs/git-submodule) in your @@ -91,7 +93,8 @@ setting a consistent `CMAKE_CXX_STANDARD` that is sufficiently high. ### Running Abseil Tests with CMake -Use the `-DBUILD_TESTING=ON` flag to run Abseil tests. +Use the `-DABSL_BUILD_TESTING=ON` flag to run Abseil tests. Note that +BUILD_TESTING must also be on (the default). You will need to provide Abseil with a Googletest dependency. There are two options for how to do this: @@ -109,7 +112,7 @@ For example, to run just the Abseil tests, you could use this script: cd path/to/abseil-cpp mkdir build cd build -cmake -DBUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON .. +cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON .. make -j ctest ``` @@ -175,7 +178,7 @@ cmake --build /temporary/build/abseil-cpp --target install ## Google Test Options -`-DBUILD_TESTING=ON` must be set to enable testing +`-DABSL_BUILD_TESTING=ON` must be set to enable testing - Have Abseil download and build Google Test for you: `-DABSL_USE_EXTERNAL_GOOGLETEST=OFF` (default) - Download and build latest Google Test: `-DABSL_USE_GOOGLETEST_HEAD=ON` diff --git a/third_party/abseil-cpp/CMake/install_test_project/test.sh b/third_party/abseil-cpp/CMake/install_test_project/test.sh index aecbb8fe321a62..cc028bac861647 100755 --- a/third_party/abseil-cpp/CMake/install_test_project/test.sh +++ b/third_party/abseil-cpp/CMake/install_test_project/test.sh @@ -55,7 +55,7 @@ cmake "${absl_dir}" \ -DABSL_USE_EXTERNAL_GOOGLETEST=ON \ -DABSL_FIND_GOOGLETEST=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DBUILD_SHARED_LIBS="${build_shared_libs}" make -j $(nproc) ctest -j $(nproc) --output-on-failure diff --git a/third_party/abseil-cpp/CMakeLists.txt b/third_party/abseil-cpp/CMakeLists.txt index a1400b743d5e90..ff49ac1e05a2dd 100644 --- a/third_party/abseil-cpp/CMakeLists.txt +++ b/third_party/abseil-cpp/CMakeLists.txt @@ -46,10 +46,6 @@ if (POLICY CMP0091) cmake_policy(SET CMP0091 NEW) endif (POLICY CMP0091) -# Set BUILD_TESTING to OFF by default. -# This must come before the project() and include(CTest) lines. -OPTION(BUILD_TESTING "Build tests" OFF) - project(absl LANGUAGES CXX) include(CTest) @@ -111,6 +107,9 @@ find_package(Threads REQUIRED) include(CMakeDependentOption) +option(ABSL_BUILD_TESTING + "If ON, Abseil will build all of Abseil's own tests." OFF) + option(ABSL_USE_EXTERNAL_GOOGLETEST "If ON, Abseil will assume that the targets for GoogleTest are already provided by the including project. This makes sense when Abseil is used with add_subproject." OFF) @@ -130,7 +129,7 @@ set(ABSL_LOCAL_GOOGLETEST_DIR "/usr/src/googletest" CACHE PATH "If ABSL_USE_GOOGLETEST_HEAD is OFF and ABSL_GOOGLETEST_URL is not set, specifies the directory of a local GoogleTest checkout." ) -if(BUILD_TESTING) +if(BUILD_TESTING AND ABSL_BUILD_TESTING) ## check targets if (ABSL_USE_EXTERNAL_GOOGLETEST) if (ABSL_FIND_GOOGLETEST) diff --git a/third_party/abseil-cpp/README.chromium b/third_party/abseil-cpp/README.chromium index 60774f6a07090b..f8a57208a8c982 100644 --- a/third_party/abseil-cpp/README.chromium +++ b/third_party/abseil-cpp/README.chromium @@ -4,7 +4,7 @@ URL: https://github.com/abseil/abseil-cpp License: Apache 2.0 License File: LICENSE Version: 0 -Revision: 9336be04a242237cd41a525bedfcf3be1bb55377 +Revision: 1065514ef332d036f3437e950e78d35ce6b7c740 Security Critical: yes Description: diff --git a/third_party/abseil-cpp/absl/base/config.h b/third_party/abseil-cpp/absl/base/config.h index c29b206ae42198..373aa0ccbeebe4 100644 --- a/third_party/abseil-cpp/absl/base/config.h +++ b/third_party/abseil-cpp/absl/base/config.h @@ -751,8 +751,6 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || // a compiler instrumentation module and a run-time library. #ifdef ABSL_HAVE_MEMORY_SANITIZER #error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set." -#elif defined(__SANITIZE_MEMORY__) -#define ABSL_HAVE_MEMORY_SANITIZER 1 #elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer) #define ABSL_HAVE_MEMORY_SANITIZER 1 #endif @@ -779,6 +777,28 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || #define ABSL_HAVE_ADDRESS_SANITIZER 1 #endif +// ABSL_HAVE_HWADDRESS_SANITIZER +// +// Hardware-Assisted AddressSanitizer (or HWASAN) is even faster than asan +// memory error detector which can use CPU features like ARM TBI, Intel LAM or +// AMD UAI. +#ifdef ABSL_HAVE_HWADDRESS_SANITIZER +#error "ABSL_HAVE_HWADDRESS_SANITIZER cannot be directly set." +#elif defined(__SANITIZE_HWADDRESS__) +#define ABSL_HAVE_HWADDRESS_SANITIZER 1 +#elif ABSL_HAVE_FEATURE(hwaddress_sanitizer) +#define ABSL_HAVE_HWADDRESS_SANITIZER 1 +#endif + +// ABSL_HAVE_LEAK_SANITIZER +// +// LeakSanitizer (or lsan) is a detector of memory leaks. +#ifdef ABSL_HAVE_LEAK_SANITIZER +#error "ABSL_HAVE_LEAK_SANITIZER cannot be directly set." +#elif ABSL_HAVE_FEATURE(leak_sanitizer) +#define ABSL_HAVE_LEAK_SANITIZER 1 +#endif + // ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION // // Class template argument deduction is a language feature added in C++17. diff --git a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h index 274054cd5a84be..7037094bfa77d3 100644 --- a/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +++ b/third_party/abseil-cpp/absl/base/internal/direct_mmap.h @@ -80,7 +80,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, (defined(__PPC__) && !defined(__PPC64__)) || \ (defined(__riscv) && __riscv_xlen == 32) || \ (defined(__s390__) && !defined(__s390x__)) || \ - (defined(__sparc__) && !defined(__arch64__)) + (defined(__sparc__) && !defined(__aarch64__)) // On these architectures, implement mmap with mmap2. static int pagesize = 0; if (pagesize == 0) { diff --git a/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h b/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h index d4b72ab1cdc72c..ad12f41c73d2ce 100644 --- a/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +++ b/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h @@ -201,7 +201,7 @@ constexpr bool IsNoThrowSwappable(std::false_type /* is_swappable */) { template uint32_t TrailingZeros(T x) { ABSL_INTERNAL_ASSUME(x != 0); - return countr_zero(x); + return static_cast(countr_zero(x)); } // An abstraction over a bitmask. It provides an easy way to iterate through the @@ -230,7 +230,7 @@ class BitMask { return *this; } explicit operator bool() const { return mask_ != 0; } - int operator*() const { return LowestBitSet(); } + uint32_t operator*() const { return LowestBitSet(); } uint32_t LowestBitSet() const { return container_internal::TrailingZeros(mask_) >> Shift; } @@ -248,7 +248,7 @@ class BitMask { uint32_t LeadingZeros() const { constexpr int total_significant_bits = SignificantBits << Shift; constexpr int extra_bits = sizeof(T) * 8 - total_significant_bits; - return countl_zero(mask_ << extra_bits) >> Shift; + return static_cast(countl_zero(mask_ << extra_bits)) >> Shift; } private: @@ -360,7 +360,7 @@ struct GroupSse2Impl { BitMask Match(h2_t hash) const { auto match = _mm_set1_epi8(hash); return BitMask( - _mm_movemask_epi8(_mm_cmpeq_epi8(match, ctrl))); + static_cast(_mm_movemask_epi8(_mm_cmpeq_epi8(match, ctrl)))); } // Returns a bitmask representing the positions of empty slots. @@ -368,7 +368,7 @@ struct GroupSse2Impl { #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 // This only works because ctrl_t::kEmpty is -128. return BitMask( - _mm_movemask_epi8(_mm_sign_epi8(ctrl, ctrl))); + static_cast(_mm_movemask_epi8(_mm_sign_epi8(ctrl, ctrl)))); #else return Match(static_cast(ctrl_t::kEmpty)); #endif @@ -376,14 +376,15 @@ struct GroupSse2Impl { // Returns a bitmask representing the positions of empty or deleted slots. BitMask MatchEmptyOrDeleted() const { - auto special = _mm_set1_epi8(static_cast(ctrl_t::kSentinel)); + auto special = _mm_set1_epi8(static_cast(ctrl_t::kSentinel)); return BitMask( - _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl))); + static_cast( + _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)))); } // Returns the number of trailing empty or deleted elements in the group. uint32_t CountLeadingEmptyOrDeleted() const { - auto special = _mm_set1_epi8(static_cast(ctrl_t::kSentinel)); + auto special = _mm_set1_epi8(static_cast(ctrl_t::kSentinel)); return TrailingZeros(static_cast( _mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1)); } @@ -1465,7 +1466,7 @@ class raw_hash_set { auto seq = probe(ctrl_, hash, capacity_); while (true) { Group g{ctrl_ + seq.offset()}; - for (int i : g.Match(H2(hash))) { + for (uint32_t i : g.Match(H2(hash))) { if (ABSL_PREDICT_TRUE(PolicyTraits::apply( EqualElement{key, eq_ref()}, PolicyTraits::element(slots_ + seq.offset(i))))) @@ -1610,7 +1611,7 @@ class raw_hash_set { void erase_meta_only(const_iterator it) { assert(IsFull(*it.inner_.ctrl_) && "erasing a dangling iterator"); --size_; - const size_t index = it.inner_.ctrl_ - ctrl_; + const size_t index = static_cast(it.inner_.ctrl_ - ctrl_); const size_t index_before = (index - Group::kWidth) & capacity_; const auto empty_after = Group(it.inner_.ctrl_).MatchEmpty(); const auto empty_before = Group(ctrl_ + index_before).MatchEmpty(); @@ -1832,7 +1833,7 @@ class raw_hash_set { auto seq = probe(ctrl_, hash, capacity_); while (true) { Group g{ctrl_ + seq.offset()}; - for (int i : g.Match(H2(hash))) { + for (uint32_t i : g.Match(H2(hash))) { if (ABSL_PREDICT_TRUE(PolicyTraits::element(slots_ + seq.offset(i)) == elem)) return true; @@ -1864,7 +1865,7 @@ class raw_hash_set { auto seq = probe(ctrl_, hash, capacity_); while (true) { Group g{ctrl_ + seq.offset()}; - for (int i : g.Match(H2(hash))) { + for (uint32_t i : g.Match(H2(hash))) { if (ABSL_PREDICT_TRUE(PolicyTraits::apply( EqualElement{key, eq_ref()}, PolicyTraits::element(slots_ + seq.offset(i))))) @@ -1984,7 +1985,7 @@ struct HashtableDebugAccess> { auto seq = probe(set.ctrl_, hash, set.capacity_); while (true) { container_internal::Group g{set.ctrl_ + seq.offset()}; - for (int i : g.Match(container_internal::H2(hash))) { + for (uint32_t i : g.Match(container_internal::H2(hash))) { if (Traits::apply( typename Set::template EqualElement{ key, set.eq_ref()}, diff --git a/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc b/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc index c886d3ad43c809..146ef433c2d80e 100644 --- a/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc +++ b/third_party/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc @@ -330,6 +330,7 @@ void BM_Group_Match(benchmark::State& state) { h2_t h = 1; for (auto _ : state) { ::benchmark::DoNotOptimize(h); + ::benchmark::DoNotOptimize(g); ::benchmark::DoNotOptimize(g.Match(h)); } } @@ -339,7 +340,10 @@ void BM_Group_MatchEmpty(benchmark::State& state) { std::array group; Iota(group.begin(), group.end(), -4); Group g{group.data()}; - for (auto _ : state) ::benchmark::DoNotOptimize(g.MatchEmpty()); + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(g.MatchEmpty()); + } } BENCHMARK(BM_Group_MatchEmpty); @@ -347,7 +351,10 @@ void BM_Group_MatchEmptyOrDeleted(benchmark::State& state) { std::array group; Iota(group.begin(), group.end(), -4); Group g{group.data()}; - for (auto _ : state) ::benchmark::DoNotOptimize(g.MatchEmptyOrDeleted()); + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(g.MatchEmptyOrDeleted()); + } } BENCHMARK(BM_Group_MatchEmptyOrDeleted); @@ -355,8 +362,10 @@ void BM_Group_CountLeadingEmptyOrDeleted(benchmark::State& state) { std::array group; Iota(group.begin(), group.end(), -2); Group g{group.data()}; - for (auto _ : state) + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); ::benchmark::DoNotOptimize(g.CountLeadingEmptyOrDeleted()); + } } BENCHMARK(BM_Group_CountLeadingEmptyOrDeleted); @@ -364,7 +373,10 @@ void BM_Group_MatchFirstEmptyOrDeleted(benchmark::State& state) { std::array group; Iota(group.begin(), group.end(), -2); Group g{group.data()}; - for (auto _ : state) ::benchmark::DoNotOptimize(*g.MatchEmptyOrDeleted()); + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(*g.MatchEmptyOrDeleted()); + } } BENCHMARK(BM_Group_MatchFirstEmptyOrDeleted); diff --git a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc index 26df3289603c18..4be6256bfb0c85 100644 --- a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +++ b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc @@ -30,16 +30,12 @@ bool AddressIsReadable(const void* /* addr */) { return true; } ABSL_NAMESPACE_END } // namespace absl -#else +#else // __linux__ && !__ANDROID__ -#include -#include -#include -#include +#include +#include #include -#include - #include "absl/base/internal/errno_saver.h" #include "absl/base/internal/raw_logging.h" @@ -47,60 +43,54 @@ namespace absl { ABSL_NAMESPACE_BEGIN namespace debugging_internal { +// NOTE: be extra careful about adding any interposable function calls here +// (such as open(), read(), etc.). These symbols may be interposed and will get +// invoked in contexts they don't expect. +// +// NOTE: any new system calls here may also require sandbox reconfiguration. +// bool AddressIsReadable(const void *addr) { - int fd = 0; + // Align address on 8-byte boundary. On aarch64, checking last + // byte before inaccessible page returned unexpected EFAULT. + const uintptr_t u_addr = reinterpret_cast(addr) & ~7; + addr = reinterpret_cast(u_addr); + + // rt_sigprocmask below will succeed for this input. + if (addr == nullptr) return false; + absl::base_internal::ErrnoSaver errno_saver; - for (int j = 0; j < 2; j++) { - // Here we probe with some syscall which - // - accepts a one-byte region of user memory as input - // - tests for EFAULT before other validation - // - has no problematic side-effects - // - // connect(2) works for this. It copies the address into kernel - // memory before any validation beyond requiring an open fd. - // But a one byte address is never valid (sa_family is two bytes), - // so the call cannot succeed and change any state. - // - // This strategy depends on Linux implementation details, - // so we rely on the test to alert us if it stops working. - // - // Some discarded past approaches: - // - msync() doesn't reject PROT_NONE regions - // - write() on /dev/null doesn't return EFAULT - // - write() on a pipe requires creating it and draining the writes - // - // Use syscall(SYS_connect, ...) instead of connect() to prevent ASAN - // and other checkers from complaining about accesses to arbitrary memory. - do { - ABSL_RAW_CHECK(syscall(SYS_connect, fd, addr, 1) == -1, - "should never succeed"); - } while (errno == EINTR); - if (errno == EFAULT) return false; - if (errno == EBADF) { - if (j != 0) { - // Unclear what happened. - ABSL_RAW_LOG(ERROR, "unexpected EBADF on fd %d", fd); - return false; - } - // fd 0 must have been closed. Try opening it again. - // Note: we shouldn't leak too many file descriptors here, since we expect - // to get fd==0 reopened. - fd = open("/dev/null", O_RDONLY); - if (fd == -1) { - ABSL_RAW_LOG(ERROR, "can't open /dev/null"); - return false; - } - } else { - // probably EINVAL or ENOTSOCK; we got past EFAULT validation. - return true; - } - } - ABSL_RAW_CHECK(false, "unreachable"); - return false; + + // Here we probe with some syscall which + // - accepts an 8-byte region of user memory as input + // - tests for EFAULT before other validation + // - has no problematic side-effects + // + // rt_sigprocmask(2) works for this. It copies sizeof(kernel_sigset_t)==8 + // bytes from the address into the kernel memory before any validation. + // + // The call can never succeed, since the `how` parameter is not one of + // SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK. + // + // This strategy depends on Linux implementation details, + // so we rely on the test to alert us if it stops working. + // + // Some discarded past approaches: + // - msync() doesn't reject PROT_NONE regions + // - write() on /dev/null doesn't return EFAULT + // - write() on a pipe requires creating it and draining the writes + // - connect() works but is problematic for sandboxes and needs a valid + // file descriptor + // + // This can never succeed (invalid first argument to sigprocmask). + ABSL_RAW_CHECK(syscall(SYS_rt_sigprocmask, ~0, addr, nullptr, + /*sizeof(kernel_sigset_t)*/ 8) == -1, + "unexpected success"); + ABSL_RAW_CHECK(errno == EFAULT || errno == EINVAL, "unexpected errno"); + return errno != EFAULT; } } // namespace debugging_internal ABSL_NAMESPACE_END } // namespace absl -#endif +#endif // __linux__ && !__ANDROID__ diff --git a/third_party/abseil-cpp/absl/flags/declare.h b/third_party/abseil-cpp/absl/flags/declare.h index b9794d8b85ac11..a791b667112693 100644 --- a/third_party/abseil-cpp/absl/flags/declare.h +++ b/third_party/abseil-cpp/absl/flags/declare.h @@ -60,6 +60,10 @@ ABSL_NAMESPACE_END // The ABSL_DECLARE_FLAG(type, name) macro expands to: // // extern absl::Flag FLAGS_name; -#define ABSL_DECLARE_FLAG(type, name) extern ::absl::Flag FLAGS_##name +#define ABSL_DECLARE_FLAG(type, name) \ + extern absl::Flag FLAGS_##name; \ + namespace absl /* block flags in namespaces */ {} \ + /* second redeclaration is to allow applying attributes */ \ + extern absl::Flag FLAGS_##name #endif // ABSL_FLAGS_DECLARE_H_ diff --git a/third_party/abseil-cpp/absl/random/internal/randen_detect.cc b/third_party/abseil-cpp/absl/random/internal/randen_detect.cc index bbe7b965329c9b..9bb58fc68cd9eb 100644 --- a/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +++ b/third_party/abseil-cpp/absl/random/internal/randen_detect.cc @@ -40,7 +40,6 @@ #if defined(ABSL_INTERNAL_USE_X86_CPUID) #if defined(_WIN32) || defined(_WIN64) #include // NOLINT(build/include_order) -#pragma intrinsic(__cpuid) #else // MSVC-equivalent __cpuid intrinsic function. static void __cpuid(int cpu_info[4], int info_type) { diff --git a/third_party/abseil-cpp/absl/strings/ascii.h b/third_party/abseil-cpp/absl/strings/ascii.h index b46bc71f35b9ad..9b8e5d1a768721 100644 --- a/third_party/abseil-cpp/absl/strings/ascii.h +++ b/third_party/abseil-cpp/absl/strings/ascii.h @@ -133,7 +133,7 @@ inline bool ascii_isdigit(unsigned char c) { return c >= '0' && c <= '9'; } // ascii_isprint() // -// Determines whether the given character is printable, including whitespace. +// Determines whether the given character is printable, including spaces. inline bool ascii_isprint(unsigned char c) { return c >= 32 && c < 127; } // ascii_isgraph() diff --git a/third_party/abseil-cpp/absl/strings/cord.cc b/third_party/abseil-cpp/absl/strings/cord.cc index 5905bac000cbb1..425b4beefd6295 100644 --- a/third_party/abseil-cpp/absl/strings/cord.cc +++ b/third_party/abseil-cpp/absl/strings/cord.cc @@ -311,11 +311,10 @@ static CordRep* CordRepFromString(std::string&& src) { constexpr unsigned char Cord::InlineRep::kMaxInline; -inline void Cord::InlineRep::set_data(const char* data, size_t n, - bool nullify_tail) { +inline void Cord::InlineRep::set_data(const char* data, size_t n) { static_assert(kMaxInline == 15, "set_data is hard-coded for a length of 15"); - cord_internal::SmallMemmove(data_.as_chars(), data, n, nullify_tail); + cord_internal::SmallMemmove(data_.as_chars(), data, n); set_inline_size(n); } @@ -375,7 +374,8 @@ void Cord::InlineRep::AppendTreeToTree(CordRep* tree, MethodIdentifier method) { } void Cord::InlineRep::AppendTree(CordRep* tree, MethodIdentifier method) { - if (tree == nullptr) return; + assert(tree != nullptr); + assert(tree->length != 0); assert(!tree->IsCrc()); if (data_.is_tree()) { AppendTreeToTree(tree, method); @@ -412,6 +412,7 @@ void Cord::InlineRep::PrependTreeToTree(CordRep* tree, void Cord::InlineRep::PrependTree(CordRep* tree, MethodIdentifier method) { assert(tree != nullptr); + assert(tree->length != 0); assert(!tree->IsCrc()); if (data_.is_tree()) { PrependTreeToTree(tree, method); @@ -549,7 +550,7 @@ Cord::Cord(absl::string_view src, MethodIdentifier method) : contents_(InlineData::kDefaultInit) { const size_t n = src.size(); if (n <= InlineRep::kMaxInline) { - contents_.set_data(src.data(), n, true); + contents_.set_data(src.data(), n); } else { CordRep* rep = NewTree(src.data(), n, 0); contents_.EmplaceTree(rep, method); @@ -559,7 +560,7 @@ Cord::Cord(absl::string_view src, MethodIdentifier method) template > Cord::Cord(T&& src) : contents_(InlineData::kDefaultInit) { if (src.size() <= InlineRep::kMaxInline) { - contents_.set_data(src.data(), src.size(), true); + contents_.set_data(src.data(), src.size()); } else { CordRep* rep = CordRepFromString(std::forward(src)); contents_.EmplaceTree(rep, CordzUpdateTracker::kConstructorString); @@ -610,7 +611,7 @@ Cord& Cord::operator=(absl::string_view src) { // - MaybeUntrackCord must be called before set_data() clobbers cordz_info. // - set_data() must be called before Unref(tree) as it may reference tree. if (tree != nullptr) CordzInfo::MaybeUntrackCord(contents_.cordz_info()); - contents_.set_data(data, length, true); + contents_.set_data(data, length); if (tree != nullptr) CordRep::Unref(tree); return *this; } @@ -1014,9 +1015,7 @@ Cord Cord::Subcord(size_t pos, size_t new_size) const { CordRep* tree = contents_.tree(); if (tree == nullptr) { - // sub_cord is newly constructed, no need to re-zero-out the tail of - // contents_ memory. - sub_cord.contents_.set_data(contents_.data() + pos, new_size, false); + sub_cord.contents_.set_data(contents_.data() + pos, new_size); return sub_cord; } diff --git a/third_party/abseil-cpp/absl/strings/cord.h b/third_party/abseil-cpp/absl/strings/cord.h index 27d3475f853d77..3bbd763ec38972 100644 --- a/third_party/abseil-cpp/absl/strings/cord.h +++ b/third_party/abseil-cpp/absl/strings/cord.h @@ -763,9 +763,8 @@ class Cord { bool empty() const; size_t size() const; const char* data() const; // Returns nullptr if holding pointer - void set_data(const char* data, size_t n, - bool nullify_tail); // Discards pointer, if any - char* set_data(size_t n); // Write data to the result + void set_data(const char* data, size_t n); // Discards pointer, if any + char* set_data(size_t n); // Write data to the result // Returns nullptr if holding bytes absl::cord_internal::CordRep* tree() const; absl::cord_internal::CordRep* as_tree() const; @@ -857,7 +856,7 @@ class Cord { bool is_profiled() const { return data_.is_tree() && data_.is_profiled(); } // Returns the available inlined capacity, or 0 if is_tree() == true. - size_t inline_capacity() const { + size_t remaining_inline_capacity() const { return data_.is_tree() ? 0 : kMaxInline - data_.inline_size(); } @@ -968,8 +967,8 @@ namespace cord_internal { // Fast implementation of memmove for up to 15 bytes. This implementation is // safe for overlapping regions. If nullify_tail is true, the destination is // padded with '\0' up to 16 bytes. -inline void SmallMemmove(char* dst, const char* src, size_t n, - bool nullify_tail = false) { +template +inline void SmallMemmove(char* dst, const char* src, size_t n) { if (n >= 8) { assert(n <= 16); uint64_t buf1; @@ -1006,22 +1005,16 @@ inline void SmallMemmove(char* dst, const char* src, size_t n, } // Does non-template-specific `CordRepExternal` initialization. -// Expects `data` to be non-empty. +// Requires `data` to be non-empty. void InitializeCordRepExternal(absl::string_view data, CordRepExternal* rep); // Creates a new `CordRep` that owns `data` and `releaser` and returns a pointer -// to it, or `nullptr` if `data` was empty. +// to it. Requires `data` to be non-empty. template // NOLINTNEXTLINE - suppress clang-tidy raw pointer return. CordRep* NewExternalRep(absl::string_view data, Releaser&& releaser) { + assert(!data.empty()); using ReleaserType = absl::decay_t; - if (data.empty()) { - // Never create empty external nodes. - InvokeReleaser(Rank0{}, ReleaserType(std::forward(releaser)), - data); - return nullptr; - } - CordRepExternal* rep = new CordRepExternalImpl( std::forward(releaser), 0); InitializeCordRepExternal(data, rep); @@ -1041,10 +1034,15 @@ inline CordRep* NewExternalRep(absl::string_view data, template Cord MakeCordFromExternal(absl::string_view data, Releaser&& releaser) { Cord cord; - if (auto* rep = ::absl::cord_internal::NewExternalRep( - data, std::forward(releaser))) { - cord.contents_.EmplaceTree(rep, + if (ABSL_PREDICT_TRUE(!data.empty())) { + cord.contents_.EmplaceTree(::absl::cord_internal::NewExternalRep( + data, std::forward(releaser)), Cord::MethodIdentifier::kMakeCordFromExternal); + } else { + using ReleaserType = absl::decay_t; + cord_internal::InvokeReleaser( + cord_internal::Rank0{}, ReleaserType(std::forward(releaser)), + data); } return cord; } diff --git a/third_party/abseil-cpp/absl/strings/cord_test.cc b/third_party/abseil-cpp/absl/strings/cord_test.cc index ea865ccaa0edde..a22db0bbe46a75 100644 --- a/third_party/abseil-cpp/absl/strings/cord_test.cc +++ b/third_party/abseil-cpp/absl/strings/cord_test.cc @@ -1370,31 +1370,64 @@ TEST_P(CordTest, ConstructFromExternalNonTrivialReleaserDestructor) { } TEST_P(CordTest, ConstructFromExternalReferenceQualifierOverloads) { - struct Releaser { - void operator()(absl::string_view) & { *lvalue_invoked = true; } - void operator()(absl::string_view) && { *rvalue_invoked = true; } + enum InvokedAs { kMissing, kLValue, kRValue }; + enum CopiedAs { kNone, kMove, kCopy }; + struct Tracker { + CopiedAs copied_as = kNone; + InvokedAs invoked_as = kMissing; + + void Record(InvokedAs rhs) { + ASSERT_EQ(invoked_as, kMissing); + invoked_as = rhs; + } - bool* lvalue_invoked; - bool* rvalue_invoked; - }; + void Record(CopiedAs rhs) { + if (copied_as == kNone || rhs == kCopy) copied_as = rhs; + } + } tracker; - bool lvalue_invoked = false; - bool rvalue_invoked = false; - Releaser releaser = {&lvalue_invoked, &rvalue_invoked}; - (void)MaybeHardened(absl::MakeCordFromExternal("", releaser)); - EXPECT_FALSE(lvalue_invoked); - EXPECT_TRUE(rvalue_invoked); - rvalue_invoked = false; + class Releaser { + public: + explicit Releaser(Tracker* tracker) : tr_(tracker) { *tracker = Tracker(); } + Releaser(Releaser&& rhs) : tr_(rhs.tr_) { tr_->Record(kMove); } + Releaser(const Releaser& rhs) : tr_(rhs.tr_) { tr_->Record(kCopy); } - (void)MaybeHardened(absl::MakeCordFromExternal("dummy", releaser)); - EXPECT_FALSE(lvalue_invoked); - EXPECT_TRUE(rvalue_invoked); - rvalue_invoked = false; - - // NOLINTNEXTLINE: suppress clang-tidy std::move on trivially copyable type. - (void)MaybeHardened(absl::MakeCordFromExternal("dummy", std::move(releaser))); - EXPECT_FALSE(lvalue_invoked); - EXPECT_TRUE(rvalue_invoked); + void operator()(absl::string_view) & { tr_->Record(kLValue); } + void operator()(absl::string_view) && { tr_->Record(kRValue); } + + private: + Tracker* tr_; + }; + + const Releaser releaser1(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("", releaser1)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); + + const Releaser releaser2(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("", releaser2)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); + + Releaser releaser3(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("", std::move(releaser3))); + EXPECT_EQ(tracker.copied_as, kMove); + EXPECT_EQ(tracker.invoked_as, kRValue); + + Releaser releaser4(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("dummy", releaser4)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); + + const Releaser releaser5(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("dummy", releaser5)); + EXPECT_EQ(tracker.copied_as, kCopy); + EXPECT_EQ(tracker.invoked_as, kRValue); + + Releaser releaser6(&tracker); + (void)MaybeHardened(absl::MakeCordFromExternal("foo", std::move(releaser6))); + EXPECT_EQ(tracker.copied_as, kMove); + EXPECT_EQ(tracker.invoked_as, kRValue); } TEST_P(CordTest, ExternalMemoryBasicUsage) { diff --git a/third_party/abseil-cpp/absl/strings/substitute.h b/third_party/abseil-cpp/absl/strings/substitute.h index 151c56f5430d6d..dae4e63f67eacb 100644 --- a/third_party/abseil-cpp/absl/strings/substitute.h +++ b/third_party/abseil-cpp/absl/strings/substitute.h @@ -159,8 +159,8 @@ class Arg { Arg(Hex hex); // NOLINT(runtime/explicit) Arg(Dec dec); // NOLINT(runtime/explicit) - // vector::reference and const_reference require special help to - // convert to `AlphaNum` because it requires two user defined conversions. + // vector::reference and const_reference require special help to convert + // to `Arg` because it requires two user defined conversions. template ::value && diff --git a/third_party/abseil-cpp/absl/synchronization/mutex.cc b/third_party/abseil-cpp/absl/synchronization/mutex.cc index 76ad41fe163a1e..3af4cda95fa0f6 100644 --- a/third_party/abseil-cpp/absl/synchronization/mutex.cc +++ b/third_party/abseil-cpp/absl/synchronization/mutex.cc @@ -2327,7 +2327,7 @@ ABSL_ATTRIBUTE_NOINLINE void Mutex::UnlockSlow(SynchWaitParams *waitp) { base_internal::CycleClock::Now() - enqueue_timestamp; mutex_tracer("slow release", this, wait_cycles); ABSL_TSAN_MUTEX_PRE_DIVERT(this, 0); - submit_profile_data(enqueue_timestamp); + submit_profile_data(wait_cycles); ABSL_TSAN_MUTEX_POST_DIVERT(this, 0); } } diff --git a/third_party/abseil-cpp/absl/synchronization/notification.h b/third_party/abseil-cpp/absl/synchronization/notification.h index 9a354ca2c023b6..429968da1f0739 100644 --- a/third_party/abseil-cpp/absl/synchronization/notification.h +++ b/third_party/abseil-cpp/absl/synchronization/notification.h @@ -22,7 +22,7 @@ // The `Notification` object maintains a private boolean "notified" state that // transitions to `true` at most once. The `Notification` class provides the // following primary member functions: -// * `HasBeenNotified() `to query its state +// * `HasBeenNotified()` to query its state // * `WaitForNotification*()` to have threads wait until the "notified" state // is `true`. // * `Notify()` to set the notification's "notified" state to `true` and diff --git a/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh b/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh index ab06aa05749129..eccb3818f7f57d 100755 --- a/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh +++ b/third_party/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh @@ -54,7 +54,7 @@ for std in ${ABSL_CMAKE_CXX_STANDARDS}; do cmake /abseil-cpp \ -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ -DBUILD_SHARED_LIBS=${build_shared} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=${std} \ -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ diff --git a/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh b/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh index bce27d295f2943..bf2e1239de1195 100755 --- a/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh +++ b/third_party/abseil-cpp/ci/linux_gcc_alpine_cmake.sh @@ -53,7 +53,7 @@ for std in ${ABSL_CMAKE_CXX_STANDARDS}; do /bin/sh -c " cmake /abseil-cpp \ -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=${std} \ -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ diff --git a/third_party/abseil-cpp/ci/macos_xcode_cmake.sh b/third_party/abseil-cpp/ci/macos_xcode_cmake.sh index 2a870cf4e9d0d9..71ea2534e4d585 100755 --- a/third_party/abseil-cpp/ci/macos_xcode_cmake.sh +++ b/third_party/abseil-cpp/ci/macos_xcode_cmake.sh @@ -45,7 +45,7 @@ for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do time cmake ${ABSEIL_ROOT} \ -GXcode \ -DBUILD_SHARED_LIBS=${build_shared} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=11 \ -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \ diff --git a/third_party/abseil-cpp/symbols_arm64_dbg.def b/third_party/abseil-cpp/symbols_arm64_dbg.def index b7dade3f48819b..87fdac715fdaca 100644 --- a/third_party/abseil-cpp/symbols_arm64_dbg.def +++ b/third_party/abseil-cpp/symbols_arm64_dbg.def @@ -437,6 +437,8 @@ EXPORTS ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SharedCompareImpl@VCord@absl@@@absl@@YAHAEBVCord@0@0@Z ??$SharedCompareImpl@Vstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@@Z + ??$SmallMemmove@$00@cord_internal@absl@@YAXPEADPEBD_K@Z + ??$SmallMemmove@$0A@@cord_internal@absl@@YAXPEADPEBD_K@Z ??$StrAppend@$$V@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@AEBVAlphaNum@0@1111@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@AEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHAEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z @@ -2485,7 +2487,6 @@ EXPORTS ?SleepFor@absl@@YAXVDuration@1@@Z ?SlowLock@SpinLock@base_internal@absl@@AEAAXXZ ?SlowUnlock@SpinLock@base_internal@absl@@AEAAXI@Z - ?SmallMemmove@cord_internal@absl@@YAXPEADPEBD_K_N@Z ?SnprintF@str_format_internal@absl@@YAHPEAD_KVUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?SpinLockDelay@base_internal@absl@@YAXPEAU?$atomic@I@__1@std@@IHW4SchedulingMode@12@@Z ?SpinLockSuggestedDelayNS@base_internal@absl@@YAHH@Z @@ -3613,7 +3614,7 @@ EXPORTS ?set_cordz_info@InlineData@cord_internal@absl@@QEAAXPEAVCordzInfo@23@@Z ?set_cordz_mean_interval@cord_internal@absl@@YAXH@Z ?set_data@InlineRep@Cord@absl@@QEAAPEAD_K@Z - ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K_N@Z + ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K@Z ?set_depth@CordRepConcat@cord_internal@absl@@QEAAXE@Z ?set_end@CordRepBtree@cord_internal@absl@@AEAAX_K@Z ?set_from_arg@InputValue@UnboundConversion@str_format_internal@absl@@QEAAXH@Z diff --git a/third_party/abseil-cpp/symbols_x64_dbg.def b/third_party/abseil-cpp/symbols_x64_dbg.def index 5c65dda5a6830c..68202396566056 100644 --- a/third_party/abseil-cpp/symbols_x64_dbg.def +++ b/third_party/abseil-cpp/symbols_x64_dbg.def @@ -437,6 +437,8 @@ EXPORTS ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SharedCompareImpl@VCord@absl@@@absl@@YAHAEBVCord@0@0@Z ??$SharedCompareImpl@Vstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@@Z + ??$SmallMemmove@$00@cord_internal@absl@@YAXPEADPEBD_K@Z + ??$SmallMemmove@$0A@@cord_internal@absl@@YAXPEADPEBD_K@Z ??$StrAppend@$$V@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@AEBVAlphaNum@0@1111@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@AEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHAEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z @@ -2487,7 +2489,6 @@ EXPORTS ?SleepFor@absl@@YAXVDuration@1@@Z ?SlowLock@SpinLock@base_internal@absl@@AEAAXXZ ?SlowUnlock@SpinLock@base_internal@absl@@AEAAXI@Z - ?SmallMemmove@cord_internal@absl@@YAXPEADPEBD_K_N@Z ?SnprintF@str_format_internal@absl@@YAHPEAD_KVUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?SpinLockDelay@base_internal@absl@@YAXPEAU?$atomic@I@__1@std@@IHW4SchedulingMode@12@@Z ?SpinLockSuggestedDelayNS@base_internal@absl@@YAHH@Z @@ -3613,7 +3614,7 @@ EXPORTS ?set_cordz_info@InlineData@cord_internal@absl@@QEAAXPEAVCordzInfo@23@@Z ?set_cordz_mean_interval@cord_internal@absl@@YAXH@Z ?set_data@InlineRep@Cord@absl@@QEAAPEAD_K@Z - ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K_N@Z + ?set_data@InlineRep@Cord@absl@@QEAAXPEBD_K@Z ?set_depth@CordRepConcat@cord_internal@absl@@QEAAXE@Z ?set_end@CordRepBtree@cord_internal@absl@@AEAAX_K@Z ?set_from_arg@InputValue@UnboundConversion@str_format_internal@absl@@QEAAXH@Z diff --git a/third_party/abseil-cpp/symbols_x86_dbg.def b/third_party/abseil-cpp/symbols_x86_dbg.def index 4b47ddfd5edae8..85868e26746259 100644 --- a/third_party/abseil-cpp/symbols_x86_dbg.def +++ b/third_party/abseil-cpp/symbols_x86_dbg.def @@ -435,6 +435,8 @@ EXPORTS ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QAE?AUOpResult@012@_NPAUCordRep@12@I@Z ??$SharedCompareImpl@VCord@absl@@@absl@@YAHABVCord@0@0@Z ??$SharedCompareImpl@Vstring_view@absl@@@absl@@YAHABVCord@0@ABVstring_view@0@@Z + ??$SmallMemmove@$00@cord_internal@absl@@YAXPADPBDI@Z + ??$SmallMemmove@$0A@@cord_internal@absl@@YAXPADPBDI@Z ??$StrAppend@$$V@absl@@YAXPAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@ABVAlphaNum@0@1111@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@ABV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHABV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z @@ -2481,7 +2483,6 @@ EXPORTS ?SleepFor@absl@@YAXVDuration@1@@Z ?SlowLock@SpinLock@base_internal@absl@@AAEXXZ ?SlowUnlock@SpinLock@base_internal@absl@@AAEXI@Z - ?SmallMemmove@cord_internal@absl@@YAXPADPBDI_N@Z ?SnprintF@str_format_internal@absl@@YAHPADIVUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?SpinLockDelay@base_internal@absl@@YAXPAU?$atomic@I@__1@std@@IHW4SchedulingMode@12@@Z ?SpinLockSuggestedDelayNS@base_internal@absl@@YAHH@Z @@ -3607,7 +3608,7 @@ EXPORTS ?set_cordz_info@InlineData@cord_internal@absl@@QAEXPAVCordzInfo@23@@Z ?set_cordz_mean_interval@cord_internal@absl@@YAXH@Z ?set_data@InlineRep@Cord@absl@@QAEPADI@Z - ?set_data@InlineRep@Cord@absl@@QAEXPBDI_N@Z + ?set_data@InlineRep@Cord@absl@@QAEXPBDI@Z ?set_depth@CordRepConcat@cord_internal@absl@@QAEXE@Z ?set_end@CordRepBtree@cord_internal@absl@@AAEXI@Z ?set_from_arg@InputValue@UnboundConversion@str_format_internal@absl@@QAEXH@Z From 2d639509785999d11ac1b7fd04dfc00efa2e72fe Mon Sep 17 00:00:00 2001 From: chromium-internal-autoroll Date: Wed, 15 Dec 2021 12:16:53 +0000 Subject: [PATCH 039/133] Roll Fuchsia Internal SDK from 7.20211214.3.1 to 7.20211215.1.1 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://skia-autoroll.corp.goog/r/fuchsia-internal-sdk-chromium Please CC chrome-fuchsia-gardener@grotations.appspotmail.com on the revert to ensure that a human is aware of the problem. To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: chrome-fuchsia-gardener@grotations.appspotmail.com Disable-Retries: true Change-Id: Icf18e442ec2505aa504a949ee0743ebf8193c9f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341616 Commit-Queue: chromium-internal-autoroll Bot-Commit: chromium-internal-autoroll Cr-Commit-Position: refs/heads/main@{#951903} --- build/fuchsia/linux_internal.sdk.sha1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 1a80232775a8af..7ab9e4879c1f15 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1 @@ -1 +1 @@ -7.20211214.3.1 +7.20211215.1.1 From caf396e9741cfbd248a5444b7f4ffda999b4fb28 Mon Sep 17 00:00:00 2001 From: Marek Maslanka Date: Wed, 15 Dec 2021 12:21:53 +0000 Subject: [PATCH 040/133] Remove checks for USE_LIBINPUT in EventDeviceInfo The code that checks if libinput needs to be used for touchpad, is not depending on the libinput. This commit completes changes from https://chromium-review.googlesource.com/c/chromium/src/+/3211447 Bug: b:208192332 Change-Id: I893cb1eaf0d8a0d0875368b45c4e80de76d46ba1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3330203 Reviewed-by: Kerker Yang Reviewed-by: Michael Spang Reviewed-by: Harry Cutts Commit-Queue: Harry Cutts Cr-Commit-Position: refs/heads/main@{#951904} --- ui/events/ozone/evdev/event_device_info.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/events/ozone/evdev/event_device_info.cc b/ui/events/ozone/evdev/event_device_info.cc index ddbc6c4488176b..5c2c0b0f18682e 100644 --- a/ui/events/ozone/evdev/event_device_info.cc +++ b/ui/events/ozone/evdev/event_device_info.cc @@ -96,7 +96,6 @@ constexpr struct { {0x413c, 0x81d5}, // Dell Active Pen PN579X }; -#if defined(USE_LIBINPUT) // Certain devices need to be forced to use libinput in place of // evdev/libgestures constexpr struct { @@ -117,7 +116,6 @@ bool IsForceLibinput(const EventDeviceInfo& devinfo) { return false; } -#endif // Note: this is not SteelSeries's actual VID; the Stratus Duo just reports it // incorrectly over Bluetooth. @@ -568,7 +566,6 @@ bool EventDeviceInfo::IsMicrophoneMuteSwitchDevice() const { bool EventDeviceInfo::UseLibinput() const { bool useLibinput = false; -#if defined(USE_LIBINPUT) if (HasTouchpad()) { auto overridden_state = base::FeatureList::GetStateIfOverridden(ui::kLibinputHandleTouchpad); @@ -579,7 +576,6 @@ bool EventDeviceInfo::UseLibinput() const { IsSemiMultitouch() || IsForceLibinput(*this); } } -#endif return useLibinput; } From 15978967d14e317b93d3c5b16d866cbb05d06051 Mon Sep 17 00:00:00 2001 From: Christoph Schwering Date: Wed, 15 Dec 2021 12:23:03 +0000 Subject: [PATCH 041/133] [Autofill] Fixed performance regression in AutofillAgent. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since https://crrev.com/c/3318298, AutofillAgent::DataListOptionsChanged() schedules a AutofillAgent::BatchDataListOptionChange() call in any case. This is a performance regression if a site adds or removes huge amounts of datalist