diff --git a/DEPS b/DEPS index a4a422b..5dff4331 100644 --- a/DEPS +++ b/DEPS
@@ -126,11 +126,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '66f09a72995a761bb9bde11b0e378ce84b84bae9', + 'skia_revision': 'ac285b1c2ae3155cd9c7c21283e2cbf7f3010cfa', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '91594a65bbcc29d1691d68ec8273dd01f3bb7341', + 'v8_revision': '29cec8c865f7eee774f859047055ceceba94c764', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -189,7 +189,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'ed0a2fef2475995b6f3c3e62cc98313465f8b296', + 'catapult_revision': '63f9b85be556ed82b32e4b9f30b266152d523cdc', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -253,7 +253,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'bb5696bcd3b7a9ba5cd6a74cd1e9665bc74deb2c', + 'dawn_revision': 'f872e6924cbb7ff75738b9ad6560cdb789a91ac1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -948,7 +948,7 @@ Var('chromium_git') + '/external/libaddressinput.git' + '@' + 'd7ed8e2f3f35ce9a3aafdfdc48745ceab66e7229', 'src/third_party/libaom/source/libaom': - Var('aomedia_git') + '/aom.git' + '@' + '20a747b9ce5ec99ad2f78dd206a3fc1b8abf6850', + Var('aomedia_git') + '/aom.git' + '@' + '625cded0550bb79efd10d98a9809a7ccd72a8f60', # Userspace interface to kernel DRM services. 'src/third_party/libdrm/src': { @@ -1296,7 +1296,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@44ab56b963a431e8e4743ef0c06a2e45f45f21d8', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@7567f837ecd0f6bfbad2a5e1b21f60f806e8543f', 'condition': 'checkout_src_internal', },
diff --git a/ash/accessibility/accessibility_controller_unittest.cc b/ash/accessibility/accessibility_controller_unittest.cc index bbc4f8b..03513e8 100644 --- a/ash/accessibility/accessibility_controller_unittest.cc +++ b/ash/accessibility/accessibility_controller_unittest.cc
@@ -495,11 +495,11 @@ } // namespace -INSTANTIATE_TEST_CASE_P(, - AccessibilityControllerSigninTest, - ::testing::Values(TestUserLoginType::kNewUser, - TestUserLoginType::kGuest, - TestUserLoginType::kExistingUser)); +INSTANTIATE_TEST_SUITE_P(, + AccessibilityControllerSigninTest, + ::testing::Values(TestUserLoginType::kNewUser, + TestUserLoginType::kGuest, + TestUserLoginType::kExistingUser)); TEST_P(AccessibilityControllerSigninTest, EnableOnLoginScreenAndLogin) { constexpr float kMagnifierScale = 4.3f;
diff --git a/ash/app_list/app_list_presenter_delegate_unittest.cc b/ash/app_list/app_list_presenter_delegate_unittest.cc index edfc24a9..3007d5a2 100644 --- a/ash/app_list/app_list_presenter_delegate_unittest.cc +++ b/ash/app_list/app_list_presenter_delegate_unittest.cc
@@ -212,7 +212,7 @@ // Instantiate the Boolean which is used to toggle mouse and touch events in // the parameterized tests. -INSTANTIATE_TEST_CASE_P(, AppListPresenterDelegateTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, AppListPresenterDelegateTest, testing::Bool()); TEST_F(PopulatedAppListTest, TappingAppsGridClosesVirtualKeyboard) { InitializeAppsGrid(); @@ -1805,9 +1805,9 @@ // Instantiate the Boolean which is used to toggle mouse and touch events in // the parameterized tests. -INSTANTIATE_TEST_CASE_P(, - AppListPresenterDelegateVirtualKeyboardTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, + AppListPresenterDelegateVirtualKeyboardTest, + testing::Bool()); // Tests that tapping or clicking the body of the applist with an active virtual // keyboard results in the virtual keyboard closing with no side effects.
diff --git a/ash/app_list/home_launcher_gesture_handler_unittest.cc b/ash/app_list/home_launcher_gesture_handler_unittest.cc index 115e0fae..5bc6abc 100644 --- a/ash/app_list/home_launcher_gesture_handler_unittest.cc +++ b/ash/app_list/home_launcher_gesture_handler_unittest.cc
@@ -412,10 +412,10 @@ DISALLOW_COPY_AND_ASSIGN(HomeLauncherModeGestureHandlerTest); }; -INSTANTIATE_TEST_CASE_P(, - HomeLauncherModeGestureHandlerTest, - testing::Values(Mode::kSlideDownToHide, - Mode::kSlideUpToShow)); +INSTANTIATE_TEST_SUITE_P(, + HomeLauncherModeGestureHandlerTest, + testing::Values(Mode::kSlideDownToHide, + Mode::kSlideUpToShow)); // Tests that the window transform and opacity changes as we scroll. TEST_P(HomeLauncherModeGestureHandlerTest, TransformAndOpacityChangesOnScroll) {
diff --git a/ash/app_list/views/search_box_view_unittest.cc b/ash/app_list/views/search_box_view_unittest.cc index 052d5a3..f446c2b 100644 --- a/ash/app_list/views/search_box_view_unittest.cc +++ b/ash/app_list/views/search_box_view_unittest.cc
@@ -469,13 +469,13 @@ DISALLOW_COPY_AND_ASSIGN(SearchBoxViewAutocompleteTest); }; -INSTANTIATE_TEST_CASE_P(, - SearchBoxViewAutocompleteTest, - ::testing::Values(ui::VKEY_LEFT, - ui::VKEY_RIGHT, - ui::VKEY_UP, - ui::VKEY_DOWN, - ui::VKEY_BACK)); +INSTANTIATE_TEST_SUITE_P(, + SearchBoxViewAutocompleteTest, + ::testing::Values(ui::VKEY_LEFT, + ui::VKEY_RIGHT, + ui::VKEY_UP, + ui::VKEY_DOWN, + ui::VKEY_BACK)); // Tests that autocomplete suggestions are consistent with top SearchResult list // titles.
diff --git a/ash/app_list/views/search_result_page_view_unittest.cc b/ash/app_list/views/search_result_page_view_unittest.cc index c2613e9c..bb09bb5 100644 --- a/ash/app_list/views/search_result_page_view_unittest.cc +++ b/ash/app_list/views/search_result_page_view_unittest.cc
@@ -120,7 +120,7 @@ // Instantiate the Boolean which is used to toggle answer cards in // the parameterized tests. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , SearchResultPageViewTest, ::testing::Values(AnswerCardState::ANSWER_CARD_OFF,
diff --git a/ash/app_list/views/search_result_tile_item_list_view_unittest.cc b/ash/app_list/views/search_result_tile_item_list_view_unittest.cc index f3d6a70a..fbae5869 100644 --- a/ash/app_list/views/search_result_tile_item_list_view_unittest.cc +++ b/ash/app_list/views/search_result_tile_item_list_view_unittest.cc
@@ -251,11 +251,11 @@ } } -INSTANTIATE_TEST_CASE_P(, - SearchResultTileItemListViewTest, - testing::ValuesIn({std::make_pair(false, false), - std::make_pair(false, true), - std::make_pair(true, false), - std::make_pair(true, true)})); +INSTANTIATE_TEST_SUITE_P(, + SearchResultTileItemListViewTest, + testing::ValuesIn({std::make_pair(false, false), + std::make_pair(false, true), + std::make_pair(true, false), + std::make_pair(true, true)})); } // namespace app_list
diff --git a/ash/login/ui/login_expanded_public_account_view_unittest.cc b/ash/login/ui/login_expanded_public_account_view_unittest.cc index 1dc294ba..dd9f534c 100644 --- a/ash/login/ui/login_expanded_public_account_view_unittest.cc +++ b/ash/login/ui/login_expanded_public_account_view_unittest.cc
@@ -293,8 +293,8 @@ EXPECT_EQ(test_api.selected_keyboard_item().value, kKeyboardIdForItem1); } -INSTANTIATE_TEST_CASE_P(, - LoginExpandedPublicAccountViewTest, - ::testing::Values("mouse", "touch")); +INSTANTIATE_TEST_SUITE_P(, + LoginExpandedPublicAccountViewTest, + ::testing::Values("mouse", "touch")); } // namespace ash
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc index fa08ec9..2a9dd68 100644 --- a/ash/metrics/user_metrics_recorder.cc +++ b/ash/metrics/user_metrics_recorder.cc
@@ -39,6 +39,7 @@ ACTIVE_WINDOW_STATE_TYPE_SNAPPED, ACTIVE_WINDOW_STATE_TYPE_PINNED, ACTIVE_WINDOW_STATE_TYPE_TRUSTED_PINNED, + ACTIVE_WINDOW_STATE_TYPE_PIP, ACTIVE_WINDOW_STATE_TYPE_COUNT, }; @@ -64,13 +65,14 @@ case mojom::WindowStateType::TRUSTED_PINNED: active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_TRUSTED_PINNED; break; + case mojom::WindowStateType::PIP: + active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_PIP; + break; case mojom::WindowStateType::DEFAULT: case mojom::WindowStateType::NORMAL: case mojom::WindowStateType::MINIMIZED: case mojom::WindowStateType::INACTIVE: case mojom::WindowStateType::AUTO_POSITIONED: - case mojom::WindowStateType::PIP: - // TODO: We probably want to record PIP state. active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER; break; } @@ -101,7 +103,8 @@ // UMA statistics. Note the containers are ordered from top most visible // container to the lowest to allow the |GetNumVisibleWindows| method to short // circuit when processing a maximized or fullscreen window. -int kVisibleWindowContainerIds[] = {kShellWindowId_AlwaysOnTopContainer, +int kVisibleWindowContainerIds[] = {kShellWindowId_PipContainer, + kShellWindowId_AlwaysOnTopContainer, kShellWindowId_DefaultContainer}; // Returns an approximate count of how many windows are currently visible in the
diff --git a/ash/public/cpp/vector_icons/BUILD.gn b/ash/public/cpp/vector_icons/BUILD.gn index 8904355..addac85 100644 --- a/ash/public/cpp/vector_icons/BUILD.gn +++ b/ash/public/cpp/vector_icons/BUILD.gn
@@ -10,6 +10,7 @@ icons = [ "assistant.icon", + "auto_launch_managed_guest_session.icon", "notification_assistant.icon", "notification_captive_portal.icon", "notification_cellular_alert.icon",
diff --git a/ash/public/cpp/vector_icons/auto_launch_managed_guest_session.icon b/ash/public/cpp/vector_icons/auto_launch_managed_guest_session.icon new file mode 100644 index 0000000..83328fd --- /dev/null +++ b/ash/public/cpp/vector_icons/auto_launch_managed_guest_session.icon
@@ -0,0 +1,40 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 96, +MOVE_TO, 48, 8, +CUBIC_TO, 70.08f, 8, 88, 25.92f, 88, 48, +CUBIC_TO, 88, 70.08f, 70.08f, 88, 48, 88, +CUBIC_TO, 25.92f, 88, 8, 70.08f, 8, 48, +CUBIC_TO, 8, 25.92f, 25.92f, 8, 48, 8, +CLOSE, +MOVE_TO, 48, 16, +CUBIC_TO, 42.48f, 16, 38, 20.48f, 38, 26, +CUBIC_TO, 38, 31.52f, 42.48f, 36, 48, 36, +CUBIC_TO, 53.52f, 36, 58, 31.52f, 58, 26, +CUBIC_TO, 58, 20.48f, 53.52f, 16, 48, 16, +CLOSE, +MOVE_TO, 68, 68.88f, +LINE_TO, 68, 51.12f, +CUBIC_TO, 68, 44.8f, 57.48f, 40, 48, 40, +CUBIC_TO, 38.52f, 40, 28, 44.8f, 28, 51.12f, +LINE_TO, 28, 68.88f, +CUBIC_TO, 28, 72.48f, 31.36f, 75.56f, 36, 77.56f, +CUBIC_TO, 39.56f, 79.08f, 43.88f, 80, 48, 80, +CUBIC_TO, 49.32f, 80, 50.68f, 79.88f, 52, 79.68f, +LINE_TO, 52, 71.68f, +CUBIC_TO, 50.68f, 71.88f, 49.32f, 72, 48, 72, +CUBIC_TO, 43.96f, 72, 39.72f, 71.12f, 36.2f, 69.6f, +CUBIC_TO, 37.2f, 66.36f, 42.84f, 64, 48, 64, +CUBIC_TO, 49.32f, 64, 50.68f, 64.16f, 52, 64.48f, +CUBIC_TO, 56.28f, 65.4f, 60, 67.76f, 60, 70.68f, +LINE_TO, 60, 77.56f, +CUBIC_TO, 64.64f, 75.52f, 68, 72.44f, 68, 68.88f, +CLOSE, +MOVE_TO, 49.25f, 60.5f, +CUBIC_TO, 45.8f, 60.5f, 43, 57.7f, 43, 54.25f, +CUBIC_TO, 43, 50.8f, 45.8f, 48, 49.25f, 48, +CUBIC_TO, 52.7f, 48, 55.5f, 50.8f, 55.5f, 54.25f, +CUBIC_TO, 55.5f, 57.7f, 52.7f, 60.5f, 49.25f, 60.5f, +CLOSE
diff --git a/ash/system/message_center/message_center_controller.cc b/ash/system/message_center/message_center_controller.cc index 5229ae4..da282560 100644 --- a/ash/system/message_center/message_center_controller.cc +++ b/ash/system/message_center/message_center_controller.cc
@@ -127,6 +127,7 @@ } message_center::RegisterVectorIcons({&kNotificationAssistantIcon, + &kAutoLaunchManagedGuestSessionIcon, &kNotificationCaptivePortalIcon, &kNotificationCellularAlertIcon, &kNotificationDownloadIcon,
diff --git a/ash/system/power/power_button_controller_unittest.cc b/ash/system/power/power_button_controller_unittest.cc index 0193bafb..b101561 100644 --- a/ash/system/power/power_button_controller_unittest.cc +++ b/ash/system/power/power_button_controller_unittest.cc
@@ -1363,11 +1363,11 @@ power_button_test_api_->GetMenuBoundsInScreen())); } -INSTANTIATE_TEST_CASE_P(AshPowerButtonPosition, - PowerButtonControllerWithPositionTest, - testing::Values(PowerButtonPosition::LEFT, - PowerButtonPosition::RIGHT, - PowerButtonPosition::TOP, - PowerButtonPosition::BOTTOM)); +INSTANTIATE_TEST_SUITE_P(AshPowerButtonPosition, + PowerButtonControllerWithPositionTest, + testing::Values(PowerButtonPosition::LEFT, + PowerButtonPosition::RIGHT, + PowerButtonPosition::TOP, + PowerButtonPosition::BOTTOM)); } // namespace ash
diff --git a/ash/wm/splitview/split_view_highlight_view_unittest.cc b/ash/wm/splitview/split_view_highlight_view_unittest.cc index 6a44b17..0a3149ca 100644 --- a/ash/wm/splitview/split_view_highlight_view_unittest.cc +++ b/ash/wm/splitview/split_view_highlight_view_unittest.cc
@@ -163,9 +163,9 @@ .ApproximatelyEqual(expected_end_transform)); } -INSTANTIATE_TEST_CASE_P(Bounds, - SplitViewHighlightViewPortraitTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(Bounds, + SplitViewHighlightViewPortraitTest, + testing::Bool()); TEST_F(SplitViewHighlightViewTest, RightBounds) { const gfx::Rect bounds(100, 0, 100, 100);
diff --git a/base/task/sequence_manager/sequence_manager_impl_unittest.cc b/base/task/sequence_manager/sequence_manager_impl_unittest.cc index 1b4a4a6..2fdb2bd 100644 --- a/base/task/sequence_manager/sequence_manager_impl_unittest.cc +++ b/base/task/sequence_manager/sequence_manager_impl_unittest.cc
@@ -399,6 +399,11 @@ }; INSTANTIATE_TEST_SUITE_P(, + SequenceManagerTest, + testing::Values(TestType::kUseMockTaskRunner, + TestType::kUseMessagePump)); + +INSTANTIATE_TEST_SUITE_P(, SequenceManagerTestWithMessageLoop, testing::Values(TestType::kUseMessageLoop, TestType::kUseMessagePump));
diff --git a/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc b/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc index 7ad868a7..f508122 100644 --- a/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc +++ b/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc
@@ -319,7 +319,7 @@ // third_party/catapult/tracing/tracing/extras/chrome/event_finder_utils.html // TODO(alexclarke): Rename this event to whatever we end up calling this // after the DoWork / DoDelayed work merge. - TRACE_EVENT0("sequence_manager", "ThreadControllerImpl::RunTask"); + TRACE_EVENT0("toplevel", "ThreadControllerImpl::RunTask"); DCHECK(main_thread_only().task_source); main_thread_only().do_work_running_count++;
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn index 28b0bf7..747245f 100644 --- a/build/config/gcc/BUILD.gn +++ b/build/config/gcc/BUILD.gn
@@ -68,7 +68,7 @@ if (current_toolchain != default_toolchain || gcc_target_rpath == "") { ldflags = [ # Want to pass "\$". GN will re-escape as required for ninja. - "-Wl,-rpath=\$ORIGIN/.", + "-Wl,-rpath=\$ORIGIN", ] } else { ldflags = [ "-Wl,-rpath=${gcc_target_rpath}" ]
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 93ab678..11aa860 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -bb35f192cd364696268d4c71d5f76111799929a8 \ No newline at end of file +ed8a157e58cafeb6f4b58dcbb4e597778bb7c869 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 0d0c78e..8562cec8 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -e26140d9cbd06b18d77aa0bba44d40b60524b749 \ No newline at end of file +c8c284db89064bbf546ba4ef24aa81d9862f63c2 \ No newline at end of file
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index b3fa34c..6f52702 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -1934,10 +1934,18 @@ auto it = element_id_to_scrollbar_layer_ids_.find(scroll_element_id); if (it != element_id_to_scrollbar_layer_ids_.end()) { const ScrollbarLayerIds& layer_ids = it->second; - if (layer_ids.horizontal != Layer::INVALID_ID) - scrollbars.insert(LayerById(layer_ids.horizontal)->ToScrollbarLayer()); - if (layer_ids.vertical != Layer::INVALID_ID) - scrollbars.insert(LayerById(layer_ids.vertical)->ToScrollbarLayer()); + if (layer_ids.horizontal != Layer::INVALID_ID) { + // TODO(bokan): It's a bug that element_id_to_scrollbar_layer_ids_ has a + // mapping to a non-scrollbar layer but avoid returning nullptrs to + // prevent crashes. https://crbug.com/924068. + if (auto* layer = LayerById(layer_ids.horizontal)->ToScrollbarLayer()) + scrollbars.insert(layer); + } + + if (layer_ids.vertical != Layer::INVALID_ID) { + if (auto* layer = LayerById(layer_ids.vertical)->ToScrollbarLayer()) + scrollbars.insert(layer); + } } return scrollbars; }
diff --git a/chrome/android/java/res_autofill_assistant/layout/autofill_assistant_payment_request.xml b/chrome/android/java/res_autofill_assistant/layout/autofill_assistant_payment_request.xml index 9e2e113..b94d0af 100644 --- a/chrome/android/java/res_autofill_assistant/layout/autofill_assistant_payment_request.xml +++ b/chrome/android/java/res_autofill_assistant/layout/autofill_assistant_payment_request.xml
@@ -30,8 +30,6 @@ android:id="@+id/payment_container_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" android:orientation="vertical" /> </org.chromium.chrome.browser.widget.FadingEdgeScrollView> @@ -42,8 +40,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" + android:layout_marginTop="18dp" android:background="@drawable/autofill_assistant_lightblue_rect_bg"> <!-- Set paddingStart to add padding between radio-button and text.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java index a771035..f458865 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java
@@ -30,6 +30,7 @@ private static final int CHILDREN_HORIZONTAL_MARGIN_DP = 24; private static final int CHILDREN_VERTICAL_MARGIN_DP = 20; private static final int DETAILS_ONLY_VERTICAL_MARGIN_DP = 48; + private static final int PAYMENT_REQUEST_MARGIN_BOTTOM_DP = 16; // The top padding that should be applied to the bottom bar when the swiping indicator is // hidden. @@ -44,6 +45,7 @@ private final int mDetailsOnlyVerticalMargin; private final int mChildrenVerticalSpacing; private final int mBottomBarWithoutIndicatorPaddingTop; + private final int mPaymentRequestMarginBottom; // Child coordinators. private final AssistantHeaderCoordinator mHeaderCoordinator; @@ -69,6 +71,8 @@ mBottomBarWithoutIndicatorPaddingTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, BOTTOM_BAR_WITHOUT_INDICATOR_PADDING_TOP_DP, displayMetrics); + mPaymentRequestMarginBottom = (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, PAYMENT_REQUEST_MARGIN_BOTTOM_DP, displayMetrics); // Instantiate child components. mHeaderCoordinator = @@ -167,7 +171,7 @@ LinearLayout.LayoutParams paymentRequestLayoutParams = (LinearLayout.LayoutParams) paymentRequestView.getLayoutParams(); paymentRequestLayoutParams.setMargins(mChildrenHorizontalMargin, topMargin, - mChildrenVerticalSpacing, mChildrenHorizontalMargin); + mChildrenHorizontalMargin, mPaymentRequestMarginBottom); paymentRequestView.setLayoutParams(paymentRequestLayoutParams); topMargin = 0;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/payment/PaymentRequestUI.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/payment/PaymentRequestUI.java index e6c5164..dffee23 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/payment/PaymentRequestUI.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/payment/PaymentRequestUI.java
@@ -352,6 +352,10 @@ new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + // Always show separator at the top. + mPaymentContainer.setEdgeVisibility( + FadingEdgeScrollView.EdgeType.HARD, FadingEdgeScrollView.EdgeType.FADING); + if (mRequestContactDetails) { mPaymentContainerLayout.addView(mContactDetailsSection, new LinearLayout.LayoutParams( @@ -373,6 +377,18 @@ new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + PaymentRequestSection sections[] = + new PaymentRequestSection[] {mOrderSummarySection, mShippingAddressSection, + mShippingOptionSection, mContactDetailsSection, mPaymentMethodSection}; + for (int i = 0; i < sections.length; i++) { + clearLeftRightPadding(sections[i]); + } + + // Always expand separators to make them align with the rest of the UI. + for (int i = 0; i < mSectionSeparators.size(); i++) { + mSectionSeparators.get(i).expand(); + } + mRequestView.addOnLayoutChangeListener(new PeekingAnimator()); // Enabled in updatePayButtonEnabled() when the user has selected all payment options. @@ -382,6 +398,11 @@ updateSectionVisibility(); } + private void clearLeftRightPadding(PaymentRequestSection section) { + section.setPadding( + /*left=*/0, section.getPaddingTop(), /*right=*/0, section.getPaddingBottom()); + } + /** * Closes the UI. Can be invoked in response to, for example: * <ul> @@ -731,14 +752,6 @@ // Container now takes the full height of the screen, animating towards it. mRequestView.getLayoutParams().height = LayoutParams.MATCH_PARENT; mRequestView.addOnLayoutChangeListener(new SheetEnlargingAnimator(true)); - - // New separators appear at the top and bottom of the list. - mPaymentContainer.setEdgeVisibility( - FadingEdgeScrollView.EdgeType.HARD, FadingEdgeScrollView.EdgeType.FADING); - mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout, -1)); - - // Expand all the dividers. - for (int i = 0; i < mSectionSeparators.size(); i++) mSectionSeparators.get(i).expand(); mPaymentContainerLayout.requestLayout(); // Disable all but the first button.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java index 7ce99e9..d787598d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java
@@ -77,7 +77,7 @@ @Override public void onSignInComplete() { if (ChromeFeatureList.isEnabled(ChromeFeatureList.UNIFIED_CONSENT)) { - UnifiedConsentServiceBridge.enableGoogleServices(); + UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled(true); } // Show sync settings if user pressed the "Settings" button. if (setUp) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java index 20786b9..48461d7f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFragment.java
@@ -134,7 +134,7 @@ SigninManager.get().signIn(accountName, getActivity(), new SigninManager.SignInCallback() { @Override public void onSignInComplete() { - UnifiedConsentServiceBridge.enableGoogleServices(); + UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled(true); if (settingsClicked) { PreferencesLauncher.launchSettingsPage(getActivity(), SyncAndServicesPreferences.class,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/UnifiedConsentServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/UnifiedConsentServiceBridge.java index 1b6465cd..bbf79a6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/UnifiedConsentServiceBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/UnifiedConsentServiceBridge.java
@@ -13,21 +13,6 @@ public class UnifiedConsentServiceBridge { private UnifiedConsentServiceBridge() {} - /** Sets whether the user has given unified consent. */ - public static void setUnifiedConsentGiven(boolean unifiedConsentGiven) { - nativeSetUnifiedConsentGiven(Profile.getLastUsedProfile(), unifiedConsentGiven); - } - - /** Returns whether the user has given unified consent. */ - public static boolean isUnifiedConsentGiven() { - return nativeIsUnifiedConsentGiven(Profile.getLastUsedProfile()); - } - - /** Enables Google services when the user is signing in. */ - public static void enableGoogleServices() { - nativeEnableGoogleServices(Profile.getLastUsedProfile()); - } - /** Returns whether collection of URL-keyed anonymized data is enabled. */ public static boolean isUrlKeyedAnonymizedDataCollectionEnabled() { return nativeIsUrlKeyedAnonymizedDataCollectionEnabled(Profile.getLastUsedProfile()); @@ -43,10 +28,6 @@ return nativeIsUrlKeyedAnonymizedDataCollectionManaged(Profile.getLastUsedProfile()); } - private static native void nativeSetUnifiedConsentGiven(Profile profile, boolean consentGiven); - private static native boolean nativeIsUnifiedConsentGiven(Profile profile); - private static native void nativeEnableGoogleServices(Profile profile); - private static native boolean nativeIsUrlKeyedAnonymizedDataCollectionEnabled(Profile profile); private static native void nativeSetUrlKeyedAnonymizedDataCollectionEnabled( Profile profile, boolean enabled);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java index 194e7a2..de03baa 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java
@@ -88,6 +88,9 @@ public void destroy() { destroyFetcher(); + if (mUpdateFailureHandler != null) { + mUpdateFailureHandler.removeCallbacksAndMessages(null); + } } public static void setUpdatesEnabledForTesting(boolean enabled) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java index bd2abfc..08a8d695 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java
@@ -11,18 +11,22 @@ import android.content.Intent; import android.support.v4.app.NotificationCompat; -import org.chromium.base.ApiCompatibilityUtils; +import org.chromium.base.ContextUtils; import org.chromium.base.metrics.RecordUserAction; import org.chromium.blink_public.platform.WebDisplayMode; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeFeatureList; +import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; import org.chromium.chrome.browser.notifications.channels.ChannelDefinitions; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.util.IntentUtils; import org.chromium.ui.base.Clipboard; +import java.lang.ref.WeakReference; + /** * Manages the notification shown by Chrome when running standalone Web Apps. It accomplishes * number of goals: @@ -42,91 +46,95 @@ return ChromeFeatureList.isEnabled(ChromeFeatureList.PWA_PERSISTENT_NOTIFICATION); } - private final WebappActivity mWebappActivity; - - public WebappActionsNotificationManager(WebappActivity webappActivity) { - this.mWebappActivity = webappActivity; - } - - public void maybeShowNotification() { - if (!isEnabled() || mWebappActivity.getActivityTab() == null) return; + public static void maybeShowNotification(Tab tab, WebappInfo webappInfo) { + if (!isEnabled() || tab == null) return; // All features provided by the notification are also available in the minimal-ui toolbar. - if (mWebappActivity.getWebappInfo().displayMode() == WebDisplayMode.MINIMAL_UI) { + if (webappInfo.displayMode() == WebDisplayMode.MINIMAL_UI) { return; } - Notification notification = createNotification(); - NotificationManager nm = (NotificationManager) mWebappActivity.getSystemService( - Context.NOTIFICATION_SERVICE); + Context appContext = ContextUtils.getApplicationContext(); + Notification notification = createNotification(appContext, tab, webappInfo); + NotificationManager nm = + (NotificationManager) appContext.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(NotificationConstants.NOTIFICATION_ID_WEBAPP_ACTIONS, notification); NotificationUmaTracker.getInstance().onNotificationShown( NotificationUmaTracker.SystemNotificationType.WEBAPP_ACTIONS, notification); } - private Notification createNotification() { - int intentFlags = Intent.FLAG_ACTIVITY_NEW_TASK - | ApiCompatibilityUtils.getActivityNewDocumentFlag() - | Intent.FLAG_ACTIVITY_CLEAR_TOP; - int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT; - - PendingIntent focusIntent = PendingIntent.getActivity(mWebappActivity, 0, - new Intent(mWebappActivity, mWebappActivity.getClass()) - .setAction(ACTION_FOCUS) - .setFlags(intentFlags), - pendingIntentFlags); - - PendingIntent openInChromeIntent = PendingIntent.getActivity(mWebappActivity, 0, - new Intent(mWebappActivity, mWebappActivity.getClass()) - .setAction(ACTION_OPEN_IN_CHROME) - .setFlags(intentFlags), - pendingIntentFlags); - - PendingIntent shareIntent = PendingIntent.getActivity(mWebappActivity, 0, - new Intent(mWebappActivity, mWebappActivity.getClass()) - .setAction(ACTION_SHARE) - .setFlags(intentFlags), - pendingIntentFlags); + private static Notification createNotification( + Context appContext, Tab tab, WebappInfo webappInfo) { + // The pending intents target an activity (instead of a service or a broadcast receiver) so + // that the notification tray closes when a user taps the one of the notification action + // links. + PendingIntent focusIntent = createPendingIntentWithAction(appContext, tab, ACTION_FOCUS); + PendingIntent openInChromeIntent = + createPendingIntentWithAction(appContext, tab, ACTION_OPEN_IN_CHROME); + PendingIntent shareIntent = createPendingIntentWithAction(appContext, tab, ACTION_SHARE); return NotificationBuilderFactory .createChromeNotificationBuilder( true /* prefer compat */, ChannelDefinitions.ChannelId.WEBAPP_ACTIONS) .setSmallIcon(R.drawable.ic_chrome) - .setContentTitle(mWebappActivity.getWebappInfo().shortName()) - .setContentText(mWebappActivity.getString(R.string.webapp_tap_to_copy_url)) + .setContentTitle(webappInfo.shortName()) + .setContentText(appContext.getString(R.string.webapp_tap_to_copy_url)) .setShowWhen(false) .setAutoCancel(false) .setOngoing(true) .setPriorityBeforeO(NotificationCompat.PRIORITY_MIN) .setContentIntent(focusIntent) .addAction(R.drawable.ic_share_white_24dp, - mWebappActivity.getResources().getString(R.string.share), shareIntent) + appContext.getResources().getString(R.string.share), shareIntent) .addAction(R.drawable.ic_exit_to_app_white_24dp, - mWebappActivity.getResources().getString(R.string.menu_open_in_chrome), + appContext.getResources().getString(R.string.menu_open_in_chrome), openInChromeIntent) .build(); } - public void cancelNotification() { + /** Creates an intent which targets {@link WebappLauncherActivity} with the passed-in action. */ + private static PendingIntent createPendingIntentWithAction( + Context context, Tab tab, String action) { + Intent intent = new Intent(action); + intent.setClass(context, WebappLauncherActivity.class); + intent.putExtra(IntentHandler.EXTRA_TAB_ID, tab.getId()); + IntentHandler.addTrustedIntentExtras(intent); + return PendingIntent.getActivity(context, 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT); + } + + public static void cancelNotification() { if (!isEnabled()) return; - NotificationManager nm = (NotificationManager) mWebappActivity.getSystemService( - Context.NOTIFICATION_SERVICE); + NotificationManager nm = + (NotificationManager) ContextUtils.getApplicationContext().getSystemService( + Context.NOTIFICATION_SERVICE); nm.cancel(NotificationConstants.NOTIFICATION_ID_WEBAPP_ACTIONS); } - public boolean handleNotificationAction(Intent intent) { + public static boolean handleNotificationAction(Intent intent) { + if (!IntentHandler.wasIntentSenderChrome(intent)) return false; + + int tabId = + IntentUtils.safeGetIntExtra(intent, IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); + WeakReference<WebappActivity> webappActivityRef = + WebappActivity.findWebappActivityWithTabId(tabId); + if (webappActivityRef == null) return false; + + WebappActivity webappActivity = webappActivityRef.get(); + if (webappActivity == null) return false; + if (ACTION_SHARE.equals(intent.getAction())) { // Not routing through onMenuOrKeyboardAction to control UMA String. - mWebappActivity.onShareMenuItemSelected( - false /* share directly */, mWebappActivity.getCurrentTabModel().isIncognito()); + webappActivity.onShareMenuItemSelected( + false /* share directly */, webappActivity.getCurrentTabModel().isIncognito()); RecordUserAction.record("Webapp.NotificationShare"); return true; } else if (ACTION_OPEN_IN_CHROME.equals(intent.getAction())) { - mWebappActivity.onMenuOrKeyboardAction(R.id.open_in_browser_id, false /* fromMenu */); + webappActivity.onMenuOrKeyboardAction(R.id.open_in_browser_id, false /* fromMenu */); return true; } else if (ACTION_FOCUS.equals(intent.getAction())) { - Tab tab = mWebappActivity.getActivityTab(); + Tab tab = webappActivity.getActivityTab(); if (tab != null) Clipboard.getInstance().copyUrlToClipboard(tab.getOriginalUrl()); RecordUserAction.record("Webapp.NotificationFocused"); return true;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java index e6e4b4d..4ef16c0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.webapps; +import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; @@ -64,6 +65,7 @@ import java.io.File; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.TimeUnit; @@ -99,7 +101,6 @@ | View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_IMMERSIVE; - private final WebappActionsNotificationManager mNotificationManager; private final WebappDirectoryManager mDirectoryManager; private WebappInfo mWebappInfo; @@ -123,6 +124,22 @@ new HashMap<String, WebappInfo>(); } + /** Returns the running WebappActivity with the given tab id. Returns null if there is none. */ + public static WeakReference<WebappActivity> findWebappActivityWithTabId(int tabId) { + if (tabId == Tab.INVALID_TAB_ID) return null; + + for (Activity activity : ApplicationStatus.getRunningActivities()) { + if (!(activity instanceof WebappActivity)) continue; + + WebappActivity webappActivity = (WebappActivity) activity; + Tab tab = webappActivity.getActivityTab(); + if (tab != null && tab.getId() == tabId) { + return new WeakReference<>(webappActivity); + } + } + return null; + } + /** * Construct all the variables that shouldn't change. We do it here both to clarify when the * objects are created and to ensure that they exist throughout the parallelized initialization @@ -133,15 +150,12 @@ mDirectoryManager = new WebappDirectoryManager(); mSplashController = new WebappSplashScreenController(); mDisclosureSnackbarController = new WebappDisclosureSnackbarController(); - mNotificationManager = new WebappActionsNotificationManager(this); } @Override protected void onNewIntent(Intent intent) { if (intent == null) return; - if (mNotificationManager.handleNotificationAction(intent)) return; - super.onNewIntent(intent); WebappInfo newWebappInfo = popWebappInfo(WebappInfo.idFromIntent(intent)); @@ -452,7 +466,7 @@ @Override public void onResumeWithNative() { super.onResumeWithNative(); - mNotificationManager.maybeShowNotification(); + WebappActionsNotificationManager.maybeShowNotification(getActivityTab(), mWebappInfo); WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataStorage(mWebappInfo.id()); if (storage != null) { @@ -462,7 +476,7 @@ @Override public void onPauseWithNative() { - mNotificationManager.cancelNotification(); + WebappActionsNotificationManager.cancelNotification(); super.onPauseWithNative(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java index 3855788..a2691b7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
@@ -33,6 +33,8 @@ import org.chromium.webapk.lib.client.WebApkValidator; import org.chromium.webapk.lib.common.WebApkConstants; +import java.lang.ref.WeakReference; + /** * Launches web apps. This was separated from the ChromeLauncherActivity because the * ChromeLauncherActivity is not allowed to be excluded from Android's Recents: crbug.com/517426. @@ -96,21 +98,13 @@ * @return True if a live WebappActivity was found, false otherwise. */ public static boolean bringWebappToFront(int tabId) { - if (tabId == Tab.INVALID_TAB_ID) return false; + WeakReference<WebappActivity> webappActivity = + WebappActivity.findWebappActivityWithTabId(tabId); + if (webappActivity == null || webappActivity.get() == null) return false; - for (Activity activity : ApplicationStatus.getRunningActivities()) { - if (!(activity instanceof WebappActivity)) continue; - - WebappActivity webappActivity = (WebappActivity) activity; - if (webappActivity.getActivityTab() != null - && webappActivity.getActivityTab().getId() == tabId) { - Tab tab = webappActivity.getActivityTab(); - tab.getTabWebContentsDelegateAndroid().activateContents(); - return true; - } - } - - return false; + Tab tab = webappActivity.get().getActivityTab(); + tab.getTabWebContentsDelegateAndroid().activateContents(); + return true; } /** @@ -138,9 +132,14 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); long createTimestamp = SystemClock.elapsedRealtime(); + Intent intent = getIntent(); + + if (WebappActionsNotificationManager.handleNotificationAction(intent)) { + finish(); + return; + } ChromeWebApkHost.init(); - Intent intent = getIntent(); WebappInfo webappInfo = tryCreateWebappInfo(intent); if (shouldRelaunchWebApk(intent, webappInfo)) { @@ -389,13 +388,6 @@ // clicks a link to takes them back to the scope of a WebAPK, we want to destroy the // CustomTabActivity activity and go back to the WebAPK activity. It is intentional that // Custom Tab will not be reachable with a back button. - - // In addition FLAG_ACTIVITY_NEW_DOCUMENT is required otherwise on Samsung Lollipop devices - // an Intent to an existing top Activity (such as sent from the Webapp Actions Notification) - // will trigger a new WebappActivity to be launched and onCreate called instead of - // onNewIntent of the existing WebappActivity being called. - // TODO(pkotwicz): Route Webapp Actions Notification actions through new intent filter - // instead of WebappLauncherActivity. http://crbug.com/894610 if (webappInfo.isSplashProvidedByWebApk()) { webappActivityLaunchIntent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java index 9d60d4d..3462472 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java
@@ -145,7 +145,7 @@ // Without this callback we were seeing a short flash of white between the splash screen and // the web content (crbug.com/734500). mCompositorViewHolder.getCompositorView().surfaceRedrawNeededAsync(() -> { - if (mDelegate != null && !mDelegate.isSplashVisible()) return; + if (mDelegate == null || !mDelegate.isSplashVisible()) return; mDelegate.hideSplash(onHiddenCallback); }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java index 72e198f..628a9b45 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
@@ -17,7 +17,6 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.bookmarks.BookmarkBridge; @@ -168,7 +167,6 @@ @Test @LargeTest @Feature({"Sync"}) - @DisabledTest // https://crbug.com/930729 public void testDownloadMovedBookmark() throws Exception { // Add the entity to test moving. addServerBookmark(TITLE, URL); @@ -203,8 +201,9 @@ mSyncTestRule.pollInstrumentationThread(new ClientBookmarksCriteria() { @Override public boolean isSatisfied(List<Bookmark> bookmarks) { + Bookmark modifiedBookmark = bookmarks.get(bookmarks.get(0).isFolder() ? 1 : 0); // The "s" is prepended because the server adds one to the parentId. - return bookmarks.get(bookmarkIndex).parentId.equals("s" + folder.id); + return modifiedBookmark.parentId.equals("s" + folder.id); } }); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java index 84f2f63..e53ba919 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java
@@ -25,6 +25,7 @@ import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowApplication; import org.robolectric.shadows.ShadowBitmap; +import org.robolectric.shadows.ShadowLooper; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.Callback; @@ -572,7 +573,7 @@ updateIfNeeded(updateManager); assertTrue(updateManager.updateCheckStarted()); - updateManager.onGotManifestData(null, null, null); + ShadowLooper.runUiThreadTasksIncludingDelayedTasks(); assertTrue(updateManager.updateRequested()); assertEquals(NAME, updateManager.requestedUpdateName()); @@ -582,6 +583,29 @@ } /** + * Test that an update is not done if: + * - WebAPK's code is out of date + * AND + * - WebApkUpdateManager has been destroyed. + */ + @Test + public void testDontRequestUpdateAfterManagerDestroyed() { + registerWebApk(WEBAPK_PACKAGE_NAME, defaultManifestData(), + REQUEST_UPDATE_FOR_SHELL_APK_VERSION - 1); + mClockRule.advance(WebappDataStorage.UPDATE_INTERVAL); + + TestWebApkUpdateManager updateManager = + new TestWebApkUpdateManager(getStorage(WEBAPK_PACKAGE_NAME)); + updateIfNeeded(updateManager); + assertTrue(updateManager.updateCheckStarted()); + + updateManager.destroy(); + + ShadowLooper.runUiThreadTasksIncludingDelayedTasks(); + assertFalse(updateManager.updateRequested()); + } + + /** * Test that an update with data from the fetched Web Manifest is done if the WebAPK's code is * out of date and the WebAPK's start_url refers to a Web Manifest. */
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index 9a5ca4b..6dc36e3 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-74.0.3703.0_rc-r1-merged.afdo.bz2 \ No newline at end of file +chromeos-chrome-amd64-74.0.3704.0_rc-r1-merged.afdo.bz2 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index b8db426..0d81a03b 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -1734,6 +1734,15 @@ Learn more. </message> + <!--Auto launch managed guest sessions privacy notification --> + <message name="IDS_AUTO_LAUNCH_NOTIFICATION_TITLE" desc="Title of the notification which is shown when the managed guest session auto launched."> + This Chromebook can be monitored + </message> + <message name="IDS_AUTO_LAUNCH_NOTIFICATION_MESSAGE" desc="Message of the notification which is shown when the managed guest session auto launched."> + <ph name="ENROLLMENT_DOMAIN">$1<ex>example.com</ex></ph> manages this device and has access to all user activity, including webpages visited, passwords, and email. See details. + </message> + + <!-- Removable device notifications --> <message name="IDS_REMOVABLE_DEVICE_DETECTION_TITLE" desc="Text of notification message which is shown when user inserts removable device (SD card, USB key...)"> Removable device detected
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index f24abdd..afa0d73 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -478,6 +478,18 @@ </if> <if expr="chromeos"> + <!-- Contained Shell page. Note that this experience is currently a prototype and is not shown + to end users at this point. + TODO(922687): Change these strings to the final ones when our internal repo is ready.--> + <message name="IDS_SETTINGS_CONTAINED_SHELL_TITLE" desc="The title of Contained Shell section." translateable="false"> + Contained Shell (Dev) + </message> + <message name="IDS_SETTINGS_CONTAINED_SHELL_LABEL" desc="The text associated with the contained shell section setting." translateable="false"> + Contained Shell + </message> + <message name="IDS_SETTINGS_CONTAINED_SHELL_SUBTEXT" desc="The subtext associated with the contained shell section setting." translateable="false"> + Enables the Contained Shell for the next sign in. + </message> <!-- Crostini Page --> <message name="IDS_SETTINGS_CROSTINI_TITLE" desc="The title of Crostini section."> Linux (Beta)
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index dfc4cc0..026813a 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2740,12 +2740,6 @@ flag_descriptions::kExpensiveBackgroundTimerThrottlingName, flag_descriptions::kExpensiveBackgroundTimerThrottlingDescription, kOsAll, FEATURE_VALUE_TYPE(features::kExpensiveBackgroundTimerThrottling)}, -#if defined(OS_CHROMEOS) - {"enumerate-audio-devices", - flag_descriptions::kEnableEnumeratingAudioDevicesName, - flag_descriptions::kEnableEnumeratingAudioDevicesDescription, kOsCrOS, - FEATURE_VALUE_TYPE(features::kEnumerateAudioDevices)}, -#endif // OS_CHROMEOS #if defined(OS_ANDROID) {"modal-permission-prompts", flag_descriptions::kModalPermissionPromptsName, flag_descriptions::kModalPermissionPromptsDescription, kOsAndroid, @@ -3717,10 +3711,6 @@ flag_descriptions::kEnableSyncPseudoUSSHistoryDeleteDirectivesDescription, kOsAll, FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSHistoryDeleteDirectives)}, - {"enable-sync-pseudo-uss-passwords", - flag_descriptions::kEnableSyncPseudoUSSPasswordsName, - flag_descriptions::kEnableSyncPseudoUSSPasswordsDescription, kOsAll, - FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSPasswords)}, {"enable-sync-pseudo-uss-preferences", flag_descriptions::kEnableSyncPseudoUSSPreferencesName, flag_descriptions::kEnableSyncPseudoUSSPreferencesDescription, kOsAll, @@ -3829,6 +3819,10 @@ {"cct-module-custom-header", flag_descriptions::kCCTModuleCustomHeaderName, flag_descriptions::kCCTModuleCustomHeaderDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kCCTModuleCustomHeader)}, + {"cct-module-custom-request-header", + flag_descriptions::kCCTModuleCustomRequestHeaderName, + flag_descriptions::kCCTModuleCustomRequestHeaderDescription, kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kCCTModuleCustomRequestHeader)}, {"cct-module-dex-loading", flag_descriptions::kCCTModuleDexLoadingName, flag_descriptions::kCCTModuleDexLoadingDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kCCTModuleDexLoading)},
diff --git a/chrome/browser/android/signin/unified_consent_service_bridge.cc b/chrome/browser/android/signin/unified_consent_service_bridge.cc index 3dd93c2..d0d62a5 100644 --- a/chrome/browser/android/signin/unified_consent_service_bridge.cc +++ b/chrome/browser/android/signin/unified_consent_service_bridge.cc
@@ -13,29 +13,6 @@ using base::android::JavaParamRef; -static jboolean JNI_UnifiedConsentServiceBridge_IsUnifiedConsentGiven( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& profileAndroid) { - // TODO(crbug.com/907856): Remove. - return false; -} - -static void JNI_UnifiedConsentServiceBridge_SetUnifiedConsentGiven( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& profileAndroid, - jboolean unifiedConsentGiven) { - // TODO(crbug.com/907856): Remove. -} - -static void JNI_UnifiedConsentServiceBridge_EnableGoogleServices( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& profileAndroid) { - Profile* profile = ProfileAndroid::FromProfileAndroid(profileAndroid); - auto* unifiedConsentService = - UnifiedConsentServiceFactory::GetForProfile(profile); - return unifiedConsentService->EnableGoogleServices(); -} - static jboolean JNI_UnifiedConsentServiceBridge_IsUrlKeyedAnonymizedDataCollectionEnabled( JNIEnv* env, @@ -45,17 +22,6 @@ unified_consent::prefs::kUrlKeyedAnonymizedDataCollectionEnabled); } -static void -JNI_UnifiedConsentServiceBridge_SetUrlKeyedAnonymizedDataCollectionEnabled( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& profileAndroid, - const jboolean enabled) { - Profile* profile = ProfileAndroid::FromProfileAndroid(profileAndroid); - profile->GetPrefs()->SetBoolean( - unified_consent::prefs::kUrlKeyedAnonymizedDataCollectionEnabled, - enabled); -} - static jboolean JNI_UnifiedConsentServiceBridge_IsUrlKeyedAnonymizedDataCollectionManaged( JNIEnv* env, @@ -64,3 +30,14 @@ return profile->GetPrefs()->IsManagedPreference( unified_consent::prefs::kUrlKeyedAnonymizedDataCollectionEnabled); } + +static void +JNI_UnifiedConsentServiceBridge_SetUrlKeyedAnonymizedDataCollectionEnabled( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& profileAndroid, + const jboolean enabled) { + Profile* profile = ProfileAndroid::FromProfileAndroid(profileAndroid); + auto* unifiedConsentService = + UnifiedConsentServiceFactory::GetForProfile(profile); + unifiedConsentService->SetUrlKeyedAnonymizedDataCollectionEnabled(true); +}
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 6275a81e..5b11d4f 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -3476,10 +3476,10 @@ registry->rules_cache_delegate_for_testing()->type()); } -INSTANTIATE_TEST_CASE_P(, - WebViewChannelTest, - testing::Values(version_info::Channel::UNKNOWN, - version_info::Channel::STABLE)); +INSTANTIATE_TEST_SUITE_P(, + WebViewChannelTest, + testing::Values(version_info::Channel::UNKNOWN, + version_info::Channel::STABLE)); // This test verifies that webview.contentWindow works inside an iframe. IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebViewInsideFrame) { @@ -3916,9 +3916,9 @@ // Create two test instances, one where the guest body is scrollable and the // other where the body is not scrollable: fast-path scrolling will generate // different ack results in between these two cases. -INSTANTIATE_TEST_CASE_P(WebViewScrollBubbling, - WebViewGuestScrollTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(WebViewScrollBubbling, + WebViewGuestScrollTest, + testing::Bool()); IN_PROC_BROWSER_TEST_P(WebViewGuestScrollTest, TestGuestWheelScrollsBubble) { LoadAppWithGuest("web_view/scrollable_embedder_and_guest"); @@ -4081,9 +4081,9 @@ guest_frame_observer.WaitForScrollOffset(default_offset); } -INSTANTIATE_TEST_CASE_P(WebViewScrollBubbling, - WebViewGuestScrollTouchTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(WebViewScrollBubbling, + WebViewGuestScrollTouchTest, + testing::Bool()); IN_PROC_BROWSER_TEST_P(WebViewGuestScrollTouchTest, TestGuestGestureScrollsBubble) {
diff --git a/chrome/browser/autofill/autofill_autocomplete_browsertest.cc b/chrome/browser/autofill/autofill_autocomplete_browsertest.cc index c9c3e51..08ecfad 100644 --- a/chrome/browser/autofill/autofill_autocomplete_browsertest.cc +++ b/chrome/browser/autofill/autofill_autocomplete_browsertest.cc
@@ -413,6 +413,6 @@ ValidateSingleValue(prefix, test_value); } -INSTANTIATE_TEST_CASE_P(, AutofillAutocompleteTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, AutofillAutocompleteTest, testing::Bool()); } // namespace autofill
diff --git a/chrome/browser/autofill/autofill_captured_sites_interactive_uitest.cc b/chrome/browser/autofill/autofill_captured_sites_interactive_uitest.cc index 406cfb1..a2980ef 100644 --- a/chrome/browser/autofill/autofill_captured_sites_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_captured_sites_interactive_uitest.cc
@@ -305,8 +305,8 @@ recipe_replayer()->ReplayTest(capture_file_path, recipe_file_path)); } -INSTANTIATE_TEST_CASE_P(, - AutofillCapturedSitesInteractiveTest, - testing::ValuesIn(GetCapturedSites()), - GetParamAsString()); +INSTANTIATE_TEST_SUITE_P(, + AutofillCapturedSitesInteractiveTest, + testing::ValuesIn(GetCapturedSites()), + GetParamAsString()); } // namespace autofill
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index b85825d..5fa880e5 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -3466,13 +3466,13 @@ ExpectFieldValue("phone", "15125551234"); } -INSTANTIATE_TEST_CASE_P(All, AutofillCompanyInteractiveTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(All, AutofillCompanyInteractiveTest, testing::Bool()); -INSTANTIATE_TEST_CASE_P(All, - AutofillDynamicFormInteractiveTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(All, + AutofillDynamicFormInteractiveTest, + testing::Bool()); -INSTANTIATE_TEST_CASE_P(All, - AutofillRestrictUnownedFieldsTest, - testing::Combine(testing::Bool(), testing::Bool())); +INSTANTIATE_TEST_SUITE_P(All, + AutofillRestrictUnownedFieldsTest, + testing::Combine(testing::Bool(), testing::Bool())); } // namespace autofill
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index 5d3a1ac8..0247eb0 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc
@@ -228,8 +228,8 @@ is_expected_to_pass); } -INSTANTIATE_TEST_CASE_P(AllForms, - FormStructureBrowserTest, - testing::ValuesIn(GetTestFiles())); +INSTANTIATE_TEST_SUITE_P(AllForms, + FormStructureBrowserTest, + testing::ValuesIn(GetTestFiles())); } // namespace autofill
diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 1ddcb7f..a13f4b88 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc
@@ -160,9 +160,9 @@ GetEncoding()); } -INSTANTIATE_TEST_CASE_P(EncodingAliases, - BrowserEncodingTest, - testing::ValuesIn(kEncodingTestDatas)); +INSTANTIATE_TEST_SUITE_P(EncodingAliases, + BrowserEncodingTest, + testing::ValuesIn(kEncodingTestDatas)); // The following encodings are excluded from the auto-detection test because // it's a known issue that the current encoding detector does not detect them:
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index a35b82e4..11daea22 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -332,6 +332,7 @@ #include "storage/browser/fileapi/external_mount_points.h" #include "third_party/blink/public/common/service_worker/service_worker_utils.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" +#include "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom.h" #include "third_party/blink/public/platform/modules/installedapp/installed_app_provider.mojom.h" #include "third_party/blink/public/platform/modules/webshare/webshare.mojom.h" #include "third_party/widevine/cdm/buildflags.h" @@ -1055,6 +1056,20 @@ return content::BuildUserAgentFromProduct(product); } +blink::UserAgentMetadata GetUserAgentMetadata() { + blink::UserAgentMetadata metadata; + + metadata.brand = version_info::GetProductName(); + metadata.version = version_info::GetVersionNumber(); + metadata.platform = version_info::GetOSType(); + + // TODO(mkwst): Poke at BuildUserAgentFromProduct to split out these pieces. + metadata.architecture = ""; + metadata.model = ""; + + return metadata; +} + ChromeContentBrowserClient::ChromeContentBrowserClient( ChromeFeatureListCreator* chrome_feature_list_creator) : chrome_feature_list_creator_(chrome_feature_list_creator), @@ -1111,6 +1126,8 @@ // used for mapping the command-line flags). registry->RegisterStringPref(prefs::kIsolateOrigins, std::string()); registry->RegisterBooleanPref(prefs::kSitePerProcess, false); + registry->RegisterDictionaryPref( + prefs::kDevToolsBackgroundServicesExpirationDict); #if !defined(OS_ANDROID) registry->RegisterBooleanPref(prefs::kAutoplayAllowed, false); registry->RegisterListPref(prefs::kAutoplayWhitelist); @@ -4301,6 +4318,58 @@ #endif } +void ChromeContentBrowserClient::UpdateDevToolsBackgroundServiceExpiration( + content::BrowserContext* browser_context, + int service, + base::Time expiration_time) { + Profile* profile = Profile::FromBrowserContext(browser_context); + DCHECK(profile); + + auto* pref_service = profile->GetPrefs(); + DCHECK(pref_service); + + DictionaryPrefUpdate pref_update( + pref_service, prefs::kDevToolsBackgroundServicesExpirationDict); + base::DictionaryValue* exp_dict = pref_update.Get(); + + // Convert |expiration_time| to minutes since that is the most granular + // option that returns an int. base::Value does not accept int64. + int expiration_time_minutes = + expiration_time.ToDeltaSinceWindowsEpoch().InMinutes(); + exp_dict->SetInteger(base::NumberToString(service), expiration_time_minutes); +} + +base::flat_map<int, base::Time> +ChromeContentBrowserClient::GetDevToolsBackgroundServiceExpirations( + content::BrowserContext* browser_context) { + Profile* profile = Profile::FromBrowserContext(browser_context); + DCHECK(profile); + + auto* pref_service = profile->GetPrefs(); + DCHECK(pref_service); + + auto* expiration_dict = pref_service->GetDictionary( + prefs::kDevToolsBackgroundServicesExpirationDict); + DCHECK(expiration_dict); + + base::flat_map<int, base::Time> expiration_times; + for (const auto& it : *expiration_dict) { + // key. + int service = 0; + bool did_convert = base::StringToInt(it.first, &service); + DCHECK(did_convert); + + // value. + DCHECK(it.second->is_int()); + base::TimeDelta delta = base::TimeDelta::FromMinutes(it.second->GetInt()); + base::Time expiration_time = base::Time::FromDeltaSinceWindowsEpoch(delta); + + expiration_times[service] = expiration_time; + } + + return expiration_times; +} + content::TracingDelegate* ChromeContentBrowserClient::GetTracingDelegate() { return new ChromeTracingDelegate(); } @@ -5461,6 +5530,11 @@ return ::GetUserAgent(); } +blink::UserAgentMetadata ChromeContentBrowserClient::GetUserAgentMetadata() + const { + return ::GetUserAgentMetadata(); +} + bool ChromeContentBrowserClient::IsBuiltinComponent( content::BrowserContext* browser_context, const url::Origin& origin) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index bce086d7..1a863bab 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -14,6 +14,7 @@ #include <vector> #include "base/callback.h" +#include "base/containers/flat_map.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -79,6 +80,8 @@ // Returns the user agent of Chrome. std::string GetUserAgent(); +blink::UserAgentMetadata GetUserAgentMetadata(); + class ChromeContentBrowserClient : public content::ContentBrowserClient { public: explicit ChromeContentBrowserClient( @@ -347,6 +350,12 @@ std::vector<std::unique_ptr<storage::FileSystemBackend>>* additional_backends) override; content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; + void UpdateDevToolsBackgroundServiceExpiration( + content::BrowserContext* browser_context, + int service, + base::Time expiration_time) override; + base::flat_map<int, base::Time> GetDevToolsBackgroundServiceExpirations( + content::BrowserContext* browser_context) override; content::TracingDelegate* GetTracingDelegate() override; bool IsPluginAllowedToCallRequestOSFileHandle( content::BrowserContext* browser_context, @@ -547,6 +556,7 @@ std::string GetProduct() const override; std::string GetUserAgent() const override; + blink::UserAgentMetadata GetUserAgentMetadata() const override; bool IsBuiltinComponent(content::BrowserContext* browser_context, const url::Origin& origin) override;
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc index df904c5..415e8748 100644 --- a/chrome/browser/chrome_content_browser_client_unittest.cc +++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -38,6 +38,7 @@ #include "media/media_buildflags.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "url/gurl.h" #if !defined(OS_ANDROID) @@ -458,6 +459,17 @@ #endif } +TEST(ChromeContentBrowserClient, UserAgentMetadata) { + ChromeContentBrowserClient content_browser_client; + auto metadata = content_browser_client.GetUserAgentMetadata(); + + EXPECT_EQ(metadata.brand, version_info::GetProductName()); + EXPECT_EQ(metadata.version, version_info::GetVersionNumber()); + EXPECT_EQ(metadata.platform, version_info::GetOSType()); + EXPECT_EQ(metadata.architecture, ""); + EXPECT_EQ(metadata.model, ""); +} + #if defined(OS_CHROMEOS) TEST(ChromeContentBrowserClientTest, ShouldTerminateOnServiceQuit) {
diff --git a/chrome/browser/chrome_origin_trials_browsertest.cc b/chrome/browser/chrome_origin_trials_browsertest.cc index d950bfe30..b8deb584 100644 --- a/chrome/browser/chrome_origin_trials_browsertest.cc +++ b/chrome/browser/chrome_origin_trials_browsertest.cc
@@ -124,9 +124,9 @@ EXPECT_EQ(GetParam().expected_switch, actual); } -INSTANTIATE_TEST_CASE_P(, - ChromeOriginTrialsDisabledFeaturesTest, - ::testing::ValuesIn(kDisabledFeaturesTests)); +INSTANTIATE_TEST_SUITE_P(, + ChromeOriginTrialsDisabledFeaturesTest, + ::testing::ValuesIn(kDisabledFeaturesTests)); // Tests to verify that disabled tokens are correctly read from prefs and // added to the command line @@ -148,8 +148,8 @@ EXPECT_EQ(GetParam().expected_switch, actual); } -INSTANTIATE_TEST_CASE_P(, - ChromeOriginTrialsDisabledTokensTest, - ::testing::ValuesIn(kDisabledTokensTests)); +INSTANTIATE_TEST_SUITE_P(, + ChromeOriginTrialsDisabledTokensTest, + ::testing::ValuesIn(kDisabledTokensTests)); } // namespace
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 29dc86bc..e448480 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1785,6 +1785,8 @@ "reset/metrics.h", "resource_reporter/resource_reporter.cc", "resource_reporter/resource_reporter.h", + "scheduler_configuration_manager.cc", + "scheduler_configuration_manager.h", "secure_channel/secure_channel_client_provider.cc", "secure_channel/secure_channel_client_provider.h", "session_length_limiter.cc", @@ -2445,6 +2447,7 @@ "printing/zeroconf_printer_detector_unittest.cc", "proxy_config_service_impl_unittest.cc", "resource_reporter/resource_reporter_unittest.cc", + "scheduler_configuration_manager_unittest.cc", "session_length_limiter_unittest.cc", "settings/cros_settings_unittest.cc", "settings/device_oauth2_token_service_unittest.cc",
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc index 90815323..e9d6787 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc
@@ -716,7 +716,7 @@ }; // TODO(yoshiki): Enable a test for retail mode (i.e. RetailAccountId). -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UserTypeInstantiation, AccessibilityManagerUserTypeTest, ::testing::Values(AccountId::FromUserEmailGaiaId(kTestUserName,
diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc index d95f1fd..79443e0 100644 --- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc
@@ -313,9 +313,10 @@ } }; -INSTANTIATE_TEST_CASE_P(TestAsNormalAndGuestUser, - SpokenFeedbackTest, - ::testing::Values(kTestAsNormalUser, kTestAsGuestUser)); +INSTANTIATE_TEST_SUITE_P(TestAsNormalAndGuestUser, + SpokenFeedbackTest, + ::testing::Values(kTestAsNormalUser, + kTestAsGuestUser)); // TODO(tommi): Flakily hitting HasOneRef DCHECK in // AudioOutputResampler::Shutdown, see crbug.com/630031.
diff --git a/chrome/browser/chromeos/account_manager/account_manager_migrator.cc b/chrome/browser/chromeos/account_manager/account_manager_migrator.cc index 2f763df..29d0b49 100644 --- a/chrome/browser/chromeos/account_manager/account_manager_migrator.cc +++ b/chrome/browser/chromeos/account_manager/account_manager_migrator.cc
@@ -359,9 +359,23 @@ void StartMigration() override { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kStepTimeoutInSeconds), - base::BindOnce(&ArcAccountsMigration::FinishWithFailure, - weak_factory_.GetWeakPtr())); + if (!arc_auth_service_) { + // ArcAuthService is not available for Secondary Profiles participating in + // Multi-Signin. It is started only for the Primary Profile. + VLOG(1) << "ArcAuthService unavailable. Aborting ARC accounts migration."; + + // It is important to mark this step as a failure so that if/when this + // Profile signs in as a Primary Profile, this step can be retried. + // However, skip emitting a failure UMA stat because otherwise we will get + // false failure stats for all Secondary Profiles using Multi-Signin. + FinishWithFailure(false /* emit_uma_stats */); + return; + } + + timer_.Start( + FROM_HERE, base::TimeDelta::FromSeconds(kStepTimeoutInSeconds), + base::BindOnce(&ArcAccountsMigration::FinishWithFailure, + weak_factory_.GetWeakPtr(), true /* emit_uma_stats */)); arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); arc_session_manager->AddObserver(this); if (arc_session_manager->state() == arc::ArcSessionManager::State::ACTIVE) { @@ -373,6 +387,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); arc::ArcSessionManager::Get()->RemoveObserver(this); + DCHECK(arc_auth_service_); arc_auth_service_->GetGoogleAccountsInArc( base::BindOnce(&ArcAccountsMigration::OnGetGoogleAccountsInArc, weak_factory_.GetWeakPtr())); @@ -395,9 +410,9 @@ Step::FinishWithSuccess(); } - void FinishWithFailure() { + void FinishWithFailure(bool emit_uma_stats) { Reset(); - Step::FinishWithFailure(); + Step::FinishWithFailure(emit_uma_stats); } void Reset() {
diff --git a/chrome/browser/chromeos/account_manager/account_migration_runner.cc b/chrome/browser/chromeos/account_manager/account_migration_runner.cc index f858dce..9fcf1bb 100644 --- a/chrome/browser/chromeos/account_manager/account_migration_runner.cc +++ b/chrome/browser/chromeos/account_manager/account_migration_runner.cc
@@ -30,9 +30,12 @@ std::move(callback_).Run(true); } -void AccountMigrationRunner::Step::FinishWithFailure() { +void AccountMigrationRunner::Step::FinishWithFailure(bool emit_uma_stats) { DCHECK(callback_); - base::UmaHistogramBoolean(GetStepResultMetricName(), false); + + if (emit_uma_stats) + base::UmaHistogramBoolean(GetStepResultMetricName(), false); + std::move(callback_).Run(false); }
diff --git a/chrome/browser/chromeos/account_manager/account_migration_runner.h b/chrome/browser/chromeos/account_manager/account_migration_runner.h index d422caf..083f3f5 100644 --- a/chrome/browser/chromeos/account_manager/account_migration_runner.h +++ b/chrome/browser/chromeos/account_manager/account_migration_runner.h
@@ -71,7 +71,7 @@ void FinishWithSuccess(); // Called by implementations of |Step| to signal an unsuccessful execution. - void FinishWithFailure(); + void FinishWithFailure(bool emit_uma_stats = true); private: friend class AccountMigrationRunner;
diff --git a/chrome/browser/chromeos/arc/notification/arc_supervision_transition_notification_unittest.cc b/chrome/browser/chromeos/arc/notification/arc_supervision_transition_notification_unittest.cc index 5c31a3b..af87d4a 100644 --- a/chrome/browser/chromeos/arc/notification/arc_supervision_transition_notification_unittest.cc +++ b/chrome/browser/chromeos/arc/notification/arc_supervision_transition_notification_unittest.cc
@@ -58,7 +58,7 @@ DISALLOW_COPY_AND_ASSIGN(ArcSupervisionTransitionNotificationTest); }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , ArcSupervisionTransitionNotificationTest, ::testing::Values(ArcSupervisionTransition::NO_TRANSITION,
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc index 5f9ee338..04f638c4 100644 --- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc +++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc
@@ -563,8 +563,8 @@ // Boolean parameter means if user is affiliated on the device. Affiliated // users belong to the domain that owns the device. -INSTANTIATE_TEST_CASE_P(ArcPolicyBridgeAffiliatedTestInstance, - ArcPolicyBridgeAffiliatedTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(ArcPolicyBridgeAffiliatedTestInstance, + ArcPolicyBridgeAffiliatedTest, + testing::Bool()); } // namespace arc
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index bf2a314..76b7ef3 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -95,6 +95,7 @@ #include "chrome/browser/chromeos/power/renderer_freezer.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/resource_reporter/resource_reporter.h" +#include "chrome/browser/chromeos/scheduler_configuration_manager.h" #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chrome/browser/chromeos/settings/shutdown_policy_forwarder.h" @@ -672,6 +673,11 @@ g_browser_process->system_network_context_manager() ->GetSharedURLLoaderFactory()); + scheduler_configuration_manager_ = + std::make_unique<SchedulerConfigurationManager>( + DBusThreadManager::Get()->GetDebugDaemonClient(), + g_browser_process->local_state()); + ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); } @@ -1088,6 +1094,7 @@ user_activity_controller_.reset(); adaptive_screen_brightness_manager_.reset(); diagnosticsd_bridge_.reset(); + scheduler_configuration_manager_.reset(); auto_screen_brightness_controller_.reset(); // Detach D-Bus clients before DBusThreadManager is shut down.
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.h b/chrome/browser/chromeos/chrome_browser_main_chromeos.h index 1a3ae8827..ffeb747 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.h +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.h
@@ -47,6 +47,7 @@ class NetworkThrottlingObserver; class PowerMetricsReporter; class RendererFreezer; +class SchedulerConfigurationManager; class ShutdownPolicyForwarder; class WakeOnWifiManager; @@ -157,6 +158,8 @@ std::unique_ptr<crostini::CrosvmMetrics> crosvm_metrics_; std::unique_ptr<DiscoverManager> discover_manager_; std::unique_ptr<DiagnosticsdBridge> diagnosticsd_bridge_; + std::unique_ptr<SchedulerConfigurationManager> + scheduler_configuration_manager_; std::unique_ptr<CrosUsbDetector> cros_usb_detector_;
diff --git a/chrome/browser/chromeos/extensions/accessibility_features_apitest.cc b/chrome/browser/chromeos/extensions/accessibility_features_apitest.cc index 3a456314..b386583a 100644 --- a/chrome/browser/chromeos/extensions/accessibility_features_apitest.cc +++ b/chrome/browser/chromeos/extensions/accessibility_features_apitest.cc
@@ -163,9 +163,9 @@ } }; -INSTANTIATE_TEST_CASE_P(AccessibilityFeatureaApiTestInstantiatePermission, - AccessibilityFeaturesApiTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(AccessibilityFeatureaApiTestInstantiatePermission, + AccessibilityFeaturesApiTest, + testing::Bool()); // Tests that an extension with read permission can read accessibility features // state, while an extension that doesn't have the permission cannot.
diff --git a/chrome/browser/chromeos/extensions/install_limiter_unittest.cc b/chrome/browser/chromeos/extensions/install_limiter_unittest.cc index b1e62ce2..8ef0c274 100644 --- a/chrome/browser/chromeos/extensions/install_limiter_unittest.cc +++ b/chrome/browser/chromeos/extensions/install_limiter_unittest.cc
@@ -64,7 +64,7 @@ kRandomExtensionId)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DemoModeConfig, InstallLimiterTest, ::testing::Values(chromeos::DemoSession::DemoModeConfig::kNone,
diff --git a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc index 5f0c5de..7b2c088d 100644 --- a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc +++ b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api_unittest.cc
@@ -754,8 +754,8 @@ CheckGetCredentialRequirements(1, 0); } -INSTANTIATE_TEST_CASE_P(StorageProviders, - QuickUnlockPrivateUnitTest, - ::testing::Values(TestType::kPrefs, - TestType::kCryptohome)); +INSTANTIATE_TEST_SUITE_P(StorageProviders, + QuickUnlockPrivateUnitTest, + ::testing::Values(TestType::kPrefs, + TestType::kCryptohome)); } // namespace chromeos
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 665e83e..588c07c 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -211,19 +211,19 @@ StartTest(); } -// INSTANTIATE_TEST_CASE_P expands to code that stringizes the arguments. Thus +// INSTANTIATE_TEST_SUITE_P expands to code that stringizes the arguments. Thus // macro parameters such as |prefix| and |test_class| won't be expanded by the -// macro pre-processor. To work around this, indirect INSTANTIATE_TEST_CASE_P, -// as WRAPPED_INSTANTIATE_TEST_CASE_P here, so the pre-processor expands macro +// macro pre-processor. To work around this, indirect INSTANTIATE_TEST_SUITE_P, +// as WRAPPED_INSTANTIATE_TEST_SUITE_P here, so the pre-processor expands macro // defines used to disable tests, MAYBE_prefix for example. -#define WRAPPED_INSTANTIATE_TEST_CASE_P(prefix, test_class, generator) \ - INSTANTIATE_TEST_CASE_P(prefix, test_class, generator, &PostTestCaseName) +#define WRAPPED_INSTANTIATE_TEST_SUITE_P(prefix, test_class, generator) \ + INSTANTIATE_TEST_SUITE_P(prefix, test_class, generator, &PostTestCaseName) std::string PostTestCaseName(const ::testing::TestParamInfo<TestCase>& test) { return TestCase::GetFullTestCaseName(test.param); } -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( FileDisplay, /* file_display.js */ FilesAppBrowserTest, ::testing::Values( @@ -279,7 +279,7 @@ TestCase("fileSearchCaseInsensitive"), TestCase("fileSearchNotFound"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( OpenVideoFiles, /* open_video_files.js */ FilesAppBrowserTest, ::testing::Values(TestCase("videoOpenDownloads").InGuestMode(), @@ -287,7 +287,7 @@ TestCase("videoOpenDrive").DisableDriveFs(), TestCase("videoOpenDrive").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( OpenAudioFiles, /* open_audio_files.js */ FilesAppBrowserTest, ::testing::Values(TestCase("audioOpenCloseDownloads"), @@ -305,7 +305,7 @@ TestCase("audioNoRepeatModeMultipleFileDrive"), TestCase("audioRepeatOneModeMultipleFileDrive"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( OpenImageFiles, /* open_image_files.js */ FilesAppBrowserTest, ::testing::Values(TestCase("imageOpenDownloads").InGuestMode(), @@ -322,7 +322,7 @@ #else #define MAYBE_ZipFiles ZipFiles #endif -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( MAYBE_ZipFiles, /* zip_files.js */ FilesAppBrowserTest, ::testing::Values(ZipCase("zipFileOpenDownloads").InGuestMode(), @@ -344,7 +344,7 @@ ZipCase("zipCreateFileDrive").EnableDriveFs(), ZipCase("zipCreateFileUsb"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( CreateNewFolder, /* create_new_folder.js */ FilesAppBrowserTest, ::testing::Values( @@ -362,7 +362,7 @@ TestCase("createFolderDrive").EnableDriveFs().EnableMyFilesVolume(), TestCase("createFolderDrive").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( KeyboardOperations, /* keyboard_operations.js */ FilesAppBrowserTest, ::testing::Values(TestCase("keyboardDeleteDownloads").InGuestMode(), @@ -388,7 +388,7 @@ TestCase("renameNewFolderDrive").DisableDriveFs(), TestCase("renameNewFolderDrive").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( ContextMenu, /* context_menu.js */ FilesAppBrowserTest, ::testing::Values( @@ -432,7 +432,7 @@ TestCase("checkPasteDisabledForReadOnlyFolderInTree").DisableDriveFs(), TestCase("checkContextMenuForTeamDriveRoot").DisableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( ContextMenu2, /* context_menu.js */ FilesAppBrowserTest, ::testing::Values( @@ -479,14 +479,14 @@ TestCase("checkLinuxFilesContextMenu"), TestCase("checkLinuxFilesContextMenu").EnableMyFilesVolume())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Delete, /* delete.js */ FilesAppBrowserTest, ::testing::Values(TestCase("deleteMenuItemNoEntrySelected"), TestCase("deleteEntryWithToolbar").InGuestMode(), TestCase("deleteEntryWithToolbar"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( QuickView, /* quick_view.js */ FilesAppBrowserTest, ::testing::Values(TestCase("openQuickView"), @@ -516,7 +516,7 @@ TestCase("closeQuickView"), TestCase("cantOpenQuickViewWithMultipleFiles"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( DirectoryTreeContextMenu, /* directory_tree_context_menu.js */ FilesAppBrowserTest, ::testing::Values( @@ -562,7 +562,7 @@ TestCase("dirCreateWithoutChangingCurrent").EnableMyFilesVolume(), TestCase("dirCreateWithoutChangingCurrent"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( DriveSpecific, /* drive_specific.js */ FilesAppBrowserTest, ::testing::Values( @@ -586,7 +586,7 @@ TestCase("driveAvailableOfflineGearMenu").EnableDriveFs(), TestCase("driveAvailableOfflineDirectoryGearMenu"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Transfer, /* transfer.js */ FilesAppBrowserTest, ::testing::Values( @@ -617,7 +617,7 @@ TestCase("transferBetweenTeamDrives").DisableDriveFs(), TestCase("transferBetweenTeamDrives").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( RestorePrefs, /* restore_prefs.js */ FilesAppBrowserTest, ::testing::Values(TestCase("restoreSortColumn").InGuestMode(), @@ -625,14 +625,14 @@ TestCase("restoreCurrentView").InGuestMode(), TestCase("restoreCurrentView"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( RestoreGeometry, /* restore_geometry.js */ FilesAppBrowserTest, ::testing::Values(TestCase("restoreGeometry"), TestCase("restoreGeometry").InGuestMode(), TestCase("restoreGeometryMaximized"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( ShareAndManageDialog, /* share_and_manage_dialog.js */ FilesAppBrowserTest, ::testing::Values(TestCase("shareFileDrive").DisableDriveFs(), @@ -655,12 +655,12 @@ TestCase("manageDirectoryTeamDrive"), TestCase("manageTeamDrive"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( SuggestAppDialog, /* suggest_app_dialog.js */ FilesAppBrowserTest, ::testing::Values(TestCase("suggestAppDialog"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Traverse, /* traverse.js */ FilesAppBrowserTest, ::testing::Values(TestCase("traverseDownloads").InGuestMode(), @@ -668,7 +668,7 @@ TestCase("traverseDrive").DisableDriveFs(), TestCase("traverseDrive").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Tasks, /* tasks.js */ FilesAppBrowserTest, ::testing::Values(TestCase("executeDefaultTaskDownloads"), @@ -682,7 +682,7 @@ TestCase("genericTaskIsNotExecuted"), TestCase("genericTaskAndNonGenericTask"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( FolderShortcuts, /* folder_shortcuts.js */ FilesAppBrowserTest, ::testing::Values(TestCase("traverseFolderShortcuts").DisableDriveFs(), @@ -690,13 +690,13 @@ TestCase("addRemoveFolderShortcuts").DisableDriveFs(), TestCase("addRemoveFolderShortcuts").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( SortColumns, /* sort_columns.js */ FilesAppBrowserTest, ::testing::Values(TestCase("sortColumns"), TestCase("sortColumns").InGuestMode())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( TabIndex, /* tab_index.js: tabindex tests require trusted JS Events. */ FilesAppBrowserTest, ::testing::Values( @@ -741,7 +741,7 @@ .InGuestMode() .EnableMyFilesVolume())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( FileDialog, /* file_dialog.js */ FilesAppBrowserTest, ::testing::Values( @@ -828,7 +828,7 @@ .EnableDriveFs(), TestCase("saveFileDialogDriveOfflinePinned").WithBrowser().Offline())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( CopyBetweenWindows, /* copy_between_windows.js */ FilesAppBrowserTest, ::testing::Values( @@ -843,7 +843,7 @@ TestCase("copyBetweenWindowsDriveToUsb").EnableDriveFs(), TestCase("copyBetweenWindowsUsbToLocal"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( GridView, /* grid_view.js */ FilesAppBrowserTest, ::testing::Values(TestCase("showGridViewDownloads"), @@ -851,7 +851,7 @@ TestCase("showGridViewDrive").DisableDriveFs(), TestCase("showGridViewDrive").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Providers, /* providers.js */ FilesAppBrowserTest, ::testing::Values(TestCase("requestMount"), @@ -865,7 +865,7 @@ TestCase("providerEject"), TestCase("providerEject").DisableNativeSmb())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( GearMenu, /* gear_menu.js */ FilesAppBrowserTest, ::testing::Values( @@ -881,13 +881,13 @@ TestCase("newFolderInDownloads"), TestCase("showSendFeedbackAction"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Crostini, /* crostini.js */ FilesAppBrowserTest, ::testing::Values(TestCase("mountCrostini"), TestCase("sharePathWithCrostini"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( MyFiles, /* my_files.js */ FilesAppBrowserTest, ::testing::Values( @@ -904,17 +904,17 @@ TestCase("myFilesUpdatesChildren"), TestCase("myFilesUpdatesChildren").EnableMyFilesVolume())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( InstallLinuxPackageDialog, /* install_linux_package_dialog.js */ FilesAppBrowserTest, ::testing::Values(TestCase("installLinuxPackageDialog"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( LauncherSearch, /* launcher_search.js */ FilesAppBrowserTest, ::testing::Values(TestCase("launcherOpenSearchResult"))); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Recents, /* recents.js */ FilesAppBrowserTest, ::testing::Values( @@ -926,7 +926,7 @@ TestCase("recentsDownloadsAndDriveWithOverlap").DisableDriveFs(), TestCase("recentsDownloadsAndDriveWithOverlap").EnableDriveFs())); -WRAPPED_INSTANTIATE_TEST_CASE_P( +WRAPPED_INSTANTIATE_TEST_SUITE_P( Metadata, /* metadata.js */ FilesAppBrowserTest, ::testing::Values(
diff --git a/chrome/browser/chromeos/lock_screen_apps/app_manager_impl_unittest.cc b/chrome/browser/chromeos/lock_screen_apps/app_manager_impl_unittest.cc index 9288b0f3..4fa08c2 100644 --- a/chrome/browser/chromeos/lock_screen_apps/app_manager_impl_unittest.cc +++ b/chrome/browser/chromeos/lock_screen_apps/app_manager_impl_unittest.cc
@@ -463,12 +463,12 @@ } // namespace -INSTANTIATE_TEST_CASE_P(Unpacked, - LockScreenAppManagerImplTest, - ::testing::Values(TestAppLocation::kUnpacked)); -INSTANTIATE_TEST_CASE_P(Internal, - LockScreenAppManagerImplTest, - ::testing::Values(TestAppLocation::kInternal)); +INSTANTIATE_TEST_SUITE_P(Unpacked, + LockScreenAppManagerImplTest, + ::testing::Values(TestAppLocation::kUnpacked)); +INSTANTIATE_TEST_SUITE_P(Internal, + LockScreenAppManagerImplTest, + ::testing::Values(TestAppLocation::kInternal)); TEST_P(LockScreenAppManagerImplTest, StartAddsAppToTarget) { scoped_refptr<const extensions::Extension> note_taking_app =
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc index 0f2e45e4..7907892 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_unittest.cc
@@ -375,7 +375,7 @@ enrollment_screen_->OnLicenseTypeSelected("annual"); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( P, AutomaticEnrollmentScreenUnitTest, ::testing::Values(
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index bf626de..e7ab2e6 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -8,6 +8,8 @@ #include <utility> #include <vector> +#include "ash/public/cpp/notification_utils.h" +#include "ash/public/cpp/vector_icons/vector_icons.h" #include "base/barrier_closure.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -54,8 +56,11 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/system/device_disabling_manager.h" #include "chrome/browser/net/system_network_context_manager.h" +#include "chrome/browser/notifications/system_notification_helper.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/chrome_device_id_helper.h" +#include "chrome/browser/ui/ash/system_tray_client.h" #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" #include "chrome/common/channel_info.h" @@ -107,6 +112,8 @@ #include "services/network/public/mojom/network_context.mojom.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/message_center/public/cpp/notification.h" +#include "ui/message_center/public/cpp/notification_delegate.h" #include "ui/views/widget/widget.h" using PolicyFetchResult = policy::PreSigninPolicyFetcher::PolicyFetchResult; @@ -117,6 +124,11 @@ namespace { +const char kAutoLaunchNotificationId[] = + "chrome://managed_guest_session/auto_launch"; + +const char kAutoLaunchNotifierId[] = "ash.managed_guest_session-auto_launch"; + // Enum types for Login.PasswordChangeFlow. // Don't change the existing values and update LoginPasswordChangeFlow in // histogram.xml when making changes here. @@ -956,12 +968,56 @@ } ClearRecordedNames(); + if (public_session_auto_login_account_id_.is_valid() && + public_session_auto_login_account_id_ == user_context.GetAccountId() && + last_login_attempt_was_auto_login_) { + const std::string& user_id = user_context.GetAccountId().GetUserEmail(); + policy::DeviceLocalAccountPolicyBroker* broker = + g_browser_process->platform_part() + ->browser_policy_connector_chromeos() + ->GetDeviceLocalAccountPolicyService() + ->GetBrokerForUser(user_id); + if (ChromeUserManager::Get()->IsFullManagementDisclosureNeeded(broker)) + ShowAutoLaunchManagedGuestSessionNotification(); + } if (is_enterprise_managed) { enterprise_user_session_metrics::RecordSignInEvent( user_context, last_login_attempt_was_auto_login_); } } +void ExistingUserController::ShowAutoLaunchManagedGuestSessionNotification() { + policy::BrowserPolicyConnectorChromeOS* connector = + g_browser_process->platform_part()->browser_policy_connector_chromeos(); + DCHECK(connector->IsEnterpriseManaged()); + std::string device_domain = connector->GetEnterpriseDisplayDomain(); + if (device_domain.empty() && connector->IsActiveDirectoryManaged()) + device_domain = connector->GetRealm(); + const base::string16 title = + l10n_util::GetStringUTF16(IDS_AUTO_LAUNCH_NOTIFICATION_TITLE); + const base::string16 message = l10n_util::GetStringFUTF16( + IDS_AUTO_LAUNCH_NOTIFICATION_MESSAGE, base::UTF8ToUTF16(device_domain)); + auto delegate = + base::MakeRefCounted<message_center::HandleNotificationClickDelegate>( + base::BindRepeating([](base::Optional<int> button_index) { + DCHECK(button_index); + SystemTrayClient::Get()->ShowEnterpriseInfo(); + })); + std::unique_ptr<message_center::Notification> notification = + ash::CreateSystemNotification( + message_center::NOTIFICATION_TYPE_SIMPLE, kAutoLaunchNotificationId, + title, message, base::string16(), GURL(), + message_center::NotifierId( + message_center::NotifierType::SYSTEM_COMPONENT, + kAutoLaunchNotifierId), + message_center::RichNotificationData(), std::move(delegate), + ash::kAutoLaunchManagedGuestSessionIcon, + message_center::SystemNotificationWarningLevel::NORMAL); + notification->SetSystemPriority(); + notification->set_pinned(true); + SystemNotificationHelper::GetInstance()->Display(*notification); +} + void ExistingUserController::OnProfilePrepared(Profile* profile, bool browser_launched) { // Reenable clicking on other windows and status area.
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h index 25745a5..5c3352a2 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.h +++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -204,6 +204,9 @@ // Shows "enable developer features" screen. void ShowEnableDebuggingScreen(); + // Shows privacy notification in case of auto lunch managed guest session. + void ShowAutoLaunchManagedGuestSessionNotification(); + // Shows kiosk feature enable screen. void ShowKioskEnableScreen();
diff --git a/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc b/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc index 6be668d..57b58c9 100644 --- a/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc +++ b/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc
@@ -429,8 +429,8 @@ SimpleEndToEnd(); } -INSTANTIATE_TEST_CASE_P(OobeInteractiveUITestImpl, - OobeInteractiveUITest, - testing::Combine(testing::Bool(), testing::Bool())); +INSTANTIATE_TEST_SUITE_P(OobeInteractiveUITestImpl, + OobeInteractiveUITest, + testing::Combine(testing::Bool(), testing::Bool())); } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/oobe_localization_browsertest.cc b/chrome/browser/chromeos/login/oobe_localization_browsertest.cc index afff4f0..2ca7f13 100644 --- a/chrome/browser/chromeos/login/oobe_localization_browsertest.cc +++ b/chrome/browser/chromeos/login/oobe_localization_browsertest.cc
@@ -428,7 +428,7 @@ RunLocalizationTest(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( StructSequence, OobeLocalizationTest, testing::Range(&oobe_localization_test_parameters[0],
diff --git a/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc b/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc index 1f65b5b..700750f 100644 --- a/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/session/chrome_session_manager_browsertest.cc
@@ -296,9 +296,9 @@ EXPECT_EQ(expected_brand, google_brand::chromeos::GetBrand()); } -INSTANTIATE_TEST_CASE_P(GuestSessionRlzTest, - GuestSessionRlzTest, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(GuestSessionRlzTest, + GuestSessionRlzTest, + ::testing::Values(false, true)); #endif // BUILDFLAG(ENABLE_RLZ)
diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc index 313a687..f0d6f8563 100644 --- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc +++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
@@ -1228,8 +1228,8 @@ OAuth2LoginManager::SessionRestoreState::SESSION_RESTORE_FAILED); } -INSTANTIATE_TEST_CASE_P(, MergeSessionTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, MergeSessionTest, testing::Bool()); -INSTANTIATE_TEST_CASE_P(, MergeSessionTimeoutTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, MergeSessionTimeoutTest, testing::Bool()); } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/sync_consent_interactive_ui_test.cc b/chrome/browser/chromeos/login/sync_consent_interactive_ui_test.cc index 310ca0a..5585c74 100644 --- a/chrome/browser/chromeos/login/sync_consent_interactive_ui_test.cc +++ b/chrome/browser/chromeos/login/sync_consent_interactive_ui_test.cc
@@ -250,9 +250,9 @@ } // "es" tests language switching, "en-GB" checks switching to language varants. -INSTANTIATE_TEST_CASE_P(SyncConsentTestWithParamsImpl, - SyncConsentTestWithParams, - testing::Values("es", "en-GB")); +INSTANTIATE_TEST_SUITE_P(SyncConsentTestWithParamsImpl, + SyncConsentTestWithParams, + testing::Values("es", "en-GB")); // Check that policy-disabled sync does not trigger SyncConsent screen. // @@ -282,8 +282,8 @@ WaitForJsCondition("Oobe.getInstance().currentScreen.id != 'sync-consent'"); } -INSTANTIATE_TEST_CASE_P(/* no prefix */, - SyncConsenPolicyDisabledTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + SyncConsenPolicyDisabledTest, + testing::Bool()); } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index f4060b4..1ae2400 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -1108,7 +1108,7 @@ EXPECT_NE(nullptr, ExistingUserController::current_controller()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WizardControllerErrorUpdateAfterCompletedOobe, WizardControllerErrorUpdateAfterCompletedOobeTest, testing::Values(ScreenExitCode::UPDATE_ERROR_UPDATING, @@ -1552,9 +1552,9 @@ } } -INSTANTIATE_TEST_CASE_P(WizardControllerDeviceStateExplicitRequirement, - WizardControllerDeviceStateExplicitRequirementTest, - testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(WizardControllerDeviceStateExplicitRequirement, + WizardControllerDeviceStateExplicitRequirementTest, + testing::Values(false, true)); class WizardControllerDeviceStateWithInitialEnrollmentTest : public WizardControllerDeviceStateTest {
diff --git a/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.cc b/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.cc index a90e276..d0350551 100644 --- a/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.cc +++ b/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.cc
@@ -56,12 +56,6 @@ OnUnzipped(false); return; } - if (!EnsureDirectoryForPluginVmImageIsPresent() || - !EnsureDownloadedPluginVmImageArchiveIsPresent()) { - LOG(ERROR) << "Unzipping of PluginVm image couldn't be proceeded"; - OnUnzipped(false); - return; - } base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, @@ -210,6 +204,12 @@ } bool PluginVmImageManager::UnzipDownloadedPluginVmImageArchive() { + if (!EnsureDirectoryForPluginVmImageIsPresent() || + !EnsureDownloadedPluginVmImageArchiveIsPresent()) { + LOG(ERROR) << "Unzipping of PluginVm image couldn't be proceeded"; + return false; + } + base::File file(downloaded_plugin_vm_image_archive_, base::File::FLAG_OPEN | base::File::FLAG_READ); if (!file.IsValid()) { @@ -318,24 +318,45 @@ void PluginVmImageManager::RemoveTemporaryPluginVmImageArchiveIfExists() { if (!downloaded_plugin_vm_image_archive_.empty()) { - if (!base::DeleteFile(downloaded_plugin_vm_image_archive_, - false /* recursive */)) { - LOG(ERROR) << "Downloaded PluginVm image archive located in " - << downloaded_plugin_vm_image_archive_.value() - << " failed to be deleted"; - } - downloaded_plugin_vm_image_archive_.clear(); + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, + base::BindOnce(&base::DeleteFile, downloaded_plugin_vm_image_archive_, + false /* recursive */), + base::BindOnce( + &PluginVmImageManager::OnTemporaryPluginVmImageArchiveRemoved, + weak_ptr_factory_.GetWeakPtr())); } } +void PluginVmImageManager::OnTemporaryPluginVmImageArchiveRemoved( + bool success) { + if (!success) { + LOG(ERROR) << "Downloaded PluginVm image archive located in " + << downloaded_plugin_vm_image_archive_.value() + << " failed to be deleted"; + return; + } + downloaded_plugin_vm_image_archive_.clear(); +} + void PluginVmImageManager::RemovePluginVmImageDirectoryIfExists() { if (!plugin_vm_image_dir_.empty()) { - if (!base::DeleteFile(plugin_vm_image_dir_, true /* recursive */)) { - LOG(ERROR) << "Directory with PluginVm image " - << plugin_vm_image_dir_.value() << " failed to be deleted"; - } - plugin_vm_image_dir_.clear(); + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, + base::BindOnce(&base::DeleteFile, plugin_vm_image_dir_, + true /* recursive */), + base::BindOnce(&PluginVmImageManager::OnPluginVmImageDirectoryRemoved, + weak_ptr_factory_.GetWeakPtr())); } } +void PluginVmImageManager::OnPluginVmImageDirectoryRemoved(bool success) { + if (!success) { + LOG(ERROR) << "Directory with PluginVm image " + << plugin_vm_image_dir_.value() << " failed to be deleted"; + return; + } + plugin_vm_image_dir_.clear(); +} + } // namespace plugin_vm
diff --git a/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h b/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h index 36edcb6..46cba5ab 100644 --- a/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h +++ b/chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h
@@ -86,6 +86,10 @@ void OnDownloadCancelled(); void OnDownloadFailed(); + // Finishes the processing of PluginVm image. Deletes downloaded PluginVm + // image archive. In case |success| is false also deletes PluginVm image. + void OnUnzipped(bool success); + void SetDownloadServiceForTesting( download::DownloadService* download_service); void SetDownloadedPluginVmImageArchiveForTesting( @@ -142,17 +146,15 @@ bool CreateDirectory(const base::FilePath& entry_path); bool FilterFilesInPluginVmImageArchive(const base::FilePath& file); - // Finishes the processing of PluginVm image. Deletes downloaded PluginVm - // image archive. In case success is false also deletes PluginVm image. - void OnUnzipped(bool success); - bool EnsureDownloadedPluginVmImageArchiveIsPresent(); // Creates directory for PluginVm image if one doesn't exists. // Returns true in case directory has already existed or was successfully // created and false otherwise. bool EnsureDirectoryForPluginVmImageIsPresent(); void RemoveTemporaryPluginVmImageArchiveIfExists(); + void OnTemporaryPluginVmImageArchiveRemoved(bool success); void RemovePluginVmImageDirectoryIfExists(); + void OnPluginVmImageDirectoryRemoved(bool success); base::WeakPtrFactory<PluginVmImageManager> weak_ptr_factory_;
diff --git a/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller_unittest.cc b/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller_unittest.cc index 322e8fcb..a53a57f 100644 --- a/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller_unittest.cc +++ b/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller_unittest.cc
@@ -388,7 +388,7 @@ is_off_hours_expected()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCases, DeviceOffHoursControllerUpdateTest, testing::Values(
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager.cc b/chrome/browser/chromeos/scheduler_configuration_manager.cc new file mode 100644 index 0000000..f80cfc4 --- /dev/null +++ b/chrome/browser/chromeos/scheduler_configuration_manager.cc
@@ -0,0 +1,81 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/scheduler_configuration_manager.h" + +#include <string> + +#include "base/bind.h" +#include "chrome/common/pref_names.h" +#include "chromeos/dbus/debug_daemon_client.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" +#include "third_party/cros_system_api/dbus/debugd/dbus-constants.h" + +namespace chromeos { + +SchedulerConfigurationManager::SchedulerConfigurationManager( + DebugDaemonClient* debug_daemon_client, + PrefService* local_state) + : debug_daemon_client_(debug_daemon_client) { + observer_.Init(local_state); + observer_.Add( + prefs::kSchedulerConfiguration, + base::BindRepeating(&SchedulerConfigurationManager::OnPrefChange, + base::Unretained(this))); + debug_daemon_client_->WaitForServiceToBeAvailable( + base::BindOnce(&SchedulerConfigurationManager::OnDebugDaemonReady, + weak_ptr_factory_.GetWeakPtr())); +} + +SchedulerConfigurationManager::~SchedulerConfigurationManager() {} + +// static +void SchedulerConfigurationManager::RegisterLocalStatePrefs( + PrefRegistrySimple* registry) { + registry->RegisterStringPref(prefs::kSchedulerConfiguration, std::string()); +} + +void SchedulerConfigurationManager::OnDebugDaemonReady(bool service_is_ready) { + if (!service_is_ready) { + LOG(ERROR) << "Debug daemon unavailable"; + return; + } + + // Initialize the system. + debug_daemon_ready_ = true; + OnPrefChange(); +} + +void SchedulerConfigurationManager::OnPrefChange() { + // No point in calling debugd if it isn't ready yet. The ready callback will + // will call this function again to set the initial configuration. + if (!debug_daemon_ready_) { + return; + } + + std::string config_name; + PrefService* local_state = observer_.prefs(); + if (local_state->HasPrefPath(prefs::kSchedulerConfiguration)) { + config_name = local_state->GetString(prefs::kSchedulerConfiguration); + } else { + config_name = debugd::scheduler_configuration::kPerformanceScheduler; + } + + // NB: Also send an update when the config gets reset to let the system pick + // whatever default. Note that the value we read in this case will be the + // default specified on pref registration, e.g. empty string. + debug_daemon_client_->SetSchedulerConfiguration( + config_name, + base::BindOnce(&SchedulerConfigurationManager::OnConfigurationSet, + weak_ptr_factory_.GetWeakPtr())); +} + +void SchedulerConfigurationManager::OnConfigurationSet(bool result) { + if (!result) { + LOG(ERROR) << "Failed to update scheduler configuration"; + } +} + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager.h b/chrome/browser/chromeos/scheduler_configuration_manager.h new file mode 100644 index 0000000..2021381 --- /dev/null +++ b/chrome/browser/chromeos/scheduler_configuration_manager.h
@@ -0,0 +1,44 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_SCHEDULER_CONFIGURATION_MANAGER_H_ +#define CHROME_BROWSER_CHROMEOS_SCHEDULER_CONFIGURATION_MANAGER_H_ + +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "components/prefs/pref_change_registrar.h" + +class PrefRegistrySimple; +class PrefService; + +namespace chromeos { + +class DebugDaemonClient; + +// Tracks scheduler configuration as provided by the respective local state pref +// and sends D-Bus IPC to reconfigure the system on config changes. +class SchedulerConfigurationManager { + public: + SchedulerConfigurationManager(DebugDaemonClient* debug_daemon_client, + PrefService* local_state); + ~SchedulerConfigurationManager(); + + static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); + + private: + void OnDebugDaemonReady(bool service_is_ready); + void OnPrefChange(); + void OnConfigurationSet(bool result); + + DebugDaemonClient* debug_daemon_client_ = nullptr; + PrefChangeRegistrar observer_; + bool debug_daemon_ready_ = false; + base::WeakPtrFactory<SchedulerConfigurationManager> weak_ptr_factory_{this}; + + DISALLOW_COPY_AND_ASSIGN(SchedulerConfigurationManager); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_SCHEDULER_CONFIGURATION_MANAGER_H_
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc b/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc new file mode 100644 index 0000000..e1507d6 --- /dev/null +++ b/chrome/browser/chromeos/scheduler_configuration_manager_unittest.cc
@@ -0,0 +1,82 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/scheduler_configuration_manager.h" + +#include <memory> + +#include "base/test/scoped_task_environment.h" +#include "chrome/common/pref_names.h" +#include "chromeos/dbus/fake_debug_daemon_client.h" +#include "components/prefs/testing_pref_service.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/dbus/debugd/dbus-constants.h" + +namespace chromeos { + +class SchedulerConfigurationManagerTest : public testing::Test { + public: + SchedulerConfigurationManagerTest() { + SchedulerConfigurationManager::RegisterLocalStatePrefs( + local_state_.registry()); + } + + base::test::ScopedTaskEnvironment scoped_task_environment_; + + FakeDebugDaemonClient debug_daemon_client_; + TestingPrefServiceSimple local_state_; +}; + +TEST_F(SchedulerConfigurationManagerTest, Startup) { + local_state_.SetString(prefs::kSchedulerConfiguration, "initial"); + debug_daemon_client_.SetServiceIsAvailable(false); + + // Manager waits on initialization for service to be available. + SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ("", debug_daemon_client_.scheduler_configuration_name()); + + // Config changes don't lead to updates while debugd isn't ready. + local_state_.SetString(prefs::kSchedulerConfiguration, "config"); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ("", debug_daemon_client_.scheduler_configuration_name()); + + // Once the debugd service becomes available, the config gets set. + debug_daemon_client_.SetServiceIsAvailable(true); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ("config", debug_daemon_client_.scheduler_configuration_name()); +} + +TEST_F(SchedulerConfigurationManagerTest, ConfigChange) { + // Correct default is used when there is no configured value. + SchedulerConfigurationManager manager(&debug_daemon_client_, &local_state_); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(debugd::scheduler_configuration::kPerformanceScheduler, + debug_daemon_client_.scheduler_configuration_name()); + + // Change user pref, which should trigger a config change. + local_state_.SetUserPref(prefs::kSchedulerConfiguration, + std::make_unique<base::Value>("user")); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ("user", debug_daemon_client_.scheduler_configuration_name()); + + // Set a policy, which should override the user setting + local_state_.SetManagedPref(prefs::kSchedulerConfiguration, + std::make_unique<base::Value>("policy")); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ("policy", debug_daemon_client_.scheduler_configuration_name()); + + // Dropping the user pref doesn't change anything. + local_state_.RemoveUserPref(prefs::kSchedulerConfiguration); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ("policy", debug_daemon_client_.scheduler_configuration_name()); + + // Dropping the policy as well reverts to the default configuration. + local_state_.RemoveManagedPref(prefs::kSchedulerConfiguration); + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(debugd::scheduler_configuration::kPerformanceScheduler, + debug_daemon_client_.scheduler_configuration_name()); +} + +} // namespace chromeos
diff --git a/chrome/browser/client_hints/client_hints_browsertest.cc b/chrome/browser/client_hints/client_hints_browsertest.cc index 76fc819..39ba63c 100644 --- a/chrome/browser/client_hints/client_hints_browsertest.cc +++ b/chrome/browser/client_hints/client_hints_browsertest.cc
@@ -664,9 +664,9 @@ // use webpages that may contain http-equiv Accept-CH and Accept-CH-Lifetime // headers. When set to false, the tests use webpages that set the headers in // the HTTP response headers. -INSTANTIATE_TEST_CASE_P(/* no prefix */, - ClientHintsBrowserTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + ClientHintsBrowserTest, + testing::Bool()); class ClientHintsAllowThirdPartyBrowserTest : public ClientHintsBrowserTest { void SetUpCommandLine(base::CommandLine* cmd) override {
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_browsertest.cc b/chrome/browser/data_reduction_proxy/data_reduction_proxy_browsertest.cc index 97b56d53c..96266dc 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_browsertest.cc +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_browsertest.cc
@@ -739,7 +739,7 @@ // First parameter indicate proxy scheme for proxies that are being tested. // Second parameter is true if the test proxy server should set via header // correctly on the response headers. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , DataReductionProxyWarmupURLBrowsertest, ::testing::Combine(testing::Values(ProxyServer_ProxyScheme_HTTP,
diff --git a/chrome/browser/data_saver/data_saver_holdback_browsertest.cc b/chrome/browser/data_saver/data_saver_holdback_browsertest.cc index 9c297df..3826465 100644 --- a/chrome/browser/data_saver/data_saver_holdback_browsertest.cc +++ b/chrome/browser/data_saver/data_saver_holdback_browsertest.cc
@@ -85,7 +85,7 @@ }; // The data saver holdback is enabled only if the first param is true. -INSTANTIATE_TEST_CASE_P(, DataSaverHoldbackBrowserTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, DataSaverHoldbackBrowserTest, testing::Bool()); IN_PROC_BROWSER_TEST_P(DataSaverHoldbackBrowserTest, DataSaverEnabledWithHoldbackEnabled) {
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc index 951fe3bd..0f2183a 100644 --- a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc +++ b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -6,14 +6,9 @@ #include <string> #include "base/callback.h" -#include "base/json/json_string_value_serializer.h" #include "base/memory/ref_counted.h" -#include "base/strings/pattern.h" -#include "base/strings/string_util.h" #include "base/test/bind_test_util.h" #include "base/values.h" -#include "chrome/browser/browsing_data/browsing_data_helper.h" -#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/profiles/profile.h" @@ -23,15 +18,10 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/sync_ui_util.h" #include "chrome/browser/ui/browser.h" -#include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/browser_sync/profile_sync_service.h" -#include "components/browsing_data/core/browsing_data_utils.h" -#include "components/browsing_data/core/pref_names.h" -#include "components/prefs/pref_service.h" #include "components/signin/core/browser/account_reconcilor.h" #include "components/signin/core/browser/signin_buildflags.h" -#include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/storage_partition.h" #include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/google_service_auth_error.h" @@ -41,279 +31,24 @@ #include "services/identity/public/cpp/identity_test_utils.h" #include "url/gurl.h" -using extension_function_test_utils::RunFunctionAndReturnError; using extension_function_test_utils::RunFunctionAndReturnSingleResult; namespace { -enum OriginTypeMask { - UNPROTECTED_WEB = content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, - PROTECTED_WEB = content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB, - EXTENSION = ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_EXTENSION -}; - -const char kRemoveEverythingArguments[] = - "[{\"since\": 1000}, {" - "\"appcache\": true, \"cache\": true, \"cookies\": true, " - "\"downloads\": true, \"fileSystems\": true, \"formData\": true, " - "\"history\": true, \"indexedDB\": true, \"localStorage\": true, " - "\"serverBoundCertificates\": true, \"passwords\": true, " - "\"pluginData\": true, \"serviceWorkers\": true, \"cacheStorage\": true, " - "\"webSQL\": true" - "}]"; - -class ExtensionBrowsingDataTest : public InProcessBrowserTest { - public: - const base::Time& GetBeginTime() { - return remover_->GetLastUsedBeginTime(); - } - - int GetRemovalMask() { - return remover_->GetLastUsedRemovalMask(); - } - - int GetOriginTypeMask() { - return remover_->GetLastUsedOriginTypeMask(); - } - - protected: - void SetUp() override { - InProcessBrowserTest::SetUp(); - } - - void SetUpOnMainThread() override { - remover_ = - content::BrowserContext::GetBrowsingDataRemover(browser()->profile()); - } - - int GetAsMask(const base::DictionaryValue* dict, std::string path, - int mask_value) { - bool result; - EXPECT_TRUE(dict->GetBoolean(path, &result)) << "for " << path; - return result ? mask_value : 0; - } - - void RunBrowsingDataRemoveFunctionAndCompareRemovalMask( - const std::string& data_types, - int expected_mask) { - auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); - SCOPED_TRACE(data_types); - EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( - function.get(), - std::string("[{\"since\": 1},") + data_types + "]", - browser())); - EXPECT_EQ(expected_mask, GetRemovalMask()); - EXPECT_EQ(UNPROTECTED_WEB, GetOriginTypeMask()); - } - - void RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - const std::string& key, - int expected_mask) { - RunBrowsingDataRemoveFunctionAndCompareRemovalMask( - std::string("{\"") + key + "\": true}", expected_mask); - } - - void RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - const std::string& protectedStr, - int expected_mask) { - auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); - SCOPED_TRACE(protectedStr); - EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( - function.get(), - "[{\"originTypes\": " + protectedStr + "}, {\"cookies\": true}]", - browser())); - EXPECT_EQ(expected_mask, GetOriginTypeMask()); - } - - template<class ShortcutFunction> - void RunAndCompareRemovalMask(int expected_mask) { - scoped_refptr<ShortcutFunction> function = - new ShortcutFunction(); - SCOPED_TRACE(ShortcutFunction::function_name()); - EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( - function.get(), - std::string("[{\"since\": 1}]"), - browser())); - EXPECT_EQ(expected_mask, GetRemovalMask()); - EXPECT_EQ(UNPROTECTED_WEB, GetOriginTypeMask()); - } - - void SetSinceAndVerify(browsing_data::TimePeriod since_pref) { - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetInteger(browsing_data::prefs::kDeleteTimePeriod, - static_cast<int>(since_pref)); - - scoped_refptr<BrowsingDataSettingsFunction> function = - new BrowsingDataSettingsFunction(); - SCOPED_TRACE("settings"); - std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult( - function.get(), std::string("[]"), browser())); - - base::DictionaryValue* result; - EXPECT_TRUE(result_value->GetAsDictionary(&result)); - base::DictionaryValue* options; - EXPECT_TRUE(result->GetDictionary("options", &options)); - double since; - EXPECT_TRUE(options->GetDouble("since", &since)); - - double expected_since = 0; - if (since_pref != browsing_data::TimePeriod::ALL_TIME) { - base::Time time = CalculateBeginDeleteTime(since_pref); - expected_since = time.ToJsTime(); - } - // Even a synchronous function takes nonzero time, but the difference - // between when the function was called and now should be well under a - // second, so we'll make sure the requested start time is within 10 seconds. - // Since the smallest selectable period is an hour, that should be - // sufficient. - EXPECT_LE(expected_since, since + 10.0 * 1000.0); - } - - void SetPrefsAndVerifySettings(int data_type_flags, - int expected_origin_type_mask, - int expected_removal_mask) { - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetInteger( - browsing_data::prefs::kLastClearBrowsingDataTab, - static_cast<int>(browsing_data::ClearBrowsingDataTab::ADVANCED)); - prefs->SetBoolean( - browsing_data::prefs::kDeleteCache, - !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_CACHE)); - prefs->SetBoolean( - browsing_data::prefs::kDeleteCookies, - !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_COOKIES)); - prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory, - !!(data_type_flags & - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY)); - prefs->SetBoolean( - browsing_data::prefs::kDeleteFormData, - !!(data_type_flags & - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA)); - prefs->SetBoolean(browsing_data::prefs::kDeleteDownloadHistory, - !!(data_type_flags & - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS)); - prefs->SetBoolean( - browsing_data::prefs::kDeleteHostedAppsData, - !!(data_type_flags & ChromeBrowsingDataRemoverDelegate:: - DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY)); - prefs->SetBoolean( - browsing_data::prefs::kDeletePasswords, - !!(data_type_flags & - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS)); - prefs->SetBoolean( - prefs::kClearPluginLSODataEnabled, - !!(data_type_flags & - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA)); - - VerifyRemovalMask(expected_origin_type_mask, expected_removal_mask); - } - - void SetBasicPrefsAndVerifySettings(int data_type_flags, - int expected_origin_type_mask, - int expected_removal_mask) { - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetInteger( - browsing_data::prefs::kLastClearBrowsingDataTab, - static_cast<int>(browsing_data::ClearBrowsingDataTab::BASIC)); - prefs->SetBoolean( - browsing_data::prefs::kDeleteCacheBasic, - !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_CACHE)); - prefs->SetBoolean( - browsing_data::prefs::kDeleteCookiesBasic, - !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_COOKIES)); - prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryBasic, - !!(data_type_flags & - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY)); - prefs->SetBoolean( - prefs::kClearPluginLSODataEnabled, - !!(data_type_flags & - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA)); - - VerifyRemovalMask(expected_origin_type_mask, expected_removal_mask); - } - - void VerifyRemovalMask(int expected_origin_type_mask, - int expected_removal_mask) { - scoped_refptr<BrowsingDataSettingsFunction> function = - new BrowsingDataSettingsFunction(); - SCOPED_TRACE("settings"); - std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult( - function.get(), std::string("[]"), browser())); - - base::DictionaryValue* result; - EXPECT_TRUE(result_value->GetAsDictionary(&result)); - - base::DictionaryValue* options; - EXPECT_TRUE(result->GetDictionary("options", &options)); - base::DictionaryValue* origin_types; - EXPECT_TRUE(options->GetDictionary("originTypes", &origin_types)); - int origin_type_mask = GetAsMask(origin_types, "unprotectedWeb", - UNPROTECTED_WEB) | - GetAsMask(origin_types, "protectedWeb", - PROTECTED_WEB) | - GetAsMask(origin_types, "extension", EXTENSION); - EXPECT_EQ(expected_origin_type_mask, origin_type_mask); - - base::DictionaryValue* data_to_remove; - EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); - int removal_mask = - GetAsMask(data_to_remove, "appcache", - content::BrowsingDataRemover::DATA_TYPE_APP_CACHE) | - GetAsMask(data_to_remove, "cache", - content::BrowsingDataRemover::DATA_TYPE_CACHE) | - GetAsMask(data_to_remove, "cacheStorage", - content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE) | - GetAsMask(data_to_remove, "cookies", - content::BrowsingDataRemover::DATA_TYPE_COOKIES) | - GetAsMask(data_to_remove, "downloads", - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS) | - GetAsMask(data_to_remove, "fileSystems", - content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS) | - GetAsMask(data_to_remove, "formData", - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA) | - GetAsMask(data_to_remove, "history", - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY) | - GetAsMask(data_to_remove, "indexedDB", - content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB) | - GetAsMask(data_to_remove, "localStorage", - content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE) | - GetAsMask(data_to_remove, "pluginData", - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA) | - GetAsMask(data_to_remove, "passwords", - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS) | - GetAsMask(data_to_remove, "serviceWorkers", - content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS) | - GetAsMask(data_to_remove, "webSQL", - content::BrowsingDataRemover::DATA_TYPE_WEB_SQL) | - GetAsMask(data_to_remove, "serverBoundCertificates", - content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS); - - EXPECT_EQ(expected_removal_mask, removal_mask); - } - - // The kAllowDeletingBrowserHistory pref must be set to false before this - // is called. - void CheckRemovalPermitted(const std::string& data_types, bool permitted) { - auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); - std::string args = "[{\"since\": 1}," + data_types + "]"; - - if (permitted) { - EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( - function.get(), args, browser())) << " for " << args; - } else { - EXPECT_TRUE(base::MatchPattern( - RunFunctionAndReturnError(function.get(), args, browser()), - extension_browsing_data_api_constants::kDeleteProhibitedError)) - << " for " << args; - } - } - - private: - // Cached pointer to BrowsingDataRemover for access to testing methods. - content::BrowsingDataRemover* remover_; -}; +class ExtensionBrowsingDataTest : public InProcessBrowserTest {}; #if BUILDFLAG(ENABLE_DICE_SUPPORT) + +const char kRemoveEverythingArguments[] = + R"([{"since": 1000}, { + "appcache": true, "cache": true, "cookies": true, + "downloads": true, "fileSystems": true, "formData": true, + "history": true, "indexedDB": true, "localStorage": true, + "serverBoundCertificates": true, "passwords": true, + "pluginData": true, "serviceWorkers": true, "cacheStorage": true, + "webSQL": true + }])"; + // Sets the APISID Gaia cookie, which is monitored by the AccountReconcilor. bool SetGaiaCookieForProfile(Profile* profile) { GURL google_url = GaiaUrls::GetInstance()->google_url(); @@ -343,63 +78,6 @@ } // namespace -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, RemovalProhibited) { - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); - - CheckRemovalPermitted("{\"appcache\": true}", true); - CheckRemovalPermitted("{\"cache\": true}", true); - CheckRemovalPermitted("{\"cacheStorage\": true}", true); - CheckRemovalPermitted("{\"cookies\": true}", true); - CheckRemovalPermitted("{\"downloads\": true}", false); - CheckRemovalPermitted("{\"fileSystems\": true}", true); - CheckRemovalPermitted("{\"formData\": true}", true); - CheckRemovalPermitted("{\"history\": true}", false); - CheckRemovalPermitted("{\"indexedDB\": true}", true); - CheckRemovalPermitted("{\"localStorage\": true}", true); - CheckRemovalPermitted("{\"serverBoundCertificates\": true}", true); - CheckRemovalPermitted("{\"passwords\": true}", true); - CheckRemovalPermitted("{\"serviceWorkers\": true}", true); - CheckRemovalPermitted("{\"webSQL\": true}", true); - - // The entire removal is prohibited if any part is. - CheckRemovalPermitted("{\"cache\": true, \"history\": true}", false); - CheckRemovalPermitted("{\"cookies\": true, \"downloads\": true}", false); - - // If a prohibited type is not selected, the removal is OK. - CheckRemovalPermitted("{\"history\": false}", true); - CheckRemovalPermitted("{\"downloads\": false}", true); - CheckRemovalPermitted("{\"cache\": true, \"history\": false}", true); - CheckRemovalPermitted("{\"cookies\": true, \"downloads\": false}", true); -} - -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, RemoveBrowsingDataAll) { - auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); - EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult(function.get(), - kRemoveEverythingArguments, - browser())); - - EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime()); - EXPECT_EQ( - // TODO(benwells): implement clearing of site usage data via the - // browsing data API. https://crbug.com/500801. - // TODO(dmurph): implement clearing of durable storage permission - // via the browsing data API. https://crbug.com/500801. - // TODO(ramyasharma): implement clearing of external protocol data - // via the browsing data API. https://crbug.com/692850. - content::BrowsingDataRemover::DATA_TYPE_COOKIES | - content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS | - (content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE & - ~content::BrowsingDataRemover::DATA_TYPE_BACKGROUND_FETCH & - ~content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE) | - content::BrowsingDataRemover::DATA_TYPE_CACHE | - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS, - GetRemovalMask()); -} - #if BUILDFLAG(ENABLE_DICE_SUPPORT) // Test that Sync is not paused when browsing data is cleared. IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, Syncing) { @@ -492,240 +170,3 @@ identity_manager->HasAccountWithRefreshToken(account_info.account_id)); } #endif - -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, BrowsingDataOriginTypeMask) { - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask("{}", 0); - - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - "{\"unprotectedWeb\": true}", UNPROTECTED_WEB); - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - "{\"protectedWeb\": true}", PROTECTED_WEB); - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - "{\"extension\": true}", EXTENSION); - - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - "{\"unprotectedWeb\": true, \"protectedWeb\": true}", - UNPROTECTED_WEB | PROTECTED_WEB); - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - "{\"unprotectedWeb\": true, \"extension\": true}", - UNPROTECTED_WEB | EXTENSION); - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - "{\"protectedWeb\": true, \"extension\": true}", - PROTECTED_WEB | EXTENSION); - - RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( - ("{\"unprotectedWeb\": true, \"protectedWeb\": true, " - "\"extension\": true}"), - UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION); -} - -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, - BrowsingDataRemovalMask) { - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "appcache", content::BrowsingDataRemover::DATA_TYPE_APP_CACHE); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "cache", content::BrowsingDataRemover::DATA_TYPE_CACHE); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "cacheStorage", content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "cookies", content::BrowsingDataRemover::DATA_TYPE_COOKIES); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "downloads", content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "fileSystems", content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "formData", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "history", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "indexedDB", content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "localStorage", content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "serverBoundCertificates", - content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "passwords", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS); - // We can't remove plugin data inside a test profile. - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "serviceWorkers", - content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS); - RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( - "webSQL", content::BrowsingDataRemover::DATA_TYPE_WEB_SQL); -} - -// Test an arbitrary combination of data types. -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, - BrowsingDataRemovalMaskCombination) { - RunBrowsingDataRemoveFunctionAndCompareRemovalMask( - "{\"appcache\": true, \"cookies\": true, \"history\": true}", - content::BrowsingDataRemover::DATA_TYPE_APP_CACHE | - content::BrowsingDataRemover::DATA_TYPE_COOKIES | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); -} - -// Make sure the remove() function accepts the format produced by settings(). -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, - BrowsingDataRemovalInputFromSettings) { - PrefService* prefs = browser()->profile()->GetPrefs(); - prefs->SetInteger( - browsing_data::prefs::kLastClearBrowsingDataTab, - static_cast<int>(browsing_data::ClearBrowsingDataTab::ADVANCED)); - prefs->SetBoolean(browsing_data::prefs::kDeleteCache, true); - prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory, true); - prefs->SetBoolean(browsing_data::prefs::kDeleteDownloadHistory, true); - prefs->SetBoolean(browsing_data::prefs::kDeleteCookies, false); - prefs->SetBoolean(browsing_data::prefs::kDeleteFormData, false); - prefs->SetBoolean(browsing_data::prefs::kDeleteHostedAppsData, false); - prefs->SetBoolean(browsing_data::prefs::kDeletePasswords, false); - prefs->SetBoolean(prefs::kClearPluginLSODataEnabled, false); - int expected_mask = content::BrowsingDataRemover::DATA_TYPE_CACHE | - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY; - std::string json; - // Scoping for the traces. - { - scoped_refptr<BrowsingDataSettingsFunction> settings_function = - new BrowsingDataSettingsFunction(); - SCOPED_TRACE("settings_json"); - std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult( - settings_function.get(), std::string("[]"), browser())); - - base::DictionaryValue* result; - EXPECT_TRUE(result_value->GetAsDictionary(&result)); - base::DictionaryValue* data_to_remove; - EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); - - JSONStringValueSerializer serializer(&json); - EXPECT_TRUE(serializer.Serialize(*data_to_remove)); - } - { - auto remove_function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); - SCOPED_TRACE("remove_json"); - EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( - remove_function.get(), - std::string("[{\"since\": 1},") + json + "]", - browser())); - EXPECT_EQ(expected_mask, GetRemovalMask()); - EXPECT_EQ(UNPROTECTED_WEB, GetOriginTypeMask()); - } -} - -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { - RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( - content::BrowsingDataRemover::DATA_TYPE_APP_CACHE); - RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( - content::BrowsingDataRemover::DATA_TYPE_CACHE); - RunAndCompareRemovalMask<BrowsingDataRemoveCacheStorageFunction>( - content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE); - RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( - content::BrowsingDataRemover::DATA_TYPE_COOKIES | - content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS); - RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); - RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( - content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS); - RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA); - RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); - RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( - content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB); - RunAndCompareRemovalMask<BrowsingDataRemoveLocalStorageFunction>( - content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE); - // We can't remove plugin data inside a test profile. - RunAndCompareRemovalMask<BrowsingDataRemovePasswordsFunction>( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS); - RunAndCompareRemovalMask<BrowsingDataRemoveServiceWorkersFunction>( - content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS); - RunAndCompareRemovalMask<BrowsingDataRemoveWebSQLFunction>( - content::BrowsingDataRemover::DATA_TYPE_WEB_SQL); -} - -// Test the processing of the 'delete since' preference. -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSince) { - SetSinceAndVerify(browsing_data::TimePeriod::ALL_TIME); - SetSinceAndVerify(browsing_data::TimePeriod::LAST_HOUR); - SetSinceAndVerify(browsing_data::TimePeriod::LAST_DAY); - SetSinceAndVerify(browsing_data::TimePeriod::LAST_WEEK); - SetSinceAndVerify(browsing_data::TimePeriod::FOUR_WEEKS); -} - -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionEmpty) { - SetPrefsAndVerifySettings(0, 0, 0); -} - -// Test straightforward settings, mapped 1:1 to data types. -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSimple) { - SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_CACHE, 0, - content::BrowsingDataRemover::DATA_TYPE_CACHE); - SetPrefsAndVerifySettings( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, 0, - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); - SetPrefsAndVerifySettings( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA, 0, - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA); - SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS, - 0, - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); - SetPrefsAndVerifySettings( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS, 0, - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS); - SetBasicPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_CACHE, - 0, - content::BrowsingDataRemover::DATA_TYPE_CACHE); - SetBasicPrefsAndVerifySettings( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, 0, - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); -} - -// Test cookie and app data settings. -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSiteData) { - int supported_site_data_except_plugins = - (content::BrowsingDataRemover::DATA_TYPE_COOKIES | - content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS | - content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE) & - ~content::BrowsingDataRemover::DATA_TYPE_BACKGROUND_FETCH & - ~content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE; - int supported_site_data = - supported_site_data_except_plugins | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA; - - SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_COOKIES, - UNPROTECTED_WEB, - supported_site_data_except_plugins); - SetPrefsAndVerifySettings( - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY, - PROTECTED_WEB, supported_site_data_except_plugins); - SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_COOKIES | - ChromeBrowsingDataRemoverDelegate:: - DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY, - PROTECTED_WEB | UNPROTECTED_WEB, - supported_site_data_except_plugins); - SetPrefsAndVerifySettings( - content::BrowsingDataRemover::DATA_TYPE_COOKIES | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA, - UNPROTECTED_WEB, supported_site_data); - SetBasicPrefsAndVerifySettings( - content::BrowsingDataRemover::DATA_TYPE_COOKIES, UNPROTECTED_WEB, - supported_site_data_except_plugins); -} - -// Test an arbitrary assortment of settings. -IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionAssorted) { - int supported_site_data = - (content::BrowsingDataRemover::DATA_TYPE_COOKIES | - content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS | - content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE) & - ~content::BrowsingDataRemover::DATA_TYPE_BACKGROUND_FETCH & - ~content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE; - - SetPrefsAndVerifySettings( - content::BrowsingDataRemover::DATA_TYPE_COOKIES | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS, - UNPROTECTED_WEB, - supported_site_data | - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | - content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); -}
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_unittest.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_unittest.cc index 9bb9be8..df6fd26 100644 --- a/chrome/browser/extensions/api/browsing_data/browsing_data_unittest.cc +++ b/chrome/browser/extensions/api/browsing_data/browsing_data_unittest.cc
@@ -2,16 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/callback.h" +#include "base/json/json_string_value_serializer.h" +#include "base/memory/ref_counted.h" +#include "base/values.h" +#include "chrome/browser/browsing_data/browsing_data_helper.h" #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_service_test_base.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/pref_names.h" #include "chrome/test/base/test_browser_window.h" +#include "components/browsing_data/core/browsing_data_utils.h" +#include "components/browsing_data/core/pref_names.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browsing_data_remover.h" #include "content/public/test/mock_browsing_data_remover_delegate.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" using extension_function_test_utils::RunFunctionAndReturnError; using extension_function_test_utils::RunFunctionAndReturnSingleResult; @@ -26,7 +37,15 @@ EXTENSION = ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_EXTENSION }; -} +const char kRemoveEverythingArguments[] = + R"([{"since": 1000}, { + "appcache": true, "cache": true, "cookies": true, + "downloads": true, "fileSystems": true, "formData": true, + "history": true, "indexedDB": true, "localStorage": true, + "serverBoundCertificates": true, "passwords": true, + "pluginData": true, "serviceWorkers": true, "cacheStorage": true, + "webSQL": true + }])"; class BrowsingDataApiTest : public ExtensionServiceTestBase { protected: @@ -49,6 +68,231 @@ browser_window_.reset(); ExtensionServiceTestBase::TearDown(); } + const base::Time& GetBeginTime() { return remover_->GetLastUsedBeginTime(); } + + int GetRemovalMask() { return remover_->GetLastUsedRemovalMask(); } + + int GetOriginTypeMask() { return remover_->GetLastUsedOriginTypeMask(); } + + int GetAsMask(const base::DictionaryValue* dict, + std::string path, + int mask_value) { + bool result; + EXPECT_TRUE(dict->GetBoolean(path, &result)) << "for " << path; + return result ? mask_value : 0; + } + + void RunBrowsingDataRemoveFunctionAndCompareRemovalMask( + const std::string& data_types, + int expected_mask) { + auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); + SCOPED_TRACE(data_types); + EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( + function.get(), + std::string("[{\"since\": 1},") + data_types + "]", + browser())); + EXPECT_EQ(expected_mask, GetRemovalMask()); + EXPECT_EQ(UNPROTECTED_WEB, GetOriginTypeMask()); + } + + void RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(const std::string& key, + int expected_mask) { + RunBrowsingDataRemoveFunctionAndCompareRemovalMask( + std::string("{\"") + key + "\": true}", expected_mask); + } + + void RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + const std::string& protectedStr, + int expected_mask) { + auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); + SCOPED_TRACE(protectedStr); + EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( + function.get(), + "[{\"originTypes\": " + protectedStr + + "}, {\"cookies\": true}]", + browser())); + EXPECT_EQ(expected_mask, GetOriginTypeMask()); + } + + template <class ShortcutFunction> + void RunAndCompareRemovalMask(int expected_mask) { + scoped_refptr<ShortcutFunction> function = new ShortcutFunction(); + SCOPED_TRACE(ShortcutFunction::function_name()); + EXPECT_EQ(NULL, + RunFunctionAndReturnSingleResult( + function.get(), std::string("[{\"since\": 1}]"), browser())); + EXPECT_EQ(expected_mask, GetRemovalMask()); + EXPECT_EQ(UNPROTECTED_WEB, GetOriginTypeMask()); + } + + void SetSinceAndVerify(browsing_data::TimePeriod since_pref) { + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetInteger(browsing_data::prefs::kDeleteTimePeriod, + static_cast<int>(since_pref)); + + scoped_refptr<BrowsingDataSettingsFunction> function = + new BrowsingDataSettingsFunction(); + SCOPED_TRACE("settings"); + std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult( + function.get(), std::string("[]"), browser())); + + base::DictionaryValue* result; + EXPECT_TRUE(result_value->GetAsDictionary(&result)); + base::DictionaryValue* options; + EXPECT_TRUE(result->GetDictionary("options", &options)); + double since; + EXPECT_TRUE(options->GetDouble("since", &since)); + + double expected_since = 0; + if (since_pref != browsing_data::TimePeriod::ALL_TIME) { + base::Time time = CalculateBeginDeleteTime(since_pref); + expected_since = time.ToJsTime(); + } + // Even a synchronous function takes nonzero time, but the difference + // between when the function was called and now should be well under a + // second, so we'll make sure the requested start time is within 10 seconds. + // Since the smallest selectable period is an hour, that should be + // sufficient. + EXPECT_LE(expected_since, since + 10.0 * 1000.0); + } + + void SetPrefsAndVerifySettings(int data_type_flags, + int expected_origin_type_mask, + int expected_removal_mask) { + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetInteger( + browsing_data::prefs::kLastClearBrowsingDataTab, + static_cast<int>(browsing_data::ClearBrowsingDataTab::ADVANCED)); + prefs->SetBoolean( + browsing_data::prefs::kDeleteCache, + !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_CACHE)); + prefs->SetBoolean( + browsing_data::prefs::kDeleteCookies, + !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_COOKIES)); + prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory, + !!(data_type_flags & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY)); + prefs->SetBoolean( + browsing_data::prefs::kDeleteFormData, + !!(data_type_flags & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA)); + prefs->SetBoolean(browsing_data::prefs::kDeleteDownloadHistory, + !!(data_type_flags & + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS)); + prefs->SetBoolean( + browsing_data::prefs::kDeleteHostedAppsData, + !!(data_type_flags & ChromeBrowsingDataRemoverDelegate:: + DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY)); + prefs->SetBoolean( + browsing_data::prefs::kDeletePasswords, + !!(data_type_flags & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS)); + prefs->SetBoolean( + prefs::kClearPluginLSODataEnabled, + !!(data_type_flags & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA)); + + VerifyRemovalMask(expected_origin_type_mask, expected_removal_mask); + } + + void SetBasicPrefsAndVerifySettings(int data_type_flags, + int expected_origin_type_mask, + int expected_removal_mask) { + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetInteger( + browsing_data::prefs::kLastClearBrowsingDataTab, + static_cast<int>(browsing_data::ClearBrowsingDataTab::BASIC)); + prefs->SetBoolean( + browsing_data::prefs::kDeleteCacheBasic, + !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_CACHE)); + prefs->SetBoolean( + browsing_data::prefs::kDeleteCookiesBasic, + !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_COOKIES)); + prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryBasic, + !!(data_type_flags & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY)); + prefs->SetBoolean( + prefs::kClearPluginLSODataEnabled, + !!(data_type_flags & + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA)); + + VerifyRemovalMask(expected_origin_type_mask, expected_removal_mask); + } + + void VerifyRemovalMask(int expected_origin_type_mask, + int expected_removal_mask) { + scoped_refptr<BrowsingDataSettingsFunction> function = + new BrowsingDataSettingsFunction(); + SCOPED_TRACE("settings"); + std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult( + function.get(), std::string("[]"), browser())); + + base::DictionaryValue* result; + EXPECT_TRUE(result_value->GetAsDictionary(&result)); + + base::DictionaryValue* options; + EXPECT_TRUE(result->GetDictionary("options", &options)); + base::DictionaryValue* origin_types; + EXPECT_TRUE(options->GetDictionary("originTypes", &origin_types)); + int origin_type_mask = + GetAsMask(origin_types, "unprotectedWeb", UNPROTECTED_WEB) | + GetAsMask(origin_types, "protectedWeb", PROTECTED_WEB) | + GetAsMask(origin_types, "extension", EXTENSION); + EXPECT_EQ(expected_origin_type_mask, origin_type_mask); + + base::DictionaryValue* data_to_remove; + EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); + int removal_mask = + GetAsMask(data_to_remove, "appcache", + content::BrowsingDataRemover::DATA_TYPE_APP_CACHE) | + GetAsMask(data_to_remove, "cache", + content::BrowsingDataRemover::DATA_TYPE_CACHE) | + GetAsMask(data_to_remove, "cacheStorage", + content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE) | + GetAsMask(data_to_remove, "cookies", + content::BrowsingDataRemover::DATA_TYPE_COOKIES) | + GetAsMask(data_to_remove, "downloads", + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS) | + GetAsMask(data_to_remove, "fileSystems", + content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS) | + GetAsMask(data_to_remove, "formData", + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA) | + GetAsMask(data_to_remove, "history", + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY) | + GetAsMask(data_to_remove, "indexedDB", + content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB) | + GetAsMask(data_to_remove, "localStorage", + content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE) | + GetAsMask(data_to_remove, "pluginData", + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA) | + GetAsMask(data_to_remove, "passwords", + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS) | + GetAsMask(data_to_remove, "serviceWorkers", + content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS) | + GetAsMask(data_to_remove, "webSQL", + content::BrowsingDataRemover::DATA_TYPE_WEB_SQL) | + GetAsMask(data_to_remove, "serverBoundCertificates", + content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS); + + EXPECT_EQ(expected_removal_mask, removal_mask); + } + + // The kAllowDeletingBrowserHistory pref must be set to false before this + // is called. + void CheckRemovalPermitted(const std::string& data_types, bool permitted) { + auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); + std::string args = "[{\"since\": 1}," + data_types + "]"; + + if (permitted) { + EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult(function.get(), args, + browser())) + << " for " << args; + } else { + EXPECT_EQ(RunFunctionAndReturnError(function.get(), args, browser()), + extension_browsing_data_api_constants::kDeleteProhibitedError) + << " for " << args; + } + } void CheckInvalidRemovalArgs(const std::string& args, const std::string& expected_error) { @@ -85,6 +329,298 @@ content::MockBrowsingDataRemoverDelegate delegate_; }; +} // namespace + +TEST_F(BrowsingDataApiTest, RemovalProhibited) { + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); + + CheckRemovalPermitted("{\"appcache\": true}", true); + CheckRemovalPermitted("{\"cache\": true}", true); + CheckRemovalPermitted("{\"cacheStorage\": true}", true); + CheckRemovalPermitted("{\"cookies\": true}", true); + CheckRemovalPermitted("{\"downloads\": true}", false); + CheckRemovalPermitted("{\"fileSystems\": true}", true); + CheckRemovalPermitted("{\"formData\": true}", true); + CheckRemovalPermitted("{\"history\": true}", false); + CheckRemovalPermitted("{\"indexedDB\": true}", true); + CheckRemovalPermitted("{\"localStorage\": true}", true); + CheckRemovalPermitted("{\"serverBoundCertificates\": true}", true); + CheckRemovalPermitted("{\"passwords\": true}", true); + CheckRemovalPermitted("{\"serviceWorkers\": true}", true); + CheckRemovalPermitted("{\"webSQL\": true}", true); + + // The entire removal is prohibited if any part is. + CheckRemovalPermitted("{\"cache\": true, \"history\": true}", false); + CheckRemovalPermitted("{\"cookies\": true, \"downloads\": true}", false); + + // If a prohibited type is not selected, the removal is OK. + CheckRemovalPermitted("{\"history\": false}", true); + CheckRemovalPermitted("{\"downloads\": false}", true); + CheckRemovalPermitted("{\"cache\": true, \"history\": false}", true); + CheckRemovalPermitted("{\"cookies\": true, \"downloads\": false}", true); +} + +TEST_F(BrowsingDataApiTest, RemoveBrowsingDataAll) { + auto function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); + EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( + function.get(), kRemoveEverythingArguments, browser())); + + EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime()); + EXPECT_EQ( + // TODO(benwells): implement clearing of site usage data via the + // browsing data API. https://crbug.com/500801. + // TODO(dmurph): implement clearing of durable storage permission + // via the browsing data API. https://crbug.com/500801. + // TODO(ramyasharma): implement clearing of external protocol data + // via the browsing data API. https://crbug.com/692850. + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS | + (content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE & + ~content::BrowsingDataRemover::DATA_TYPE_BACKGROUND_FETCH & + ~content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE) | + content::BrowsingDataRemover::DATA_TYPE_CACHE | + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS, + GetRemovalMask()); +} + +TEST_F(BrowsingDataApiTest, BrowsingDataOriginTypeMask) { + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask("{}", 0); + + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + "{\"unprotectedWeb\": true}", UNPROTECTED_WEB); + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + "{\"protectedWeb\": true}", PROTECTED_WEB); + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask("{\"extension\": true}", + EXTENSION); + + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + "{\"unprotectedWeb\": true, \"protectedWeb\": true}", + UNPROTECTED_WEB | PROTECTED_WEB); + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + "{\"unprotectedWeb\": true, \"extension\": true}", + UNPROTECTED_WEB | EXTENSION); + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + "{\"protectedWeb\": true, \"extension\": true}", + PROTECTED_WEB | EXTENSION); + + RunBrowsingDataRemoveFunctionAndCompareOriginTypeMask( + ("{\"unprotectedWeb\": true, \"protectedWeb\": true, " + "\"extension\": true}"), + UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION); +} + +TEST_F(BrowsingDataApiTest, BrowsingDataRemovalMask) { + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "appcache", content::BrowsingDataRemover::DATA_TYPE_APP_CACHE); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "cache", content::BrowsingDataRemover::DATA_TYPE_CACHE); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "cacheStorage", content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "cookies", content::BrowsingDataRemover::DATA_TYPE_COOKIES); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "downloads", content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "fileSystems", content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "formData", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "history", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "indexedDB", content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "localStorage", content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "serverBoundCertificates", + content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "passwords", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS); + // We can't remove plugin data inside a test profile. + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "serviceWorkers", + content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS); + RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( + "webSQL", content::BrowsingDataRemover::DATA_TYPE_WEB_SQL); +} + +// Test an arbitrary combination of data types. +TEST_F(BrowsingDataApiTest, BrowsingDataRemovalMaskCombination) { + RunBrowsingDataRemoveFunctionAndCompareRemovalMask( + "{\"appcache\": true, \"cookies\": true, \"history\": true}", + content::BrowsingDataRemover::DATA_TYPE_APP_CACHE | + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); +} + +// Make sure the remove() function accepts the format produced by settings(). +TEST_F(BrowsingDataApiTest, BrowsingDataRemovalInputFromSettings) { + PrefService* prefs = browser()->profile()->GetPrefs(); + prefs->SetInteger( + browsing_data::prefs::kLastClearBrowsingDataTab, + static_cast<int>(browsing_data::ClearBrowsingDataTab::ADVANCED)); + prefs->SetBoolean(browsing_data::prefs::kDeleteCache, true); + prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory, true); + prefs->SetBoolean(browsing_data::prefs::kDeleteDownloadHistory, true); + prefs->SetBoolean(browsing_data::prefs::kDeleteCookies, false); + prefs->SetBoolean(browsing_data::prefs::kDeleteFormData, false); + prefs->SetBoolean(browsing_data::prefs::kDeleteHostedAppsData, false); + prefs->SetBoolean(browsing_data::prefs::kDeletePasswords, false); + prefs->SetBoolean(prefs::kClearPluginLSODataEnabled, false); + int expected_mask = content::BrowsingDataRemover::DATA_TYPE_CACHE | + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY; + std::string json; + // Scoping for the traces. + { + scoped_refptr<BrowsingDataSettingsFunction> settings_function = + new BrowsingDataSettingsFunction(); + SCOPED_TRACE("settings_json"); + std::unique_ptr<base::Value> result_value(RunFunctionAndReturnSingleResult( + settings_function.get(), std::string("[]"), browser())); + + base::DictionaryValue* result; + EXPECT_TRUE(result_value->GetAsDictionary(&result)); + base::DictionaryValue* data_to_remove; + EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); + + JSONStringValueSerializer serializer(&json); + EXPECT_TRUE(serializer.Serialize(*data_to_remove)); + } + { + auto remove_function = base::MakeRefCounted<BrowsingDataRemoveFunction>(); + SCOPED_TRACE("remove_json"); + EXPECT_EQ(NULL, + RunFunctionAndReturnSingleResult( + remove_function.get(), + std::string("[{\"since\": 1},") + json + "]", browser())); + EXPECT_EQ(expected_mask, GetRemovalMask()); + EXPECT_EQ(UNPROTECTED_WEB, GetOriginTypeMask()); + } +} + +TEST_F(BrowsingDataApiTest, ShortcutFunctionRemovalMask) { + RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( + content::BrowsingDataRemover::DATA_TYPE_APP_CACHE); + RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( + content::BrowsingDataRemover::DATA_TYPE_CACHE); + RunAndCompareRemovalMask<BrowsingDataRemoveCacheStorageFunction>( + content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE); + RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS); + RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); + RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( + content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS); + RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA); + RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); + RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( + content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB); + RunAndCompareRemovalMask<BrowsingDataRemoveLocalStorageFunction>( + content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE); + // We can't remove plugin data inside a test profile. + RunAndCompareRemovalMask<BrowsingDataRemovePasswordsFunction>( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS); + RunAndCompareRemovalMask<BrowsingDataRemoveServiceWorkersFunction>( + content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS); + RunAndCompareRemovalMask<BrowsingDataRemoveWebSQLFunction>( + content::BrowsingDataRemover::DATA_TYPE_WEB_SQL); +} + +// Test the processing of the 'delete since' preference. +TEST_F(BrowsingDataApiTest, SettingsFunctionSince) { + SetSinceAndVerify(browsing_data::TimePeriod::ALL_TIME); + SetSinceAndVerify(browsing_data::TimePeriod::LAST_HOUR); + SetSinceAndVerify(browsing_data::TimePeriod::LAST_DAY); + SetSinceAndVerify(browsing_data::TimePeriod::LAST_WEEK); + SetSinceAndVerify(browsing_data::TimePeriod::FOUR_WEEKS); +} + +TEST_F(BrowsingDataApiTest, SettingsFunctionEmpty) { + SetPrefsAndVerifySettings(0, 0, 0); +} + +// Test straightforward settings, mapped 1:1 to data types. +TEST_F(BrowsingDataApiTest, SettingsFunctionSimple) { + SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_CACHE, 0, + content::BrowsingDataRemover::DATA_TYPE_CACHE); + SetPrefsAndVerifySettings( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, 0, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); + SetPrefsAndVerifySettings( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA, 0, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA); + SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS, + 0, + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); + SetPrefsAndVerifySettings( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS, 0, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS); + SetBasicPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_CACHE, + 0, + content::BrowsingDataRemover::DATA_TYPE_CACHE); + SetBasicPrefsAndVerifySettings( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, 0, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY); +} + +// Test cookie and app data settings. +TEST_F(BrowsingDataApiTest, SettingsFunctionSiteData) { + int supported_site_data_except_plugins = + (content::BrowsingDataRemover::DATA_TYPE_COOKIES | + content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS | + content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE) & + ~content::BrowsingDataRemover::DATA_TYPE_BACKGROUND_FETCH & + ~content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE; + int supported_site_data = + supported_site_data_except_plugins | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA; + + SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_COOKIES, + UNPROTECTED_WEB, + supported_site_data_except_plugins); + SetPrefsAndVerifySettings( + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY, + PROTECTED_WEB, supported_site_data_except_plugins); + SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_COOKIES | + ChromeBrowsingDataRemoverDelegate:: + DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY, + PROTECTED_WEB | UNPROTECTED_WEB, + supported_site_data_except_plugins); + SetPrefsAndVerifySettings( + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA, + UNPROTECTED_WEB, supported_site_data); + SetBasicPrefsAndVerifySettings( + content::BrowsingDataRemover::DATA_TYPE_COOKIES, UNPROTECTED_WEB, + supported_site_data_except_plugins); +} + +// Test an arbitrary assortment of settings. +TEST_F(BrowsingDataApiTest, SettingsFunctionAssorted) { + int supported_site_data = + (content::BrowsingDataRemover::DATA_TYPE_COOKIES | + content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS | + content::BrowsingDataRemover::DATA_TYPE_DOM_STORAGE) & + ~content::BrowsingDataRemover::DATA_TYPE_BACKGROUND_FETCH & + ~content::BrowsingDataRemover::DATA_TYPE_EMBEDDER_DOM_STORAGE; + + SetPrefsAndVerifySettings( + content::BrowsingDataRemover::DATA_TYPE_COOKIES | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS, + UNPROTECTED_WEB, + supported_site_data | + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY | + content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS); +} + TEST_F(BrowsingDataApiTest, RemoveWithoutFilter) { auto filter_builder = content::BrowsingDataFilterBuilder::Create( content::BrowsingDataFilterBuilder::BLACKLIST);
diff --git a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc index 82dbd35..e3c8e69 100644 --- a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc +++ b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc
@@ -437,14 +437,14 @@ #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) || \ defined(OS_WIN) // Supported platforms. -INSTANTIATE_TEST_CASE_P(, - CastStreamingApiTestWithPixelOutput, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, + CastStreamingApiTestWithPixelOutput, + ::testing::Bool()); #else // Platforms where the out of process audio service isn't supported -INSTANTIATE_TEST_CASE_P(, - CastStreamingApiTestWithPixelOutput, - ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(, + CastStreamingApiTestWithPixelOutput, + ::testing::Values(false)); #endif } // namespace extensions
diff --git a/chrome/browser/extensions/api/cast_streaming/performance_test.cc b/chrome/browser/extensions/api/cast_streaming/performance_test.cc index 3e98be6..0aa1583 100644 --- a/chrome/browser/extensions/api/cast_streaming/performance_test.cc +++ b/chrome/browser/extensions/api/cast_streaming/performance_test.cc
@@ -725,15 +725,15 @@ // Note: First argument is optional and intentionally left blank. // (it's a prefix for the generated test cases) -INSTANTIATE_TEST_CASE_P(, - CastV2PerformanceTest, - testing::Values(k24fps, - k30fps, - k60fps, - k30fps | kProxyWifi, - k30fps | kProxyBad, - k30fps | kSlowClock, - k30fps | kFastClock, - k30fps | kProxyWifi | kAutoThrottling, - k30fps | kProxySlow | kAutoThrottling, - k30fps | kProxyBad | kAutoThrottling)); +INSTANTIATE_TEST_SUITE_P(, + CastV2PerformanceTest, + testing::Values(k24fps, + k30fps, + k60fps, + k30fps | kProxyWifi, + k30fps | kProxyBad, + k30fps | kSlowClock, + k30fps | kFastClock, + k30fps | kProxyWifi | kAutoThrottling, + k30fps | kProxySlow | kAutoThrottling, + k30fps | kProxyBad | kAutoThrottling));
diff --git a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc index 1d75a16..b6d947e 100644 --- a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc +++ b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc
@@ -191,7 +191,7 @@ EXPECT_FALSE(action->GetIsVisible(tab_id)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , ParameterizedDeclarativeContentActionTest, testing::Values(ExtensionBuilder::ActionType::BROWSER_ACTION,
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc index a5de456..a1578d2a 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
@@ -582,12 +582,12 @@ EXPECT_FALSE(page_action->GetIsVisible(tab_id)); } -INSTANTIATE_TEST_CASE_P(LegacyShowActionKey, - ParameterizedShowActionDeclarativeContentApiTest, - ::testing::Values("ShowPageAction")); -INSTANTIATE_TEST_CASE_P(ModernShowActionKey, - ParameterizedShowActionDeclarativeContentApiTest, - ::testing::Values("ShowAction")); +INSTANTIATE_TEST_SUITE_P(LegacyShowActionKey, + ParameterizedShowActionDeclarativeContentApiTest, + ::testing::Values("ShowPageAction")); +INSTANTIATE_TEST_SUITE_P(ModernShowActionKey, + ParameterizedShowActionDeclarativeContentApiTest, + ::testing::Values("ShowAction")); // Tests that rules are not evaluated in incognito browser windows when the // extension specifies spanning incognito mode but is not enabled for incognito.
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc index 9c1d096..6b0e7408 100644 --- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
@@ -2375,23 +2375,23 @@ {"block_none.com", kNone}}); } -INSTANTIATE_TEST_CASE_P(, - DeclarativeNetRequestBrowserTest, - ::testing::Values(ExtensionLoadType::PACKED, - ExtensionLoadType::UNPACKED)); +INSTANTIATE_TEST_SUITE_P(, + DeclarativeNetRequestBrowserTest, + ::testing::Values(ExtensionLoadType::PACKED, + ExtensionLoadType::UNPACKED)); -INSTANTIATE_TEST_CASE_P(, - DeclarativeNetRequestHostPermissionsBrowserTest, - ::testing::Values(ExtensionLoadType::PACKED, - ExtensionLoadType::UNPACKED)); -INSTANTIATE_TEST_CASE_P(, - DeclarativeNetRequestResourceTypeBrowserTest, - ::testing::Values(ExtensionLoadType::PACKED, - ExtensionLoadType::UNPACKED)); +INSTANTIATE_TEST_SUITE_P(, + DeclarativeNetRequestHostPermissionsBrowserTest, + ::testing::Values(ExtensionLoadType::PACKED, + ExtensionLoadType::UNPACKED)); +INSTANTIATE_TEST_SUITE_P(, + DeclarativeNetRequestResourceTypeBrowserTest, + ::testing::Values(ExtensionLoadType::PACKED, + ExtensionLoadType::UNPACKED)); -INSTANTIATE_TEST_CASE_P(, - DeclarativeNetRequestBrowserTest_Packed, - ::testing::Values(ExtensionLoadType::PACKED)); +INSTANTIATE_TEST_SUITE_P(, + DeclarativeNetRequestBrowserTest_Packed, + ::testing::Values(ExtensionLoadType::PACKED)); } // namespace } // namespace declarative_net_request
diff --git a/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc b/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc index 7bddaac..19e3f5d 100644 --- a/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/rule_indexing_unittest.cc
@@ -555,10 +555,10 @@ LoadAndExpectSuccess(1 /* rules count */); } -INSTANTIATE_TEST_CASE_P(, - RuleIndexingTest, - ::testing::Values(ExtensionLoadType::PACKED, - ExtensionLoadType::UNPACKED)); +INSTANTIATE_TEST_SUITE_P(, + RuleIndexingTest, + ::testing::Values(ExtensionLoadType::PACKED, + ExtensionLoadType::UNPACKED)); } // namespace } // namespace declarative_net_request
diff --git a/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc b/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc index bb84f48..16b2359 100644 --- a/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
@@ -673,10 +673,10 @@ } } -INSTANTIATE_TEST_CASE_P(, - RulesetManagerTest, - ::testing::Values(ExtensionLoadType::PACKED, - ExtensionLoadType::UNPACKED)); +INSTANTIATE_TEST_SUITE_P(, + RulesetManagerTest, + ::testing::Values(ExtensionLoadType::PACKED, + ExtensionLoadType::UNPACKED)); } // namespace } // namespace declarative_net_request
diff --git a/chrome/browser/extensions/api/declarative_net_request/ruleset_matcher_unittest.cc b/chrome/browser/extensions/api/declarative_net_request/ruleset_matcher_unittest.cc index 4ac65d5..f3cdae8 100644 --- a/chrome/browser/extensions/api/declarative_net_request/ruleset_matcher_unittest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/ruleset_matcher_unittest.cc
@@ -150,10 +150,10 @@ expected_checksum, &matcher)); } -INSTANTIATE_TEST_CASE_P(, - RulesetMatcherTest, - ::testing::Values(ExtensionLoadType::PACKED, - ExtensionLoadType::UNPACKED)); +INSTANTIATE_TEST_SUITE_P(, + RulesetMatcherTest, + ::testing::Values(ExtensionLoadType::PACKED, + ExtensionLoadType::UNPACKED)); } // namespace } // namespace declarative_net_request
diff --git a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc index 168bc888..54c97d9 100644 --- a/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc +++ b/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
@@ -320,9 +320,9 @@ } // Both cases of affiliated and non-affiliated on the device user are tested. -INSTANTIATE_TEST_CASE_P(AffiliationCheck, - EnterpriseDeviceAttributesTest, - ::testing::Values(Params(true /* affiliated */), - Params(false /* affiliated */)), - PrintParam); +INSTANTIATE_TEST_SUITE_P(AffiliationCheck, + EnterpriseDeviceAttributesTest, + ::testing::Values(Params(true /* affiliated */), + Params(false /* affiliated */)), + PrintParam); } // namespace extensions
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api_unittest.cc b/chrome/browser/extensions/api/extension_action/extension_action_api_unittest.cc index 85f0d5a..1de8d89 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_api_unittest.cc +++ b/chrome/browser/extensions/api/extension_action/extension_action_api_unittest.cc
@@ -101,10 +101,10 @@ EXPECT_EQ("icon38.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); } -INSTANTIATE_TEST_CASE_P(, - ExtensionActionAPIUnitTest, - testing::Values(TestActionType::kBrowser, - TestActionType::kPage)); +INSTANTIATE_TEST_SUITE_P(, + ExtensionActionAPIUnitTest, + testing::Values(TestActionType::kBrowser, + TestActionType::kPage)); } // namespace } // namespace extensions
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_apitest.cc b/chrome/browser/extensions/api/extension_action/extension_action_apitest.cc index 58185ec..09dc875 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/extension_action_apitest.cc
@@ -258,9 +258,9 @@ action->GetTitle(ExtensionAction::kDefaultTabId)); } -INSTANTIATE_TEST_CASE_P(, - MultiActionAPITest, - testing::Values(TestActionType::kBrowser, - TestActionType::kPage)); +INSTANTIATE_TEST_SUITE_P(, + MultiActionAPITest, + testing::Values(TestActionType::kBrowser, + TestActionType::kPage)); } // namespace extensions
diff --git a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc index 131ab81a..4a26b70 100644 --- a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc +++ b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
@@ -125,9 +125,9 @@ net::MockClientSocketFactory mock_client_socket_factory_; }; -INSTANTIATE_TEST_CASE_P(/* no prefix */, - TCPSocketUnitTest, - testing::Values(net::SYNCHRONOUS, net::ASYNC)); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + TCPSocketUnitTest, + testing::Values(net::SYNCHRONOUS, net::ASYNC)); TEST_F(TCPSocketUnitTest, SocketConnectError) { net::IPEndPoint ip_end_point(net::IPAddress::IPv4Localhost(), 1234); @@ -582,9 +582,9 @@ TestSocketFactory client_socket_factory_; }; -INSTANTIATE_TEST_CASE_P(/* no prefix */, - TCPSocketSettingsTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + TCPSocketSettingsTest, + testing::Bool()); TEST_P(TCPSocketSettingsTest, SetNoDelay) { std::unique_ptr<TCPSocket> socket = CreateAndConnectSocket();
diff --git a/chrome/browser/extensions/api/socket/tls_socket_unittest.cc b/chrome/browser/extensions/api/socket/tls_socket_unittest.cc index 483c23a..dadab921 100644 --- a/chrome/browser/extensions/api/socket/tls_socket_unittest.cc +++ b/chrome/browser/extensions/api/socket/tls_socket_unittest.cc
@@ -227,9 +227,9 @@ EXPECT_TRUE(ssl_socket.ConnectDataConsumed()); } -INSTANTIATE_TEST_CASE_P(/* no prefix */, - TLSSocketTest, - testing::Values(net::SYNCHRONOUS, net::ASYNC)); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + TLSSocketTest, + testing::Values(net::SYNCHRONOUS, net::ASYNC)); TEST_P(TLSSocketTest, ReadWrite) { net::IoMode io_mode = GetParam();
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index 0c5f59e..4677243 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -1504,10 +1504,9 @@ }, }; -INSTANTIATE_TEST_CASE_P( - ExtensionWebRequest, - ExtensionWebRequestHeaderModificationTest, - ::testing::ValuesIn(kTests)); +INSTANTIATE_TEST_SUITE_P(ExtensionWebRequest, + ExtensionWebRequestHeaderModificationTest, + ::testing::ValuesIn(kTests)); } // namespace
diff --git a/chrome/browser/extensions/bookmark_app_helper_unittest.cc b/chrome/browser/extensions/bookmark_app_helper_unittest.cc index b8e37b51..bab629de 100644 --- a/chrome/browser/extensions/bookmark_app_helper_unittest.cc +++ b/chrome/browser/extensions/bookmark_app_helper_unittest.cc
@@ -386,10 +386,10 @@ } } -INSTANTIATE_TEST_CASE_P(/* no prefix */, - BookmarkAppHelperExtensionServiceInstallableSiteTest, - ::testing::Values(ForInstallableSite::kNo, - ForInstallableSite::kYes)); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + BookmarkAppHelperExtensionServiceInstallableSiteTest, + ::testing::Values(ForInstallableSite::kNo, + ForInstallableSite::kYes)); TEST_F(BookmarkAppHelperExtensionServiceTest, CreateBookmarkAppDefaultLauncherContainers) {
diff --git a/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc b/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc index 50ead5c58..abf39795 100644 --- a/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc +++ b/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc
@@ -388,7 +388,7 @@ public ::testing::WithParamInterface< std::tuple<std::string, ui::PageTransition>> {}; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppNavigationThrottleExperimentalTransitionBrowserTest, testing::Combine( @@ -1150,7 +1150,7 @@ base::BindOnce(&WindowOpenAndWait, app_web_contents, target_url)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppNavigationThrottleExperimentalWindowOpenBrowserTest, testing::Values(BookmarkAppNavigationBrowserTest::GetAppUrlHost(), @@ -1251,7 +1251,7 @@ 1}}); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppNavigationThrottleExperimentalLinkBrowserTest, testing::Values("", "noopener", "noreferrer", "nofollow")); @@ -1457,7 +1457,7 @@ } #endif // OS_CHROMEOS -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppNavigationThrottleCommonBrowserTest, testing::Bool()); @@ -1580,7 +1580,7 @@ 1}}); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppNavigationThrottleCommonFormSubmissionBrowserTest, testing::Combine( @@ -1662,7 +1662,7 @@ 1}}); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppNavigationThrottleCommonLinkBrowserTest, testing::Combine(
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 011f106..c8d894c 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -1841,7 +1841,7 @@ test_url_loader_factory_.AddResponse( url1.spec(), "Any content. This is irrelevant.", net::HTTP_OK); - RunUntilIdle(); + content::RunAllTasksUntilIdle(); // Expect that the service was asked to do an install with the right data. base::FilePath tmpfile_path = service.install_path();
diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index 8fb17841..682ff8e1 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc
@@ -267,14 +267,13 @@ EXPECT_TRUE(default_homepage_is_ntp); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FirstRunMasterPrefsWithTrackedPreferencesInstance, FirstRunMasterPrefsWithTrackedPreferences, testing::Values( chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, - chrome_prefs::internals:: - kSettingsEnforcementGroupEnforceAlwaysWithDSE, + chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlwaysWithDSE, chrome_prefs::internals:: kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE));
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 478fd1cc..5173e27 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -347,6 +347,11 @@ "expiry_milestone": 76 }, { + "name": "cct-module-custom-request-header", + "owners": [ "mvanouwerkerk" ], + "expiry_milestone": 76 + }, + { "name": "cct-module-dex-loading", "owners": [ "mvanouwerkerk" ], "expiry_milestone": 76 @@ -2102,11 +2107,6 @@ "expiry_milestone": 76 }, { - "name": "enumerate-audio-devices", - // "owners": [ "your-team" ], - "expiry_milestone": 76 - }, - { "name": "expensive-background-timer-throttling", // "owners": [ "your-team" ], "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 6c3748e8..1b5f925 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -603,11 +603,6 @@ "this is enabled do not implement TLS 1.0 through 1.2 correctly or " "securely. They must be fixed by vendors."; -const char kEnableEnumeratingAudioDevicesName[] = - "Experimentally enable enumerating audio devices."; -const char kEnableEnumeratingAudioDevicesDescription[] = - "Experimentally enable the use of enumerating audio devices."; - const char kEnableGenericSensorName[] = "Generic Sensor"; const char kEnableGenericSensorDescription[] = "Enables motion sensor classes based on Generic Sensor API, i.e. " @@ -2278,6 +2273,12 @@ "Enables header customization by dynamically loaded modules in " "Chrome Custom Tabs."; +const char kCCTModuleCustomRequestHeaderName[] = + "Chrome Custom Tabs Module Custom Request Header"; +const char kCCTModuleCustomRequestHeaderDescription[] = + "Enables a custom request header for URLs managed by dynamically loaded " + "modules in Chrome Custom Tabs."; + const char kCCTModuleDexLoadingName[] = "Chrome Custom Tabs Module Dex Loading"; const char kCCTModuleDexLoadingDescription[] = "Enables loading Chrome Custom Tabs module code from a dex file "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 18ae44d..c2c963b 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -391,9 +391,6 @@ extern const char kEnforceTLS13DowngradeName[]; extern const char kEnforceTLS13DowngradeDescription[]; -extern const char kEnableEnumeratingAudioDevicesName[]; -extern const char kEnableEnumeratingAudioDevicesDescription[]; - extern const char kEnableGenericSensorName[]; extern const char kEnableGenericSensorDescription[]; @@ -1351,6 +1348,9 @@ extern const char kCCTModuleCustomHeaderName[]; extern const char kCCTModuleCustomHeaderDescription[]; +extern const char kCCTModuleCustomRequestHeaderName[]; +extern const char kCCTModuleCustomRequestHeaderDescription[]; + extern const char kCCTModuleDexLoadingName[]; extern const char kCCTModuleDexLoadingDescription[];
diff --git a/chrome/browser/google/google_update_win_unittest.cc b/chrome/browser/google/google_update_win_unittest.cc index 54c641cc..c0bed81 100644 --- a/chrome/browser/google/google_update_win_unittest.cc +++ b/chrome/browser/google/google_update_win_unittest.cc
@@ -1022,6 +1022,6 @@ task_runner_->RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P(UserLevel, GoogleUpdateWinTest, Values(false)); +INSTANTIATE_TEST_SUITE_P(UserLevel, GoogleUpdateWinTest, Values(false)); -INSTANTIATE_TEST_CASE_P(SystemLevel, GoogleUpdateWinTest, Values(true)); +INSTANTIATE_TEST_SUITE_P(SystemLevel, GoogleUpdateWinTest, Values(true));
diff --git a/chrome/browser/loader/cors_origin_access_list_browsertest.cc b/chrome/browser/loader/cors_origin_access_list_browsertest.cc index dfd421f..0b5b568 100644 --- a/chrome/browser/loader/cors_origin_access_list_browsertest.cc +++ b/chrome/browser/loader/cors_origin_access_list_browsertest.cc
@@ -278,12 +278,12 @@ EXPECT_EQ(fail_string(), watcher->WaitAndGetTitle()) << GetReason(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OutOfBlinkCorsWithServicification, CorsOriginAccessListBrowserTest, ::testing::Values(TestMode::kOutOfBlinkCorsWithServicification)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OutOfBlinkCorsWithoutServicification, CorsOriginAccessListBrowserTest, ::testing::Values(TestMode::kOutOfBlinkCorsWithoutServicification));
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index be4fc9e..9a51788b 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -470,36 +470,36 @@ using ::testing::Combine; using ::testing::Values; -INSTANTIATE_TEST_CASE_P(MSE_ClearKey, - EncryptedMediaTest, - Combine(Values(kClearKeyKeySystem), - Values(SrcType::MSE))); +INSTANTIATE_TEST_SUITE_P(MSE_ClearKey, + EncryptedMediaTest, + Combine(Values(kClearKeyKeySystem), + Values(SrcType::MSE))); // External Clear Key is currently only used on platforms that use library CDMs. #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, - EncryptedMediaTest, - Combine(Values(kExternalClearKeyKeySystem), - Values(SrcType::SRC))); +INSTANTIATE_TEST_SUITE_P(SRC_ExternalClearKey, + EncryptedMediaTest, + Combine(Values(kExternalClearKeyKeySystem), + Values(SrcType::SRC))); -INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, - EncryptedMediaTest, - Combine(Values(kExternalClearKeyKeySystem), - Values(SrcType::MSE))); +INSTANTIATE_TEST_SUITE_P(MSE_ExternalClearKey, + EncryptedMediaTest, + Combine(Values(kExternalClearKeyKeySystem), + Values(SrcType::MSE))); #else // BUILDFLAG(ENABLE_LIBRARY_CDMS) // To reduce test time, only run ClearKey SRC tests when we are not running // ExternalClearKey SRC tests. -INSTANTIATE_TEST_CASE_P(SRC_ClearKey, - EncryptedMediaTest, - Combine(Values(kClearKeyKeySystem), - Values(SrcType::SRC))); +INSTANTIATE_TEST_SUITE_P(SRC_ClearKey, + EncryptedMediaTest, + Combine(Values(kClearKeyKeySystem), + Values(SrcType::SRC))); #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(BUNDLE_WIDEVINE_CDM) -INSTANTIATE_TEST_CASE_P(MSE_Widevine, - EncryptedMediaTest, - Combine(Values(kWidevineKeySystem), - Values(SrcType::MSE))); +INSTANTIATE_TEST_SUITE_P(MSE_Widevine, + EncryptedMediaTest, + Combine(Values(kWidevineKeySystem), + Values(SrcType::MSE))); #endif // #if BUILDFLAG(BUNDLE_WIDEVINE_CDM) IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { @@ -790,9 +790,9 @@ // Test CDM_9 through CDM_11. static_assert(media::CheckSupportedCdmInterfaceVersions(9, 11), "Mismatch between implementation and test coverage"); -INSTANTIATE_TEST_CASE_P(CDM_9, ECKEncryptedMediaTest, Values(9)); -INSTANTIATE_TEST_CASE_P(CDM_10, ECKEncryptedMediaTest, Values(10)); -INSTANTIATE_TEST_CASE_P(CDM_11, ECKEncryptedMediaTest, Values(11)); +INSTANTIATE_TEST_SUITE_P(CDM_9, ECKEncryptedMediaTest, Values(9)); +INSTANTIATE_TEST_SUITE_P(CDM_10, ECKEncryptedMediaTest, Values(10)); +INSTANTIATE_TEST_SUITE_P(CDM_11, ECKEncryptedMediaTest, Values(11)); IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, InitializeCDMFail) { TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem,
diff --git a/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc b/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc index f1dc07f..81c0801d 100644 --- a/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_getdisplaymedia_browsertest.cc
@@ -179,7 +179,7 @@ EXPECT_EQ(result, base::StringPrintf("%d", kMaxFrameRate)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , WebRtcGetDisplayMediaBrowserTestWithFakeUI, testing::Values(TestConfig{"monitor", "true", "never", false},
diff --git a/chrome/browser/media/webrtc/webrtc_getmediadevices_browsertest.cc b/chrome/browser/media/webrtc/webrtc_getmediadevices_browsertest.cc index fbaf8ce..4a7eff8 100644 --- a/chrome/browser/media/webrtc/webrtc_getmediadevices_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_getmediadevices_browsertest.cc
@@ -216,10 +216,10 @@ #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) || \ defined(OS_WIN) // Supported platforms. -INSTANTIATE_TEST_CASE_P(, WebRtcGetMediaDevicesBrowserTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, WebRtcGetMediaDevicesBrowserTest, ::testing::Bool()); #else // Platforms where the out of process audio service is not supported -INSTANTIATE_TEST_CASE_P(, - WebRtcGetMediaDevicesBrowserTest, - ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcGetMediaDevicesBrowserTest, + ::testing::Values(false)); #endif
diff --git a/chrome/browser/media/webrtc/webrtc_video_display_perf_browsertest.cc b/chrome/browser/media/webrtc/webrtc_video_display_perf_browsertest.cc index 22b11c09..d6cd9e3 100644 --- a/chrome/browser/media/webrtc/webrtc_video_display_perf_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_video_display_perf_browsertest.cc
@@ -339,12 +339,13 @@ std::vector<double> total_durations_; }; -INSTANTIATE_TEST_CASE_P(WebRtcVideoDisplayPerfBrowserTests, - WebRtcVideoDisplayPerfBrowserTest, - testing::Combine(testing::Values(gfx::Size(1280, 720), - gfx::Size(1920, 1080)), - testing::Values(30, 60), - testing::Bool())); +INSTANTIATE_TEST_SUITE_P(WebRtcVideoDisplayPerfBrowserTests, + WebRtcVideoDisplayPerfBrowserTest, + testing::Combine(testing::Values(gfx::Size(1280, 720), + gfx::Size(1920, + 1080)), + testing::Values(30, 60), + testing::Bool())); IN_PROC_BROWSER_TEST_P(WebRtcVideoDisplayPerfBrowserTest, MANUAL_TestVideoDisplayPerfVP9) {
diff --git a/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc b/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc index 3262cab..2ca00c5 100644 --- a/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc
@@ -339,10 +339,9 @@ base::ScopedTempDir temp_working_dir_; }; -INSTANTIATE_TEST_CASE_P( - WebRtcVideoQualityBrowserTests, - WebRtcVideoQualityBrowserTest, - testing::ValuesIn(kVideoConfigurations)); +INSTANTIATE_TEST_SUITE_P(WebRtcVideoQualityBrowserTests, + WebRtcVideoQualityBrowserTest, + testing::ValuesIn(kVideoConfigurations)); IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, MANUAL_TestVideoQualityVp8) {
diff --git a/chrome/browser/metrics/desktop_session_duration/desktop_profile_session_durations_service_factory.h b/chrome/browser/metrics/desktop_session_duration/desktop_profile_session_durations_service_factory.h index 49c66a65..ec8fb32 100644 --- a/chrome/browser/metrics/desktop_session_duration/desktop_profile_session_durations_service_factory.h +++ b/chrome/browser/metrics/desktop_session_duration/desktop_profile_session_durations_service_factory.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_DESKTOP_PROFILE_SESSION_DURATIONS_SERVICE_FACTORY_H_ #include "base/memory/singleton.h" -#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" namespace metrics {
diff --git a/chrome/browser/metrics/ukm_browsertest.cc b/chrome/browser/metrics/ukm_browsertest.cc index c2167513..6e227af 100644 --- a/chrome/browser/metrics/ukm_browsertest.cc +++ b/chrome/browser/metrics/ukm_browsertest.cc
@@ -277,7 +277,7 @@ unified_consent::UnifiedConsentService* consent_service = UnifiedConsentServiceFactory::GetForProfile(profile); if (consent_service) - consent_service->EnableGoogleServices(); + consent_service->SetUrlKeyedAnonymizedDataCollectionEnabled(true); return harness; }
diff --git a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc index 7bcf78d..f8d31f4 100644 --- a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc +++ b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc
@@ -1201,7 +1201,7 @@ has_gesture); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, MainFrameDownloadFlagsBrowserTest, ::testing::Combine( @@ -1406,7 +1406,7 @@ has_gesture); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, SubframeDownloadFlagsBrowserTest, ::testing::Combine(
diff --git a/chrome/browser/page_load_metrics/observers/live_tab_count_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/live_tab_count_page_load_metrics_observer_unittest.cc index 5e027840..ed4f577 100644 --- a/chrome/browser/page_load_metrics/observers/live_tab_count_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/live_tab_count_page_load_metrics_observer_unittest.cc
@@ -120,10 +120,10 @@ EXPECT_EQ(bucket, live_tab_count_metrics::kNumLiveTabCountBuckets - 1); } -INSTANTIATE_TEST_CASE_P(Foreground, - LiveTabCountPageLoadMetricsObserverTest, - testing::Values(TabState::kForeground)); +INSTANTIATE_TEST_SUITE_P(Foreground, + LiveTabCountPageLoadMetricsObserverTest, + testing::Values(TabState::kForeground)); -INSTANTIATE_TEST_CASE_P(Background, - LiveTabCountPageLoadMetricsObserverTest, - testing::Values(TabState::kBackground)); +INSTANTIATE_TEST_SUITE_P(Background, + LiveTabCountPageLoadMetricsObserverTest, + testing::Values(TabState::kBackground));
diff --git a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc index c80b302..7ffa614 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -488,7 +488,7 @@ GetClient()->IsFillingFallbackEnabled(url)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , ChromePasswordManagerClientSchemeTest, ::testing::ValuesIn(ChromePasswordManagerClientSchemeTest::GetSchemes()));
diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index ccb365b..3b9ee75 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc
@@ -1119,10 +1119,11 @@ UnorderedElementsAre(Pointee(form_google_), Pointee(form_isc_))); } -INSTANTIATE_TEST_CASE_P(, - NativeBackendKWalletTest, - ::testing::Values(base::nix::DESKTOP_ENVIRONMENT_KDE4, - base::nix::DESKTOP_ENVIRONMENT_KDE5)); +INSTANTIATE_TEST_SUITE_P( + , + NativeBackendKWalletTest, + ::testing::Values(base::nix::DESKTOP_ENVIRONMENT_KDE4, + base::nix::DESKTOP_ENVIRONMENT_KDE5)); // TODO(mdm): add more basic tests here at some point. // (For example tests for storing >1 password per realm pickle.)
diff --git a/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc b/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc index d029221..4a91575 100644 --- a/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_manager_captured_sites_interactive_uitest.cc
@@ -242,8 +242,8 @@ recipe_replayer()->ReplayTest(capture_file_path, recipe_file_path)); } -INSTANTIATE_TEST_CASE_P(, - CapturedSitesPasswordManagerBrowserTest, - testing::ValuesIn(GetCapturedSites()), - GetParamAsString()); +INSTANTIATE_TEST_SUITE_P(, + CapturedSitesPasswordManagerBrowserTest, + testing::ValuesIn(GetCapturedSites()), + GetParamAsString()); } // namespace password_manager
diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc index 30e2f68..b8a74d58 100644 --- a/chrome/browser/password_manager/password_store_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
@@ -300,14 +300,14 @@ ClosePasswordStore(); } -INSTANTIATE_TEST_CASE_P(, - PasswordStoreMacTest, - testing::Values(MigrationStatus::NOT_STARTED, - MigrationStatus::MIGRATED, - MigrationStatus::FAILED_ONCE, - MigrationStatus::FAILED_TWICE, - MigrationStatus::MIGRATED_DELETED, - MigrationStatus::MIGRATED_PARTIALLY, - MigrationStatus::MIGRATION_STOPPED)); +INSTANTIATE_TEST_SUITE_P(, + PasswordStoreMacTest, + testing::Values(MigrationStatus::NOT_STARTED, + MigrationStatus::MIGRATED, + MigrationStatus::FAILED_ONCE, + MigrationStatus::FAILED_TWICE, + MigrationStatus::MIGRATED_DELETED, + MigrationStatus::MIGRATED_PARTIALLY, + MigrationStatus::MIGRATION_STOPPED)); } // namespace
diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 11c767e..92917adb 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc
@@ -422,13 +422,13 @@ namespace password_manager { -INSTANTIATE_TYPED_TEST_CASE_P(XNoBackend, - PasswordStoreOriginTest, - PasswordStoreXNoBackendTestDelegate); +INSTANTIATE_TYPED_TEST_SUITE_P(XNoBackend, + PasswordStoreOriginTest, + PasswordStoreXNoBackendTestDelegate); -INSTANTIATE_TYPED_TEST_CASE_P(XWorkingBackend, - PasswordStoreOriginTest, - PasswordStoreXWorkingBackendTestDelegate); +INSTANTIATE_TYPED_TEST_SUITE_P(XWorkingBackend, + PasswordStoreOriginTest, + PasswordStoreXWorkingBackendTestDelegate); } class PasswordStoreXTest : public testing::TestWithParam<BackendType> { @@ -898,12 +898,12 @@ LinuxBackendMigrationStatus::kLoginDBReplaced, 1); } -INSTANTIATE_TEST_CASE_P(NoBackend, - PasswordStoreXTest, - testing::Values(NO_BACKEND)); -INSTANTIATE_TEST_CASE_P(FailingBackend, - PasswordStoreXTest, - testing::Values(FAILING_BACKEND)); -INSTANTIATE_TEST_CASE_P(WorkingBackend, - PasswordStoreXTest, - testing::Values(WORKING_BACKEND)); +INSTANTIATE_TEST_SUITE_P(NoBackend, + PasswordStoreXTest, + testing::Values(NO_BACKEND)); +INSTANTIATE_TEST_SUITE_P(FailingBackend, + PasswordStoreXTest, + testing::Values(FAILING_BACKEND)); +INSTANTIATE_TEST_SUITE_P(WorkingBackend, + PasswordStoreXTest, + testing::Values(WORKING_BACKEND));
diff --git a/chrome/browser/password_manager/save_password_infobar_delegate_android_unittest.cc b/chrome/browser/password_manager/save_password_infobar_delegate_android_unittest.cc index 987ae4d3..4d46ff7 100644 --- a/chrome/browser/password_manager/save_password_infobar_delegate_android_unittest.cc +++ b/chrome/browser/password_manager/save_password_infobar_delegate_android_unittest.cc
@@ -274,7 +274,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /*no extra name*/, SavePasswordInfoBarDelegateTestForUKMs, ::testing::Values(
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc index 05ce090..f0d9a24 100644 --- a/chrome/browser/pdf/pdf_extension_test.cc +++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -620,13 +620,13 @@ } // We break PDFExtensionLoadTest up into kNumberLoadTestParts. -INSTANTIATE_TEST_CASE_P(PDFTestFiles, - PDFExtensionLoadTest, - testing::Range(0, kNumberLoadTestParts)); +INSTANTIATE_TEST_SUITE_P(PDFTestFiles, + PDFExtensionLoadTest, + testing::Range(0, kNumberLoadTestParts)); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - PDFExtensionHitTestTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + PDFExtensionHitTestTest, + testing::Bool()); IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Basic) { RunTestsInFile("basic_test.js", "test.pdf");
diff --git a/chrome/browser/permissions/permission_request_manager_browsertest.cc b/chrome/browser/permissions/permission_request_manager_browsertest.cc index cfc8c06..e6eafe5 100644 --- a/chrome/browser/permissions/permission_request_manager_browsertest.cc +++ b/chrome/browser/permissions/permission_request_manager_browsertest.cc
@@ -375,8 +375,14 @@ EXPECT_EQ(2, bubble_factory_1->show_count()); } +// Regularly timing out in Linux Debug Builds. https://crbug.com/931657 +#if defined(OS_LINUX) +#define MAYBE_BackgroundTabNavigation DISABLED_BackgroundTabNavigation +#else +#define MAYBE_BackgroundTabNavigation BackgroundTabNavigation +#endif IN_PROC_BROWSER_TEST_F(PermissionRequestManagerBrowserTest, - BackgroundTabNavigation) { + MAYBE_BackgroundTabNavigation) { ASSERT_TRUE(embedded_test_server()->Start()); ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
diff --git a/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc index 8f481f6..f056d4b 100644 --- a/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc
@@ -1084,21 +1084,19 @@ } #if defined(OS_CHROMEOS) -INSTANTIATE_TEST_CASE_P( - CloudPolicyInvalidatorUserTypedTestInstance, - CloudPolicyInvalidatorUserTypedTest, - testing::Values(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::DEVICE)); +INSTANTIATE_TEST_SUITE_P(CloudPolicyInvalidatorUserTypedTestInstance, + CloudPolicyInvalidatorUserTypedTest, + testing::Values(em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::DEVICE)); #elif defined(OS_ANDROID) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CloudPolicyInvalidatorUserTypedTestInstance, CloudPolicyInvalidatorUserTypedTest, testing::Values(em::DeviceRegisterRequest::ANDROID_BROWSER)); #else -INSTANTIATE_TEST_CASE_P( - CloudPolicyInvalidatorUserTypedTestInstance, - CloudPolicyInvalidatorUserTypedTest, - testing::Values(em::DeviceRegisterRequest::BROWSER)); +INSTANTIATE_TEST_SUITE_P(CloudPolicyInvalidatorUserTypedTestInstance, + CloudPolicyInvalidatorUserTypedTest, + testing::Values(em::DeviceRegisterRequest::BROWSER)); #endif } // namespace policy
diff --git a/chrome/browser/policy/cloud/device_management_service_browsertest.cc b/chrome/browser/policy/cloud/device_management_service_browsertest.cc index 3f8a227..ea48555 100644 --- a/chrome/browser/policy/cloud/device_management_service_browsertest.cc +++ b/chrome/browser/policy/cloud/device_management_service_browsertest.cc
@@ -265,7 +265,7 @@ run_loop.Run(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DeviceManagementServiceIntegrationTestInstance, DeviceManagementServiceIntegrationTest, testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse,
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc index c68aa2c..42c13d9b 100644 --- a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc +++ b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
@@ -60,9 +60,9 @@ namespace em = enterprise_management; +using testing::_; using testing::AnyNumber; using testing::Mock; -using testing::_; namespace policy { @@ -104,10 +104,7 @@ test_account_id_(AccountId::FromUserEmailGaiaId( kTestUser, identity::GetTestGaiaIdForEmail(kTestUser))), - register_completed_(false), - test_system_shared_loader_factory_( - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &test_url_loader_factory_)) {} + register_completed_(false) {} MOCK_METHOD1(OnPolicyRefresh, void(bool)); @@ -146,10 +143,10 @@ RegisterLocalState(local_state_->registry()); TestingBrowserProcess::GetGlobal()->SetLocalState(local_state_.get()); TestingBrowserProcess::GetGlobal()->SetSharedURLLoaderFactory( - test_system_shared_loader_factory_); + test_url_loader_factory_.GetSafeWeakWrapper()); g_browser_process->browser_policy_connector()->Init( - local_state_.get(), test_system_shared_loader_factory_); + local_state_.get(), test_url_loader_factory_.GetSafeWeakWrapper()); // Create a testing profile with cloud-policy-on-signin enabled, and bring // up a UserCloudPolicyManager with a MockUserCloudPolicyStore. @@ -180,11 +177,11 @@ // Tests are responsible for freeing the UserCloudPolicyManager instances // they inject. - manager_.reset(UserCloudPolicyManagerFactory::GetForBrowserContext( - profile_.get())); + manager_.reset( + UserCloudPolicyManagerFactory::GetForBrowserContext(profile_.get())); manager_->Init(&schema_registry_); - mock_store_ = static_cast<MockUserCloudPolicyStore*>( - manager_->core()->store()); + mock_store_ = + static_cast<MockUserCloudPolicyStore*>(manager_->core()->store()); DCHECK(mock_store_); AddProfile(); @@ -202,7 +199,6 @@ testing_browser_process->SetLocalState(NULL); local_state_.reset(); testing_browser_process->ShutdownBrowserPolicyConnector(); - test_system_shared_loader_factory_->Detach(); base::RunLoop run_loop; run_loop.RunUntilIdle(); } @@ -281,8 +277,7 @@ MockDeviceManagementJob* register_request = NULL; EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, _)) - .WillOnce(device_management_service_.CreateAsyncJob( - ®ister_request)); + .WillOnce(device_management_service_.CreateAsyncJob(®ister_request)); EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) .Times(1); @@ -320,7 +315,7 @@ signin_service->FetchPolicyForSignedInUser( test_account_id_, dm_token_, client_id_, - test_system_shared_loader_factory_, + test_url_loader_factory_.GetSafeWeakWrapper(), base::Bind(&UserPolicySigninServiceTest::OnPolicyRefresh, base::Unretained(this))); @@ -342,8 +337,8 @@ policy_data.set_policy_type(dm_protocol::kChromeUserPolicyType); em::PolicyFetchResponse* policy_response = policy_blob.mutable_policy_response()->add_response(); - ASSERT_TRUE(policy_data.SerializeToString( - policy_response->mutable_policy_data())); + ASSERT_TRUE( + policy_data.SerializeToString(policy_response->mutable_policy_data())); fetch_request->SendResponse(DM_STATUS_SUCCESS, policy_blob); // Complete the store which should cause the policy fetch callback to be @@ -385,8 +380,6 @@ std::unique_ptr<TestingPrefServiceSimple> local_state_; network::TestURLLoaderFactory test_url_loader_factory_; - scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> - test_system_shared_loader_factory_; }; class UserPolicySigninServiceSignedInTest : public UserPolicySigninServiceTest { @@ -753,7 +746,7 @@ UserPolicySigninServiceFactory::GetForProfile(profile_.get()); signin_service->FetchPolicyForSignedInUser( test_account_id_, "mock_dm_token", "mock_client_id", - test_system_shared_loader_factory_, + test_url_loader_factory_.GetSafeWeakWrapper(), base::Bind(&UserPolicySigninServiceTest::OnPolicyRefresh, base::Unretained(this))); ASSERT_TRUE(fetch_request);
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 3e26405..9686b45 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -1215,9 +1215,9 @@ DISALLOW_COPY_AND_ASSIGN(SSLPolicyTestCommittedInterstitials); }; -INSTANTIATE_TEST_CASE_P(, - SSLPolicyTestCommittedInterstitials, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(, + SSLPolicyTestCommittedInterstitials, + ::testing::Values(false, true)); #if defined(OS_WIN) // This policy only exists on Windows. @@ -4149,12 +4149,13 @@ } #undef MAYBE_RunTest -INSTANTIATE_TEST_CASE_P(RestoreOnStartupPolicyTestInstance, - RestoreOnStartupPolicyTest, - testing::Values(&RestoreOnStartupPolicyTest::ListOfURLs, - &RestoreOnStartupPolicyTest::NTP, - &RestoreOnStartupPolicyTest::Last, - &RestoreOnStartupPolicyTest::Blocked)); +INSTANTIATE_TEST_SUITE_P( + RestoreOnStartupPolicyTestInstance, + RestoreOnStartupPolicyTest, + testing::Values(&RestoreOnStartupPolicyTest::ListOfURLs, + &RestoreOnStartupPolicyTest::NTP, + &RestoreOnStartupPolicyTest::Last, + &RestoreOnStartupPolicyTest::Blocked)); // Similar to PolicyTest but sets a couple of policies before the browser is // started. @@ -4543,9 +4544,9 @@ } } -INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, - MediaStreamDevicesControllerBrowserTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(MediaStreamDevicesControllerBrowserTestInstance, + MediaStreamDevicesControllerBrowserTest, + testing::Bool()); class WebBluetoothPolicyTest : public PolicyTest { void SetUpCommandLine(base::CommandLine* command_line)override { @@ -5253,9 +5254,9 @@ EXPECT_EQ(is_enabled(), media_router::GetCastAllowAllIPsPref(pref)); } -INSTANTIATE_TEST_CASE_P(MediaRouterCastAllowAllIPsPolicyTestInstance, - MediaRouterCastAllowAllIPsPolicyTest, - testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(MediaRouterCastAllowAllIPsPolicyTestInstance, + MediaRouterCastAllowAllIPsPolicyTest, + testing::Values(true, false)); #endif // !defined(OS_ANDROID) // Sets the proper policy before the browser is started. @@ -6011,9 +6012,9 @@ EXPECT_EQ(1u, num_requests()); } -INSTANTIATE_TEST_CASE_P(, - NetworkTimePolicyTest, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(, + NetworkTimePolicyTest, + ::testing::Values(false, true)); #if defined(OS_CHROMEOS) @@ -6675,11 +6676,11 @@ } #undef MAYBE_RunTest -INSTANTIATE_TEST_CASE_P(, - PromotionalTabsEnabledPolicyTest, - ::testing::Values(BooleanPolicy::kNotConfigured, - BooleanPolicy::kFalse, - BooleanPolicy::kTrue)); +INSTANTIATE_TEST_SUITE_P(, + PromotionalTabsEnabledPolicyTest, + ::testing::Values(BooleanPolicy::kNotConfigured, + BooleanPolicy::kFalse, + BooleanPolicy::kTrue)); #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) @@ -6778,11 +6779,11 @@ } } -INSTANTIATE_TEST_CASE_P(, - WebRtcEventLogCollectionAllowedPolicyTest, - ::testing::Values(BooleanPolicy::kNotConfigured, - BooleanPolicy::kFalse, - BooleanPolicy::kTrue)); +INSTANTIATE_TEST_SUITE_P(, + WebRtcEventLogCollectionAllowedPolicyTest, + ::testing::Values(BooleanPolicy::kNotConfigured, + BooleanPolicy::kFalse, + BooleanPolicy::kTrue)); #endif // !defined(OS_ANDROID) } // namespace policy
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index eceb7d5..fad6a6b 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/accessibility/invert_bubble_prefs.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/chrome_content_browser_client.h" +#include "chrome/browser/chromeos/scheduler_configuration_manager.h" #include "chrome/browser/component_updater/component_updater_prefs.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "chrome/browser/devtools/devtools_window.h" @@ -516,6 +517,7 @@ chromeos::Preferences::RegisterPrefs(registry); chromeos::ResetScreen::RegisterPrefs(registry); chromeos::ResourceReporter::RegisterPrefs(registry); + chromeos::SchedulerConfigurationManager::RegisterLocalStatePrefs(registry); chromeos::ServicesCustomizationDocument::RegisterPrefs(registry); chromeos::SigninScreenHandler::RegisterPrefs(registry); chromeos::StartupUtils::RegisterPrefs(registry);
diff --git a/chrome/browser/printing/cloud_print/privet_http_unittest.cc b/chrome/browser/printing/cloud_print/privet_http_unittest.cc index 0d99892..6dfa08e 100644 --- a/chrome/browser/printing/cloud_print/privet_http_unittest.cc +++ b/chrome/browser/printing/cloud_print/privet_http_unittest.cc
@@ -427,7 +427,7 @@ StrictMock<MockJSONCallback> info_callback_; }; -INSTANTIATE_TEST_CASE_P(PrivetTests, PrivetInfoTest, ValuesIn(kTestParams)); +INSTANTIATE_TEST_SUITE_P(PrivetTests, PrivetInfoTest, ValuesIn(kTestParams)); TEST_P(PrivetInfoTest, SuccessfulInfo) { info_operation_->Start(); @@ -461,7 +461,9 @@ PrivetURLLoader::RetryImmediatelyForTest retry_immediately_; }; -INSTANTIATE_TEST_CASE_P(PrivetTests, PrivetRegisterTest, ValuesIn(kTestParams)); +INSTANTIATE_TEST_SUITE_P(PrivetTests, + PrivetRegisterTest, + ValuesIn(kTestParams)); TEST_P(PrivetRegisterTest, RegisterSuccessSimple) { register_operation_->Start(); @@ -577,9 +579,9 @@ StrictMock<MockJSONCallback> capabilities_callback_; }; -INSTANTIATE_TEST_CASE_P(PrivetTests, - PrivetCapabilitiesTest, - ValuesIn(kTestParams)); +INSTANTIATE_TEST_SUITE_P(PrivetTests, + PrivetCapabilitiesTest, + ValuesIn(kTestParams)); TEST_P(PrivetCapabilitiesTest, SuccessfulCapabilities) { capabilities_operation_->Start(); @@ -695,9 +697,9 @@ run_tasks_immediately_for_local_print_; }; -INSTANTIATE_TEST_CASE_P(PrivetTests, - PrivetLocalPrintTest, - ValuesIn(kTestParams)); +INSTANTIATE_TEST_SUITE_P(PrivetTests, + PrivetLocalPrintTest, + ValuesIn(kTestParams)); TEST_P(PrivetLocalPrintTest, SuccessfulLocalPrint) { local_print_operation_->SetUsername("sample@gmail.com");
diff --git a/chrome/browser/printing/pwg_raster_converter.cc b/chrome/browser/printing/pwg_raster_converter.cc index 3e86443..c140bf4e 100644 --- a/chrome/browser/printing/pwg_raster_converter.cc +++ b/chrome/browser/printing/pwg_raster_converter.cc
@@ -203,7 +203,7 @@ const cloud_devices::CloudDeviceDescription& ticket) { cloud_devices::printer::DuplexTicketItem duplex_item; cloud_devices::printer::DuplexType duplex_value = - cloud_devices::printer::NO_DUPLEX; + cloud_devices::printer::DuplexType::NO_DUPLEX; if (duplex_item.LoadFrom(ticket)) duplex_value = duplex_item.value(); @@ -220,14 +220,14 @@ DCHECK(color_value.IsValid()); bool use_color; switch (color_value.type) { - case cloud_devices::printer::STANDARD_MONOCHROME: - case cloud_devices::printer::CUSTOM_MONOCHROME: + case cloud_devices::printer::ColorType::STANDARD_MONOCHROME: + case cloud_devices::printer::ColorType::CUSTOM_MONOCHROME: use_color = false; break; - case cloud_devices::printer::STANDARD_COLOR: - case cloud_devices::printer::CUSTOM_COLOR: - case cloud_devices::printer::AUTO_COLOR: + case cloud_devices::printer::ColorType::STANDARD_COLOR: + case cloud_devices::printer::ColorType::CUSTOM_COLOR: + case cloud_devices::printer::ColorType::AUTO_COLOR: use_color = true; break; @@ -246,23 +246,28 @@ PwgRasterSettings result; switch (duplex_value) { - case cloud_devices::printer::NO_DUPLEX: + case cloud_devices::printer::DuplexType::NO_DUPLEX: result.duplex_mode = DuplexMode::SIMPLEX; result.odd_page_transform = TRANSFORM_NORMAL; break; - case cloud_devices::printer::LONG_EDGE: - result.duplex_mode = DuplexMode::LONG_EDGE; - if (document_sheet_back == cloud_devices::printer::ROTATED) + case cloud_devices::printer::DuplexType::LONG_EDGE: + if (document_sheet_back == + cloud_devices::printer::DocumentSheetBack::ROTATED) { result.odd_page_transform = TRANSFORM_ROTATE_180; - else if (document_sheet_back == cloud_devices::printer::FLIPPED) + } else if (document_sheet_back == + cloud_devices::printer::DocumentSheetBack::FLIPPED) { result.odd_page_transform = TRANSFORM_FLIP_VERTICAL; + } break; - case cloud_devices::printer::SHORT_EDGE: + case cloud_devices::printer::DuplexType::SHORT_EDGE: result.duplex_mode = DuplexMode::SHORT_EDGE; - if (document_sheet_back == cloud_devices::printer::MANUAL_TUMBLE) + if (document_sheet_back == + cloud_devices::printer::DocumentSheetBack::MANUAL_TUMBLE) { result.odd_page_transform = TRANSFORM_ROTATE_180; - else if (document_sheet_back == cloud_devices::printer::FLIPPED) + } else if (document_sheet_back == + cloud_devices::printer::DocumentSheetBack::FLIPPED) { result.odd_page_transform = TRANSFORM_FLIP_HORIZONTAL; + } break; } @@ -274,7 +279,9 @@ // conversion from RGB to grayscale... " const auto& types = raster_capability.value().document_types_supported; result.use_color = - use_color || !base::ContainsValue(types, cloud_devices::printer::SGRAY_8); + use_color || + !base::ContainsValue( + types, cloud_devices::printer::PwgDocumentTypeSupported::SGRAY_8); return result; }
diff --git a/chrome/browser/profiles/host_zoom_map_browsertest.cc b/chrome/browser/profiles/host_zoom_map_browsertest.cc index babc2efe..6b64f54 100644 --- a/chrome/browser/profiles/host_zoom_map_browsertest.cc +++ b/chrome/browser/profiles/host_zoom_map_browsertest.cc
@@ -130,13 +130,6 @@ return results; } - std::string GetSigninPromoURL() { - return signin::GetEmbeddedPromoURL( - signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE, - signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, false) - .spec(); - } - GURL ConstructTestServerURL(const char* url_template) { return GURL(base::StringPrintf( url_template, embedded_test_server()->port())); @@ -251,10 +244,14 @@ test_scheme, test_host)); } +#if !defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F( HostZoomMapBrowserTest, WebviewBasedSigninUsesDefaultStoragePartitionForEmbedder) { - GURL test_url = ConstructTestServerURL(GetSigninPromoURL().c_str()); + GURL signin_url = signin::GetEmbeddedPromoURL( + signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE, + signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, false); + GURL test_url = ConstructTestServerURL(signin_url.spec().c_str()); std::string test_host(test_url.host()); std::string test_scheme(test_url.scheme()); ui_test_utils::NavigateToURL(browser(), test_url); @@ -270,6 +267,7 @@ HostZoomMap::GetDefaultForBrowserContext(browser()->profile()); EXPECT_EQ(host_zoom_map, default_profile_host_zoom_map); } +#endif // Regression test for crbug.com/364399. IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) {
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc index 1948d37..8c6256e 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
@@ -697,7 +697,7 @@ "MailToEscapedUnicodeCharacters"}, }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , FormatUrlForClipboardTest, testing::ValuesIn(kFormatUrlForClipboardTestData),
diff --git a/chrome/browser/resources/chromeos/BUILD.gn b/chrome/browser/resources/chromeos/BUILD.gn index a1ce079..e8d171e8 100644 --- a/chrome/browser/resources/chromeos/BUILD.gn +++ b/chrome/browser/resources/chromeos/BUILD.gn
@@ -25,6 +25,7 @@ deps = [ "bluetooth_pairing_dialog:closure_compile", "braille_ime:closure_compile", + "contained_home:closure_compile", "internet_config_dialog:closure_compile", "internet_detail_dialog:closure_compile", "login:closure_compile",
diff --git a/chrome/browser/resources/chromeos/camera/Makefile b/chrome/browser/resources/chromeos/camera/Makefile index 66061773..8e511a7 100644 --- a/chrome/browser/resources/chromeos/camera/Makefile +++ b/chrome/browser/resources/chromeos/camera/Makefile
@@ -126,6 +126,7 @@ src/js/views/camera/options.js \ src/js/views/camera/preview.js \ src/js/views/camera/recordtime.js \ + src/js/views/camera/timertick.js \ src/js/views/dialog.js \ src/js/views/gallery_base.js \ src/js/views/settings.js \
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera.js index 114c9732..9b4a3cd 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera.js
@@ -105,13 +105,6 @@ this.started_ = null; /** - * Promise for the current timer ticks. - * @type {Promise} - * @private - */ - this.ticks_ = null; - - /** * Timeout for a take of photo or recording. * @type {?number} * @private @@ -208,7 +201,7 @@ if (this.recordMode) { label = this.taking ? 'record_video_stop_button' : 'record_video_start_button'; } else { - label = (this.taking && this.ticks_) ? + label = (this.taking && document.body.classList.contains('timer')) ? 'take_photo_cancel_button' : 'take_photo_button'; } this.shutterButton_.setAttribute('aria-label', chrome.i18n.getMessage(label)); @@ -238,10 +231,9 @@ */ cca.views.Camera.prototype.beginTake_ = function() { document.body.classList.add('taking'); - this.ticks_ = this.options_.timerTicks(); this.updateShutterLabel_(); - Promise.resolve(this.ticks_).then(() => { + cca.views.camera.timertick.start().then(() => { // Play a sound before starting to record and delay the take to avoid the // sound being recorded if necessary. var delay = @@ -270,10 +262,7 @@ * @private */ cca.views.Camera.prototype.endTake_ = function() { - if (this.ticks_) { - this.ticks_.cancel(); - this.ticks_ = null; - } + cca.views.camera.timertick.cancel(); if (this.takeTimeout_) { clearTimeout(this.takeTimeout_); this.takeTimeout_ = null;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js index 37faac8..fc6c8bd2 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js
@@ -166,47 +166,6 @@ }; /** - * Schedules ticks by the timer option if any. - * @return {?Promise} Promise for the operation. - * TODO(yuli): Move this function into timerticks.js. - */ -cca.views.camera.Options.prototype.timerTicks = function() { - if (!document.body.classList.contains('timer')) { - return null; - } - var cancel; - var tickTimeout = null; - var tickMsg = document.querySelector('#timer-tick-msg'); - var ticks = new Promise((resolve, reject) => { - var tickCounter = document.body.classList.contains('_10sec') ? 10 : 3; - var onTimerTick = () => { - if (tickCounter == 0) { - resolve(); - } else { - cca.sound.play('#sound-tick'); - tickMsg.textContent = tickCounter + ''; - cca.util.animateOnce(tickMsg); - tickTimeout = setTimeout(onTimerTick, 1000); - tickCounter--; - } - }; - // First tick immediately in the next message loop cycle. - tickTimeout = setTimeout(onTimerTick, 0); - cancel = reject; - }); - - ticks.cancel = () => { - if (tickTimeout) { - clearTimeout(tickTimeout); - tickTimeout = null; - } - cca.util.animateCancel(tickMsg); - cancel(); - }; - return ticks; -}; - -/** * Updates the options' values for the current constraints and stream. * @param {Object} constraints Current stream constraints in use. * @param {MediaStream} stream Current Stream in use.
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js new file mode 100644 index 0000000..250d0e9 --- /dev/null +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js
@@ -0,0 +1,79 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +/** + * Namespace for the Camera app. + */ +var cca = cca || {}; + +/** + * Namespace for views. + */ +cca.views = cca.views || {}; +/** + * Namespace for camera view. + */ +cca.views.camera = cca.views.camera || {}; + +/** + * Namespace for timertick. + */ +cca.views.camera.timertick = cca.views.camera.timertick || {}; + +/** + * Handler to cancel the active running timer-ticks. + * @type {function()} + * @private + */ +cca.views.camera.timertick.cancel_ = null; + +/** + * Starts timer ticking if applicable. + * @return {!Promise} Promise for the operation. + */ +cca.views.camera.timertick.start = function() { + cca.views.camera.timertick.cancel_ = null; + if (!document.body.classList.contains('timer')) { + return Promise.resolve(); + } + return new Promise((resolve, reject) => { + var tickTimeout = null; + var tickMsg = document.querySelector('#timer-tick-msg'); + cca.views.camera.timertick.cancel_ = () => { + if (tickTimeout) { + clearTimeout(tickTimeout); + tickTimeout = null; + } + cca.util.animateCancel(tickMsg); + reject(); + }; + + var tickCounter = document.body.classList.contains('_10sec') ? 10 : 3; + var onTimerTick = () => { + if (tickCounter == 0) { + resolve(); + } else { + cca.sound.play('#sound-tick'); + tickMsg.textContent = tickCounter + ''; + cca.util.animateOnce(tickMsg); + tickTimeout = setTimeout(onTimerTick, 1000); + tickCounter--; + } + }; + // First tick immediately in the next message loop cycle. + tickTimeout = setTimeout(onTimerTick, 0); + }); +}; + +/** + * Cancels active timer ticking if applicable. + */ +cca.views.camera.timertick.cancel = function() { + if (cca.views.camera.timertick.cancel_) { + cca.views.camera.timertick.cancel_(); + cca.views.camera.timertick.cancel_ = null; + } +};
diff --git a/chrome/browser/resources/chromeos/camera/src/views/main.html b/chrome/browser/resources/chromeos/camera/src/views/main.html index 75c5fa9..c32e9dee 100644 --- a/chrome/browser/resources/chromeos/camera/src/views/main.html +++ b/chrome/browser/resources/chromeos/camera/src/views/main.html
@@ -24,6 +24,7 @@ <script src="../js/views/camera/options.js"></script> <script src="../js/views/camera/preview.js"></script> <script src="../js/views/camera/recordtime.js"></script> + <script src="../js/views/camera/timertick.js"></script> <script src="../js/views/dialog.js"></script> <script src="../js/views/browser.js"></script> <script src="../js/views/settings.js"></script>
diff --git a/chrome/browser/resources/chromeos/contained_home/BUILD.gn b/chrome/browser/resources/chromeos/contained_home/BUILD.gn new file mode 100644 index 0000000..88a33a4 --- /dev/null +++ b/chrome/browser/resources/chromeos/contained_home/BUILD.gn
@@ -0,0 +1,22 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ + ":contained_home_api", + ] +} + +js_library("contained_home_api") { + sources = [ + "api.js", + "api_impl.js", + ] + externs_list = [ + "$externs_path/arc_apps_private.js", + "$externs_path/chrome_extensions.js", + ] +}
diff --git a/chrome/browser/resources/chromeos/contained_home/api.js b/chrome/browser/resources/chromeos/contained_home/api.js new file mode 100644 index 0000000..a3592f5 --- /dev/null +++ b/chrome/browser/resources/chromeos/contained_home/api.js
@@ -0,0 +1,123 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview Chrome OS Contained Home API definition. + */ + +/** + * Namespace for the contained home bridge and related data. + * @const + */ +var containedHome = {}; + +/** + * System bridge API for the contained home experience. + * + * @interface + */ +containedHome.Bridge = class { + /** + * Adds listener for system events. + * @param {!containedHome.Listener} listener Listener for system events. + */ + addListener(listener) {} + + /** + * Returns an access token with scope for the contained home experience. + * @return {!Promise<string>} Promise for the access token. + */ + getAccessToken() {} + + /** + * Returns a list of apps installed in the user session. + * @return {!Promise<!Array<!containedHome.InstalledApp>>} Promise for the + * list of apps. + */ + getInstalledApps() {} + + /** + * Launches a content (app, video, etc). + * @param {!containedHome.ContentSource} contentSource + * @param {string} contentId + * @param {?Object=} opt_params Optional params to locate the content. + * @return {!Promise<boolean>} Promise that is resolved after the content is + * launched. + */ + launchContent(contentSource, contentId, opt_params) {} +}; + +/** + * Set of known / handled content sources. + * + * A "Content Source" describes how to launch/view the content. + * @enum {string} + */ +containedHome.ContentSource = { + /** The content is, or is hosted inside, an ARC++ app. */ + ARC_INTENT: 'arc_intent', +}; + +/** + * Types of installed apps on ChromeOS. + * @enum {string} + */ +containedHome.AppType = { + /** The app is an ARC++ app (Android app). */ + ARC: 'arc', +}; + +/** + * A record representing an installed app on the system. + * @record + */ +containedHome.InstalledApp = class { + constructor() { + /** @type {!containedHome.AppType} The type of app. */ + this.appType; + /** + * @type {string} Stable, unique identifier for the app. For ARC++ apps, + * this is the package name. + */ + this.appId; + /** @type {string} Readable name to display. */ + this.displayName; + /** @type {string | undefined} Base64-encoded thumbnail image, fallback. */ + this.thumbnailImage; + /** @type {boolean | undefined} Whether the app is suspended. */ + this.suspended; + } +}; + +/** + * Different ways an installed app can change. + * @enum {string} + */ +containedHome.AppEventType = { + INSTALLED: 'installed', + UNINSTALLED: 'uninstalled', +}; + +/** + * Interface for a listener of system events, subscribed via + * {!containedHome.Bridge}. + * + * @interface + */ +containedHome.Listener = class { + /** + * Called when an app state change. + * @param {!containedHome.InstalledApp} app The app whose state changed. + * @param {!containedHome.AppEventType} appEventType Type of the event + * indicating what changed for the app. + */ + onInstalledAppChanged(app, appEventType) {} +}; + +/** + * Provides bridge implementation. + * @return {!containedHome.Bridge} Bridge instance that can be used to interact + * with ChromeOS. + */ +containedHome.getChromeOsBridge = function() {};
diff --git a/chrome/browser/resources/chromeos/contained_home/api_impl.js b/chrome/browser/resources/chromeos/contained_home/api_impl.js new file mode 100644 index 0000000..55cecde4 --- /dev/null +++ b/chrome/browser/resources/chromeos/contained_home/api_impl.js
@@ -0,0 +1,84 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview ContainedHome implementation. + */ + +/** @implements {containedHome.Bridge} */ +class ContainedHomeBridge { + constructor() { + /** @type {!Array<!containedHome.Listener>} */ + this.listeners = []; + + chrome.arcAppsPrivate.onInstalled.addListener(installedApp => { + const app = { + appType: containedHome.AppType.ARC, + appId: installedApp.packageName, + displayName: installedApp.packageName, + suspended: false, + thumbnailImage: '', + }; + for (const listener of this.listeners) { + listener.onInstalledAppChanged( + app, containedHome.AppEventType.INSTALLED); + } + }); + } + + /** @override */ + addListener(listener) { + this.listeners.push(listener); + } + + /** @override */ + getAccessToken() { + return new Promise((resolve, reject) => { + chrome.identity.getAuthToken({'scopes': []}, token => { + if (token) { + resolve(token); + } else { + reject('Unable to get access token.'); + } + }); + }); + } + + /** @override */ + getInstalledApps() { + return new Promise((resolve, reject) => { + chrome.arcAppsPrivate.getLaunchableApps(launchableApps => { + const installedApps = []; + for (const launchableApp of launchableApps) { + installedApps.push({ + appType: containedHome.AppType.ARC, + appId: launchableApp.packageName, + displayName: launchableApp.packageName, + suspended: false, + thumbnailImage: '', + }); + } + resolve(installedApps); + }); + }); + } + + /** @override */ + launchContent(contentSource, contentId, opt_params) { + if (contentSource === containedHome.ContentSource.ARC_INTENT) { + // TODO(brunoad): create and migrate to a more generic API. + chrome.arcAppsPrivate.launchApp(contentId); + } + return Promise.resolve(true); + } +} + +/** + * Provides bridge implementation. + * @return {!containedHome.Bridge} Bridge instance that can be used to interact + * with ChromeOS. + */ +containedHome.getChromeOsBridge = function() { + return new ContainedHomeBridge(); +};
diff --git a/chrome/browser/resources/chromeos/contained_home/contained_home_resources.grdp b/chrome/browser/resources/chromeos/contained_home/contained_home_resources.grdp new file mode 100644 index 0000000..433244f --- /dev/null +++ b/chrome/browser/resources/chromeos/contained_home/contained_home_resources.grdp
@@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<grit-part> + <include name="IDR_CONTAINED_HOME_BG_JS" file="chromeos/contained_home/bg.js" type="BINDATA" /> + <include name="IDR_CONTAINED_HOME_ICON_192" file="chromeos/contained_home/static/icon192.png" type="BINDATA" /> + <include name="IDR_CONTAINED_HOME_MAIN_HTML" file="chromeos/contained_home/main.html" type="chrome_html" /> + <include name="IDR_CONTAINED_HOME_API_JS" file="chromeos/contained_home/api.js" type="BINDATA" /> + <include name="IDR_CONTAINED_HOME_API_IMPL_JS" file="chromeos/contained_home/api_impl.js" type="BINDATA" /> +</grit-part>
diff --git a/chrome/browser/resources/chromeos/contained_home/contained_home_resources_internal.grdp b/chrome/browser/resources/chromeos/contained_home/contained_home_resources_internal.grdp new file mode 100644 index 0000000..5656207d --- /dev/null +++ b/chrome/browser/resources/chromeos/contained_home/contained_home_resources_internal.grdp
@@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- TODO(brunoad): This list will be populated from src-internal --> +<grit-part />
diff --git a/chrome/browser/resources/chromeos/contained_home/manifest.json b/chrome/browser/resources/chromeos/contained_home/manifest.json index 03c1d26..bafcc4f 100644 --- a/chrome/browser/resources/chromeos/contained_home/manifest.json +++ b/chrome/browser/resources/chromeos/contained_home/manifest.json
@@ -6,11 +6,17 @@ "manifest_version": 2, "description": "Contained Home", "icons": { - "192": "images/icon192.png" + "192": "static/icon192.png" }, + "permissions": [ + "arcAppsPrivate", + "https://*.googleapis.com", + "identity" + ], "app": { "background": { "scripts": ["bg.js"] - } + }, + "content_security_policy": "script-src 'self'; object-src 'self'; img-src 'self' data: https://lh3.googleusercontent.com" } }
diff --git a/chrome/browser/resources/chromeos/contained_home/images/icon192.png b/chrome/browser/resources/chromeos/contained_home/static/icon192.png similarity index 100% rename from chrome/browser/resources/chromeos/contained_home/images/icon192.png rename to chrome/browser/resources/chromeos/contained_home/static/icon192.png Binary files differ
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd index 7790ea7..b6054b8 100644 --- a/chrome/browser/resources/component_extension_resources.grd +++ b/chrome/browser/resources/component_extension_resources.grd
@@ -91,9 +91,8 @@ <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_JS" file="chromeos/arc_support/recommend_app_list_view.js" type="BINDATA" /> <include name="IDR_ARC_SUPPORT_RECOMMEND_APP_LIST_VIEW_HTML" file="chromeos/arc_support/recommend_app_list_view.html" type="chrome_html" flattenhtml="true" /> <if expr="_google_chrome"> - <include name="IDR_CONTAINED_HOME_BG_JS" file="chromeos/contained_home/bg.js" type="BINDATA" /> - <include name="IDR_CONTAINED_HOME_ICON_192" file="chromeos/contained_home/images/icon192.png" type="BINDATA" /> - <include name="IDR_CONTAINED_HOME_MAIN_HTML" file="chromeos/contained_home/main.html" type="chrome_html" /> + <part file="chromeos/contained_home/contained_home_resources.grdp" /> + <part file="chromeos/contained_home/contained_home_resources_internal.grdp" /> </if> </if> <if expr="enable_plugins">
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index 780c478..0c79689 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -106,6 +106,7 @@ deps += [ "android_apps_page:closure_compile", "bluetooth_page:closure_compile", + "contained_shell_page:closure_compile", "crostini_page:closure_compile", "date_time_page:closure_compile", "device_page:closure_compile",
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.html b/chrome/browser/resources/settings/basic_page/basic_page.html index 65d9633a..d5f36114 100644 --- a/chrome/browser/resources/settings/basic_page/basic_page.html +++ b/chrome/browser/resources/settings/basic_page/basic_page.html
@@ -19,6 +19,7 @@ <link rel="import" href="../android_apps_page/android_apps_browser_proxy.html"> <link rel="import" href="../android_apps_page/android_apps_page.html"> <link rel="import" href="../bluetooth_page/bluetooth_page.html"> +<link rel="import" href="../contained_shell_page/contained_shell_page.html"> <link rel="import" href="../crostini_page/crostini_page.html"> <link rel="import" href="../device_page/device_page.html"> <link rel="import" href="../internet_page/internet_page.html"> @@ -196,6 +197,14 @@ </settings-android-apps-page> </settings-section> </template> + <template is="dom-if" if="[[showContainedShell]]" restamp> + <settings-section + page-title="$i18n{containedShellPageTitle}" + section="contained-shell"> + <settings-contained-shell-page> + </settings-contained-shell-page> + </settings-section> + </template> <template is="dom-if" if="[[showCrostini]]" restamp> <settings-section page-title="$i18n{crostiniPageTitle}" section="crostini">
diff --git a/chrome/browser/resources/settings/contained_shell_page/BUILD.gn b/chrome/browser/resources/settings/contained_shell_page/BUILD.gn new file mode 100644 index 0000000..9f44635c --- /dev/null +++ b/chrome/browser/resources/settings/contained_shell_page/BUILD.gn
@@ -0,0 +1,15 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + deps = [ + ":contained_shell_page", + ] +} + +js_library("contained_shell_page") { + deps = [] +}
diff --git a/chrome/browser/resources/settings/contained_shell_page/contained_shell_page.html b/chrome/browser/resources/settings/contained_shell_page/contained_shell_page.html new file mode 100644 index 0000000..4ae4a6df --- /dev/null +++ b/chrome/browser/resources/settings/contained_shell_page/contained_shell_page.html
@@ -0,0 +1,26 @@ +<link rel="import" href="chrome://resources/html/polymer.html"> + +<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> +<link rel="import" href="../i18n_setup.html"> +<link rel="import" href="../settings_shared_css.html"> + +<dom-module id="settings-contained-shell-page"> + <template> + <style include="settings-shared"></style> + <div id="contained-shell" class="settings-box two-line first"> + <div class="start"> + $i18n{containedShellPageLabel} + <div class="secondary" id="secondaryText"> + $i18n{containedShellPageSubtext} + </div> + </div> + <div class="separator"></div> + <paper-button id="enable" + aria-label="$i18n{containedShellTurnOn}" + aria-describedby="secondaryText"> + $i18n{containedShellTurnOn} + </paper-button> + </div> + </template> + <script src="contained_shell_page.js"></script> +</dom-module>
diff --git a/chrome/browser/resources/settings/contained_shell_page/contained_shell_page.js b/chrome/browser/resources/settings/contained_shell_page/contained_shell_page.js new file mode 100644 index 0000000..2fc1a371 --- /dev/null +++ b/chrome/browser/resources/settings/contained_shell_page/contained_shell_page.js
@@ -0,0 +1,13 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview + * 'settings-contained-shell-page' is the settings page for enabling the + * Contained Shell. + * TODO(ltenorio): Implement the Contained Shell toggle here when the pref is + * submitted. + */ + +Polymer({is: 'settings-contained-shell-page'});
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.html b/chrome/browser/resources/settings/settings_main/settings_main.html index 2811210..2c0066a 100644 --- a/chrome/browser/resources/settings/settings_main/settings_main.html +++ b/chrome/browser/resources/settings/settings_main/settings_main.html
@@ -64,6 +64,7 @@ <settings-basic-page prefs="{{prefs}}" page-visibility="[[pageVisibility]]" show-android-apps="[[showAndroidApps]]" + show-contained-shell="[[showContainedShell]]" show-crostini="[[showCrostini]]" have-play-store-app="[[havePlayStoreApp]]" on-showing-section="onShowingSection_"
diff --git a/chrome/browser/resources/settings/settings_resources.grd b/chrome/browser/resources/settings/settings_resources.grd index 10b23d2..8699bbb 100644 --- a/chrome/browser/resources/settings/settings_resources.grd +++ b/chrome/browser/resources/settings/settings_resources.grd
@@ -1259,6 +1259,12 @@ type="chrome_html" preprocess="true" allowexternalscript="true" /> + <structure name="IDR_SETTINGS_CONTAINED_SHELL_PAGE_HTML" + file="contained_shell_page/contained_shell_page.html" + type="chrome_html" /> + <structure name="IDR_SETTINGS_CONTAINED_SHELL_PAGE_JS" + file="contained_shell_page/contained_shell_page.js" + type="chrome_html" /> <structure name="IDR_SETTINGS_BLUETOOTH_DEVICE_LIST_ITEM_HTML" file="bluetooth_page/bluetooth_device_list_item.html" type="chrome_html" />
diff --git a/chrome/browser/resources/settings/settings_ui/settings_ui.html b/chrome/browser/resources/settings/settings_ui/settings_ui.html index dad18a07..00f4b74 100644 --- a/chrome/browser/resources/settings/settings_ui/settings_ui.html +++ b/chrome/browser/resources/settings/settings_ui/settings_ui.html
@@ -84,6 +84,7 @@ toolbar-spinner-active="{{toolbarSpinnerActive_}}" page-visibility="[[pageVisibility_]]" show-android-apps="[[showAndroidApps_]]" + show-contained-shell="[[showContainedShell_]]" show-crostini="[[showCrostini_]]" show-multidevice="[[showMultidevice_]]" have-play-store-app="[[havePlayStoreApp_]]"
diff --git a/chrome/browser/resources/settings/settings_ui/settings_ui.js b/chrome/browser/resources/settings/settings_ui/settings_ui.js index 1280113..dba894a7 100644 --- a/chrome/browser/resources/settings/settings_ui/settings_ui.js +++ b/chrome/browser/resources/settings/settings_ui/settings_ui.js
@@ -54,6 +54,9 @@ showAndroidApps_: Boolean, /** @private */ + showContainedShell_: Boolean, + + /** @private */ showCrostini_: Boolean, /** @private */ @@ -136,6 +139,8 @@ this.showAndroidApps_ = loadTimeData.valueExists('androidAppsVisible') && loadTimeData.getBoolean('androidAppsVisible'); + this.showContainedShell_ = loadTimeData.valueExists('showContainedShell') && + loadTimeData.getBoolean('showContainedShell'); this.showCrostini_ = loadTimeData.valueExists('showCrostini') && loadTimeData.getBoolean('showCrostini'); this.havePlayStoreApp_ = loadTimeData.valueExists('havePlayStoreApp') &&
diff --git a/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc index 52ab6d0..ec8ef04 100644 --- a/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc
@@ -381,7 +381,7 @@ ShutdownDownloadManager(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DownloadMetadataManager, GetDetailsTest, testing::Combine( @@ -520,7 +520,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DownloadMetadataManager, SetRequestTest, testing::Combine(testing::Values("absent", "this", "other", "unknown"),
diff --git a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc index 8028da8..8c08f13 100644 --- a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc
@@ -172,7 +172,7 @@ incident->tracked_preference().atomic_value()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Values, PreferenceValidationDelegateValues, // On Android, make_tuple(..., "null") doesn't compile due to the error: @@ -220,7 +220,7 @@ EXPECT_EQ(0U, incidents_.size()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( NoIncident, PreferenceValidationDelegateNoIncident, testing::Combine(testing::Values(ValueState::UNCHANGED, @@ -303,7 +303,7 @@ tp_incident.value_state()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithIncident, PreferenceValidationDelegateWithIncident, testing::Combine(testing::Values(ValueState::CLEARED, @@ -314,7 +314,7 @@ ValueState::UNTRUSTED_UNKNOWN_VALUE), testing::Bool())); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithBypassIncident, PreferenceValidationDelegateWithIncident, testing::Combine(testing::Values(ValueState::UNCHANGED, @@ -323,7 +323,7 @@ testing::Values(ValueState::CHANGED, ValueState::CLEARED), testing::Bool())); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithIncidentIgnoreBypass, PreferenceValidationDelegateWithIncident, testing::Combine(testing::Values(ValueState::CLEARED,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index db94cfb..c66a10b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -1768,7 +1768,7 @@ EXPECT_TRUE(IsShowingInterstitial()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting, SafeBrowsingBlockingPageBrowserTest, testing::Combine( @@ -1815,7 +1815,7 @@ EXPECT_TRUE(VerifyIDNDecoded()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SafeBrowsingBlockingPageIDNTestWithThreatType, SafeBrowsingBlockingPageIDNTest, testing::Combine(testing::Values(false, true),
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_dependency_browsertest_win.cc b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_dependency_browsertest_win.cc index dbf6874..9b582c8 100644 --- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_dependency_browsertest_win.cc +++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_dependency_browsertest_win.cc
@@ -69,9 +69,9 @@ } } -INSTANTIATE_TEST_CASE_P(Default, - SettingsResetDependencyTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(Default, + SettingsResetDependencyTest, + ::testing::Bool()); } // namespace } // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc index e9e5d19d..0c4e77d 100644 --- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc +++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc
@@ -416,9 +416,9 @@ EXPECT_EQ(reset_callbacks_, 1); } -INSTANTIATE_TEST_CASE_P(SettingsResetPromptModel, - ResetStatesTest, - Combine(Bool(), Bool(), Bool())); +INSTANTIATE_TEST_SUITE_P(SettingsResetPromptModel, + ResetStatesTest, + Combine(Bool(), Bool(), Bool())); } // namespace } // namespace safe_browsing
diff --git a/chrome/browser/secure_origin_whitelist_browsertest.cc b/chrome/browser/secure_origin_whitelist_browsertest.cc index 4a06fd0..d2ff9f2 100644 --- a/chrome/browser/secure_origin_whitelist_browsertest.cc +++ b/chrome/browser/secure_origin_whitelist_browsertest.cc
@@ -123,19 +123,19 @@ policy::MockConfigurationPolicyProvider provider_; }; -INSTANTIATE_TEST_CASE_P(SecureOriginWhitelistBrowsertest, - SecureOriginWhitelistBrowsertest, - testing::Values(TestVariant::kNone, - TestVariant::kCommandline, +INSTANTIATE_TEST_SUITE_P(SecureOriginWhitelistBrowsertest, + SecureOriginWhitelistBrowsertest, + testing::Values(TestVariant::kNone, + TestVariant::kCommandline, // The legacy policy isn't defined on ChromeOS or Android, so skip tests that // use it on those platforms. #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) - TestVariant::kPolicyOld, - TestVariant::kPolicyOldAndNew, + TestVariant::kPolicyOld, + TestVariant::kPolicyOldAndNew, #endif - TestVariant::kPolicy, - TestVariant::kPolicy2, - TestVariant::kPolicy3)); + TestVariant::kPolicy, + TestVariant::kPolicy2, + TestVariant::kPolicy3)); IN_PROC_BROWSER_TEST_P(SecureOriginWhitelistBrowsertest, Simple) { GURL url = embedded_test_server()->GetURL(
diff --git a/chrome/browser/sessions/session_data_deleter.cc b/chrome/browser/sessions/session_data_deleter.cc index 3670587..5c40627 100644 --- a/chrome/browser/sessions/session_data_deleter.cc +++ b/chrome/browser/sessions/session_data_deleter.cc
@@ -17,7 +17,6 @@ #include "chrome/browser/ui/startup/startup_browser_creator.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/dom_storage_context.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_usage_info.h" #include "net/cookies/cookie_util.h" @@ -38,11 +37,7 @@ friend class base::RefCountedThreadSafe<SessionDataDeleter>; ~SessionDataDeleter(); - // Deletes the local storage described by |usages| for origins which are - // session-only. - void ClearSessionOnlyLocalStorage( - content::StoragePartition* storage_partition, - const std::vector<content::StorageUsageInfo>& usages); + bool OriginMatcher(const GURL& origin, storage::SpecialStoragePolicy* policy); // Takes the result of a CookieManager::GetAllCookies() method, and // initiates deletion of all cookies that are session only by the @@ -66,10 +61,16 @@ void SessionDataDeleter::Run(content::StoragePartition* storage_partition) { if (storage_policy_.get() && storage_policy_->HasSessionOnlyOrigins()) { - storage_partition->GetDOMStorageContext()->GetLocalStorageUsage( - base::Bind(&SessionDataDeleter::ClearSessionOnlyLocalStorage, - this, - storage_partition)); + // Cookies are not origin scoped, so they are handled separately. + const uint32_t removal_mask = + content::StoragePartition::REMOVE_DATA_MASK_ALL & + ~content::StoragePartition::REMOVE_DATA_MASK_COOKIES; + storage_partition->ClearData( + removal_mask, content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, + base::BindRepeating(&SessionDataDeleter::OriginMatcher, this), + /*cookie_deletion_filter=*/nullptr, + /*perform_storage_cleanup=*/false, base::Time(), base::Time::Max(), + base::DoNothing()); } storage_partition->GetNetworkContext()->GetCookieManager( @@ -103,6 +104,12 @@ // side of the pipe is closed, so all deletion requested will still occur. } +bool SessionDataDeleter::OriginMatcher(const GURL& origin, + storage::SpecialStoragePolicy* policy) { + return policy->IsStorageSessionOnly(origin) && + !policy->IsStorageProtected(origin); +} + void SessionDataDeleter::DeleteSessionOnlyOriginCookies( const std::vector<net::CanonicalCookie>& cookies) { auto delete_cookie_predicate = @@ -120,20 +127,6 @@ SessionDataDeleter::~SessionDataDeleter() {} -void SessionDataDeleter::ClearSessionOnlyLocalStorage( - content::StoragePartition* storage_partition, - const std::vector<content::StorageUsageInfo>& usages) { - DCHECK(storage_policy_.get()); - DCHECK(storage_policy_->HasSessionOnlyOrigins()); - for (size_t i = 0; i < usages.size(); ++i) { - const content::StorageUsageInfo& usage = usages[i]; - if (!storage_policy_->IsStorageSessionOnly(usage.origin.GetURL())) - continue; - storage_partition->GetDOMStorageContext()->DeleteLocalStorage( - usage.origin, base::DoNothing()); - } -} - } // namespace void DeleteSessionOnlyData(Profile* profile) {
diff --git a/chrome/browser/signin/chrome_signin_client_unittest.cc b/chrome/browser/signin/chrome_signin_client_unittest.cc index 112b2d30..4110a6c 100644 --- a/chrome/browser/signin/chrome_signin_client_unittest.cc +++ b/chrome/browser/signin/chrome_signin_client_unittest.cc
@@ -355,9 +355,9 @@ signin_metrics::ProfileSignout::NUM_PROFILE_SIGNOUT_METRICS, "kSignoutSources should enumerate all ProfileSignout values"); -INSTANTIATE_TEST_CASE_P(AllSignoutSources, - ChromeSigninClientSignoutSourceTest, - testing::ValuesIn(kSignoutSources)); +INSTANTIATE_TEST_SUITE_P(AllSignoutSources, + ChromeSigninClientSignoutSourceTest, + testing::ValuesIn(kSignoutSources)); #endif // !defined(OS_ANDROID) #endif // !defined(OS_CHROMEOS)
diff --git a/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc b/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc index ffee071f..0f92e03 100644 --- a/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc +++ b/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc
@@ -166,9 +166,9 @@ EXPECT_FALSE(show_error_called_); } -INSTANTIATE_TEST_CASE_P(/* no prefix */, - ProcessDiceHeaderDelegateImplTestEnableSync, - ::testing::ValuesIn(kEnableSyncTestCases)); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + ProcessDiceHeaderDelegateImplTestEnableSync, + ::testing::ValuesIn(kEnableSyncTestCases)); TestConfiguration kHandleTokenExchangeFailureTestCases[] = { // clang-format off @@ -210,7 +210,7 @@ EXPECT_EQ(expected_url, web_contents()->GetVisibleURL()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, ProcessDiceHeaderDelegateImplTestHandleTokenExchangeFailure, ::testing::ValuesIn(kHandleTokenExchangeFailureTestCases));
diff --git a/chrome/browser/signin/signin_promo.cc b/chrome/browser/signin/signin_promo.cc index ada383b97..1daa649 100644 --- a/chrome/browser/signin/signin_promo.cc +++ b/chrome/browser/signin/signin_promo.cc
@@ -29,119 +29,13 @@ namespace signin { -namespace { - -// The maximum number of times we want to show the sign in promo at startup. -const int kSignInPromoShowAtStartupMaximum = 10; - -// Forces the web based signin flow when set. -bool g_force_web_based_signin_flow = false; - -// Checks we want to show the sign in promo for the given brand. -bool AllowPromoAtStartupForCurrentBrand() { - std::string brand; - google_brand::GetBrand(&brand); - - if (brand.empty()) - return true; - - if (google_brand::IsInternetCafeBrandCode(brand)) - return false; - - // Enable for both organic and distribution. - return true; -} - -// Returns true if a user has seen the sign in promo at startup previously. -bool HasShownPromoAtStartup(Profile* profile) { - return profile->GetPrefs()->HasPrefPath(prefs::kSignInPromoStartupCount); -} - -// Returns true if the user has previously skipped the sign in promo. -bool HasUserSkippedPromo(Profile* profile) { - return profile->GetPrefs()->GetBoolean(prefs::kSignInPromoUserSkipped); -} - -GURL GetEmbeddedReauthURLInternal(signin_metrics::AccessPoint access_point, - signin_metrics::Reason reason, - const std::string& email) { - GURL url = GetEmbeddedPromoURL(access_point, reason, /*auto_close=*/true); - url = net::AppendQueryParameter(url, "email", email); - url = net::AppendQueryParameter(url, "validateEmail", "1"); - return net::AppendQueryParameter(url, "readOnlyEmail", "1"); -} - -} // namespace - const char kSignInPromoQueryKeyAccessPoint[] = "access_point"; const char kSignInPromoQueryKeyAutoClose[] = "auto_close"; -const char kSignInPromoQueryKeyContinue[] = "continue"; const char kSignInPromoQueryKeyForceKeepData[] = "force_keep_data"; const char kSignInPromoQueryKeyReason[] = "reason"; const char kSignInPromoQueryKeySource[] = "source"; const char kSigninPromoLandingURLSuccessPage[] = "success.html"; -bool ShouldShowPromoAtStartup(Profile* profile, bool is_new_profile) { - DCHECK(profile); - - // Don't show if the profile is an incognito. - if (profile->IsOffTheRecord()) - return false; - - if (!ShouldShowPromo(profile)) - return false; - - if (!is_new_profile) { - if (!HasShownPromoAtStartup(profile)) - return false; - } - -#if defined(OS_WIN) - // Do not show the promo on first run on Win10 and newer. - if (is_new_profile && base::win::GetVersion() >= base::win::VERSION_WIN10) - return false; -#endif - - if (HasUserSkippedPromo(profile)) - return false; - - // For Chinese users skip the sign in promo. - if (g_browser_process->GetApplicationLocale() == "zh-CN") - return false; - - PrefService* prefs = profile->GetPrefs(); - int show_count = prefs->GetInteger(prefs::kSignInPromoStartupCount); - if (show_count >= kSignInPromoShowAtStartupMaximum) - return false; - - // This pref can be set in the master preferences file to allow or disallow - // showing the sign in promo at startup. - if (prefs->HasPrefPath(prefs::kSignInPromoShowOnFirstRunAllowed)) - return prefs->GetBoolean(prefs::kSignInPromoShowOnFirstRunAllowed); - - // For now don't show the promo for some brands. - if (!AllowPromoAtStartupForCurrentBrand()) - return false; - - // Default to show the promo for Google Chrome builds. -#if defined(GOOGLE_CHROME_BUILD) - return true; -#else - return false; -#endif -} - -void DidShowPromoAtStartup(Profile* profile) { - int show_count = profile->GetPrefs()->GetInteger( - prefs::kSignInPromoStartupCount); - show_count++; - profile->GetPrefs()->SetInteger(prefs::kSignInPromoStartupCount, show_count); -} - -void SetUserSkippedPromo(Profile* profile) { - profile->GetPrefs()->SetBoolean(prefs::kSignInPromoUserSkipped, true); -} - GURL GetLandingURL(signin_metrics::AccessPoint access_point) { GURL url(extensions::kGaiaAuthExtensionOrigin); GURL::Replacements replacements; @@ -168,6 +62,7 @@ return GURL(url); } +#if !defined(OS_CHROMEOS) GURL GetEmbeddedPromoURL(signin_metrics::AccessPoint access_point, signin_metrics::Reason reason, bool auto_close) { @@ -197,8 +92,12 @@ GURL GetEmbeddedReauthURLWithEmail(signin_metrics::AccessPoint access_point, signin_metrics::Reason reason, const std::string& email) { - return GetEmbeddedReauthURLInternal(access_point, reason, email); + GURL url = GetEmbeddedPromoURL(access_point, reason, /*auto_close=*/true); + url = net::AppendQueryParameter(url, "email", email); + url = net::AppendQueryParameter(url, "validateEmail", "1"); + return net::AppendQueryParameter(url, "readOnlyEmail", "1"); } +#endif // !defined(OS_CHROMEOS) GURL GetChromeSyncURLForDice(const std::string& email, const std::string& continue_url) { @@ -270,14 +169,8 @@ return false; } -void ForceWebBasedSigninFlowForTesting(bool force) { - g_force_web_based_signin_flow = force; -} - void RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { - registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); - registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); registry->RegisterIntegerPref(prefs::kDiceSigninUserMenuPromoCount, 0);
diff --git a/chrome/browser/signin/signin_promo.h b/chrome/browser/signin/signin_promo.h index c50d497c..d3c4510c 100644 --- a/chrome/browser/signin/signin_promo.h +++ b/chrome/browser/signin/signin_promo.h
@@ -12,7 +12,6 @@ #include "components/signin/core/browser/signin_metrics.h" class GURL; -class Profile; namespace user_prefs { class PrefRegistrySyncable; @@ -23,25 +22,18 @@ extern const char kSignInPromoQueryKeyAccessPoint[]; extern const char kSignInPromoQueryKeyAutoClose[]; -extern const char kSignInPromoQueryKeyContinue[]; extern const char kSignInPromoQueryKeyForceKeepData[]; extern const char kSignInPromoQueryKeyReason[]; extern const char kSignInPromoQueryKeySource[]; extern const char kSigninPromoLandingURLSuccessPage[]; -// Returns true if we should show the sign in promo at startup. -bool ShouldShowPromoAtStartup(Profile* profile, bool is_new_profile); - -// Called when the sign in promo has been shown so that we can keep track -// of the number of times we've displayed it. -void DidShowPromoAtStartup(Profile* profile); - -// Registers the fact that the user has skipped the sign in promo. -void SetUserSkippedPromo(Profile* profile); - // Gets the sign in landing page URL. GURL GetLandingURL(signin_metrics::AccessPoint access_point); +#if !defined(OS_CHROMEOS) +// These functions are only used to unlock the profile from the desktop user +// manager and the windows credential provider. + // Returns the sign in promo URL that can be used in a modal dialog with // the given arguments in the query. // |access_point| indicates where the sign in is being initiated. @@ -56,6 +48,7 @@ GURL GetEmbeddedReauthURLWithEmail(signin_metrics::AccessPoint access_point, signin_metrics::Reason reason, const std::string& email); +#endif // !defined(OS_CHROMEOS) // Returns the URL to be used to signin and turn on Sync when DICE is enabled. // If email is not empty, then it will pass email as hint to the page so that it @@ -83,9 +76,6 @@ // Returns true if the auto_close parameter in the given URL is set to true. bool IsAutoCloseEnabledInEmbeddedURL(const GURL& url); -// Forces UseWebBasedSigninFlow() to return true when set; used in tests only. -void ForceWebBasedSigninFlowForTesting(bool force); - // Registers the preferences the Sign In Promo needs. void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
diff --git a/chrome/browser/signin/signin_promo_unittest.cc b/chrome/browser/signin/signin_promo_unittest.cc index e56b0e1..88ba43a0 100644 --- a/chrome/browser/signin/signin_promo_unittest.cc +++ b/chrome/browser/signin/signin_promo_unittest.cc
@@ -4,11 +4,13 @@ #include "chrome/browser/signin/signin_promo.h" +#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" namespace signin { +#if !defined(OS_CHROMEOS) TEST(SigninPromoTest, TestPromoURL) { GURL expected_url_1( "chrome://chrome-signin/?access_point=0&reason=0&auto_close=1"); @@ -33,6 +35,7 @@ signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE, signin_metrics::Reason::REASON_UNLOCK, "example@domain.com")); } +#endif // !defined(OS_CHROMEOS) TEST(SigninPromoTest, TestLandingURL) { GURL expected_url_1(
diff --git a/chrome/browser/signin/signin_util_win_browsertest.cc b/chrome/browser/signin/signin_util_win_browsertest.cc index 91add871..ba512ee 100644 --- a/chrome/browser/signin/signin_util_win_browsertest.cc +++ b/chrome/browser/signin/signin_util_win_browsertest.cc
@@ -251,47 +251,47 @@ } } -INSTANTIATE_TEST_CASE_P(SigninUtilWinBrowserTest1, - SigninUtilWinBrowserTest, - testing::Values(SigninUtilWinBrowserTestParams( - /*is_first_run=*/false, - /*gaia_id=*/base::string16(), - /*email=*/base::string16(), - /*refresh_token=*/std::string(), - /*expect_is_started=*/false))); +INSTANTIATE_TEST_SUITE_P(SigninUtilWinBrowserTest1, + SigninUtilWinBrowserTest, + testing::Values(SigninUtilWinBrowserTestParams( + /*is_first_run=*/false, + /*gaia_id=*/base::string16(), + /*email=*/base::string16(), + /*refresh_token=*/std::string(), + /*expect_is_started=*/false))); -INSTANTIATE_TEST_CASE_P(SigninUtilWinBrowserTest2, - SigninUtilWinBrowserTest, - testing::Values(SigninUtilWinBrowserTestParams( - /*is_first_run=*/true, - /*gaia_id=*/base::string16(), - /*email=*/base::string16(), - /*refresh_token=*/std::string(), - /*expect_is_started=*/false))); +INSTANTIATE_TEST_SUITE_P(SigninUtilWinBrowserTest2, + SigninUtilWinBrowserTest, + testing::Values(SigninUtilWinBrowserTestParams( + /*is_first_run=*/true, + /*gaia_id=*/base::string16(), + /*email=*/base::string16(), + /*refresh_token=*/std::string(), + /*expect_is_started=*/false))); -INSTANTIATE_TEST_CASE_P(SigninUtilWinBrowserTest3, - SigninUtilWinBrowserTest, - testing::Values(SigninUtilWinBrowserTestParams( - /*is_first_run=*/true, - /*gaia_id=*/L"gaia-123456", - /*email=*/base::string16(), - /*refresh_token=*/std::string(), - /*expect_is_started=*/false))); +INSTANTIATE_TEST_SUITE_P(SigninUtilWinBrowserTest3, + SigninUtilWinBrowserTest, + testing::Values(SigninUtilWinBrowserTestParams( + /*is_first_run=*/true, + /*gaia_id=*/L"gaia-123456", + /*email=*/base::string16(), + /*refresh_token=*/std::string(), + /*expect_is_started=*/false))); -INSTANTIATE_TEST_CASE_P(SigninUtilWinBrowserTest4, - SigninUtilWinBrowserTest, - testing::Values(SigninUtilWinBrowserTestParams( - /*is_first_run=*/true, - /*gaia_id=*/L"gaia-123456", - /*email=*/L"foo@gmail.com", - /*refresh_token=*/std::string(), - /*expect_is_started=*/false))); +INSTANTIATE_TEST_SUITE_P(SigninUtilWinBrowserTest4, + SigninUtilWinBrowserTest, + testing::Values(SigninUtilWinBrowserTestParams( + /*is_first_run=*/true, + /*gaia_id=*/L"gaia-123456", + /*email=*/L"foo@gmail.com", + /*refresh_token=*/std::string(), + /*expect_is_started=*/false))); -INSTANTIATE_TEST_CASE_P(SigninUtilWinBrowserTest5, - SigninUtilWinBrowserTest, - testing::Values(SigninUtilWinBrowserTestParams( - /*is_first_run=*/true, - /*gaia_id=*/L"gaia-123456", - /*email=*/L"foo@gmail.com", - /*refresh_token=*/"lst-123456", - /*expect_is_started=*/true))); +INSTANTIATE_TEST_SUITE_P(SigninUtilWinBrowserTest5, + SigninUtilWinBrowserTest, + testing::Values(SigninUtilWinBrowserTestParams( + /*is_first_run=*/true, + /*gaia_id=*/L"gaia-123456", + /*email=*/L"foo@gmail.com", + /*refresh_token=*/"lst-123456", + /*expect_is_started=*/true)));
diff --git a/chrome/browser/spellchecker/spellcheck_service_unittest.cc b/chrome/browser/spellchecker/spellcheck_service_unittest.cc index 1a9df60..bccc1d5f 100644 --- a/chrome/browser/spellchecker/spellcheck_service_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_unittest.cc
@@ -107,7 +107,7 @@ DISALLOW_COPY_AND_ASSIGN(SpellcheckServiceUnitTest); }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCases, SpellcheckServiceUnitTest, testing::Values(
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index afe34ce..3302494 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -96,7 +96,6 @@ #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher.h" #include "services/network/public/cpp/features.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/simple_url_loader.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "url/gurl.h" @@ -122,7 +121,7 @@ const char kPasswordFileForTest[] = "password-file-for-test"; const char kSyncUserForTest[] = "sync-user-for-test"; const char kSyncPasswordForTest[] = "sync-password-for-test"; -} +} // namespace switches namespace { @@ -154,8 +153,7 @@ void OnProfileCreated(Profile* profile, bool success, bool is_new_profile) override { - g_browser_process->profile_manager()->RegisterTestingProfile(profile, - true, + g_browser_process->profile_manager()->RegisterTestingProfile(profile, true, false); // Perform any custom work needed before the profile is initialized. @@ -240,10 +238,7 @@ previous_profile_(nullptr), num_clients_(-1), use_verifier_(true), - create_gaia_account_at_runtime_(false), - test_shared_url_loader_factory_( - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &test_url_loader_factory_)) { + create_gaia_account_at_runtime_(false) { sync_datatype_helper::AssociateWithTest(this); switch (test_type_) { case SINGLE_CLIENT: @@ -314,7 +309,6 @@ // Return OSCrypt to its real behaviour OSCryptMocker::TearDown(); - test_shared_url_loader_factory_->Detach(); fake_server_.reset(); } @@ -344,9 +338,8 @@ bool SyncTest::CreateGaiaAccount(const std::string& username, const std::string& password) { - std::string relative_url = base::StringPrintf("/CreateUsers?%s=%s", - username.c_str(), - password.c_str()); + std::string relative_url = base::StringPrintf( + "/CreateUsers?%s=%s", username.c_str(), password.c_str()); GURL create_user_url = GaiaUrls::GetInstance()->gaia_url().Resolve(relative_url); // NavigateToURL blocks until the navigation finishes. @@ -357,7 +350,7 @@ EXPECT_TRUE(entry) << "Could not get a hold on NavigationEntry post URL navigate."; DVLOG(1) << "Create Gaia account request return code = " - << entry->GetHttpStatusCode(); + << entry->GetHttpStatusCode(); return entry->GetHttpStatusCode() == 200; } @@ -408,7 +401,8 @@ std::make_unique<SyncProfileDelegate>(base::Bind( &SyncTest::InitializeProfile, base::Unretained(this), index)); Profile* profile = MakeTestProfile(profile_path, index); - SetURLLoaderFactoryForTest(profile, test_shared_url_loader_factory_); + SetURLLoaderFactoryForTest(profile, + test_url_loader_factory_.GetSafeWeakWrapper()); } // Once profile initialization has kicked off, wait for it to finish. @@ -439,12 +433,10 @@ Profile* SyncTest::MakeProfileForUISignin(base::FilePath profile_path) { ProfileManager* profile_manager = g_browser_process->profile_manager(); base::RunLoop run_loop; - ProfileManager::CreateCallback create_callback = base::Bind( - &CreateProfileCallback, run_loop.QuitClosure()); - profile_manager->CreateProfileAsync(profile_path, - create_callback, - base::string16(), - std::string()); + ProfileManager::CreateCallback create_callback = + base::Bind(&CreateProfileCallback, run_loop.QuitClosure()); + profile_manager->CreateProfileAsync(profile_path, create_callback, + base::string16(), std::string()); run_loop.Run(); return profile_manager->GetProfileByPath(profile_path); } @@ -661,7 +653,8 @@ fake_server_->AsWeakPtr()))); } - ProfileSyncServiceHarness::SigninType singin_type = UsingExternalServers() + ProfileSyncServiceHarness::SigninType singin_type = + UsingExternalServers() ? ProfileSyncServiceHarness::SigninType::UI_SIGNIN : ProfileSyncServiceHarness::SigninType::FAKE_SIGNIN; @@ -691,7 +684,8 @@ } void SyncTest::SetupMockGaiaResponsesForProfile(Profile* profile) { - SetURLLoaderFactoryForTest(profile, test_shared_url_loader_factory_); + SetURLLoaderFactoryForTest(profile, + test_url_loader_factory_.GetSafeWeakWrapper()); } void SyncTest::SetUpInvalidations(int index) { @@ -1009,13 +1003,12 @@ << switches::kPasswordFileForTest << "=<filename>"; std::string file_contents; base::ReadFileToString(password_file_, &file_contents); - ASSERT_NE(file_contents, "") << "Password file \"" - << password_file_.value() << "\" does not exist."; + ASSERT_NE(file_contents, "") + << "Password file \"" << password_file_.value() << "\" does not exist."; std::vector<std::string> tokens = base::SplitString( file_contents, "\r\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - ASSERT_EQ(2U, tokens.size()) << "Password file \"" - << password_file_.value() - << "\" must contain exactly two lines of text."; + ASSERT_EQ(2U, tokens.size()) << "Password file \"" << password_file_.value() + << "\" must contain exactly two lines of text."; username_ = tokens[0]; password_ = tokens[1]; } @@ -1259,10 +1252,10 @@ ASSERT_TRUE(ServerSupportsNotificationControl()); std::string path = "chromiumsync/disablenotifications"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); - ASSERT_EQ("Notifications disabled", - base::UTF16ToASCII( - browser()->tab_strip_model()->GetActiveWebContents()-> - GetTitle())); + ASSERT_EQ( + "Notifications disabled", + base::UTF16ToASCII( + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle())); } void SyncTest::DisableNotifications() { @@ -1273,10 +1266,10 @@ ASSERT_TRUE(ServerSupportsNotificationControl()); std::string path = "chromiumsync/enablenotifications"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); - ASSERT_EQ("Notifications enabled", - base::UTF16ToASCII( - browser()->tab_strip_model()->GetActiveWebContents()-> - GetTitle())); + ASSERT_EQ( + "Notifications enabled", + base::UTF16ToASCII( + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle())); } void SyncTest::EnableNotifications() { @@ -1287,18 +1280,18 @@ ASSERT_TRUE(ServerSupportsNotificationControl()); const std::string& data = syncer::P2PNotificationData( - "from_server", - syncer::NOTIFY_ALL, + "from_server", syncer::NOTIFY_ALL, syncer::ObjectIdInvalidationMap::InvalidateAll( - syncer::ModelTypeSetToObjectIdSet(changed_types))).ToString(); + syncer::ModelTypeSetToObjectIdSet(changed_types))) + .ToString(); const std::string& path = std::string("chromiumsync/sendnotification?channel=") + syncer::kSyncP2PNotificationChannel + "&data=" + data; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); - ASSERT_EQ("Notification sent", - base::UTF16ToASCII( - browser()->tab_strip_model()->GetActiveWebContents()-> - GetTitle())); + ASSERT_EQ( + "Notification sent", + base::UTF16ToASCII( + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle())); } bool SyncTest::ServerSupportsErrorTriggering() const { @@ -1319,10 +1312,10 @@ joiner = '&'; } ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); - ASSERT_EQ("Migration: 200", - base::UTF16ToASCII( - browser()->tab_strip_model()->GetActiveWebContents()-> - GetTitle())); + ASSERT_EQ( + "Migration: 200", + base::UTF16ToASCII( + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle())); } fake_server::FakeServer* SyncTest::GetFakeServer() const {
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc index a769afb8f..3438cb0 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc
@@ -638,9 +638,9 @@ DISALLOW_COPY_AND_ASSIGN(MetadataDatabaseTest); }; -INSTANTIATE_TEST_CASE_P(MetadataDatabaseTestWithIndexesOnDisk, - MetadataDatabaseTest, - ::testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(MetadataDatabaseTestWithIndexesOnDisk, + MetadataDatabaseTest, + ::testing::Values(true, false)); TEST_P(MetadataDatabaseTest, InitializationTest_Empty) { EXPECT_EQ(SYNC_STATUS_OK, InitializeMetadataDatabase());
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc index 2cdcec0..06a652c 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -2702,24 +2702,24 @@ } } -INSTANTIATE_TEST_CASE_P(, - ArcAppModelBuilderTest, - ::testing::ValuesIn(kUnmanagedArcStates)); -INSTANTIATE_TEST_CASE_P(, - ArcDefaultAppTest, - ::testing::ValuesIn(kUnmanagedArcStates)); -INSTANTIATE_TEST_CASE_P(, - ArcAppLauncherForDefaulAppTest, - ::testing::ValuesIn(kUnmanagedArcStates)); -INSTANTIATE_TEST_CASE_P(, - ArcDefaultAppForManagedUserTest, - ::testing::ValuesIn(kManagedArcStates)); -INSTANTIATE_TEST_CASE_P(, - ArcPlayStoreAppTest, - ::testing::ValuesIn(kUnmanagedArcStates)); -INSTANTIATE_TEST_CASE_P(, - ArcAppModelBuilderRecreate, - ::testing::ValuesIn(kUnmanagedArcStates)); -INSTANTIATE_TEST_CASE_P(, - ArcAppModelIconTest, - ::testing::ValuesIn(kUnmanagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcAppModelBuilderTest, + ::testing::ValuesIn(kUnmanagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcDefaultAppTest, + ::testing::ValuesIn(kUnmanagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcAppLauncherForDefaulAppTest, + ::testing::ValuesIn(kUnmanagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcDefaultAppForManagedUserTest, + ::testing::ValuesIn(kManagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcPlayStoreAppTest, + ::testing::ValuesIn(kUnmanagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcAppModelBuilderRecreate, + ::testing::ValuesIn(kUnmanagedArcStates)); +INSTANTIATE_TEST_SUITE_P(, + ArcAppModelIconTest, + ::testing::ValuesIn(kUnmanagedArcStates));
diff --git a/chrome/browser/ui/app_list/md_icon_normalizer_unittest.cc b/chrome/browser/ui/app_list/md_icon_normalizer_unittest.cc index 1d0ff16..d3f7d49b 100644 --- a/chrome/browser/ui/app_list/md_icon_normalizer_unittest.cc +++ b/chrome/browser/ui/app_list/md_icon_normalizer_unittest.cc
@@ -270,7 +270,7 @@ EXPECT_EQ(1, ::GetScale(bitmap)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, MdIconNormalizerTestWithColorType, ::testing::Values(kAlpha_8_SkColorType, @@ -311,7 +311,7 @@ ::ExpectScaledSize(kGuidelineSizeSquare, kIconSize, bitmap); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, MdIconNormalizerTestWithNoAlpha, ::testing::Values(kGray_8_SkColorType,
diff --git a/chrome/browser/ui/app_list/search/tests/app_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/tests/app_search_provider_unittest.cc index d1ff28461..2db6f51 100644 --- a/chrome/browser/ui/app_list/search/tests/app_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/tests/app_search_provider_unittest.cc
@@ -825,7 +825,7 @@ RunQuery(kRankingAppQuery)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , AppSearchProviderWithExtensionInstallType, ::testing::ValuesIn({TestExtensionInstallType::CONTROLLED_BY_POLICY, @@ -916,7 +916,7 @@ RunQuery(kRankingAppQuery)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , AppSearchProviderWithArcAppInstallType, ::testing::ValuesIn({TestArcAppInstallType::CONTROLLED_BY_POLICY,
diff --git a/chrome/browser/ui/ash/accelerator_commands_browsertest.cc b/chrome/browser/ui/ash/accelerator_commands_browsertest.cc index 090d16f..e9e775c 100644 --- a/chrome/browser/ui/ash/accelerator_commands_browsertest.cc +++ b/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
@@ -211,12 +211,12 @@ EXPECT_FALSE(widget->IsFullscreen()); } -INSTANTIATE_TEST_CASE_P(InitiallyRestored, - AcceleratorCommandsFullscreenBrowserTest, - Values(ui::SHOW_STATE_NORMAL)); -INSTANTIATE_TEST_CASE_P(InitiallyMaximized, - AcceleratorCommandsFullscreenBrowserTest, - Values(ui::SHOW_STATE_MAXIMIZED)); +INSTANTIATE_TEST_SUITE_P(InitiallyRestored, + AcceleratorCommandsFullscreenBrowserTest, + Values(ui::SHOW_STATE_NORMAL)); +INSTANTIATE_TEST_SUITE_P(InitiallyMaximized, + AcceleratorCommandsFullscreenBrowserTest, + Values(ui::SHOW_STATE_MAXIMIZED)); class AcceleratorCommandsPlatformAppFullscreenBrowserTest : public WithParamInterface<ui::WindowShowState>, @@ -310,9 +310,9 @@ } } -INSTANTIATE_TEST_CASE_P(InitiallyRestored, - AcceleratorCommandsPlatformAppFullscreenBrowserTest, - Values(ui::SHOW_STATE_NORMAL)); -INSTANTIATE_TEST_CASE_P(InitiallyMaximized, - AcceleratorCommandsPlatformAppFullscreenBrowserTest, - Values(ui::SHOW_STATE_MAXIMIZED)); +INSTANTIATE_TEST_SUITE_P(InitiallyRestored, + AcceleratorCommandsPlatformAppFullscreenBrowserTest, + Values(ui::SHOW_STATE_NORMAL)); +INSTANTIATE_TEST_SUITE_P(InitiallyMaximized, + AcceleratorCommandsPlatformAppFullscreenBrowserTest, + Values(ui::SHOW_STATE_MAXIMIZED));
diff --git a/chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc b/chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc index b3c54b0..eb4db598 100644 --- a/chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/arc_app_launcher_browsertest.cc
@@ -444,9 +444,9 @@ } } -INSTANTIATE_TEST_CASE_P(ArcAppDeferredLauncherWithParamsBrowserTestInstance, - ArcAppDeferredLauncherWithParamsBrowserTest, - ::testing::ValuesIn(build_test_parameter)); +INSTANTIATE_TEST_SUITE_P(ArcAppDeferredLauncherWithParamsBrowserTestInstance, + ArcAppDeferredLauncherWithParamsBrowserTest, + ::testing::ValuesIn(build_test_parameter)); // This tests validates pin state on package update and remove. IN_PROC_BROWSER_TEST_F(ArcAppLauncherBrowserTest, PinOnPackageUpdateAndRemove) {
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 485023f..131e166 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -4120,9 +4120,9 @@ DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerPlayStoreAvailabilityTest); }; -INSTANTIATE_TEST_CASE_P(, - ChromeLauncherControllerPlayStoreAvailabilityTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, + ChromeLauncherControllerPlayStoreAvailabilityTest, + ::testing::Bool()); } // namespace
diff --git a/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc b/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc index 5d8d25b..ef63b4e 100644 --- a/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc +++ b/chrome/browser/ui/blocked_content/popup_opener_tab_helper_unittest.cc
@@ -408,9 +408,9 @@ DISALLOW_COPY_AND_ASSIGN(BlockTabUnderIncognitoTest); }; -INSTANTIATE_TEST_CASE_P(, - BlockTabUnderIncognitoTest, - testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, + BlockTabUnderIncognitoTest, + testing::Values(true, false)); TEST_F(BlockTabUnderTest, SimpleTabUnder_IsBlocked) { EXPECT_TRUE(NavigateAndCommitWithoutGesture(GURL("https://first.test/")));
diff --git a/chrome/browser/ui/cocoa/page_info/page_info_bubble_views_mac_browsertest.mm b/chrome/browser/ui/cocoa/page_info/page_info_bubble_views_mac_browsertest.mm index 3daa37b8..bcdee55 100644 --- a/chrome/browser/ui/cocoa/page_info/page_info_bubble_views_mac_browsertest.mm +++ b/chrome/browser/ui/cocoa/page_info/page_info_bubble_views_mac_browsertest.mm
@@ -113,6 +113,6 @@ EXPECT_FALSE(PageInfoBubbleView::GetPageInfoBubble()); } -INSTANTIATE_TEST_CASE_P(, - PageInfoBubbleViewsMacTest, - testing::ValuesIn(kGurlBubbleTypePairs)); +INSTANTIATE_TEST_SUITE_P(, + PageInfoBubbleViewsMacTest, + testing::ValuesIn(kGurlBubbleTypePairs));
diff --git a/chrome/browser/ui/extensions/hosted_app_browsertest.cc b/chrome/browser/ui/extensions/hosted_app_browsertest.cc index b3af115..7213f85 100644 --- a/chrome/browser/ui/extensions/hosted_app_browsertest.cc +++ b/chrome/browser/ui/extensions/hosted_app_browsertest.cc
@@ -2918,44 +2918,44 @@ NavigateAndCheckForToolbar(app_browser_, popup_url, false); } -INSTANTIATE_TEST_CASE_P(/* no prefix */, - HostedAppTest, - ::testing::Combine(kAppTypeValues, - ::testing::Bool(), - ::testing::Bool())); +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + HostedAppTest, + ::testing::Combine(kAppTypeValues, + ::testing::Bool(), + ::testing::Bool())); -INSTANTIATE_TEST_CASE_P(/* no prefix */, - HostedAppCustomTabBarOnlyTest, - ::testing::Combine(kAppTypeValues, - ::testing::Bool(), - ::testing::Values(true))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + HostedAppCustomTabBarOnlyTest, + ::testing::Combine(kAppTypeValues, + ::testing::Bool(), + ::testing::Values(true))); +INSTANTIATE_TEST_SUITE_P( /* no prefix */, HostedAppPWAOnlyTest, ::testing::Combine(::testing::Values(AppType::BOOKMARK_APP), ::testing::Values(true), ::testing::Bool())); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, BookmarkAppOnlyTest, ::testing::Combine(::testing::Values(AppType::BOOKMARK_APP), ::testing::Bool(), ::testing::Bool())); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, HostedAppProcessModelTest, ::testing::Combine(::testing::Values(AppType::HOSTED_APP), ::testing::Bool(), ::testing::Bool())); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, HostedAppIsolatedOriginTest, ::testing::Combine(::testing::Values(AppType::HOSTED_APP), ::testing::Bool(), ::testing::Bool())); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, HostedAppSitePerProcessTest, ::testing::Combine(::testing::Values(AppType::HOSTED_APP), @@ -2963,7 +2963,7 @@ ::testing::Bool())); #if !defined(OS_CHROMEOS) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, HostedAppBadgingTest, ::testing::Combine(::testing::Values(AppType::BOOKMARK_APP),
diff --git a/chrome/browser/ui/passwords/settings/password_access_authenticator_unittest.cc b/chrome/browser/ui/passwords/settings/password_access_authenticator_unittest.cc index 6c0ff51e..ea1e203 100644 --- a/chrome/browser/ui/passwords/settings/password_access_authenticator_unittest.cc +++ b/chrome/browser/ui/passwords/settings/password_access_authenticator_unittest.cc
@@ -128,7 +128,7 @@ EXPECT_TRUE(reauth_called); } -INSTANTIATE_TEST_CASE_P(, - PasswordAccessAuthenticatorTest, - Values(password_manager::ReauthPurpose::VIEW_PASSWORD, - password_manager::ReauthPurpose::EXPORT)); +INSTANTIATE_TEST_SUITE_P(, + PasswordAccessAuthenticatorTest, + Values(password_manager::ReauthPurpose::VIEW_PASSWORD, + password_manager::ReauthPurpose::EXPORT));
diff --git a/chrome/browser/ui/startup/credential_provider_signin_dialog_win_browsertest.cc b/chrome/browser/ui/startup/credential_provider_signin_dialog_win_browsertest.cc index 180cdb6..b646ccfe 100644 --- a/chrome/browser/ui/startup/credential_provider_signin_dialog_win_browsertest.cc +++ b/chrome/browser/ui/startup/credential_provider_signin_dialog_win_browsertest.cc
@@ -334,7 +334,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , CredentialProviderSigninDialogWinDialogExitCodeTest, ::testing::Range(0, static_cast<int>(credential_provider::kUiecCount)));
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 6415c76..ac0166b 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -1209,10 +1209,6 @@ embedded_test_server()->GetURL("/title1.html")); browser()->profile()->GetPrefs()->SetInteger( prefs::kRestoreOnStartup, 1); - // We switch off the sign-in promo too because it's behavior varies between - // platforms too much. - browser()->profile()->GetPrefs()->SetBoolean( - prefs::kSignInPromoUserSkipped, true); // Do a process-startup browser launch. base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc index 5f846086..d8d057c 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
@@ -236,9 +236,9 @@ // Note: First argument is optional and intentionally left blank. // (it's a prefix for the generated test cases) -INSTANTIATE_TEST_CASE_P(, - ToolbarActionsBarUnitTest, - testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(, + ToolbarActionsBarUnitTest, + testing::Values(false, true)); TEST_P(ToolbarActionsBarUnitTest, BasicToolbarActionsBarTest) { // Add three extensions to the profile; this is the easiest way to have
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc index 68af9c43..fd3bcb40 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc
@@ -242,7 +242,7 @@ view()->RemoveAllChildViews(true /* delete_children */); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, AutofillPopupViewNativeViewsForEveryTypeTest, ::testing::ValuesIn(kClickTestCase));
diff --git a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc index 2a64127..469f3f9 100644 --- a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc +++ b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
@@ -543,7 +543,7 @@ } bool use_cross_site_subframe() { - // This is controlled by gtest's test param from INSTANTIATE_TEST_CASE_P. + // This is controlled by gtest's test param from INSTANTIATE_TEST_SUITE_P. return GetParam(); } @@ -1284,10 +1284,12 @@ // of a drag operation, and cross-site drags should be allowed across a // navigation. -INSTANTIATE_TEST_CASE_P( - SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(SameSiteSubframe, + DragAndDropBrowserTest, + ::testing::Values(false)); -INSTANTIATE_TEST_CASE_P( - CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(CrossSiteSubframe, + DragAndDropBrowserTest, + ::testing::Values(true)); } // namespace chrome
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc index 57866a02..10c6c9b 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc
@@ -385,7 +385,7 @@ RunTest(UNINSTALL_BY_EXTENSION, EXTENSION_FROM_WEBSTORE); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , ParameterizedExtensionUninstallDialogViewBrowserTest, testing::Values(extensions::UNINSTALL_REASON_USER_INITIATED,
diff --git a/chrome/browser/ui/views/frame/browser_frame_ash_browsertest.cc b/chrome/browser/ui/views/frame/browser_frame_ash_browsertest.cc index b72a47c..392e127 100644 --- a/chrome/browser/ui/views/frame/browser_frame_ash_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_frame_ash_browsertest.cc
@@ -125,6 +125,6 @@ << (is_test_app ? "for app window" : "for tabbed browser window"); } -INSTANTIATE_TEST_CASE_P(BrowserTestTabbedOrApp, - BrowserTestParam, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(BrowserTestTabbedOrApp, + BrowserTestParam, + testing::Bool());
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc index d1eb098..cc73df2ff 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc
@@ -1507,7 +1507,7 @@ } #define INSTANTIATE_TEST_CASE(name) \ - INSTANTIATE_TEST_CASE_P(, name, ::testing::Values(false, true)) + INSTANTIATE_TEST_SUITE_P(, name, ::testing::Values(false, true)) INSTANTIATE_TEST_CASE(BrowserNonClientFrameViewAshTest); INSTANTIATE_TEST_CASE(ImmersiveModeBrowserViewTest);
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc index d9ca7b7d..3553e43 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc
@@ -44,17 +44,18 @@ web_app_info); content::TestNavigationObserver navigation_observer(GetAppURL()); navigation_observer.StartWatchingNewWebContents(); - Browser* app_browser = extensions::browsertest_util::LaunchAppBrowser( + app_browser_ = extensions::browsertest_util::LaunchAppBrowser( browser()->profile(), app); navigation_observer.WaitForNavigationFinished(); BrowserView* browser_view = - BrowserView::GetBrowserViewForBrowser(app_browser); + BrowserView::GetBrowserViewForBrowser(app_browser_); app_frame_view_ = browser_view->frame()->GetFrameView(); } protected: base::Optional<SkColor> app_theme_color_ = SK_ColorBLUE; + Browser* app_browser_ = nullptr; BrowserNonClientFrameView* app_frame_view_ = nullptr; private: @@ -150,3 +151,17 @@ ->GetFrameView() ->hosted_app_button_container_for_testing()); } + +// Tests the frame color for a bookmark app when a theme is applied. +IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewBrowserTest, + FullscreenForTabTitlebarHeight) { + InstallAndLaunchBookmarkApp(); + EXPECT_GT(app_frame_view_->GetTopInset(false), 0); + + content::WebContents* web_contents = + app_frame_view_->browser_view()->GetActiveWebContents(); + static_cast<content::WebContentsDelegate*>(app_browser_) + ->EnterFullscreenModeForTab(web_contents, web_contents->GetURL(), {}); + + EXPECT_EQ(app_frame_view_->GetTopInset(false), 0); +}
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm index 4f1e4df4..e44b7b3a 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
@@ -127,6 +127,8 @@ int BrowserNonClientFrameViewMac::GetTopInset(bool restored) const { if (hosted_app_button_container()) { DCHECK(browser_view()->IsBrowserTypeHostedApp()); + if (ShouldHideTopUIForFullscreen()) + return 0; return hosted_app_button_container()->GetPreferredSize().height() + kHostedAppMenuMargin * 2; }
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc index 04ef915..78b23af 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
@@ -398,10 +398,10 @@ ExpectWindowTitle(); } -INSTANTIATE_TEST_CASE_P(, - OpaqueBrowserFrameViewLayoutTest, - ::testing::Values(false, true), - [](const testing::TestParamInfo<bool>& param_info) { - return std::string(param_info.param ? "Maximized" - : "Restored"); - }); +INSTANTIATE_TEST_SUITE_P(, + OpaqueBrowserFrameViewLayoutTest, + ::testing::Values(false, true), + [](const testing::TestParamInfo<bool>& param_info) { + return std::string(param_info.param ? "Maximized" + : "Restored"); + });
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc index 55c709e..74403a4 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc
@@ -153,7 +153,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( /* no prefix */, IntentPickerBubbleViewBrowserTest, testing::Values("", "noopener", "noreferrer", "nofollow"));
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc index 08d8f67..601f908 100644 --- a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc +++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc
@@ -7,6 +7,8 @@ #include <memory> #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h" +#include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager_factory.h" #include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/grit/generated_resources.h" @@ -35,7 +37,9 @@ g_plugin_vm_launcher_view->GetWidget()->Show(); } -PluginVmLauncherView::PluginVmLauncherView(Profile* profile) { +PluginVmLauncherView::PluginVmLauncherView(Profile* profile) + : plugin_vm_image_manager_( + plugin_vm::PluginVmImageManagerFactory::GetForProfile(profile)) { const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, @@ -113,13 +117,10 @@ } bool PluginVmLauncherView::Cancel() { - if (state_ == State::DOWNLOADING) { - // TODO(https://crbug.com/904852): Cancel download and delete partially - // downloaded PluginVm image. - } - if (state_ == State::UNZIPPING) { - // TODO(https://crbug.com/904852): Remove PluginVm image files. - } + if (state_ == State::DOWNLOADING) + plugin_vm_image_manager_->CancelDownload(); + if (state_ == State::UNZIPPING) + plugin_vm_image_manager_->CancelUnzipping(); return true; } @@ -131,28 +132,50 @@ } PluginVmLauncherView::~PluginVmLauncherView() { + plugin_vm_image_manager_->RemoveObserver(); g_plugin_vm_launcher_view = nullptr; } +void PluginVmLauncherView::OnDownloadStarted() {} + +void PluginVmLauncherView::OnProgressUpdated( + base::Optional<double> fraction_complete) { + DCHECK_EQ(state_, State::DOWNLOADING); + if (fraction_complete.has_value()) + progress_bar_->SetValue(fraction_complete.value()); + else + progress_bar_->SetValue(-1); +} + void PluginVmLauncherView::OnDownloadCompleted() { DCHECK_EQ(state_, State::DOWNLOADING); + + plugin_vm_image_manager_->StartUnzipping(); state_ = State::UNZIPPING; OnStateUpdated(); +} - // TODO(https://crbug.com/904852): Unzip downloaded PluginVm image. +void PluginVmLauncherView::OnDownloadCancelled() {} +void PluginVmLauncherView::OnDownloadFailed() { + state_ = State::ERROR; + OnStateUpdated(); +} + +void PluginVmLauncherView::OnUnzipped() { DCHECK_EQ(state_, State::UNZIPPING); state_ = State::FINISHED; OnStateUpdated(); } -void PluginVmLauncherView::OnError() { - DCHECK(state_ == State::DOWNLOADING || state_ == State::UNZIPPING); +void PluginVmLauncherView::OnUnzippingFailed() { state_ = State::ERROR; - OnStateUpdated(); +} - // TODO(https://crbug.com/904852): Remove PluginVm image files. +plugin_vm::PluginVmImageManager* +PluginVmLauncherView::GetPluginVmImageManagerForTesting() { + return plugin_vm_image_manager_; } void PluginVmLauncherView::AddedToWidget() { @@ -194,8 +217,9 @@ } void PluginVmLauncherView::StartPluginVmImageDownload() { - // TODO(https://crbug.com/904852): Start PluginVm image download. - state_ = State::DOWNLOADING; + plugin_vm_image_manager_->SetObserver(this); + plugin_vm_image_manager_->StartDownload(); + state_ = State::DOWNLOADING; OnStateUpdated(); }
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h index 5df272e..1682e526 100644 --- a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h +++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_PLUGIN_VM_PLUGIN_VM_LAUNCHER_VIEW_H_ #include "base/macros.h" +#include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_manager.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" namespace views { @@ -19,11 +20,12 @@ // PluginVm is not yet ready to be launched. This class is responsible for // triggering the steps of the PluginVm setup process and displaying progress // according to the state of this setup. -class PluginVmLauncherView : public views::BubbleDialogDelegateView { +class PluginVmLauncherView : public views::BubbleDialogDelegateView, + public plugin_vm::PluginVmImageManager::Observer { public: explicit PluginVmLauncherView(Profile* profile); - // views::BubbleDialogDelegateView: + // views::BubbleDialogDelegateView implementation. int GetDialogButtons() const override; base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; base::string16 GetWindowTitle() const override; @@ -31,12 +33,19 @@ bool Cancel() override; gfx::Size CalculatePreferredSize() const override; - // Public for testing purposes. - void OnDownloadCompleted(); - void OnError(); + // plugin_vm::PluginVmImageDownloadObserver implementation. + void OnDownloadStarted() override; + void OnProgressUpdated(base::Optional<double> fraction_complete) override; + void OnDownloadCompleted() override; + void OnDownloadCancelled() override; + void OnDownloadFailed() override; + void OnUnzipped() override; + void OnUnzippingFailed() override; + + plugin_vm::PluginVmImageManager* GetPluginVmImageManagerForTesting(); protected: - // views::BubbleDialogDelegateView: + // views::BubbleDialogDelegateView implementation. void AddedToWidget() override; private: @@ -58,6 +67,7 @@ State state_ = State::START_DOWNLOADING; views::Label* message_label_ = nullptr; views::ProgressBar* progress_bar_ = nullptr; + plugin_vm::PluginVmImageManager* plugin_vm_image_manager_ = nullptr; DISALLOW_COPY_AND_ASSIGN(PluginVmLauncherView); };
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view_browsertest.cc b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view_browsertest.cc index 9192944..c1d6b58b 100644 --- a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view_browsertest.cc +++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view_browsertest.cc
@@ -31,6 +31,32 @@ return view_->GetDialogClientView()->cancel_button() != nullptr; } + void CheckSetupIsInProgress() { + EXPECT_TRUE(HasCancelButton()); + EXPECT_FALSE(HasAcceptButton()); + EXPECT_EQ(view_->GetWindowTitle(), + l10n_util::GetStringUTF16( + IDS_PLUGIN_VM_LAUNCHER_ENVIRONMENT_SETTING_TITLE)); + } + + void CheckSetupFailed() { + EXPECT_TRUE(HasAcceptButton()); + EXPECT_TRUE(HasCancelButton()); + EXPECT_EQ(view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), + l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_RETRY_BUTTON)); + EXPECT_EQ(view_->GetWindowTitle(), + l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_ERROR_TITLE)); + } + + void CheckSetupIsCompleted() { + EXPECT_TRUE(HasAcceptButton()); + EXPECT_FALSE(HasCancelButton()); + EXPECT_EQ(view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), + l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_LAUNCH_BUTTON)); + EXPECT_EQ(view_->GetWindowTitle(), + l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_FINISHED_TITLE)); + } + protected: PluginVmLauncherView* view_; @@ -44,54 +70,64 @@ } IN_PROC_BROWSER_TEST_F(PluginVmLauncherViewBrowserTest, SetupCompleted) { + // TODO(https://crbug.com/904852): Add a proper end-to-end test that + // checks that file specified by PluginVmImage user policy is being + // downloaded and unzipped to the specified location. + ShowUi("default"); EXPECT_NE(nullptr, view_); - EXPECT_TRUE(HasCancelButton()); - EXPECT_FALSE(HasAcceptButton()); - EXPECT_EQ(view_->GetWindowTitle(), - l10n_util::GetStringUTF16( - IDS_PLUGIN_VM_LAUNCHER_ENVIRONMENT_SETTING_TITLE)); + CheckSetupIsInProgress(); - view_->OnDownloadCompleted(); + view_->GetPluginVmImageManagerForTesting()->OnDownloadCompleted( + base::FilePath()); - EXPECT_TRUE(HasAcceptButton()); - EXPECT_FALSE(HasCancelButton()); - EXPECT_EQ(view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), - l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_LAUNCH_BUTTON)); - EXPECT_EQ(view_->GetWindowTitle(), - l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_FINISHED_TITLE)); + CheckSetupIsInProgress(); + + view_->GetPluginVmImageManagerForTesting()->OnUnzipped(true /* success */); + + CheckSetupIsCompleted(); view_->GetDialogClientView()->AcceptWindow(); EXPECT_TRUE(view_->GetWidget()->IsClosed()); } -IN_PROC_BROWSER_TEST_F(PluginVmLauncherViewBrowserTest, RetryAfterSetupError) { +IN_PROC_BROWSER_TEST_F(PluginVmLauncherViewBrowserTest, + RetryAfterDownloadFailed) { ShowUi("default"); EXPECT_NE(nullptr, view_); - EXPECT_TRUE(HasCancelButton()); - EXPECT_FALSE(HasAcceptButton()); - EXPECT_EQ(view_->GetWindowTitle(), - l10n_util::GetStringUTF16( - IDS_PLUGIN_VM_LAUNCHER_ENVIRONMENT_SETTING_TITLE)); + CheckSetupIsInProgress(); - view_->OnError(); + view_->GetPluginVmImageManagerForTesting()->OnDownloadFailed(); - EXPECT_TRUE(HasAcceptButton()); - EXPECT_TRUE(HasCancelButton()); - EXPECT_EQ(view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK), - l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_RETRY_BUTTON)); - EXPECT_EQ(view_->GetWindowTitle(), - l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_ERROR_TITLE)); + CheckSetupFailed(); // Retry button clicked to retry the download. view_->GetDialogClientView()->AcceptWindow(); - EXPECT_TRUE(HasCancelButton()); - EXPECT_FALSE(HasAcceptButton()); - EXPECT_EQ(view_->GetWindowTitle(), - l10n_util::GetStringUTF16( - IDS_PLUGIN_VM_LAUNCHER_ENVIRONMENT_SETTING_TITLE)); + CheckSetupIsInProgress(); +} + +IN_PROC_BROWSER_TEST_F(PluginVmLauncherViewBrowserTest, + RetryAfterUnzippingFailed) { + ShowUi("default"); + EXPECT_NE(nullptr, view_); + + CheckSetupIsInProgress(); + + view_->GetPluginVmImageManagerForTesting()->OnDownloadCompleted( + base::FilePath()); + + CheckSetupIsInProgress(); + + view_->GetPluginVmImageManagerForTesting()->OnUnzipped(false /* success */); + + CheckSetupFailed(); + + // Retry button clicked to retry the download. + view_->GetDialogClientView()->AcceptWindow(); + + CheckSetupIsInProgress(); }
diff --git a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc index d85868b78..6051ebb 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
@@ -601,6 +601,6 @@ browser()->OpenFile(); } -INSTANTIATE_TEST_CASE_P(SelectFileDialogExtensionBrowserTest, - SelectFileDialogExtensionBrowserTest, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(SelectFileDialogExtensionBrowserTest, + SelectFileDialogExtensionBrowserTest, + testing::Bool());
diff --git a/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc b/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc index a7ced7c..8f2d7e9 100644 --- a/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc +++ b/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
@@ -80,8 +80,9 @@ PrinterBasicInfo basic_info = ToBasicInfo(*printer); + // USER_VISIBLE because the result is displayed in the print preview dialog. base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, + FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, base::BindOnce(&GetSettingsOnBlockingPool, printer->id(), basic_info, PrinterSemanticCapsAndDefaults::Papers(), nullptr), base::BindOnce(&CapabilitiesFetched, std::move(policies), std::move(cb)));
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc index ab7ba485..2a40f3f3 100644 --- a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc +++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
@@ -76,28 +76,30 @@ using namespace cloud_devices::printer; OrientationCapability orientation; - orientation.AddOption(cloud_devices::printer::PORTRAIT); - orientation.AddOption(cloud_devices::printer::LANDSCAPE); - orientation.AddDefaultOption(AUTO_ORIENTATION, true); + orientation.AddOption(cloud_devices::printer::OrientationType::PORTRAIT); + orientation.AddOption(cloud_devices::printer::OrientationType::LANDSCAPE); + orientation.AddDefaultOption(OrientationType::AUTO_ORIENTATION, true); orientation.SaveTo(&description); ColorCapability color; { - Color standard_color(STANDARD_COLOR); + Color standard_color(ColorType::STANDARD_COLOR); standard_color.vendor_id = base::NumberToString(COLOR); color.AddDefaultOption(standard_color, true); } color.SaveTo(&description); static const cloud_devices::printer::MediaType kPdfMedia[] = { - ISO_A0, ISO_A1, ISO_A2, ISO_A3, ISO_A4, - ISO_A5, NA_LEGAL, NA_LETTER, NA_LEDGER}; + MediaType::ISO_A0, MediaType::ISO_A1, MediaType::ISO_A2, + MediaType::ISO_A3, MediaType::ISO_A4, MediaType::ISO_A5, + MediaType::NA_LEGAL, MediaType::NA_LETTER, MediaType::NA_LEDGER}; const gfx::Size default_media_size = GetDefaultPdfMediaSizeMicrons(); Media default_media("", "", default_media_size.width(), default_media_size.height()); if (!default_media.MatchBySize() || !base::ContainsValue(kPdfMedia, default_media.type)) { - default_media = Media(locale == "en-US" ? NA_LETTER : ISO_A4); + default_media = + Media(locale == "en-US" ? MediaType::NA_LETTER : MediaType::ISO_A4); } MediaCapability media; for (const auto& pdf_media : kPdfMedia) {
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc index 439d019..986e5a36 100644 --- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -476,6 +476,17 @@ base::FeatureList::IsEnabled(chromeos::features::kCrostiniUsbSupport)); } +void AddContainedShellStrings(content::WebUIDataSource* html_source) { + static constexpr LocalizedString kLocalizedStrings[] = { + {"containedShellPageTitle", IDS_SETTINGS_CONTAINED_SHELL_TITLE}, + {"containedShellPageLabel", IDS_SETTINGS_CONTAINED_SHELL_LABEL}, + {"containedShellPageSubtext", IDS_SETTINGS_CONTAINED_SHELL_SUBTEXT}, + {"containedShellTurnOn", IDS_SETTINGS_TURN_ON}, + }; + AddLocalizedStringsBulk(html_source, kLocalizedStrings, + base::size(kLocalizedStrings)); +} + void AddAndroidAppStrings(content::WebUIDataSource* html_source) { LocalizedString localized_strings[] = { {"androidAppsPageTitle", arc::IsPlayStoreAvailable() @@ -2809,6 +2820,7 @@ #if defined(OS_CHROMEOS) AddCrostiniStrings(html_source); + AddContainedShellStrings(html_source); AddAndroidAppStrings(html_source); AddBluetoothStrings(html_source); AddChromeOSUserStrings(html_source, profile);
diff --git a/chrome/browser/ui/webui/settings/md_settings_ui.cc b/chrome/browser/ui/webui/settings/md_settings_ui.cc index 4f6f9a76..0362b26 100644 --- a/chrome/browser/ui/webui/settings/md_settings_ui.cc +++ b/chrome/browser/ui/webui/settings/md_settings_ui.cc
@@ -327,6 +327,10 @@ html_source->AddBoolean("hasInternalStylus", ash::stylus_utils::HasInternalStylus()); + html_source->AddBoolean( + "showContainedShell", + base::FeatureList::IsEnabled(ash::features::kContainedShell)); + html_source->AddBoolean("showCrostini", crostini::IsCrostiniUIAllowedForProfile( profile, false /* check_policy */));
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc index 94b2f6f..da6493b 100644 --- a/chrome/browser/ui/webui/settings/people_handler.cc +++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -1068,10 +1068,6 @@ } void PeopleHandler::MarkFirstSetupComplete() { - // Suppress the sign in promo once the user starts sync. This way the user - // doesn't see the sign in promo even if they sign out later on. - signin::SetUserSkippedPromo(profile_); - syncer::SyncService* service = GetSyncService(); // The sync service may be nullptr if it has been just disabled by policy. if (!service || service->GetUserSettings()->IsFirstSetupComplete())
diff --git a/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chrome/browser/ui/webui/settings/people_handler_unittest.cc index a4fe434..d438e8e 100644 --- a/chrome/browser/ui/webui/settings/people_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -1149,10 +1149,10 @@ } } -INSTANTIATE_TEST_CASE_P(Test, - PeopleHandlerDiceUnifiedConsentTest, - ::testing::Combine(::testing::Bool(), - ::testing::Bool())); +INSTANTIATE_TEST_SUITE_P(Test, + PeopleHandlerDiceUnifiedConsentTest, + ::testing::Combine(::testing::Bool(), + ::testing::Bool())); #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) } // namespace settings
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc index bf019c91..5291a78 100644 --- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc +++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
@@ -496,7 +496,7 @@ switch (result) { case LoginUIService::CONFIGURE_SYNC_FIRST: if (consent_service) - consent_service->EnableGoogleServices(); + consent_service->SetUrlKeyedAnonymizedDataCollectionEnabled(true); delegate_->ShowSyncSettings(); break; case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: { @@ -504,7 +504,7 @@ if (sync_service) sync_service->GetUserSettings()->SetFirstSetupComplete(); if (consent_service) - consent_service->EnableGoogleServices(); + consent_service->SetUrlKeyedAnonymizedDataCollectionEnabled(true); break; } case LoginUIService::ABORT_SIGNIN:
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc index d94313c..8ad7a26 100644 --- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc +++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -628,7 +628,6 @@ const GURL& current_url = contents->GetURL(); if (skip_for_now) { - signin::SetUserSkippedPromo(Profile::FromWebUI(web_ui())); SyncStarterCallback(false); return; }
diff --git a/chrome/browser/unified_consent/unified_consent_browsertest.cc b/chrome/browser/unified_consent/unified_consent_browsertest.cc index 5c10df77..e259d14 100644 --- a/chrome/browser/unified_consent/unified_consent_browsertest.cc +++ b/chrome/browser/unified_consent/unified_consent_browsertest.cc
@@ -83,14 +83,16 @@ // Tests that all service entries in the settings histogram are recorded after // enabling them. -IN_PROC_BROWSER_TEST_F(UnifiedConsentBrowserTest, - PRE_SettingsHistogram_AllGoogleServicesEnabled) { +IN_PROC_BROWSER_TEST_F( + UnifiedConsentBrowserTest, + PRE_SettingsHistogram_UrlKeyedAnonymizedDataCollectionEnabled) { EnableSync(); - consent_service()->EnableGoogleServices(); + consent_service()->SetUrlKeyedAnonymizedDataCollectionEnabled(true); } -IN_PROC_BROWSER_TEST_F(UnifiedConsentBrowserTest, - SettingsHistogram_AllGoogleServicesEnabled) { +IN_PROC_BROWSER_TEST_F( + UnifiedConsentBrowserTest, + SettingsHistogram_UrlKeyedAnonymizedDataCollectionEnabled) { histogram_tester_.ExpectBucketCount( "UnifiedConsent.SyncAndGoogleServicesSettings", metrics::SettingsHistogramValue::kNone, 0);
diff --git a/chrome/browser/vr/elements/omnibox_formatting_unittest.cc b/chrome/browser/vr/elements/omnibox_formatting_unittest.cc index 1097601..63721c4 100644 --- a/chrome/browser/vr/elements/omnibox_formatting_unittest.cc +++ b/chrome/browser/vr/elements/omnibox_formatting_unittest.cc
@@ -133,9 +133,9 @@ kNoOffset, false, true}, }; -INSTANTIATE_TEST_CASE_P(ElisionTestCases, - ElisionTest, - ::testing::ValuesIn(elision_test_cases)); +INSTANTIATE_TEST_SUITE_P(ElisionTestCases, + ElisionTest, + ::testing::ValuesIn(elision_test_cases)); TextFormatting CreateTextUrlFormatting(const std::string& url_string, const std::string& expected_string) {
diff --git a/chrome/browser/vr/ui_scene_unittest.cc b/chrome/browser/vr/ui_scene_unittest.cc index fb67cce..b614ef8 100644 --- a/chrome/browser/vr/ui_scene_unittest.cc +++ b/chrome/browser/vr/ui_scene_unittest.cc
@@ -295,8 +295,8 @@ {RIGHT, TOP, LEFT, BOTTOM, 3, 3}, }; -INSTANTIATE_TEST_CASE_P(AlignmentTestCases, - AlignmentTest, - ::testing::ValuesIn(alignment_test_cases)); +INSTANTIATE_TEST_SUITE_P(AlignmentTestCases, + AlignmentTest, + ::testing::ValuesIn(alignment_test_cases)); } // namespace vr
diff --git a/chrome/chrome_cleaner/interfaces/typemaps/pup_typemap_unittest.cc b/chrome/chrome_cleaner/interfaces/typemaps/pup_typemap_unittest.cc index ff8b6af..b60744a9 100644 --- a/chrome/chrome_cleaner/interfaces/typemaps/pup_typemap_unittest.cc +++ b/chrome/chrome_cleaner/interfaces/typemaps/pup_typemap_unittest.cc
@@ -280,14 +280,14 @@ EXPECT_EQ(expected_to_succeed_ ? 0 : kConnectionBrokenResultCode, exit_code); } -INSTANTIATE_TEST_CASE_P(Success, - PUPTypemapTest, - testing::Combine(testing::Values(true), - testing::Values("EchoPUP", - "EchoPUP_ExtraData")), - GetParamNameForTest()); +INSTANTIATE_TEST_SUITE_P(Success, + PUPTypemapTest, + testing::Combine(testing::Values(true), + testing::Values("EchoPUP", + "EchoPUP_ExtraData")), + GetParamNameForTest()); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Failure, PUPTypemapTest, testing::Combine(testing::Values(false),
diff --git a/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc index 8fb7cdfd..583c7a0 100644 --- a/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc +++ b/chrome/chrome_cleaner/ipc/chrome_prompt_ipc_unittest.cc
@@ -381,18 +381,18 @@ EXPECT_EQ(expected_exit_code, exit_code); } -INSTANTIATE_TEST_CASE_P(NoUwSPresent, - ChromePromptIPCTest, - testing::Combine( - /*uws_expected=*/Values(false), - /*uwe_expected=*/Values(false), - /*with_registry_keys=*/Values(false), - Values(mojom::PromptAcceptance::DENIED), - Values(ParentDisconnected::kNone, - ParentDisconnected::kOnStartup)), - GetParamNameForTest()); +INSTANTIATE_TEST_SUITE_P(NoUwSPresent, + ChromePromptIPCTest, + testing::Combine( + /*uws_expected=*/Values(false), + /*uwe_expected=*/Values(false), + /*with_registry_keys=*/Values(false), + Values(mojom::PromptAcceptance::DENIED), + Values(ParentDisconnected::kNone, + ParentDisconnected::kOnStartup)), + GetParamNameForTest()); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UwSPresent, ChromePromptIPCTest, testing::Combine(
diff --git a/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc b/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc index 52db7308..e0b27ac8 100644 --- a/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc +++ b/chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc
@@ -1537,10 +1537,10 @@ // TODO(csharp) add multi-thread tests. -INSTANTIATE_TEST_CASE_P(All, - CleanerLoggingServiceTest, - testing::Values(ExecutionMode::kScanning, - ExecutionMode::kCleanup), - GetParamNameForTest()); +INSTANTIATE_TEST_SUITE_P(All, + CleanerLoggingServiceTest, + testing::Values(ExecutionMode::kScanning, + ExecutionMode::kCleanup), + GetParamNameForTest()); } // namespace chrome_cleaner
diff --git a/chrome/chrome_cleaner/logging/utils_unittest.cc b/chrome/chrome_cleaner/logging/utils_unittest.cc index ea63e160..40d9508 100644 --- a/chrome/chrome_cleaner/logging/utils_unittest.cc +++ b/chrome/chrome_cleaner/logging/utils_unittest.cc
@@ -148,7 +148,9 @@ TestPUPData test_pup_data_; }; -INSTANTIATE_TEST_CASE_P(PUPToUwS, PUPToUwSTest, ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(PUPToUwS, + PUPToUwSTest, + ::testing::Values(false, true)); TEST_P(PUPToUwSTest, PUPToUwS) { UwS uws = PUPToUwS(GetPUPWithExpectedFiles(), kUwSDetectedFlagsNone,
diff --git a/chrome/chrome_cleaner/os/file_remover_unittest.cc b/chrome/chrome_cleaner/os/file_remover_unittest.cc index 64abccd..13ca3210 100644 --- a/chrome/chrome_cleaner/os/file_remover_unittest.cc +++ b/chrome/chrome_cleaner/os/file_remover_unittest.cc
@@ -614,9 +614,9 @@ stream_path)); } -INSTANTIATE_TEST_CASE_P(All, - FileRemoverQuarantineTest, - testing::Bool(), - GetParamNameForTest()); +INSTANTIATE_TEST_SUITE_P(All, + FileRemoverQuarantineTest, + testing::Bool(), + GetParamNameForTest()); } // namespace chrome_cleaner
diff --git a/chrome/chrome_cleaner/scanner/urza_scanner_impl_unittest.cc b/chrome/chrome_cleaner/scanner/urza_scanner_impl_unittest.cc index 4ab8a780..68967d5 100644 --- a/chrome/chrome_cleaner/scanner/urza_scanner_impl_unittest.cc +++ b/chrome/chrome_cleaner/scanner/urza_scanner_impl_unittest.cc
@@ -264,10 +264,10 @@ class ScannerTestWithBitness : public ScannerTest, public ::testing::WithParamInterface<int> {}; -INSTANTIATE_TEST_CASE_P(ScannerBitnessTest, - ScannerTestWithBitness, - testing::Values(32, 64), - GetParamNameForTest()); +INSTANTIATE_TEST_SUITE_P(ScannerBitnessTest, + ScannerTestWithBitness, + testing::Values(32, 64), + GetParamNameForTest()); // A custom matcher finding an active disk footprint. bool TestCustomMatcher1(const MatchingOptions& options,
diff --git a/chrome/chrome_cleaner/settings/cleaner_settings_unittest.cc b/chrome/chrome_cleaner/settings/cleaner_settings_unittest.cc index 224c6fa..b6d671e 100644 --- a/chrome/chrome_cleaner/settings/cleaner_settings_unittest.cc +++ b/chrome/chrome_cleaner/settings/cleaner_settings_unittest.cc
@@ -69,7 +69,7 @@ EXPECT_EQ(logs_upload_allowed, settings->logs_upload_allowed()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( All, CleanerSettingsTest, ::testing::Combine(
diff --git a/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc b/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc index 830b4ff..c79c90ab 100644 --- a/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc +++ b/chrome/chrome_cleaner/ui/chrome_proxy_main_dialog_unittest.cc
@@ -139,11 +139,12 @@ run_loop.Run(); } -INSTANTIATE_TEST_CASE_P(All, - ConfirmCleanupChromeProxyMainDialogTest, - testing::Values(PromptAcceptance::ACCEPTED_WITH_LOGS, - PromptAcceptance::ACCEPTED_WITHOUT_LOGS, - PromptAcceptance::DENIED)); +INSTANTIATE_TEST_SUITE_P( + All, + ConfirmCleanupChromeProxyMainDialogTest, + testing::Values(PromptAcceptance::ACCEPTED_WITH_LOGS, + PromptAcceptance::ACCEPTED_WITHOUT_LOGS, + PromptAcceptance::DENIED)); } // namespace } // namespace chrome_cleaner
diff --git a/chrome/chrome_cleaner/ui/silent_main_dialog_unittest.cc b/chrome/chrome_cleaner/ui/silent_main_dialog_unittest.cc index b727c4c..333504fb 100644 --- a/chrome/chrome_cleaner/ui/silent_main_dialog_unittest.cc +++ b/chrome/chrome_cleaner/ui/silent_main_dialog_unittest.cc
@@ -108,11 +108,11 @@ dialog_->ConfirmCleanupIfNeeded(found_pups); } -INSTANTIATE_TEST_CASE_P(All, - ConfirmCleanupSilentMainDialogTest, - ::testing::Values(FileTypeToTest::kActive, - FileTypeToTest::kInactive), - GetParamNameForTest()); +INSTANTIATE_TEST_SUITE_P(All, + ConfirmCleanupSilentMainDialogTest, + ::testing::Values(FileTypeToTest::kActive, + FileTypeToTest::kInactive), + GetParamNameForTest()); } // namespace } // namespace chrome_cleaner
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 39da56b..b083b4f 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -1562,6 +1562,10 @@ // Defines administrator-set availability of developer tools. const char kDevToolsAvailability[] = "devtools.availability"; +// Dictionary from background service to recording expiration time. +const char kDevToolsBackgroundServicesExpirationDict[] = + "devtools.backgroundserviceexpiration"; + // Determines whether devtools should be discovering usb devices for // remote debugging at chrome://inspect. const char kDevToolsDiscoverUsbDevicesEnabled[] = @@ -1601,12 +1605,6 @@ // menu. const char kDiceSigninUserMenuPromoCount[] = "sync_promo.user_menu_show_count"; -// Tracks the number of times that we have shown the sign in promo at startup. -const char kSignInPromoStartupCount[] = "sync_promo.startup_count"; - -// Boolean tracking whether the user chose to skip the sign in promo. -const char kSignInPromoUserSkipped[] = "sync_promo.user_skipped"; - // Boolean that specifies if the sign in promo is allowed to show on first run. // This preference is specified in the master preference file to suppress the // sign in promo for some installations. @@ -1913,6 +1911,10 @@ // A boolean preference controlling Android status reporting. const char kReportArcStatusEnabled[] = "arc.status_reporting_enabled"; +// A string preference indicating the name of the OS level task scheduler +// configuration to use. +const char kSchedulerConfiguration[] = "chromeos.scheduler_configuration"; + // Dictionary indicating current network bandwidth throttling settings. // Contains a boolean (is throttling enabled) and two integers (upload rate // and download rate in kbits/s to throttle to)
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 8a2674b8..81a33aa 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -545,6 +545,7 @@ extern const char kDevToolsAdbKey[]; extern const char kDevToolsAvailability[]; +extern const char kDevToolsBackgroundServicesExpirationDict[]; extern const char kDevToolsDiscoverUsbDevicesEnabled[]; extern const char kDevToolsEditedFiles[]; extern const char kDevToolsFileSystemPaths[]; @@ -557,8 +558,6 @@ #if !defined(OS_ANDROID) extern const char kDiceSigninUserMenuPromoCount[]; -extern const char kSignInPromoStartupCount[]; -extern const char kSignInPromoUserSkipped[]; extern const char kSignInPromoShowOnFirstRunAllowed[]; extern const char kSignInPromoShowNTPBubble[]; #endif @@ -638,6 +637,7 @@ extern const char kLogoutStartedLast[]; extern const char kConsumerManagementStage[]; extern const char kReportArcStatusEnabled[]; +extern const char kSchedulerConfiguration[]; extern const char kNetworkThrottlingEnabled[]; extern const char kPowerMetricsDailySample[]; extern const char kPowerMetricsIdleScreenDimCount[];
diff --git a/chrome/common/safe_browsing/disk_image_type_sniffer_mac_unittest.cc b/chrome/common/safe_browsing/disk_image_type_sniffer_mac_unittest.cc index 7ab199c..fb4cfe72 100644 --- a/chrome/common/safe_browsing/disk_image_type_sniffer_mac_unittest.cc +++ b/chrome/common/safe_browsing/disk_image_type_sniffer_mac_unittest.cc
@@ -99,9 +99,9 @@ }; -INSTANTIATE_TEST_CASE_P(DiskImageTypeSnifferMacTestInstantiation, - DiskImageTypeSnifferMacTest, - testing::ValuesIn(cases)); +INSTANTIATE_TEST_SUITE_P(DiskImageTypeSnifferMacTestInstantiation, + DiskImageTypeSnifferMacTest, + testing::ValuesIn(cases)); TEST(DiskImageTypeSnifferMacTest, IsAppleDiskImageTrailerIsCorrect) { uint8_t good_header[4] = {'k', 'o', 'l', 'y'};
diff --git a/chrome/common/safe_browsing/ipc_protobuf_message_unittest.cc b/chrome/common/safe_browsing/ipc_protobuf_message_unittest.cc index fe27177..b663775 100644 --- a/chrome/common/safe_browsing/ipc_protobuf_message_unittest.cc +++ b/chrome/common/safe_browsing/ipc_protobuf_message_unittest.cc
@@ -157,6 +157,6 @@ } } -INSTANTIATE_TEST_CASE_P(IPCProtobufMessage, - IPCProtobufMessageTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(IPCProtobufMessage, + IPCProtobufMessageTest, + ::testing::Bool());
diff --git a/chrome/common/safe_browsing/pe_image_reader_win_unittest.cc b/chrome/common/safe_browsing/pe_image_reader_win_unittest.cc index 6d680a9..f31c417e 100644 --- a/chrome/common/safe_browsing/pe_image_reader_win_unittest.cc +++ b/chrome/common/safe_browsing/pe_image_reader_win_unittest.cc
@@ -163,12 +163,12 @@ } // namespace -INSTANTIATE_TEST_CASE_P(WordSize32, - PeImageReaderTest, - testing::Values(&kTestData[0])); -INSTANTIATE_TEST_CASE_P(WordSize64, - PeImageReaderTest, - testing::Values(&kTestData[1])); +INSTANTIATE_TEST_SUITE_P(WordSize32, + PeImageReaderTest, + testing::Values(&kTestData[0])); +INSTANTIATE_TEST_SUITE_P(WordSize64, + PeImageReaderTest, + testing::Values(&kTestData[1])); // An object exposing a PeImageReader::EnumCertificatesCallback that invokes a // virtual OnCertificate() method. This method is suitable for mocking in tests. @@ -280,15 +280,15 @@ } // namespace -INSTANTIATE_TEST_CASE_P(SignedExe, - PeImageReaderCertificateTest, - testing::Values(&kCertificateTestData[0])); -INSTANTIATE_TEST_CASE_P(UnsignedExe, - PeImageReaderCertificateTest, - testing::Values(&kCertificateTestData[1])); -INSTANTIATE_TEST_CASE_P(DisableOutdatedBuildDetectorExe, - PeImageReaderCertificateTest, - testing::Values(&kCertificateTestData[2])); -INSTANTIATE_TEST_CASE_P(SignedTwiceExe, - PeImageReaderCertificateTest, - testing::Values(&kCertificateTestData[3])); +INSTANTIATE_TEST_SUITE_P(SignedExe, + PeImageReaderCertificateTest, + testing::Values(&kCertificateTestData[0])); +INSTANTIATE_TEST_SUITE_P(UnsignedExe, + PeImageReaderCertificateTest, + testing::Values(&kCertificateTestData[1])); +INSTANTIATE_TEST_SUITE_P(DisableOutdatedBuildDetectorExe, + PeImageReaderCertificateTest, + testing::Values(&kCertificateTestData[2])); +INSTANTIATE_TEST_SUITE_P(SignedTwiceExe, + PeImageReaderCertificateTest, + testing::Values(&kCertificateTestData[3]));
diff --git a/chrome/credential_provider/test/gcp_setup_unittests.cc b/chrome/credential_provider/test/gcp_setup_unittests.cc index 9e11754..db2bec3 100644 --- a/chrome/credential_provider/test/gcp_setup_unittests.cc +++ b/chrome/credential_provider/test/gcp_setup_unittests.cc
@@ -474,13 +474,13 @@ // For a max retry of 10, it is possible to create gaia users 'gaia', // 'gaia0' ... 'gaia8' before failing. At 'gaia9' the test should fail. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AvailableGaiaUserName, GcpGaiaUserCreationTest, ::testing::Combine(::testing::Range(0, kMaxUsernameAttempts - 2), ::testing::Values(true))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UnavailableGaiaUserName, GcpGaiaUserCreationTest, ::testing::Values(std::make_tuple<int, bool>(kMaxUsernameAttempts - 1,
diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc b/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc index e94ee482..038c7fe4 100644 --- a/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc +++ b/chrome/installer/gcapi/gcapi_omaha_experiment_test.cc
@@ -198,6 +198,6 @@ VerifyExperimentLabels(expected_labels); } -INSTANTIATE_TEST_CASE_P(, GCAPIOmahaExperimentTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, GCAPIOmahaExperimentTest, ::testing::Bool()); } // namespace
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index b4c4810..1dd00fa7 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc
@@ -175,28 +175,28 @@ " BackgroundColor='#5F6368'/>\r\n" "</Application>\r\n"; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( GoogleChrome, CreateVisualElementsManifestTest, testing::Combine(testing::Values(install_static::STABLE_INDEX), testing::Values(kExpectedPrimaryManifest))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BetaChrome, CreateVisualElementsManifestTest, testing::Combine(testing::Values(install_static::BETA_INDEX), testing::Values(kExpectedBetaManifest))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DevChrome, CreateVisualElementsManifestTest, testing::Combine(testing::Values(install_static::DEV_INDEX), testing::Values(kExpectedDevManifest))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CanaryChrome, CreateVisualElementsManifestTest, testing::Combine(testing::Values(install_static::CANARY_INDEX), testing::Values(kExpectedCanaryManifest))); #else -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Chromium, CreateVisualElementsManifestTest, testing::Combine(testing::Values(install_static::CHROMIUM_INDEX), @@ -505,16 +505,15 @@ // Verify that any installer operation for any installation level triggers // the migration from sub-folder to root of start-menu. -INSTANTIATE_TEST_CASE_P( - MigrateShortcutTests, MigrateShortcutTest, +INSTANTIATE_TEST_SUITE_P( + MigrateShortcutTests, + MigrateShortcutTest, testing::Combine( testing::Values( installer::INSTALL_SHORTCUT_REPLACE_EXISTING, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL, installer::INSTALL_SHORTCUT_CREATE_ALL), - testing::Values( - installer::CURRENT_USER, - installer::ALL_USERS))); + testing::Values(installer::CURRENT_USER, installer::ALL_USERS))); TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { base::win::ShortcutProperties dummy_properties;
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc index 3e4f4a9..a90ec49 100644 --- a/chrome/installer/setup/install_worker_unittest.cc +++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -440,7 +440,7 @@ } }; -INSTANTIATE_TEST_CASE_P(AddUpdateBrandCodeWorkItemTest, - AddUpdateBrandCodeWorkItemTest, - Combine(Bool(), Bool(), Bool()), - AddUpdateBrandCodeWorkItemTestParamToString()); +INSTANTIATE_TEST_SUITE_P(AddUpdateBrandCodeWorkItemTest, + AddUpdateBrandCodeWorkItemTest, + Combine(Bool(), Bool(), Bool()), + AddUpdateBrandCodeWorkItemTestParamToString());
diff --git a/chrome/installer/setup/setup_install_details_unittest.cc b/chrome/installer/setup/setup_install_details_unittest.cc index 8e5f8d8..b53e11ff 100644 --- a/chrome/installer/setup/setup_install_details_unittest.cc +++ b/chrome/installer/setup/setup_install_details_unittest.cc
@@ -360,6 +360,6 @@ EXPECT_THAT(details->channel(), Eq(test_data().channel)); } -INSTANTIATE_TEST_CASE_P(All, - MakeInstallDetailsTest, - testing::ValuesIn(kTestData)); +INSTANTIATE_TEST_SUITE_P(All, + MakeInstallDetailsTest, + testing::ValuesIn(kTestData));
diff --git a/chrome/installer/setup/update_active_setup_version_work_item_unittest.cc b/chrome/installer/setup/update_active_setup_version_work_item_unittest.cc index 0c5c0af..545fee0 100644 --- a/chrome/installer/setup/update_active_setup_version_work_item_unittest.cc +++ b/chrome/installer/setup/update_active_setup_version_work_item_unittest.cc
@@ -149,6 +149,6 @@ } } -INSTANTIATE_TEST_CASE_P(UpdateActiveSetupVersionWorkItemTestInstance, - UpdateActiveSetupVersionWorkItemTest, - ValuesIn(kUpdateActiveSetupVersionWorkItemTestCases)); +INSTANTIATE_TEST_SUITE_P(UpdateActiveSetupVersionWorkItemTestInstance, + UpdateActiveSetupVersionWorkItemTest, + ValuesIn(kUpdateActiveSetupVersionWorkItemTestCases));
diff --git a/chrome/installer/setup/user_experiment_unittest.cc b/chrome/installer/setup/user_experiment_unittest.cc index 75a3e64..ddc53822 100644 --- a/chrome/installer/setup/user_experiment_unittest.cc +++ b/chrome/installer/setup/user_experiment_unittest.cc
@@ -181,11 +181,11 @@ EXPECT_TRUE(IsUpdateRenamePending()); } -INSTANTIATE_TEST_CASE_P(UserLevel, - UserExperimentTest, - ::testing::Values(false)); -INSTANTIATE_TEST_CASE_P(SystemLevel, - UserExperimentTest, - ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(UserLevel, + UserExperimentTest, + ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(SystemLevel, + UserExperimentTest, + ::testing::Values(true)); } // namespace installer
diff --git a/chrome/installer/util/beacons_unittest.cc b/chrome/installer/util/beacons_unittest.cc index 7953e79..1c89334a 100644 --- a/chrome/installer/util/beacons_unittest.cc +++ b/chrome/installer/util/beacons_unittest.cc
@@ -147,12 +147,12 @@ } // Run the tests for all combinations of beacon type, scope, and install level. -INSTANTIATE_TEST_CASE_P(BeaconTest, - BeaconTest, - Combine(Values(BeaconType::FIRST, BeaconType::LAST), - Values(BeaconScope::PER_USER, - BeaconScope::PER_INSTALL), - Bool())); +INSTANTIATE_TEST_SUITE_P(BeaconTest, + BeaconTest, + Combine(Values(BeaconType::FIRST, BeaconType::LAST), + Values(BeaconScope::PER_USER, + BeaconScope::PER_INSTALL), + Bool())); class DefaultBrowserBeaconTest : public ::testing::TestWithParam< @@ -224,32 +224,32 @@ #if defined(GOOGLE_CHROME_BUILD) // Stable supports user and system levels. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Stable, DefaultBrowserBeaconTest, testing::Combine(testing::Values(install_static::STABLE_INDEX), testing::Values("user", "system"))); // Beta supports user and system levels. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Beta, DefaultBrowserBeaconTest, testing::Combine(testing::Values(install_static::BETA_INDEX), testing::Values("user", "system"))); // Dev supports user and system levels. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Dev, DefaultBrowserBeaconTest, testing::Combine(testing::Values(install_static::DEV_INDEX), testing::Values("user", "system"))); // Canary is only at user level. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Canary, DefaultBrowserBeaconTest, testing::Combine(testing::Values(install_static::CANARY_INDEX), testing::Values("user"))); #else // GOOGLE_CHROME_BUILD // Chromium supports user and system levels. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Chromium, DefaultBrowserBeaconTest, testing::Combine(testing::Values(install_static::CHROMIUM_INDEX),
diff --git a/chrome/installer/util/experiment_storage_unittest.cc b/chrome/installer/util/experiment_storage_unittest.cc index 33643572..d71797b 100644 --- a/chrome/installer/util/experiment_storage_unittest.cc +++ b/chrome/installer/util/experiment_storage_unittest.cc
@@ -169,12 +169,12 @@ EXPECT_EQ(metrics, stored_metrics); } -INSTANTIATE_TEST_CASE_P(UserLevel, - ExperimentStorageTest, - ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(UserLevel, + ExperimentStorageTest, + ::testing::Values(false)); -INSTANTIATE_TEST_CASE_P(SystemLevel, - ExperimentStorageTest, - ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(SystemLevel, + ExperimentStorageTest, + ::testing::Values(true)); } // namespace installer
diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index 06330cc..c22f653 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc
@@ -855,12 +855,12 @@ } } -INSTANTIATE_TEST_CASE_P(SetProgressUserLevel, - SetProgressTest, - testing::Values(false)); -INSTANTIATE_TEST_CASE_P(SetProgressSystemLevel, - SetProgressTest, - testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(SetProgressUserLevel, + SetProgressTest, + testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(SetProgressSystemLevel, + SetProgressTest, + testing::Values(true)); // Test GoogleUpdateSettings::GetUninstallCommandLine at system- or user-level, // according to the param. @@ -918,8 +918,9 @@ GoogleUpdateSettings::GetUninstallCommandLine(!system_install_)); } -INSTANTIATE_TEST_CASE_P(GetUninstallCommandLineAtLevel, GetUninstallCommandLine, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(GetUninstallCommandLineAtLevel, + GetUninstallCommandLine, + testing::Bool()); // Test GoogleUpdateSettings::GetGoogleUpdateVersion at system- or user-level, // according to the param. @@ -978,8 +979,9 @@ .IsValid()); } -INSTANTIATE_TEST_CASE_P(GetGoogleUpdateVersionAtLevel, GetGoogleUpdateVersion, - testing::Bool()); +INSTANTIATE_TEST_SUITE_P(GetGoogleUpdateVersionAtLevel, + GetGoogleUpdateVersion, + testing::Bool()); // Test values for use by the CollectStatsConsent test fixture. class StatsState { @@ -1124,14 +1126,14 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UserLevel, CollectStatsConsent, ::testing::Values( StatsState(StatsState::kUserLevel, StatsState::NO_SETTING), StatsState(StatsState::kUserLevel, StatsState::FALSE_SETTING), StatsState(StatsState::kUserLevel, StatsState::TRUE_SETTING))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SystemLevel, CollectStatsConsent, ::testing::Values(StatsState(StatsState::kSystemLevel,
diff --git a/chrome/installer/util/product_state_unittest.cc b/chrome/installer/util/product_state_unittest.cc index 8b193e04..259aeb5 100644 --- a/chrome/installer/util/product_state_unittest.cc +++ b/chrome/installer/util/product_state_unittest.cc
@@ -372,7 +372,9 @@ } } -INSTANTIATE_TEST_CASE_P(UserLevel, ProductStateTest, ::testing::Values(false)); -INSTANTIATE_TEST_CASE_P(SystemLevel, ProductStateTest, ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(UserLevel, ProductStateTest, ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(SystemLevel, + ProductStateTest, + ::testing::Values(true)); } // namespace installer
diff --git a/chrome/renderer/chrome_content_renderer_client_browsertest.cc b/chrome/renderer/chrome_content_renderer_client_browsertest.cc index ca2da70..2ca71dac 100644 --- a/chrome/renderer/chrome_content_renderer_client_browsertest.cc +++ b/chrome/renderer/chrome_content_renderer_client_browsertest.cc
@@ -231,7 +231,6 @@ WaitForYouTubeRequest(); } -INSTANTIATE_TEST_CASE_P( - FlashEmbeds, - ChromeContentRendererClientBrowserTest, - ::testing::ValuesIn(kFlashEmbedsTestData)); +INSTANTIATE_TEST_SUITE_P(FlashEmbeds, + ChromeContentRendererClientBrowserTest, + ::testing::ValuesIn(kFlashEmbedsTestData));
diff --git a/chrome/service/cloud_print/cdd_conversion_win.cc b/chrome/service/cloud_print/cdd_conversion_win.cc index 3b055e6..e5613dd2 100644 --- a/chrome/service/cloud_print/cdd_conversion_win.cc +++ b/chrome/service/cloud_print/cdd_conversion_win.cc
@@ -35,7 +35,7 @@ { ColorTicketItem color; if (color.LoadFrom(description)) { - bool is_color = color.value().type == STANDARD_COLOR; + bool is_color = color.value().type == ColorType::STANDARD_COLOR; dev_mode = printing::CreateDevModeWithColor(printer.Get(), printer_name, is_color); } else { @@ -60,7 +60,7 @@ if (orientation.LoadFrom(description)) { dev_mode->dmFields |= DM_ORIENTATION; - if (orientation.value() == LANDSCAPE) { + if (orientation.value() == OrientationType::LANDSCAPE) { dev_mode->dmOrientation = DMORIENT_LANDSCAPE; } else { dev_mode->dmOrientation = DMORIENT_PORTRAIT; @@ -69,9 +69,9 @@ if (color.LoadFrom(description)) { dev_mode->dmFields |= DM_COLOR; - if (color.value().type == STANDARD_MONOCHROME) { + if (color.value().type == ColorType::STANDARD_MONOCHROME) { dev_mode->dmColor = DMCOLOR_MONOCHROME; - } else if (color.value().type == STANDARD_COLOR) { + } else if (color.value().type == ColorType::STANDARD_COLOR) { dev_mode->dmColor = DMCOLOR_COLOR; } else { NOTREACHED(); @@ -80,11 +80,11 @@ if (duplex.LoadFrom(description)) { dev_mode->dmFields |= DM_DUPLEX; - if (duplex.value() == NO_DUPLEX) { + if (duplex.value() == DuplexType::NO_DUPLEX) { dev_mode->dmDuplex = DMDUP_SIMPLEX; - } else if (duplex.value() == LONG_EDGE) { + } else if (duplex.value() == DuplexType::LONG_EDGE) { dev_mode->dmDuplex = DMDUP_VERTICAL; - } else if (duplex.value() == SHORT_EDGE) { + } else if (duplex.value() == DuplexType::SHORT_EDGE) { dev_mode->dmDuplex = DMDUP_HORIZONTAL; } else { NOTREACHED();
diff --git a/chrome/test/base/in_process_browser_test_browsertest.cc b/chrome/test/base/in_process_browser_test_browsertest.cc index 567c075..cfe79791 100644 --- a/chrome/test/base/in_process_browser_test_browsertest.cc +++ b/chrome/test/base/in_process_browser_test_browsertest.cc
@@ -34,9 +34,9 @@ EXPECT_EQ(0, strcmp("foo", GetParam())); } -INSTANTIATE_TEST_CASE_P(IPBTP, - InProcessBrowserTestP, - ::testing::Values("foo")); +INSTANTIATE_TEST_SUITE_P(IPBTP, + InProcessBrowserTestP, + ::testing::Values("foo")); // WebContents observer that can detect provisional load failures. class LoadFailObserver : public content::WebContentsObserver {
diff --git a/chrome/test/chromedriver/client/chromedriver.py b/chrome/test/chromedriver/client/chromedriver.py index 16299e4..c264918 100644 --- a/chrome/test/chromedriver/client/chromedriver.py +++ b/chrome/test/chromedriver/client/chromedriver.py
@@ -14,6 +14,9 @@ ELEMENT_KEY = "ELEMENT" MAX_RETRY_COUNT = 3 +# Temp code for debugging https://crbug.com/chromedriver/2778. +enable_core_dump = False + class ChromeDriverException(Exception): pass class NoSuchElement(ChromeDriverException): @@ -133,6 +136,29 @@ if not e.message.startswith('timed out'): raise else: + # Temp code for debugging https://crbug.com/chromedriver/2778. + # If enabled, trigger a core dump on first timeout. + # The code is only intended for Linux, where the above bug is observed. + global enable_core_dump + if enable_core_dump and util.GetPlatformName() == 'linux': + enable_core_dump = False + import psutil + import signal + this_process = psutil.Process() + chromedriver_process = this_process.children()[0] + if chromedriver_process.name() == 'chromedriver': + chrome_processes = chromedriver_process.children() + if len(chrome_processes) == 1: + # Remove core file size limit, then use SIGABRT to dump core. + chrome_processes[0].rlimit( + psutil.RLIMIT_CORE, + (psutil.RLIM_INFINITY, psutil.RLIM_INFINITY)) + chrome_processes[0].send_signal(signal.SIGABRT) + else: + print 'Skipping core dump as ChromeDriver has unexpected children' + else: + print 'Unable to find ChromeDriver process, skipping core dump' + if ChromeDriver.retry_count < MAX_RETRY_COUNT: ChromeDriver.retry_count = ChromeDriver.retry_count + 1 ChromeDriver.retried_tests.append(kwargs.get('test_name'))
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index 355094d4..d7cfefb 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -3362,6 +3362,10 @@ options.filter = '*-' + ':__main__.'.join([''] + negative_filter) + # Temp code for debugging https://crbug.com/chromedriver/2778. + if options.test_type is None and util.GetPlatformName() == 'linux': + chromedriver.enable_core_dump = True + all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( sys.modules[__name__]) tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter)
diff --git a/chrome/utility/safe_browsing/mac/hfs_unittest.cc b/chrome/utility/safe_browsing/mac/hfs_unittest.cc index 18a118b..2a2ecdd 100644 --- a/chrome/utility/safe_browsing/mac/hfs_unittest.cc +++ b/chrome/utility/safe_browsing/mac/hfs_unittest.cc
@@ -221,11 +221,10 @@ EXPECT_EQ(0u, buffer.size()); } -INSTANTIATE_TEST_CASE_P(HFSIteratorTest, - HFSFileReadTest, - testing::Values( - "hfs_plus.img", - "hfsx_case_sensitive.img")); +INSTANTIATE_TEST_SUITE_P(HFSIteratorTest, + HFSFileReadTest, + testing::Values("hfs_plus.img", + "hfsx_case_sensitive.img")); } // namespace } // namespace dmg
diff --git a/chrome/utility/safe_browsing/mac/udif_unittest.cc b/chrome/utility/safe_browsing/mac/udif_unittest.cc index 3b0e64f..4ead681 100644 --- a/chrome/utility/safe_browsing/mac/udif_unittest.cc +++ b/chrome/utility/safe_browsing/mac/udif_unittest.cc
@@ -251,9 +251,10 @@ {"dmg_UFBI_SPUD.dmg", kAPMExpectedPartitions, UDIFTestCase::ALL_PASS}, }; -INSTANTIATE_TEST_CASE_P(UDIFParserTest, UDIFParserTest, - testing::ValuesIn(cases), - UDIFTestCase::GetTestName); +INSTANTIATE_TEST_SUITE_P(UDIFParserTest, + UDIFParserTest, + testing::ValuesIn(cases), + UDIFTestCase::GetTestName); } // namespace } // namespace dmg
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 56e4b7ca..80804a3 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -11750.0.0 \ No newline at end of file +11752.0.0 \ No newline at end of file
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc index 22db6cb..b27c93c 100644 --- a/chromeos/dbus/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon_client.cc
@@ -530,6 +530,18 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } + void SetSchedulerConfiguration(const std::string& config_name, + VoidDBusMethodCallback callback) override { + dbus::MethodCall method_call(debugd::kDebugdInterface, + debugd::kSetSchedulerConfiguration); + dbus::MessageWriter writer(&method_call); + writer.AppendString(config_name); + debugdaemon_proxy_->CallMethod( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::BindOnce(&DebugDaemonClientImpl::OnVoidMethod, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + } + protected: void Init(dbus::Bus* bus) override { debugdaemon_proxy_ =
diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h index 36d38c7..77b259e 100644 --- a/chromeos/dbus/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon_client.h
@@ -230,6 +230,12 @@ // to 0. virtual void SetRlzPingSent(SetRlzPingSentCallback callback) = 0; + // Request switching to the scheduler configuration profile indicated. The + // profile names are defined by debugd, which adjusts various knobs affecting + // kernel level task scheduling (see debugd source code for details). + virtual void SetSchedulerConfiguration(const std::string& config_name, + VoidDBusMethodCallback callback) = 0; + // Factory function, creates a new instance and returns ownership. // For normal usage, access the singleton via DBusThreadManager::Get(). static DebugDaemonClient* Create();
diff --git a/chromeos/dbus/fake_debug_daemon_client.cc b/chromeos/dbus/fake_debug_daemon_client.cc index 5822b7e..25caecd 100644 --- a/chromeos/dbus/fake_debug_daemon_client.cc +++ b/chromeos/dbus/fake_debug_daemon_client.cc
@@ -273,4 +273,12 @@ FROM_HERE, base::BindOnce(std::move(callback), true)); } +void FakeDebugDaemonClient::SetSchedulerConfiguration( + const std::string& config_name, + VoidDBusMethodCallback callback) { + scheduler_configuration_name_ = config_name; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), true)); +} + } // namespace chromeos
diff --git a/chromeos/dbus/fake_debug_daemon_client.h b/chromeos/dbus/fake_debug_daemon_client.h index 15e2f3b..a404fb4e 100644 --- a/chromeos/dbus/fake_debug_daemon_client.h +++ b/chromeos/dbus/fake_debug_daemon_client.h
@@ -90,6 +90,8 @@ void StartConcierge(ConciergeCallback callback) override; void StopConcierge(ConciergeCallback callback) override; void SetRlzPingSent(SetRlzPingSentCallback callback) override; + void SetSchedulerConfiguration(const std::string& config_name, + VoidDBusMethodCallback callback) override; // Sets debugging features mask for testing. virtual void SetDebuggingFeaturesStatus(int features_mask); @@ -98,6 +100,10 @@ // pending callbacks if is_available is true. void SetServiceIsAvailable(bool is_available); + const std::string& scheduler_configuration_name() const { + return scheduler_configuration_name_; + } + private: int features_mask_; @@ -105,6 +111,7 @@ std::vector<WaitForServiceToBeAvailableCallback> pending_wait_for_service_to_be_available_callbacks_; std::set<std::string> printers_; + std::string scheduler_configuration_name_; DISALLOW_COPY_AND_ASSIGN(FakeDebugDaemonClient); };
diff --git a/components/autofill/core/browser/autofill_profile_sync_util.cc b/components/autofill/core/browser/autofill_profile_sync_util.cc index f54c161..8f6b3ca 100644 --- a/components/autofill/core/browser/autofill_profile_sync_util.cc +++ b/components/autofill/core/browser/autofill_profile_sync_util.cc
@@ -5,10 +5,14 @@ #include "components/autofill/core/browser/autofill_profile_sync_util.h" #include "base/guid.h" +// TODO(crbug.com/904390): Remove when the investigation is over. +#include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/autofill_profile.h" +// TODO(crbug.com/904390): Remove when the investigation is over. +#include "components/autofill/core/browser/autofill_profile_comparator.h" #include "components/autofill/core/browser/country_names.h" #include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/proto/autofill_sync.pb.h" @@ -235,4 +239,28 @@ return specifics.guid(); } +bool IsLocalProfileEqualToServerProfile( + const std::vector<std::unique_ptr<AutofillProfile>>& server_profiles, + const AutofillProfile& local_profile, + const std::string& app_locale) { + AutofillProfileComparator comparator(app_locale); + for (const auto& server_profile : server_profiles) { + // The same logic as when deciding whether to convert into a new profile in + // PersonalDataManager::MergeServerAddressesIntoProfiles. + if (comparator.AreMergeable(*server_profile, local_profile) && + (!local_profile.IsVerified() || !server_profile->IsVerified())) { + return true; + } + } + return false; +} + +void ReportAutofillProfileAddOrUpdateOrigin( + AutofillProfileSyncChangeOrigin origin) { + UMA_HISTOGRAM_ENUMERATION("Sync.AutofillProfile.AddOrUpdateOrigin", origin); +} +void ReportAutofillProfileDeleteOrigin(AutofillProfileSyncChangeOrigin origin) { + UMA_HISTOGRAM_ENUMERATION("Sync.AutofillProfile.DeleteOrigin", origin); +} + } // namespace autofill
diff --git a/components/autofill/core/browser/autofill_profile_sync_util.h b/components/autofill/core/browser/autofill_profile_sync_util.h index a435952..87d677a7 100644 --- a/components/autofill/core/browser/autofill_profile_sync_util.h +++ b/components/autofill/core/browser/autofill_profile_sync_util.h
@@ -7,6 +7,8 @@ #include <memory> #include <string> +// TODO(crbug.com/904390): Remove when the investigation is over. +#include <vector> namespace syncer { struct EntityData; @@ -40,6 +42,24 @@ std::string GetStorageKeyFromAutofillProfileSpecifics( const sync_pb::AutofillProfileSpecifics& specifics); +// TODO(crbug.com/904390): Remove when the investigation is over. +bool IsLocalProfileEqualToServerProfile( + const std::vector<std::unique_ptr<AutofillProfile>>& server_profiles, + const AutofillProfile& local_profile, + const std::string& app_locale); + +// TODO(crbug.com/904390): Remove when the investigation is over. +enum class AutofillProfileSyncChangeOrigin { + kTrulyLocal = 0, + kConvertedLocal = 1, + kIncrementalRemote = 2, + kInitial = 3, + kMaxValue = kInitial, +}; +void ReportAutofillProfileAddOrUpdateOrigin( + AutofillProfileSyncChangeOrigin origin); +void ReportAutofillProfileDeleteOrigin(AutofillProfileSyncChangeOrigin origin); + } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_SYNC_UTIL_H_
diff --git a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.cc b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.cc index 4ee20ea6..7acd59b 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.cc
@@ -49,6 +49,20 @@ // Address to this variable used as the user data key. static int kAutofillProfileSyncBridgeUserDataKey = 0; +// TODO(crbug.com/904390): Remove when the investigation is over. +base::Optional<AutofillProfile> FindLocalProfileByStorageKey( + const std::string& storage_key, + AutofillTable* table) { + std::vector<std::unique_ptr<AutofillProfile>> local_profiles; + table->GetAutofillProfiles(&local_profiles); + for (const auto& local_profile : local_profiles) { + if (storage_key == GetStorageKeyFromAutofillProfile(*local_profile)) { + return *local_profile; + } + } + return base::nullopt; +} + } // namespace // static @@ -124,8 +138,9 @@ RETURN_IF_ERROR( initial_sync_tracker.MergeSimilarEntriesForInitialSync(app_locale_)); - RETURN_IF_ERROR( - FlushSyncTracker(std::move(metadata_change_list), &initial_sync_tracker)); + RETURN_IF_ERROR(FlushSyncTracker(std::move(metadata_change_list), + &initial_sync_tracker, + AutofillProfileSyncChangeOrigin::kInitial)); web_data_backend_->NotifyThatSyncHasStarted(syncer::AUTOFILL_PROFILE); return base::nullopt; @@ -156,7 +171,8 @@ } } - return FlushSyncTracker(std::move(metadata_change_list), &tracker); + return FlushSyncTracker(std::move(metadata_change_list), &tracker, + AutofillProfileSyncChangeOrigin::kIncrementalRemote); } void AutofillProfileSyncBridge::GetData(StorageKeyList storage_keys, @@ -215,6 +231,22 @@ std::make_unique<syncer::SyncMetadataStoreChangeList>( GetAutofillTable(), syncer::AUTOFILL_PROFILE); + // TODO(crbug.com/904390): Remove when the investigation is over. + base::Optional<AutofillProfile> local_profile; + if (change.type() == AutofillProfileChange::REMOVE) { + local_profile = + FindLocalProfileByStorageKey(change.key(), GetAutofillTable()); + } else { + local_profile = *change.data_model(); + } + std::vector<std::unique_ptr<AutofillProfile>> server_profiles; + GetAutofillTable()->GetServerProfiles(&server_profiles); + bool is_converted_from_server = false; + if (local_profile != base::nullopt) { + is_converted_from_server = IsLocalProfileEqualToServerProfile( + server_profiles, *local_profile, app_locale_); + } + switch (change.type()) { case AutofillProfileChange::ADD: case AutofillProfileChange::UPDATE: @@ -222,6 +254,12 @@ change.key(), CreateEntityDataFromAutofillProfile(*change.data_model()), metadata_change_list.get()); + + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileAddOrUpdateOrigin( + is_converted_from_server + ? AutofillProfileSyncChangeOrigin::kConvertedLocal + : AutofillProfileSyncChangeOrigin::kTrulyLocal); break; case AutofillProfileChange::REMOVE: // Removals have no data_model() so this change can still be for a @@ -231,6 +269,15 @@ // TODO(jkrcal): implement a hash map of known storage_keys and use it // here. change_processor()->Delete(change.key(), metadata_change_list.get()); + + // TODO(crbug.com/904390): Remove when the investigation is over. + if (local_profile != base::nullopt) { + // Report only if we delete an existing entity. + ReportAutofillProfileDeleteOrigin( + is_converted_from_server + ? AutofillProfileSyncChangeOrigin::kConvertedLocal + : AutofillProfileSyncChangeOrigin::kTrulyLocal); + } break; case AutofillProfileChange::EXPIRE: // EXPIRE changes are not being issued for profiles. @@ -245,7 +292,8 @@ base::Optional<syncer::ModelError> AutofillProfileSyncBridge::FlushSyncTracker( std::unique_ptr<MetadataChangeList> metadata_change_list, - AutofillProfileSyncDifferenceTracker* tracker) { + AutofillProfileSyncDifferenceTracker* tracker, + AutofillProfileSyncChangeOrigin origin) { DCHECK(tracker); RETURN_IF_ERROR(tracker->FlushToLocal( @@ -259,6 +307,9 @@ change_processor()->Put(GetStorageKeyFromAutofillProfile(*entry), CreateEntityDataFromAutofillProfile(*entry), metadata_change_list.get()); + + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileAddOrUpdateOrigin(origin); } return static_cast<syncer::SyncMetadataStoreChangeList*>(
diff --git a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.h b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.h index a6e50098..9b449f4 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.h +++ b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge.h
@@ -29,6 +29,7 @@ class AutofillTable; class AutofillWebDataBackend; class AutofillWebDataService; +enum class AutofillProfileSyncChangeOrigin; // Sync bridge implementation for AUTOFILL_PROFILE model type. Takes care of // propagating local autofill profiles to other clients as well as incorporating @@ -90,7 +91,9 @@ // Flushes changes accumulated within |tracker| both to local and to sync. base::Optional<syncer::ModelError> FlushSyncTracker( std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, - AutofillProfileSyncDifferenceTracker* tracker); + AutofillProfileSyncDifferenceTracker* tracker, + // TODO(crbug.com/904390): Remove |origin| when the investigation is over. + AutofillProfileSyncChangeOrigin origin); // Synchronously load sync metadata from the autofill table and pass it to the // processor so that it can start tracking changes.
diff --git a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc index 552c2dab..08e50b60 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc
@@ -1208,7 +1208,7 @@ EXPECT_THAT(GetAllLocalData(), ElementsAre(WithUsageStats(merged))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AutofillProfileSyncBridgeTest, AutofillProfileSyncBridgeUpdatesUsageStatsTest, testing::Values(
diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc index 51d3cb7..f3c90a6d 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
@@ -17,6 +17,8 @@ #include "components/autofill/core/browser/autofill_country.h" #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/autofill_profile_comparator.h" +// TODO(crbug.com/904390): Remove when the investigation is over. +#include "components/autofill/core/browser/autofill_profile_sync_util.h" #include "components/autofill/core/browser/country_names.h" #include "components/autofill/core/browser/form_group.h" #include "components/autofill/core/browser/webdata/autofill_table.h" @@ -184,6 +186,10 @@ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, CreateData(*(it.second)))); + + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileAddOrUpdateOrigin( + AutofillProfileSyncChangeOrigin::kInitial); profiles_map_[it.first] = it.second; } @@ -192,6 +198,10 @@ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE, CreateData(*(bundle.profiles_to_sync_back[i])))); + + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileAddOrUpdateOrigin( + AutofillProfileSyncChangeOrigin::kInitial); } if (!new_changes.empty()) { @@ -603,6 +613,24 @@ return; } + // TODO(crbug.com/904390): Remove when the investigation is over. + const AutofillProfile* local_profile = nullptr; + if (change.type() == AutofillProfileChange::REMOVE) { + if (profiles_map_.find(change.key()) != profiles_map_.end()) { + local_profile = profiles_map_[change.key()]; + } + } else { + local_profile = change.data_model(); + } + bool is_converted_from_server = false; + // |webdata_backend_| may be null in unit-tests. + if (local_profile != nullptr && webdata_backend_ != nullptr) { + std::vector<std::unique_ptr<AutofillProfile>> server_profiles; + GetAutofillTable()->GetServerProfiles(&server_profiles); + is_converted_from_server = IsLocalProfileEqualToServerProfile( + server_profiles, *local_profile, app_locale_); + } + syncer::SyncChangeList new_changes; DataBundle bundle; switch (change.type()) { @@ -616,6 +644,12 @@ profiles_.push_back( std::make_unique<AutofillProfile>(*(change.data_model()))); profiles_map_[change.data_model()->guid()] = profiles_.back().get(); + + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileAddOrUpdateOrigin( + is_converted_from_server + ? AutofillProfileSyncChangeOrigin::kConvertedLocal + : AutofillProfileSyncChangeOrigin::kTrulyLocal); break; case AutofillProfileChange::UPDATE: { auto it = profiles_map_.find(change.data_model()->guid()); @@ -625,6 +659,12 @@ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE, CreateData(*(change.data_model())))); + + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileAddOrUpdateOrigin( + is_converted_from_server + ? AutofillProfileSyncChangeOrigin::kConvertedLocal + : AutofillProfileSyncChangeOrigin::kTrulyLocal); break; } case AutofillProfileChange::REMOVE: { @@ -636,6 +676,11 @@ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_DELETE, CreateData(empty_profile))); profiles_map_.erase(change.key()); + // TODO(crbug.com/904390): Remove when the investigation is over. + ReportAutofillProfileDeleteOrigin( + is_converted_from_server + ? AutofillProfileSyncChangeOrigin::kConvertedLocal + : AutofillProfileSyncChangeOrigin::kTrulyLocal); } break; }
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc index 956aee63..af355624 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc
@@ -884,8 +884,8 @@ bridge()->ApplyStopSyncChanges(/*delete_metadata_change_list=*/nullptr); } -INSTANTIATE_TEST_CASE_P(USS, - AutofillWalletSyncBridgeTest, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(USS, + AutofillWalletSyncBridgeTest, + ::testing::Values(false, true)); } // namespace autofill
diff --git a/components/browser_sync/profile_sync_components_factory_impl.cc b/components/browser_sync/profile_sync_components_factory_impl.cc index a624a77..77fc254 100644 --- a/components/browser_sync/profile_sync_components_factory_impl.cc +++ b/components/browser_sync/profile_sync_components_factory_impl.cc
@@ -29,7 +29,6 @@ #include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/sync/password_data_type_controller.h" #include "components/password_manager/core/browser/sync/password_model_type_controller.h" -#include "components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.h" #include "components/prefs/pref_service.h" #include "components/reading_list/features/reading_list_switches.h" #include "components/sync/base/report_unrecoverable_error.h" @@ -338,14 +337,6 @@ std::make_unique<password_manager::PasswordModelTypeController>( password_store_->CreateSyncControllerDelegate(), sync_service, sync_client_->GetPasswordStateChangedCallback())); - } else if (base::FeatureList::IsEnabled( - switches::kSyncPseudoUSSPasswords)) { - controllers.push_back( - std::make_unique<password_manager:: - PasswordSyncableServiceBasedModelTypeController>( - sync_client_->GetModelTypeStoreService()->GetStoreFactory(), - dump_stack, password_store_, sync_service, sync_client_, - sync_client_->GetPasswordStateChangedCallback())); } else { controllers.push_back(std::make_unique<PasswordDataTypeController>( dump_stack, sync_service, sync_client_,
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index c4138de..dbd27d7 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -516,21 +516,7 @@ debug_identifier_, base::BindRepeating(&syncer::SyncClient::CreateModelWorkerForGroup, base::Unretained(sync_client_.get()))); - params.encryption_observer_proxies.push_back( - crypto_.GetEncryptionObserverProxy()); - - // Let datatypes install their own proxy encryption observers that receive - // updates from the sync thread. Currently, this is necessary for pseudo-USS - // PASSWORDS only. - for (const std::pair<const syncer::ModelType, - std::unique_ptr<DataTypeController>>& - type_and_controller : data_type_controllers_) { - std::unique_ptr<syncer::SyncEncryptionHandler::Observer> proxy_observer = - type_and_controller.second->GetEncryptionObserverProxy(); - if (proxy_observer) { - params.encryption_observer_proxies.push_back(std::move(proxy_observer)); - } - } + params.encryption_observer_proxy = crypto_.GetEncryptionObserverProxy(); params.extensions_activity = sync_client_->GetExtensionsActivity(); params.event_handler = GetJsEventHandler();
diff --git a/components/browser_sync/profile_sync_service_autofill_unittest.cc b/components/browser_sync/profile_sync_service_autofill_unittest.cc index 84f22c1..7051642 100644 --- a/components/browser_sync/profile_sync_service_autofill_unittest.cc +++ b/components/browser_sync/profile_sync_service_autofill_unittest.cc
@@ -144,6 +144,11 @@ MOCK_METHOD1(UpdateAutofillProfile, bool(const AutofillProfile&)); // NOLINT MOCK_METHOD1(AddAutofillProfile, bool(const AutofillProfile&)); // NOLINT MOCK_METHOD1(RemoveAutofillProfile, bool(const std::string&)); // NOLINT + + // TODO(crbug.com/904390): Remove when the investigation is over. + MOCK_CONST_METHOD1( + GetServerProfiles, + bool(std::vector<std::unique_ptr<AutofillProfile>>*)); // NOLINT }; MATCHER_P(MatchProfiles, profile, "") { @@ -950,6 +955,10 @@ "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549"); + // TODO(crbug.com/904390): Remove when the investigation is over. This call is + // needed in the AutofillProfileChanged() callback. + EXPECT_CALL(autofill_table(), GetServerProfiles(_)).WillOnce(Return(true)); + AutofillProfileChange change(AutofillProfileChange::ADD, added_profile.guid(), &added_profile); web_data_service()->OnAutofillProfileChanged(change); @@ -989,6 +998,10 @@ StartAutofillProfileSyncService(add_autofill.callback()); ASSERT_TRUE(add_autofill.success()); + // TODO(crbug.com/904390): Remove when the investigation is over. This call is + // needed in the AutofillProfileChanged() callback. + EXPECT_CALL(autofill_table(), GetServerProfiles(_)).WillOnce(Return(true)); + AutofillProfileChange change(AutofillProfileChange::REMOVE, sync_profile.guid(), nullptr); web_data_service()->OnAutofillProfileChanged(change);
diff --git a/components/browser_watcher/postmortem_report_collector_unittest.cc b/components/browser_watcher/postmortem_report_collector_unittest.cc index 86e2ee7..2086aab 100644 --- a/components/browser_watcher/postmortem_report_collector_unittest.cc +++ b/components/browser_watcher/postmortem_report_collector_unittest.cc
@@ -209,12 +209,12 @@ ValidateHistograms(expected_unclean, expected_system_unclean); } -INSTANTIATE_TEST_CASE_P(WithCrashDatabase, - PostmortemReportCollectorProcessTest, - ::testing::Values(true)); -INSTANTIATE_TEST_CASE_P(WithoutCrashDatabase, - PostmortemReportCollectorProcessTest, - ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(WithCrashDatabase, + PostmortemReportCollectorProcessTest, + ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(WithoutCrashDatabase, + PostmortemReportCollectorProcessTest, + ::testing::Values(true)); TEST(PostmortemReportCollectorTest, CollectEmptyFile) { // Create an empty file.
diff --git a/components/cloud_devices/common/printer_description.cc b/components/cloud_devices/common/printer_description.cc index ae143c8..89d74914 100644 --- a/components/cloud_devices/common/printer_description.cc +++ b/components/cloud_devices/common/printer_description.cc
@@ -109,68 +109,71 @@ ColorType id; const char* const json_name; } kColorNames[] = { - {STANDARD_COLOR, kTypeColorColor}, - {STANDARD_MONOCHROME, kTypeColorMonochrome}, - {CUSTOM_COLOR, kTypeColorCustomColor}, - {CUSTOM_MONOCHROME, kTypeColorCustomMonochrome}, - {AUTO_COLOR, kTypeColorAuto}, + {ColorType::STANDARD_COLOR, kTypeColorColor}, + {ColorType::STANDARD_MONOCHROME, kTypeColorMonochrome}, + {ColorType::CUSTOM_COLOR, kTypeColorCustomColor}, + {ColorType::CUSTOM_MONOCHROME, kTypeColorCustomMonochrome}, + {ColorType::AUTO_COLOR, kTypeColorAuto}, }; const struct DuplexNames { DuplexType id; const char* const json_name; } kDuplexNames[] = { - {NO_DUPLEX, kTypeDuplexNoDuplex}, - {LONG_EDGE, kTypeDuplexLongEdge}, - {SHORT_EDGE, kTypeDuplexShortEdge}, + {DuplexType::NO_DUPLEX, kTypeDuplexNoDuplex}, + {DuplexType::LONG_EDGE, kTypeDuplexLongEdge}, + {DuplexType::SHORT_EDGE, kTypeDuplexShortEdge}, }; const struct OrientationNames { OrientationType id; const char* const json_name; } kOrientationNames[] = { - {PORTRAIT, kTypeOrientationPortrait}, - {LANDSCAPE, kTypeOrientationLandscape}, - {AUTO_ORIENTATION, kTypeOrientationAuto}, + {OrientationType::PORTRAIT, kTypeOrientationPortrait}, + {OrientationType::LANDSCAPE, kTypeOrientationLandscape}, + {OrientationType::AUTO_ORIENTATION, kTypeOrientationAuto}, }; const struct MarginsNames { MarginsType id; const char* const json_name; } kMarginsNames[] = { - {NO_MARGINS, kTypeMarginsBorderless}, - {STANDARD_MARGINS, kTypeMarginsStandard}, - {CUSTOM_MARGINS, kTypeMarginsCustom}, + {MarginsType::NO_MARGINS, kTypeMarginsBorderless}, + {MarginsType::STANDARD_MARGINS, kTypeMarginsStandard}, + {MarginsType::CUSTOM_MARGINS, kTypeMarginsCustom}, }; const struct FitToPageNames { FitToPageType id; const char* const json_name; } kFitToPageNames[] = { - {NO_FITTING, kTypeFitToPageNoFitting}, - {FIT_TO_PAGE, kTypeFitToPageFitToPage}, - {GROW_TO_PAGE, kTypeFitToPageGrowToPage}, - {SHRINK_TO_PAGE, kTypeFitToPageShrinkToPage}, - {FILL_PAGE, kTypeFitToPageFillPage}, + {FitToPageType::NO_FITTING, kTypeFitToPageNoFitting}, + {FitToPageType::FIT_TO_PAGE, kTypeFitToPageFitToPage}, + {FitToPageType::GROW_TO_PAGE, kTypeFitToPageGrowToPage}, + {FitToPageType::SHRINK_TO_PAGE, kTypeFitToPageShrinkToPage}, + {FitToPageType::FILL_PAGE, kTypeFitToPageFillPage}, }; const struct DocumentSheetBackNames { DocumentSheetBack id; const char* const json_name; } kDocumentSheetBackNames[] = { - {NORMAL, kTypeDocumentSheetBackNormal}, - {ROTATED, kTypeDocumentSheetBackRotated}, - {MANUAL_TUMBLE, kTypeDocumentSheetBackManualTumble}, - {FLIPPED, kTypeDocumentSheetBackFlipped}}; + {DocumentSheetBack::NORMAL, kTypeDocumentSheetBackNormal}, + {DocumentSheetBack::ROTATED, kTypeDocumentSheetBackRotated}, + {DocumentSheetBack::MANUAL_TUMBLE, kTypeDocumentSheetBackManualTumble}, + {DocumentSheetBack::FLIPPED, kTypeDocumentSheetBackFlipped}}; const int32_t kInchToUm = 25400; const int32_t kMmToUm = 1000; const int32_t kSizeTrasholdUm = 1000; +// Json name of media type is constructed by removing "MediaType::" enum class +// prefix from it. #define MAP_CLOUD_PRINT_MEDIA_TYPE(type, width, height, unit_um) \ { \ - type, #type, static_cast<int>(width* unit_um + 0.5), \ - static_cast<int>(height* unit_um + 0.5) \ + type, &#type[strlen("MediaType::")], \ + static_cast<int>(width * unit_um + 0.5), \ + static_cast<int>(height * unit_um + 0.5) \ } const struct MediaDefinition { @@ -179,171 +182,189 @@ int width_um; int height_um; } kMediaDefinitions[] = { - {CUSTOM_MEDIA, "CUSTOM", 0, 0}, - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_INDEX_3X5, 3, 5, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_PERSONAL, 3.625f, 6.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_MONARCH, 3.875f, 7.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_NUMBER_9, 3.875f, 8.875f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_INDEX_4X6, 4, 6, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_NUMBER_10, 4.125f, 9.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_A2, 4.375f, 5.75f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_NUMBER_11, 4.5f, 10.375f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_NUMBER_12, 4.75f, 11, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_5X7, 5, 7, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_INDEX_5X8, 5, 8, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_NUMBER_14, 5, 11.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_INVOICE, 5.5f, 8.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_INDEX_4X6_EXT, 6, 8, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_6X9, 6, 9, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_C5, 6.5f, 9.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_7X9, 7, 9, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_EXECUTIVE, 7.25f, 10.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_GOVT_LETTER, 8, 10, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_GOVT_LEGAL, 8, 13, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_QUARTO, 8.5f, 10.83f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_LETTER, 8.5f, 11, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_FANFOLD_EUR, 8.5f, 12, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_LETTER_PLUS, 8.5f, 12.69f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_FOOLSCAP, 8.5f, 13, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_LEGAL, 8.5f, 14, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_SUPER_A, 8.94f, 14, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_9X11, 9, 11, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_ARCH_A, 9, 12, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_LETTER_EXTRA, 9.5f, 12, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_LEGAL_EXTRA, 9.5f, 15, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_10X11, 10, 11, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_10X13, 10, 13, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_10X14, 10, 14, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_10X15, 10, 15, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_11X12, 11, 12, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_EDP, 11, 14, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_FANFOLD_US, 11, 14.875f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_11X15, 11, 15, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_LEDGER, 11, 17, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_EUR_EDP, 12, 14, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_ARCH_B, 12, 18, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_12X19, 12, 19, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_B_PLUS, 12, 19.17f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_SUPER_B, 13, 19, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_C, 17, 22, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_ARCH_C, 18, 24, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_D, 22, 34, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_ARCH_D, 24, 36, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_ASME_F, 28, 40, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_WIDE_FORMAT, 30, 42, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_E, 34, 44, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_ARCH_E, 36, 48, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(NA_F, 44, 68, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ROC_16K, 7.75f, 10.75f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ROC_8K, 10.75f, 15.5f, kInchToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_32K, 97, 151, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_1, 102, 165, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_2, 102, 176, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_4, 110, 208, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_5, 110, 220, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_8, 120, 309, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_6, 120, 230, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_3, 125, 176, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_16K, 146, 215, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_7, 160, 230, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_JUURO_KU_KAI, 198, 275, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_PA_KAI, 267, 389, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_DAI_PA_KAI, 275, 395, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(PRC_10, 324, 458, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A10, 26, 37, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A9, 37, 52, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A8, 52, 74, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A7, 74, 105, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A6, 105, 148, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A5, 148, 210, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A5_EXTRA, 174, 235, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4, 210, 297, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4_TAB, 225, 297, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4_EXTRA, 235, 322, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3, 297, 420, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X3, 297, 630, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X4, 297, 841, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X5, 297, 1051, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X6, 297, 1261, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X7, 297, 1471, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X8, 297, 1682, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A4X9, 297, 1892, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3_EXTRA, 322, 445, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A2, 420, 594, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3X3, 420, 891, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3X4, 420, 1189, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3X5, 420, 1486, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3X6, 420, 1783, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A3X7, 420, 2080, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A1, 594, 841, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A2X3, 594, 1261, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A2X4, 594, 1682, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A2X5, 594, 2102, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A0, 841, 1189, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A1X3, 841, 1783, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A1X4, 841, 2378, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_2A0, 1189, 1682, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_A0X3, 1189, 2523, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B10, 31, 44, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B9, 44, 62, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B8, 62, 88, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B7, 88, 125, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B6, 125, 176, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B6C4, 125, 324, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B5, 176, 250, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B5_EXTRA, 201, 276, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B4, 250, 353, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B3, 353, 500, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B2, 500, 707, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B1, 707, 1000, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_B0, 1000, 1414, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C10, 28, 40, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C9, 40, 57, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C8, 57, 81, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C7, 81, 114, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C7C6, 81, 162, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C6, 114, 162, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C6C5, 114, 229, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C5, 162, 229, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C4, 229, 324, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C3, 324, 458, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C2, 458, 648, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C1, 648, 917, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_C0, 917, 1297, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_DL, 110, 220, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_RA2, 430, 610, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_SRA2, 450, 640, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_RA1, 610, 860, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_SRA1, 640, 900, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_RA0, 860, 1220, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(ISO_SRA0, 900, 1280, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B10, 32, 45, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B9, 45, 64, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B8, 64, 91, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B7, 91, 128, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B6, 128, 182, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B5, 182, 257, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B4, 257, 364, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B3, 364, 515, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B2, 515, 728, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B1, 728, 1030, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_B0, 1030, 1456, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JIS_EXEC, 216, 330, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_CHOU4, 90, 205, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_HAGAKI, 100, 148, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_YOU4, 105, 235, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_CHOU2, 111.1f, 146, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_CHOU3, 120, 235, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_OUFUKU, 148, 200, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_KAHU, 240, 322.1f, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(JPN_KAKU2, 240, 332, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_SMALL_PHOTO, 100, 150, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_ITALIAN, 110, 230, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_POSTFIX, 114, 229, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_LARGE_PHOTO, 200, 300, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_FOLIO, 210, 330, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_FOLIO_SP, 215, 315, kMmToUm), - MAP_CLOUD_PRINT_MEDIA_TYPE(OM_INVITE, 220, 220, kMmToUm)}; + {MediaType::CUSTOM_MEDIA, "CUSTOM", 0, 0}, + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_INDEX_3X5, 3, 5, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_PERSONAL, 3.625f, 6.5f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_MONARCH, 3.875f, 7.5f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_NUMBER_9, + 3.875f, + 8.875f, + kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_INDEX_4X6, 4, 6, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_NUMBER_10, + 4.125f, + 9.5f, + kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_A2, 4.375f, 5.75f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_NUMBER_11, + 4.5f, + 10.375f, + kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_NUMBER_12, 4.75f, 11, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_5X7, 5, 7, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_INDEX_5X8, 5, 8, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_NUMBER_14, 5, 11.5f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_INVOICE, 5.5f, 8.5f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_INDEX_4X6_EXT, 6, 8, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_6X9, 6, 9, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_C5, 6.5f, 9.5f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_7X9, 7, 9, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_EXECUTIVE, + 7.25f, + 10.5f, + kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_GOVT_LETTER, 8, 10, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_GOVT_LEGAL, 8, 13, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_QUARTO, 8.5f, 10.83f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_LETTER, 8.5f, 11, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_FANFOLD_EUR, 8.5f, 12, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_LETTER_PLUS, + 8.5f, + 12.69f, + kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_FOOLSCAP, 8.5f, 13, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_LEGAL, 8.5f, 14, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_SUPER_A, 8.94f, 14, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_9X11, 9, 11, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_ARCH_A, 9, 12, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_LETTER_EXTRA, 9.5f, 12, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_LEGAL_EXTRA, 9.5f, 15, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_10X11, 10, 11, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_10X13, 10, 13, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_10X14, 10, 14, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_10X15, 10, 15, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_11X12, 11, 12, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_EDP, 11, 14, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_FANFOLD_US, + 11, + 14.875f, + kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_11X15, 11, 15, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_LEDGER, 11, 17, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_EUR_EDP, 12, 14, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_ARCH_B, 12, 18, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_12X19, 12, 19, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_B_PLUS, 12, 19.17f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_SUPER_B, 13, 19, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_C, 17, 22, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_ARCH_C, 18, 24, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_D, 22, 34, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_ARCH_D, 24, 36, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_ASME_F, 28, 40, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_WIDE_FORMAT, 30, 42, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_E, 34, 44, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_ARCH_E, 36, 48, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::NA_F, 44, 68, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ROC_16K, 7.75f, 10.75f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ROC_8K, 10.75f, 15.5f, kInchToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_32K, 97, 151, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_1, 102, 165, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_2, 102, 176, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_4, 110, 208, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_5, 110, 220, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_8, 120, 309, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_6, 120, 230, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_3, 125, 176, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_16K, 146, 215, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_7, 160, 230, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_JUURO_KU_KAI, 198, 275, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_PA_KAI, 267, 389, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_DAI_PA_KAI, 275, 395, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::PRC_10, 324, 458, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A10, 26, 37, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A9, 37, 52, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A8, 52, 74, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A7, 74, 105, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A6, 105, 148, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A5, 148, 210, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A5_EXTRA, 174, 235, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4, 210, 297, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4_TAB, 225, 297, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4_EXTRA, 235, 322, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3, 297, 420, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X3, 297, 630, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X4, 297, 841, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X5, 297, 1051, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X6, 297, 1261, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X7, 297, 1471, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X8, 297, 1682, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A4X9, 297, 1892, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3_EXTRA, 322, 445, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A2, 420, 594, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3X3, 420, 891, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3X4, 420, 1189, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3X5, 420, 1486, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3X6, 420, 1783, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A3X7, 420, 2080, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A1, 594, 841, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A2X3, 594, 1261, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A2X4, 594, 1682, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A2X5, 594, 2102, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A0, 841, 1189, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A1X3, 841, 1783, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A1X4, 841, 2378, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_2A0, 1189, 1682, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_A0X3, 1189, 2523, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B10, 31, 44, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B9, 44, 62, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B8, 62, 88, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B7, 88, 125, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B6, 125, 176, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B6C4, 125, 324, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B5, 176, 250, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B5_EXTRA, 201, 276, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B4, 250, 353, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B3, 353, 500, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B2, 500, 707, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B1, 707, 1000, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_B0, 1000, 1414, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C10, 28, 40, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C9, 40, 57, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C8, 57, 81, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C7, 81, 114, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C7C6, 81, 162, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C6, 114, 162, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C6C5, 114, 229, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C5, 162, 229, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C4, 229, 324, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C3, 324, 458, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C2, 458, 648, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C1, 648, 917, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_C0, 917, 1297, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_DL, 110, 220, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_RA2, 430, 610, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_SRA2, 450, 640, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_RA1, 610, 860, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_SRA1, 640, 900, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_RA0, 860, 1220, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::ISO_SRA0, 900, 1280, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B10, 32, 45, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B9, 45, 64, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B8, 64, 91, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B7, 91, 128, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B6, 128, 182, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B5, 182, 257, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B4, 257, 364, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B3, 364, 515, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B2, 515, 728, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B1, 728, 1030, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_B0, 1030, 1456, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JIS_EXEC, 216, 330, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_CHOU4, 90, 205, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_HAGAKI, 100, 148, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_YOU4, 105, 235, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_CHOU2, 111.1f, 146, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_CHOU3, 120, 235, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_OUFUKU, 148, 200, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_KAHU, 240, 322.1f, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::JPN_KAKU2, 240, 332, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_SMALL_PHOTO, 100, 150, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_ITALIAN, 110, 230, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_POSTFIX, 114, 229, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_LARGE_PHOTO, 200, 300, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_FOLIO, 210, 330, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_FOLIO_SP, 215, 315, kMmToUm), + MAP_CLOUD_PRINT_MEDIA_TYPE(MediaType::OM_INVITE, 220, 220, kMmToUm)}; #undef MAP_CLOUD_PRINT_MEDIA_TYPE const MediaDefinition& FindMediaByType(MediaType type) { @@ -391,15 +412,13 @@ } // namespace PwgRasterConfig::PwgRasterConfig() - : document_sheet_back(ROTATED), + : document_sheet_back(DocumentSheetBack::ROTATED), reverse_order_streaming(false), - rotate_all_pages(false) { -} + rotate_all_pages(false) {} PwgRasterConfig::~PwgRasterConfig() {} -Color::Color() : type(AUTO_COLOR) { -} +Color::Color() : type(ColorType::AUTO_COLOR) {} Color::Color(ColorType type) : type(type) { } @@ -410,14 +429,17 @@ } bool Color::IsValid() const { - if (type != CUSTOM_COLOR && type != CUSTOM_MONOCHROME) + if (type != ColorType::CUSTOM_COLOR && type != ColorType::CUSTOM_MONOCHROME) return true; return !vendor_id.empty() && !custom_display_name.empty(); } Margins::Margins() - : type(STANDARD_MARGINS), top_um(0), right_um(0), bottom_um(0), left_um(0) { -} + : type(MarginsType::STANDARD_MARGINS), + top_um(0), + right_um(0), + bottom_um(0), + left_um(0) {} Margins::Margins(MarginsType type, int32_t top_um, @@ -450,8 +472,10 @@ } Media::Media() - : type(CUSTOM_MEDIA), width_um(0), height_um(0), is_continuous_feed(false) { -} + : type(MediaType::CUSTOM_MEDIA), + width_um(0), + height_um(0), + is_continuous_feed(false) {} Media::Media(MediaType type) : type(type), @@ -474,7 +498,7 @@ const std::string& vendor_id, int32_t width_um, int32_t height_um) - : type(CUSTOM_MEDIA), + : type(MediaType::CUSTOM_MEDIA), width_um(width_um), height_um(height_um), is_continuous_feed(width_um <= 0 || height_um <= 0), @@ -581,10 +605,13 @@ return false; const std::string& type = type_value.GetString(); - if (type == kTypeDocumentSupportedTypeSRGB8) - option_out.document_types_supported.push_back(SRGB_8); - else if (type == kTypeDocumentSupportedTypeSGRAY8) - option_out.document_types_supported.push_back(SGRAY_8); + if (type == kTypeDocumentSupportedTypeSRGB8) { + option_out.document_types_supported.push_back( + PwgDocumentTypeSupported::SRGB_8); + } else if (type == kTypeDocumentSupportedTypeSGRAY8) { + option_out.document_types_supported.push_back( + PwgDocumentTypeSupported::SGRAY_8); + } } } @@ -605,11 +632,11 @@ base::Value::ListStorage supported_list; for (const auto& type : option.document_types_supported) { switch (type) { - case SRGB_8: + case PwgDocumentTypeSupported::SRGB_8: supported_list.push_back( base::Value(kTypeDocumentSupportedTypeSRGB8)); break; - case SGRAY_8: + case PwgDocumentTypeSupported::SGRAY_8: supported_list.push_back( base::Value(kTypeDocumentSupportedTypeSGRAY8)); break; @@ -837,11 +864,12 @@ } static void Save(const Media& option, base::Value* dict) { - if (option.type != CUSTOM_MEDIA) { + if (option.type != MediaType::CUSTOM_MEDIA) { dict->SetKey(kKeyName, base::Value(TypeToString(kMediaDefinitions, option.type))); } - if (!option.custom_display_name.empty() || option.type == CUSTOM_MEDIA) { + if (!option.custom_display_name.empty() || + option.type == MediaType::CUSTOM_MEDIA) { dict->SetKey(kKeyCustomDisplayName, base::Value(option.custom_display_name)); }
diff --git a/components/cloud_devices/common/printer_description.h b/components/cloud_devices/common/printer_description.h index 344075f8..a688a23b 100644 --- a/components/cloud_devices/common/printer_description.h +++ b/components/cloud_devices/common/printer_description.h
@@ -22,9 +22,14 @@ typedef std::string ContentType; -enum DocumentSheetBack { NORMAL, ROTATED, MANUAL_TUMBLE, FLIPPED }; +enum class DocumentSheetBack { + NORMAL, + ROTATED, + MANUAL_TUMBLE, + FLIPPED, +}; -enum PwgDocumentTypeSupported { +enum class PwgDocumentTypeSupported { SGRAY_8 = 22, SRGB_8 = 23, }; @@ -39,7 +44,7 @@ bool rotate_all_pages; }; -enum ColorType { +enum class ColorType { STANDARD_COLOR, STANDARD_MONOCHROME, CUSTOM_COLOR, @@ -60,19 +65,19 @@ std::string custom_display_name; }; -enum DuplexType { +enum class DuplexType { NO_DUPLEX, LONG_EDGE, SHORT_EDGE, }; -enum OrientationType { +enum class OrientationType { PORTRAIT, LANDSCAPE, AUTO_ORIENTATION, }; -enum MarginsType { +enum class MarginsType { NO_MARGINS, STANDARD_MARGINS, CUSTOM_MARGINS, @@ -108,7 +113,7 @@ int32_t vertical; }; -enum FitToPageType { +enum class FitToPageType { NO_FITTING, FIT_TO_PAGE, GROW_TO_PAGE, @@ -116,7 +121,7 @@ FILL_PAGE, }; -enum MediaType { +enum class MediaType { CUSTOM_MEDIA, // North American standard sheet media names.
diff --git a/components/cloud_devices/common/printer_description_unittest.cc b/components/cloud_devices/common/printer_description_unittest.cc index a61825f..d123dbb 100644 --- a/components/cloud_devices/common/printer_description_unittest.cc +++ b/components/cloud_devices/common/printer_description_unittest.cc
@@ -406,42 +406,42 @@ content_types.AddOption("image/jpeg"); PwgRasterConfig custom_raster; - custom_raster.document_sheet_back = MANUAL_TUMBLE; + custom_raster.document_sheet_back = DocumentSheetBack::MANUAL_TUMBLE; custom_raster.reverse_order_streaming = true; custom_raster.rotate_all_pages = false; pwg_raster_config.set_value(custom_raster); - color.AddDefaultOption(Color(STANDARD_COLOR), true); - color.AddOption(Color(STANDARD_MONOCHROME)); - Color custom(CUSTOM_MONOCHROME); + color.AddDefaultOption(Color(ColorType::STANDARD_COLOR), true); + color.AddOption(Color(ColorType::STANDARD_MONOCHROME)); + Color custom(ColorType::CUSTOM_MONOCHROME); custom.vendor_id = "123"; custom.custom_display_name = "monochrome"; color.AddOption(custom); - duplex.AddDefaultOption(LONG_EDGE, true); - duplex.AddOption(SHORT_EDGE); - duplex.AddOption(NO_DUPLEX); + duplex.AddDefaultOption(DuplexType::LONG_EDGE, true); + duplex.AddOption(DuplexType::SHORT_EDGE); + duplex.AddOption(DuplexType::NO_DUPLEX); - orientation.AddOption(PORTRAIT); - orientation.AddOption(LANDSCAPE); - orientation.AddDefaultOption(AUTO_ORIENTATION, true); + orientation.AddOption(OrientationType::PORTRAIT); + orientation.AddOption(OrientationType::LANDSCAPE); + orientation.AddDefaultOption(OrientationType::AUTO_ORIENTATION, true); - margins.AddDefaultOption(Margins(NO_MARGINS, 0, 0, 0, 0), true); - margins.AddOption(Margins(STANDARD_MARGINS, 100, 200, 300, 400)); - margins.AddOption(Margins(CUSTOM_MARGINS, 1, 2, 3, 4)); + margins.AddDefaultOption(Margins(MarginsType::NO_MARGINS, 0, 0, 0, 0), true); + margins.AddOption(Margins(MarginsType::STANDARD_MARGINS, 100, 200, 300, 400)); + margins.AddOption(Margins(MarginsType::CUSTOM_MARGINS, 1, 2, 3, 4)); dpi.AddOption(Dpi(150, 250)); dpi.AddDefaultOption(Dpi(600, 1600), true); - fit_to_page.AddDefaultOption(NO_FITTING, true); - fit_to_page.AddOption(FIT_TO_PAGE); - fit_to_page.AddOption(GROW_TO_PAGE); - fit_to_page.AddOption(SHRINK_TO_PAGE); - fit_to_page.AddOption(FILL_PAGE); + fit_to_page.AddDefaultOption(FitToPageType::NO_FITTING, true); + fit_to_page.AddOption(FitToPageType::FIT_TO_PAGE); + fit_to_page.AddOption(FitToPageType::GROW_TO_PAGE); + fit_to_page.AddOption(FitToPageType::SHRINK_TO_PAGE); + fit_to_page.AddOption(FitToPageType::FILL_PAGE); - media.AddDefaultOption(Media(NA_LETTER, 2222, 3333), true); - media.AddOption(Media(ISO_A6, 4444, 5555)); - media.AddOption(Media(JPN_YOU4, 6666, 7777)); + media.AddDefaultOption(Media(MediaType::NA_LETTER, 2222, 3333), true); + media.AddOption(Media(MediaType::ISO_A6, 4444, 5555)); + media.AddOption(Media(MediaType::JPN_YOU4, 6666, 7777)); media.AddOption(Media("Feed", "FEED", 1111, 0)); collate.set_default_value(false); @@ -473,8 +473,10 @@ PwgRasterConfigCapability pwg_raster; EXPECT_TRUE(pwg_raster.LoadFrom(description)); ASSERT_EQ(1U, pwg_raster.value().document_types_supported.size()); - EXPECT_EQ(SRGB_8, pwg_raster.value().document_types_supported[0]); - EXPECT_EQ(ROTATED, pwg_raster.value().document_sheet_back); + EXPECT_EQ(PwgDocumentTypeSupported::SRGB_8, + pwg_raster.value().document_types_supported[0]); + EXPECT_EQ(DocumentSheetBack::ROTATED, + pwg_raster.value().document_sheet_back); EXPECT_FALSE(pwg_raster.value().reverse_order_streaming); } { @@ -485,8 +487,10 @@ PwgRasterConfigCapability pwg_raster; EXPECT_TRUE(pwg_raster.LoadFrom(description)); ASSERT_EQ(1U, pwg_raster.value().document_types_supported.size()); - EXPECT_EQ(SGRAY_8, pwg_raster.value().document_types_supported[0]); - EXPECT_EQ(ROTATED, pwg_raster.value().document_sheet_back); + EXPECT_EQ(PwgDocumentTypeSupported::SGRAY_8, + pwg_raster.value().document_types_supported[0]); + EXPECT_EQ(DocumentSheetBack::ROTATED, + pwg_raster.value().document_sheet_back); EXPECT_FALSE(pwg_raster.value().reverse_order_streaming); } { @@ -497,9 +501,12 @@ PwgRasterConfigCapability pwg_raster; EXPECT_TRUE(pwg_raster.LoadFrom(description)); ASSERT_EQ(2U, pwg_raster.value().document_types_supported.size()); - EXPECT_EQ(SRGB_8, pwg_raster.value().document_types_supported[0]); - EXPECT_EQ(SGRAY_8, pwg_raster.value().document_types_supported[1]); - EXPECT_EQ(ROTATED, pwg_raster.value().document_sheet_back); + EXPECT_EQ(PwgDocumentTypeSupported::SRGB_8, + pwg_raster.value().document_types_supported[0]); + EXPECT_EQ(PwgDocumentTypeSupported::SGRAY_8, + pwg_raster.value().document_types_supported[1]); + EXPECT_EQ(DocumentSheetBack::ROTATED, + pwg_raster.value().document_sheet_back); EXPECT_FALSE(pwg_raster.value().reverse_order_streaming); } { @@ -510,8 +517,10 @@ PwgRasterConfigCapability pwg_raster; EXPECT_TRUE(pwg_raster.LoadFrom(description)); ASSERT_EQ(1U, pwg_raster.value().document_types_supported.size()); - EXPECT_EQ(SRGB_8, pwg_raster.value().document_types_supported[0]); - EXPECT_EQ(ROTATED, pwg_raster.value().document_sheet_back); + EXPECT_EQ(PwgDocumentTypeSupported::SRGB_8, + pwg_raster.value().document_types_supported[0]); + EXPECT_EQ(DocumentSheetBack::ROTATED, + pwg_raster.value().document_sheet_back); EXPECT_FALSE(pwg_raster.value().reverse_order_streaming); } { @@ -522,7 +531,8 @@ PwgRasterConfigCapability pwg_raster; EXPECT_TRUE(pwg_raster.LoadFrom(description)); EXPECT_EQ(0U, pwg_raster.value().document_types_supported.size()); - EXPECT_EQ(ROTATED, pwg_raster.value().document_sheet_back); + EXPECT_EQ(DocumentSheetBack::ROTATED, + pwg_raster.value().document_sheet_back); EXPECT_FALSE(pwg_raster.value().reverse_order_streaming); } { @@ -548,8 +558,9 @@ CloudDeviceDescription description; PwgRasterConfig custom_raster; - custom_raster.document_types_supported.push_back(SRGB_8); - custom_raster.document_sheet_back = ROTATED; + custom_raster.document_types_supported.push_back( + PwgDocumentTypeSupported::SRGB_8); + custom_raster.document_sheet_back = DocumentSheetBack::ROTATED; PwgRasterConfigCapability pwg_raster; pwg_raster.set_value(custom_raster); @@ -562,8 +573,9 @@ CloudDeviceDescription description; PwgRasterConfig custom_raster; - custom_raster.document_types_supported.push_back(SGRAY_8); - custom_raster.document_sheet_back = ROTATED; + custom_raster.document_types_supported.push_back( + PwgDocumentTypeSupported::SGRAY_8); + custom_raster.document_sheet_back = DocumentSheetBack::ROTATED; PwgRasterConfigCapability pwg_raster; pwg_raster.set_value(custom_raster); @@ -576,9 +588,11 @@ CloudDeviceDescription description; PwgRasterConfig custom_raster; - custom_raster.document_types_supported.push_back(SRGB_8); - custom_raster.document_types_supported.push_back(SGRAY_8); - custom_raster.document_sheet_back = ROTATED; + custom_raster.document_types_supported.push_back( + PwgDocumentTypeSupported::SRGB_8); + custom_raster.document_types_supported.push_back( + PwgDocumentTypeSupported::SGRAY_8); + custom_raster.document_sheet_back = DocumentSheetBack::ROTATED; PwgRasterConfigCapability pwg_raster; pwg_raster.set_value(custom_raster); @@ -591,7 +605,7 @@ CloudDeviceDescription description; PwgRasterConfig custom_raster; - custom_raster.document_sheet_back = ROTATED; + custom_raster.document_sheet_back = DocumentSheetBack::ROTATED; PwgRasterConfigCapability pwg_raster; pwg_raster.set_value(custom_raster); @@ -639,49 +653,52 @@ EXPECT_TRUE(content_types.Contains("image/jpeg")); EXPECT_EQ(0U, pwg_raster_config.value().document_types_supported.size()); - EXPECT_EQ(MANUAL_TUMBLE, pwg_raster_config.value().document_sheet_back); + EXPECT_EQ(DocumentSheetBack::MANUAL_TUMBLE, + pwg_raster_config.value().document_sheet_back); EXPECT_TRUE(pwg_raster_config.value().reverse_order_streaming); EXPECT_FALSE(pwg_raster_config.value().rotate_all_pages); - EXPECT_TRUE(color.Contains(Color(STANDARD_COLOR))); - EXPECT_TRUE(color.Contains(Color(STANDARD_MONOCHROME))); - Color custom(CUSTOM_MONOCHROME); + EXPECT_TRUE(color.Contains(Color(ColorType::STANDARD_COLOR))); + EXPECT_TRUE(color.Contains(Color(ColorType::STANDARD_MONOCHROME))); + Color custom(ColorType::CUSTOM_MONOCHROME); custom.vendor_id = "123"; custom.custom_display_name = "monochrome"; EXPECT_TRUE(color.Contains(custom)); - EXPECT_EQ(Color(STANDARD_COLOR), color.GetDefault()); + EXPECT_EQ(Color(ColorType::STANDARD_COLOR), color.GetDefault()); - EXPECT_TRUE(duplex.Contains(LONG_EDGE)); - EXPECT_TRUE(duplex.Contains(SHORT_EDGE)); - EXPECT_TRUE(duplex.Contains(NO_DUPLEX)); - EXPECT_EQ(LONG_EDGE, duplex.GetDefault()); + EXPECT_TRUE(duplex.Contains(DuplexType::LONG_EDGE)); + EXPECT_TRUE(duplex.Contains(DuplexType::SHORT_EDGE)); + EXPECT_TRUE(duplex.Contains(DuplexType::NO_DUPLEX)); + EXPECT_EQ(DuplexType::LONG_EDGE, duplex.GetDefault()); - EXPECT_TRUE(orientation.Contains(PORTRAIT)); - EXPECT_TRUE(orientation.Contains(LANDSCAPE)); - EXPECT_TRUE(orientation.Contains(AUTO_ORIENTATION)); - EXPECT_EQ(AUTO_ORIENTATION, orientation.GetDefault()); + EXPECT_TRUE(orientation.Contains(OrientationType::PORTRAIT)); + EXPECT_TRUE(orientation.Contains(OrientationType::LANDSCAPE)); + EXPECT_TRUE(orientation.Contains(OrientationType::AUTO_ORIENTATION)); + EXPECT_EQ(OrientationType::AUTO_ORIENTATION, orientation.GetDefault()); - EXPECT_TRUE(margins.Contains(Margins(NO_MARGINS, 0, 0, 0, 0))); - EXPECT_TRUE(margins.Contains(Margins(STANDARD_MARGINS, 100, 200, 300, 400))); - EXPECT_TRUE(margins.Contains(Margins(CUSTOM_MARGINS, 1, 2, 3, 4))); - EXPECT_EQ(Margins(NO_MARGINS, 0, 0, 0, 0), margins.GetDefault()); + EXPECT_TRUE(margins.Contains(Margins(MarginsType::NO_MARGINS, 0, 0, 0, 0))); + EXPECT_TRUE(margins.Contains( + Margins(MarginsType::STANDARD_MARGINS, 100, 200, 300, 400))); + EXPECT_TRUE( + margins.Contains(Margins(MarginsType::CUSTOM_MARGINS, 1, 2, 3, 4))); + EXPECT_EQ(Margins(MarginsType::NO_MARGINS, 0, 0, 0, 0), margins.GetDefault()); EXPECT_TRUE(dpi.Contains(Dpi(150, 250))); EXPECT_TRUE(dpi.Contains(Dpi(600, 1600))); EXPECT_EQ(Dpi(600, 1600), dpi.GetDefault()); - EXPECT_TRUE(fit_to_page.Contains(NO_FITTING)); - EXPECT_TRUE(fit_to_page.Contains(FIT_TO_PAGE)); - EXPECT_TRUE(fit_to_page.Contains(GROW_TO_PAGE)); - EXPECT_TRUE(fit_to_page.Contains(SHRINK_TO_PAGE)); - EXPECT_TRUE(fit_to_page.Contains(FILL_PAGE)); - EXPECT_EQ(NO_FITTING, fit_to_page.GetDefault()); + EXPECT_TRUE(fit_to_page.Contains(FitToPageType::NO_FITTING)); + EXPECT_TRUE(fit_to_page.Contains(FitToPageType::FIT_TO_PAGE)); + EXPECT_TRUE(fit_to_page.Contains(FitToPageType::GROW_TO_PAGE)); + EXPECT_TRUE(fit_to_page.Contains(FitToPageType::SHRINK_TO_PAGE)); + EXPECT_TRUE(fit_to_page.Contains(FitToPageType::FILL_PAGE)); + EXPECT_EQ(FitToPageType::NO_FITTING, fit_to_page.GetDefault()); - EXPECT_TRUE(media.Contains(Media(NA_LETTER, 2222, 3333))); - EXPECT_TRUE(media.Contains(Media(ISO_A6, 4444, 5555))); - EXPECT_TRUE(media.Contains(Media(JPN_YOU4, 6666, 7777))); + EXPECT_TRUE(media.Contains(Media(MediaType::NA_LETTER, 2222, 3333))); + EXPECT_TRUE(media.Contains(Media(MediaType::ISO_A6, 4444, 5555))); + EXPECT_TRUE(media.Contains(Media(MediaType::JPN_YOU4, 6666, 7777))); EXPECT_TRUE(media.Contains(Media("Feed", "FEED", 1111, 0))); - EXPECT_EQ(Media(NA_LETTER, 2222, 3333), media.GetDefault()); + EXPECT_EQ(Media(MediaType::NA_LETTER, 2222, 3333), media.GetDefault()); EXPECT_FALSE(collate.default_value()); EXPECT_TRUE(reverse.default_value()); @@ -743,22 +760,22 @@ ReverseTicketItem reverse; PwgRasterConfig custom_raster; - custom_raster.document_sheet_back = MANUAL_TUMBLE; + custom_raster.document_sheet_back = DocumentSheetBack::MANUAL_TUMBLE; custom_raster.reverse_order_streaming = true; custom_raster.rotate_all_pages = false; pwg_raster_config.set_value(custom_raster); - color.set_value(Color(STANDARD_MONOCHROME)); - duplex.set_value(NO_DUPLEX); - orientation.set_value(LANDSCAPE); + color.set_value(Color(ColorType::STANDARD_MONOCHROME)); + duplex.set_value(DuplexType::NO_DUPLEX); + orientation.set_value(OrientationType::LANDSCAPE); copies.set_value(123); - margins.set_value(Margins(CUSTOM_MARGINS, 7, 6, 3, 1)); + margins.set_value(Margins(MarginsType::CUSTOM_MARGINS, 7, 6, 3, 1)); dpi.set_value(Dpi(562, 125)); - fit_to_page.set_value(SHRINK_TO_PAGE); + fit_to_page.set_value(FitToPageType::SHRINK_TO_PAGE); PageRange page_ranges; page_ranges.push_back(Interval(1, 99)); page_ranges.push_back(Interval(150)); page_range.set_value(page_ranges); - media.set_value(Media(ISO_C7C6, 4261, 334)); + media.set_value(Media(MediaType::ISO_C7C6, 4261, 334)); collate.set_value(false); reverse.set_value(true); @@ -809,21 +826,22 @@ EXPECT_TRUE(reverse.LoadFrom(description)); EXPECT_TRUE(media.LoadFrom(description)); - EXPECT_EQ(MANUAL_TUMBLE, pwg_raster_config.value().document_sheet_back); + EXPECT_EQ(DocumentSheetBack::MANUAL_TUMBLE, + pwg_raster_config.value().document_sheet_back); EXPECT_TRUE(pwg_raster_config.value().reverse_order_streaming); EXPECT_FALSE(pwg_raster_config.value().rotate_all_pages); - EXPECT_EQ(color.value(), Color(STANDARD_MONOCHROME)); - EXPECT_EQ(duplex.value(), NO_DUPLEX); - EXPECT_EQ(orientation.value(), LANDSCAPE); + EXPECT_EQ(color.value(), Color(ColorType::STANDARD_MONOCHROME)); + EXPECT_EQ(duplex.value(), DuplexType::NO_DUPLEX); + EXPECT_EQ(orientation.value(), OrientationType::LANDSCAPE); EXPECT_EQ(copies.value(), 123); - EXPECT_EQ(margins.value(), Margins(CUSTOM_MARGINS, 7, 6, 3, 1)); + EXPECT_EQ(margins.value(), Margins(MarginsType::CUSTOM_MARGINS, 7, 6, 3, 1)); EXPECT_EQ(dpi.value(), Dpi(562, 125)); - EXPECT_EQ(fit_to_page.value(), SHRINK_TO_PAGE); + EXPECT_EQ(fit_to_page.value(), FitToPageType::SHRINK_TO_PAGE); PageRange page_ranges; page_ranges.push_back(Interval(1, 99)); page_ranges.push_back(Interval(150)); EXPECT_EQ(page_range.value(), page_ranges); - EXPECT_EQ(media.value(), Media(ISO_C7C6, 4261, 334)); + EXPECT_EQ(media.value(), Media(MediaType::ISO_C7C6, 4261, 334)); EXPECT_FALSE(collate.value()); EXPECT_TRUE(reverse.value());
diff --git a/components/cronet/ios/test/cronet_performance_test.mm b/components/cronet/ios/test/cronet_performance_test.mm index 4d53f42..09eb2a1 100644 --- a/components/cronet/ios/test/cronet_performance_test.mm +++ b/components/cronet/ios/test/cronet_performance_test.mm
@@ -266,7 +266,7 @@ } } -INSTANTIATE_TEST_CASE_P(Loops, - PerfTest, - ::testing::ValuesIn(test_combinations)); +INSTANTIATE_TEST_SUITE_P(Loops, + PerfTest, + ::testing::ValuesIn(test_combinations)); } // namespace cronet
diff --git a/components/cronet/native/test/url_request_test.cc b/components/cronet/native/test/url_request_test.cc index 1dbfda0..7167839 100644 --- a/components/cronet/native/test/url_request_test.cc +++ b/components/cronet/native/test/url_request_test.cc
@@ -223,9 +223,9 @@ }; const bool kDirectExecutorEnabled[]{true, false}; -INSTANTIATE_TEST_CASE_P(, - UrlRequestTest, - testing::ValuesIn(kDirectExecutorEnabled)); +INSTANTIATE_TEST_SUITE_P(, + UrlRequestTest, + testing::ValuesIn(kDirectExecutorEnabled)); TEST_P(UrlRequestTest, InitChecks) { Cronet_EngineParamsPtr engine_params = Cronet_EngineParams_Create();
diff --git a/components/download/internal/common/download_file_unittest.cc b/components/download/internal/common/download_file_unittest.cc index b7cab3ac..fb89b4c5 100644 --- a/components/download/internal/common/download_file_unittest.cc +++ b/components/download/internal/common/download_file_unittest.cc
@@ -503,10 +503,10 @@ // DownloadFileTestWithRename.<FooTest> will be instantiated once with // RenameAndAnnotate as the value parameter and once with RenameAndUniquify as // the value parameter. -INSTANTIATE_TEST_CASE_P(DownloadFile, - DownloadFileTestWithRename, - ::testing::Values(RENAME_AND_ANNOTATE, - RENAME_AND_UNIQUIFY)); +INSTANTIATE_TEST_SUITE_P(DownloadFile, + DownloadFileTestWithRename, + ::testing::Values(RENAME_AND_ANNOTATE, + RENAME_AND_UNIQUIFY)); const char DownloadFileTest::kTestData1[] = "Let's write some data to the file!\n";
diff --git a/components/download/internal/common/download_item_impl_unittest.cc b/components/download/internal/common/download_item_impl_unittest.cc index 06e966d..02488f1 100644 --- a/components/download/internal/common/download_item_impl_unittest.cc +++ b/components/download/internal/common/download_item_impl_unittest.cc
@@ -2300,13 +2300,13 @@ base::queue<base::Closure> failing_update_events_; }; -INSTANTIATE_TEST_CASE_P(Success, - DownloadItemDestinationUpdateRaceTest, - ::testing::ValuesIn(GenerateSuccessfulEventLists())); +INSTANTIATE_TEST_SUITE_P(Success, + DownloadItemDestinationUpdateRaceTest, + ::testing::ValuesIn(GenerateSuccessfulEventLists())); -INSTANTIATE_TEST_CASE_P(Failure, - DownloadItemDestinationUpdateRaceTest, - ::testing::ValuesIn(GenerateFailingEventLists())); +INSTANTIATE_TEST_SUITE_P(Failure, + DownloadItemDestinationUpdateRaceTest, + ::testing::ValuesIn(GenerateFailingEventLists())); } // namespace
diff --git a/components/download/internal/common/parallel_download_utils_unittest.cc b/components/download/internal/common/parallel_download_utils_unittest.cc index 7981868..af8aab7 100644 --- a/components/download/internal/common/parallel_download_utils_unittest.cc +++ b/components/download/internal/common/parallel_download_utils_unittest.cc
@@ -268,9 +268,9 @@ // The testing value specified offset for preceding stream. The error stream // offset is fixed value. -INSTANTIATE_TEST_CASE_P(ParallelDownloadUtilsTestSuite, - ParallelDownloadUtilsRecoverErrorTest, - ::testing::Values(0, 20, 80)); +INSTANTIATE_TEST_SUITE_P(ParallelDownloadUtilsTestSuite, + ParallelDownloadUtilsRecoverErrorTest, + ::testing::Values(0, 20, 80)); // Ensure the minimum slice size is correctly applied. TEST_F(ParallelDownloadUtilsTest, FindSlicesForRemainingContentMinSliceSize) {
diff --git a/components/favicon/core/large_icon_service_impl_unittest.cc b/components/favicon/core/large_icon_service_impl_unittest.cc index 397a5bd..3e93fa1 100644 --- a/components/favicon/core/large_icon_service_impl_unittest.cc +++ b/components/favicon/core/large_icon_service_impl_unittest.cc
@@ -755,9 +755,9 @@ // Every test will appear with suffix /0 (param false) and /1 (param true), e.g. // LargeIconServiceGetterTest.FallbackSinceTooPicky/0: get image. // LargeIconServiceGetterTest.FallbackSinceTooPicky/1: get raw bitmap. -INSTANTIATE_TEST_CASE_P(, // Empty instatiation name. - LargeIconServiceGetterTest, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(, // Empty instatiation name. + LargeIconServiceGetterTest, + ::testing::Values(false, true)); TEST(LargeIconServiceOrganizationNameTest, ShouldGetOrganizationNameForUma) { EXPECT_EQ("", LargeIconServiceImpl::GetOrganizationNameForUma(GURL()));
diff --git a/components/feed/core/user_classifier_unittest.cc b/components/feed/core/user_classifier_unittest.cc index 8a8eb0302..ddb68952 100644 --- a/components/feed/core/user_classifier_unittest.cc +++ b/components/feed/core/user_classifier_unittest.cc
@@ -296,7 +296,7 @@ Eq(rate_after_a_year)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , // An empty prefix for the parametrized tests names (no need to // distinguish the only instance we make here). FeedUserClassifierEventTest,
diff --git a/components/grpc_support/bidirectional_stream_unittest.cc b/components/grpc_support/bidirectional_stream_unittest.cc index 4db647a..3a8ed4e 100644 --- a/components/grpc_support/bidirectional_stream_unittest.cc +++ b/components/grpc_support/bidirectional_stream_unittest.cc
@@ -707,8 +707,8 @@ bidirectional_stream_destroy(test.stream); } -INSTANTIATE_TEST_CASE_P(BidirectionalStreamDelayRequestHeadersUntilFlush, - BidirectionalStreamTest, - ::testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(BidirectionalStreamDelayRequestHeadersUntilFlush, + BidirectionalStreamTest, + ::testing::Values(true, false)); } // namespace grpc_support
diff --git a/components/link_header_util/link_header_util_unittest.cc b/components/link_header_util/link_header_util_unittest.cc index 21ce2d4..bd69cd91 100644 --- a/components/link_header_util/link_header_util_unittest.cc +++ b/components/link_header_util/link_header_util_unittest.cc
@@ -215,9 +215,9 @@ ""}, }; -INSTANTIATE_TEST_CASE_P(LinkHeaderTest, - SimpleParseTest, - testing::ValuesIn(simple_parse_tests)); +INSTANTIATE_TEST_SUITE_P(LinkHeaderTest, + SimpleParseTest, + testing::ValuesIn(simple_parse_tests)); } // namespace
diff --git a/components/metrics/file_metrics_provider_unittest.cc b/components/metrics/file_metrics_provider_unittest.cc index c6e605e..dd03be8a 100644 --- a/components/metrics/file_metrics_provider_unittest.cc +++ b/components/metrics/file_metrics_provider_unittest.cc
@@ -268,10 +268,9 @@ }; // Run all test cases with both small and large files. -INSTANTIATE_TEST_CASE_P(SmallAndLargeFiles, - FileMetricsProviderTest, - testing::Bool()); - +INSTANTIATE_TEST_SUITE_P(SmallAndLargeFiles, + FileMetricsProviderTest, + testing::Bool()); TEST_P(FileMetricsProviderTest, AccessMetrics) { ASSERT_FALSE(PathExists(metrics_file()));
diff --git a/components/mirroring/service/video_capture_client_unittest.cc b/components/mirroring/service/video_capture_client_unittest.cc index 8006fc5..586e7f6 100644 --- a/components/mirroring/service/video_capture_client_unittest.cc +++ b/components/mirroring/service/video_capture_client_unittest.cc
@@ -137,8 +137,8 @@ OnBufferReady(0, gfx::Size(320, 180)); } -INSTANTIATE_TEST_CASE_P(, - VideoCaptureClientTest, - ::testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, + VideoCaptureClientTest, + ::testing::Values(true, false)); } // namespace mirroring
diff --git a/components/navigation_interception/intercept_navigation_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_throttle_unittest.cc index d9d493bb..a819416 100644 --- a/components/navigation_interception/intercept_navigation_throttle_unittest.cc +++ b/components/navigation_interception/intercept_navigation_throttle_unittest.cc
@@ -231,8 +231,8 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P(, - InterceptNavigationThrottleTest, - testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, + InterceptNavigationThrottleTest, + testing::Values(true, false)); } // namespace navigation_interception
diff --git a/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc b/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc index ea87c03..806f0e6 100644 --- a/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc +++ b/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc
@@ -191,10 +191,10 @@ Fetch("", false); } -INSTANTIATE_TEST_CASE_P(, - CachedImageFetcherTest, - testing::Values(TestType::kImageCallback, - TestType::kImageDataCallback, - TestType::kBothCallbacks)); +INSTANTIATE_TEST_SUITE_P(, + CachedImageFetcherTest, + testing::Values(TestType::kImageCallback, + TestType::kImageDataCallback, + TestType::kBothCallbacks)); } // namespace ntp_snippets
diff --git a/components/ntp_snippets/user_classifier_unittest.cc b/components/ntp_snippets/user_classifier_unittest.cc index 4c46883..69e685e 100644 --- a/components/ntp_snippets/user_classifier_unittest.cc +++ b/components/ntp_snippets/user_classifier_unittest.cc
@@ -293,7 +293,7 @@ Eq(metric_after_a_year)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , // An empty prefix for the parametrized tests names (no need to // distinguish the only instance we make here). UserClassifierMetricTest,
diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc index e01b06a..e6080d3a 100644 --- a/components/ntp_tiles/most_visited_sites_unittest.cc +++ b/components/ntp_tiles/most_visited_sites_unittest.cc
@@ -1015,9 +1015,9 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P(MostVisitedSitesTest, - MostVisitedSitesTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(MostVisitedSitesTest, + MostVisitedSitesTest, + ::testing::Bool()); TEST(MostVisitedSitesTest, ShouldDeduplicateDomainWithNoWwwDomain) { EXPECT_TRUE(MostVisitedSites::IsHostOrMobilePageKnown({"www.mobile.de"}, @@ -1515,9 +1515,9 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P(MostVisitedSitesWithCustomLinksTest, - MostVisitedSitesWithCustomLinksTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(MostVisitedSitesWithCustomLinksTest, + MostVisitedSitesWithCustomLinksTest, + ::testing::Bool()); #endif class MostVisitedSitesWithCacheHitTest : public MostVisitedSitesTest { @@ -1675,9 +1675,9 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P(MostVisitedSitesWithCacheHitTest, - MostVisitedSitesWithCacheHitTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(MostVisitedSitesWithCacheHitTest, + MostVisitedSitesWithCacheHitTest, + ::testing::Bool()); class MostVisitedSitesWithEmptyCacheTest : public MostVisitedSitesTest { public: @@ -1966,9 +1966,9 @@ } } -INSTANTIATE_TEST_CASE_P(MostVisitedSitesWithEmptyCacheTest, - MostVisitedSitesWithEmptyCacheTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(MostVisitedSitesWithEmptyCacheTest, + MostVisitedSitesWithEmptyCacheTest, + ::testing::Bool()); // This a test for MostVisitedSites::MergeTiles(...) method, and thus has the // same scope as the method itself. This tests merging popular sites with
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn index b1ffce2d..c227c0a 100644 --- a/components/password_manager/core/browser/BUILD.gn +++ b/components/password_manager/core/browser/BUILD.gn
@@ -170,8 +170,6 @@ "sync/password_sync_bridge.h", "sync/password_syncable_service.cc", "sync/password_syncable_service.h", - "sync/password_syncable_service_based_model_type_controller.cc", - "sync/password_syncable_service_based_model_type_controller.h", "sync_credentials_filter.cc", "sync_credentials_filter.h", "ui/credential_provider_interface.h",
diff --git a/components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.cc b/components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.cc deleted file mode 100644 index 0bc92f8..0000000 --- a/components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.cc +++ /dev/null
@@ -1,241 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.h" - -#include <string> -#include <utility> - -#include "base/bind.h" -#include "base/sequence_checker.h" -#include "components/password_manager/core/browser/password_store.h" -#include "components/sync/base/cryptographer.h" -#include "components/sync/base/model_type.h" -#include "components/sync/driver/sync_client.h" -#include "components/sync/driver/sync_service.h" -#include "components/sync/engine/sync_encryption_handler.h" - -namespace password_manager { - -namespace { - -// A SyncEncryptionHandler::Observer implementation that simply posts -// OnCryptographerStateChanged events to another task runner. This object is -// needed because its handed over to the sync thread, where the authoritative -// cryptographer lives. This class allows receiving cryptographer updates -// directly from the sync thread to the model thread (password's background -// thread). -class OnCryptographerStateChangedProxy - : public syncer::SyncEncryptionHandler::Observer { - public: - // |cb| will be run on |task_runner|. - OnCryptographerStateChangedProxy( - scoped_refptr<base::SequencedTaskRunner> task_runner, - const base::RepeatingCallback< - void(std::unique_ptr<syncer::Cryptographer>)>& cb) - : task_runner_(std::move(task_runner)), cb_(cb) { - DCHECK(task_runner_); - DCHECK(cb_); - } - - void OnPassphraseRequired( - syncer::PassphraseRequiredReason reason, - const syncer::KeyDerivationParams& key_derivation_params, - const sync_pb::EncryptedData& pending_keys) override {} - - void OnPassphraseAccepted() override {} - - void OnBootstrapTokenUpdated(const std::string& bootstrap_token, - syncer::BootstrapTokenType type) override {} - - void OnEncryptedTypesChanged(syncer::ModelTypeSet encrypted_types, - bool encrypt_everything) override {} - - void OnEncryptionComplete() override {} - - void OnCryptographerStateChanged( - syncer::Cryptographer* cryptographer) override { - // We make a copy of |cryptographer| since it's not thread-safe. - task_runner_->PostTask( - FROM_HERE, base::BindOnce(cb_, std::make_unique<syncer::Cryptographer>( - *cryptographer))); - } - - void OnPassphraseTypeChanged(syncer::PassphraseType type, - base::Time passphrase_time) override {} - - void OnLocalSetPassphraseEncryption( - const syncer::SyncEncryptionHandler::NigoriState& nigori_state) override { - } - - private: - const scoped_refptr<base::SequencedTaskRunner> task_runner_; - const base::RepeatingCallback<void(std::unique_ptr<syncer::Cryptographer>)> - cb_; - - DISALLOW_COPY_AND_ASSIGN(OnCryptographerStateChangedProxy); -}; - -} // namespace - -// Created and constructed on any thread, but otherwise used exclusively on a -// single sequence (the model sequence). -class PasswordSyncableServiceBasedModelTypeController::ModelCryptographerImpl - : public syncer::SyncableServiceBasedBridge::ModelCryptographer { - public: - ModelCryptographerImpl() { DETACH_FROM_SEQUENCE(sequence_checker_); } - - void OnCryptographerStateChanged( - std::unique_ptr<syncer::Cryptographer> cryptographer) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(cryptographer); - cryptographer_ = std::move(cryptographer); - } - - base::Optional<syncer::ModelError> Decrypt( - sync_pb::EntitySpecifics* specifics) override { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(cryptographer_); - DCHECK(cryptographer_->is_ready()); - - const sync_pb::PasswordSpecifics& password_specifics = - specifics->password(); - DCHECK(password_specifics.has_encrypted()); - - const sync_pb::EncryptedData& encrypted = password_specifics.encrypted(); - if (!cryptographer_->CanDecrypt(encrypted)) { - return syncer::ModelError(FROM_HERE, "Cannot decrypt password"); - } - - sync_pb::EntitySpecifics unencrypted_password; - if (!cryptographer_->Decrypt(encrypted, - unencrypted_password.mutable_password() - ->mutable_client_only_encrypted_data())) { - return syncer::ModelError(FROM_HERE, "Failed to decrypt password"); - } - - unencrypted_password.Swap(specifics); - return base::nullopt; - } - - base::Optional<syncer::ModelError> Encrypt( - sync_pb::EntitySpecifics* specifics) override { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(cryptographer_); - DCHECK(cryptographer_->is_ready()); - - const sync_pb::PasswordSpecificsData& data = - specifics->password().client_only_encrypted_data(); - - // We populate password metadata regardless of passphrase type, but it may - // be cleared out later in NonBlockingTypeCommitContribution if an explicit - // passphrase is used. - sync_pb::EntitySpecifics encrypted_password; - if (specifics->password().unencrypted_metadata().url() != - data.signon_realm()) { - encrypted_password.mutable_password() - ->mutable_unencrypted_metadata() - ->set_url(data.signon_realm()); - } - - if (!cryptographer_->Encrypt( - data, encrypted_password.mutable_password()->mutable_encrypted())) { - return syncer::ModelError(FROM_HERE, "Failed to encrypt password"); - } - - encrypted_password.Swap(specifics); - return base::nullopt; - } - - private: - ~ModelCryptographerImpl() override = default; - - SEQUENCE_CHECKER(sequence_checker_); - - std::unique_ptr<syncer::Cryptographer> cryptographer_; -}; - -PasswordSyncableServiceBasedModelTypeController:: - PasswordSyncableServiceBasedModelTypeController( - syncer::OnceModelTypeStoreFactory store_factory, - const base::RepeatingClosure& dump_stack, - scoped_refptr<PasswordStore> password_store, - syncer::SyncService* sync_service, - syncer::SyncClient* sync_client, - const base::RepeatingClosure& state_changed_callback) - : PasswordSyncableServiceBasedModelTypeController( - std::move(store_factory), - dump_stack, - std::move(password_store), - sync_service, - sync_client, - state_changed_callback, - base::MakeRefCounted<ModelCryptographerImpl>()) {} - -PasswordSyncableServiceBasedModelTypeController:: - ~PasswordSyncableServiceBasedModelTypeController() = default; - -void PasswordSyncableServiceBasedModelTypeController::LoadModels( - const syncer::ConfigureContext& configure_context, - const ModelLoadCallback& model_load_callback) { - DCHECK(CalledOnValidThread()); - sync_service_->AddObserver(this); - NonUiSyncableServiceBasedModelTypeController::LoadModels(configure_context, - model_load_callback); - state_changed_callback_.Run(); -} - -void PasswordSyncableServiceBasedModelTypeController::Stop( - syncer::ShutdownReason shutdown_reason, - StopCallback callback) { - DCHECK(CalledOnValidThread()); - sync_service_->RemoveObserver(this); - NonUiSyncableServiceBasedModelTypeController::Stop(shutdown_reason, - std::move(callback)); - state_changed_callback_.Run(); -} - -std::unique_ptr<syncer::SyncEncryptionHandler::Observer> -PasswordSyncableServiceBasedModelTypeController::GetEncryptionObserverProxy() { - DCHECK(CalledOnValidThread()); - return std::make_unique<OnCryptographerStateChangedProxy>( - background_task_runner_, - base::BindRepeating(&ModelCryptographerImpl::OnCryptographerStateChanged, - model_cryptographer_)); -} - -void PasswordSyncableServiceBasedModelTypeController::OnStateChanged( - syncer::SyncService* sync) { - DCHECK(CalledOnValidThread()); - state_changed_callback_.Run(); -} - -PasswordSyncableServiceBasedModelTypeController:: - PasswordSyncableServiceBasedModelTypeController( - syncer::OnceModelTypeStoreFactory store_factory, - const base::RepeatingClosure& dump_stack, - scoped_refptr<PasswordStore> password_store, - syncer::SyncService* sync_service, - syncer::SyncClient* sync_client, - const base::RepeatingClosure& state_changed_callback, - scoped_refptr<ModelCryptographerImpl> model_cryptographer) - : NonUiSyncableServiceBasedModelTypeController( - syncer::PASSWORDS, - std::move(store_factory), - base::BindRepeating(&PasswordStore::GetPasswordSyncableService, - password_store), - dump_stack, - password_store->GetBackgroundTaskRunner(), - model_cryptographer), - background_task_runner_(password_store->GetBackgroundTaskRunner()), - model_cryptographer_(model_cryptographer), - sync_service_(sync_service), - sync_client_(sync_client), - state_changed_callback_(state_changed_callback) { - DCHECK(sync_service_); - DCHECK(sync_client_); - DCHECK(model_cryptographer_); -} - -} // namespace password_manager
diff --git a/components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.h b/components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.h deleted file mode 100644 index e25dd83..0000000 --- a/components/password_manager/core/browser/sync/password_syncable_service_based_model_type_controller.h +++ /dev/null
@@ -1,78 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_PASSWORD_SYNCABLE_SERVICE_BASED_MODEL_TYPE_CONTROLLER_H_ -#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_PASSWORD_SYNCABLE_SERVICE_BASED_MODEL_TYPE_CONTROLLER_H_ - -#include <memory> - -#include "base/callback.h" -#include "base/macros.h" -#include "components/sync/driver/non_ui_syncable_service_based_model_type_controller.h" -#include "components/sync/driver/sync_service_observer.h" - -namespace syncer { -class SyncClient; -class SyncService; -} // namespace syncer - -namespace password_manager { - -class PasswordStore; - -// A class that manages the startup and shutdown of password sync. -class PasswordSyncableServiceBasedModelTypeController - : public syncer::NonUiSyncableServiceBasedModelTypeController, - public syncer::SyncServiceObserver { - public: - // |password_store| must not be null and is used to persist the encrypted - // copy of sync's data and metadata, sync-ed with |password_store|. - // |dump_stack| is called when a unrecoverable error occurs. |sync_client| - // must not be null. - PasswordSyncableServiceBasedModelTypeController( - syncer::OnceModelTypeStoreFactory store_factory, - const base::RepeatingClosure& dump_stack, - scoped_refptr<PasswordStore> password_store, - syncer::SyncService* sync_service, - syncer::SyncClient* sync_client, - const base::RepeatingClosure& state_changed_callback); - ~PasswordSyncableServiceBasedModelTypeController() override; - - // DataTypeController overrides. - void LoadModels(const syncer::ConfigureContext& configure_context, - const ModelLoadCallback& model_load_callback) override; - void Stop(syncer::ShutdownReason shutdown_reason, - StopCallback callback) override; - std::unique_ptr<syncer::SyncEncryptionHandler::Observer> - GetEncryptionObserverProxy() override; - - // SyncServiceObserver overrides. - void OnStateChanged(syncer::SyncService* sync) override; - - private: - class ModelCryptographerImpl; - - // Constructor overload to make sure |ModelCryptographerImpl| gets constructed - // before the base class. - PasswordSyncableServiceBasedModelTypeController( - syncer::OnceModelTypeStoreFactory store_factory, - const base::RepeatingClosure& dump_stack, - scoped_refptr<PasswordStore> password_store, - syncer::SyncService* sync_service, - syncer::SyncClient* sync_client, - const base::RepeatingClosure& state_changed_callback, - scoped_refptr<ModelCryptographerImpl> model_cryptographer); - - const scoped_refptr<base::SequencedTaskRunner> background_task_runner_; - const scoped_refptr<ModelCryptographerImpl> model_cryptographer_; - syncer::SyncService* const sync_service_; - syncer::SyncClient* const sync_client_; - const base::RepeatingClosure state_changed_callback_; - - DISALLOW_COPY_AND_ASSIGN(PasswordSyncableServiceBasedModelTypeController); -}; - -} // namespace password_manager - -#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SYNC_PASSWORD_SYNCABLE_SERVICE_BASED_MODEL_TYPE_CONTROLLER_H_
diff --git a/components/payments/content/payment_request_state_unittest.cc b/components/payments/content/payment_request_state_unittest.cc index f0d0910..a5d932af 100644 --- a/components/payments/content/payment_request_state_unittest.cc +++ b/components/payments/content/payment_request_state_unittest.cc
@@ -57,7 +57,7 @@ // PaymentRequestState::Delegate: void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override { payment_response_ = std::move(response); - }; + } void OnShippingOptionIdSelected(std::string shipping_option_id) override {} void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override { selected_shipping_address_ = std::move(address);
diff --git a/components/payments/content/payment_response_helper_unittest.cc b/components/payments/content/payment_response_helper_unittest.cc index 5d3e914..07abec8c 100644 --- a/components/payments/content/payment_response_helper_unittest.cc +++ b/components/payments/content/payment_response_helper_unittest.cc
@@ -45,7 +45,7 @@ // PaymentRequestState::Delegate: void OnPaymentResponseReady(mojom::PaymentResponsePtr response) override { payment_response_ = std::move(response); - }; + } // Convenience method to create a PaymentRequestSpec with specified |details| // and |method_data|.
diff --git a/components/policy/core/browser/url_blacklist_manager_unittest.cc b/components/policy/core/browser/url_blacklist_manager_unittest.cc index e079aa8c..0930f96 100644 --- a/components/policy/core/browser/url_blacklist_manager_unittest.cc +++ b/components/policy/core/browser/url_blacklist_manager_unittest.cc
@@ -238,7 +238,7 @@ EXPECT_EQ(1, blacklist_manager_->update_called()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( URLBlacklistFilterToComponentsTestInstance, URLBlacklistFilterToComponentsTest, testing::Values(
diff --git a/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc b/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc index 2fc70659..369939b1 100644 --- a/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_manager_unittest.cc
@@ -135,11 +135,10 @@ } // Instantiate abstract test case for basic policy reading tests. -INSTANTIATE_TEST_CASE_P( - UserCloudPolicyManagerProviderTest, - ConfigurationPolicyProviderTest, - testing::Values(TestHarness::CreateMandatory, - TestHarness::CreateRecommended)); +INSTANTIATE_TEST_SUITE_P(UserCloudPolicyManagerProviderTest, + ConfigurationPolicyProviderTest, + testing::Values(TestHarness::CreateMandatory, + TestHarness::CreateRecommended)); class TestCloudPolicyManager : public CloudPolicyManager { public:
diff --git a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc index 9cfcc3e..f98850e 100644 --- a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc
@@ -558,8 +558,8 @@ } } -INSTANTIATE_TEST_CASE_P(CloudPolicyRefreshSchedulerClientErrorTest, - CloudPolicyRefreshSchedulerClientErrorTest, - testing::ValuesIn(kClientErrorTestCases)); +INSTANTIATE_TEST_SUITE_P(CloudPolicyRefreshSchedulerClientErrorTest, + CloudPolicyRefreshSchedulerClientErrorTest, + testing::ValuesIn(kClientErrorTestCases)); } // namespace policy
diff --git a/components/policy/core/common/cloud/device_management_service_unittest.cc b/components/policy/core/common/cloud/device_management_service_unittest.cc index e44a3b57..68d0a53 100644 --- a/components/policy/core/common/cloud/device_management_service_unittest.cc +++ b/components/policy/core/common/cloud/device_management_service_unittest.cc
@@ -371,70 +371,58 @@ GetParam().response_); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DeviceManagementServiceFailedRequestTestInstance, DeviceManagementServiceFailedRequestTest, testing::Values( - FailedRequestParams( - DM_STATUS_REQUEST_FAILED, - net::ERR_FAILED, - 200, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_HTTP_STATUS_ERROR, - net::OK, - 666, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_RESPONSE_DECODING_ERROR, - net::OK, - 200, - PROTO_STRING("Not a protobuf.")), - FailedRequestParams( - DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED, - net::OK, - 403, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER, - net::OK, - 405, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_SERVICE_DEVICE_ID_CONFLICT, - net::OK, - 409, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_SERVICE_DEVICE_NOT_FOUND, - net::OK, - 410, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID, - net::OK, - 401, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_REQUEST_INVALID, - net::OK, - 400, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_TEMPORARY_UNAVAILABLE, - net::OK, - 404, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_SERVICE_ACTIVATION_PENDING, - net::OK, - 412, - PROTO_STRING(kResponseEmpty)), - FailedRequestParams( - DM_STATUS_SERVICE_MISSING_LICENSES, - net::OK, - 402, - PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_REQUEST_FAILED, + net::ERR_FAILED, + 200, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_HTTP_STATUS_ERROR, + net::OK, + 666, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_RESPONSE_DECODING_ERROR, + net::OK, + 200, + PROTO_STRING("Not a protobuf.")), + FailedRequestParams(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED, + net::OK, + 403, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER, + net::OK, + 405, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT, + net::OK, + 409, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_SERVICE_DEVICE_NOT_FOUND, + net::OK, + 410, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID, + net::OK, + 401, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_REQUEST_INVALID, + net::OK, + 400, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_TEMPORARY_UNAVAILABLE, + net::OK, + 404, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_SERVICE_ACTIVATION_PENDING, + net::OK, + 412, + PROTO_STRING(kResponseEmpty)), + FailedRequestParams(DM_STATUS_SERVICE_MISSING_LICENSES, + net::OK, + 402, + PROTO_STRING(kResponseEmpty)), FailedRequestParams( DM_STATUS_SERVICE_CONSUMER_ACCOUNT_WITH_PACKAGED_LICENSE, net::OK,
diff --git a/components/policy/core/common/config_dir_policy_loader_unittest.cc b/components/policy/core/common/config_dir_policy_loader_unittest.cc index d6b21a5..632880a7 100644 --- a/components/policy/core/common/config_dir_policy_loader_unittest.cc +++ b/components/policy/core/common/config_dir_policy_loader_unittest.cc
@@ -167,16 +167,14 @@ } // namespace // Instantiate abstract test case for basic policy reading tests. -INSTANTIATE_TEST_CASE_P( - ConfigDirPolicyLoaderTest, - ConfigurationPolicyProviderTest, - testing::Values(TestHarness::Create)); +INSTANTIATE_TEST_SUITE_P(ConfigDirPolicyLoaderTest, + ConfigurationPolicyProviderTest, + testing::Values(TestHarness::Create)); // Instantiate abstract test case for 3rd party policy reading tests. -INSTANTIATE_TEST_CASE_P( - ConfigDir3rdPartyPolicyLoaderTest, - Configuration3rdPartyPolicyProviderTest, - testing::Values(TestHarness::Create)); +INSTANTIATE_TEST_SUITE_P(ConfigDir3rdPartyPolicyLoaderTest, + Configuration3rdPartyPolicyProviderTest, + testing::Values(TestHarness::Create)); // Some tests that exercise special functionality in ConfigDirPolicyLoader. class ConfigDirPolicyLoaderTest : public PolicyTestBase {
diff --git a/components/policy/core/common/policy_loader_ios_unittest.mm b/components/policy/core/common/policy_loader_ios_unittest.mm index 09187b1..808013c 100644 --- a/components/policy/core/common/policy_loader_ios_unittest.mm +++ b/components/policy/core/common/policy_loader_ios_unittest.mm
@@ -216,15 +216,13 @@ } // namespace -INSTANTIATE_TEST_CASE_P( - PolicyProviderIOSChromePolicyTest, - ConfigurationPolicyProviderTest, - testing::Values(TestHarness::Create)); +INSTANTIATE_TEST_SUITE_P(PolicyProviderIOSChromePolicyTest, + ConfigurationPolicyProviderTest, + testing::Values(TestHarness::Create)); -INSTANTIATE_TEST_CASE_P( - PolicyProviderIOSEncodedChromePolicyTest, - ConfigurationPolicyProviderTest, - testing::Values(TestHarness::CreateWithEncodedKey)); +INSTANTIATE_TEST_SUITE_P(PolicyProviderIOSEncodedChromePolicyTest, + ConfigurationPolicyProviderTest, + testing::Values(TestHarness::CreateWithEncodedKey)); TEST(PolicyProviderIOSTest, ChromePolicyOverEncodedChromePolicy) { // This test verifies that if the "ChromePolicy" key is present then the
diff --git a/components/policy/core/common/policy_loader_mac_unittest.cc b/components/policy/core/common/policy_loader_mac_unittest.cc index ecaffd70..b579ac2 100644 --- a/components/policy/core/common/policy_loader_mac_unittest.cc +++ b/components/policy/core/common/policy_loader_mac_unittest.cc
@@ -133,10 +133,9 @@ } // namespace // Instantiate abstract test case for basic policy reading tests. -INSTANTIATE_TEST_CASE_P( - PolicyProviderMacTest, - ConfigurationPolicyProviderTest, - testing::Values(TestHarness::Create)); +INSTANTIATE_TEST_SUITE_P(PolicyProviderMacTest, + ConfigurationPolicyProviderTest, + testing::Values(TestHarness::Create)); // TODO(joaodasilva): instantiate Configuration3rdPartyPolicyProviderTest too // once the mac loader supports 3rd party policy. http://crbug.com/108995
diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc index 41ae2526..d564ee8 100644 --- a/components/policy/core/common/policy_loader_win_unittest.cc +++ b/components/policy/core/common/policy_loader_win_unittest.cc
@@ -389,16 +389,16 @@ } // namespace // Instantiate abstract test case for basic policy reading tests. -INSTANTIATE_TEST_CASE_P(PolicyProviderWinTest, - ConfigurationPolicyProviderTest, - testing::Values(RegistryTestHarness::CreateHKCU, - RegistryTestHarness::CreateHKLM)); +INSTANTIATE_TEST_SUITE_P(PolicyProviderWinTest, + ConfigurationPolicyProviderTest, + testing::Values(RegistryTestHarness::CreateHKCU, + RegistryTestHarness::CreateHKLM)); // Instantiate abstract test case for 3rd party policy reading tests. -INSTANTIATE_TEST_CASE_P(ThirdPartyPolicyProviderWinTest, - Configuration3rdPartyPolicyProviderTest, - testing::Values(RegistryTestHarness::CreateHKCU, - RegistryTestHarness::CreateHKLM)); +INSTANTIATE_TEST_SUITE_P(ThirdPartyPolicyProviderWinTest, + Configuration3rdPartyPolicyProviderTest, + testing::Values(RegistryTestHarness::CreateHKCU, + RegistryTestHarness::CreateHKLM)); // Test cases for windows policy provider specific functionality. class PolicyLoaderWinTest : public PolicyTestBase {
diff --git a/components/prefs/json_pref_store_unittest.cc b/components/prefs/json_pref_store_unittest.cc index d3aa266..a7bd474f 100644 --- a/components/prefs/json_pref_store_unittest.cc +++ b/components/prefs/json_pref_store_unittest.cc
@@ -538,15 +538,15 @@ &scoped_task_environment_); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithoutCallback, JsonPrefStoreTest, ::testing::Values(CommitPendingWriteMode::WITHOUT_CALLBACK)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithCallback, JsonPrefStoreTest, ::testing::Values(CommitPendingWriteMode::WITH_CALLBACK)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithSynchronousCallback, JsonPrefStoreTest, ::testing::Values(CommitPendingWriteMode::WITH_SYNCHRONOUS_CALLBACK)); @@ -694,15 +694,15 @@ ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithoutCallback, JsonPrefStoreLossyWriteTest, ::testing::Values(CommitPendingWriteMode::WITHOUT_CALLBACK)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithReply, JsonPrefStoreLossyWriteTest, ::testing::Values(CommitPendingWriteMode::WITH_CALLBACK)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( WithNotify, JsonPrefStoreLossyWriteTest, ::testing::Values(CommitPendingWriteMode::WITH_SYNCHRONOUS_CALLBACK));
diff --git a/components/printing/common/cloud_print_cdd_conversion.cc b/components/printing/common/cloud_print_cdd_conversion.cc index 2daeec3..ff359932 100644 --- a/components/printing/common/cloud_print_cdd_conversion.cc +++ b/components/printing/common/cloud_print_cdd_conversion.cc
@@ -21,15 +21,15 @@ printing::DuplexMode mode) { switch (mode) { case printing::SIMPLEX: - return cloud_devices::printer::NO_DUPLEX; + return cloud_devices::printer::DuplexType::NO_DUPLEX; case printing::LONG_EDGE: - return cloud_devices::printer::LONG_EDGE; + return cloud_devices::printer::DuplexType::LONG_EDGE; case printing::SHORT_EDGE: - return cloud_devices::printer::SHORT_EDGE; + return cloud_devices::printer::DuplexType::SHORT_EDGE; default: NOTREACHED(); } - return cloud_devices::printer::NO_DUPLEX; + return cloud_devices::printer::DuplexType::NO_DUPLEX; } } // namespace @@ -65,12 +65,12 @@ ColorCapability color; if (semantic_info.color_default || semantic_info.color_changeable) { - Color standard_color(STANDARD_COLOR); + Color standard_color(ColorType::STANDARD_COLOR); standard_color.vendor_id = base::NumberToString(semantic_info.color_model); color.AddDefaultOption(standard_color, semantic_info.color_default); } if (!semantic_info.color_default || semantic_info.color_changeable) { - Color standard_monochrome(STANDARD_MONOCHROME); + Color standard_monochrome(ColorType::STANDARD_MONOCHROME); standard_monochrome.vendor_id = base::NumberToString(semantic_info.bw_model); color.AddDefaultOption(standard_monochrome, !semantic_info.color_default); @@ -136,9 +136,9 @@ } OrientationCapability orientation; - orientation.AddDefaultOption(PORTRAIT, true); - orientation.AddOption(LANDSCAPE); - orientation.AddOption(AUTO_ORIENTATION); + orientation.AddDefaultOption(OrientationType::PORTRAIT, true); + orientation.AddOption(OrientationType::LANDSCAPE); + orientation.AddOption(OrientationType::AUTO_ORIENTATION); orientation.SaveTo(&description); return std::move(description).ToValue();
diff --git a/components/safe_browsing/password_protection/password_protection_service_unittest.cc b/components/safe_browsing/password_protection/password_protection_service_unittest.cc index 1632ec2..81988bc 100644 --- a/components/safe_browsing/password_protection/password_protection_service_unittest.cc +++ b/components/safe_browsing/password_protection/password_protection_service_unittest.cc
@@ -1335,11 +1335,11 @@ histograms_.ExpectTotalCount(kPasswordOnFocusRequestOutcomeHistogram, 1); } -INSTANTIATE_TEST_CASE_P(Regular, - PasswordProtectionServiceTest, - ::testing::Values(false)); -INSTANTIATE_TEST_CASE_P(SBER, - PasswordProtectionServiceTest, - ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(Regular, + PasswordProtectionServiceTest, + ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(SBER, + PasswordProtectionServiceTest, + ::testing::Values(true)); } // namespace safe_browsing
diff --git a/components/signin/core/browser/account_reconcilor_delegate_unittest.cc b/components/signin/core/browser/account_reconcilor_delegate_unittest.cc index 84c1ded..a146d379 100644 --- a/components/signin/core/browser/account_reconcilor_delegate_unittest.cc +++ b/components/signin/core/browser/account_reconcilor_delegate_unittest.cc
@@ -141,8 +141,8 @@ GaiaAccountsFromString(order_as_string))); } -INSTANTIATE_TEST_CASE_P(, - AccountReconcilorDelegateTest, - ::testing::ValuesIn(kReorderParams)); +INSTANTIATE_TEST_SUITE_P(, + AccountReconcilorDelegateTest, + ::testing::ValuesIn(kReorderParams)); } // namespace signin
diff --git a/components/signin/core/browser/account_reconcilor_unittest.cc b/components/signin/core/browser/account_reconcilor_unittest.cc index 084af7a..2a0f6cdf 100644 --- a/components/signin/core/browser/account_reconcilor_unittest.cc +++ b/components/signin/core/browser/account_reconcilor_unittest.cc
@@ -343,13 +343,13 @@ DISALLOW_COPY_AND_ASSIGN(AccountReconcilorMethodParamTest); }; -INSTANTIATE_TEST_CASE_P(Dice_Mirror, - AccountReconcilorMethodParamTest, - ::testing::Values( +INSTANTIATE_TEST_SUITE_P(Dice_Mirror, + AccountReconcilorMethodParamTest, + ::testing::Values( #if BUILDFLAG(ENABLE_DICE_SUPPORT) - signin::AccountConsistencyMethod::kDice, + signin::AccountConsistencyMethod::kDice, #endif - signin::AccountConsistencyMethod::kMirror)); + signin::AccountConsistencyMethod::kMirror)); AccountReconcilorTest::AccountReconcilorTest() : account_consistency_(signin::AccountConsistencyMethod::kDisabled), @@ -1035,7 +1035,7 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DiceTable, AccountReconcilorTestTable, ::testing::ValuesIn(GenerateTestCasesFromParams(kDiceParams))); @@ -1139,7 +1139,7 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DiceTableMultilogin, AccountReconcilorTestDiceMultilogin, ::testing::ValuesIn(GenerateTestCasesFromParams(kDiceParams))); @@ -1618,9 +1618,9 @@ EXPECT_TRUE(test_signin_client()->is_ready_for_dice_migration()); } -INSTANTIATE_TEST_CASE_P(TestDiceEndpoint, - AccountReconcilorDiceEndpointParamTest, - ::testing::ValuesIn({false, true})); +INSTANTIATE_TEST_SUITE_P(TestDiceEndpoint, + AccountReconcilorDiceEndpointParamTest, + ::testing::ValuesIn({false, true})); TEST_F(AccountReconcilorTest, DiceDeleteCookie) { SetAccountConsistency(signin::AccountConsistencyMethod::kDice); @@ -1843,7 +1843,7 @@ base::RunLoop().RunUntilIdle(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DiceTableMirrorMultilogin, AccountReconcilorTestMirrorMultilogin, ::testing::ValuesIn(GenerateTestCasesFromParams(kMirrorParams))); @@ -2837,9 +2837,9 @@ EXPECT_FALSE(timer->IsRunning()); } -INSTANTIATE_TEST_CASE_P(TestMirrorEndpoint, - AccountReconcilorMirrorEndpointParamTest, - ::testing::ValuesIn({false, true})); +INSTANTIATE_TEST_SUITE_P(TestMirrorEndpoint, + AccountReconcilorMirrorEndpointParamTest, + ::testing::ValuesIn({false, true})); TEST_F(AccountReconcilorTest, DelegateTimeoutIsNotCalledIfTimeoutIsNotReached) { AccountInfo account_info = ConnectProfileToAccount("user@gmail.com");
diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle_unittest.cc b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle_unittest.cc index 60eb509..27282df 100644 --- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle_unittest.cc +++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle_unittest.cc
@@ -642,11 +642,11 @@ sub_histogram_tester.ExpectTotalCount(kActivationCPU, ExpectThreadTimers(2)); } -INSTANTIATE_TEST_CASE_P(, - ActivationStateComputingNavigationThrottleTest, - ::testing::Values(true, false)); -INSTANTIATE_TEST_CASE_P(, - ActivationStateComputingThrottleSubFrameTest, - ::testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, + ActivationStateComputingNavigationThrottleTest, + ::testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, + ActivationStateComputingThrottleSubFrameTest, + ::testing::Values(true, false)); } // namespace subresource_filter
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc index e147fec..dab1469 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc +++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc
@@ -373,10 +373,10 @@ DISALLOW_COPY_AND_ASSIGN(ContentSubresourceFilterThrottleManagerTest); }; -INSTANTIATE_TEST_CASE_P(, - ContentSubresourceFilterThrottleManagerTest, - ::testing::Values(WILL_START_REQUEST, - WILL_PROCESS_RESPONSE)); +INSTANTIATE_TEST_SUITE_P(, + ContentSubresourceFilterThrottleManagerTest, + ::testing::Values(WILL_START_REQUEST, + WILL_PROCESS_RESPONSE)); TEST_P(ContentSubresourceFilterThrottleManagerTest, ActivateMainFrameAndFilterSubframeNavigation) {
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc index 671afe9..9b27feb 100644 --- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc +++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
@@ -1036,7 +1036,7 @@ tester().ExpectTotalCount(kSafeBrowsingNavigationDelay, 0); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CancelMethod, SubresourceFilterSafeBrowsingActivationThrottleTestWithCancelling, ::testing::Combine( @@ -1047,12 +1047,12 @@ ::testing::Values(content::TestNavigationThrottle::SYNCHRONOUS, content::TestNavigationThrottle::ASYNCHRONOUS))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ActivationLevelTest, SubresourceFilterSafeBrowsingActivationThrottleParamTest, ::testing::ValuesIn(kActivationListTestData)); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ActivationScopeTest, SubresourceFilterSafeBrowsingActivationThrottleScopeTest, ::testing::ValuesIn(kActivationScopeTestData));
diff --git a/components/subresource_filter/content/common/ad_delay_throttle_unittest.cc b/components/subresource_filter/content/common/ad_delay_throttle_unittest.cc index b2775d57c..d980140 100644 --- a/components/subresource_filter/content/common/ad_delay_throttle_unittest.cc +++ b/components/subresource_filter/content/common/ad_delay_throttle_unittest.cc
@@ -565,8 +565,8 @@ } } -INSTANTIATE_TEST_CASE_P(, - AdDelayThrottleEnabledParamTest, - ::testing::Values(true, false)); +INSTANTIATE_TEST_SUITE_P(, + AdDelayThrottleEnabledParamTest, + ::testing::Values(true, false)); } // namespace subresource_filter
diff --git a/components/subresource_filter/tools/ruleset_converter/BUILD.gn b/components/subresource_filter/tools/ruleset_converter/BUILD.gn index 7ab3f2d4..e44e367 100644 --- a/components/subresource_filter/tools/ruleset_converter/BUILD.gn +++ b/components/subresource_filter/tools/ruleset_converter/BUILD.gn
@@ -12,11 +12,15 @@ "ruleset_format.cc", "ruleset_format.h", ] + + public_deps = [ + "//components/url_pattern_index/proto:url_pattern_index", + ] + deps = [ "../rule_parser", "//base", "//components/subresource_filter/core/common", - "//components/url_pattern_index/proto:url_pattern_index", "//third_party/protobuf:protobuf_lite", ] }
diff --git a/components/supervised_user_error_page/supervised_user_error_page_unittest.cc b/components/supervised_user_error_page/supervised_user_error_page_unittest.cc index 873c850..c1e712a 100644 --- a/components/supervised_user_error_page/supervised_user_error_page_unittest.cc +++ b/components/supervised_user_error_page/supervised_user_error_page_unittest.cc
@@ -49,9 +49,9 @@ {MANUAL, true, false, IDS_CHILD_BLOCK_MESSAGE_MANUAL_MULTI_PARENT}, }; -INSTANTIATE_TEST_CASE_P(GetBlockMessageIDParameterized, - SupervisedUserErrorPageTest_GetBlockMessageID, - ::testing::ValuesIn(block_message_id_test_params)); +INSTANTIATE_TEST_SUITE_P(GetBlockMessageIDParameterized, + SupervisedUserErrorPageTest_GetBlockMessageID, + ::testing::ValuesIn(block_message_id_test_params)); struct BuildHtmlTestParameter { bool allow_access_requests; @@ -201,8 +201,8 @@ "custodian2_email", true, false, ASYNC_CHECKER, true}, }; -INSTANTIATE_TEST_CASE_P(GetBlockMessageIDParameterized, - SupervisedUserErrorPageTest_BuildHtml, - ::testing::ValuesIn(build_html_test_parameter)); +INSTANTIATE_TEST_SUITE_P(GetBlockMessageIDParameterized, + SupervisedUserErrorPageTest_BuildHtml, + ::testing::ValuesIn(build_html_test_parameter)); } // namespace supervised_user_error_page
diff --git a/components/sync/base/unique_position_unittest.cc b/components/sync/base/unique_position_unittest.cc index 3c0782e..be691b02 100644 --- a/components/sync/base/unique_position_unittest.cc +++ b/components/sync/base/unique_position_unittest.cc
@@ -483,15 +483,15 @@ EXPECT_LT(GetLength(pos), 500U); } -INSTANTIATE_TEST_CASE_P(MinSuffix, - PositionInsertTest, - ::testing::Values(std::string(kMinSuffix, - base::size(kMinSuffix)))); -INSTANTIATE_TEST_CASE_P(MaxSuffix, - PositionInsertTest, - ::testing::Values(std::string(kMaxSuffix, - base::size(kMaxSuffix)))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + MinSuffix, + PositionInsertTest, + ::testing::Values(std::string(kMinSuffix, base::size(kMinSuffix)))); +INSTANTIATE_TEST_SUITE_P( + MaxSuffix, + PositionInsertTest, + ::testing::Values(std::string(kMaxSuffix, base::size(kMaxSuffix)))); +INSTANTIATE_TEST_SUITE_P( NormalSuffix, PositionInsertTest, ::testing::Values(std::string(kNormalSuffix, base::size(kNormalSuffix))));
diff --git a/components/sync/driver/data_type_controller.cc b/components/sync/driver/data_type_controller.cc index b95ba5ef..7e94d014 100644 --- a/components/sync/driver/data_type_controller.cc +++ b/components/sync/driver/data_type_controller.cc
@@ -53,9 +53,4 @@ return sequence_checker_.CalledOnValidSequence(); } -std::unique_ptr<SyncEncryptionHandler::Observer> -DataTypeController::GetEncryptionObserverProxy() { - return nullptr; -} - } // namespace syncer
diff --git a/components/sync/driver/data_type_controller.h b/components/sync/driver/data_type_controller.h index f0091458..b8b56a4 100644 --- a/components/sync/driver/data_type_controller.h +++ b/components/sync/driver/data_type_controller.h
@@ -18,7 +18,6 @@ #include "components/sync/base/unrecoverable_error_handler.h" #include "components/sync/engine/cycle/status_counters.h" #include "components/sync/engine/shutdown_reason.h" -#include "components/sync/engine/sync_encryption_handler.h" #include "components/sync/model/data_type_error_handler.h" namespace syncer { @@ -180,13 +179,6 @@ // histograms. Can be called only if state() != NOT_RUNNING. virtual void RecordMemoryUsageAndCountsHistograms() = 0; - // Allows datatype controllers to receive crypto updates directly from the - // sync thread. - // TODO(crbug.com/856941): Remove when PASSWORDS are migrated to USS, which - // will likely make this API unnecessary. - virtual std::unique_ptr<SyncEncryptionHandler::Observer> - GetEncryptionObserverProxy(); - protected: explicit DataTypeController(ModelType type);
diff --git a/components/sync/driver/glue/sync_backend_host_core.cc b/components/sync/driver/glue/sync_backend_host_core.cc index d3ca947..13e7e232 100644 --- a/components/sync/driver/glue/sync_backend_host_core.cc +++ b/components/sync/driver/glue/sync_backend_host_core.cc
@@ -128,11 +128,9 @@ // the initializing downloading control types or initializing the encryption // handler in order to receive notifications triggered during encryption // startup. - DCHECK(!encryption_observer_proxies_.empty()); - for (const std::unique_ptr<SyncEncryptionHandler::Observer>& proxy_observer : - encryption_observer_proxies_) { - sync_manager_->GetEncryptionHandler()->AddObserver(proxy_observer.get()); - } + DCHECK(encryption_observer_proxy_); + sync_manager_->GetEncryptionHandler()->AddObserver( + encryption_observer_proxy_.get()); // Sync manager initialization is complete, so we can schedule recurring // SaveChanges. @@ -316,9 +314,9 @@ DCHECK(params.registrar); registrar_ = std::move(params.registrar); - DCHECK(encryption_observer_proxies_.empty()); - DCHECK(!params.encryption_observer_proxies.empty()); - encryption_observer_proxies_ = std::move(params.encryption_observer_proxies); + DCHECK(!encryption_observer_proxy_); + DCHECK(params.encryption_observer_proxy); + encryption_observer_proxy_ = std::move(params.encryption_observer_proxy); sync_manager_ = params.sync_manager_factory->CreateSyncManager(name_); sync_manager_->AddObserver(this);
diff --git a/components/sync/driver/glue/sync_backend_host_core.h b/components/sync/driver/glue/sync_backend_host_core.h index 5b273436..337f715 100644 --- a/components/sync/driver/glue/sync_backend_host_core.h +++ b/components/sync/driver/glue/sync_backend_host_core.h
@@ -201,9 +201,8 @@ // Non-null only between calls to DoInitialize() and DoShutdown(). std::unique_ptr<SyncBackendRegistrar> registrar_; - // Non-empty only between calls to DoInitialize() and DoShutdown(). - std::vector<std::unique_ptr<SyncEncryptionHandler::Observer>> - encryption_observer_proxies_; + // Non-null only between calls to DoInitialize() and DoShutdown(). + std::unique_ptr<SyncEncryptionHandler::Observer> encryption_observer_proxy_; // The timer used to periodically call SaveChanges. std::unique_ptr<base::RepeatingTimer> save_changes_timer_;
diff --git a/components/sync/driver/glue/sync_engine_impl_unittest.cc b/components/sync/driver/glue/sync_engine_impl_unittest.cc index 5d1ed13..02a473c 100644 --- a/components/sync/driver/glue/sync_engine_impl_unittest.cc +++ b/components/sync/driver/glue/sync_engine_impl_unittest.cc
@@ -254,8 +254,8 @@ params.host = &host_; params.registrar = std::make_unique<SyncBackendRegistrar>( std::string(), base::Bind(&CreateModelWorkerForGroup)); - params.encryption_observer_proxies.push_back( - std::make_unique<NullEncryptionObserver>()); + params.encryption_observer_proxy = + std::make_unique<NullEncryptionObserver>(); params.http_factory_getter = std::move(http_post_provider_factory_getter); params.credentials = credentials_; params.sync_manager_factory = std::move(fake_manager_factory_);
diff --git a/components/sync/driver/non_ui_syncable_service_based_model_type_controller.cc b/components/sync/driver/non_ui_syncable_service_based_model_type_controller.cc index e654bdea..68fe1d4 100644 --- a/components/sync/driver/non_ui_syncable_service_based_model_type_controller.cc +++ b/components/sync/driver/non_ui_syncable_service_based_model_type_controller.cc
@@ -25,11 +25,8 @@ NonUiSyncableServiceBasedModelTypeController::SyncableServiceProvider syncable_service_provider, const base::RepeatingClosure& dump_stack, - scoped_refptr<base::SequencedTaskRunner> task_runner, - scoped_refptr<SyncableServiceBasedBridge::ModelCryptographer> - cryptographer) + scoped_refptr<base::SequencedTaskRunner> task_runner) : type_(type), - cryptographer_(std::move(cryptographer)), store_factory_(std::move(store_factory)), syncable_service_provider_(std::move(syncable_service_provider)), dump_stack_(dump_stack), @@ -48,15 +45,13 @@ type_, std::move(store_factory_), std::make_unique<ClientTagBasedModelTypeProcessor>(type_, dump_stack_), - syncable_service.get(), cryptographer_)); + syncable_service.get())); } return bridge_->change_processor()->GetControllerDelegate(); } private: const ModelType type_; - const scoped_refptr<SyncableServiceBasedBridge::ModelCryptographer> - cryptographer_; OnceModelTypeStoreFactory store_factory_; NonUiSyncableServiceBasedModelTypeController::SyncableServiceProvider syncable_service_provider_; @@ -74,9 +69,7 @@ OnceModelTypeStoreFactory store_factory, SyncableServiceProvider syncable_service_provider, const base::RepeatingClosure& dump_stack, - scoped_refptr<base::SequencedTaskRunner> task_runner, - scoped_refptr<SyncableServiceBasedBridge::ModelCryptographer> - cryptographer) + scoped_refptr<base::SequencedTaskRunner> task_runner) : ModelTypeController( type, std::make_unique<ProxyModelTypeControllerDelegate>( @@ -87,8 +80,7 @@ std::move(store_factory), std::move(syncable_service_provider), dump_stack, - task_runner, - std::move(cryptographer))))) {} + task_runner)))) {} NonUiSyncableServiceBasedModelTypeController:: ~NonUiSyncableServiceBasedModelTypeController() {}
diff --git a/components/sync/driver/non_ui_syncable_service_based_model_type_controller.h b/components/sync/driver/non_ui_syncable_service_based_model_type_controller.h index 7fa1d6e..2f8985e 100644 --- a/components/sync/driver/non_ui_syncable_service_based_model_type_controller.h +++ b/components/sync/driver/non_ui_syncable_service_based_model_type_controller.h
@@ -15,7 +15,6 @@ #include "components/sync/base/model_type.h" #include "components/sync/driver/model_type_controller.h" #include "components/sync/model/model_type_store.h" -#include "components/sync/model_impl/syncable_service_based_bridge.h" namespace syncer { @@ -40,9 +39,7 @@ OnceModelTypeStoreFactory store_factory, SyncableServiceProvider syncable_service_provider, const base::RepeatingClosure& dump_stack, - scoped_refptr<base::SequencedTaskRunner> task_runner, - scoped_refptr<SyncableServiceBasedBridge::ModelCryptographer> - cryptographer = nullptr); + scoped_refptr<base::SequencedTaskRunner> task_runner); ~NonUiSyncableServiceBasedModelTypeController() override; private:
diff --git a/components/sync/driver/sync_driver_switches.cc b/components/sync/driver/sync_driver_switches.cc index b631435..2a5fb718 100644 --- a/components/sync/driver/sync_driver_switches.cc +++ b/components/sync/driver/sync_driver_switches.cc
@@ -62,8 +62,6 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kSyncPseudoUSSHistoryDeleteDirectives{ "SyncPseudoUSSHistoryDeleteDirectives", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kSyncPseudoUSSPasswords{"SyncPseudoUSSPasswords", - base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kSyncPseudoUSSPreferences{ "SyncPseudoUSSPreferences", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kSyncPseudoUSSPriorityPreferences{
diff --git a/components/sync/driver/sync_driver_switches.h b/components/sync/driver/sync_driver_switches.h index 0c001cfa..79bd831 100644 --- a/components/sync/driver/sync_driver_switches.h +++ b/components/sync/driver/sync_driver_switches.h
@@ -30,7 +30,6 @@ extern const base::Feature kSyncPseudoUSSExtensions; extern const base::Feature kSyncPseudoUSSFavicons; extern const base::Feature kSyncPseudoUSSHistoryDeleteDirectives; -extern const base::Feature kSyncPseudoUSSPasswords; extern const base::Feature kSyncPseudoUSSPreferences; extern const base::Feature kSyncPseudoUSSPriorityPreferences; extern const base::Feature kSyncPseudoUSSSearchEngines;
diff --git a/components/sync/driver/sync_session_durations_metrics_recorder.h b/components/sync/driver/sync_session_durations_metrics_recorder.h index c8139605..815a9d3 100644 --- a/components/sync/driver/sync_session_durations_metrics_recorder.h +++ b/components/sync/driver/sync_session_durations_metrics_recorder.h
@@ -12,7 +12,6 @@ #include "base/scoped_observer.h" #include "base/timer/elapsed_timer.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/signin/core/browser/gaia_cookie_manager_service.h" #include "components/sync/driver/sync_service_observer.h" #include "services/identity/public/cpp/identity_manager.h"
diff --git a/components/sync/engine/sync_engine.h b/components/sync/engine/sync_engine.h index db0c9d8..b3ba3d8 100644 --- a/components/sync/engine/sync_engine.h +++ b/components/sync/engine/sync_engine.h
@@ -8,7 +8,6 @@ #include <map> #include <memory> #include <string> -#include <vector> #include "base/callback.h" #include "base/compiler_specific.h" @@ -58,8 +57,7 @@ scoped_refptr<base::SequencedTaskRunner> sync_task_runner; SyncEngineHost* host = nullptr; std::unique_ptr<SyncBackendRegistrar> registrar; - std::vector<std::unique_ptr<SyncEncryptionHandler::Observer>> - encryption_observer_proxies; + std::unique_ptr<SyncEncryptionHandler::Observer> encryption_observer_proxy; scoped_refptr<ExtensionsActivity> extensions_activity; WeakHandle<JsEventHandler> event_handler; GURL service_url;
diff --git a/components/sync/engine_impl/DEPS b/components/sync/engine_impl/DEPS index 421cf34..78b788a 100644 --- a/components/sync/engine_impl/DEPS +++ b/components/sync/engine_impl/DEPS
@@ -1,7 +1,5 @@ include_rules = [ "+components/sync/base", - # TODO(crbug.com/902349): Remove the dependency below when fully migrating passwords to USS and the feature toggle isn't required in the ModelTypeWorker anymore. - "+components/sync/driver", "+components/sync/engine", "+components/sync/js", "+components/sync/model",
diff --git a/components/sync/engine_impl/cycle/nudge_tracker.cc b/components/sync/engine_impl/cycle/nudge_tracker.cc index 1b195d45..9cab8ec1 100644 --- a/components/sync/engine_impl/cycle/nudge_tracker.cc +++ b/components/sync/engine_impl/cycle/nudge_tracker.cc
@@ -51,22 +51,23 @@ base::TimeDelta::FromMilliseconds(kSyncRefreshDelayMilliseconds)), remote_invalidation_nudge_delay_( base::TimeDelta::FromMilliseconds(kSyncSchedulerDelayMilliseconds)) { - ModelTypeSet protocol_types = ProtocolTypes(); // Default initialize all the type trackers. - for (ModelType type : protocol_types) { + for (ModelType type : ProtocolTypes()) { type_trackers_.emplace(type, std::make_unique<DataTypeTracker>()); } } NudgeTracker::~NudgeTracker() {} -bool NudgeTracker::IsSyncRequired() const { +bool NudgeTracker::IsSyncRequired(ModelTypeSet types) const { if (IsRetryRequired()) { return true; } - for (const auto& type_and_tracker : type_trackers_) { - if (type_and_tracker.second->IsSyncRequired()) { + for (ModelType type : types) { + TypeTrackerMap::const_iterator tracker_it = type_trackers_.find(type); + DCHECK(tracker_it != type_trackers_.end()) << ModelTypeToString(type); + if (tracker_it->second->IsSyncRequired()) { return true; } } @@ -74,7 +75,7 @@ return false; } -bool NudgeTracker::IsGetUpdatesRequired() const { +bool NudgeTracker::IsGetUpdatesRequired(ModelTypeSet types) const { if (invalidations_out_of_sync_) { return true; } @@ -83,8 +84,10 @@ return true; } - for (const auto& type_and_tracker : type_trackers_) { - if (type_and_tracker.second->IsGetUpdatesRequired()) { + for (ModelType type : types) { + TypeTrackerMap::const_iterator tracker_it = type_trackers_.find(type); + DCHECK(tracker_it != type_trackers_.end()) << ModelTypeToString(type); + if (tracker_it->second->IsGetUpdatesRequired()) { return true; } } @@ -103,7 +106,7 @@ return current_retry_time_ <= sync_cycle_start_time_; } -void NudgeTracker::RecordSuccessfulSyncCycle() { +void NudgeTracker::RecordSuccessfulSyncCycle(ModelTypeSet types) { // If a retry was required, we've just serviced it. Unset the flag. if (IsRetryRequired()) { current_retry_time_ = base::TimeTicks(); @@ -112,8 +115,10 @@ // A successful cycle while invalidations are enabled puts us back into sync. invalidations_out_of_sync_ = !invalidations_enabled_; - for (const auto& type_and_tracker : type_trackers_) { - type_and_tracker.second->RecordSuccessfulSyncCycle(); + for (ModelType type : types) { + TypeTrackerMap::const_iterator tracker_it = type_trackers_.find(type); + DCHECK(tracker_it != type_trackers_.end()) << ModelTypeToString(type); + tracker_it->second->RecordSuccessfulSyncCycle(); } }
diff --git a/components/sync/engine_impl/cycle/nudge_tracker.h b/components/sync/engine_impl/cycle/nudge_tracker.h index 57fd37c..f3f1716a 100644 --- a/components/sync/engine_impl/cycle/nudge_tracker.h +++ b/components/sync/engine_impl/cycle/nudge_tracker.h
@@ -33,11 +33,11 @@ // Returns true if there is a good reason for performing a sync cycle. // This does not take into account whether or not this is a good *time* to // perform a sync cycle; that's the scheduler's job. - bool IsSyncRequired() const; + bool IsSyncRequired(ModelTypeSet types) const; // Returns true if there is a good reason for performing a get updates // request as part of the next sync cycle. - bool IsGetUpdatesRequired() const; + bool IsGetUpdatesRequired(ModelTypeSet types) const; // Return true if should perform a sync cycle for GU retry. // @@ -48,8 +48,8 @@ bool IsRetryRequired() const; // Tells this class that all required update fetching or committing has - // completed successfully. - void RecordSuccessfulSyncCycle(); + // completed successfully, as the result of a "normal" sync cycle. + void RecordSuccessfulSyncCycle(ModelTypeSet types); // Takes note of a local change. // Returns the shortest nudge delay from the tracker of each type in |types|.
diff --git a/components/sync/engine_impl/cycle/nudge_tracker_unittest.cc b/components/sync/engine_impl/cycle/nudge_tracker_unittest.cc index 112f5358..a38be36 100644 --- a/components/sync/engine_impl/cycle/nudge_tracker_unittest.cc +++ b/components/sync/engine_impl/cycle/nudge_tracker_unittest.cc
@@ -63,7 +63,7 @@ void SetInvalidationsInSync() { nudge_tracker_.OnInvalidationsEnabled(); - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle({}); } std::unique_ptr<InvalidationInterface> BuildInvalidation( @@ -94,8 +94,8 @@ // Use with valgrind to detect uninitialized members. TEST_F(NudgeTrackerTest, EmptyNudgeTracker) { // Now we're at the normal, "idle" state. - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); EXPECT_EQ(sync_pb::SyncEnums::UNKNOWN_ORIGIN, nudge_tracker_.GetOrigin()); sync_pb::GetUpdateTriggers gu_trigger; @@ -239,7 +239,7 @@ } // Clear status then verify. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); { sync_pb::GetUpdateTriggers gu_trigger; nudge_tracker_.FillProtoMessage(BOOKMARKS, &gu_trigger); @@ -268,7 +268,7 @@ } // Clear status then verify. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); { sync_pb::GetUpdateTriggers gu_trigger; nudge_tracker_.FillProtoMessage(BOOKMARKS, &gu_trigger); @@ -283,34 +283,34 @@ // Start with invalidations offline. nudge_tracker_.OnInvalidationsDisabled(); EXPECT_TRUE(InvalidationsOutOfSync()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Simply enabling invalidations does not bring us back into sync. nudge_tracker_.OnInvalidationsEnabled(); EXPECT_TRUE(InvalidationsOutOfSync()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // We must successfully complete a sync cycle while invalidations are enabled // to be sure that we're in sync. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_FALSE(InvalidationsOutOfSync()); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // If the invalidator malfunctions, we go become unsynced again. nudge_tracker_.OnInvalidationsDisabled(); EXPECT_TRUE(InvalidationsOutOfSync()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // A sync cycle while invalidations are disabled won't reset the flag. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_TRUE(InvalidationsOutOfSync()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Nor will the re-enabling of invalidations be sufficient, even now that // we've had a successful sync cycle. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_TRUE(InvalidationsOutOfSync()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); } // Tests that locally modified types are correctly written out to the @@ -324,7 +324,7 @@ EXPECT_EQ(1, ProtoLocallyModifiedCount(PREFERENCES)); // Record a successful sync cycle. Verify the count is cleared. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_EQ(0, ProtoLocallyModifiedCount(PREFERENCES)); } @@ -339,74 +339,82 @@ EXPECT_EQ(1, ProtoRefreshRequestedCount(SESSIONS)); // Record a successful sync cycle. Verify the count is cleared. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_EQ(0, ProtoRefreshRequestedCount(SESSIONS)); } // Basic tests for the IsSyncRequired() flag. TEST_F(NudgeTrackerTest, IsSyncRequired) { - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // Initial sync request. nudge_tracker_.RecordInitialSyncRequired(BOOKMARKS); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle({BOOKMARKS}); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // Sync request for resolve conflict. nudge_tracker_.RecordCommitConflict(BOOKMARKS); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + // Now a sync is required for BOOKMARKS. + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired({BOOKMARKS})); + // But not for SESSIONS. + EXPECT_FALSE(nudge_tracker_.IsSyncRequired({SESSIONS})); + // A successful cycle for SESSIONS doesn't change anything. + nudge_tracker_.RecordSuccessfulSyncCycle({SESSIONS}); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + // A successful cycle for all types resolves things. + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // Local changes. nudge_tracker_.RecordLocalChange(ModelTypeSet(SESSIONS)); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // Refresh requests. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(SESSIONS)); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // Invalidations. nudge_tracker_.RecordRemoteInvalidation(PREFERENCES, BuildInvalidation(1, "hint")); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); } // Basic tests for the IsGetUpdatesRequired() flag. TEST_F(NudgeTrackerTest, IsGetUpdatesRequired) { - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Initial sync request. nudge_tracker_.RecordInitialSyncRequired(BOOKMARKS); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Local changes. nudge_tracker_.RecordLocalChange(ModelTypeSet(SESSIONS)); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Refresh requests. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(SESSIONS)); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Invalidations. nudge_tracker_.RecordRemoteInvalidation(PREFERENCES, BuildInvalidation(1, "hint")); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); } // Test IsSyncRequired() responds correctly to data type throttling and backoff. @@ -414,35 +422,35 @@ const base::TimeTicks now = base::TimeTicks::Now(); const base::TimeDelta throttle_length = base::TimeDelta::FromMinutes(0); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // A local change to sessions enables the flag. nudge_tracker_.RecordLocalChange(ModelTypeSet(SESSIONS)); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // But the throttling of sessions unsets it. nudge_tracker_.SetTypesThrottledUntil(ModelTypeSet(SESSIONS), throttle_length, now); EXPECT_TRUE(IsTypeThrottled(SESSIONS)); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // A refresh request for bookmarks means we have reason to sync again. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(BOOKMARKS)); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // But the backoff of bookmarks unsets it. nudge_tracker_.SetTypeBackedOff(BOOKMARKS, throttle_length, now); EXPECT_TRUE(IsTypeThrottled(SESSIONS)); EXPECT_TRUE(IsTypeBackedOff(BOOKMARKS)); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // A refresh request for preferences means we have reason to sync again. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(PREFERENCES)); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // A successful sync cycle means we took care of preferences. - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsSyncRequired()); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); // But we still haven't dealt with sessions and bookmarks. We'll need to // remember that sessions and bookmarks are out of sync and re-enable the flag @@ -450,7 +458,7 @@ nudge_tracker_.UpdateTypeThrottlingAndBackoffState(); EXPECT_FALSE(nudge_tracker_.IsTypeBlocked(SESSIONS)); EXPECT_FALSE(nudge_tracker_.IsTypeBlocked(BOOKMARKS)); - EXPECT_TRUE(nudge_tracker_.IsSyncRequired()); + EXPECT_TRUE(nudge_tracker_.IsSyncRequired(ProtocolTypes())); } // Test IsGetUpdatesRequired() responds correctly to data type throttling and @@ -459,34 +467,34 @@ const base::TimeTicks now = base::TimeTicks::Now(); const base::TimeDelta throttle_length = base::TimeDelta::FromMinutes(0); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // A refresh request to sessions enables the flag. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(SESSIONS)); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // But the throttling of sessions unsets it. nudge_tracker_.SetTypesThrottledUntil(ModelTypeSet(SESSIONS), throttle_length, now); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // A refresh request for bookmarks means we have reason to sync again. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(BOOKMARKS)); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // But the backoff of bookmarks unsets it. nudge_tracker_.SetTypeBackedOff(BOOKMARKS, throttle_length, now); EXPECT_TRUE(IsTypeThrottled(SESSIONS)); EXPECT_TRUE(IsTypeBackedOff(BOOKMARKS)); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // A refresh request for preferences means we have reason to sync again. nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(PREFERENCES)); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // A successful sync cycle means we took care of preferences. - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // But we still haven't dealt with sessions and bookmarks. We'll need to // remember that sessions and bookmarks are out of sync and re-enable the flag @@ -494,7 +502,7 @@ nudge_tracker_.UpdateTypeThrottlingAndBackoffState(); EXPECT_FALSE(nudge_tracker_.IsTypeBlocked(SESSIONS)); EXPECT_FALSE(nudge_tracker_.IsTypeBlocked(BOOKMARKS)); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); } // Tests blocking-related getter functions when no types are blocked. @@ -633,20 +641,20 @@ // Not due yet at t0. nudge_tracker_.SetSyncCycleStartTime(t0); EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // Successful sync cycle at t0 changes nothing. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // At t4, the retry becomes due. nudge_tracker_.SetSyncCycleStartTime(t4); EXPECT_TRUE(nudge_tracker_.IsRetryRequired()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); // A sync cycle unsets the flag. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); // It's still unset at the start of the next sync cycle. @@ -676,7 +684,7 @@ EXPECT_TRUE(nudge_tracker_.IsRetryRequired()); // Verify that the successful sync cycle clears the flag. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); // Verify expecations around the new retry time. @@ -708,7 +716,7 @@ EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); // The cycle succeeded. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); // The time t3 is greater than the GU retry time scheduled at the beginning of // the test, but later than the retry time that overwrote it during the @@ -740,7 +748,7 @@ EXPECT_TRUE(nudge_tracker_.IsRetryRequired()); // The second cycle is a success. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); } @@ -773,19 +781,19 @@ EXPECT_TRUE(nudge_tracker_.IsRetryRequired()); // It succeeds. The retry time is not updated, so it should remain at t5. - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); // Another sync cycle. This one is still before the scheduled retry. It does // not change the scheduled retry time. nudge_tracker_.SetSyncCycleStartTime(t4); EXPECT_FALSE(nudge_tracker_.IsRetryRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); // The retry scheduled way back during the first cycle of this test finally // becomes due. Perform a successful sync cycle to service it. nudge_tracker_.SetSyncCycleStartTime(t6); EXPECT_TRUE(nudge_tracker_.IsRetryRequired()); - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); } // Test the default nudge delays for various types. @@ -911,10 +919,6 @@ return tracker_.AllInvalidationsAccountedFor(); } - void RecordSuccessfulSyncCycle() { - nudge_tracker_.RecordSuccessfulSyncCycle(); - } - private: MockInvalidationTracker tracker_; }; @@ -925,7 +929,7 @@ EXPECT_TRUE(IsInvalidationUnacknowledged(inv_id)); - RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_TRUE(IsInvalidationAcknowledged(inv_id)); EXPECT_TRUE(AllInvalidationsAccountedFor()); @@ -941,7 +945,7 @@ EXPECT_TRUE(IsInvalidationUnacknowledged(inv2_id)); EXPECT_TRUE(IsInvalidationUnacknowledged(inv3_id)); - RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_TRUE(IsInvalidationAcknowledged(inv1_id)); EXPECT_TRUE(IsInvalidationAcknowledged(inv2_id)); EXPECT_TRUE(IsInvalidationAcknowledged(inv3_id)); @@ -972,7 +976,7 @@ EXPECT_TRUE(IsInvalidationDropped(inv10_id)); // This should recover from the drop and bring us back into sync. - RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); for (int id : invalidation_ids) EXPECT_TRUE(IsInvalidationAcknowledged(id)); @@ -986,7 +990,7 @@ TEST_F(NudgeTrackerAckTrackingTest, UnknownVersionFromServer_Simple) { int inv_id = SendUnknownVersionInvalidation(BOOKMARKS); EXPECT_TRUE(IsInvalidationUnacknowledged(inv_id)); - RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_TRUE(IsInvalidationAcknowledged(inv_id)); EXPECT_TRUE(AllInvalidationsAccountedFor()); } @@ -1009,7 +1013,7 @@ EXPECT_TRUE(IsInvalidationUnacknowledged(inv5_id)); // Finish the sync cycle and expect all remaining invalidations to be acked. - RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); EXPECT_TRUE(IsInvalidationAcknowledged(inv1_id)); EXPECT_TRUE(IsInvalidationAcknowledged(inv2_id)); EXPECT_TRUE(IsInvalidationAcknowledged(inv3_id));
diff --git a/components/sync/engine_impl/model_type_worker.cc b/components/sync/engine_impl/model_type_worker.cc index faba91b5..0419b780 100644 --- a/components/sync/engine_impl/model_type_worker.cc +++ b/components/sync/engine_impl/model_type_worker.cc
@@ -24,7 +24,6 @@ #include "components/sync/base/model_type.h" #include "components/sync/base/time.h" #include "components/sync/base/unique_position.h" -#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/engine/model_type_processor.h" #include "components/sync/engine_impl/commit_contribution.h" #include "components/sync/engine_impl/non_blocking_type_commit_contribution.h" @@ -328,18 +327,8 @@ } response_data->encryption_key_name = specifics.password().encrypted().key_name(); - // TODO(crbug.com/902349): Once passwords are fully migrated to USS and this - // feature toggle isn't needed anymore, make sure to remove the - // "+components/sync/driver", from "components/sync/engine_impl/DEPS" - if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSPasswords)) { - data.specifics = specifics; - } else { - // Full-blown USS implementation requires the password to be decrypted at - // the worker. - if (!DecryptPasswordSpecifics(*cryptographer, specifics, - &data.specifics)) { - return FAILED_TO_DECRYPT; - } + if (!DecryptPasswordSpecifics(*cryptographer, specifics, &data.specifics)) { + return FAILED_TO_DECRYPT; } response_data->entity = data.PassToPtr(); return SUCCESS; @@ -586,16 +575,10 @@ ++it; continue; } - if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSPasswords)) { - specifics = data->specifics; - } else { - // Full-blown USS implementation requires the password to be decrypted - // at the worker. - if (!DecryptPasswordSpecifics(*cryptographer_, data->specifics, - &specifics)) { - ++it; - continue; - } + if (!DecryptPasswordSpecifics(*cryptographer_, data->specifics, + &specifics)) { + ++it; + continue; } } else { DCHECK(data->specifics.has_encrypted());
diff --git a/components/sync/engine_impl/non_blocking_type_commit_contribution.cc b/components/sync/engine_impl/non_blocking_type_commit_contribution.cc index 94c2a2df..731bb186 100644 --- a/components/sync/engine_impl/non_blocking_type_commit_contribution.cc +++ b/components/sync/engine_impl/non_blocking_type_commit_contribution.cc
@@ -11,7 +11,6 @@ #include "base/values.h" #include "components/sync/base/time.h" #include "components/sync/base/unique_position.h" -#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/engine/non_blocking_sync_common.h" #include "components/sync/engine_impl/model_type_worker.h" #include "components/sync/protocol/proto_value_conversions.h" @@ -231,37 +230,26 @@ // Encrypt the specifics and hide the title if necessary. if (commit_proto->specifics().has_password()) { - if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSPasswords)) { - // If explicit encryption is enabled, password metadata fields must be - // cleared. See documentation in password_specifics.proto. - if (IsExplicitPassphrase(passphrase_type_)) { - commit_proto->mutable_specifics() - ->mutable_password() - ->clear_unencrypted_metadata(); - } - commit_proto->set_name("encrypted"); - } else { - DCHECK(cryptographer_); - const sync_pb::PasswordSpecifics& password_specifics = - commit_proto->specifics().password(); - const sync_pb::PasswordSpecificsData& password_data = - password_specifics.client_only_encrypted_data(); - sync_pb::EntitySpecifics encrypted_password; - if (!IsExplicitPassphrase(passphrase_type_) && - password_specifics.unencrypted_metadata().url() != - password_data.signon_realm()) { - encrypted_password.mutable_password() - ->mutable_unencrypted_metadata() - ->set_url(password_data.signon_realm()); - } - - bool result = cryptographer_->Encrypt( - password_data, - encrypted_password.mutable_password()->mutable_encrypted()); - DCHECK(result); - *commit_proto->mutable_specifics() = std::move(encrypted_password); - commit_proto->set_name("encrypted"); + DCHECK(cryptographer_); + const sync_pb::PasswordSpecifics& password_specifics = + commit_proto->specifics().password(); + const sync_pb::PasswordSpecificsData& password_data = + password_specifics.client_only_encrypted_data(); + sync_pb::EntitySpecifics encrypted_password; + if (!IsExplicitPassphrase(passphrase_type_) && + password_specifics.unencrypted_metadata().url() != + password_data.signon_realm()) { + encrypted_password.mutable_password() + ->mutable_unencrypted_metadata() + ->set_url(password_data.signon_realm()); } + + bool result = cryptographer_->Encrypt( + password_data, + encrypted_password.mutable_password()->mutable_encrypted()); + DCHECK(result); + *commit_proto->mutable_specifics() = std::move(encrypted_password); + commit_proto->set_name("encrypted"); } else if (cryptographer_) { if (commit_proto->has_specifics()) { sync_pb::EntitySpecifics encrypted_specifics;
diff --git a/components/sync/engine_impl/sync_scheduler_impl.cc b/components/sync/engine_impl/sync_scheduler_impl.cc index 8442f85..c12e1862 100644 --- a/components/sync/engine_impl/sync_scheduler_impl.cc +++ b/components/sync/engine_impl/sync_scheduler_impl.cc
@@ -116,8 +116,6 @@ // Helper macros to log with the syncer thread name; useful when there // are multiple syncer threads involved. -#define SLOG(severity) LOG(severity) << name_ << ": " - #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " #define SDVLOG_LOC(from_here, verbose_level) \ @@ -226,7 +224,8 @@ // Update our current time before checking IsRetryRequired(). nudge_tracker_.SetSyncCycleStartTime(TimeTicks::Now()); - if (nudge_tracker_.IsSyncRequired() && CanRunNudgeJobNow(NORMAL_PRIORITY)) { + if (nudge_tracker_.IsSyncRequired(GetEnabledAndUnblockedTypes()) && + CanRunNudgeJobNow(NORMAL_PRIORITY)) { TrySyncCycleJob(); } } @@ -466,16 +465,21 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(CanRunNudgeJobNow(priority)); + ModelTypeSet types = GetEnabledAndUnblockedTypes(); DVLOG(2) << "Will run normal mode sync cycle with types " - << ModelTypeSetToString(GetEnabledAndUnblockedTypes()); + << ModelTypeSetToString(types); SyncCycle cycle(cycle_context_, this); - bool success = syncer_->NormalSyncShare(GetEnabledAndUnblockedTypes(), - &nudge_tracker_, &cycle); + bool success = syncer_->NormalSyncShare(types, &nudge_tracker_, &cycle); if (success) { // That cycle took care of any outstanding work we had. SDVLOG(2) << "Nudge succeeded."; - nudge_tracker_.RecordSuccessfulSyncCycle(); + // Note that some types might have become blocked (throttled) during the + // cycle. NudgeTracker knows of that, and won't clear any "outstanding work" + // flags for these types. + // TODO(crbug.com/930074): Consider renaming this method to + // RecordSuccessfulSyncCycleIfNotBlocked. + nudge_tracker_.RecordSuccessfulSyncCycle(types); HandleSuccess(); // If this was a canary, we may need to restart the poll timer (the poll @@ -736,7 +740,7 @@ DoClearServerDataSyncCycleJob(priority); } } else if (CanRunNudgeJobNow(priority)) { - if (nudge_tracker_.IsSyncRequired()) { + if (nudge_tracker_.IsSyncRequired(GetEnabledAndUnblockedTypes())) { SDVLOG(2) << "Found pending nudge job"; DoNudgeSyncCycleJob(priority); } else if (((TimeTicks::Now() - last_poll_reset_) >= GetPollInterval())) { @@ -786,10 +790,12 @@ // Maybe this is a good time to run a nudge job. Let's try it. // If not a good time, reschedule a new run. - if (nudge_tracker_.IsSyncRequired() && CanRunNudgeJobNow(NORMAL_PRIORITY)) + if (nudge_tracker_.IsSyncRequired(GetEnabledAndUnblockedTypes()) && + CanRunNudgeJobNow(NORMAL_PRIORITY)) { TrySyncCycleJob(); - else + } else { RestartWaiting(); + } } void SyncSchedulerImpl::PerformDelayedNudge() { @@ -985,7 +991,6 @@ #undef SDVLOG_LOC #undef SDVLOG -#undef SLOG #undef ENUM_CASE } // namespace syncer
diff --git a/components/sync/engine_impl/sync_scheduler_impl.h b/components/sync/engine_impl/sync_scheduler_impl.h index c2233fd5..6217838 100644 --- a/components/sync/engine_impl/sync_scheduler_impl.h +++ b/components/sync/engine_impl/sync_scheduler_impl.h
@@ -35,7 +35,7 @@ class SyncSchedulerImpl : public SyncScheduler { public: // |name| is a display string to identify the syncer thread. Takes - // |ownership of |syncer| and |delay_provider|. + // ownership of |syncer| and |delay_provider|. SyncSchedulerImpl(const std::string& name, BackoffDelayProvider* delay_provider, SyncCycleContext* context, @@ -106,7 +106,6 @@ }; friend class SyncSchedulerImplTest; - friend class SyncSchedulerWhiteboxTest; friend class SyncerTest; FRIEND_TEST_ALL_PREFIXES(SyncSchedulerTest, TransientPollFailure);
diff --git a/components/sync/engine_impl/sync_scheduler_impl_unittest.cc b/components/sync/engine_impl/sync_scheduler_impl_unittest.cc index 0c18215..a11f794 100644 --- a/components/sync/engine_impl/sync_scheduler_impl_unittest.cc +++ b/components/sync/engine_impl/sync_scheduler_impl_unittest.cc
@@ -44,6 +44,7 @@ using testing::Lt; using testing::Mock; using testing::Return; +using testing::SaveArg; using testing::WithArg; using testing::WithArgs; using testing::WithoutArgs; @@ -129,6 +130,8 @@ model_type_registry_ = std::make_unique<ModelTypeRegistry>( workers_, test_user_share_.user_share(), &mock_nudge_handler_, UssMigrator(), &cancelation_signal_); + model_type_registry_->RegisterDirectoryType(HISTORY_DELETE_DIRECTIVES, + GROUP_UI); model_type_registry_->RegisterDirectoryType(NIGORI, GROUP_PASSIVE); model_type_registry_->RegisterDirectoryType(THEMES, GROUP_UI); model_type_registry_->RegisterDirectoryType(TYPED_URLS, GROUP_DB); @@ -147,6 +150,10 @@ RebuildScheduler(); } + void UnregisterDataType(ModelType type) { + model_type_registry_->UnregisterDirectoryType(type); + } + void RebuildScheduler() { // The old syncer is destroyed with the scheduler that owns it. syncer_ = new testing::StrictMock<MockSyncer>(); @@ -394,6 +401,33 @@ RunLoop(); } +TEST_F(SyncSchedulerImplTest, NudgeForDisabledType) { + ModelTypeSet model_types{THEMES, HISTORY_DELETE_DIRECTIVES}; + + StartSyncScheduler(base::Time()); + scheduler()->ScheduleLocalNudge(model_types, FROM_HERE); + + // The user enables a custom passphrase at this point, so + // HISTORY_DELETE_DIRECTIVES gets disabled. + UnregisterDataType(HISTORY_DELETE_DIRECTIVES); + ASSERT_FALSE(context()->GetEnabledTypes().Has(HISTORY_DELETE_DIRECTIVES)); + + // The resulting sync cycle should ask only for the remaining types. + SyncShareTimes times; + NudgeTracker* nudge_tracker = nullptr; + EXPECT_CALL(*syncer(), NormalSyncShare(context()->GetEnabledTypes(), _, _)) + .WillOnce(DoAll(SaveArg<1>(&nudge_tracker), + Invoke(test_util::SimulateNormalSuccess), + RecordSyncShare(×, true))); + RunLoop(); + + // Now no sync is required for the enabled types. + ASSERT_FALSE(nudge_tracker->IsSyncRequired(context()->GetEnabledTypes())); + // ...but HISTORY_DELETE_DIRECTIVES is not enabled, so its earlier nudge is + // still there. + EXPECT_TRUE(nudge_tracker->IsSyncRequired({HISTORY_DELETE_DIRECTIVES})); +} + // Make sure a regular config command is scheduled fine in the absence of any // errors. TEST_F(SyncSchedulerImplTest, Config) {
diff --git a/components/sync/engine_impl/syncer.cc b/components/sync/engine_impl/syncer.cc index d4d745f..c700b54c 100644 --- a/components/sync/engine_impl/syncer.cc +++ b/components/sync/engine_impl/syncer.cc
@@ -46,7 +46,7 @@ SyncCycle* cycle) { base::AutoReset<bool> is_syncing(&is_syncing_, true); HandleCycleBegin(cycle); - if (nudge_tracker->IsGetUpdatesRequired() || + if (nudge_tracker->IsGetUpdatesRequired(request_types) || cycle->context()->ShouldFetchUpdatesBeforeCommit()) { VLOG(1) << "Downloading types " << ModelTypeSetToString(request_types); if (!DownloadAndApplyUpdates(&request_types, cycle,
diff --git a/components/sync/engine_impl/syncer_unittest.cc b/components/sync/engine_impl/syncer_unittest.cc index 9098a41cd..fcdd07a 100644 --- a/components/sync/engine_impl/syncer_unittest.cc +++ b/components/sync/engine_impl/syncer_unittest.cc
@@ -521,10 +521,10 @@ void ConfigureNoGetUpdatesRequired() { context_->set_server_enabled_pre_commit_update_avoidance(true); nudge_tracker_.OnInvalidationsEnabled(); - nudge_tracker_.RecordSuccessfulSyncCycle(); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); ASSERT_FALSE(context_->ShouldFetchUpdatesBeforeCommit()); - ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + ASSERT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); } base::test::ScopedTaskEnvironment task_environment_; @@ -3180,18 +3180,18 @@ TEST_F(SyncerTest, CommitFailureWithConflict) { ConfigureNoGetUpdatesRequired(); CreateUnsyncedDirectory("X", "id_X"); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); EXPECT_TRUE(SyncShareNudge()); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); CreateUnsyncedDirectory("Y", "id_Y"); mock_server_->set_conflict_n_commits(1); EXPECT_FALSE(SyncShareNudge()); - EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired()); + EXPECT_TRUE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); - nudge_tracker_.RecordSuccessfulSyncCycle(); - EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired()); + nudge_tracker_.RecordSuccessfulSyncCycle(ProtocolTypes()); + EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired(ProtocolTypes())); } // Tests that sending debug info events on Commit works. @@ -5728,9 +5728,9 @@ } }; -INSTANTIATE_TEST_CASE_P(ExtensionsActivity, - MixedResult, - testing::Range(0, 1 << TEST_PARAM_BIT_COUNT)); +INSTANTIATE_TEST_SUITE_P(ExtensionsActivity, + MixedResult, + testing::Range(0, 1 << TEST_PARAM_BIT_COUNT)); TEST_P(MixedResult, ExtensionsActivity) { {
diff --git a/components/sync/model/model_type_sync_bridge.cc b/components/sync/model/model_type_sync_bridge.cc index 05cec458..6ad1900 100644 --- a/components/sync/model/model_type_sync_bridge.cc +++ b/components/sync/model/model_type_sync_bridge.cc
@@ -68,12 +68,4 @@ return change_processor_.get(); } -base::Optional<ModelError> -ModelTypeSyncBridge::ApplySyncChangesWithNewEncryptionRequirements( - std::unique_ptr<MetadataChangeList> metadata_change_list, - EntityChangeList entity_changes) { - return ApplySyncChanges(std::move(metadata_change_list), - std::move(entity_changes)); -} - } // namespace syncer
diff --git a/components/sync/model/model_type_sync_bridge.h b/components/sync/model/model_type_sync_bridge.h index ac0b41c..f650aac9 100644 --- a/components/sync/model/model_type_sync_bridge.h +++ b/components/sync/model/model_type_sync_bridge.h
@@ -182,15 +182,6 @@ ModelTypeChangeProcessor* change_processor(); const ModelTypeChangeProcessor* change_processor() const; - // Similar to ApplySyncChanges(), but notifies the bridge that the processor - // is about to recommit all data due to encryption changes. - // TODO(crbug.com/856941): Remove when PASSWORDS are migrated to USS, which - // will likely make this API unnecessary. - virtual base::Optional<ModelError> - ApplySyncChangesWithNewEncryptionRequirements( - std::unique_ptr<MetadataChangeList> metadata_change_list, - EntityChangeList entity_changes); - private: std::unique_ptr<ModelTypeChangeProcessor> change_processor_; };
diff --git a/components/sync/model_impl/client_tag_based_model_type_processor.cc b/components/sync/model_impl/client_tag_based_model_type_processor.cc index f66a2f0..4e6d16c 100644 --- a/components/sync/model_impl/client_tag_based_model_type_processor.cc +++ b/components/sync/model_impl/client_tag_based_model_type_processor.cc
@@ -403,13 +403,8 @@ DCHECK(data); DCHECK(!data->is_deleted()); DCHECK(!data->non_unique_name.empty()); - - // Only the pseudo-USS bridge for PASSWORDS populates encrypted data. - // TODO(crbug.com/856941): Remove when PASSWORDS are migrated to USS and - // replace instead with a DCHECK that verifies the input is not encrypted. - if (!data->specifics.has_encrypted()) { - DCHECK_EQ(type_, GetModelTypeFromSpecifics(data->specifics)); - } + DCHECK(!data->specifics.has_encrypted()); + DCHECK_EQ(type_, GetModelTypeFromSpecifics(data->specifics)); if (!model_type_state_.initial_sync_done()) { // Ignore changes before the initial sync is done. @@ -1121,8 +1116,6 @@ // recommit only the ones whose encryption key doesn't match the one in // DataTypeState. Work is tracked in http://crbug.com/727874. RecommitAllForEncryption(already_updated, metadata_changes.get()); - return bridge_->ApplySyncChangesWithNewEncryptionRequirements( - std::move(metadata_changes), std::move(entity_changes)); } // Inform the bridge of the new or updated data. return bridge_->ApplySyncChanges(std::move(metadata_changes),
diff --git a/components/sync/model_impl/syncable_service_based_bridge.cc b/components/sync/model_impl/syncable_service_based_bridge.cc index 11c531c..8225fe3 100644 --- a/components/sync/model_impl/syncable_service_based_bridge.cc +++ b/components/sync/model_impl/syncable_service_based_bridge.cc
@@ -97,7 +97,8 @@ return ModelError(FROM_HERE, "Failed deserializing data."); } - in_memory_store->emplace(record.id, std::move(persisted_entity)); + in_memory_store->emplace(record.id, + std::move(*persisted_entity.mutable_specifics())); } return base::nullopt; @@ -113,14 +114,11 @@ error_callback, ModelTypeStore* store, SyncableServiceBasedBridge::InMemoryStore* in_memory_store, - scoped_refptr<SyncableServiceBasedBridge::ModelCryptographer> - cryptographer, ModelTypeChangeProcessor* other) : type_(type), error_callback_(error_callback), store_(store), in_memory_store_(in_memory_store), - cryptographer_(std::move(cryptographer)), other_(other) { DCHECK(store); DCHECK(other); @@ -162,28 +160,11 @@ GenerateSyncableHash(type_, sync_data.GetTag()); DCHECK(!storage_key.empty()); + (*in_memory_store_)[storage_key] = sync_data.GetSpecifics(); sync_pb::PersistedEntityData persisted_entity = CreatePersistedFromSyncData(sync_data); - // Production code uses a cryptographer only for PASSWORDS. - if (cryptographer_) { - const base::Optional<ModelError> error = - cryptographer_->Encrypt(persisted_entity.mutable_specifics()); - if (error) { - other_->ReportError(*error); - return SyncError(error->location(), SyncError::CRYPTO_ERROR, - error->message(), type_); - } - persisted_entity.set_non_unique_name("encrypted"); - } - - // Purposefully crash if we have client only data, as this could - // result in storing password in plain text. - CHECK(!persisted_entity.specifics() - .password() - .has_client_only_encrypted_data()); - - (*in_memory_store_)[storage_key] = persisted_entity; batch->WriteData(storage_key, persisted_entity.SerializeAsString()); + other_->Put( storage_key, ConvertPersistedToEntityData( @@ -269,8 +250,6 @@ error_callback_; ModelTypeStore* const store_; SyncableServiceBasedBridge::InMemoryStore* const in_memory_store_; - const scoped_refptr<SyncableServiceBasedBridge::ModelCryptographer> - cryptographer_; ModelTypeChangeProcessor* const other_; SEQUENCE_CHECKER(sequence_checker_); @@ -296,26 +275,19 @@ } // namespace -SyncableServiceBasedBridge::ModelCryptographer::ModelCryptographer() {} - -SyncableServiceBasedBridge::ModelCryptographer::~ModelCryptographer() {} - SyncableServiceBasedBridge::SyncableServiceBasedBridge( ModelType type, OnceModelTypeStoreFactory store_factory, std::unique_ptr<ModelTypeChangeProcessor> change_processor, - SyncableService* syncable_service, - scoped_refptr<ModelCryptographer> cryptographer) + SyncableService* syncable_service) : ModelTypeSyncBridge(std::move(change_processor)), type_(type), syncable_service_(syncable_service), - cryptographer_(std::move(cryptographer)), store_factory_(std::move(store_factory)), syncable_service_started_(false), weak_ptr_factory_(this) { DCHECK(store_factory_); DCHECK(syncable_service_); - DCHECK(cryptographer_ || type_ != PASSWORDS); } SyncableServiceBasedBridge::~SyncableServiceBasedBridge() { @@ -362,22 +334,13 @@ DCHECK(!syncable_service_started_); DCHECK(in_memory_store_.empty()); - std::unique_ptr<ModelTypeStore::WriteBatch> batch = - store_->CreateWriteBatch(); - batch->TakeMetadataChangesFrom(std::move(metadata_change_list)); + StoreAndConvertRemoteChanges(std::move(metadata_change_list), + std::move(entity_change_list)); - { - SyncChangeList sync_change_list; - const base::Optional<ModelError> error = StoreAndConvertRemoteChanges( - std::move(batch), std::move(entity_change_list), &sync_change_list); - if (error) { - return error; - } - } - - // We ignore |sync_change_list| at this point and let - // MaybeStartSyncableService() read from |in_memory_store_|, which has been - // updated above as part of StoreAndConvertRemoteChanges(). + // We ignore the output of previous call of StoreAndConvertRemoteChanges() at + // this point and let MaybeStartSyncableService() read from + // |in_memory_store_|, which has been updated above as part of + // StoreAndConvertRemoteChanges(). return MaybeStartSyncableService(); } @@ -386,44 +349,36 @@ EntityChangeList entity_change_list) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(store_); - return ApplySyncChangesWithBatch(std::move(metadata_change_list), - std::move(entity_change_list), - store_->CreateWriteBatch()); + DCHECK(change_processor()->IsTrackingMetadata()); + DCHECK(syncable_service_started_); + + SyncChangeList sync_change_list = StoreAndConvertRemoteChanges( + std::move(metadata_change_list), std::move(entity_change_list)); + + if (sync_change_list.empty()) { + return base::nullopt; + } + + return ConvertToModelError( + syncable_service_->ProcessSyncChanges(FROM_HERE, sync_change_list)); } void SyncableServiceBasedBridge::GetData(StorageKeyList storage_keys, DataCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(store_); - - auto batch = std::make_unique<MutableDataBatch>(); - for (const std::string& storage_key : storage_keys) { - auto it = in_memory_store_.find(storage_key); - if (it == in_memory_store_.end()) { - // Suggests orphan metadata, which the processor should handle. - continue; - } - - batch->Put(storage_key, ConvertPersistedToEntityData( - /*client_tag_hash=*/storage_key, it->second)); - } - - std::move(callback).Run(std::move(batch)); + store_->ReadData( + storage_keys, + base::BindOnce(&SyncableServiceBasedBridge::OnReadDataForProcessor, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } void SyncableServiceBasedBridge::GetAllDataForDebugging(DataCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(store_); - - auto batch = std::make_unique<MutableDataBatch>(); - for (const std::pair<const std::string, sync_pb::PersistedEntityData>& - record : in_memory_store_) { - batch->Put(record.first, - ConvertPersistedToEntityData( - /*client_tag_hash=*/record.first, record.second)); - } - - std::move(callback).Run(std::move(batch)); + store_->ReadAllData( + base::BindOnce(&SyncableServiceBasedBridge::OnReadAllDataForProcessor, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } std::string SyncableServiceBasedBridge::GetClientTag( @@ -492,27 +447,6 @@ return base::trace_event::EstimateMemoryUsage(in_memory_store_); } -base::Optional<ModelError> -SyncableServiceBasedBridge::ApplySyncChangesWithNewEncryptionRequirements( - std::unique_ptr<MetadataChangeList> metadata_change_list, - EntityChangeList entity_changes) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(store_); - - std::unique_ptr<ModelTypeStore::WriteBatch> batch = - store_->CreateWriteBatch(); - if (cryptographer_) { - // This is used by PASSWORDS only. - base::Optional<ModelError> error = ReencryptEverything(batch.get()); - if (error) { - return error; - } - } - - return ApplySyncChangesWithBatch(std::move(metadata_change_list), - std::move(entity_changes), std::move(batch)); -} - // static std::unique_ptr<SyncChangeProcessor> SyncableServiceBasedBridge::CreateLocalChangeProcessorForTesting( @@ -522,7 +456,7 @@ ModelTypeChangeProcessor* other) { return std::make_unique<LocalChangeProcessor>( type, /*error_callback=*/base::DoNothing(), store, in_memory_store, - /*cryptographer=*/nullptr, other); + other); } void SyncableServiceBasedBridge::OnStoreCreated( @@ -612,21 +546,10 @@ // this function is reached only if sync is starting already. SyncDataList initial_sync_data; initial_sync_data.reserve(in_memory_store_.size()); - for (const std::pair<const std::string, sync_pb::PersistedEntityData>& - record : in_memory_store_) { - sync_pb::EntitySpecifics specifics = record.second.specifics(); - - // Production code uses a cryptographer only for PASSWORDS. - if (cryptographer_) { - const base::Optional<ModelError> error = - cryptographer_->Decrypt(&specifics); - if (error) { - return error; - } - } - + for (const std::pair<const std::string, sync_pb::EntitySpecifics>& record : + in_memory_store_) { initial_sync_data.push_back(SyncData::CreateRemoteData( - /*id=*/kInvalidNodeId, std::move(specifics), + /*id=*/kInvalidNodeId, std::move(record.second), /*client_tag_hash=*/record.first)); } @@ -634,7 +557,7 @@ base::BindRepeating(&SyncableServiceBasedBridge::ReportErrorIfSet, weak_ptr_factory_.GetWeakPtr()); auto local_change_processor = std::make_unique<LocalChangeProcessor>( - type_, error_callback, store_.get(), &in_memory_store_, cryptographer_, + type_, error_callback, store_.get(), &in_memory_store_, change_processor()); const base::Optional<ModelError> merge_error = ConvertToModelError( @@ -653,15 +576,15 @@ return merge_error; } -base::Optional<ModelError> -SyncableServiceBasedBridge::StoreAndConvertRemoteChanges( - std::unique_ptr<ModelTypeStore::WriteBatch> batch, - EntityChangeList input_entity_change_list, - SyncChangeList* output_sync_change_list) { - DCHECK(output_sync_change_list); +SyncChangeList SyncableServiceBasedBridge::StoreAndConvertRemoteChanges( + std::unique_ptr<MetadataChangeList> initial_metadata_change_list, + EntityChangeList input_entity_change_list) { + std::unique_ptr<ModelTypeStore::WriteBatch> batch = + store_->CreateWriteBatch(); + batch->TakeMetadataChangesFrom(std::move(initial_metadata_change_list)); - output_sync_change_list->clear(); - output_sync_change_list->reserve(input_entity_change_list.size()); + SyncChangeList output_sync_change_list; + output_sync_change_list.reserve(input_entity_change_list.size()); for (const EntityChange& change : input_entity_change_list) { switch (change.type()) { @@ -670,30 +593,17 @@ DCHECK_NE(0U, in_memory_store_.count(storage_key)); DVLOG(1) << ModelTypeToString(type_) << ": Processing deletion with storage key: " << storage_key; - - sync_pb::EntitySpecifics specifics = - std::move(*in_memory_store_[storage_key].mutable_specifics()); - in_memory_store_.erase(storage_key); - - // Production code uses a cryptographer only for PASSWORDS. - if (cryptographer_) { - const base::Optional<ModelError> error = - cryptographer_->Decrypt(&specifics); - if (error) { - return error; - } - } - - output_sync_change_list->emplace_back( + output_sync_change_list.emplace_back( FROM_HERE, SyncChange::ACTION_DELETE, SyncData::CreateRemoteData( - /*id=*/kInvalidNodeId, std::move(specifics), + /*id=*/kInvalidNodeId, in_memory_store_[storage_key], change.data().client_tag_hash)); // For tombstones, there is no actual data, which means no client tag // hash either, but the processor provides the storage key. DCHECK(!storage_key.empty()); batch->DeleteData(storage_key); + in_memory_store_.erase(storage_key); break; } @@ -710,34 +620,16 @@ DVLOG(1) << ModelTypeToString(type_) << ": Processing add/update with key: " << storage_key; - sync_pb::PersistedEntityData persisted_entity = - CreatePersistedFromEntityData(change.data()); - - // Purposefully crash if we have client only data, as this could - // result in storing password in plain text. - CHECK(!persisted_entity.specifics() - .password() - .has_client_only_encrypted_data()); - - batch->WriteData(storage_key, persisted_entity.SerializeAsString()); - in_memory_store_[storage_key] = persisted_entity; - - // Production code uses a cryptographer only for PASSWORDS. - if (cryptographer_) { - const base::Optional<ModelError> error = - cryptographer_->Decrypt(persisted_entity.mutable_specifics()); - if (error) { - return error; - } - } - - output_sync_change_list->emplace_back( + output_sync_change_list.emplace_back( FROM_HERE, ConvertToSyncChangeType(change.type()), SyncData::CreateRemoteData( - /*id=*/kInvalidNodeId, - std::move(*persisted_entity.mutable_specifics()), + /*id=*/kInvalidNodeId, change.data().specifics, change.data().client_tag_hash)); + batch->WriteData( + storage_key, + CreatePersistedFromEntityData(change.data()).SerializeAsString()); + in_memory_store_[storage_key] = change.data().specifics; break; } } @@ -748,7 +640,43 @@ base::BindOnce(&SyncableServiceBasedBridge::ReportErrorIfSet, weak_ptr_factory_.GetWeakPtr())); - return base::nullopt; + return output_sync_change_list; +} + +void SyncableServiceBasedBridge::OnReadDataForProcessor( + DataCallback callback, + const base::Optional<ModelError>& error, + std::unique_ptr<ModelTypeStore::RecordList> record_list, + std::unique_ptr<ModelTypeStore::IdList> missing_id_list) { + OnReadAllDataForProcessor(std::move(callback), error, std::move(record_list)); +} + +void SyncableServiceBasedBridge::OnReadAllDataForProcessor( + DataCallback callback, + const base::Optional<ModelError>& error, + std::unique_ptr<ModelTypeStore::RecordList> record_list) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + if (error) { + change_processor()->ReportError(*error); + return; + } + + auto batch = std::make_unique<MutableDataBatch>(); + for (const ModelTypeStore::Record& record : *record_list) { + sync_pb::PersistedEntityData persisted_entity; + if (record.id.empty() || !persisted_entity.ParseFromString(record.value)) { + change_processor()->ReportError( + {FROM_HERE, "Failed deserializing data."}); + return; + } + + // Note that client tag hash is used as storage key too. + batch->Put(record.id, + ConvertPersistedToEntityData( + /*client_tag_hash=*/record.id, std::move(persisted_entity))); + } + std::move(callback).Run(std::move(batch)); } void SyncableServiceBasedBridge::ReportErrorIfSet( @@ -758,70 +686,6 @@ } } -base::Optional<ModelError> SyncableServiceBasedBridge::ReencryptEverything( - ModelTypeStore::WriteBatch* batch) { - DCHECK(cryptographer_); - - DVLOG(1) << "Encryption key changed: reencrypting all data for " - << ModelTypeToString(type_) << " with " << in_memory_store_.size() - << " entities"; - - for (std::pair<const std::string, sync_pb::PersistedEntityData>& record : - in_memory_store_) { - const std::string& storage_key = record.first; - sync_pb::EntitySpecifics* specifics = record.second.mutable_specifics(); - - base::Optional<ModelError> error; - error = cryptographer_->Decrypt(specifics); - if (error) { - return error; - } - - error = cryptographer_->Encrypt(specifics); - if (error) { - return error; - } - - // Purposefully crash if we have client only data, as this could - // result in storing password in plain text. - CHECK(!specifics->password().has_client_only_encrypted_data()); - - batch->WriteData(storage_key, record.second.SerializeAsString()); - - // No need to call Put() because the processor will recommit all entries - // anyway. - } - - return base::nullopt; -} - -base::Optional<ModelError> -SyncableServiceBasedBridge::ApplySyncChangesWithBatch( - std::unique_ptr<MetadataChangeList> metadata_change_list, - EntityChangeList entity_change_list, - std::unique_ptr<ModelTypeStore::WriteBatch> batch) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(store_); - DCHECK(change_processor()->IsTrackingMetadata()); - DCHECK(syncable_service_started_); - - batch->TakeMetadataChangesFrom(std::move(metadata_change_list)); - - SyncChangeList sync_change_list; - const base::Optional<ModelError> error = StoreAndConvertRemoteChanges( - std::move(batch), std::move(entity_change_list), &sync_change_list); - if (error) { - return error; - } - - if (sync_change_list.empty()) { - return base::nullopt; - } - - return ConvertToModelError( - syncable_service_->ProcessSyncChanges(FROM_HERE, sync_change_list)); -} - void SyncableServiceBasedBridge::RecordAssociationTime( base::TimeDelta time) const { // This mimics the implementation in SharedChangeProcessor.
diff --git a/components/sync/model_impl/syncable_service_based_bridge.h b/components/sync/model_impl/syncable_service_based_bridge.h index 1f2351b..04dda28 100644 --- a/components/sync/model_impl/syncable_service_based_bridge.h +++ b/components/sync/model_impl/syncable_service_based_bridge.h
@@ -12,7 +12,6 @@ #include "base/callback_forward.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "components/sync/model/model_error.h" @@ -22,7 +21,6 @@ namespace sync_pb { class EntitySpecifics; -class PersistedEntityData; } // namespace sync_pb namespace syncer { @@ -38,37 +36,14 @@ // considered an implementation detail. class SyncableServiceBasedBridge : public ModelTypeSyncBridge { public: - using InMemoryStore = std::map<std::string, sync_pb::PersistedEntityData>; - - // Used for passwords only. - // TODO(crbug.com/856941): Remove when PASSWORDS are migrated to USS, which - // will likely make this API unnecessary. - class ModelCryptographer - : public base::RefCountedThreadSafe<ModelCryptographer> { - public: - ModelCryptographer(); - - virtual base::Optional<ModelError> Decrypt( - sync_pb::EntitySpecifics* specifics) = 0; - virtual base::Optional<ModelError> Encrypt( - sync_pb::EntitySpecifics* specifics) = 0; - - protected: - virtual ~ModelCryptographer(); - - private: - friend class base::RefCountedThreadSafe<ModelCryptographer>; - - DISALLOW_COPY_AND_ASSIGN(ModelCryptographer); - }; + using InMemoryStore = std::map<std::string, sync_pb::EntitySpecifics>; // Pointers must not be null and |syncable_service| must outlive this object. SyncableServiceBasedBridge( ModelType type, OnceModelTypeStoreFactory store_factory, std::unique_ptr<ModelTypeChangeProcessor> change_processor, - SyncableService* syncable_service, - scoped_refptr<ModelCryptographer> cryptographer = nullptr); + SyncableService* syncable_service); ~SyncableServiceBasedBridge() override; // ModelTypeSyncBridge implementation. @@ -92,9 +67,6 @@ StopSyncResponse ApplyStopSyncChanges( std::unique_ptr<MetadataChangeList> delete_metadata_change_list) override; size_t EstimateSyncOverheadMemoryUsage() const override; - base::Optional<ModelError> ApplySyncChangesWithNewEncryptionRequirements( - std::unique_ptr<MetadataChangeList> metadata_change_list, - EntityChangeList entity_changes) override; // For testing. static std::unique_ptr<SyncChangeProcessor> @@ -111,22 +83,23 @@ void OnReadAllMetadataForInit(const base::Optional<ModelError>& error, std::unique_ptr<MetadataBatch> metadata_batch); base::Optional<ModelError> MaybeStartSyncableService() WARN_UNUSED_RESULT; - base::Optional<ModelError> StoreAndConvertRemoteChanges( - std::unique_ptr<ModelTypeStore::WriteBatch> batch, - EntityChangeList input_entity_change_list, - SyncChangeList* output_sync_change_list) WARN_UNUSED_RESULT; - void ReportErrorIfSet(const base::Optional<ModelError>& error); - base::Optional<ModelError> ReencryptEverything( - ModelTypeStore::WriteBatch* batch); - base::Optional<ModelError> ApplySyncChangesWithBatch( + SyncChangeList StoreAndConvertRemoteChanges( std::unique_ptr<MetadataChangeList> metadata_change_list, - EntityChangeList entity_change_list, - std::unique_ptr<ModelTypeStore::WriteBatch> batch); + EntityChangeList input_entity_change_list); + void OnReadDataForProcessor( + DataCallback callback, + const base::Optional<ModelError>& error, + std::unique_ptr<ModelTypeStore::RecordList> record_list, + std::unique_ptr<ModelTypeStore::IdList> missing_id_list); + void OnReadAllDataForProcessor( + DataCallback callback, + const base::Optional<ModelError>& error, + std::unique_ptr<ModelTypeStore::RecordList> record_list); + void ReportErrorIfSet(const base::Optional<ModelError>& error); void RecordAssociationTime(base::TimeDelta time) const; const ModelType type_; SyncableService* const syncable_service_; - const scoped_refptr<ModelCryptographer> cryptographer_; OnceModelTypeStoreFactory store_factory_; std::unique_ptr<ModelTypeStore> store_;
diff --git a/components/sync/model_impl/syncable_service_based_bridge_unittest.cc b/components/sync/model_impl/syncable_service_based_bridge_unittest.cc index 8ab1d2eb..54b4fa1 100644 --- a/components/sync/model_impl/syncable_service_based_bridge_unittest.cc +++ b/components/sync/model_impl/syncable_service_based_bridge_unittest.cc
@@ -5,7 +5,6 @@ #include "components/sync/model_impl/syncable_service_based_bridge.h" #include <utility> -#include <vector> #include "base/bind.h" #include "base/bind_helpers.h" @@ -40,8 +39,6 @@ using testing::SaveArg; using testing::_; -using ModelCryptographer = SyncableServiceBasedBridge::ModelCryptographer; - const ModelType kModelType = PREFERENCES; sync_pb::EntitySpecifics GetTestSpecifics(const std::string& name = "name") { @@ -66,14 +63,6 @@ return arg && arg->specifics.preference().name() == name; } -MATCHER(IsEncrypted, "") { - return arg && arg->specifics.encrypted().has_blob(); -} - -MATCHER_P(IsEncryptedWithKey, key, "") { - return arg && arg->specifics.encrypted().key_name() == key; -} - class MockSyncableService : public SyncableService { public: MOCK_METHOD4( @@ -89,59 +78,6 @@ MOCK_CONST_METHOD1(GetAllSyncData, SyncDataList(ModelType type)); }; -// Simple ModelCryptographer implementation that serializes the input proto to a -// string, prepends a prefix (representing the encryption key) and puts the -// result in proto field EntitySpecifics.encrypted.blob. -class TestModelCryptographer : public ModelCryptographer { - public: - TestModelCryptographer() { AddKey("DefaultKey"); } - - void AddKey(const std::string& key) { keys_.push_back(key); } - - base::Optional<ModelError> Decrypt( - sync_pb::EntitySpecifics* specifics) override { - if (!specifics->has_encrypted()) { - return ModelError(FROM_HERE, "Not encrypted"); - } - const std::string& actual_key = specifics->encrypted().key_name(); - if (std::find(keys_.begin(), keys_.end(), actual_key) == keys_.end()) { - return ModelError(FROM_HERE, "Unknown key"); - } - if (specifics->encrypted().blob().find(actual_key) != 0) { - return ModelError(FROM_HERE, "Corrupt blob"); - } - sync_pb::EntitySpecifics unencrypted_specifics; - const std::string blob_without_key = - specifics->encrypted().blob().substr(actual_key.size()); - if (!unencrypted_specifics.ParseFromString(blob_without_key)) { - return ModelError(FROM_HERE, "Cannot parse blob"); - } - *specifics = unencrypted_specifics; - return base::nullopt; - } - - base::Optional<ModelError> Encrypt( - sync_pb::EntitySpecifics* specifics) override { - if (specifics->has_encrypted()) { - return ModelError(FROM_HERE, "Already encrypted"); - } - sync_pb::EntitySpecifics encrypted_specifics; - encrypted_specifics.mutable_encrypted()->set_key_name(keys_.back()); - encrypted_specifics.mutable_encrypted()->set_blob( - keys_.back() + specifics->SerializeAsString()); - *specifics = encrypted_specifics; - return base::nullopt; - } - - protected: - ~TestModelCryptographer() override {} - - private: - std::vector<std::string> keys_; - - DISALLOW_COPY_AND_ASSIGN(TestModelCryptographer); -}; - class SyncableServiceBasedBridgeTest : public ::testing::Test { protected: SyncableServiceBasedBridgeTest() @@ -158,8 +94,7 @@ ~SyncableServiceBasedBridgeTest() override {} - void InitializeBridge( - scoped_refptr<ModelCryptographer> cryptographer = nullptr) { + void InitializeBridge() { real_processor_ = std::make_unique<syncer::ClientTagBasedModelTypeProcessor>( kModelType, /*dump_stack=*/base::DoNothing(), @@ -168,8 +103,7 @@ bridge_ = std::make_unique<SyncableServiceBasedBridge>( kModelType, ModelTypeStoreTestUtil::FactoryForForwardingStore(store_.get()), - mock_processor_.CreateForwardingProcessor(), &syncable_service_, - cryptographer); + mock_processor_.CreateForwardingProcessor(), &syncable_service_); } void ShutdownBridge() { @@ -543,154 +477,6 @@ EXPECT_THAT(GetAllData(), IsEmpty()); } -TEST_F(SyncableServiceBasedBridgeTest, ShouldDecryptInitialRemoteData) { - auto cryptographer = base::MakeRefCounted<TestModelCryptographer>(); - InitializeBridge(cryptographer); - StartSyncing(); - - EXPECT_CALL(mock_error_handler_, Run(_)).Times(0); - // Once the initial encrypted data is fetched from the server, - // MergeDataAndStartSyncing() should be exercised, which should receive - // decrypted specifics. - EXPECT_CALL(syncable_service_, - MergeDataAndStartSyncing( - kModelType, ElementsAre(SyncDataRemoteMatches("name1")), - NotNull(), NotNull())); - sync_pb::EntitySpecifics specifics = GetTestSpecifics("name1"); - ASSERT_FALSE(cryptographer->Encrypt(&specifics)); - worker_->UpdateFromServer(kClientTagHash, specifics); - // The bridge's store should contain encrypted content. - EXPECT_THAT(GetAllData(), ElementsAre(Pair(kClientTagHash, IsEncrypted()))); -} - -TEST_F(SyncableServiceBasedBridgeTest, - ShouldHandleDecryptionErrorForInitialRemoteData) { - auto cryptographer = base::MakeRefCounted<TestModelCryptographer>(); - InitializeBridge(cryptographer); - StartSyncing(); - - EXPECT_CALL(mock_error_handler_, Run(_)); - EXPECT_CALL(syncable_service_, MergeDataAndStartSyncing(_, _, _, _)).Times(0); - - sync_pb::EntitySpecifics specifics; - specifics.mutable_encrypted()->set_blob("corrupt-encrypted-blob"); - ASSERT_TRUE(cryptographer->Decrypt(&specifics)); - worker_->UpdateFromServer(kClientTagHash, specifics); -} - -TEST_F(SyncableServiceBasedBridgeTest, ShouldDecryptForRemoteDeletion) { - auto cryptographer = base::MakeRefCounted<TestModelCryptographer>(); - InitializeBridge(cryptographer); - StartSyncing(); - - sync_pb::EntitySpecifics specifics = GetTestSpecifics("name1"); - ASSERT_FALSE(cryptographer->Encrypt(&specifics)); - worker_->UpdateFromServer(kClientTagHash, specifics); - ASSERT_THAT(start_syncing_sync_processor_, NotNull()); - ASSERT_THAT(GetAllData(), ElementsAre(Pair(kClientTagHash, IsEncrypted()))); - - EXPECT_CALL(mock_error_handler_, Run(_)).Times(0); - EXPECT_CALL(syncable_service_, - ProcessSyncChanges(_, ElementsAre(SyncChangeMatches( - SyncChange::ACTION_DELETE, "name1")))); - worker_->TombstoneFromServer(kClientTagHash); - EXPECT_THAT(GetAllData(), IsEmpty()); -} - -TEST_F(SyncableServiceBasedBridgeTest, - ShouldDecryptPreviousDirectoryDataAfterRestart) { - auto cryptographer = base::MakeRefCounted<TestModelCryptographer>(); - InitializeBridge(cryptographer); - StartSyncing(); - - sync_pb::EntitySpecifics specifics = GetTestSpecifics("name1"); - ASSERT_FALSE(cryptographer->Encrypt(&specifics)); - worker_->UpdateFromServer(kClientTagHash, specifics); - // The bridge's store should contain encrypted content. - ASSERT_THAT(GetAllData(), ElementsAre(Pair(kClientTagHash, IsEncrypted()))); - - EXPECT_CALL(mock_error_handler_, Run(_)).Times(0); - // Mimic restart, which shouldn't start syncing until OnSyncStarting() is - // received (exercised in StartSyncing()). - ShutdownBridge(); - InitializeBridge(cryptographer); - - EXPECT_CALL(syncable_service_, - MergeDataAndStartSyncing( - kModelType, ElementsAre(SyncDataRemoteMatches("name1")), - NotNull(), NotNull())); - StartSyncing(); - - // The bridge's store should still contain encrypted content. - EXPECT_THAT(GetAllData(), ElementsAre(Pair(kClientTagHash, IsEncrypted()))); -} - -TEST_F(SyncableServiceBasedBridgeTest, ShouldEncryptLocalCreation) { - auto cryptographer = base::MakeRefCounted<TestModelCryptographer>(); - InitializeBridge(cryptographer); - StartSyncing(); - worker_->UpdateFromServer(); - - ASSERT_THAT(start_syncing_sync_processor_, NotNull()); - ASSERT_THAT(GetAllData(), IsEmpty()); - EXPECT_CALL(mock_error_handler_, Run(_)).Times(0); - - // The processor should receive encrypted data. - EXPECT_CALL(mock_processor_, Put(kClientTagHash, IsEncrypted(), NotNull())); - - SyncChangeList change_list; - change_list.emplace_back( - FROM_HERE, SyncChange::ACTION_ADD, - SyncData::CreateLocalData(kClientTag, "title", GetTestSpecifics())); - const SyncError error = - start_syncing_sync_processor_->ProcessSyncChanges(FROM_HERE, change_list); - EXPECT_FALSE(error.IsSet()); - EXPECT_THAT(GetAllData(), ElementsAre(Pair(kClientTagHash, IsEncrypted()))); -} - -TEST_F(SyncableServiceBasedBridgeTest, ShouldReencryptDataUponKeyChange) { - const std::string kEncryptionKey1 = "EncryptionKey1"; - const std::string kEncryptionKey2 = "EncryptionKey2"; - - auto cryptographer = base::MakeRefCounted<TestModelCryptographer>(); - cryptographer->AddKey(kEncryptionKey1); - InitializeBridge(cryptographer); - StartSyncing(); - - EXPECT_CALL(mock_error_handler_, Run(_)).Times(0); - - sync_pb::EntitySpecifics specifics = GetTestSpecifics("name1"); - ASSERT_FALSE(cryptographer->Encrypt(&specifics)); - worker_->UpdateFromServer(kClientTagHash, specifics); - // The bridge's store should contain encrypted content. - ASSERT_THAT( - GetAllData(), - ElementsAre(Pair(kClientTagHash, IsEncryptedWithKey(kEncryptionKey1)))); - - // Mimic reencryption. - EXPECT_CALL(mock_processor_, Put(_, _, _)).Times(0); - cryptographer->AddKey(kEncryptionKey2); - worker_->UpdateWithEncryptionKey(kEncryptionKey2); - - // The bridge's store should still contain encrypted content. - EXPECT_THAT( - GetAllData(), - ElementsAre(Pair(kClientTagHash, IsEncryptedWithKey(kEncryptionKey2)))); - - // Mimic restart, which shouldn't start syncing until OnSyncStarting() is - // received (exercised in StartSyncing()). Having reencrypted the data should - // not be noticeable by the SyncableService, which should receive the data - // unencrypted. - ShutdownBridge(); - InitializeBridge(cryptographer); - - EXPECT_CALL(syncable_service_, - MergeDataAndStartSyncing( - kModelType, ElementsAre(SyncDataRemoteMatches("name1")), - NotNull(), NotNull())); - StartSyncing(); -} - TEST(SyncableServiceBasedBridgeLocalChangeProcessorTest, ShouldDropIfCommitted) { const std::string kClientTagHash = "clienttaghash1"; @@ -698,10 +484,10 @@ base::test::ScopedTaskEnvironment task_environment; std::unique_ptr<ModelTypeStore> store = ModelTypeStoreTestUtil::CreateInMemoryStoreForTest(); - std::map<std::string, sync_pb::PersistedEntityData> in_memory_store; + SyncableServiceBasedBridge::InMemoryStore in_memory_store; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor; - in_memory_store[kClientTagHash] = sync_pb::PersistedEntityData(); + in_memory_store[kClientTagHash] = sync_pb::EntitySpecifics(); std::unique_ptr<SyncChangeProcessor> sync_change_processor = SyncableServiceBasedBridge::CreateLocalChangeProcessorForTesting( @@ -733,10 +519,10 @@ base::test::ScopedTaskEnvironment task_environment; std::unique_ptr<ModelTypeStore> store = ModelTypeStoreTestUtil::CreateInMemoryStoreForTest(); - std::map<std::string, sync_pb::PersistedEntityData> in_memory_store; + SyncableServiceBasedBridge::InMemoryStore in_memory_store; testing::NiceMock<MockModelTypeChangeProcessor> mock_processor; - in_memory_store[kClientTagHash] = sync_pb::PersistedEntityData(); + in_memory_store[kClientTagHash] = sync_pb::EntitySpecifics(); std::unique_ptr<SyncChangeProcessor> sync_change_processor = SyncableServiceBasedBridge::CreateLocalChangeProcessorForTesting(
diff --git a/components/sync/syncable/directory_backing_store_unittest.cc b/components/sync/syncable/directory_backing_store_unittest.cc index 44b6d2ef..b6abe75 100644 --- a/components/sync/syncable/directory_backing_store_unittest.cc +++ b/components/sync/syncable/directory_backing_store_unittest.cc
@@ -4226,8 +4226,9 @@ } } -INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest, - testing::Range(67, kCurrentDBVersion + 1)); +INSTANTIATE_TEST_SUITE_P(DirectoryBackingStore, + MigrationTest, + testing::Range(67, kCurrentDBVersion + 1)); TEST_F(DirectoryBackingStoreTest, ModelTypeIds) { ModelTypeSet protocol_types = ProtocolTypes();
diff --git a/components/unified_consent/unified_consent_service.cc b/components/unified_consent/unified_consent_service.cc index 956bc38..73f6f203 100644 --- a/components/unified_consent/unified_consent_service.cc +++ b/components/unified_consent/unified_consent_service.cc
@@ -66,12 +66,13 @@ user_pref_service->ClearPref(prefs::kUnifiedConsentMigrationState); } -void UnifiedConsentService::EnableGoogleServices() { - DCHECK(identity_manager_->HasPrimaryAccount()); - DCHECK_EQ(MigrationState::kCompleted, GetMigrationState()); +void UnifiedConsentService::SetUrlKeyedAnonymizedDataCollectionEnabled( + bool enabled) { + if (GetMigrationState() != MigrationState::kCompleted) + SetMigrationState(MigrationState::kCompleted); pref_service_->SetBoolean(prefs::kUrlKeyedAnonymizedDataCollectionEnabled, - true); + enabled); } void UnifiedConsentService::Shutdown() { @@ -82,13 +83,7 @@ void UnifiedConsentService::OnPrimaryAccountCleared( const CoreAccountInfo& account_info) { // By design, clearing the primary account disables URL-keyed data collection. - pref_service_->SetBoolean(prefs::kUrlKeyedAnonymizedDataCollectionEnabled, - false); - - if (GetMigrationState() != MigrationState::kCompleted) { - // When the user signs out, the migration is complete. - SetMigrationState(MigrationState::kCompleted); - } + SetUrlKeyedAnonymizedDataCollectionEnabled(false); } void UnifiedConsentService::OnStateChanged(syncer::SyncService* sync) { @@ -139,10 +134,7 @@ sync_service_->GetUserSettings()->GetChosenDataTypes().Has( syncer::TYPED_URLS) && !sync_service_->GetUserSettings()->IsUsingSecondaryPassphrase(); - pref_service_->SetBoolean(prefs::kUrlKeyedAnonymizedDataCollectionEnabled, - url_keyed_metrics_enabled); - - SetMigrationState(MigrationState::kCompleted); + SetUrlKeyedAnonymizedDataCollectionEnabled(url_keyed_metrics_enabled); } } // namespace unified_consent
diff --git a/components/unified_consent/unified_consent_service.h b/components/unified_consent/unified_consent_service.h index 8a30d51..f0bd433c 100644 --- a/components/unified_consent/unified_consent_service.h +++ b/components/unified_consent/unified_consent_service.h
@@ -54,10 +54,8 @@ static void RollbackIfNeeded(PrefService* user_pref_service, syncer::SyncService* sync_service); - // Enables all Google services tied to unified consent. - // Note: Sync has to be enabled through the SyncService. It is *not* enabled - // in this method. - void EnableGoogleServices(); + // Enables or disables URL-keyed anonymized data collection. + void SetUrlKeyedAnonymizedDataCollectionEnabled(bool enabled); // KeyedService: void Shutdown() override;
diff --git a/components/unified_consent/unified_consent_service_unittest.cc b/components/unified_consent/unified_consent_service_unittest.cc index 1c8e6864..137916b 100644 --- a/components/unified_consent/unified_consent_service_unittest.cc +++ b/components/unified_consent/unified_consent_service_unittest.cc
@@ -105,26 +105,14 @@ prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); } -TEST_F(UnifiedConsentServiceTest, EnableServices) { +TEST_F(UnifiedConsentServiceTest, EnableUrlKeyedAnonymizedDataCollection) { CreateConsentService(); identity_test_environment_.SetPrimaryAccount("testaccount"); EXPECT_FALSE(pref_service_.GetBoolean( prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); // Enable services and check expectations. - consent_service_->EnableGoogleServices(); - EXPECT_TRUE(pref_service_.GetBoolean( - prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); -} - -TEST_F(UnifiedConsentServiceTest, EnableServices_WithUnsupportedService) { - CreateConsentService(); - identity_test_environment_.SetPrimaryAccount("testaccount"); - EXPECT_FALSE(pref_service_.GetBoolean( - prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); - - // Enable services and check expectations. - consent_service_->EnableGoogleServices(); + consent_service_->SetUrlKeyedAnonymizedDataCollectionEnabled(true); EXPECT_TRUE(pref_service_.GetBoolean( prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); } @@ -154,7 +142,7 @@ identity_test_environment_.SetPrimaryAccount("testaccount"); // Precondition: Enable unified consent. - consent_service_->EnableGoogleServices(); + consent_service_->SetUrlKeyedAnonymizedDataCollectionEnabled(true); EXPECT_TRUE(pref_service_.GetBoolean( prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); @@ -180,13 +168,11 @@ // Migrate and opt into unified consent. CreateConsentService(); - consent_service_->EnableGoogleServices(); + consent_service_->SetUrlKeyedAnonymizedDataCollectionEnabled(true); // Check expectations after opt-in. EXPECT_TRUE(pref_service_.GetBoolean( prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); EXPECT_EQ(unified_consent::MigrationState::kCompleted, GetMigrationState()); - EXPECT_TRUE(pref_service_.GetBoolean( - prefs::kUrlKeyedAnonymizedDataCollectionEnabled)); consent_service_->Shutdown(); consent_service_.reset();
diff --git a/components/update_client/ping_manager_unittest.cc b/components/update_client/ping_manager_unittest.cc index e33a755..1dec1e4 100644 --- a/components/update_client/ping_manager_unittest.cc +++ b/components/update_client/ping_manager_unittest.cc
@@ -115,7 +115,7 @@ // This test is parameterized for using JSON or XML serialization. |true| means // JSON serialization is used. -INSTANTIATE_TEST_CASE_P(Parameterized, PingManagerTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(Parameterized, PingManagerTest, testing::Bool()); TEST_P(PingManagerTest, SendPing) { auto interceptor = std::make_unique<URLLoaderPostInterceptor>(
diff --git a/components/update_client/request_sender_unittest.cc b/components/update_client/request_sender_unittest.cc index 99820bed..69a111e3 100644 --- a/components/update_client/request_sender_unittest.cc +++ b/components/update_client/request_sender_unittest.cc
@@ -73,7 +73,7 @@ DISALLOW_COPY_AND_ASSIGN(RequestSenderTest); }; -INSTANTIATE_TEST_CASE_P(IsForeground, RequestSenderTest, ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(IsForeground, RequestSenderTest, ::testing::Bool()); RequestSenderTest::RequestSenderTest() : scoped_task_environment_(
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc index a62d0ff..1e11a96 100644 --- a/components/update_client/update_checker_unittest.cc +++ b/components/update_client/update_checker_unittest.cc
@@ -164,9 +164,9 @@ }; // This test is parameterized for |is_foreground and |use_JSON|. -INSTANTIATE_TEST_CASE_P(Parameterized, - UpdateCheckerTest, - testing::Combine(testing::Bool(), testing::Bool())); +INSTANTIATE_TEST_SUITE_P(Parameterized, + UpdateCheckerTest, + testing::Combine(testing::Bool(), testing::Bool())); UpdateCheckerTest::UpdateCheckerTest() : scoped_task_environment_(
diff --git a/components/viz/client/client_resource_provider_unittest.cc b/components/viz/client/client_resource_provider_unittest.cc index cdb71a9..e948d23 100644 --- a/components/viz/client/client_resource_provider_unittest.cc +++ b/components/viz/client/client_resource_provider_unittest.cc
@@ -80,9 +80,9 @@ std::unique_ptr<ClientResourceProvider> provider_; }; -INSTANTIATE_TEST_CASE_P(ClientResourceProviderTests, - ClientResourceProviderTest, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(ClientResourceProviderTests, + ClientResourceProviderTest, + ::testing::Values(false, true)); class MockReleaseCallback { public:
diff --git a/components/viz/common/gl_helper_unittest.cc b/components/viz/common/gl_helper_unittest.cc index ae1bf5189..a328f4e 100644 --- a/components/viz/common/gl_helper_unittest.cc +++ b/components/viz/common/gl_helper_unittest.cc
@@ -1329,7 +1329,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , GLHelperPixelReadbackTest, ::testing::Combine(
diff --git a/components/viz/common/gl_i420_converter_pixeltest.cc b/components/viz/common/gl_i420_converter_pixeltest.cc index d6e27e9..05ac138 100644 --- a/components/viz/common/gl_i420_converter_pixeltest.cc +++ b/components/viz/common/gl_i420_converter_pixeltest.cc
@@ -122,6 +122,6 @@ // Run the tests twice, once disallowing use of the MRT path, and once allowing // its use (auto-detecting whether the current platform supports it). -INSTANTIATE_TEST_CASE_P(, GLI420ConverterPixelTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, GLI420ConverterPixelTest, testing::Bool()); } // namespace viz
diff --git a/components/viz/common/gl_scaler_shader_pixeltest.cc b/components/viz/common/gl_scaler_shader_pixeltest.cc index 1b93812..ad3bc9a 100644 --- a/components/viz/common/gl_scaler_shader_pixeltest.cc +++ b/components/viz/common/gl_scaler_shader_pixeltest.cc
@@ -683,8 +683,8 @@ ExpectAreTheSameImage(expected_b, actual_b); } -INSTANTIATE_TEST_CASE_P(, - GLScalerShaderPixelTest, - testing::Combine(testing::Bool(), testing::Bool())); +INSTANTIATE_TEST_SUITE_P(, + GLScalerShaderPixelTest, + testing::Combine(testing::Bool(), testing::Bool())); } // namespace viz
diff --git a/components/viz/common/yuv_readback_unittest.cc b/components/viz/common/yuv_readback_unittest.cc index fac7863..def5ebf 100644 --- a/components/viz/common/yuv_readback_unittest.cc +++ b/components/viz/common/yuv_readback_unittest.cc
@@ -550,7 +550,7 @@ } // First argument is intentionally empty. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , YUVReadbackPixelTest, ::testing::Combine(
diff --git a/components/viz/service/display/copy_output_scaling_pixeltest.cc b/components/viz/service/display/copy_output_scaling_pixeltest.cc index 771585a..8f5d9e9 100644 --- a/components/viz/service/display/copy_output_scaling_pixeltest.cc +++ b/components/viz/service/display/copy_output_scaling_pixeltest.cc
@@ -297,14 +297,14 @@ TEST_P(GLCopyOutputScalingPixelTest, ScaledCopyOfDrawnFrame) { RunTest(); } -INSTANTIATE_TEST_CASE_P(, GLCopyOutputScalingPixelTest, kParameters); +INSTANTIATE_TEST_SUITE_P(, GLCopyOutputScalingPixelTest, kParameters); using SoftwareCopyOutputScalingPixelTest = CopyOutputScalingPixelTest<SoftwareRenderer>; TEST_P(SoftwareCopyOutputScalingPixelTest, ScaledCopyOfDrawnFrame) { RunTest(); } -INSTANTIATE_TEST_CASE_P(, SoftwareCopyOutputScalingPixelTest, kParameters); +INSTANTIATE_TEST_SUITE_P(, SoftwareCopyOutputScalingPixelTest, kParameters); } // namespace } // namespace viz
diff --git a/components/viz/service/display/display_resource_provider_unittest.cc b/components/viz/service/display/display_resource_provider_unittest.cc index 9cd37ea..cdc51d5 100644 --- a/components/viz/service/display/display_resource_provider_unittest.cc +++ b/components/viz/service/display/display_resource_provider_unittest.cc
@@ -442,9 +442,9 @@ std::unique_ptr<TestSharedBitmapManager> shared_bitmap_manager_; }; -INSTANTIATE_TEST_CASE_P(DisplayResourceProviderTests, - DisplayResourceProviderTest, - ::testing::Values(false, true)); +INSTANTIATE_TEST_SUITE_P(DisplayResourceProviderTests, + DisplayResourceProviderTest, + ::testing::Values(false, true)); TEST_P(DisplayResourceProviderTest, LockForExternalUse) { // TODO(penghuang): consider supporting SW mode.
diff --git a/components/viz/service/display/gl_renderer_copier_pixeltest.cc b/components/viz/service/display/gl_renderer_copier_pixeltest.cc index 5f5edba..c7b5f2e 100644 --- a/components/viz/service/display/gl_renderer_copier_pixeltest.cc +++ b/components/viz/service/display/gl_renderer_copier_pixeltest.cc
@@ -314,7 +314,7 @@ // Instantiate parameter sets for all possible combinations of scenarios // GLRendererCopier will encounter, which will cause it to follow different // workflows. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , GLRendererCopierPixelTest, testing::Combine(
diff --git a/components/viz/service/display/gl_renderer_unittest.cc b/components/viz/service/display/gl_renderer_unittest.cc index 51be581..2c36d6f 100644 --- a/components/viz/service/display/gl_renderer_unittest.cc +++ b/components/viz/service/display/gl_renderer_unittest.cc
@@ -402,9 +402,9 @@ TestShadersWithPrecision(GetParam()); } -INSTANTIATE_TEST_CASE_P(PrecisionShadersCompile, - PrecisionShaderPixelTest, - ::testing::ValuesIn(kPrecisionList)); +INSTANTIATE_TEST_SUITE_P(PrecisionShadersCompile, + PrecisionShaderPixelTest, + ::testing::ValuesIn(kPrecisionList)); class PrecisionBlendShaderPixelTest : public GLRendererShaderPixelTest, @@ -416,7 +416,7 @@ std::get<1>(GetParam())); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrecisionBlendShadersCompile, PrecisionBlendShaderPixelTest, ::testing::Combine(::testing::ValuesIn(kPrecisionList), @@ -432,10 +432,10 @@ std::get<1>(GetParam())); } -INSTANTIATE_TEST_CASE_P(PrecisionSamplerShadersCompile, - PrecisionSamplerShaderPixelTest, - ::testing::Combine(::testing::ValuesIn(kPrecisionList), - ::testing::ValuesIn(kSamplerList))); +INSTANTIATE_TEST_SUITE_P(PrecisionSamplerShadersCompile, + PrecisionSamplerShaderPixelTest, + ::testing::Combine(::testing::ValuesIn(kPrecisionList), + ::testing::ValuesIn(kSamplerList))); class MaskShaderPixelTest : public GLRendererShaderPixelTest, @@ -447,12 +447,12 @@ std::get<2>(GetParam()), std::get<3>(GetParam())); } -INSTANTIATE_TEST_CASE_P(MaskShadersCompile, - MaskShaderPixelTest, - ::testing::Combine(::testing::ValuesIn(kPrecisionList), - ::testing::ValuesIn(kSamplerList), - ::testing::ValuesIn(kBlendModeList), - ::testing::Bool())); +INSTANTIATE_TEST_SUITE_P(MaskShadersCompile, + MaskShaderPixelTest, + ::testing::Combine(::testing::ValuesIn(kPrecisionList), + ::testing::ValuesIn(kSamplerList), + ::testing::ValuesIn(kBlendModeList), + ::testing::Bool())); #endif
diff --git a/components/viz/service/display/renderer_pixeltest.cc b/components/viz/service/display/renderer_pixeltest.cc index 127f1b74..d5d5546 100644 --- a/components/viz/service/display/renderer_pixeltest.cc +++ b/components/viz/service/display/renderer_pixeltest.cc
@@ -1782,7 +1782,7 @@ } // First argument (test case prefix) is intentionally left empty. -INSTANTIATE_TEST_CASE_P(, VideoGLRendererPixelHiLoTest, testing::Bool()); +INSTANTIATE_TEST_SUITE_P(, VideoGLRendererPixelHiLoTest, testing::Bool()); TEST_F(VideoGLRendererPixelTest, SimpleYUVJRect) { gfx::Rect rect(this->device_viewport_size_); @@ -4300,14 +4300,14 @@ true, false, }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FromColorSpace, ColorTransformPixelTest, testing::Combine(testing::ValuesIn(src_color_spaces), testing::ValuesIn(intermediate_color_spaces), testing::ValuesIn(color_space_premul_values))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ToColorSpace, ColorTransformPixelTest, testing::Combine(testing::ValuesIn(intermediate_color_spaces),
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc b/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc index ed5a7bb8..7a0b0c40 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc +++ b/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc
@@ -646,7 +646,7 @@ UnregisterBFS(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FrameSinkManagerOrderingParamTestInstantiation, FrameSinkManagerOrderingParamTest, ::testing::Combine(::testing::ValuesIn(kRegisterOrderList),
diff --git a/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc b/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc index 8493455..2ebef7c 100644 --- a/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc +++ b/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc
@@ -555,7 +555,7 @@ } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( , VideoCaptureOverlayRenderTest, testing::Values(VideoCaptureOverlayRenderTest::kARGBFormat,
diff --git a/content/BUILD.gn b/content/BUILD.gn index 8b213a89..594b6d4 100644 --- a/content/BUILD.gn +++ b/content/BUILD.gn
@@ -15,6 +15,8 @@ ] } +assert(!is_ios, "Chromium/iOS shouldn't use anything in //content") + # When targets depend on, e.g. //content/public/browser, what happens? To # facilitate the complexity here, the "public" targets are groups that forward # to the right thing depending on the build mode. Say for additional
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 4358ef3..c821f019 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -78,6 +78,7 @@ "//content/browser/background_sync:background_sync_proto", "//content/browser/cache_storage:cache_storage_proto", "//content/browser/cookie_store:cookie_store_proto", + "//content/browser/devtools:devtools_background_services_proto", "//content/browser/devtools:protocol_sources", "//content/browser/dom_storage:local_storage_proto", "//content/browser/notifications:notification_proto",
diff --git a/content/browser/background_fetch/storage/match_requests_task.cc b/content/browser/background_fetch/storage/match_requests_task.cc index bcf786b7..974b212f 100644 --- a/content/browser/background_fetch/storage/match_requests_task.cc +++ b/content/browser/background_fetch/storage/match_requests_task.cc
@@ -154,7 +154,7 @@ std::string MatchRequestsTask::HistogramName() const { return "MatchRequestsTask"; -}; +} } // namespace background_fetch
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index 28e5c54..5169f88 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc
@@ -1203,6 +1203,17 @@ DELETE_FILE_GRANT); } +bool ChildProcessSecurityPolicyImpl::CanAccessDataForWebSocket( + int child_id, + const GURL& url) { + DCHECK(url.SchemeIsWSOrWSS()); + GURL::Replacements replace_scheme; + replace_scheme.SetSchemeStr(url.SchemeIs(url::kWssScheme) ? url::kHttpsScheme + : url::kHttpScheme); + GURL url_to_check = url.ReplaceComponents(replace_scheme); + return CanAccessDataForOrigin(child_id, url_to_check); +} + bool ChildProcessSecurityPolicyImpl::HasWebUIBindings(int child_id) { base::AutoLock lock(lock_);
diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/child_process_security_policy_impl.h index f9b73ce..4b237c2b 100644 --- a/content/browser/child_process_security_policy_impl.h +++ b/content/browser/child_process_security_policy_impl.h
@@ -240,6 +240,10 @@ bool CanDeleteFileSystemFile(int child_id, const storage::FileSystemURL& filesystem_url); + // True if cookie headers may be exposed to renderer |child_id| for |url| for + // display in DevTools. |url| should be a WebSocket URL. + bool CanAccessDataForWebSocket(int child_id, const GURL& url); + // Returns true if the specified child_id has been granted ReadRawCookies. bool CanReadRawCookies(int child_id);
diff --git a/content/browser/devtools/BUILD.gn b/content/browser/devtools/BUILD.gn index ec74261a..02b6946 100644 --- a/content/browser/devtools/BUILD.gn +++ b/content/browser/devtools/BUILD.gn
@@ -4,6 +4,7 @@ import("//third_party/brotli/brotli.gni") import("//third_party/inspector_protocol/inspector_protocol.gni") +import("//third_party/protobuf/proto_library.gni") import("//tools/grit/grit_rule.gni") group("resources") { @@ -120,3 +121,9 @@ "protocol/tracing.h", ] } + +proto_library("devtools_background_services_proto") { + sources = [ + "devtools_background_services.proto", + ] +}
diff --git a/content/browser/devtools/devtools_background_services.proto b/content/browser/devtools/devtools_background_services.proto new file mode 100644 index 0000000..b8848ef --- /dev/null +++ b/content/browser/devtools/devtools_background_services.proto
@@ -0,0 +1,44 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; + +package content.devtools.proto; + +// An event for a non-existent background service. Used for tests. +message TestBackgroundServiceEvent { + optional string value = 1; +} + +// The background service we are logging events for. +// Do not change the tags since these are persisted. +enum BackgroundService { + UNKNOWN = 0; + TEST_BACKGROUND_SERVICE = 1; +} + +// A proto for storing the background service event with common metadata for +// all events. +// +// Next Tag: 6 +message BackgroundServiceState { + // Microseconds since windows epoch. + optional int64 timestamp = 1; + + // The origin's URL spec. + optional string origin = 2; + + optional int64 service_worker_registration_id = 3; + + optional BackgroundService background_service = 4; + + // The event information to store. + oneof background_service_event { + TestBackgroundServiceEvent test_event = 5; + + // Add the per background service event messages to store here. + } +} \ No newline at end of file
diff --git a/content/browser/devtools/devtools_background_services_context.cc b/content/browser/devtools/devtools_background_services_context.cc index 5d7987a..522bed5 100644 --- a/content/browser/devtools/devtools_background_services_context.cc +++ b/content/browser/devtools/devtools_background_services_context.cc
@@ -4,15 +4,182 @@ #include "content/browser/devtools/devtools_background_services_context.h" +#include <algorithm> + +#include "base/guid.h" +#include "base/strings/string_number_conversions.h" +#include "base/task/post_task.h" +#include "base/time/time.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/content_browser_client.h" +#include "url/origin.h" + namespace content { +namespace { + +std::string CreateEntryKeyPrefix(devtools::proto::BackgroundService service) { + DCHECK_NE(service, devtools::proto::BackgroundService::UNKNOWN); + return "devtools_background_services_" + base::NumberToString(service) + "_"; +} + +std::string CreateEntryKey(devtools::proto::BackgroundService service) { + return CreateEntryKeyPrefix(service) + base::GenerateGUID(); +} + +void DidLogServiceEvent(blink::ServiceWorkerStatusCode status) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + // TODO(rayankans): Log errors to UMA. +} + +void UpdateDevToolsBackgroundServiceExpiration( + BrowserContext* browser_context, + devtools::proto::BackgroundService service, + base::Time expiration_time) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + GetContentClient()->browser()->UpdateDevToolsBackgroundServiceExpiration( + browser_context, service, expiration_time); +} + +} // namespace + DevToolsBackgroundServicesContext::DevToolsBackgroundServicesContext( BrowserContext* browser_context, scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) : browser_context_(browser_context), - service_worker_context_(std::move(service_worker_context)) {} + service_worker_context_(std::move(service_worker_context)), + weak_ptr_factory_(this) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + auto expiration_times = + GetContentClient()->browser()->GetDevToolsBackgroundServiceExpirations( + browser_context_); + + for (const auto& expiration_time : expiration_times) { + DCHECK(devtools::proto::BackgroundService_IsValid(expiration_time.first)); + expiration_times_.emplace( + static_cast<devtools::proto::BackgroundService>(expiration_time.first), + expiration_time.second); + } +} DevToolsBackgroundServicesContext::~DevToolsBackgroundServicesContext() = default; +void DevToolsBackgroundServicesContext::StartRecording( + devtools::proto::BackgroundService service) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + DCHECK(expiration_times_[service].is_null()); + + // TODO(rayankans): Make the time delay finch configurable. + base::Time expiration_time = base::Time::Now() + base::TimeDelta::FromDays(3); + expiration_times_[service] = expiration_time; + + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&UpdateDevToolsBackgroundServiceExpiration, + browser_context_, service, expiration_time)); +} + +void DevToolsBackgroundServicesContext::StopRecording( + devtools::proto::BackgroundService service) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + DCHECK(!expiration_times_[service].is_null()); + expiration_times_.erase(service); + + base::PostTaskWithTraits( + FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&UpdateDevToolsBackgroundServiceExpiration, + browser_context_, service, base::Time())); +} + +void DevToolsBackgroundServicesContext::GetLoggedBackgroundServiceEvents( + devtools::proto::BackgroundService service, + GetLoggedBackgroundServiceEventsCallback callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + service_worker_context_->GetUserDataForAllRegistrationsByKeyPrefix( + CreateEntryKeyPrefix(service), + base::BindOnce(&DevToolsBackgroundServicesContext::DidGetUserData, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + +void DevToolsBackgroundServicesContext::DidGetUserData( + GetLoggedBackgroundServiceEventsCallback callback, + const std::vector<std::pair<int64_t, std::string>>& user_data, + blink::ServiceWorkerStatusCode status) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + std::vector<devtools::proto::BackgroundServiceState> service_states; + + if (status != blink::ServiceWorkerStatusCode::kOk) { + // TODO(rayankans): Log errors to UMA. + std::move(callback).Run(service_states); + return; + } + + service_states.reserve(user_data.size()); + for (const auto& data : user_data) { + devtools::proto::BackgroundServiceState service_state; + if (!service_state.ParseFromString(data.second)) { + // TODO(rayankans): Log errors to UMA. + std::move(callback).Run({}); + return; + } + DCHECK_EQ(data.first, service_state.service_worker_registration_id()); + service_states.push_back(std::move(service_state)); + } + + std::sort(service_states.begin(), service_states.end(), + [](const auto& state1, const auto& state2) { + return state1.timestamp() < state2.timestamp(); + }); + std::move(callback).Run(std::move(service_states)); +} + +void DevToolsBackgroundServicesContext::LogTestBackgroundServiceEvent( + uint64_t service_worker_registration_id, + const url::Origin& origin, + devtools::proto::TestBackgroundServiceEvent event) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + auto service = devtools::proto::BackgroundService::TEST_BACKGROUND_SERVICE; + if (expiration_times_[service].is_null()) + return; + + devtools::proto::BackgroundServiceState service_state; + service_state.set_background_service(service); + *service_state.mutable_test_event() = std::move(event); + + LogBackgroundServiceState(service_worker_registration_id, origin, + std::move(service_state)); +} + +void DevToolsBackgroundServicesContext::LogBackgroundServiceState( + uint64_t service_worker_registration_id, + const url::Origin& origin, + devtools::proto::BackgroundServiceState service_state) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + DCHECK(!expiration_times_[service_state.background_service()].is_null()); + + // Add common metadata. + service_state.set_timestamp( + base::Time::Now().ToDeltaSinceWindowsEpoch().InMicroseconds()); + service_state.set_origin(origin.GetURL().spec()); + service_state.set_service_worker_registration_id( + service_worker_registration_id); + + service_worker_context_->StoreRegistrationUserData( + service_worker_registration_id, origin.GetURL(), + {{CreateEntryKey(service_state.background_service()), + service_state.SerializeAsString()}}, + base::BindOnce(&DidLogServiceEvent)); +} + } // namespace content
diff --git a/content/browser/devtools/devtools_background_services_context.h b/content/browser/devtools/devtools_background_services_context.h index 7972a11..797a79f 100644 --- a/content/browser/devtools/devtools_background_services_context.h +++ b/content/browser/devtools/devtools_background_services_context.h
@@ -5,13 +5,25 @@ #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_BACKGROUND_SERVICES_CONTEXT_H_ #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_BACKGROUND_SERVICES_CONTEXT_H_ +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "base/callback_forward.h" +#include "base/containers/flat_map.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" +#include "content/browser/devtools/devtools_background_services.pb.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/common/content_export.h" +namespace url { +class Origin; +} // namespace url + namespace content { class BrowserContext; @@ -26,17 +38,59 @@ class CONTENT_EXPORT DevToolsBackgroundServicesContext : public base::RefCountedThreadSafe<DevToolsBackgroundServicesContext> { public: + using GetLoggedBackgroundServiceEventsCallback = base::OnceCallback<void( + std::vector<devtools::proto::BackgroundServiceState>)>; + DevToolsBackgroundServicesContext( BrowserContext* browser_context, scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); + // Queries all logged events for |service| and returns them in sorted order + // (by timestamp). |callback| is called with an empty vector if there was an + // error. Must be called from the IO thread. + void GetLoggedBackgroundServiceEvents( + devtools::proto::BackgroundService service, + GetLoggedBackgroundServiceEventsCallback callback); + + // Enables recording mode for |service|. This is capped at 3 days in case + // developers forget to switch it off. + void StartRecording(devtools::proto::BackgroundService service); + + // Disables recording mode for |service|. + void StopRecording(devtools::proto::BackgroundService service); + private: + friend class DevToolsBackgroundServicesContextTest; friend class base::RefCountedThreadSafe<DevToolsBackgroundServicesContext>; ~DevToolsBackgroundServicesContext(); + // Entry point for logging a test event. + void LogTestBackgroundServiceEvent( + uint64_t service_worker_registration_id, + const url::Origin& origin, + devtools::proto::TestBackgroundServiceEvent event); + + // Called after the Log*Event method creates the appropriate state proto. + void LogBackgroundServiceState( + uint64_t service_worker_registration_id, + const url::Origin& origin, + devtools::proto::BackgroundServiceState service_state); + + void DidGetUserData( + GetLoggedBackgroundServiceEventsCallback callback, + const std::vector<std::pair<int64_t, std::string>>& user_data, + blink::ServiceWorkerStatusCode status); + BrowserContext* browser_context_; scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; + // Maps from the background service to the time up until the events can be + // recorded. + base::flat_map<devtools::proto::BackgroundService, base::Time> + expiration_times_; + + base::WeakPtrFactory<DevToolsBackgroundServicesContext> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(DevToolsBackgroundServicesContext); };
diff --git a/content/browser/devtools/devtools_background_services_context_unittest.cc b/content/browser/devtools/devtools_background_services_context_unittest.cc new file mode 100644 index 0000000..5fd39293 --- /dev/null +++ b/content/browser/devtools/devtools_background_services_context_unittest.cc
@@ -0,0 +1,285 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/devtools/devtools_background_services_context.h" + +#include <string> +#include <vector> + +#include "base/containers/flat_map.h" +#include "base/memory/scoped_refptr.h" +#include "base/run_loop.h" +#include "content/browser/devtools/devtools_background_services.pb.h" +#include "content/browser/service_worker/embedded_worker_test_helper.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/test/test_browser_context.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/origin.h" + +namespace content { +namespace { + +class TestBrowserClient : public ContentBrowserClient { + public: + TestBrowserClient() {} + ~TestBrowserClient() override {} + + void UpdateDevToolsBackgroundServiceExpiration( + BrowserContext* browser_context, + int service, + base::Time expiration_time) override { + exp_dict_[service] = expiration_time; + } + + base::flat_map<int, base::Time> GetDevToolsBackgroundServiceExpirations( + BrowserContext* browser_context) override { + return exp_dict_; + } + + private: + base::flat_map<int, base::Time> exp_dict_; +}; + +void DidRegisterServiceWorker(int64_t* out_service_worker_registration_id, + base::OnceClosure quit_closure, + blink::ServiceWorkerStatusCode status, + const std::string& status_message, + int64_t service_worker_registration_id) { + DCHECK(out_service_worker_registration_id); + EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, status) << status_message; + + *out_service_worker_registration_id = service_worker_registration_id; + + std::move(quit_closure).Run(); +} + +void DidFindServiceWorkerRegistration( + scoped_refptr<ServiceWorkerRegistration>* out_service_worker_registration, + base::OnceClosure quit_closure, + blink::ServiceWorkerStatusCode status, + scoped_refptr<ServiceWorkerRegistration> service_worker_registration) { + DCHECK(out_service_worker_registration); + EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, status) + << blink::ServiceWorkerStatusToString(status); + + *out_service_worker_registration = service_worker_registration; + + std::move(quit_closure).Run(); +} + +void DidGetLoggedBackgroundServiceEvents( + base::OnceClosure quit_closure, + std::vector<devtools::proto::BackgroundServiceState>* out_feature_states, + std::vector<devtools::proto::BackgroundServiceState> feature_states) { + *out_feature_states = std::move(feature_states); + std::move(quit_closure).Run(); +} + +} // namespace + +class DevToolsBackgroundServicesContextTest : public ::testing::Test { + public: + DevToolsBackgroundServicesContextTest() + : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), + embedded_worker_test_helper_(base::FilePath() /* in memory */) {} + + ~DevToolsBackgroundServicesContextTest() override = default; + + void SetUp() override { + // Register Service Worker. + service_worker_registration_id_ = RegisterServiceWorker(); + ASSERT_NE(service_worker_registration_id_, + blink::mojom::kInvalidServiceWorkerRegistrationId); + + browser_client_ = std::make_unique<TestBrowserClient>(); + SetBrowserClientForTesting(browser_client_.get()); + + SimulateBrowserRestart(); + } + + protected: + void SimulateBrowserRestart() { + // Create |context_|. + context_ = base::MakeRefCounted<DevToolsBackgroundServicesContext>( + &browser_context_, embedded_worker_test_helper_.context_wrapper()); + ASSERT_TRUE(context_); + } + + base::Time GetExpirationTime() { + return context_->expiration_times_ + [devtools::proto::BackgroundService::TEST_BACKGROUND_SERVICE]; + } + + std::vector<devtools::proto::BackgroundServiceState> + GetLoggedBackgroundServiceEvents() { + std::vector<devtools::proto::BackgroundServiceState> feature_states; + + base::RunLoop run_loop; + context_->GetLoggedBackgroundServiceEvents( + devtools::proto::BackgroundService::TEST_BACKGROUND_SERVICE, + base::BindOnce(&DidGetLoggedBackgroundServiceEvents, + run_loop.QuitClosure(), &feature_states)); + run_loop.Run(); + + return feature_states; + } + + void LogTestBackgroundServiceEvent(const std::string& log_message) { + devtools::proto::TestBackgroundServiceEvent event; + event.set_value(log_message); + + context_->LogTestBackgroundServiceEvent(service_worker_registration_id_, + origin_, std::move(event)); + } + + void StartRecording() { + context_->StartRecording( + devtools::proto::BackgroundService::TEST_BACKGROUND_SERVICE); + + // Wait for the messages to propagate to the browser client. + thread_bundle_.RunUntilIdle(); + } + + void StopRecording() { + context_->StopRecording( + devtools::proto::BackgroundService::TEST_BACKGROUND_SERVICE); + + // Wait for the messages to propagate to the browser client. + thread_bundle_.RunUntilIdle(); + } + + TestBrowserThreadBundle thread_bundle_; // Must be first member. + url::Origin origin_ = url::Origin::Create(GURL("https://example.com")); + int64_t service_worker_registration_id_ = + blink::mojom::kInvalidServiceWorkerRegistrationId; + + private: + int64_t RegisterServiceWorker() { + GURL script_url(origin_.GetURL().spec() + "sw.js"); + int64_t service_worker_registration_id = + blink::mojom::kInvalidServiceWorkerRegistrationId; + + { + blink::mojom::ServiceWorkerRegistrationOptions options; + options.scope = origin_.GetURL(); + base::RunLoop run_loop; + embedded_worker_test_helper_.context()->RegisterServiceWorker( + script_url, options, + base::BindOnce(&DidRegisterServiceWorker, + &service_worker_registration_id, + run_loop.QuitClosure())); + + run_loop.Run(); + } + + if (service_worker_registration_id == + blink::mojom::kInvalidServiceWorkerRegistrationId) { + ADD_FAILURE() << "Could not obtain a valid Service Worker registration"; + return blink::mojom::kInvalidServiceWorkerRegistrationId; + } + + { + base::RunLoop run_loop; + embedded_worker_test_helper_.context()->storage()->FindRegistrationForId( + service_worker_registration_id, origin_.GetURL(), + base::BindOnce(&DidFindServiceWorkerRegistration, + &service_worker_registration_, + run_loop.QuitClosure())); + run_loop.Run(); + } + + // Wait for the worker to be activated. + base::RunLoop().RunUntilIdle(); + + if (!service_worker_registration_) { + ADD_FAILURE() << "Could not find the new Service Worker registration."; + return blink::mojom::kInvalidServiceWorkerRegistrationId; + } + + return service_worker_registration_id; + } + + EmbeddedWorkerTestHelper embedded_worker_test_helper_; + TestBrowserContext browser_context_; + scoped_refptr<DevToolsBackgroundServicesContext> context_; + scoped_refptr<ServiceWorkerRegistration> service_worker_registration_; + std::unique_ptr<ContentBrowserClient> browser_client_; + + DISALLOW_COPY_AND_ASSIGN(DevToolsBackgroundServicesContextTest); +}; + +TEST_F(DevToolsBackgroundServicesContextTest, + NothingStoredWithRecordingModeOff) { + // Initially there are no entries. + EXPECT_TRUE(GetLoggedBackgroundServiceEvents().empty()); + + // "Log" some events and wait for them to finish. + LogTestBackgroundServiceEvent("f1"); + LogTestBackgroundServiceEvent("f2"); + + // There should still be nothing since recording mode is off. + EXPECT_TRUE(GetLoggedBackgroundServiceEvents().empty()); +} + +TEST_F(DevToolsBackgroundServicesContextTest, GetLoggedFeatures) { + StartRecording(); + + // "Log" some events and wait for them to finish. + LogTestBackgroundServiceEvent("f1"); + LogTestBackgroundServiceEvent("f2"); + + // Check the values. + auto feature_events = GetLoggedBackgroundServiceEvents(); + ASSERT_EQ(feature_events.size(), 2u); + + for (const auto& feature_event : feature_events) { + EXPECT_EQ(feature_event.background_service(), + devtools::proto::BackgroundService::TEST_BACKGROUND_SERVICE); + EXPECT_EQ(feature_event.origin(), origin_.GetURL().spec()); + EXPECT_EQ(feature_event.service_worker_registration_id(), + service_worker_registration_id_); + ASSERT_TRUE(feature_event.has_test_event()); + } + + EXPECT_EQ(feature_events[0].test_event().value(), "f1"); + EXPECT_EQ(feature_events[1].test_event().value(), "f2"); + + EXPECT_LE(feature_events[0].timestamp(), feature_events[1].timestamp()); +} + +TEST_F(DevToolsBackgroundServicesContextTest, StopRecording) { + StartRecording(); + // Initially there are no entries. + EXPECT_TRUE(GetLoggedBackgroundServiceEvents().empty()); + + // "Log" some events and wait for them to finish. + LogTestBackgroundServiceEvent("f1"); + StopRecording(); + LogTestBackgroundServiceEvent("f2"); + + // Check the values. + ASSERT_EQ(GetLoggedBackgroundServiceEvents().size(), 1u); +} + +TEST_F(DevToolsBackgroundServicesContextTest, DelegateExpirationTimes) { + // Initially expiration time is null. + EXPECT_TRUE(GetExpirationTime().is_null()); + + // Toggle Recording mode, and now this should be non-null. + StartRecording(); + EXPECT_FALSE(GetExpirationTime().is_null()); + + // The value should still be there on browser restarts. + SimulateBrowserRestart(); + EXPECT_FALSE(GetExpirationTime().is_null()); + + // Stopping Recording mode should clear the value. + StopRecording(); + EXPECT_TRUE(GetExpirationTime().is_null()); + SimulateBrowserRestart(); + EXPECT_TRUE(GetExpirationTime().is_null()); +} + +} // namespace content \ No newline at end of file
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 11bcbee..18331232 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -219,15 +219,18 @@ } } std::string destination; + std::string mode = "navigate"; switch (frame_tree_node->frame_owner_element_type()) { case blink::FrameOwnerElementType::kNone: destination = "document"; break; case blink::FrameOwnerElementType::kObject: destination = "object"; + mode = "no-cors"; break; case blink::FrameOwnerElementType::kEmbed: destination = "embed"; + mode = "no-cors"; break; case blink::FrameOwnerElementType::kIframe: case blink::FrameOwnerElementType::kFrame: @@ -238,6 +241,7 @@ destination = "nested-document"; } headers->SetHeaderIfMissing("Sec-Fetch-Dest", destination.c_str()); + headers->SetHeaderIfMissing("Sec-Fetch-Mode", mode.c_str()); headers->SetHeaderIfMissing("Sec-Fetch-Site", site_value.c_str()); headers->SetHeaderIfMissing("Sec-Fetch-User", has_user_gesture ? "?T" : "?F");
diff --git a/content/browser/renderer_host/input/passthrough_touch_event_queue.cc b/content/browser/renderer_host/input/passthrough_touch_event_queue.cc index ecb9a86..625f3d1 100644 --- a/content/browser/renderer_host/input/passthrough_touch_event_queue.cc +++ b/content/browser/renderer_host/input/passthrough_touch_event_queue.cc
@@ -4,16 +4,15 @@ #include "content/browser/renderer_host/input/passthrough_touch_event_queue.h" +#include <string> #include <utility> #include "base/auto_reset.h" -#include "base/feature_list.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/trace_event/trace_event.h" #include "content/browser/renderer_host/input/touch_timeout_handler.h" #include "content/common/input/web_touch_event_traits.h" -#include "content/public/common/content_features.h" #include "ui/events/base_event_utils.h" #include "ui/gfx/geometry/point_f.h" @@ -43,6 +42,13 @@ } // namespace +// static +const base::FeatureParam<std::string> + PassthroughTouchEventQueue::kSkipBrowserTouchFilterType{ + &features::kSkipBrowserTouchFilter, + features::kSkipBrowserTouchFilterTypeParamName, + features::kSkipBrowserTouchFilterTypeParamValueDiscrete}; + PassthroughTouchEventQueue::TouchEventWithLatencyInfoAndAckState:: TouchEventWithLatencyInfoAndAckState(const TouchEventWithLatencyInfo& event) : TouchEventWithLatencyInfo(event), @@ -61,7 +67,9 @@ maybe_has_handler_for_current_sequence_(false), drop_remaining_touches_in_sequence_(false), send_touch_events_async_(false), - processing_acks_(false) { + processing_acks_(false), + skip_touch_filter_(config.skip_touch_filter), + events_to_always_forward_(config.events_to_always_forward) { if (config.touch_ack_timeout_supported) { timeout_handler_.reset( new TouchTimeoutHandler(this, config.desktop_touch_ack_timeout_delay, @@ -296,16 +304,37 @@ PassthroughTouchEventQueue::PreFilterResult PassthroughTouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) { + PreFilterResult result = FilterBeforeForwardingImpl(event); + if (result == PreFilterResult::kFilteredTimeout) + return PreFilterResult::kFilteredTimeout; + + // Override non-timeout filter results based on the Finch trial that bypasses + // the filter. We do this here so that the event still has the opportunity to + // update any internal state that's necessary to handle future events + // (i.e. future touch moves might be dropped, even if this touch start isn't + // due to a filter override). + if (skip_touch_filter_) { + if (events_to_always_forward_ == + features::kSkipBrowserTouchFilterTypeParamValueAll) { + return PreFilterResult::kUnfiltered; + } else if (events_to_always_forward_ == + features::kSkipBrowserTouchFilterTypeParamValueDiscrete && + event.GetType() != WebInputEvent::kTouchMove) { + return PreFilterResult::kUnfiltered; + } + } + + return result; +} + +PassthroughTouchEventQueue::PreFilterResult +PassthroughTouchEventQueue::FilterBeforeForwardingImpl( + const WebTouchEvent& event) { // Unconditionally apply the timeout filter to avoid exacerbating // any responsiveness problems on the page. if (timeout_handler_ && timeout_handler_->FilterEvent(event)) return PreFilterResult::kFilteredTimeout; - if (base::FeatureList::IsEnabled( - features::kSkipPassthroughTouchEventQueueFilter)) { - return PreFilterResult::kUnfiltered; - } - if (event.GetType() == WebInputEvent::kTouchScrollStarted) return PreFilterResult::kUnfiltered;
diff --git a/content/browser/renderer_host/input/passthrough_touch_event_queue.h b/content/browser/renderer_host/input/passthrough_touch_event_queue.h index 4e9564f..5f448b9 100644 --- a/content/browser/renderer_host/input/passthrough_touch_event_queue.h +++ b/content/browser/renderer_host/input/passthrough_touch_event_queue.h
@@ -6,12 +6,16 @@ #define CONTENT_BROWSER_RENDERER_HOST_INPUT_PASSTHROUGH_TOUCH_EVENT_QUEUE_H_ #include <set> +#include <string> +#include "base/feature_list.h" #include "base/gtest_prod_util.h" #include "base/macros.h" +#include "base/metrics/field_trial_params.h" #include "base/time/time.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/common/content_export.h" +#include "content/public/common/content_features.h" #include "content/public/common/input_event_ack_source.h" #include "content/public/common/input_event_ack_state.h" @@ -54,7 +58,10 @@ base::TimeDelta::FromMilliseconds(200)), mobile_touch_ack_timeout_delay( base::TimeDelta::FromMilliseconds(1000)), - touch_ack_timeout_supported(false) {} + touch_ack_timeout_supported(false), + skip_touch_filter( + base::FeatureList::IsEnabled(features::kSkipBrowserTouchFilter)), + events_to_always_forward(kSkipBrowserTouchFilterType.Get()) {} // Touch ack timeout delay for desktop sites. If zero, timeout behavior // is disabled for such sites. Defaults to 200ms. @@ -67,6 +74,11 @@ // Whether the platform supports touch ack timeout behavior. // Defaults to false (disabled). bool touch_ack_timeout_supported; + + // Whether we should allow events to bypass normal queue filter rules. + bool skip_touch_filter; + // What events types are allowed to bypass the filter. + std::string events_to_always_forward; }; PassthroughTouchEventQueue(PassthroughTouchEventQueueClient* client, @@ -136,6 +148,14 @@ TouchMoveWithoutSequenceHandlerFiltered); FRIEND_TEST_ALL_PREFIXES(PassthroughTouchEventQueueTest, TouchMoveWithoutPageHandlersUnfilteredWithSkipFlag); + FRIEND_TEST_ALL_PREFIXES(PassthroughTouchEventQueueTest, + TouchStartUnfilteredWithForwardDiscrete); + FRIEND_TEST_ALL_PREFIXES(PassthroughTouchEventQueueTest, + TouchMoveFilteredWithForwardDiscrete); + FRIEND_TEST_ALL_PREFIXES(PassthroughTouchEventQueueTest, + TouchStartUnfilteredWithForwardAll); + FRIEND_TEST_ALL_PREFIXES(PassthroughTouchEventQueueTest, + TouchMoveUnfilteredWithForwardAll); friend class TouchTimeoutHandler; @@ -171,6 +191,7 @@ // Filter touches prior to forwarding to the renderer, e.g., if the renderer // has no touch handler. PreFilterResult FilterBeforeForwarding(const blink::WebTouchEvent& event); + PreFilterResult FilterBeforeForwardingImpl(const blink::WebTouchEvent& event); void AckTouchEventToClient(const TouchEventWithLatencyInfo& acked_event, InputEventAckSource ack_source, @@ -216,6 +237,12 @@ // on the unique touch event id. std::set<TouchEventWithLatencyInfoAndAckState> outstanding_touches_; + // Whether we should allow events to bypass normal queue filter rules. + const bool skip_touch_filter_; + // What events types are allowed to bypass the filter. + const std::string events_to_always_forward_; + static const base::FeatureParam<std::string> kSkipBrowserTouchFilterType; + DISALLOW_COPY_AND_ASSIGN(PassthroughTouchEventQueue); };
diff --git a/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc b/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc index 27bfd0d..d192dbb 100644 --- a/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/passthrough_touch_event_queue_unittest.cc
@@ -118,6 +118,15 @@ DefaultTouchTimeoutDelay()); } + void SetUpForSkipFilterTesting(const std::string& events_to_always_forward) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeatureWithParameters( + features::kSkipBrowserTouchFilter, + {{features::kSkipBrowserTouchFilterTypeParamName, + events_to_always_forward}}); + ResetQueueWithConfig(PassthroughTouchEventQueue::Config()); + } + void SendTouchEvent(WebTouchEvent event) { if (slop_length_dips_) { event.moved_beyond_slop_region = false; @@ -1829,7 +1838,7 @@ SyntheticWebTouchEvent event; int id = event.PressPoint(1, 1); - event.ReleasePoint(id); + event.MovePoint(id, 2, 2); EXPECT_EQ( PassthroughTouchEventQueue::PreFilterResult::kFilteredNoPageHandlers, @@ -1922,10 +1931,21 @@ } TEST_F(PassthroughTouchEventQueueTest, - TouchMoveWithoutPageHandlersUnfilteredWithSkipFlag) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - features::kSkipPassthroughTouchEventQueueFilter); + TouchStartUnfilteredWithForwardDiscrete) { + SetUpForSkipFilterTesting( + features::kSkipBrowserTouchFilterTypeParamValueDiscrete); + + OnHasTouchEventHandlers(false); + SyntheticWebTouchEvent event; + event.PressPoint(1, 1); + + EXPECT_EQ(PassthroughTouchEventQueue::PreFilterResult::kUnfiltered, + FilterBeforeForwarding(event)); +} + +TEST_F(PassthroughTouchEventQueueTest, TouchMoveFilteredWithForwardDiscrete) { + SetUpForSkipFilterTesting( + features::kSkipBrowserTouchFilterTypeParamValueDiscrete); OnHasTouchEventHandlers(false); // Start the touch sequence. @@ -1933,7 +1953,34 @@ SyntheticWebTouchEvent event; int id = event.PressPoint(1, 1); - event.ReleasePoint(id); + event.MovePoint(id, 2, 2); + + EXPECT_EQ( + PassthroughTouchEventQueue::PreFilterResult::kFilteredNoPageHandlers, + FilterBeforeForwarding(event)); +} + +TEST_F(PassthroughTouchEventQueueTest, TouchStartUnfilteredWithForwardAll) { + SetUpForSkipFilterTesting(features::kSkipBrowserTouchFilterTypeParamValueAll); + + OnHasTouchEventHandlers(false); + SyntheticWebTouchEvent event; + event.PressPoint(1, 1); + + EXPECT_EQ(PassthroughTouchEventQueue::PreFilterResult::kUnfiltered, + FilterBeforeForwarding(event)); +} + +TEST_F(PassthroughTouchEventQueueTest, TouchMoveUnfilteredWithForwardAll) { + SetUpForSkipFilterTesting(features::kSkipBrowserTouchFilterTypeParamValueAll); + + OnHasTouchEventHandlers(false); + // Start the touch sequence. + PressTouchPoint(1, 1); + + SyntheticWebTouchEvent event; + int id = event.PressPoint(1, 1); + event.MovePoint(id, 2, 2); EXPECT_EQ(PassthroughTouchEventQueue::PreFilterResult::kUnfiltered, FilterBeforeForwarding(event));
diff --git a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc index d8efbcd6..3a3e0161 100644 --- a/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc +++ b/content/browser/renderer_host/media/render_frame_audio_input_stream_factory_unittest.cc
@@ -12,6 +12,7 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/task/post_task.h" +#include "build/build_config.h" #include "content/browser/media/forwarding_audio_stream_factory.h" #include "content/browser/renderer_host/media/audio_input_device_manager.h" #include "content/browser/renderer_host/media/media_stream_manager.h" @@ -43,10 +44,19 @@ namespace content { -class RenderFrameAudioInputStreamFactoryTest +// RenderViewHostTestHarness works poorly on Android. +#if defined(OS_ANDROID) +#define MAYBE_RenderFrameAudioInputStreamFactoryTest \ + DISABLED_RenderFrameAudioInputStreamFactoryTest +#else +#define MAYBE_RenderFrameAudioInputStreamFactoryTest \ + RenderFrameAudioInputStreamFactoryTest +#endif + +class MAYBE_RenderFrameAudioInputStreamFactoryTest : public RenderViewHostTestHarness { public: - RenderFrameAudioInputStreamFactoryTest() + MAYBE_RenderFrameAudioInputStreamFactoryTest() : RenderViewHostTestHarness(), test_service_manager_context_( std::make_unique<TestServiceManagerContext>()), @@ -58,7 +68,7 @@ base::CreateSingleThreadTaskRunnerWithTraits( {BrowserThread::UI}))) {} - ~RenderFrameAudioInputStreamFactoryTest() override {} + ~MAYBE_RenderFrameAudioInputStreamFactoryTest() override {} void SetUp() override { RenderViewHostTestHarness::SetUp(); @@ -73,7 +83,7 @@ service_manager::ServiceFilter::ByName(audio::mojom::kServiceName), audio::mojom::StreamFactory::Name_, base::BindRepeating( - &RenderFrameAudioInputStreamFactoryTest::BindFactory, + &MAYBE_RenderFrameAudioInputStreamFactoryTest::BindFactory, base::Unretained(this))); base::RunLoop().RunUntilIdle(); @@ -185,13 +195,13 @@ std::unique_ptr<MediaStreamManager> media_stream_manager_; }; -TEST_F(RenderFrameAudioInputStreamFactoryTest, ConstructDestruct) { +TEST_F(MAYBE_RenderFrameAudioInputStreamFactoryTest, ConstructDestruct) { mojom::RendererAudioInputStreamFactoryPtr factory_ptr; RenderFrameAudioInputStreamFactory factory( mojo::MakeRequest(&factory_ptr), media_stream_manager_.get(), main_rfh()); } -TEST_F(RenderFrameAudioInputStreamFactoryTest, +TEST_F(MAYBE_RenderFrameAudioInputStreamFactoryTest, CreateOpenedStream_ForwardsCall) { mojom::RendererAudioInputStreamFactoryPtr factory_ptr; RenderFrameAudioInputStreamFactory factory( @@ -211,7 +221,7 @@ EXPECT_TRUE(!!audio_service_stream_factory_.last_created_callback); } -TEST_F(RenderFrameAudioInputStreamFactoryTest, +TEST_F(MAYBE_RenderFrameAudioInputStreamFactoryTest, CreateWebContentsCapture_ForwardsCall) { std::unique_ptr<WebContents> source_contents = CreateTestWebContents(); mojom::RendererAudioInputStreamFactoryPtr factory_ptr; @@ -235,7 +245,7 @@ EXPECT_TRUE(!!audio_service_stream_factory_.last_created_loopback_callback); } -TEST_F(RenderFrameAudioInputStreamFactoryTest, +TEST_F(MAYBE_RenderFrameAudioInputStreamFactoryTest, CreateWebContentsCaptureAfterCaptureSourceDestructed_Fails) { std::unique_ptr<WebContents> source_contents = CreateTestWebContents(); mojom::RendererAudioInputStreamFactoryPtr factory_ptr; @@ -260,7 +270,7 @@ EXPECT_FALSE(!!audio_service_stream_factory_.last_created_loopback_callback); } -TEST_F(RenderFrameAudioInputStreamFactoryTest, +TEST_F(MAYBE_RenderFrameAudioInputStreamFactoryTest, CreateStreamWithoutValidSessionId_Fails) { mojom::RendererAudioInputStreamFactoryPtr factory_ptr; RenderFrameAudioInputStreamFactory factory(
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 6a00a7d5..b33f30b 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -213,6 +213,7 @@ #include "services/service_manager/zygote/common/zygote_buildflags.h" #include "storage/browser/fileapi/sandbox_file_system_backend.h" #include "third_party/blink/public/common/page/launching_process_state.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/public_buildflags.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/ui_base_features.h" @@ -4449,6 +4450,8 @@ // Pass bits of global renderer state to the renderer. GetRendererInterface()->SetUserAgent( GetContentClient()->browser()->GetUserAgent()); + GetRendererInterface()->SetUserAgentMetadata( + GetContentClient()->browser()->GetUserAgentMetadata()); NotifyRendererIfLockedToSite(); if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites() && base::FeatureList::IsEnabled(features::kV8LowMemoryModeForSubframes)) {
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index 5d82b9b..6655cfc3 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -34,6 +34,7 @@ #include "storage/common/blob_storage/blob_handle.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/service_worker/service_worker_utils.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom.h" @@ -377,6 +378,9 @@ } void SetWebKitSharedTimersSuspended(bool suspend) override { NOTREACHED(); } void SetUserAgent(const std::string& user_agent) override { NOTREACHED(); } + void SetUserAgentMetadata(const blink::UserAgentMetadata& metadata) override { + NOTREACHED(); + } void UpdateScrollbarTheme( mojom::UpdateScrollbarThemeParamsPtr params) override { NOTREACHED();
diff --git a/content/browser/websockets/websocket_manager.cc b/content/browser/websockets/websocket_manager.cc index 08e32d0..b56fd77 100644 --- a/content/browser/websockets/websocket_manager.cc +++ b/content/browser/websockets/websocket_manager.cc
@@ -86,7 +86,7 @@ ChildProcessSecurityPolicyImpl* impl = ChildProcessSecurityPolicyImpl::GetInstance(); return impl->CanReadRawCookies(manager_->process_id_) && - impl->CanAccessDataForOrigin(manager_->process_id_, url); + impl->CanAccessDataForWebSocket(manager_->process_id_, url); } void OnCreateURLRequest(int child_id,
diff --git a/content/browser/worker_host/worker_script_fetch_initiator.cc b/content/browser/worker_host/worker_script_fetch_initiator.cc index 01042296..a8f396c 100644 --- a/content/browser/worker_host/worker_script_fetch_initiator.cc +++ b/content/browser/worker_host/worker_script_fetch_initiator.cc
@@ -217,6 +217,8 @@ "sharedworker"); resource_request->headers.SetHeaderIfMissing("Sec-Fetch-Site", site_value.c_str()); + resource_request->headers.SetHeaderIfMissing("Sec-Fetch-Mode", + "same-origin"); resource_request->headers.SetHeaderIfMissing("Sec-Fetch-User", "?F"); } }
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h index ccdb57a..7317f21 100644 --- a/content/common/navigation_params.h +++ b/content/common/navigation_params.h
@@ -36,7 +36,6 @@ namespace content { -// PlzNavigate // Struct keeping track of the Javascript SourceLocation that triggered the // navigation. This is initialized based on information from Blink at the start // of navigation, and passed back to Blink when the navigation commits. @@ -147,7 +146,7 @@ ~CommonNavigationParams(); // The URL to navigate to. - // PlzNavigate: May be modified when the navigation is ready to commit. + // May be modified when the navigation is ready to commit. GURL url; // When a frame navigates another frame, this is the origin of the document @@ -174,7 +173,7 @@ // Informs the RenderView the pending navigation should replace the current // history entry when it commits. This is used for cross-process redirects so // the transferred navigation can recover the navigation state. - // PlzNavigate: this is used by client-side redirects to indicate that when + // This is used by client-side redirects to indicate that when // the navigation commits, it should commit in the existing page. bool should_replace_current_entry = false; @@ -193,7 +192,7 @@ // The navigationStart time exposed through the Navigation Timing API to JS. // If this is for a browser-initiated navigation, this can override the // navigation_start value in Blink. - // PlzNavigate: For renderer initiated navigations, this will be set on the + // For renderer initiated navigations, this will be set on the // renderer side and sent with FrameHostMsg_BeginNavigation. base::TimeTicks navigation_start = base::TimeTicks::Now(); @@ -203,7 +202,6 @@ // Body of HTTP POST request. scoped_refptr<network::ResourceRequestBody> post_data; - // PlzNavigate // Information about the Javascript source for this navigation. Used for // providing information in console error messages triggered by the // navigation. If the navigation was not caused by Javascript, this should @@ -235,7 +233,6 @@ // Provided by the browser ----------------------------------------------------- -// PlzNavigate // Timings collected in the browser during navigation for the // Navigation Timing API. Sent to Blink in CommitNavigationParams when // the navigation is ready to be committed. @@ -286,15 +283,12 @@ // The ResourceResponseInfos received during redirects. std::vector<network::ResourceResponseHead> redirect_response; - // PlzNavigate // The RedirectInfos received during redirects. std::vector<net::RedirectInfo> redirect_infos; - // PlzNavigate // The content type from the request headers for POST requests. std::string post_content_type; - // PlzNavigate // The original URL & method for this navigation. GURL original_url; std::string original_method; @@ -360,7 +354,6 @@ // Whether a ServiceWorkerProviderHost should be created for the window. bool should_create_service_worker = false; - // PlzNavigate // Timing of navigation events. NavigationTiming navigation_timing; @@ -368,7 +361,6 @@ // created by the browser. Set to kInvalidServiceWorkerProviderId otherwise. int service_worker_provider_id = kInvalidServiceWorkerProviderId; - // PlzNavigate // The AppCache host id to be used to identify this navigation. int appcache_host_id = blink::mojom::kAppCacheNoHostId;
diff --git a/content/common/renderer.mojom b/content/common/renderer.mojom index 7a53a7a..a9f2e5c 100644 --- a/content/common/renderer.mojom +++ b/content/common/renderer.mojom
@@ -13,6 +13,7 @@ import "services/service_manager/public/mojom/service.mojom"; import "third_party/blink/public/mojom/renderer_preferences.mojom"; import "third_party/blink/public/mojom/service_worker/embedded_worker.mojom"; +import "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; struct CreateViewParams { @@ -224,6 +225,10 @@ // initialization. SetUserAgent(string user_agent); + // Sets the user agent metadata. This will replace `SetUserAgent()` if we + // decide to ship https://github.com/WICG/ua-client-hints. + SetUserAgentMetadata(blink.mojom.UserAgentMetadata metadata); + // Tells the renderer about a scrollbar appearance change. Only for use on // OS X. UpdateScrollbarTheme(UpdateScrollbarThemeParams params);
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index efbc337..ff27bb1 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -34,6 +34,7 @@ #include "services/network/public/mojom/network_service.mojom.h" #include "services/service_manager/sandbox/sandbox_type.h" #include "storage/browser/quota/quota_manager.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/renderer_preference_watcher.mojom.h" #include "ui/gfx/image/image_skia.h" #include "ui/shell_dialogs/select_file_policy.h" @@ -571,6 +572,17 @@ return nullptr; } +void ContentBrowserClient::UpdateDevToolsBackgroundServiceExpiration( + BrowserContext* browser_context, + int service, + base::Time expiration_time) {} + +base::flat_map<int, base::Time> +ContentBrowserClient::GetDevToolsBackgroundServiceExpirations( + BrowserContext* browser_context) { + return {}; +} + TracingDelegate* ContentBrowserClient::GetTracingDelegate() { return nullptr; } @@ -918,6 +930,10 @@ return std::string(); } +blink::UserAgentMetadata ContentBrowserClient::GetUserAgentMetadata() const { + return blink::UserAgentMetadata(); +} + bool ContentBrowserClient::IsBuiltinComponent(BrowserContext* browser_context, const url::Origin& origin) { return false;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index fbac51d..1b49a64 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -15,9 +15,11 @@ #include <vector> #include "base/callback.h" +#include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/optional.h" #include "base/task/task_scheduler/task_scheduler.h" +#include "base/time/time.h" #include "base/values.h" #include "build/build_config.h" #include "content/public/browser/certificate_request_result_type.h" @@ -50,6 +52,7 @@ #include "storage/browser/quota/quota_manager.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/renderer_preference_watcher.mojom-forward.h" #include "third_party/blink/public/platform/web_feature.mojom-forward.h" #include "third_party/blink/public/web/window_features.mojom-forward.h" @@ -877,6 +880,20 @@ // It's valid to return nullptr. virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate(); + // Stores the new expiration time up until which events related to |service| + // can still be logged. |service| is the int value of the + // DevToolsBackgroundService enum. |expiration_time| can be null, denoting + // that nothing should be recorded any more. + virtual void UpdateDevToolsBackgroundServiceExpiration( + BrowserContext* browser_context, + int service, + base::Time expiration_time); + + // Returns a mapping from a background service to the time up until which + // recording the background service's events is still allowed. + virtual base::flat_map<int, base::Time> + GetDevToolsBackgroundServiceExpirations(BrowserContext* browser_context); + // Creates a new TracingDelegate. The caller owns the returned value. // It's valid to return nullptr. virtual TracingDelegate* GetTracingDelegate(); @@ -1446,6 +1463,9 @@ // Returns the user agent. Content may cache this value. virtual std::string GetUserAgent() const; + // Returns user agent metadata. Content may cache this value. + virtual blink::UserAgentMetadata GetUserAgentMetadata() const; + // Returns whether |origin| should be considered a integral component similar // to native code, and as such whether its log messages should be recorded. virtual bool IsBuiltinComponent(BrowserContext* browser_context,
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 3cbe280..8f69d78 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -473,11 +473,17 @@ const base::Feature kTouchpadAsyncPinchEvents{"TouchpadAsyncPinchEvents", base::FEATURE_ENABLED_BY_DEFAULT}; -// Skips the passthrough touch event queue filter, ensuring that all touch -// events that reach the queue will be passed onto the renderer compositor -// process as long as the page hasn't timed out. -const base::Feature kSkipPassthroughTouchEventQueueFilter{ - "SkipPassthroughTouchEventQueueFilter", base::FEATURE_DISABLED_BY_DEFAULT}; +// Skips the browser touch event filter, ensuring that events that reach the +// queue and would otherwise be filtered out will instead be passed onto the +// renderer compositor process as long as the page hasn't timed out. Which event +// types will be always forwarded is controlled by the "type" FeatureParam, +// which can be either "discrete" (default) or "all". +const base::Feature kSkipBrowserTouchFilter{"SkipBrowserTouchFilter", + base::FEATURE_DISABLED_BY_DEFAULT}; + +const char kSkipBrowserTouchFilterTypeParamName[] = "type"; +const char kSkipBrowserTouchFilterTypeParamValueDiscrete[] = "discrete"; +const char kSkipBrowserTouchFilterTypeParamValueAll[] = "all"; // Allows user activation propagation to all frames having the same origin as // the activation notifier frame. This is an intermediate measure before we @@ -546,10 +552,8 @@ // Controls whether the WebAuthentication API is enabled: // https://w3c.github.io/webauthn -const base::Feature kWebAuth { - "WebAuthentication", - base::FEATURE_ENABLED_BY_DEFAULT -}; +const base::Feature kWebAuth{"WebAuthentication", + base::FEATURE_ENABLED_BY_DEFAULT}; // Controls whether BLE authenticators can be used via the WebAuthentication // API. https://w3c.github.io/webauthn @@ -656,12 +660,12 @@ base::FEATURE_DISABLED_BY_DEFAULT}; // Controls whether the orientation sensor based device is enabled. -const base::Feature kWebXrOrientationSensorDevice{ - "WebXROrientationSensorDevice", +const base::Feature kWebXrOrientationSensorDevice { + "WebXROrientationSensorDevice", #if defined(OS_ANDROID) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif };
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 499aaef2..b57a897 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -109,7 +109,11 @@ CONTENT_EXPORT extern const char kSignedHTTPExchangeAcceptHeaderFieldTrialParamName[]; CONTENT_EXPORT extern const base::Feature kSignedHTTPExchangeOriginTrial; -CONTENT_EXPORT extern const base::Feature kSkipPassthroughTouchEventQueueFilter; +CONTENT_EXPORT extern const base::Feature kSkipBrowserTouchFilter; +CONTENT_EXPORT extern const char kSkipBrowserTouchFilterTypeParamName[]; +CONTENT_EXPORT extern const char + kSkipBrowserTouchFilterTypeParamValueDiscrete[]; +CONTENT_EXPORT extern const char kSkipBrowserTouchFilterTypeParamValueAll[]; CONTENT_EXPORT extern const base::Feature kSpareRendererForSitePerProcess; CONTENT_EXPORT extern const base::Feature kTimerThrottlingForHiddenFrames; CONTENT_EXPORT extern const base::Feature kTouchpadAsyncPinchEvents;
diff --git a/content/public/renderer/render_thread.h b/content/public/renderer/render_thread.h index d11233f..66df7e7 100644 --- a/content/public/renderer/render_thread.h +++ b/content/public/renderer/render_thread.h
@@ -25,6 +25,8 @@ } namespace blink { +struct UserAgentMetadata; + namespace scheduler { enum class WebRendererProcessType; } @@ -108,6 +110,7 @@ // Returns the user-agent string. virtual blink::WebString GetUserAgent() = 0; + virtual const blink::UserAgentMetadata& GetUserAgentMetadata() = 0; }; } // namespace content
diff --git a/content/public/test/fake_service_worker_context.h b/content/public/test/fake_service_worker_context.h index 088583c..824811c 100644 --- a/content/public/test/fake_service_worker_context.h +++ b/content/public/test/fake_service_worker_context.h
@@ -81,12 +81,12 @@ std::vector<StartServiceWorkerAndDispatchMessageArgs>& start_service_worker_and_dispatch_message_calls() { return start_service_worker_and_dispatch_message_calls_; - }; + } std::vector<StartServiceWorkerAndDispatchMessageArgs>& start_service_worker_and_dispatch_long_running_message_calls() { return start_service_worker_and_dispatch_long_running_message_calls_; - }; + } const std::vector<GURL>& stop_all_service_workers_for_origin_calls() { return stop_all_service_workers_for_origin_calls_;
diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc index fe409a7..7afea0b 100644 --- a/content/public/test/mock_render_thread.cc +++ b/content/public/test/mock_render_thread.cc
@@ -24,6 +24,7 @@ #include "services/service_manager/public/cpp/connector.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/dom_storage/session_storage_namespace_id.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/web/web_script_controller.h" namespace content { @@ -34,6 +35,8 @@ // that the IDs generated by MockRenderThread will not clash. constexpr int32_t kFirstGeneratedRoutingId = 313337000; +static const blink::UserAgentMetadata kUserAgentMetadata; + class MockRenderMessageFilterImpl : public mojom::RenderMessageFilter { public: explicit MockRenderMessageFilterImpl(MockRenderThread* thread) @@ -231,6 +234,10 @@ return blink::WebString(); } +const blink::UserAgentMetadata& MockRenderThread::GetUserAgentMetadata() { + return kUserAgentMetadata; +} + #if defined(OS_WIN) void MockRenderThread::PreCacheFont(const LOGFONT& log_font) { }
diff --git a/content/public/test/mock_render_thread.h b/content/public/test/mock_render_thread.h index 7c03ae9..8143f5f4 100644 --- a/content/public/test/mock_render_thread.h +++ b/content/public/test/mock_render_thread.h
@@ -81,6 +81,7 @@ void SetRendererProcessType( blink::scheduler::WebRendererProcessType type) override; blink::WebString GetUserAgent() override; + const blink::UserAgentMetadata& GetUserAgentMetadata() override; #if defined(OS_WIN) void PreCacheFont(const LOGFONT& log_font) override; void ReleaseCachedFonts() override;
diff --git a/content/renderer/media/stream/media_stream_audio_processor.cc b/content/renderer/media/stream/media_stream_audio_processor.cc index 1e24bfe..a955723 100644 --- a/content/renderer/media/stream/media_stream_audio_processor.cc +++ b/content/renderer/media/stream/media_stream_audio_processor.cc
@@ -37,7 +37,6 @@ #include "third_party/webrtc/api/audio/echo_canceller3_config.h" #include "third_party/webrtc/api/audio/echo_canceller3_config_json.h" #include "third_party/webrtc/api/audio/echo_canceller3_factory.h" -#include "third_party/webrtc/api/media_constraints_interface.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing_statistics.h" #include "third_party/webrtc/modules/audio_processing/typing_detection.h"
diff --git a/content/renderer/media/stream/mock_constraint_factory.cc b/content/renderer/media/stream/mock_constraint_factory.cc index adda05d..1153e2c 100644 --- a/content/renderer/media/stream/mock_constraint_factory.cc +++ b/content/renderer/media/stream/mock_constraint_factory.cc
@@ -9,7 +9,6 @@ #include "base/strings/utf_string_conversions.h" #include "content/renderer/media/stream/media_stream_audio_processor_options.h" #include "content/renderer/media/stream/mock_constraint_factory.h" -#include "third_party/webrtc/api/media_constraints_interface.h" namespace content {
diff --git a/content/renderer/media/stream/processed_local_audio_source.cc b/content/renderer/media/stream/processed_local_audio_source.cc index 8996cce..b61f233ef 100644 --- a/content/renderer/media/stream/processed_local_audio_source.cc +++ b/content/renderer/media/stream/processed_local_audio_source.cc
@@ -23,7 +23,6 @@ #include "media/base/channel_layout.h" #include "media/base/sample_rates.h" #include "media/webrtc/webrtc_switches.h" -#include "third_party/webrtc/api/media_constraints_interface.h" #include "third_party/webrtc/media/base/media_channel.h" namespace content {
diff --git a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h index abb273e1..61e25246 100644 --- a/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h +++ b/content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h
@@ -13,7 +13,6 @@ #include "base/macros.h" #include "base/single_thread_task_runner.h" #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" -#include "third_party/webrtc/api/media_constraints_interface.h" #include "third_party/webrtc/api/media_stream_interface.h" namespace content {
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc index 45e7ae65..88c721b69 100644 --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -60,7 +60,6 @@ #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_local_frame.h" #include "third_party/webrtc/api/create_peerconnection_factory.h" -#include "third_party/webrtc/api/media_constraints_interface.h" #include "third_party/webrtc/api/video_track_source_proxy.h" #include "third_party/webrtc/media/engine/fake_video_codec_factory.h" #include "third_party/webrtc/media/engine/multiplex_codec_factory.h"
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index f97fc06..f426c57 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1502,6 +1502,10 @@ return user_agent_; } +const blink::UserAgentMetadata& RenderThreadImpl::GetUserAgentMetadata() { + return user_agent_metadata_; +} + void RenderThreadImpl::OnAssociatedInterfaceRequest( const std::string& name, mojo::ScopedInterfaceEndpointHandle handle) { @@ -2223,6 +2227,11 @@ GetContentClient()->renderer()->DidSetUserAgent(user_agent); } +void RenderThreadImpl::SetUserAgentMetadata( + const blink::UserAgentMetadata& user_agent_metadata) { + user_agent_metadata_ = user_agent_metadata; +} + void RenderThreadImpl::UpdateScrollbarTheme( mojom::UpdateScrollbarThemeParamsPtr params) { #if defined(OS_MACOSX)
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index b294fac3..5a5b774c 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -56,6 +56,7 @@ #include "services/service_manager/public/cpp/binder_registry.h" #include "services/viz/public/interfaces/compositing/compositing_mode_watcher.mojom.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/dom_storage/storage_partition_service.mojom.h" #include "third_party/blink/public/platform/scheduler/web_rail_mode_observer.h" #include "third_party/blink/public/platform/web_connection_type.h" @@ -213,6 +214,7 @@ void SetRendererProcessType( blink::scheduler::WebRendererProcessType type) override; blink::WebString GetUserAgent() override; + const blink::UserAgentMetadata& GetUserAgentMetadata() override; // IPC::Listener implementation via ChildThreadImpl: void OnAssociatedInterfaceRequest( @@ -552,6 +554,7 @@ double bandwidth_kbps) override; void SetWebKitSharedTimersSuspended(bool suspend) override; void SetUserAgent(const std::string& user_agent) override; + void SetUserAgentMetadata(const blink::UserAgentMetadata& metadata) override; void UpdateScrollbarTheme( mojom::UpdateScrollbarThemeParamsPtr params) override; void OnSystemColorsChanged(int32_t aqua_color_variant, @@ -635,6 +638,7 @@ int hidden_widget_count_; blink::WebString user_agent_; + blink::UserAgentMetadata user_agent_metadata_; // Used to control web test specific behavior. std::unique_ptr<WebTestDependencies> web_test_deps_;
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index 0456ed1..6fa35ba6 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -391,6 +391,14 @@ return render_thread->GetUserAgent(); } +blink::UserAgentMetadata RendererBlinkPlatformImpl::UserAgentMetadata() { + auto* render_thread = RenderThreadImpl::current(); + // RenderThreadImpl is null in some tests. + if (!render_thread) + return blink::UserAgentMetadata(); + return render_thread->GetUserAgentMetadata(); +} + void RendererBlinkPlatformImpl::CacheMetadata( blink::mojom::CodeCacheType cache_type, const blink::WebURL& url,
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h index 02a9681..e3d39d7 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h
@@ -25,6 +25,7 @@ #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_type.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h" #include "third_party/blink/public/mojom/loader/code_cache.mojom.h" #include "third_party/blink/public/platform/modules/webdatabase/web_database.mojom.h" @@ -82,6 +83,7 @@ bool IsLinkVisited(unsigned long long linkHash) override; blink::WebPrescientNetworking* PrescientNetworking() override; blink::WebString UserAgent() override; + blink::UserAgentMetadata UserAgentMetadata() override; void CacheMetadata(blink::mojom::CodeCacheType cache_type, const blink::WebURL&, base::Time,
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index d9eb022..fb9ccac 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc
@@ -61,6 +61,7 @@ #include "services/test/echo/public/cpp/manifest.h" #include "services/test/echo/public/mojom/echo.mojom.h" #include "storage/browser/quota/quota_settings.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "ui/base/ui_base_features.h" #include "url/gurl.h" #include "url/origin.h" @@ -235,6 +236,20 @@ return BuildUserAgentFromProduct(product); } +blink::UserAgentMetadata GetShellUserAgentMetadata() { + blink::UserAgentMetadata metadata; + + metadata.brand = "content_shell"; + metadata.version = CONTENT_SHELL_VERSION; + metadata.platform = BuildOSCpuInfo(false); + + // TODO(mkwst): Split these out from BuildOSCpuInfo(). + metadata.architecture = ""; + metadata.model = ""; + + return metadata; +} + ShellContentBrowserClient* ShellContentBrowserClient::Get() { return g_browser_client; } @@ -492,6 +507,11 @@ return GetShellUserAgent(); } +blink::UserAgentMetadata ShellContentBrowserClient::GetUserAgentMetadata() + const { + return GetShellUserAgentMetadata(); +} + #if defined(OS_LINUX) || defined(OS_ANDROID) void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line,
diff --git a/content/shell/browser/shell_content_browser_client.h b/content/shell/browser/shell_content_browser_client.h index 2a1f674..bc80b43 100644 --- a/content/shell/browser/shell_content_browser_client.h +++ b/content/shell/browser/shell_content_browser_client.h
@@ -23,6 +23,7 @@ class ShellBrowserMainParts; std::string GetShellUserAgent(); +blink::UserAgentMetadata GetShellUserAgentMetadata(); class ShellContentBrowserClient : public ContentBrowserClient { public: @@ -88,6 +89,7 @@ LoginAuthRequiredCallback auth_required_callback) override; std::string GetUserAgent() const override; + blink::UserAgentMetadata GetUserAgentMetadata() const override; #if defined(OS_LINUX) || defined(OS_ANDROID) void GetAdditionalMappedFilesForChildProcess(
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index eb2a2ca..1c6d2aad 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1395,6 +1395,7 @@ "../browser/compositor/reflector_impl_unittest.cc", "../browser/compositor/software_browser_compositor_output_surface_unittest.cc", "../browser/cookie_store/cookie_store_manager_unittest.cc", + "../browser/devtools/devtools_background_services_context_unittest.cc", "../browser/devtools/devtools_http_handler_unittest.cc", "../browser/devtools/devtools_manager_unittest.cc", "../browser/devtools/devtools_video_consumer_unittest.cc", @@ -1905,6 +1906,7 @@ "//content/browser:for_content_tests", "//content/browser/background_fetch:background_fetch_proto", "//content/browser/cache_storage:cache_storage_proto", + "//content/browser/devtools:devtools_background_services_proto", "//content/browser/dom_storage:local_storage_proto", "//content/browser/notifications:notification_proto", "//content/browser/service_worker:service_worker_proto",
diff --git a/courgette/label_manager_unittest.cc b/courgette/label_manager_unittest.cc index e95b513..037958b 100644 --- a/courgette/label_manager_unittest.cc +++ b/courgette/label_manager_unittest.cc
@@ -25,9 +25,7 @@ class TestLabelManager : public LabelManager { public: - void SetLabels(const LabelVector& labels) { - labels_ = labels; - }; + void SetLabels(const LabelVector& labels) { labels_ = labels; } }; void CheckLabelManagerContent(LabelManager* label_manager,
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h index e46e882..3065b8b9 100644 --- a/gpu/GLES2/gl2chromium_autogen.h +++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -275,6 +275,11 @@ #define glFramebufferParameteri GLES2_GET_FUN(FramebufferParameteri) #define glBindImageTexture GLES2_GET_FUN(BindImageTexture) #define glDispatchCompute GLES2_GET_FUN(DispatchCompute) +#define glGetProgramInterfaceiv GLES2_GET_FUN(GetProgramInterfaceiv) +#define glGetProgramResourceIndex GLES2_GET_FUN(GetProgramResourceIndex) +#define glGetProgramResourceName GLES2_GET_FUN(GetProgramResourceName) +#define glGetProgramResourceiv GLES2_GET_FUN(GetProgramResourceiv) +#define glGetProgramResourceLocation GLES2_GET_FUN(GetProgramResourceLocation) #define glMemoryBarrierEXT GLES2_GET_FUN(MemoryBarrierEXT) #define glMemoryBarrierByRegion GLES2_GET_FUN(MemoryBarrierByRegion) #define glSwapBuffers GLES2_GET_FUN(SwapBuffers)
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 2cc75e3..7fe7fed 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -2526,6 +2526,60 @@ 'type': 'STRn', 'expectation': False, }, + 'GetProgramInterfaceiv': { + 'type': 'GETn', + 'decoder_func': 'DoGetProgramInterfaceiv', + 'result': ['SizedResult<GLint>'], + 'unit_test': False, + 'trace_level': 2, + 'es31': True, + }, + 'GetProgramResourceiv': { + 'type': 'Custom', + 'data_transfer_methods': ['shm'], + 'cmd_args': + 'GLidProgram program, GLenum program_interface, GLuint index, ' + 'uint32_t props_bucket_id, GLint* params', + 'result': ['SizedResult<GLint>'], + 'unit_test': False, + 'trace_level': 2, + 'es31': True, + }, + 'GetProgramResourceIndex': { + 'type': 'Custom', + 'data_transfer_methods': ['shm'], + 'cmd_args': + 'GLidProgram program, GLenum program_interface, ' + 'uint32_t name_bucket_id, GLuint* index', + 'result': ['GLuint'], + 'error_return': 'GL_INVALID_INDEX', + 'unit_test': False, + 'trace_level': 2, + 'es31': True, + }, + 'GetProgramResourceLocation': { + 'type': 'Custom', + 'data_transfer_methods': ['shm'], + 'cmd_args': + 'GLidProgram program, GLenum program_interface, ' + 'uint32_t name_bucket_id, GLint* location', + 'result': ['GLint'], + 'error_return': -1, + 'unit_test': False, + 'trace_level': 2, + 'es31': True, + }, + 'GetProgramResourceName': { + 'type': 'Custom', + 'data_transfer_methods': ['shm'], + 'cmd_args': + 'GLidProgram program, GLenum program_interface, GLuint index, ' + 'uint32_t name_bucket_id, void* result', + 'result': ['int32_t'], + 'unit_test': False, + 'trace_level': 2, + 'es31': True, + }, 'GetRenderbufferParameteriv': { 'type': 'GETn', 'decoder_func': 'DoGetRenderbufferParameteriv',
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 0a8dab9..ca386c6 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -1262,6 +1262,46 @@ gles2::GetGLContext()->DispatchCompute(num_groups_x, num_groups_y, num_groups_z); } +void GL_APIENTRY GLES2GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) { + gles2::GetGLContext()->GetProgramInterfaceiv(program, program_interface, + pname, params); +} +GLuint GL_APIENTRY GLES2GetProgramResourceIndex(GLuint program, + GLenum program_interface, + const char* name) { + return gles2::GetGLContext()->GetProgramResourceIndex( + program, program_interface, name); +} +void GL_APIENTRY GLES2GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) { + gles2::GetGLContext()->GetProgramResourceName(program, program_interface, + index, bufsize, length, name); +} +void GL_APIENTRY GLES2GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) { + gles2::GetGLContext()->GetProgramResourceiv(program, program_interface, index, + prop_count, props, bufsize, + length, params); +} +GLint GL_APIENTRY GLES2GetProgramResourceLocation(GLuint program, + GLenum program_interface, + const char* name) { + return gles2::GetGLContext()->GetProgramResourceLocation( + program, program_interface, name); +} void GL_APIENTRY GLES2MemoryBarrierEXT(GLbitfield barriers) { gles2::GetGLContext()->MemoryBarrierEXT(barriers); } @@ -2918,6 +2958,26 @@ reinterpret_cast<GLES2FunctionPointer>(glDispatchCompute), }, { + "glGetProgramInterfaceiv", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramInterfaceiv), + }, + { + "glGetProgramResourceIndex", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramResourceIndex), + }, + { + "glGetProgramResourceName", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramResourceName), + }, + { + "glGetProgramResourceiv", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramResourceiv), + }, + { + "glGetProgramResourceLocation", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramResourceLocation), + }, + { "glMemoryBarrierEXT", reinterpret_cast<GLES2FunctionPointer>(glMemoryBarrierEXT), },
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 4b936cbc..e0c0ca8 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -2473,6 +2473,73 @@ } } +void GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetProgramInterfaceiv* c = + GetCmdSpace<gles2::cmds::GetProgramInterfaceiv>(); + if (c) { + c->Init(program, program_interface, pname, params_shm_id, + params_shm_offset); + } +} + +void GetProgramResourceIndex(GLuint program, + GLenum program_interface, + uint32_t name_bucket_id, + uint32_t index_shm_id, + uint32_t index_shm_offset) { + gles2::cmds::GetProgramResourceIndex* c = + GetCmdSpace<gles2::cmds::GetProgramResourceIndex>(); + if (c) { + c->Init(program, program_interface, name_bucket_id, index_shm_id, + index_shm_offset); + } +} + +void GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + uint32_t name_bucket_id, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::GetProgramResourceName* c = + GetCmdSpace<gles2::cmds::GetProgramResourceName>(); + if (c) { + c->Init(program, program_interface, index, name_bucket_id, result_shm_id, + result_shm_offset); + } +} + +void GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + uint32_t props_bucket_id, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetProgramResourceiv* c = + GetCmdSpace<gles2::cmds::GetProgramResourceiv>(); + if (c) { + c->Init(program, program_interface, index, props_bucket_id, params_shm_id, + params_shm_offset); + } +} + +void GetProgramResourceLocation(GLuint program, + GLenum program_interface, + uint32_t name_bucket_id, + uint32_t location_shm_id, + uint32_t location_shm_offset) { + gles2::cmds::GetProgramResourceLocation* c = + GetCmdSpace<gles2::cmds::GetProgramResourceLocation>(); + if (c) { + c->Init(program, program_interface, name_bucket_id, location_shm_id, + location_shm_offset); + } +} + void MemoryBarrierEXT(GLbitfield barriers) { gles2::cmds::MemoryBarrierEXT* c = GetCmdSpace<gles2::cmds::MemoryBarrierEXT>();
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 6c470c3..3f15a8c 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -1809,6 +1809,231 @@ return index; } +bool GLES2Implementation::GetProgramInterfaceivHelper(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) { + bool success = share_group_->program_info_manager()->GetProgramInterfaceiv( + this, program, program_interface, pname, params); + GPU_CLIENT_LOG_CODE_BLOCK({ + if (success) { + GPU_CLIENT_LOG(" 0: " << *params); + } + }); + return success; +} + +GLuint GLES2Implementation::GetProgramResourceIndexHelper( + GLuint program, + GLenum program_interface, + const char* name) { + typedef cmds::GetProgramResourceIndex::Result Result; + SetBucketAsCString(kResultBucketId, name); + auto result = GetResultAs<Result>(); + if (!result) { + return GL_INVALID_INDEX; + } + *result = GL_INVALID_INDEX; + helper_->GetProgramResourceIndex(program, program_interface, kResultBucketId, + GetResultShmId(), result.offset()); + WaitForCmd(); + helper_->SetBucketSize(kResultBucketId, 0); + return *result; +} + +GLuint GLES2Implementation::GetProgramResourceIndex( + GLuint program, + GLenum program_interface, + const char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramResourceIndex(" + << program << ", " << program_interface << ", " << name + << ")"); + TRACE_EVENT0("gpu", "GLES2::GetProgramResourceIndex"); + GLuint index = share_group_->program_info_manager()->GetProgramResourceIndex( + this, program, program_interface, name); + GPU_CLIENT_LOG("returned " << index); + CheckGLError(); + return index; +} + +bool GLES2Implementation::GetProgramResourceNameHelper(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) { + DCHECK_LE(0, bufsize); + // Clear the bucket so if the command fails nothing will be in it. + helper_->SetBucketSize(kResultBucketId, 0); + bool success = false; + { + // The Result pointer must be scoped to this block because it can be + // invalidated below if getting result name causes the transfer buffer to be + // reallocated. + typedef cmds::GetProgramResourceName::Result Result; + auto result = GetResultAs<Result>(); + if (!result) { + return false; + } + // Set as failed so if the command fails we'll recover. + *result = 0; + helper_->GetProgramResourceName(program, program_interface, index, + kResultBucketId, GetResultShmId(), + result.offset()); + WaitForCmd(); + success = !!*result; + } + if (success) { + GetResultNameHelper(bufsize, length, name); + } + return success; +} + +void GLES2Implementation::GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramResourceName(" + << program << ", " << program_interface << ", " << index + << ", " << bufsize << ", " << static_cast<void*>(length) + << ", " << static_cast<void*>(name) << ")"); + if (bufsize < 0) { + SetGLError(GL_INVALID_VALUE, "glGetProgramResourceName", "bufsize < 0"); + return; + } + TRACE_EVENT0("gpu", "GLES2::GetProgramResourceName"); + bool success = share_group_->program_info_manager()->GetProgramResourceName( + this, program, program_interface, index, bufsize, length, name); + if (success && name) { + GPU_CLIENT_LOG(" name: " << name); + } + CheckGLError(); +} + +bool GLES2Implementation::GetProgramResourceivHelper(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) { + DCHECK_LE(0, prop_count); + DCHECK_LE(0, bufsize); + base::CheckedNumeric<uint32_t> bytes = prop_count; + bytes *= sizeof(GLenum); + if (!bytes.IsValid()) { + SetGLError(GL_INVALID_VALUE, "glGetProgramResourceiv", "count overflow"); + return false; + } + SetBucketContents(kResultBucketId, props, bytes.ValueOrDefault(0)); + typedef cmds::GetProgramResourceiv::Result Result; + auto result = GetResultAs<Result>(); + if (!result) { + return false; + } + result->SetNumResults(0); + helper_->GetProgramResourceiv(program, program_interface, index, + kResultBucketId, GetResultShmId(), + result.offset()); + WaitForCmd(); + if (length) { + *length = result->GetNumResults(); + } + if (result->GetNumResults() > 0) { + if (params) { + result->CopyResult(params); + } + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32_t i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); + return true; + } + return false; +} + +void GLES2Implementation::GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramResourceiv(" << program + << ", " << program_interface << ", " << index << ", " + << prop_count << ", " << static_cast<const void*>(props) + << ", " << bufsize << ", " << static_cast<void*>(length) + << ", " << static_cast<void*>(params) << ")"); + if (prop_count < 0) { + SetGLError(GL_INVALID_VALUE, "glGetProgramResourceiv", "prop_count < 0"); + return; + } + if (bufsize < 0) { + SetGLError(GL_INVALID_VALUE, "glGetProgramResourceiv", "bufsize < 0"); + return; + } + TRACE_EVENT0("gpu", "GLES2::GetProgramResourceiv"); + GLsizei param_count = 0; + bool success = share_group_->program_info_manager()->GetProgramResourceiv( + this, program, program_interface, index, prop_count, props, bufsize, + ¶m_count, params); + if (length) { + *length = param_count; + } + if (success && params) { + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei ii = 0; ii < param_count; ++ii) { + GPU_CLIENT_LOG(" " << ii << ": " << params[ii]); + } + }); + } + CheckGLError(); +} + +GLint GLES2Implementation::GetProgramResourceLocationHelper( + GLuint program, + GLenum program_interface, + const char* name) { + typedef cmds::GetProgramResourceLocation::Result Result; + SetBucketAsCString(kResultBucketId, name); + auto result = GetResultAs<Result>(); + if (!result) { + return -1; + } + *result = -1; + helper_->GetProgramResourceLocation(program, program_interface, + kResultBucketId, GetResultShmId(), + result.offset()); + WaitForCmd(); + helper_->SetBucketSize(kResultBucketId, 0); + return *result; +} + +GLint GLES2Implementation::GetProgramResourceLocation( + GLuint program, + GLenum program_interface, + const char* name) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramResourceLocation(" + << program << ", " << program_interface << ", " << name + << ")"); + TRACE_EVENT0("gpu", "GLES2::GetProgramResourceLocation"); + GLint location = + share_group_->program_info_manager()->GetProgramResourceLocation( + this, program, program_interface, name); + GPU_CLIENT_LOG("returned " << location); + CheckGLError(); + return location; +} + void GLES2Implementation::LinkProgram(GLuint program) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLinkProgram(" << program << ")");
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 44f7d0b..393b49b 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -186,6 +186,19 @@ GLint* values); bool GetQueryObjectValueHelper( const char* function_name, GLuint id, GLenum pname, GLuint64* params); + bool GetProgramInterfaceivHelper( + GLuint program, GLenum program_interface, GLenum pname, GLint* params); + GLuint GetProgramResourceIndexHelper( + GLuint program, GLenum program_interface, const char* name); + bool GetProgramResourceNameHelper( + GLuint program, GLenum program_interface, GLuint index, GLsizei bufsize, + GLsizei* length, char* name); + bool GetProgramResourceivHelper( + GLuint program, GLenum program_interface, GLuint index, + GLsizei prop_count, const GLenum* props, GLsizei bufsize, GLsizei* length, + GLint* params); + GLint GetProgramResourceLocationHelper( + GLuint program, GLenum program_interface, const char* name); const scoped_refptr<ShareGroup>& share_group() const { return share_group_; }
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 624ea51c8..60200cb 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -883,6 +883,35 @@ GLuint num_groups_y, GLuint num_groups_z) override; +void GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) override; + +GLuint GetProgramResourceIndex(GLuint program, + GLenum program_interface, + const char* name) override; + +void GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) override; + +void GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) override; + +GLint GetProgramResourceLocation(GLuint program, + GLenum program_interface, + const char* name) override; + void MemoryBarrierEXT(GLbitfield barriers) override; void MemoryBarrierByRegion(GLbitfield barriers) override;
diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index b196b0a..bfbcd6b7 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -3077,6 +3077,38 @@ CheckGLError(); } +void GLES2Implementation::GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInterfaceiv(" + << program << ", " + << GLES2Util::GetStringEnum(program_interface) << ", " + << GLES2Util::GetStringEnum(pname) << ", " + << static_cast<const void*>(params) << ")"); + TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramInterfaceiv"); + if (GetProgramInterfaceivHelper(program, program_interface, pname, params)) { + return; + } + typedef cmds::GetProgramInterfaceiv::Result Result; + ScopedResultPtr<Result> result = GetResultAs<Result>(); + if (!result) { + return; + } + result->SetNumResults(0); + helper_->GetProgramInterfaceiv(program, program_interface, pname, + GetResultShmId(), result.offset()); + WaitForCmd(); + result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32_t i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); + CheckGLError(); +} void GLES2Implementation::MemoryBarrierEXT(GLbitfield barriers) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMemoryBarrierEXT(" << barriers
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index 7226960..6ddbda8e 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
@@ -2712,6 +2712,24 @@ EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, GetProgramInterfaceiv) { + struct Cmds { + cmds::GetProgramInterfaceiv cmd; + }; + typedef cmds::GetProgramInterfaceiv::Result::Type ResultType; + ResultType result = 0; + Cmds expected; + ExpectedMemoryInfo result1 = + GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType)); + expected.cmd.Init(123, 2, 3, result1.id, result1.offset); + EXPECT_CALL(*command_buffer(), OnFlush()) + .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1))) + .RetiresOnSaturation(); + gl_->GetProgramInterfaceiv(123, 2, 3, &result); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); + EXPECT_EQ(static_cast<ResultType>(1), result); +} + TEST_F(GLES2ImplementationTest, MemoryBarrierEXT) { struct Cmds { cmds::MemoryBarrierEXT cmd;
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index 8f02498..9daed65b 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -650,6 +650,30 @@ virtual void DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) = 0; +virtual void GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) = 0; +virtual GLuint GetProgramResourceIndex(GLuint program, + GLenum program_interface, + const char* name) = 0; +virtual void GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) = 0; +virtual void GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) = 0; +virtual GLint GetProgramResourceLocation(GLuint program, + GLenum program_interface, + const char* name) = 0; virtual void MemoryBarrierEXT(GLbitfield barriers) = 0; virtual void MemoryBarrierByRegion(GLbitfield barriers) = 0; virtual void SwapBuffers(GLuint64 swap_id, GLbitfield flags = 0) = 0;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index 263313c..35b35b1 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -627,6 +627,30 @@ void DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) override; +void GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) override; +GLuint GetProgramResourceIndex(GLuint program, + GLenum program_interface, + const char* name) override; +void GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) override; +void GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) override; +GLint GetProgramResourceLocation(GLuint program, + GLenum program_interface, + const char* name) override; void MemoryBarrierEXT(GLbitfield barriers) override; void MemoryBarrierByRegion(GLbitfield barriers) override; void SwapBuffers(GLuint64 swap_id, GLbitfield flags) override;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h index 81e592e..bb14269 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -852,6 +852,36 @@ void GLES2InterfaceStub::DispatchCompute(GLuint /* num_groups_x */, GLuint /* num_groups_y */, GLuint /* num_groups_z */) {} +void GLES2InterfaceStub::GetProgramInterfaceiv(GLuint /* program */, + GLenum /* program_interface */, + GLenum /* pname */, + GLint* /* params */) {} +GLuint GLES2InterfaceStub::GetProgramResourceIndex( + GLuint /* program */, + GLenum /* program_interface */, + const char* /* name */) { + return 0; +} +void GLES2InterfaceStub::GetProgramResourceName(GLuint /* program */, + GLenum /* program_interface */, + GLuint /* index */, + GLsizei /* bufsize */, + GLsizei* /* length */, + char* /* name */) {} +void GLES2InterfaceStub::GetProgramResourceiv(GLuint /* program */, + GLenum /* program_interface */, + GLuint /* index */, + GLsizei /* prop_count */, + const GLenum* /* props */, + GLsizei /* bufsize */, + GLsizei* /* length */, + GLint* /* params */) {} +GLint GLES2InterfaceStub::GetProgramResourceLocation( + GLuint /* program */, + GLenum /* program_interface */, + const char* /* name */) { + return 0; +} void GLES2InterfaceStub::MemoryBarrierEXT(GLbitfield /* barriers */) {} void GLES2InterfaceStub::MemoryBarrierByRegion(GLbitfield /* barriers */) {} void GLES2InterfaceStub::SwapBuffers(GLuint64 /* swap_id */,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index 61c2fa70..428d60e 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -627,6 +627,30 @@ void DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) override; +void GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) override; +GLuint GetProgramResourceIndex(GLuint program, + GLenum program_interface, + const char* name) override; +void GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) override; +void GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) override; +GLint GetProgramResourceLocation(GLuint program, + GLenum program_interface, + const char* name) override; void MemoryBarrierEXT(GLbitfield barriers) override; void MemoryBarrierByRegion(GLbitfield barriers) override; void SwapBuffers(GLuint64 swap_id, GLbitfield flags) override;
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h index dcde091e..b14f102 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -1830,6 +1830,55 @@ gl_->DispatchCompute(num_groups_x, num_groups_y, num_groups_z); } +void GLES2TraceImplementation::GetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLint* params) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramInterfaceiv"); + gl_->GetProgramInterfaceiv(program, program_interface, pname, params); +} + +GLuint GLES2TraceImplementation::GetProgramResourceIndex( + GLuint program, + GLenum program_interface, + const char* name) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramResourceIndex"); + return gl_->GetProgramResourceIndex(program, program_interface, name); +} + +void GLES2TraceImplementation::GetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei bufsize, + GLsizei* length, + char* name) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramResourceName"); + gl_->GetProgramResourceName(program, program_interface, index, bufsize, + length, name); +} + +void GLES2TraceImplementation::GetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramResourceiv"); + gl_->GetProgramResourceiv(program, program_interface, index, prop_count, + props, bufsize, length, params); +} + +GLint GLES2TraceImplementation::GetProgramResourceLocation( + GLuint program, + GLenum program_interface, + const char* name) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetProgramResourceLocation"); + return gl_->GetProgramResourceLocation(program, program_interface, name); +} + void GLES2TraceImplementation::MemoryBarrierEXT(GLbitfield barriers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MemoryBarrierEXT"); gl_->MemoryBarrierEXT(barriers);
diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc index 9581a354..c49efa9 100644 --- a/gpu/command_buffer/client/program_info_manager.cc +++ b/gpu/command_buffer/client/program_info_manager.cc
@@ -1015,6 +1015,50 @@ return gl->GetUniformIndicesHelper(program, count, names, indices); } +bool ProgramInfoManager::GetProgramInterfaceiv( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + GLenum pname, GLint* params) { + // TODO(jiajie.hu@intel.com): The info is not cached for now, so always + // fallback to the IPC path. + return false; +} + +GLuint ProgramInfoManager::GetProgramResourceIndex( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + const char* name) { + // TODO(jiajie.hu@intel.com): The info is not cached for now, so always + // fallback to the IPC path. + return gl->GetProgramResourceIndexHelper(program, program_interface, name); +} + +bool ProgramInfoManager::GetProgramResourceName( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + GLuint index, GLsizei bufsize, GLsizei* length, char* name) { + // TODO(jiajie.hu@intel.com): The info is not cached for now, so always + // fallback to the IPC path. + return gl->GetProgramResourceNameHelper( + program, program_interface, index, bufsize, length, name); +} + +bool ProgramInfoManager::GetProgramResourceiv( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + GLuint index, GLsizei prop_count, const GLenum* props, GLsizei bufsize, + GLsizei* length, GLint* params) { + // TODO(jiajie.hu@intel.com): The info is not cached for now, so always + // fallback to the IPC path. + return gl->GetProgramResourceivHelper( + program, program_interface, index, prop_count, props, bufsize, length, + params); +} + +GLint ProgramInfoManager::GetProgramResourceLocation( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + const char* name) { + // TODO(jiajie.hu@intel.com): The info is not cached for now, so always + // fallback to the IPC path. + return gl->GetProgramResourceLocationHelper(program, program_interface, name); +} + } // namespace gles2 } // namespace gpu
diff --git a/gpu/command_buffer/client/program_info_manager.h b/gpu/command_buffer/client/program_info_manager.h index 4f1ddcb5..ee39eec 100644 --- a/gpu/command_buffer/client/program_info_manager.h +++ b/gpu/command_buffer/client/program_info_manager.h
@@ -83,6 +83,27 @@ GLES2Implementation* gl, GLuint program, GLsizei count, const GLuint* indices, GLenum pname, GLint* params); + bool GetProgramInterfaceiv( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + GLenum pname, GLint* params); + + GLuint GetProgramResourceIndex( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + const char* name); + + bool GetProgramResourceName( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + GLuint index, GLsizei bufsize, GLsizei* length, char* name); + + bool GetProgramResourceiv( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + GLuint index, GLsizei prop_count, const GLenum* props, GLsizei bufsize, + GLsizei* length, GLint* params); + + GLint GetProgramResourceLocation( + GLES2Implementation* gl, GLuint program, GLenum program_interface, + const char* name); + private: friend class ProgramInfoManagerTest;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index d45e669..41836d0 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -12293,6 +12293,334 @@ static_assert(offsetof(DispatchCompute, num_groups_z) == 12, "offset of DispatchCompute num_groups_z should be 12"); +struct GetProgramInterfaceiv { + typedef GetProgramInterfaceiv ValueType; + static const CommandId kCmdId = kGetProgramInterfaceiv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(2); + + typedef SizedResult<GLint> Result; + + static uint32_t ComputeSize() { + return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { header.SetCmd<ValueType>(); } + + void Init(GLuint _program, + GLenum _program_interface, + GLenum _pname, + uint32_t _params_shm_id, + uint32_t _params_shm_offset) { + SetHeader(); + program = _program; + program_interface = _program_interface; + pname = _pname; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set(void* cmd, + GLuint _program, + GLenum _program_interface, + GLenum _pname, + uint32_t _params_shm_id, + uint32_t _params_shm_offset) { + static_cast<ValueType*>(cmd)->Init(_program, _program_interface, _pname, + _params_shm_id, _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + gpu::CommandHeader header; + uint32_t program; + uint32_t program_interface; + uint32_t pname; + uint32_t params_shm_id; + uint32_t params_shm_offset; +}; + +static_assert(sizeof(GetProgramInterfaceiv) == 24, + "size of GetProgramInterfaceiv should be 24"); +static_assert(offsetof(GetProgramInterfaceiv, header) == 0, + "offset of GetProgramInterfaceiv header should be 0"); +static_assert(offsetof(GetProgramInterfaceiv, program) == 4, + "offset of GetProgramInterfaceiv program should be 4"); +static_assert(offsetof(GetProgramInterfaceiv, program_interface) == 8, + "offset of GetProgramInterfaceiv program_interface should be 8"); +static_assert(offsetof(GetProgramInterfaceiv, pname) == 12, + "offset of GetProgramInterfaceiv pname should be 12"); +static_assert(offsetof(GetProgramInterfaceiv, params_shm_id) == 16, + "offset of GetProgramInterfaceiv params_shm_id should be 16"); +static_assert(offsetof(GetProgramInterfaceiv, params_shm_offset) == 20, + "offset of GetProgramInterfaceiv params_shm_offset should be 20"); + +struct GetProgramResourceIndex { + typedef GetProgramResourceIndex ValueType; + static const CommandId kCmdId = kGetProgramResourceIndex; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(2); + + typedef GLuint Result; + + static uint32_t ComputeSize() { + return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { header.SetCmd<ValueType>(); } + + void Init(GLuint _program, + GLenum _program_interface, + uint32_t _name_bucket_id, + uint32_t _index_shm_id, + uint32_t _index_shm_offset) { + SetHeader(); + program = _program; + program_interface = _program_interface; + name_bucket_id = _name_bucket_id; + index_shm_id = _index_shm_id; + index_shm_offset = _index_shm_offset; + } + + void* Set(void* cmd, + GLuint _program, + GLenum _program_interface, + uint32_t _name_bucket_id, + uint32_t _index_shm_id, + uint32_t _index_shm_offset) { + static_cast<ValueType*>(cmd)->Init(_program, _program_interface, + _name_bucket_id, _index_shm_id, + _index_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + gpu::CommandHeader header; + uint32_t program; + uint32_t program_interface; + uint32_t name_bucket_id; + uint32_t index_shm_id; + uint32_t index_shm_offset; +}; + +static_assert(sizeof(GetProgramResourceIndex) == 24, + "size of GetProgramResourceIndex should be 24"); +static_assert(offsetof(GetProgramResourceIndex, header) == 0, + "offset of GetProgramResourceIndex header should be 0"); +static_assert(offsetof(GetProgramResourceIndex, program) == 4, + "offset of GetProgramResourceIndex program should be 4"); +static_assert( + offsetof(GetProgramResourceIndex, program_interface) == 8, + "offset of GetProgramResourceIndex program_interface should be 8"); +static_assert(offsetof(GetProgramResourceIndex, name_bucket_id) == 12, + "offset of GetProgramResourceIndex name_bucket_id should be 12"); +static_assert(offsetof(GetProgramResourceIndex, index_shm_id) == 16, + "offset of GetProgramResourceIndex index_shm_id should be 16"); +static_assert( + offsetof(GetProgramResourceIndex, index_shm_offset) == 20, + "offset of GetProgramResourceIndex index_shm_offset should be 20"); + +struct GetProgramResourceName { + typedef GetProgramResourceName ValueType; + static const CommandId kCmdId = kGetProgramResourceName; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(2); + + typedef int32_t Result; + + static uint32_t ComputeSize() { + return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { header.SetCmd<ValueType>(); } + + void Init(GLuint _program, + GLenum _program_interface, + GLuint _index, + uint32_t _name_bucket_id, + uint32_t _result_shm_id, + uint32_t _result_shm_offset) { + SetHeader(); + program = _program; + program_interface = _program_interface; + index = _index; + name_bucket_id = _name_bucket_id; + result_shm_id = _result_shm_id; + result_shm_offset = _result_shm_offset; + } + + void* Set(void* cmd, + GLuint _program, + GLenum _program_interface, + GLuint _index, + uint32_t _name_bucket_id, + uint32_t _result_shm_id, + uint32_t _result_shm_offset) { + static_cast<ValueType*>(cmd)->Init(_program, _program_interface, _index, + _name_bucket_id, _result_shm_id, + _result_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + gpu::CommandHeader header; + uint32_t program; + uint32_t program_interface; + uint32_t index; + uint32_t name_bucket_id; + uint32_t result_shm_id; + uint32_t result_shm_offset; +}; + +static_assert(sizeof(GetProgramResourceName) == 28, + "size of GetProgramResourceName should be 28"); +static_assert(offsetof(GetProgramResourceName, header) == 0, + "offset of GetProgramResourceName header should be 0"); +static_assert(offsetof(GetProgramResourceName, program) == 4, + "offset of GetProgramResourceName program should be 4"); +static_assert(offsetof(GetProgramResourceName, program_interface) == 8, + "offset of GetProgramResourceName program_interface should be 8"); +static_assert(offsetof(GetProgramResourceName, index) == 12, + "offset of GetProgramResourceName index should be 12"); +static_assert(offsetof(GetProgramResourceName, name_bucket_id) == 16, + "offset of GetProgramResourceName name_bucket_id should be 16"); +static_assert(offsetof(GetProgramResourceName, result_shm_id) == 20, + "offset of GetProgramResourceName result_shm_id should be 20"); +static_assert( + offsetof(GetProgramResourceName, result_shm_offset) == 24, + "offset of GetProgramResourceName result_shm_offset should be 24"); + +struct GetProgramResourceiv { + typedef GetProgramResourceiv ValueType; + static const CommandId kCmdId = kGetProgramResourceiv; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(2); + + typedef SizedResult<GLint> Result; + + static uint32_t ComputeSize() { + return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { header.SetCmd<ValueType>(); } + + void Init(GLuint _program, + GLenum _program_interface, + GLuint _index, + uint32_t _props_bucket_id, + uint32_t _params_shm_id, + uint32_t _params_shm_offset) { + SetHeader(); + program = _program; + program_interface = _program_interface; + index = _index; + props_bucket_id = _props_bucket_id; + params_shm_id = _params_shm_id; + params_shm_offset = _params_shm_offset; + } + + void* Set(void* cmd, + GLuint _program, + GLenum _program_interface, + GLuint _index, + uint32_t _props_bucket_id, + uint32_t _params_shm_id, + uint32_t _params_shm_offset) { + static_cast<ValueType*>(cmd)->Init(_program, _program_interface, _index, + _props_bucket_id, _params_shm_id, + _params_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + gpu::CommandHeader header; + uint32_t program; + uint32_t program_interface; + uint32_t index; + uint32_t props_bucket_id; + uint32_t params_shm_id; + uint32_t params_shm_offset; +}; + +static_assert(sizeof(GetProgramResourceiv) == 28, + "size of GetProgramResourceiv should be 28"); +static_assert(offsetof(GetProgramResourceiv, header) == 0, + "offset of GetProgramResourceiv header should be 0"); +static_assert(offsetof(GetProgramResourceiv, program) == 4, + "offset of GetProgramResourceiv program should be 4"); +static_assert(offsetof(GetProgramResourceiv, program_interface) == 8, + "offset of GetProgramResourceiv program_interface should be 8"); +static_assert(offsetof(GetProgramResourceiv, index) == 12, + "offset of GetProgramResourceiv index should be 12"); +static_assert(offsetof(GetProgramResourceiv, props_bucket_id) == 16, + "offset of GetProgramResourceiv props_bucket_id should be 16"); +static_assert(offsetof(GetProgramResourceiv, params_shm_id) == 20, + "offset of GetProgramResourceiv params_shm_id should be 20"); +static_assert(offsetof(GetProgramResourceiv, params_shm_offset) == 24, + "offset of GetProgramResourceiv params_shm_offset should be 24"); + +struct GetProgramResourceLocation { + typedef GetProgramResourceLocation ValueType; + static const CommandId kCmdId = kGetProgramResourceLocation; + static const cmd::ArgFlags kArgFlags = cmd::kFixed; + static const uint8_t cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(2); + + typedef GLint Result; + + static uint32_t ComputeSize() { + return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT + } + + void SetHeader() { header.SetCmd<ValueType>(); } + + void Init(GLuint _program, + GLenum _program_interface, + uint32_t _name_bucket_id, + uint32_t _location_shm_id, + uint32_t _location_shm_offset) { + SetHeader(); + program = _program; + program_interface = _program_interface; + name_bucket_id = _name_bucket_id; + location_shm_id = _location_shm_id; + location_shm_offset = _location_shm_offset; + } + + void* Set(void* cmd, + GLuint _program, + GLenum _program_interface, + uint32_t _name_bucket_id, + uint32_t _location_shm_id, + uint32_t _location_shm_offset) { + static_cast<ValueType*>(cmd)->Init(_program, _program_interface, + _name_bucket_id, _location_shm_id, + _location_shm_offset); + return NextCmdAddress<ValueType>(cmd); + } + + gpu::CommandHeader header; + uint32_t program; + uint32_t program_interface; + uint32_t name_bucket_id; + uint32_t location_shm_id; + uint32_t location_shm_offset; +}; + +static_assert(sizeof(GetProgramResourceLocation) == 24, + "size of GetProgramResourceLocation should be 24"); +static_assert(offsetof(GetProgramResourceLocation, header) == 0, + "offset of GetProgramResourceLocation header should be 0"); +static_assert(offsetof(GetProgramResourceLocation, program) == 4, + "offset of GetProgramResourceLocation program should be 4"); +static_assert( + offsetof(GetProgramResourceLocation, program_interface) == 8, + "offset of GetProgramResourceLocation program_interface should be 8"); +static_assert( + offsetof(GetProgramResourceLocation, name_bucket_id) == 12, + "offset of GetProgramResourceLocation name_bucket_id should be 12"); +static_assert( + offsetof(GetProgramResourceLocation, location_shm_id) == 16, + "offset of GetProgramResourceLocation location_shm_id should be 16"); +static_assert( + offsetof(GetProgramResourceLocation, location_shm_offset) == 20, + "offset of GetProgramResourceLocation location_shm_offset should be 20"); + struct MemoryBarrierEXT { typedef MemoryBarrierEXT ValueType; static const CommandId kCmdId = kMemoryBarrierEXT;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index 62958cd..23dbbe7 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -4122,6 +4122,97 @@ CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } +TEST_F(GLES2FormatTest, GetProgramInterfaceiv) { + cmds::GetProgramInterfaceiv& cmd = + *GetBufferAs<cmds::GetProgramInterfaceiv>(); + void* next_cmd = + cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), + static_cast<GLenum>(13), static_cast<uint32_t>(14), + static_cast<uint32_t>(15)); + EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInterfaceiv::kCmdId), + cmd.header.command); + EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); + EXPECT_EQ(static_cast<GLuint>(11), cmd.program); + EXPECT_EQ(static_cast<GLenum>(12), cmd.program_interface); + EXPECT_EQ(static_cast<GLenum>(13), cmd.pname); + EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id); + EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset); + CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); +} + +TEST_F(GLES2FormatTest, GetProgramResourceIndex) { + cmds::GetProgramResourceIndex& cmd = + *GetBufferAs<cmds::GetProgramResourceIndex>(); + void* next_cmd = + cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), + static_cast<uint32_t>(13), static_cast<uint32_t>(14), + static_cast<uint32_t>(15)); + EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramResourceIndex::kCmdId), + cmd.header.command); + EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); + EXPECT_EQ(static_cast<GLuint>(11), cmd.program); + EXPECT_EQ(static_cast<GLenum>(12), cmd.program_interface); + EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id); + EXPECT_EQ(static_cast<uint32_t>(14), cmd.index_shm_id); + EXPECT_EQ(static_cast<uint32_t>(15), cmd.index_shm_offset); + CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); +} + +TEST_F(GLES2FormatTest, GetProgramResourceName) { + cmds::GetProgramResourceName& cmd = + *GetBufferAs<cmds::GetProgramResourceName>(); + void* next_cmd = + cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), + static_cast<GLuint>(13), static_cast<uint32_t>(14), + static_cast<uint32_t>(15), static_cast<uint32_t>(16)); + EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramResourceName::kCmdId), + cmd.header.command); + EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); + EXPECT_EQ(static_cast<GLuint>(11), cmd.program); + EXPECT_EQ(static_cast<GLenum>(12), cmd.program_interface); + EXPECT_EQ(static_cast<GLuint>(13), cmd.index); + EXPECT_EQ(static_cast<uint32_t>(14), cmd.name_bucket_id); + EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_id); + EXPECT_EQ(static_cast<uint32_t>(16), cmd.result_shm_offset); + CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); +} + +TEST_F(GLES2FormatTest, GetProgramResourceiv) { + cmds::GetProgramResourceiv& cmd = *GetBufferAs<cmds::GetProgramResourceiv>(); + void* next_cmd = + cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), + static_cast<GLuint>(13), static_cast<uint32_t>(14), + static_cast<uint32_t>(15), static_cast<uint32_t>(16)); + EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramResourceiv::kCmdId), + cmd.header.command); + EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); + EXPECT_EQ(static_cast<GLuint>(11), cmd.program); + EXPECT_EQ(static_cast<GLenum>(12), cmd.program_interface); + EXPECT_EQ(static_cast<GLuint>(13), cmd.index); + EXPECT_EQ(static_cast<uint32_t>(14), cmd.props_bucket_id); + EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_id); + EXPECT_EQ(static_cast<uint32_t>(16), cmd.params_shm_offset); + CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); +} + +TEST_F(GLES2FormatTest, GetProgramResourceLocation) { + cmds::GetProgramResourceLocation& cmd = + *GetBufferAs<cmds::GetProgramResourceLocation>(); + void* next_cmd = + cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), + static_cast<uint32_t>(13), static_cast<uint32_t>(14), + static_cast<uint32_t>(15)); + EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramResourceLocation::kCmdId), + cmd.header.command); + EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); + EXPECT_EQ(static_cast<GLuint>(11), cmd.program); + EXPECT_EQ(static_cast<GLenum>(12), cmd.program_interface); + EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id); + EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_id); + EXPECT_EQ(static_cast<uint32_t>(15), cmd.location_shm_offset); + CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); +} + TEST_F(GLES2FormatTest, MemoryBarrierEXT) { cmds::MemoryBarrierEXT& cmd = *GetBufferAs<cmds::MemoryBarrierEXT>(); void* next_cmd = cmd.Set(&cmd, static_cast<GLbitfield>(11));
diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h index c3321ba..1731b16d 100644 --- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
@@ -262,100 +262,105 @@ OP(FramebufferParameteri) /* 503 */ \ OP(BindImageTexture) /* 504 */ \ OP(DispatchCompute) /* 505 */ \ - OP(MemoryBarrierEXT) /* 506 */ \ - OP(MemoryBarrierByRegion) /* 507 */ \ - OP(SwapBuffers) /* 508 */ \ - OP(GetMaxValueInBufferCHROMIUM) /* 509 */ \ - OP(EnableFeatureCHROMIUM) /* 510 */ \ - OP(MapBufferRange) /* 511 */ \ - OP(UnmapBuffer) /* 512 */ \ - OP(FlushMappedBufferRange) /* 513 */ \ - OP(ResizeCHROMIUM) /* 514 */ \ - OP(GetRequestableExtensionsCHROMIUM) /* 515 */ \ - OP(RequestExtensionCHROMIUM) /* 516 */ \ - OP(GetProgramInfoCHROMIUM) /* 517 */ \ - OP(GetUniformBlocksCHROMIUM) /* 518 */ \ - OP(GetTransformFeedbackVaryingsCHROMIUM) /* 519 */ \ - OP(GetUniformsES3CHROMIUM) /* 520 */ \ - OP(DescheduleUntilFinishedCHROMIUM) /* 521 */ \ - OP(GetTranslatedShaderSourceANGLE) /* 522 */ \ - OP(PostSubBufferCHROMIUM) /* 523 */ \ - OP(CopyTextureCHROMIUM) /* 524 */ \ - OP(CopySubTextureCHROMIUM) /* 525 */ \ - OP(DrawArraysInstancedANGLE) /* 526 */ \ - OP(DrawElementsInstancedANGLE) /* 527 */ \ - OP(VertexAttribDivisorANGLE) /* 528 */ \ - OP(ProduceTextureDirectCHROMIUMImmediate) /* 529 */ \ - OP(CreateAndConsumeTextureINTERNALImmediate) /* 530 */ \ - OP(BindUniformLocationCHROMIUMBucket) /* 531 */ \ - OP(BindTexImage2DCHROMIUM) /* 532 */ \ - OP(BindTexImage2DWithInternalformatCHROMIUM) /* 533 */ \ - OP(ReleaseTexImage2DCHROMIUM) /* 534 */ \ - OP(TraceBeginCHROMIUM) /* 535 */ \ - OP(TraceEndCHROMIUM) /* 536 */ \ - OP(DiscardFramebufferEXTImmediate) /* 537 */ \ - OP(LoseContextCHROMIUM) /* 538 */ \ - OP(InsertFenceSyncCHROMIUM) /* 539 */ \ - OP(UnpremultiplyAndDitherCopyCHROMIUM) /* 540 */ \ - OP(DrawBuffersEXTImmediate) /* 541 */ \ - OP(DiscardBackbufferCHROMIUM) /* 542 */ \ - OP(ScheduleOverlayPlaneCHROMIUM) /* 543 */ \ - OP(ScheduleCALayerSharedStateCHROMIUM) /* 544 */ \ - OP(ScheduleCALayerCHROMIUM) /* 545 */ \ - OP(ScheduleCALayerInUseQueryCHROMIUMImmediate) /* 546 */ \ - OP(CommitOverlayPlanesCHROMIUM) /* 547 */ \ - OP(FlushDriverCachesCHROMIUM) /* 548 */ \ - OP(ScheduleDCLayerCHROMIUM) /* 549 */ \ - OP(SetActiveURLCHROMIUM) /* 550 */ \ - OP(MatrixLoadfCHROMIUMImmediate) /* 551 */ \ - OP(MatrixLoadIdentityCHROMIUM) /* 552 */ \ - OP(GenPathsCHROMIUM) /* 553 */ \ - OP(DeletePathsCHROMIUM) /* 554 */ \ - OP(IsPathCHROMIUM) /* 555 */ \ - OP(PathCommandsCHROMIUM) /* 556 */ \ - OP(PathParameterfCHROMIUM) /* 557 */ \ - OP(PathParameteriCHROMIUM) /* 558 */ \ - OP(PathStencilFuncCHROMIUM) /* 559 */ \ - OP(StencilFillPathCHROMIUM) /* 560 */ \ - OP(StencilStrokePathCHROMIUM) /* 561 */ \ - OP(CoverFillPathCHROMIUM) /* 562 */ \ - OP(CoverStrokePathCHROMIUM) /* 563 */ \ - OP(StencilThenCoverFillPathCHROMIUM) /* 564 */ \ - OP(StencilThenCoverStrokePathCHROMIUM) /* 565 */ \ - OP(StencilFillPathInstancedCHROMIUM) /* 566 */ \ - OP(StencilStrokePathInstancedCHROMIUM) /* 567 */ \ - OP(CoverFillPathInstancedCHROMIUM) /* 568 */ \ - OP(CoverStrokePathInstancedCHROMIUM) /* 569 */ \ - OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 570 */ \ - OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 571 */ \ - OP(BindFragmentInputLocationCHROMIUMBucket) /* 572 */ \ - OP(ProgramPathFragmentInputGenCHROMIUM) /* 573 */ \ - OP(CoverageModulationCHROMIUM) /* 574 */ \ - OP(BlendBarrierKHR) /* 575 */ \ - OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 576 */ \ - OP(BindFragDataLocationIndexedEXTBucket) /* 577 */ \ - OP(BindFragDataLocationEXTBucket) /* 578 */ \ - OP(GetFragDataIndexEXT) /* 579 */ \ - OP(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate) /* 580 */ \ - OP(OverlayPromotionHintCHROMIUM) /* 581 */ \ - OP(SwapBuffersWithBoundsCHROMIUMImmediate) /* 582 */ \ - OP(SetDrawRectangleCHROMIUM) /* 583 */ \ - OP(SetEnableDCLayersCHROMIUM) /* 584 */ \ - OP(InitializeDiscardableTextureCHROMIUM) /* 585 */ \ - OP(UnlockDiscardableTextureCHROMIUM) /* 586 */ \ - OP(LockDiscardableTextureCHROMIUM) /* 587 */ \ - OP(TexStorage2DImageCHROMIUM) /* 588 */ \ - OP(SetColorSpaceMetadataCHROMIUM) /* 589 */ \ - OP(WindowRectanglesEXTImmediate) /* 590 */ \ - OP(CreateGpuFenceINTERNAL) /* 591 */ \ - OP(WaitGpuFenceCHROMIUM) /* 592 */ \ - OP(DestroyGpuFenceCHROMIUM) /* 593 */ \ - OP(SetReadbackBufferShadowAllocationINTERNAL) /* 594 */ \ - OP(FramebufferTextureMultiviewLayeredANGLE) /* 595 */ \ - OP(MaxShaderCompilerThreadsKHR) /* 596 */ \ - OP(CreateAndTexStorage2DSharedImageINTERNALImmediate) /* 597 */ \ - OP(BeginSharedImageAccessDirectCHROMIUM) /* 598 */ \ - OP(EndSharedImageAccessDirectCHROMIUM) /* 599 */ + OP(GetProgramInterfaceiv) /* 506 */ \ + OP(GetProgramResourceIndex) /* 507 */ \ + OP(GetProgramResourceName) /* 508 */ \ + OP(GetProgramResourceiv) /* 509 */ \ + OP(GetProgramResourceLocation) /* 510 */ \ + OP(MemoryBarrierEXT) /* 511 */ \ + OP(MemoryBarrierByRegion) /* 512 */ \ + OP(SwapBuffers) /* 513 */ \ + OP(GetMaxValueInBufferCHROMIUM) /* 514 */ \ + OP(EnableFeatureCHROMIUM) /* 515 */ \ + OP(MapBufferRange) /* 516 */ \ + OP(UnmapBuffer) /* 517 */ \ + OP(FlushMappedBufferRange) /* 518 */ \ + OP(ResizeCHROMIUM) /* 519 */ \ + OP(GetRequestableExtensionsCHROMIUM) /* 520 */ \ + OP(RequestExtensionCHROMIUM) /* 521 */ \ + OP(GetProgramInfoCHROMIUM) /* 522 */ \ + OP(GetUniformBlocksCHROMIUM) /* 523 */ \ + OP(GetTransformFeedbackVaryingsCHROMIUM) /* 524 */ \ + OP(GetUniformsES3CHROMIUM) /* 525 */ \ + OP(DescheduleUntilFinishedCHROMIUM) /* 526 */ \ + OP(GetTranslatedShaderSourceANGLE) /* 527 */ \ + OP(PostSubBufferCHROMIUM) /* 528 */ \ + OP(CopyTextureCHROMIUM) /* 529 */ \ + OP(CopySubTextureCHROMIUM) /* 530 */ \ + OP(DrawArraysInstancedANGLE) /* 531 */ \ + OP(DrawElementsInstancedANGLE) /* 532 */ \ + OP(VertexAttribDivisorANGLE) /* 533 */ \ + OP(ProduceTextureDirectCHROMIUMImmediate) /* 534 */ \ + OP(CreateAndConsumeTextureINTERNALImmediate) /* 535 */ \ + OP(BindUniformLocationCHROMIUMBucket) /* 536 */ \ + OP(BindTexImage2DCHROMIUM) /* 537 */ \ + OP(BindTexImage2DWithInternalformatCHROMIUM) /* 538 */ \ + OP(ReleaseTexImage2DCHROMIUM) /* 539 */ \ + OP(TraceBeginCHROMIUM) /* 540 */ \ + OP(TraceEndCHROMIUM) /* 541 */ \ + OP(DiscardFramebufferEXTImmediate) /* 542 */ \ + OP(LoseContextCHROMIUM) /* 543 */ \ + OP(InsertFenceSyncCHROMIUM) /* 544 */ \ + OP(UnpremultiplyAndDitherCopyCHROMIUM) /* 545 */ \ + OP(DrawBuffersEXTImmediate) /* 546 */ \ + OP(DiscardBackbufferCHROMIUM) /* 547 */ \ + OP(ScheduleOverlayPlaneCHROMIUM) /* 548 */ \ + OP(ScheduleCALayerSharedStateCHROMIUM) /* 549 */ \ + OP(ScheduleCALayerCHROMIUM) /* 550 */ \ + OP(ScheduleCALayerInUseQueryCHROMIUMImmediate) /* 551 */ \ + OP(CommitOverlayPlanesCHROMIUM) /* 552 */ \ + OP(FlushDriverCachesCHROMIUM) /* 553 */ \ + OP(ScheduleDCLayerCHROMIUM) /* 554 */ \ + OP(SetActiveURLCHROMIUM) /* 555 */ \ + OP(MatrixLoadfCHROMIUMImmediate) /* 556 */ \ + OP(MatrixLoadIdentityCHROMIUM) /* 557 */ \ + OP(GenPathsCHROMIUM) /* 558 */ \ + OP(DeletePathsCHROMIUM) /* 559 */ \ + OP(IsPathCHROMIUM) /* 560 */ \ + OP(PathCommandsCHROMIUM) /* 561 */ \ + OP(PathParameterfCHROMIUM) /* 562 */ \ + OP(PathParameteriCHROMIUM) /* 563 */ \ + OP(PathStencilFuncCHROMIUM) /* 564 */ \ + OP(StencilFillPathCHROMIUM) /* 565 */ \ + OP(StencilStrokePathCHROMIUM) /* 566 */ \ + OP(CoverFillPathCHROMIUM) /* 567 */ \ + OP(CoverStrokePathCHROMIUM) /* 568 */ \ + OP(StencilThenCoverFillPathCHROMIUM) /* 569 */ \ + OP(StencilThenCoverStrokePathCHROMIUM) /* 570 */ \ + OP(StencilFillPathInstancedCHROMIUM) /* 571 */ \ + OP(StencilStrokePathInstancedCHROMIUM) /* 572 */ \ + OP(CoverFillPathInstancedCHROMIUM) /* 573 */ \ + OP(CoverStrokePathInstancedCHROMIUM) /* 574 */ \ + OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 575 */ \ + OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 576 */ \ + OP(BindFragmentInputLocationCHROMIUMBucket) /* 577 */ \ + OP(ProgramPathFragmentInputGenCHROMIUM) /* 578 */ \ + OP(CoverageModulationCHROMIUM) /* 579 */ \ + OP(BlendBarrierKHR) /* 580 */ \ + OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 581 */ \ + OP(BindFragDataLocationIndexedEXTBucket) /* 582 */ \ + OP(BindFragDataLocationEXTBucket) /* 583 */ \ + OP(GetFragDataIndexEXT) /* 584 */ \ + OP(UniformMatrix4fvStreamTextureMatrixCHROMIUMImmediate) /* 585 */ \ + OP(OverlayPromotionHintCHROMIUM) /* 586 */ \ + OP(SwapBuffersWithBoundsCHROMIUMImmediate) /* 587 */ \ + OP(SetDrawRectangleCHROMIUM) /* 588 */ \ + OP(SetEnableDCLayersCHROMIUM) /* 589 */ \ + OP(InitializeDiscardableTextureCHROMIUM) /* 590 */ \ + OP(UnlockDiscardableTextureCHROMIUM) /* 591 */ \ + OP(LockDiscardableTextureCHROMIUM) /* 592 */ \ + OP(TexStorage2DImageCHROMIUM) /* 593 */ \ + OP(SetColorSpaceMetadataCHROMIUM) /* 594 */ \ + OP(WindowRectanglesEXTImmediate) /* 595 */ \ + OP(CreateGpuFenceINTERNAL) /* 596 */ \ + OP(WaitGpuFenceCHROMIUM) /* 597 */ \ + OP(DestroyGpuFenceCHROMIUM) /* 598 */ \ + OP(SetReadbackBufferShadowAllocationINTERNAL) /* 599 */ \ + OP(FramebufferTextureMultiviewLayeredANGLE) /* 600 */ \ + OP(MaxShaderCompilerThreadsKHR) /* 601 */ \ + OP(CreateAndTexStorage2DSharedImageINTERNALImmediate) /* 602 */ \ + OP(BeginSharedImageAccessDirectCHROMIUM) /* 603 */ \ + OP(EndSharedImageAccessDirectCHROMIUM) /* 604 */ enum CommandId { kOneBeforeStartPoint =
diff --git a/gpu/command_buffer/gles2_cmd_buffer_functions.txt b/gpu/command_buffer/gles2_cmd_buffer_functions.txt index 740a8dc..a022738 100644 --- a/gpu/command_buffer/gles2_cmd_buffer_functions.txt +++ b/gpu/command_buffer/gles2_cmd_buffer_functions.txt
@@ -271,6 +271,13 @@ GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); + +GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLidProgram program, GLenum program_interface, GLenum pname, GLint* params); +GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLidProgram program, GLenum program_interface, const char* name); +GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLidProgram program, GLenum program_interface, GLuint index, GLsizeiNotNegative bufsize, GLsizeiOptional* length, char* name); +GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLidProgram program, GLenum program_interface, GLuint index, GLsizeiNotNegative prop_count, const GLenum* props, GLsizeiNotNegative bufsize, GLsizeiOptional* length, GLint* params); +GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLidProgram program, GLenum program_interface, const char* name); + GL_APICALL void GL_APIENTRY glMemoryBarrierEXT (GLbitfield barriers); GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index faf7838..60546d5 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -11786,6 +11786,34 @@ return error::kNoError; } +error::Error GLES2DecoderImpl::HandleGetProgramResourceiv( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + // Unimplemented for WebGL 2.0 Compute context. + return error::kUnknownCommand; +} + +error::Error GLES2DecoderImpl::HandleGetProgramResourceIndex( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + // Unimplemented for WebGL 2.0 Compute context. + return error::kUnknownCommand; +} + +error::Error GLES2DecoderImpl::HandleGetProgramResourceLocation( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + // Unimplemented for WebGL 2.0 Compute context. + return error::kUnknownCommand; +} + +error::Error GLES2DecoderImpl::HandleGetProgramResourceName( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + // Unimplemented for WebGL 2.0 Compute context. + return error::kUnknownCommand; +} + error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( uint32_t immediate_data_size, const volatile void* cmd_data) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index 912d5b30..8ae2168 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -4668,6 +4668,12 @@ return error::kUnknownCommand; } +error::Error GLES2DecoderImpl::HandleGetProgramInterfaceiv( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + return error::kUnknownCommand; +} + error::Error GLES2DecoderImpl::HandleMemoryBarrierEXT( uint32_t immediate_data_size, const volatile void* cmd_data) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototypes.h b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototypes.h index 046f791..781d677 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototypes.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototypes.h
@@ -305,6 +305,32 @@ GLsizei* length, GLint* params); error::Error DoGetProgramInfoLog(GLuint program, std::string* infolog); +error::Error DoGetProgramInterfaceiv(GLuint program, + GLenum program_interface, + GLenum pname, + GLsizei bufsize, + GLsizei* length, + GLint* params); +error::Error DoGetProgramResourceiv(GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params); +error::Error DoGetProgramResourceIndex(GLuint program, + GLenum program_interface, + const char* name, + GLuint* index); +error::Error DoGetProgramResourceLocation(GLuint program, + GLenum program_interface, + const char* name, + GLint* location); +error::Error DoGetProgramResourceName(GLuint program, + GLenum program_interface, + GLuint index, + std::string* name); error::Error DoGetRenderbufferParameteriv(GLenum target, GLenum pname, GLsizei bufsize,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc index 638dff00..bab7a390 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
@@ -1705,6 +1705,82 @@ return error::kNoError; } +error::Error GLES2DecoderPassthroughImpl::DoGetProgramInterfaceiv( + GLuint program, + GLenum program_interface, + GLenum pname, + GLsizei bufsize, + GLsizei* length, + GLint* params) { + // glGetProgramInterfaceivRobustANGLE remains to be implemented in ANGLE. + if (bufsize < 1) { + return error::kOutOfBounds; + } + *length = 1; + api()->glGetProgramInterfaceivFn(GetProgramServiceID(program, resources_), + program_interface, pname, params); + return error::kNoError; +} + +error::Error GLES2DecoderPassthroughImpl::DoGetProgramResourceiv( + GLuint program, + GLenum program_interface, + GLuint index, + GLsizei prop_count, + const GLenum* props, + GLsizei bufsize, + GLsizei* length, + GLint* params) { + api()->glGetProgramResourceivFn(GetProgramServiceID(program, resources_), + program_interface, index, prop_count, props, + bufsize, length, params); + return error::kNoError; +} + +error::Error GLES2DecoderPassthroughImpl::DoGetProgramResourceIndex( + GLuint program, + GLenum program_interface, + const char* name, + GLuint* index) { + *index = api()->glGetProgramResourceIndexFn( + GetProgramServiceID(program, resources_), program_interface, name); + return error::kNoError; +} + +error::Error GLES2DecoderPassthroughImpl::DoGetProgramResourceLocation( + GLuint program, + GLenum program_interface, + const char* name, + GLint* location) { + *location = api()->glGetProgramResourceLocationFn( + GetProgramServiceID(program, resources_), program_interface, name); + return error::kNoError; +} + +error::Error GLES2DecoderPassthroughImpl::DoGetProgramResourceName( + GLuint program, + GLenum program_interface, + GLuint index, + std::string* name) { + CheckErrorCallbackState(); + + GLuint service_id = GetProgramServiceID(program, resources_); + GLint max_name_length = 0; + api()->glGetProgramInterfaceivFn(service_id, program_interface, + GL_MAX_NAME_LENGTH, &max_name_length); + if (CheckErrorCallbackState()) { + return error::kNoError; + } + + std::vector<GLchar> buffer(max_name_length, 0); + GLsizei length = 0; + api()->glGetProgramResourceNameFn(service_id, program_interface, index, + max_name_length, &length, buffer.data()); + DCHECK_LE(length, max_name_length); + *name = length > 0 ? std::string(buffer.data(), length) : std::string(); + return error::kNoError; +} + error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv( GLenum target, GLenum pname,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc index 7d7e982..07aafbdf 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc
@@ -483,6 +483,162 @@ return error::kNoError; } +error::Error GLES2DecoderPassthroughImpl::HandleGetProgramResourceiv( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + if (!feature_info_->IsWebGL2ComputeContext()) { + return error::kUnknownCommand; + } + const volatile gles2::cmds::GetProgramResourceiv& c = + *static_cast<const volatile gles2::cmds::GetProgramResourceiv*>(cmd_data); + GLuint program = static_cast<GLuint>(c.program); + GLenum program_interface = static_cast<GLenum>(c.program_interface); + GLuint index = static_cast<GLuint>(c.index); + uint32_t props_bucket_id = c.props_bucket_id; + uint32_t params_shm_id = c.params_shm_id; + uint32_t params_shm_offset = c.params_shm_offset; + + Bucket* bucket = GetBucket(props_bucket_id); + if (!bucket) { + return error::kInvalidArguments; + } + GLsizei prop_count = static_cast<GLsizei>(bucket->size() / sizeof(GLenum)); + const GLenum* props = bucket->GetDataAs<const GLenum*>(0, bucket->size()); + unsigned int buffer_size = 0; + typedef cmds::GetProgramResourceiv::Result Result; + Result* result = GetSharedMemoryAndSizeAs<Result*>( + params_shm_id, params_shm_offset, sizeof(Result), &buffer_size); + GLint* params = result ? result->GetData() : nullptr; + if (params == nullptr) { + return error::kOutOfBounds; + } + // Check that the client initialized the result. + if (result->size != 0) { + return error::kInvalidArguments; + } + GLsizei bufsize = Result::ComputeMaxResults(buffer_size); + GLsizei length = 0; + error::Error error = DoGetProgramResourceiv( + program, program_interface, index, prop_count, props, bufsize, &length, + params); + if (error != error::kNoError) { + return error; + } + if (length > bufsize) { + return error::kOutOfBounds; + } + result->SetNumResults(length); + return error::kNoError; +} + +error::Error GLES2DecoderPassthroughImpl::HandleGetProgramResourceIndex( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + if (!feature_info_->IsWebGL2ComputeContext()) { + return error::kUnknownCommand; + } + const volatile gles2::cmds::GetProgramResourceIndex& c = + *static_cast<const volatile gles2::cmds::GetProgramResourceIndex*>( + cmd_data); + GLuint program = static_cast<GLuint>(c.program); + GLenum program_interface = static_cast<GLenum>(c.program_interface); + uint32_t name_bucket_id = c.name_bucket_id; + uint32_t index_shm_id = c.index_shm_id; + uint32_t index_shm_offset = c.index_shm_offset; + + Bucket* bucket = GetBucket(name_bucket_id); + if (!bucket) { + return error::kInvalidArguments; + } + std::string name_str; + if (!bucket->GetAsString(&name_str)) { + return error::kInvalidArguments; + } + GLuint* index = GetSharedMemoryAs<GLuint*>( + index_shm_id, index_shm_offset, sizeof(GLuint)); + if (!index) { + return error::kOutOfBounds; + } + if (*index != GL_INVALID_INDEX) { + return error::kInvalidArguments; + } + return DoGetProgramResourceIndex( + program, program_interface, name_str.c_str(), index); +} + +error::Error GLES2DecoderPassthroughImpl::HandleGetProgramResourceLocation( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + if (!feature_info_->IsWebGL2ComputeContext()) { + return error::kUnknownCommand; + } + const volatile gles2::cmds::GetProgramResourceLocation& c = + *static_cast<const volatile gles2::cmds::GetProgramResourceLocation*>( + cmd_data); + GLuint program = static_cast<GLuint>(c.program); + GLenum program_interface = static_cast<GLenum>(c.program_interface); + uint32_t name_bucket_id = c.name_bucket_id; + uint32_t location_shm_id = c.location_shm_id; + uint32_t location_shm_offset = c.location_shm_offset; + + Bucket* bucket = GetBucket(name_bucket_id); + if (!bucket) { + return error::kInvalidArguments; + } + std::string name_str; + if (!bucket->GetAsString(&name_str)) { + return error::kInvalidArguments; + } + GLint* location = GetSharedMemoryAs<GLint*>( + location_shm_id, location_shm_offset, sizeof(GLint)); + if (!location) { + return error::kOutOfBounds; + } + if (*location != -1) { + return error::kInvalidArguments; + } + return DoGetProgramResourceLocation( + program, program_interface, name_str.c_str(), location); +} + +error::Error GLES2DecoderPassthroughImpl::HandleGetProgramResourceName( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + if (!feature_info_->IsWebGL2ComputeContext()) { + return error::kUnknownCommand; + } + const volatile gles2::cmds::GetProgramResourceName& c = + *static_cast<const volatile gles2::cmds::GetProgramResourceName*>( + cmd_data); + GLuint program = static_cast<GLuint>(c.program); + GLenum program_interface = static_cast<GLenum>(c.program_interface); + GLuint index = static_cast<GLuint>(c.index); + uint32_t name_bucket_id = c.name_bucket_id; + uint32_t result_shm_id = c.result_shm_id; + uint32_t result_shm_offset = c.result_shm_offset; + + typedef cmds::GetProgramResourceName::Result Result; + Result* result = GetSharedMemoryAs<Result*>( + result_shm_id, result_shm_offset, sizeof(*result)); + if (!result) { + return error::kOutOfBounds; + } + // Check that the client initialized the result. + if (*result != 0) { + return error::kInvalidArguments; + } + std::string name; + error::Error error = + DoGetProgramResourceName(program, program_interface, index, &name); + if (error != error::kNoError) { + return error; + } + *result = 1; + Bucket* bucket = CreateBucket(name_bucket_id); + bucket->SetFromString(name.c_str()); + return error::kNoError; +} + error::Error GLES2DecoderPassthroughImpl::HandleGetShaderInfoLog( uint32_t immediate_data_size, const volatile void* cmd_data) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers_autogen.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers_autogen.cc index 2339a57a..2c46446 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers_autogen.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers_autogen.cc
@@ -3995,6 +3995,40 @@ return error::kNoError; } +error::Error GLES2DecoderPassthroughImpl::HandleGetProgramInterfaceiv( + uint32_t immediate_data_size, + const volatile void* cmd_data) { + if (!feature_info_->IsWebGL2ComputeContext()) + return error::kUnknownCommand; + const volatile gles2::cmds::GetProgramInterfaceiv& c = + *static_cast<const volatile gles2::cmds::GetProgramInterfaceiv*>( + cmd_data); + GLuint program = c.program; + GLenum program_interface = static_cast<GLenum>(c.program_interface); + GLenum pname = static_cast<GLenum>(c.pname); + unsigned int buffer_size = 0; + typedef cmds::GetProgramInterfaceiv::Result Result; + Result* result = GetSharedMemoryAndSizeAs<Result*>( + c.params_shm_id, c.params_shm_offset, sizeof(Result), &buffer_size); + GLint* params = result ? result->GetData() : nullptr; + if (params == nullptr) { + return error::kOutOfBounds; + } + GLsizei bufsize = Result::ComputeMaxResults(buffer_size); + GLsizei written_values = 0; + GLsizei* length = &written_values; + error::Error error = DoGetProgramInterfaceiv(program, program_interface, + pname, bufsize, length, params); + if (error != error::kNoError) { + return error; + } + if (written_values > bufsize) { + return error::kOutOfBounds; + } + result->SetNumResults(written_values); + return error::kNoError; +} + error::Error GLES2DecoderPassthroughImpl::HandleMemoryBarrierEXT( uint32_t immediate_data_size, const volatile void* cmd_data) {
diff --git a/headless/test/headless_protocol_browsertest.cc b/headless/test/headless_protocol_browsertest.cc index fb5703b7..b2b7c63a9 100644 --- a/headless/test/headless_protocol_browsertest.cc +++ b/headless/test/headless_protocol_browsertest.cc
@@ -208,6 +208,8 @@ HEADLESS_PROTOCOL_TEST(VirtualTimeBasics, "emulation/virtual-time-basics.js") HEADLESS_PROTOCOL_TEST(VirtualTimeInterrupt, "emulation/virtual-time-interrupt.js") + +// Flaky on Linux. TODO(crbug.com/930717): Re-enable. #if defined(OS_LINUX) #define MAYBE_VirtualTimeCrossProcessNavigation \ DISABLED_VirtualTimeCrossProcessNavigation
diff --git a/ios/chrome/app/strings/ios_chromium_strings.grd b/ios/chrome/app/strings/ios_chromium_strings.grd index f566c62..aa6a2cd 100644 --- a/ios/chrome/app/strings/ios_chromium_strings.grd +++ b/ios/chrome/app/strings/ios_chromium_strings.grd
@@ -137,15 +137,6 @@ <message name="IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_TITLE" desc="Title of the screen where users select an account to use. [Length: 20em] [iOS only]"> Sign in to Chromium </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_BETTER_BROWSER" desc="Description on the sign-in consent dialog to explain the benefit to sign-in. [Length: unlimited] [iOS only]"> - Improve Chromium and its security by sending system and usage data to Google - </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS" desc="Description on the sign-in consent dialog to explain the benefit to sign-in. [Length: unlimited] [iOS only]"> - <ph name="BEGIN_LINK">BEGIN_LINK</ph>Settings<ph name="END_LINK">END_LINK</ph> can be customized anytime. Google may use content on sites you visit, browser interactions and activity to personalize Chromium and Google services like Translate, Search and ads. - </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE" desc="Title on the sign-in consent dialog to explain why sign-in can be useful for the user. [iOS only]"> - Get Google smarts in Chromium - </message> <message name="IDS_IOS_AUTOFILL_DESCRIBE_LOCAL_COPY" desc="Text label that describes a Wallet credit card which has been copied to the local Chromium instance. Title case. [Length: 20em] [iOS only]"> Copied to Chromium </message>
diff --git a/ios/chrome/app/strings/ios_google_chrome_strings.grd b/ios/chrome/app/strings/ios_google_chrome_strings.grd index 252d048..87b0410 100644 --- a/ios/chrome/app/strings/ios_google_chrome_strings.grd +++ b/ios/chrome/app/strings/ios_google_chrome_strings.grd
@@ -137,15 +137,6 @@ <message name="IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_TITLE" desc="Title of the screen where users select an account to use. [Length: 20em] [iOS only]"> Sign in to Chrome </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_BETTER_BROWSER" desc="Description on the sign-in consent dialog to explain the benefit to sign-in. [Length: unlimited] [iOS only]"> - Improve Chrome and its security by sending system and usage data to Google - </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS" desc="Description on the sign-in consent dialog to explain the benefit to sign-in. [Length: unlimited] [iOS only]"> - <ph name="BEGIN_LINK">BEGIN_LINK</ph>Settings<ph name="END_LINK">END_LINK</ph> can be customized anytime. Google may use content on sites you visit, browser interactions and activity to personalize Chrome and Google services like Translate, Search and ads. - </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE" desc="Title on the sign-in consent dialog to explain why sign-in can be useful for the user. [iOS only]"> - Get Google smarts in Chrome - </message> <message name="IDS_IOS_AUTOFILL_DESCRIBE_LOCAL_COPY" desc="Text label that describes a Wallet credit card which has been copied to the local Chrome instance. Title case. [Length: 20em] [iOS only]"> Copied to Chrome </message>
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 77b808b..2218537 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -186,18 +186,25 @@ <message name="IDS_IOS_ACCOUNT_IDENTITY_CHOOSER_CHOOSE_ACCOUNT" desc="Label at the top an account list. The user has to select one of the accounts to sign-in. [Length: 20em] [iOS only]"> Choose an Account </message> + <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE" desc="Title on the sync consent dialog to explain why sync can be useful for the user. [iOS only]"> + Turn on sync? + </message> + <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE" desc="Title of the sync description section on the sync consent dialog to explain why sync can be useful for the user. [iOS only]"> + Sync your passwords, history & more on all devices + </message> + <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE" desc="Subtitle of the sync description section on the sync consent dialog to explain why sync can be useful for the user. [iOS only]"> + Google may use your history to personalize Search, ads, and other Google services. + </message> + <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS" desc="Explination text on the sync consent dialog to explain the user they can customize sync settings. [iOS only]"> + You can <ph name="BEGIN_LINK">BEGIN_LINK</ph>customize these settings<ph name="END_LINK">END_LINK</ph> anytime + </message> <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_ADD_ACCOUNT" desc="Title of the button to add an account [Length: 15m] [iOS only]"> ADD ACCOUNT </message> <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_OK_BUTTON" desc="Title of the button to validate the user consent [Length: 15m] [iOS only]"> YES, I'M IN </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_PERSONALIZED" desc="Description on the sign-in consent dialog to explain the benefit to sign-in. [Length: unlimited] [iOS only]" translateable="false"> - More personal Google services, like better page suggestions - </message> - <message name="IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_DATA" desc="Description on the sign-in consent dialog to explain the benefit to sign-in. [Length: unlimited] [iOS only]" translateable="false"> - Your passwords, history & more on all devices - </message> + <message name="IDS_IOS_APPEX_PASSWORD_FORM_FILLED_SUCCESS" desc="Message displayed when an App Extension has successfully filled a sign-in form with username and password. [Length: 30em] [iOS only]"> Forms filled. </message>
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS.png.sha1 new file mode 100644 index 0000000..00cbd17 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS.png.sha1
@@ -0,0 +1 @@ +b63102438325c11e56bb2768e34e683ca6a0cfba \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE.png.sha1 new file mode 100644 index 0000000..00cbd17 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +b63102438325c11e56bb2768e34e683ca6a0cfba \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE.png.sha1 new file mode 100644 index 0000000..00cbd17 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE.png.sha1
@@ -0,0 +1 @@ +b63102438325c11e56bb2768e34e683ca6a0cfba \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE.png.sha1 new file mode 100644 index 0000000..00cbd17 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE.png.sha1
@@ -0,0 +1 @@ +b63102438325c11e56bb2768e34e683ca6a0cfba \ No newline at end of file
diff --git a/ios/chrome/browser/about_flags.mm b/ios/chrome/browser/about_flags.mm index dcf8088..23ceb76 100644 --- a/ios/chrome/browser/about_flags.mm +++ b/ios/chrome/browser/about_flags.mm
@@ -478,10 +478,6 @@ flag_descriptions::kSyncPseudoUSSHistoryDeleteDirectivesDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSHistoryDeleteDirectives)}, - {"sync-pseudo-uss-passwords", - flag_descriptions::kSyncPseudoUSSPasswordsName, - flag_descriptions::kSyncPseudoUSSPasswordsDescription, flags_ui::kOsIos, - FEATURE_VALUE_TYPE(switches::kSyncPseudoUSSPasswords)}, {"sync-pseudo-uss-preferences", flag_descriptions::kSyncPseudoUSSPreferencesName, flag_descriptions::kSyncPseudoUSSPreferencesDescription, flags_ui::kOsIos,
diff --git a/ios/chrome/browser/autofill/autocomplete_history_manager_factory.cc b/ios/chrome/browser/autofill/autocomplete_history_manager_factory.cc index 2b044cc..b327017 100644 --- a/ios/chrome/browser/autofill/autocomplete_history_manager_factory.cc +++ b/ios/chrome/browser/autofill/autocomplete_history_manager_factory.cc
@@ -16,7 +16,6 @@ #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/history/history_service_factory.h" -#include "ios/chrome/browser/signin/gaia_cookie_manager_service_factory.h" #include "ios/chrome/browser/signin/identity_manager_factory.h" #include "ios/chrome/browser/web_data_service_factory.h"
diff --git a/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm b/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm index 7a9ac73..db2e5bad 100644 --- a/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm +++ b/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm
@@ -39,14 +39,11 @@ #include "ios/chrome/browser/signin/account_consistency_service_factory.h" #include "ios/chrome/browser/signin/account_fetcher_service_factory.h" #include "ios/chrome/browser/signin/account_reconcilor_factory.h" -#include "ios/chrome/browser/signin/account_tracker_service_factory.h" #include "ios/chrome/browser/signin/authentication_service_factory.h" -#include "ios/chrome/browser/signin/gaia_cookie_manager_service_factory.h" -#include "ios/chrome/browser/signin/profile_oauth2_token_service_factory.h" +#include "ios/chrome/browser/signin/identity_manager_factory.h" #include "ios/chrome/browser/signin/signin_browser_state_info_updater_factory.h" #include "ios/chrome/browser/signin/signin_client_factory.h" #include "ios/chrome/browser/signin/signin_error_controller_factory.h" -#include "ios/chrome/browser/signin/signin_manager_factory.h" #import "ios/chrome/browser/snapshots/snapshot_cache_factory.h" #include "ios/chrome/browser/suggestions/suggestions_service_factory.h" #include "ios/chrome/browser/sync/consent_auditor_factory.h" @@ -84,19 +81,16 @@ ios::AccountConsistencyServiceFactory::GetInstance(); ios::AccountFetcherServiceFactory::GetInstance(); ios::AccountReconcilorFactory::GetInstance(); - ios::AccountTrackerServiceFactory::GetInstance(); ios::AutocompleteClassifierFactory::GetInstance(); ios::BookmarkModelFactory::GetInstance(); ios::BookmarkUndoServiceFactory::GetInstance(); ios::CookieSettingsFactory::GetInstance(); ios::FaviconServiceFactory::GetInstance(); - ios::GaiaCookieManagerServiceFactory::GetInstance(); ios::GoogleURLTrackerFactory::GetInstance(); ios::HistoryServiceFactory::GetInstance(); ios::InMemoryURLIndexFactory::GetInstance(); ios::ShortcutsBackendFactory::GetInstance(); ios::SigninErrorControllerFactory::GetInstance(); - ios::SigninManagerFactory::GetInstance(); ios::StartupTaskRunnerServiceFactory::GetInstance(); ios::TemplateURLServiceFactory::GetInstance(); ios::TopSitesFactory::GetInstance(); @@ -110,6 +104,7 @@ ConsentAuditorFactory::GetInstance(); FullscreenControllerFactory::GetInstance(); GoogleLogoServiceFactory::GetInstance(); + IdentityManagerFactory::EnsureFactoryAndDependeeFactoriesBuilt(); IOSChromeContentSuggestionsServiceFactory::GetInstance(); IOSChromeDeprecatedProfileInvalidationProviderFactory::GetInstance(); IOSChromeFaviconLoaderFactory::GetInstance(); @@ -121,7 +116,6 @@ IOSUserEventServiceFactory::GetInstance(); LanguageModelManagerFactory::GetInstance(); ModelTypeStoreServiceFactory::GetInstance(); - ProfileOAuth2TokenServiceFactory::GetInstance(); ProfileSyncServiceFactory::GetInstance(); ReadingListModelFactory::GetInstance(); SigninBrowserStateInfoUpdaterFactory::GetInstance();
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/ios_chrome_flag_descriptions.cc index 60baefb..ca26dcd8 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.cc
@@ -97,11 +97,6 @@ "Enable new USS-based codepath for sync datatype " "HISTORY_DELETE_DIRECTIVES."; -const char kSyncPseudoUSSPasswordsName[] = - "Enable pseudo-USS for PASSWORDS sync."; -const char kSyncPseudoUSSPasswordsDescription[] = - "Enable new USS-based codepath for sync datatype PASSWORDS (pseudo-USS)."; - const char kSyncPseudoUSSPreferencesName[] = "Enable pseudo-USS for PREFERENCES sync."; const char kSyncPseudoUSSPreferencesDescription[] =
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.h b/ios/chrome/browser/ios_chrome_flag_descriptions.h index 5c390c41..d532fc1 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.h
@@ -76,9 +76,6 @@ extern const char kSyncPseudoUSSHistoryDeleteDirectivesName[]; extern const char kSyncPseudoUSSHistoryDeleteDirectivesDescription[]; -extern const char kSyncPseudoUSSPasswordsName[]; -extern const char kSyncPseudoUSSPasswordsDescription[]; - extern const char kSyncPseudoUSSPreferencesName[]; extern const char kSyncPseudoUSSPreferencesDescription[];
diff --git a/ios/chrome/browser/signin/gaia_auth_fetcher_ios_unittest.mm b/ios/chrome/browser/signin/gaia_auth_fetcher_ios_unittest.mm index 75d692d..cdf9911b 100644 --- a/ios/chrome/browser/signin/gaia_auth_fetcher_ios_unittest.mm +++ b/ios/chrome/browser/signin/gaia_auth_fetcher_ios_unittest.mm
@@ -16,7 +16,6 @@ #import "ios/chrome/browser/signin/gaia_auth_fetcher_ios_wk_webview_bridge.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "net/url_request/test_url_fetcher_factory.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h" #include "testing/gmock/include/gmock/gmock.h" @@ -66,22 +65,18 @@ // Tests fixture for GaiaAuthFetcherIOS class GaiaAuthFetcherIOSTest : public PlatformTest { protected: - GaiaAuthFetcherIOSTest() - : test_shared_loader_factory_( - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &test_url_loader_factory_)) { + GaiaAuthFetcherIOSTest() { browser_state_ = TestChromeBrowserState::Builder().Build(); ActiveStateManager::FromBrowserState(browser_state())->SetActive(true); - gaia_auth_fetcher_.reset( - new GaiaAuthFetcherIOS(&consumer_, gaia::GaiaSource::kChrome, - test_shared_loader_factory_, browser_state())); + gaia_auth_fetcher_.reset(new GaiaAuthFetcherIOS( + &consumer_, gaia::GaiaSource::kChrome, + test_url_loader_factory_.GetSafeWeakWrapper(), browser_state())); gaia_auth_fetcher_->bridge_.reset(new FakeGaiaAuthFetcherIOSWKWebViewBridge( gaia_auth_fetcher_.get(), browser_state())); } ~GaiaAuthFetcherIOSTest() override { - test_shared_loader_factory_->Detach(); gaia_auth_fetcher_.reset(); ActiveStateManager::FromBrowserState(browser_state())->SetActive(false); } @@ -104,8 +99,6 @@ std::unique_ptr<ios::ChromeBrowserState> browser_state_; MockGaiaConsumer consumer_; network::TestURLLoaderFactory test_url_loader_factory_; - scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> - test_shared_loader_factory_; std::unique_ptr<GaiaAuthFetcherIOS> gaia_auth_fetcher_; };
diff --git a/ios/chrome/browser/signin/identity_manager_factory.cc b/ios/chrome/browser/signin/identity_manager_factory.cc index ce9696c..2b44640ab 100644 --- a/ios/chrome/browser/signin/identity_manager_factory.cc +++ b/ios/chrome/browser/signin/identity_manager_factory.cc
@@ -80,6 +80,15 @@ return instance.get(); } +// static +void IdentityManagerFactory::EnsureFactoryAndDependeeFactoriesBuilt() { + IdentityManagerFactory::GetInstance(); + ios::AccountTrackerServiceFactory::GetInstance(); + ios::GaiaCookieManagerServiceFactory::GetInstance(); + ProfileOAuth2TokenServiceFactory::GetInstance(); + ios::SigninManagerFactory::GetInstance(); +} + void IdentityManagerFactory::AddObserver( IdentityManagerFactoryObserver* observer) { observer_list_.AddObserver(observer);
diff --git a/ios/chrome/browser/signin/identity_manager_factory.h b/ios/chrome/browser/signin/identity_manager_factory.h index 2fc912c..1ee9767 100644 --- a/ios/chrome/browser/signin/identity_manager_factory.h +++ b/ios/chrome/browser/signin/identity_manager_factory.h
@@ -32,6 +32,10 @@ // Returns an instance of the IdentityManagerFactory singleton. static IdentityManagerFactory* GetInstance(); + // Ensures that IdentityManagerFactory and the factories on which it depends + // are built. + static void EnsureFactoryAndDependeeFactoriesBuilt(); + // Methods to register or remove observers of IdentityManager // creation/shutdown. void AddObserver(IdentityManagerFactoryObserver* observer);
diff --git a/ios/chrome/browser/ui/authentication/authentication_constants.h b/ios/chrome/browser/ui/authentication/authentication_constants.h index b2d4f041..f8bf85b 100644 --- a/ios/chrome/browser/ui/authentication/authentication_constants.h +++ b/ios/chrome/browser/ui/authentication/authentication_constants.h
@@ -9,7 +9,6 @@ // Header image sizes. extern const CGFloat kAuthenticationHeaderImageHeight; -extern const CGFloat kAuthenticationHeaderImageWidth; // Font sizes extern const UIFontTextStyle kAuthenticationTitleFontStyle;
diff --git a/ios/chrome/browser/ui/authentication/authentication_constants.mm b/ios/chrome/browser/ui/authentication/authentication_constants.mm index 4a17b73f..66397c61 100644 --- a/ios/chrome/browser/ui/authentication/authentication_constants.mm +++ b/ios/chrome/browser/ui/authentication/authentication_constants.mm
@@ -9,10 +9,9 @@ #endif const CGFloat kAuthenticationHeaderImageHeight = 88.; -const CGFloat kAuthenticationHeaderImageWidth = 360.; -const UIFontTextStyle kAuthenticationTitleFontStyle = UIFontTextStyleTitle2; -const UIFontTextStyle kAuthenticationTextFontStyle = UIFontTextStyleFootnote; +const UIFontTextStyle kAuthenticationTitleFontStyle = UIFontTextStyleTitle1; +const UIFontTextStyle kAuthenticationTextFontStyle = UIFontTextStyleSubheadline; const int kAuthenticationHeaderBackgroundColor = 0xf8f9fa; const CGFloat kAuthenticationHorizontalMargin = 16.;
diff --git a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm index 4591d9c..6dcc688 100644 --- a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm
@@ -301,7 +301,7 @@ UnifiedConsentServiceFactory::GetForBrowserState(_browserState); // |unifiedConsentService| may be null in unit tests. if (unifiedConsentService) - unifiedConsentService->EnableGoogleServices(); + unifiedConsentService->SetUrlKeyedAnonymizedDataCollectionEnabled(true); } SyncSetupServiceFactory::GetForBrowserState(_browserState)->CommitChanges(); [self acceptSignInAndShowAccountsSettings:_unifiedConsentCoordinator
diff --git a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller_unittest.mm b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller_unittest.mm index 5cdd161..18f0a367 100644 --- a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller_unittest.mm
@@ -246,9 +246,8 @@ if (unified_consent_enabled_) { return { IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE, - IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_DATA, - IDS_IOS_ACCOUNT_UNIFIED_CONSENT_PERSONALIZED, - IDS_IOS_ACCOUNT_UNIFIED_CONSENT_BETTER_BROWSER, + IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE, + IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE, IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS, }; }
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn b/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn index 8a2ed5a8..028423b 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn +++ b/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn
@@ -32,10 +32,6 @@ "unified_consent_view_controller_delegate.h", ] deps = [ - "resources:ic_assistant", - "resources:ic_google", - "resources:ic_settings", - "resources:ic_sync_complete", "resources:identity_picker_view_arrow_down", "resources:unified_consent_header", "//base",
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/BUILD.gn b/ios/chrome/browser/ui/authentication/unified_consent/resources/BUILD.gn index e13db170..c698277f 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/BUILD.gn +++ b/ios/chrome/browser/ui/authentication/unified_consent/resources/BUILD.gn
@@ -4,38 +4,6 @@ import("//build/config/ios/asset_catalog.gni") -imageset("ic_assistant") { - sources = [ - "ic_assistant.imageset/Contents.json", - "ic_assistant.imageset/ic_assistant@2x.png", - "ic_assistant.imageset/ic_assistant@3x.png", - ] -} - -imageset("ic_google") { - sources = [ - "ic_google.imageset/Contents.json", - "ic_google.imageset/ic_google@2x.png", - "ic_google.imageset/ic_google@3x.png", - ] -} - -imageset("ic_settings") { - sources = [ - "ic_settings.imageset/Contents.json", - "ic_settings.imageset/ic_settings@2x.png", - "ic_settings.imageset/ic_settings@3x.png", - ] -} - -imageset("ic_sync_complete") { - sources = [ - "ic_sync_complete.imageset/Contents.json", - "ic_sync_complete.imageset/ic_sync_complete@2x.png", - "ic_sync_complete.imageset/ic_sync_complete@3x.png", - ] -} - imageset("identity_picker_view_arrow_down") { sources = [ "identity_picker_view_arrow_down.imageset/Contents.json",
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/Contents.json b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/Contents.json deleted file mode 100644 index d46a3174..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/Contents.json +++ /dev/null
@@ -1,22 +0,0 @@ -{ - "images": [ - { - "idiom": "universal", - "scale": "1x" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "ic_assistant@2x.png" - }, - { - "idiom": "universal", - "scale": "3x", - "filename": "ic_assistant@3x.png" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -}
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/ic_assistant@2x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/ic_assistant@2x.png deleted file mode 100644 index 1e003ca..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/ic_assistant@2x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/ic_assistant@3x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/ic_assistant@3x.png deleted file mode 100644 index 15f74f5..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_assistant.imageset/ic_assistant@3x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/Contents.json b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/Contents.json deleted file mode 100644 index 55b57a6..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/Contents.json +++ /dev/null
@@ -1,22 +0,0 @@ -{ - "images": [ - { - "idiom": "universal", - "scale": "1x" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "ic_google@2x.png" - }, - { - "idiom": "universal", - "scale": "3x", - "filename": "ic_google@3x.png" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -}
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/ic_google@2x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/ic_google@2x.png deleted file mode 100644 index 3634aa48..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/ic_google@2x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/ic_google@3x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/ic_google@3x.png deleted file mode 100644 index 6afc3056..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_google.imageset/ic_google@3x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/Contents.json b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/Contents.json deleted file mode 100644 index f7851e6..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/Contents.json +++ /dev/null
@@ -1,22 +0,0 @@ -{ - "images": [ - { - "idiom": "universal", - "scale": "1x" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "ic_settings@2x.png" - }, - { - "idiom": "universal", - "scale": "3x", - "filename": "ic_settings@3x.png" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -}
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/ic_settings@2x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/ic_settings@2x.png deleted file mode 100644 index 34e86b2..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/ic_settings@2x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/ic_settings@3x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/ic_settings@3x.png deleted file mode 100644 index 070b716..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_settings.imageset/ic_settings@3x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/Contents.json b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/Contents.json deleted file mode 100644 index 726deb8..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/Contents.json +++ /dev/null
@@ -1,22 +0,0 @@ -{ - "images": [ - { - "idiom": "universal", - "scale": "1x" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "ic_sync_complete@2x.png" - }, - { - "idiom": "universal", - "scale": "3x", - "filename": "ic_sync_complete@3x.png" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -}
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/ic_sync_complete@2x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/ic_sync_complete@2x.png deleted file mode 100644 index 52d4fe50..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/ic_sync_complete@2x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/ic_sync_complete@3x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/ic_sync_complete@3x.png deleted file mode 100644 index 1b2a458..0000000 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/ic_sync_complete.imageset/ic_sync_complete@3x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm index 3554a8f..e13d5b4 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm
@@ -29,17 +29,8 @@ namespace { -// Sizes. -// Size of the small icons next to the text. -const CGFloat kIconSize = 16.; - -// Horizontal margin between the small icon and the text next to it. -const CGFloat kIconTextMargin = 16.; -// Horizontal margin on the left part of the separator. -const CGFloat kLeftSeparatorMargin = - kAuthenticationHorizontalMargin + kIconSize + kIconTextMargin; // Vertical margin the main title and the identity picker. -const CGFloat KTitlePickerMargin = 17.; +const CGFloat kTitlePickerMargin = 16.; // Vertical margin above the first text and after the last text. const CGFloat kVerticalTextMargin = 22.; // Vertical margin between texts. @@ -49,16 +40,6 @@ // URL for the Settings link. const char* const kSettingsSyncURL = "internal://settings-sync"; - -// Assistant icon name. -NSString* const kAssistantIconName = @"ic_assistant"; -// Google icon name. -NSString* const kGoogleIconName = @"ic_google"; -// Settings icon name. -NSString* const kSettingsIconName = @"ic_settings"; -// Sync complete icon name. -NSString* const kSyncCompleteIconName = @"ic_sync_complete"; - } // namespace @interface UnifiedConsentViewController ()<UIScrollViewDelegate> { @@ -175,19 +156,16 @@ UIImageView* headerImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; headerImageView.translatesAutoresizingMaskIntoConstraints = NO; headerImageView.image = [UIImage imageNamed:kAuthenticationHeaderImageName]; + headerImageView.contentMode = UIViewContentModeScaleAspectFit; [container addSubview:headerImageView]; // Title. - UILabel* title = [[UILabel alloc] initWithFrame:CGRectZero]; - title.translatesAutoresizingMaskIntoConstraints = NO; - title.text = l10n_util::GetNSString(IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE); - _consentStringIds.push_back(IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE); - title.textColor = - [UIColor colorWithWhite:0 alpha:kAuthenticationTitleColorAlpha]; - title.font = [UIFont preferredFontForTextStyle:kAuthenticationTitleFontStyle]; - title.numberOfLines = 0; + UILabel* title = + [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE + fontStyle:kAuthenticationTitleFontStyle + textColorAlpha:kAuthenticationTitleColorAlpha + parentView:container]; - [container addSubview:title]; // Identity picker view. self.identityPickerView = [[IdentityPickerView alloc] initWithFrame:CGRectZero]; @@ -197,36 +175,33 @@ forControlEvents:UIControlEventTouchUpInside]; [container addSubview:self.identityPickerView]; - // Sync bookmark label. - UILabel* syncBookmarkLabel = - [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_DATA - withIconName:kSyncCompleteIconName - iconVerticallyCentered:YES + // Sync title and subtitle. + UILabel* syncTitleLabel = + [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE + fontStyle:kAuthenticationTextFontStyle + textColorAlpha:kAuthenticationTitleColorAlpha parentView:container]; - // Get more personalized label. - UILabel* morePersonalizedLabel = - [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_PERSONALIZED - withIconName:kAssistantIconName - iconVerticallyCentered:YES + + UILabel* syncSubtitleLabel = + [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE + fontStyle:kAuthenticationTextFontStyle + textColorAlpha:kAuthenticationTextColorAlpha parentView:container]; - // Powerful Google label. - UILabel* powerfulGoogleLabel = - [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_BETTER_BROWSER - withIconName:kGoogleIconName - iconVerticallyCentered:YES - parentView:container]; + // Separator. UIView* separator = [[UIView alloc] initWithFrame:CGRectZero]; separator.translatesAutoresizingMaskIntoConstraints = NO; separator.backgroundColor = [UIColor colorWithWhite:0 alpha:kAuthenticationSeparatorColorAlpha]; [container addSubview:separator]; + // Customize label. self.openSettingsStringId = IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SETTINGS; - self.customizeSyncLabel = [self addLabelWithStringId:self.openSettingsStringId - withIconName:kSettingsIconName - iconVerticallyCentered:NO - parentView:container]; + self.customizeSyncLabel = + [self addLabelWithStringId:self.openSettingsStringId + fontStyle:kAuthenticationTextFontStyle + textColorAlpha:kAuthenticationTextColorAlpha + parentView:container]; // Layouts NSDictionary* views = @{ @@ -236,21 +211,18 @@ @"container" : container, @"scrollview" : self.scrollView, @"separator" : separator, - @"synctext" : syncBookmarkLabel, - @"personalizedtext" : morePersonalizedLabel, - @"powerfultext" : powerfulGoogleLabel, - @"customizesynctext" : self.customizeSyncLabel, + @"synctitle" : syncTitleLabel, + @"syncsubtitle" : syncSubtitleLabel, + @"customizesync" : self.customizeSyncLabel, }; NSDictionary* metrics = @{ - @"TitlePickerMargin" : @(KTitlePickerMargin), + @"TitlePickerMargin" : @(kTitlePickerMargin), @"HMargin" : @(kAuthenticationHorizontalMargin), @"VBetweenText" : @(kVerticalBetweenTextMargin), @"VSeparatorText" : @(kVerticalSeparatorTextMargin), - @"LeftSeparMrg" : @(kLeftSeparatorMargin), @"VTextMargin" : @(kVerticalTextMargin), @"SeparatorHeight" : @(kAuthenticationSeparatorHeight), @"HeaderHeight" : @(kAuthenticationHeaderImageHeight), - @"HeaderWidth" : @(kAuthenticationHeaderImageWidth), @"HeaderTitleMargin" : @(kAuthenticationHeaderTitleMargin), }; NSArray* constraints = @[ @@ -259,17 +231,17 @@ @"H:|[container]|", @"H:|-(HMargin)-[title]-(HMargin)-|", @"H:|-(HMargin)-[picker]-(HMargin)-|", - @"H:|-(LeftSeparMrg)-[separator]-(HMargin)-|", + @"H:|-(HMargin)-[separator]-(HMargin)-|", + @"H:|-(HMargin)-[synctitle]-(HMargin)-|", + @"H:|-(HMargin)-[syncsubtitle]-(HMargin)-|", + @"H:|-(HMargin)-[customizesync]-(HMargin)-|", // Vertical constraints. @"V:|[scrollview]|", @"V:|[container]|", @"V:|[header]-(HeaderTitleMargin)-[title]-(TitlePickerMargin)-[picker]", - @"V:[synctext]-(VBetweenText)-[personalizedtext]", - @"V:[personalizedtext]-(VBetweenText)-[powerfultext]", - @"V:[powerfultext]-(VTextMargin)-[separator]", - @"V:[separator]-(VSeparatorText)-[customizesynctext]-(VTextMargin)-|", + @"V:[synctitle]-[syncsubtitle]-(VBetweenText)-[separator]", + @"V:[separator]-(VSeparatorText)-[customizesync]-(VTextMargin)-|", // Size constraints. - @"H:[header(HeaderWidth)]", @"V:[header(HeaderHeight)]", @"V:[separator(SeparatorHeight)]", ]; @@ -280,9 +252,9 @@ .active = YES; // Adding constraints with or without identity. self.noIdentityConstraint = - [syncBookmarkLabel.topAnchor constraintEqualToAnchor:title.bottomAnchor - constant:kVerticalTextMargin]; - self.withIdentityConstraint = [syncBookmarkLabel.topAnchor + [syncTitleLabel.topAnchor constraintEqualToAnchor:title.bottomAnchor + constant:kVerticalTextMargin]; + self.withIdentityConstraint = [syncTitleLabel.topAnchor constraintEqualToAnchor:self.identityPickerView.bottomAnchor constant:kVerticalTextMargin]; // Adding constraints for the container. @@ -360,56 +332,21 @@ #pragma mark - Private -// Adds an icon and a label, into |parentView|, next to each other with the -// constraints between the icon and the label. -// If |iconVerticallyCentered| is true, the |icon| is vertically centered with -// the label. Otherwise, it the |icon| is vertically aligned with the first line -// of the label. +// Adds label with title |stringId| into |parentView|. - (UILabel*)addLabelWithStringId:(int)stringId - withIconName:(NSString*)iconName - iconVerticallyCentered:(BOOL)iconVerticallyCentered + fontStyle:(UIFontTextStyle)fontStyle + textColorAlpha:(CGFloat)textColorAlpha parentView:(UIView*)parentView { DCHECK(stringId); - DCHECK(iconName); DCHECK(parentView); UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; label.translatesAutoresizingMaskIntoConstraints = NO; - label.font = [UIFont preferredFontForTextStyle:kAuthenticationTextFontStyle]; + label.font = [UIFont preferredFontForTextStyle:fontStyle]; + label.textColor = [UIColor colorWithWhite:0 alpha:textColorAlpha]; label.text = l10n_util::GetNSString(stringId); _consentStringIds.push_back(stringId); - label.textColor = - [UIColor colorWithWhite:0 alpha:kAuthenticationTextColorAlpha]; label.numberOfLines = 0; [parentView addSubview:label]; - UIImageView* image = [[UIImageView alloc] initWithFrame:CGRectZero]; - image.image = [UIImage imageNamed:iconName]; - image.translatesAutoresizingMaskIntoConstraints = NO; - [parentView addSubview:image]; - NSDictionary* views = NSDictionaryOfVariableBindings(label, image); - NSArray* constraints = @[ - @"H:|-(HMargin)-[image]-(IconTextMargin)-[label]-(HMargin)-|", - @"H:[image(IconSize)]", - @"V:[image(IconSize)]", - ]; - NSDictionary* metrics = @{ - @"HMargin" : @(kAuthenticationHorizontalMargin), - @"IconSize" : @(kIconSize), - @"IconTextMargin" : @(kIconTextMargin), - }; - ApplyVisualConstraintsWithMetrics(constraints, views, metrics); - if (iconVerticallyCentered) { - AddSameCenterYConstraint(label, image); - } else { - // |icon| should be aligned to first line of |label|. This has to be done - // according to the middle of the cap height of the font. - // The cap height position is based on the ascender. - UIFont* font = label.font; - [image.centerYAnchor - constraintEqualToAnchor:label.topAnchor - constant:font.ascender - font.capHeight + - font.capHeight / 2.] - .active = YES; - } return label; }
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h index efdf3870..bbac1e29 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h
@@ -21,7 +21,6 @@ namespace ios { class ChromeBrowserState; } // namespace ios -@protocol UrlLoader; class WebStateList; @protocol BookmarkHomeViewControllerDelegate @@ -50,10 +49,9 @@ @property(nonatomic, weak) id<BookmarkHomeViewControllerDelegate> homeDelegate; // Initializers. -- (instancetype)initWithLoader:(id<UrlLoader>)loader - browserState:(ios::ChromeBrowserState*)browserState - dispatcher:(id<ApplicationCommands>)dispatcher - webStateList:(WebStateList*)webStateList +- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState + dispatcher:(id<ApplicationCommands>)dispatcher + webStateList:(WebStateList*)webStateList NS_DESIGNATED_INITIALIZER; - (instancetype)initWithTableViewStyle:(UITableViewStyle)tableViewStyle appBarStyle:
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm index 6979ea6..6096562 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
@@ -37,6 +37,7 @@ #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_home_node_item.h" #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_table_cell_title_edit_delegate.h" #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_table_signin_promo_cell.h" +#import "ios/chrome/browser/ui/chrome_load_params.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h" #import "ios/chrome/browser/ui/material_components/utils.h" @@ -44,10 +45,11 @@ #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #import "ios/chrome/browser/ui/table_view/table_view_model.h" #import "ios/chrome/browser/ui/table_view/table_view_navigation_controller_constants.h" -#import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/util/rtl_geometry.h" #import "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #import "ios/chrome/common/favicon/favicon_attributes.h" #import "ios/chrome/common/favicon/favicon_view.h" #import "ios/chrome/common/ui_util/constraints_ui_util.h" @@ -138,9 +140,6 @@ // bookmarks. @property(nonatomic, strong) BookmarkFolderViewController* folderSelector; -// Object to load URLs. -@property(nonatomic, weak) id<UrlLoader> loader; - // FaviconLoader is a keyed service that uses LargeIconService to retrieve // favicon images. @property(nonatomic, assign) FaviconLoader* faviconLoader; @@ -202,16 +201,14 @@ #pragma mark - Initializer -- (instancetype)initWithLoader:(id<UrlLoader>)loader - browserState:(ios::ChromeBrowserState*)browserState - dispatcher:(id<ApplicationCommands>)dispatcher - webStateList:(WebStateList*)webStateList { +- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState + dispatcher:(id<ApplicationCommands>)dispatcher + webStateList:(WebStateList*)webStateList { DCHECK(browserState); self = [super initWithTableViewStyle:UITableViewStylePlain appBarStyle:ChromeTableViewControllerStyleNoAppBar]; if (self) { _browserState = browserState->GetOriginalChromeBrowserState(); - _loader = loader; _dispatcher = dispatcher; _webStateList = webStateList; @@ -644,7 +641,6 @@ if (!self.bookmarkInteractionController) { self.bookmarkInteractionController = [[BookmarkInteractionController alloc] initWithBrowserState:self.browserState - loader:self.loader parentController:self dispatcher:self.dispatcher webStateList:self.webStateList]; @@ -1033,7 +1029,7 @@ } // Saves the current position and asks the delegate to open the url, if delegate -// is set, otherwise opens the URL using loader. +// is set, otherwise opens the URL using URL loading service. - (void)dismissWithURL:(const GURL&)url { [self cacheIndexPathRow]; if (self.homeDelegate) { @@ -1063,7 +1059,8 @@ web::NavigationManager::WebLoadParams params(url); params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK; ChromeLoadParams chromeParams(params); - [self.loader loadURLWithParams:chromeParams]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->LoadUrlInCurrentTab(chromeParams); } - (void)addNewFolder { @@ -1107,11 +1104,10 @@ - (BookmarkHomeViewController*)createControllerWithRootFolder: (const bookmarks::BookmarkNode*)folder { - BookmarkHomeViewController* controller = - [[BookmarkHomeViewController alloc] initWithLoader:_loader - browserState:self.browserState - dispatcher:self.dispatcher - webStateList:self.webStateList]; + BookmarkHomeViewController* controller = [[BookmarkHomeViewController alloc] + initWithBrowserState:self.browserState + dispatcher:self.dispatcher + webStateList:self.webStateList]; [controller setRootNode:folder]; controller.homeDelegate = self.homeDelegate; return controller;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller_unittest.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller_unittest.mm index b2ed35b..91bd98b 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller_unittest.mm
@@ -21,10 +21,9 @@ TableViewPopulatedAfterBookmarkModelLoaded) { @autoreleasepool { BookmarkHomeViewController* controller = [[BookmarkHomeViewController alloc] - initWithLoader:nil - browserState:chrome_browser_state_.get() - dispatcher:nil - webStateList:nullptr]; + initWithBrowserState:chrome_browser_state_.get() + dispatcher:nil + webStateList:nullptr]; [controller setRootNode:_bookmarkModel->mobile_node()]; // Two sections: Messages and Bookmarks.
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h index 4d76096..945da25 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h
@@ -9,7 +9,6 @@ @protocol ApplicationCommands; @protocol BookmarkInteractionControllerDelegate; @class Tab; -@protocol UrlLoader; namespace bookmarks { class BookmarkNode; @@ -29,7 +28,6 @@ @property(nonatomic, weak) id<BookmarkInteractionControllerDelegate> delegate; - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState - loader:(id<UrlLoader>)loader parentController:(UIViewController*)parentController dispatcher:(id<ApplicationCommands>)dispatcher webStateList:(WebStateList*)webStateList
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm index 9d79d5c..13e5dc24 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.mm
@@ -34,8 +34,9 @@ #import "ios/chrome/browser/ui/table_view/table_view_navigation_controller_delegate.h" #import "ios/chrome/browser/ui/table_view/table_view_presentation_controller.h" #import "ios/chrome/browser/ui/table_view/table_view_presentation_controller_delegate.h" -#include "ios/chrome/browser/ui/url_loader.h" #include "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #import "ios/chrome/browser/url_loading/url_loading_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/chrome/grit/ios_strings.h" @@ -75,9 +76,6 @@ // it is incognito. ios::ChromeBrowserState* _browserState; // weak - // The designated url loader. - __weak id<UrlLoader> _loader; - // The parent controller on top of which the UI needs to be presented. __weak UIViewController* _parentController; @@ -155,7 +153,6 @@ @synthesize mediator = _mediator; - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState - loader:(id<UrlLoader>)loader parentController:(UIViewController*)parentController dispatcher:(id<ApplicationCommands>)dispatcher webStateList:(WebStateList*)webStateList { @@ -165,7 +162,6 @@ // incognito mode. _currentBrowserState = browserState; _browserState = browserState->GetOriginalChromeBrowserState(); - _loader = loader; _parentController = parentController; _dispatcher = dispatcher; _webStateList = webStateList; @@ -223,11 +219,10 @@ DCHECK_EQ(PresentedState::NONE, self.currentPresentedState); DCHECK(!self.bookmarkNavigationController); - self.bookmarkBrowser = - [[BookmarkHomeViewController alloc] initWithLoader:_loader - browserState:_currentBrowserState - dispatcher:self.dispatcher - webStateList:_webStateList]; + self.bookmarkBrowser = [[BookmarkHomeViewController alloc] + initWithBrowserState:_currentBrowserState + dispatcher:self.dispatcher + webStateList:_webStateList]; self.bookmarkBrowser.homeDelegate = self; NSArray<BookmarkHomeViewController*>* replacementViewControllers = nil; @@ -546,7 +541,8 @@ web::NavigationManager::WebLoadParams params(url); params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK; ChromeLoadParams chromeParams(params); - [_loader loadURLWithParams:chromeParams]; + UrlLoadingServiceFactory::GetForBrowserState(_currentBrowserState) + ->LoadUrlInCurrentTab(chromeParams); } - (void)openURLInNewTab:(const GURL&)url @@ -560,7 +556,8 @@ inIncognito:inIncognito inBackground:inBackground appendTo:kLastTab]; - [_loader webPageOrderedOpen:command]; + UrlLoadingServiceFactory::GetForBrowserState(_currentBrowserState) + ->OpenUrlInNewTab(command); } @end
diff --git a/ios/chrome/browser/ui/browser_view_controller+private.h b/ios/chrome/browser/ui/browser_view_controller+private.h index b4e696a2..f556386 100644 --- a/ios/chrome/browser/ui/browser_view_controller+private.h +++ b/ios/chrome/browser/ui/browser_view_controller+private.h
@@ -24,9 +24,10 @@ - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion dismissOmnibox:(BOOL)dismissOmnibox; -// Switch to the tab best represented by the given |params|. -- (void)switchToTabWithParams: - (const web::NavigationManager::WebLoadParams&)params; +// Does an animation from |originPoint| when opening a background tab, then +// calls |completion|. +- (void)animateOpenBackgroundTabFromOriginPoint:(CGPoint)originPoint + completion:(void (^)())completion; // Called before the instance is deallocated. - (void)shutdown;
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 4597fb83..b3c00721 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -250,6 +250,11 @@ } } +bool IsHelpURL(GURL& URL) { + GURL helpUrl(l10n_util::GetStringUTF16(IDS_IOS_TOOLS_MENU_HELP_URL)); + return helpUrl == URL; +} + // Histogram that tracks user actions related to the WKWebView 3D touch link // preview API. These values are persisted to logs. Entries should not be // renumbered and numeric values should never be reused. @@ -1356,6 +1361,33 @@ } } +- (void)animateOpenBackgroundTabFromOriginPoint:(CGPoint)originPoint + completion:(void (^)())completion { + if ([self canShowTabStrip] || CGPointEqualToPoint(originPoint, CGPointZero)) { + completion(); + } else { + self.inNewTabAnimation = YES; + // Exit fullscreen if needed. + FullscreenControllerFactory::GetInstance() + ->GetForBrowserState(_browserState) + ->ExitFullscreen(); + const CGFloat kAnimatedViewSize = 50; + BackgroundTabAnimationView* animatedView = + [[BackgroundTabAnimationView alloc] + initWithFrame:CGRectMake(0, 0, kAnimatedViewSize, + kAnimatedViewSize)]; + __weak UIView* weakAnimatedView = animatedView; + auto completionBlock = ^() { + self.inNewTabAnimation = NO; + [weakAnimatedView removeFromSuperview]; + completion(); + }; + [self.view addSubview:animatedView]; + [animatedView animateFrom:originPoint + toTabGridButtonWithCompletion:completionBlock]; + } +} + - (void)shutdown { DCHECK(!_isShutdown); _isShutdown = YES; @@ -1927,7 +1959,6 @@ [[PrimaryToolbarCoordinator alloc] initWithBrowserState:_browserState]; self.primaryToolbarCoordinator = topToolbarCoordinator; topToolbarCoordinator.delegate = self; - topToolbarCoordinator.URLLoader = self; topToolbarCoordinator.webStateList = self.tabModel.webStateList; topToolbarCoordinator.dispatcher = self.dispatcher; topToolbarCoordinator.commandDispatcher = self.commandDispatcher; @@ -2403,7 +2434,6 @@ return; _bookmarkInteractionController = [[BookmarkInteractionController alloc] initWithBrowserState:_browserState - loader:self parentController:self dispatcher:self.dispatcher webStateList:self.tabModel.webStateList]; @@ -3148,10 +3178,10 @@ referrer:referrer inIncognito:strongSelf.isOffTheRecord inBackground:YES - appendTo:kCurrentTab]; command.originPoint = originPoint; - [strongSelf webPageOrderedOpen:command]; + UrlLoadingServiceFactory::GetForBrowserState(strongSelf.browserState) + ->OpenUrlInNewTab(command); }; [_contextMenuCoordinator addItemWithTitle:title action:action]; if (!_isOffTheRecord) { @@ -3159,6 +3189,10 @@ title = l10n_util::GetNSStringWithFixup( IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); action = ^{ + BrowserViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + Record(ACTION_OPEN_IN_INCOGNITO_TAB, isImage, isLink); OpenNewTabCommand* command = @@ -3166,9 +3200,9 @@ referrer:referrer inIncognito:YES inBackground:NO - appendTo:kCurrentTab]; - [weakSelf webPageOrderedOpen:command]; + UrlLoadingServiceFactory::GetForBrowserState(strongSelf.browserState) + ->OpenUrlInNewTab(command); }; [_contextMenuCoordinator addItemWithTitle:title action:action]; } @@ -3219,9 +3253,14 @@ // Open Image. title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_OPENIMAGE); action = ^{ + BrowserViewController* strongSelf = weakSelf; + if (!strongSelf) + return; + Record(ACTION_OPEN_IMAGE, isImage, isLink); ChromeLoadParams params(imageUrl); - [weakSelf loadURLWithParams:params]; + UrlLoadingServiceFactory::GetForBrowserState(strongSelf.browserState) + ->LoadUrlInCurrentTab(params); }; [_contextMenuCoordinator addItemWithTitle:title action:action]; // Open Image In New Tab. @@ -3241,7 +3280,8 @@ appendTo:kCurrentTab]; command.originPoint = originPoint; - [strongSelf openNewTabInCurrentMode:command]; + UrlLoadingServiceFactory::GetForBrowserState(strongSelf.browserState) + ->OpenUrlInNewTab(command); }; [_contextMenuCoordinator addItemWithTitle:title action:action]; @@ -3366,7 +3406,8 @@ atIndex:self.tabModel.count inBackground:NO]; } else { - [self loadURLWithParams:ChromeLoadParams(loadParams)]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->LoadUrlInCurrentTab(ChromeLoadParams(loadParams)); } } @@ -3394,9 +3435,9 @@ - (void)tabDidOpenURL:(GURL)URL transitionType:(ui::PageTransition)transitionType { // Deactivate the NTP immediately on a load to hide the NTP quickly, but - // after calling -LoadURLWithParams. Otherwise, if the webState has never - // been visible (such as during startup with an NTP), it's possible the - // webView can trigger a unnecessary load for chrome://newtab. + // after calling UrlLoadingService::LoadUrlInCurrentTab. Otherwise, if the + // webState has never been visible (such as during startup with an NTP), it's + // possible the webView can trigger a unnecessary load for chrome://newtab. if (URL.GetOrigin() != kChromeUINewTabURL) { WebStateList* webStateList = self.tabModel.webStateList; web::WebState* current_web_state = webStateList->GetActiveWebState(); @@ -3409,6 +3450,64 @@ } } +- (void)newTabWillOpenURL:(GURL)URL inIncognito:(BOOL)inIncognito { + if (!IsHelpURL(URL)) { + // Send either the "New Tab Opened" or "New Incognito Tab" opened to the + // feature_engagement::Tracker based on |inIncognito|. + feature_engagement::NotifyNewTabEvent(_browserState, inIncognito); + } +} + +- (void)willSwitchToTabWithURL:(GURL)URL + newWebStateIndex:(NSInteger)newWebStateIndex { + if ([self canShowTabStrip]) + return; + + WebStateList* webStateList = self.tabModel.webStateList; + web::WebState* webStateBeingActivated = + webStateList->GetWebStateAt(newWebStateIndex); + + // Add animations only if the tab strip isn't shown. + UIView* snapshotView = [self.view snapshotViewAfterScreenUpdates:NO]; + + // TODO(crbug.com/904992): Do not repurpose SnapshotGeneratorDelegate. + SwipeView* swipeView = [[SwipeView alloc] + initWithFrame:self.contentArea.frame + topMargin:[self snapshotGenerator:nil + snapshotEdgeInsetsForWebState:webStateBeingActivated] + .top]; + + [swipeView setTopToolbarImage:[self.primaryToolbarCoordinator + toolbarSideSwipeSnapshotForWebState: + webStateBeingActivated]]; + [swipeView setBottomToolbarImage:[self.secondaryToolbarCoordinator + toolbarSideSwipeSnapshotForWebState: + webStateBeingActivated]]; + + SnapshotTabHelper::FromWebState(webStateBeingActivated) + ->RetrieveColorSnapshot(^(UIImage* image) { + if (PagePlaceholderTabHelper::FromWebState(webStateBeingActivated) + ->will_add_placeholder_for_next_navigation()) { + [swipeView setImage:nil]; + } else { + [swipeView setImage:image]; + } + }); + + SwitchToTabAnimationView* animationView = + [[SwitchToTabAnimationView alloc] initWithFrame:self.view.bounds]; + + [self.view addSubview:animationView]; + + SwitchToTabAnimationPosition position = + newWebStateIndex > webStateList->active_index() + ? SwitchToTabAnimationPositionAfter + : SwitchToTabAnimationPositionBefore; + [animationView animateFromCurrentView:snapshotView + toNewView:swipeView + inPosition:position]; +} + #pragma mark - CRWWebStateObserver methods. // TODO(crbug.com/918934): This call to closeFindInPage incorrectly triggers for @@ -3526,7 +3625,6 @@ NewTabPageController* pageController = [[NewTabPageController alloc] initWithUrl:url - loader:self focuser:self.dispatcher browserState:_browserState toolbarDelegate:self.toolbarInterface @@ -3539,10 +3637,9 @@ } else if (url_host == kChromeUIOfflineHost && [self hasControllerForURL:url]) { StaticHtmlNativeContent* staticNativeController = - [[OfflinePageNativeContent alloc] initWithLoader:self - browserState:_browserState - webState:webState - URL:url]; + [[OfflinePageNativeContent alloc] initWithBrowserState:_browserState + webState:webState + URL:url]; [self setOverScrollActionControllerToStaticNativeContent: staticNativeController]; nativeController = staticNativeController; @@ -3945,155 +4042,11 @@ } - (void)webPageOrderedOpen:(OpenNewTabCommand*)command { - // TODO(crbug.com/907527): move to UrlLoadingService::OpenUrlInNewTab. - - // Send either the "New Tab Opened" or "New Incognito Tab" opened to the - // feature_engagement::Tracker based on |inIncognito|. - feature_engagement::NotifyNewTabEvent(self.tabModel.browserState, - command.inIncognito); - - if (command.inIncognito == _isOffTheRecord) { - [self openNewTabInCurrentMode:command]; - return; - } - // When sending an open command that switches modes, ensure the tab - // ends up appended to the end of the model, not just next to what is - // currently selected in the other mode. This is done with the |append| - // parameter. - command.appendTo = kLastTab; - [self.dispatcher openURLInNewTab:command]; -} - -#pragma mark - UrlLoader helpers - -// Opens a new tab in the current mode, following |command| parameters. The -// |inIncognito| parameter is not taken into account. -- (void)openNewTabInCurrentMode:(OpenNewTabCommand*)command { - Tab* adjacentTab = nil; - if (command.appendTo == kCurrentTab) - adjacentTab = self.tabModel.currentTab; - - GURL capturedURL = command.URL; - web::Referrer capturedReferrer = command.referrer; - auto openTab = ^{ - [self.tabModel insertTabWithURL:capturedURL - referrer:capturedReferrer - transition:ui::PAGE_TRANSITION_LINK - opener:adjacentTab - openedByDOM:NO - atIndex:TabModelConstants::kTabPositionAutomatically - inBackground:command.inBackground]; - }; - - if (!command.inBackground || [self canShowTabStrip] || - CGPointEqualToPoint(command.originPoint, CGPointZero)) { - openTab(); - } else { - self.inNewTabAnimation = YES; - // Exit fullscreen if needed. - FullscreenControllerFactory::GetInstance() - ->GetForBrowserState(_browserState) - ->ExitFullscreen(); - const CGFloat kAnimatedViewSize = 50; - BackgroundTabAnimationView* animatedView = - [[BackgroundTabAnimationView alloc] - initWithFrame:CGRectMake(0, 0, kAnimatedViewSize, - kAnimatedViewSize)]; - __weak UIView* weakAnimatedView = animatedView; - auto completionBlock = ^() { - self.inNewTabAnimation = NO; - [weakAnimatedView removeFromSuperview]; - openTab(); - }; - [self.view addSubview:animatedView]; - [animatedView animateFrom:command.originPoint - toTabGridButtonWithCompletion:completionBlock]; - } -} - -// Switch to the tab corresponding to |params|. -- (void)switchToTabWithParams: - (const web::NavigationManager::WebLoadParams&)params { - const GURL& URL = params.url; - - WebStateList* webStateList = self.tabModel.webStateList; - NSInteger newWebStateIndex = - webStateList->GetIndexOfInactiveWebStateWithURL(URL); - bool oldTabIsNTPWithoutHistory = - IsNTPWithoutHistory(webStateList->GetActiveWebState()); - - if (newWebStateIndex == WebStateList::kInvalidIndex) { - // If the tab containing the URL has been closed. - if (oldTabIsNTPWithoutHistory) { - // It is NTP, just load the URL. - ChromeLoadParams currentPageParams(params); - [self loadURLWithParams:currentPageParams]; - } else { - // Open the URL in foreground. - OpenNewTabCommand* newTabCommand = - [[OpenNewTabCommand alloc] initWithURL:URL - referrer:web::Referrer() - inIncognito:self.isOffTheRecord - inBackground:NO - appendTo:kCurrentTab]; - [self.dispatcher openURLInNewTab:newTabCommand]; - } - return; - } - - web::WebState* webStateBeingActivated = - webStateList->GetWebStateAt(newWebStateIndex); - - if (![self canShowTabStrip]) { - // Add animations only if the tab strip isn't shown. - UIView* snapshotView = [self.view snapshotViewAfterScreenUpdates:NO]; - - // TODO(crbug.com/904992): Do not repurpose SnapshotGeneratorDelegate. - SwipeView* swipeView = [[SwipeView alloc] - initWithFrame:self.contentArea.frame - topMargin:[self snapshotGenerator:nil - snapshotEdgeInsetsForWebState:webStateBeingActivated] - .top]; - - [swipeView setTopToolbarImage:[self.primaryToolbarCoordinator - toolbarSideSwipeSnapshotForWebState: - webStateBeingActivated]]; - [swipeView setBottomToolbarImage:[self.secondaryToolbarCoordinator - toolbarSideSwipeSnapshotForWebState: - webStateBeingActivated]]; - - SnapshotTabHelper::FromWebState(webStateBeingActivated) - ->RetrieveColorSnapshot(^(UIImage* image) { - if (PagePlaceholderTabHelper::FromWebState(webStateBeingActivated) - ->will_add_placeholder_for_next_navigation()) { - [swipeView setImage:nil]; - } else { - [swipeView setImage:image]; - } - }); - - SwitchToTabAnimationView* animationView = - [[SwitchToTabAnimationView alloc] initWithFrame:self.view.bounds]; - - [self.view addSubview:animationView]; - - SwitchToTabAnimationPosition position = - newWebStateIndex > webStateList->active_index() - ? SwitchToTabAnimationPositionAfter - : SwitchToTabAnimationPositionBefore; - [animationView animateFromCurrentView:snapshotView - toNewView:swipeView - inPosition:position]; - } - NSInteger oldWebStateIndex = webStateList->active_index(); - webStateList->ActivateWebStateAt(newWebStateIndex); - - // Close the tab if it is NTP with no back/forward history to avoid having - // empty tabs. - if (oldTabIsNTPWithoutHistory) { - webStateList->CloseWebStateAt(oldWebStateIndex, - WebStateList::CLOSE_USER_ACTION); - } + // TODO(crbug.com/907527): call UrlLoadingService directly where we call + // this method. + UrlLoadingService* urlLoadingService = + UrlLoadingServiceFactory::GetForBrowserState(self.browserState); + urlLoadingService->OpenUrlInNewTab(command); } #pragma mark - ToolbarCoordinatorDelegate (Public) @@ -4315,7 +4268,8 @@ inIncognito:NO inBackground:NO appendTo:kCurrentTab]; - [self openNewTabInCurrentMode:command]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->OpenUrlInNewTab(command); } - (void)showBookmarksManager { @@ -4354,7 +4308,8 @@ // TODO(crbug.com/799601): Delete this once its not needed. const GURL memexURL("https://chrome-memex.appspot.com"); ChromeLoadParams params(memexURL); - [self loadURLWithParams:params]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->LoadUrlInCurrentTab(params); } - (void)prepareForPopupMenuPresentation:(PopupMenuCommandType)type { @@ -4950,7 +4905,6 @@ NewTabPageCoordinator* newTabPageCoordinator = [[NewTabPageCoordinator alloc] initWithBrowserState:_browserState]; newTabPageCoordinator.dispatcher = self.dispatcher; - newTabPageCoordinator.URLLoader = self; newTabPageCoordinator.toolbarDelegate = self.toolbarInterface; newTabPageCoordinator.webStateList = self.tabModel.webStateList; _ntpCoordinatorsForWebStates[webState] = newTabPageCoordinator;
diff --git a/ios/chrome/browser/ui/browser_view_controller_unittest.mm b/ios/chrome/browser/ui/browser_view_controller_unittest.mm index 8e00416..c01271e2 100644 --- a/ios/chrome/browser/ui/browser_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/browser_view_controller_unittest.mm
@@ -41,6 +41,7 @@ #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/page_info_commands.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" #import "ios/chrome/browser/ui/page_not_available_controller.h" @@ -167,15 +168,16 @@ #pragma mark - URLLoadingServiceDelegate -- (void)switchToTabWithParams: - (const web::NavigationManager::WebLoadParams&)params { - [self.bvc switchToTabWithParams:params]; -} - - (void)openURLInNewTabWithCommand:(OpenNewTabCommand*)command { [self.bvc webPageOrderedOpen:command]; } +- (void)animateOpenBackgroundTabFromCommand:(OpenNewTabCommand*)command + completion:(void (^)())completion { + [self.bvc animateOpenBackgroundTabFromOriginPoint:command.originPoint + completion:completion]; +} + @end #pragma mark -
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h index acc4be5..b11c7463 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h
@@ -29,7 +29,6 @@ // BrowserState used to create the ContentSuggestionFactory. @property(nonatomic, assign) ios::ChromeBrowserState* browserState; // URLLoader used to open pages. -@property(nonatomic, weak) id<UrlLoader> URLLoader; @property(nonatomic, assign) WebStateList* webStateList; @property(nonatomic, weak) id<NewTabPageControllerDelegate> toolbarDelegate; @property(nonatomic, weak) id<ApplicationCommands,
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm index 37be9d31..a4b9aac 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm
@@ -67,7 +67,6 @@ @synthesize browserState = _browserState; @synthesize suggestionsViewController = _suggestionsViewController; -@synthesize URLLoader = _URLLoader; @synthesize visible = _visible; @synthesize contentSuggestionsMediator = _contentSuggestionsMediator; @synthesize headerCollectionInteractionHandler =
diff --git a/ios/chrome/browser/ui/location_bar/BUILD.gn b/ios/chrome/browser/ui/location_bar/BUILD.gn index 0e96a03a..e19fd557 100644 --- a/ios/chrome/browser/ui/location_bar/BUILD.gn +++ b/ios/chrome/browser/ui/location_bar/BUILD.gn
@@ -138,6 +138,7 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/toolbar", "//ios/chrome/browser/ui/toolbar/test", + "//ios/chrome/browser/url_loading", "//ios/chrome/browser/web_state_list", "//ios/chrome/browser/web_state_list:test_support", "//ios/chrome/test/fakes",
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.h b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.h index f5943e2..66924c01 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.h +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.h
@@ -22,7 +22,6 @@ @protocol LocationBarAnimatee; @protocol OmniboxPopupPositioner; @protocol ToolbarCoordinatorDelegate; -@protocol UrlLoader; // Location bar coordinator. @interface LocationBarCoordinator @@ -36,8 +35,6 @@ @property(nonatomic, assign) ios::ChromeBrowserState* browserState; // The dispatcher for this view controller. @property(nonatomic, weak) CommandDispatcher* dispatcher; -// URL loader for the location bar. -@property(nonatomic, weak) id<UrlLoader> URLLoader; // Delegate for this coordinator. // TODO(crbug.com/799446): Change this. @property(nonatomic, weak) id<ToolbarCoordinatorDelegate> delegate;
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm index 0c317c1..bb8441a 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator.mm
@@ -36,8 +36,9 @@ #import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.h" #include "ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller_impl.h" #import "ios/chrome/browser/ui/toolbar/toolbar_coordinator_delegate.h" -#import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/util/pasteboard_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #import "ios/chrome/browser/url_loading/url_loading_util.h" #import "ios/chrome/browser/web/web_navigation_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" @@ -93,7 +94,6 @@ @synthesize mediator = _mediator; @synthesize browserState = _browserState; @synthesize dispatcher = _dispatcher; -@synthesize URLLoader = _URLLoader; @synthesize delegate = _delegate; @synthesize webStateList = _webStateList; @synthesize omniboxPopupCoordinator = _omniboxPopupCoordinator; @@ -250,7 +250,8 @@ params.extra_headers = [combinedExtraHeaders copy]; ChromeLoadParams chromeParams(params); chromeParams.disposition = disposition; - [self.URLLoader loadURLWithParams:chromeParams]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->LoadUrlInCurrentTab(chromeParams); if (google_util::IsGoogleSearchUrl(url)) { UMA_HISTOGRAM_ENUMERATION( @@ -397,7 +398,8 @@ params.transition_type = ui::PageTransitionFromInt( ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); ChromeLoadParams chromeParams(params); - [self.URLLoader loadURLWithParams:chromeParams]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->LoadUrlInCurrentTab(chromeParams); } }
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm b/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm index 22f5fc6..d0c97ded 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_coordinator_unittest.mm
@@ -15,10 +15,11 @@ #include "ios/chrome/browser/search_engines/template_url_service_factory.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/toolbar/toolbar_coordinator_delegate.h" +#include "ios/chrome/browser/url_loading/test_url_loading_service.h" +#include "ios/chrome/browser/url_loading/url_loading_service_factory.h" #include "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_opener.h" -#import "ios/chrome/test/fakes/fake_url_loader.h" #import "ios/web/public/test/fakes/test_web_state.h" #import "ios/web/public/test/test_web_thread_bundle.h" #include "testing/platform_test.h" @@ -70,6 +71,10 @@ test_cbs_builder.AddTestingFactory( ios::AutocompleteClassifierFactory::GetInstance(), ios::AutocompleteClassifierFactory::GetDefaultFactory()); + test_cbs_builder.AddTestingFactory( + UrlLoadingServiceFactory::GetInstance(), + UrlLoadingServiceFactory::GetDefaultFactory()); + browser_state_ = test_cbs_builder.Build(); auto web_state = std::make_unique<web::TestWebState>(); @@ -80,14 +85,12 @@ WebStateOpener()); delegate_ = [[TestToolbarCoordinatorDelegate alloc] init]; - url_loader_ = [[FakeURLLoader alloc] init]; coordinator_ = [[LocationBarCoordinator alloc] init]; coordinator_.browserState = browser_state_.get(); coordinator_.webStateList = &web_state_list_; coordinator_.delegate = delegate_; coordinator_.commandDispatcher = [[CommandDispatcher alloc] init]; - coordinator_.URLLoader = url_loader_; } void TearDown() override { @@ -105,7 +108,6 @@ FakeWebStateListDelegate web_state_list_delegate_; WebStateList web_state_list_; TestToolbarCoordinatorDelegate* delegate_; - FakeURLLoader* url_loader_; }; TEST_F(LocationBarCoordinatorTest, Stops) { @@ -133,14 +135,21 @@ transition:transition disposition:disposition]; - EXPECT_EQ(url, url_loader_.url); - EXPECT_TRUE(url_loader_.referrer.url.is_empty()); - EXPECT_EQ(web::ReferrerPolicyDefault, url_loader_.referrer.policy); - EXPECT_TRUE(ui::PageTransitionCoreTypeIs(transition, url_loader_.transition)); - EXPECT_FALSE(url_loader_.rendererInitiated); - ASSERT_EQ(1U, url_loader_.extraHeaders.count); - EXPECT_GT([url_loader_.extraHeaders[@"X-Client-Data"] length], 0U); - EXPECT_EQ(disposition, url_loader_.disposition); + TestUrlLoadingService* url_loader = + (TestUrlLoadingService*)UrlLoadingServiceFactory::GetForBrowserState( + browser_state_.get()); + + EXPECT_EQ(url, url_loader->last_web_params.url); + EXPECT_TRUE(url_loader->last_web_params.referrer.url.is_empty()); + EXPECT_EQ(web::ReferrerPolicyDefault, + url_loader->last_web_params.referrer.policy); + EXPECT_TRUE(ui::PageTransitionCoreTypeIs( + transition, url_loader->last_web_params.transition_type)); + EXPECT_FALSE(url_loader->last_web_params.is_renderer_initiated); + ASSERT_EQ(1U, url_loader->last_web_params.extra_headers.count); + EXPECT_GT( + [url_loader->last_web_params.extra_headers[@"X-Client-Data"] length], 0U); + EXPECT_EQ(disposition, url_loader->last_disposition); } // Calls -loadGURLFromLocationBar:transition: with https://www.nongoogle.com/ @@ -160,13 +169,19 @@ transition:transition disposition:disposition]; - EXPECT_EQ(url, url_loader_.url); - EXPECT_TRUE(url_loader_.referrer.url.is_empty()); - EXPECT_EQ(web::ReferrerPolicyDefault, url_loader_.referrer.policy); - EXPECT_TRUE(ui::PageTransitionCoreTypeIs(transition, url_loader_.transition)); - EXPECT_FALSE(url_loader_.rendererInitiated); - ASSERT_EQ(0U, url_loader_.extraHeaders.count); - EXPECT_EQ(disposition, url_loader_.disposition); + TestUrlLoadingService* url_loader = + (TestUrlLoadingService*)UrlLoadingServiceFactory::GetForBrowserState( + browser_state_.get()); + + EXPECT_EQ(url, url_loader->last_web_params.url); + EXPECT_TRUE(url_loader->last_web_params.referrer.url.is_empty()); + EXPECT_EQ(web::ReferrerPolicyDefault, + url_loader->last_web_params.referrer.policy); + EXPECT_TRUE(ui::PageTransitionCoreTypeIs( + transition, url_loader->last_web_params.transition_type)); + EXPECT_FALSE(url_loader->last_web_params.is_renderer_initiated); + ASSERT_EQ(0U, url_loader->last_web_params.extra_headers.count); + EXPECT_EQ(disposition, url_loader->last_disposition); } } // namespace
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_generic_coordinator.h b/ios/chrome/browser/ui/location_bar/location_bar_generic_coordinator.h index 37153b24..9f3ffc4 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_generic_coordinator.h +++ b/ios/chrome/browser/ui/location_bar/location_bar_generic_coordinator.h
@@ -22,7 +22,6 @@ @protocol LocationBarAnimatee; @protocol OmniboxPopupPositioner; @protocol ToolbarCoordinatorDelegate; -@protocol UrlLoader; @protocol LocationBarGenericCoordinator<NSObject, LocationBarURLLoader, @@ -36,8 +35,6 @@ @property(nonatomic, assign) ios::ChromeBrowserState* browserState; // The dispatcher for this view controller. @property(nonatomic, weak) CommandDispatcher* dispatcher; -// URL loader for the location bar. -@property(nonatomic, weak) id<UrlLoader> URLLoader; // Delegate for this coordinator. // TODO(crbug.com/799446): Change this. @property(nonatomic, weak) id<ToolbarCoordinatorDelegate> delegate;
diff --git a/ios/chrome/browser/ui/main/browser_coordinator.mm b/ios/chrome/browser/ui/main/browser_coordinator.mm index 5a05a60..a6c44123 100644 --- a/ios/chrome/browser/ui/main/browser_coordinator.mm +++ b/ios/chrome/browser/ui/main/browser_coordinator.mm
@@ -30,6 +30,7 @@ #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browser_coordinator_commands.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/download/ar_quick_look_coordinator.h" #import "ios/chrome/browser/ui/download/pass_kit_coordinator.h" #import "ios/chrome/browser/ui/page_info/page_info_legacy_coordinator.h" @@ -426,13 +427,15 @@ #pragma mark - URLLoadingServiceDelegate -- (void)switchToTabWithParams: - (const web::NavigationManager::WebLoadParams&)params { - [self.viewController switchToTabWithParams:params]; +- (void)openURLInNewTabWithCommand:(OpenNewTabCommand*)command { + [self.viewController.dispatcher openURLInNewTab:command]; } -- (void)openURLInNewTabWithCommand:(OpenNewTabCommand*)command { - [self.viewController webPageOrderedOpen:command]; +- (void)animateOpenBackgroundTabFromCommand:(OpenNewTabCommand*)command + completion:(void (^)())completion { + [self.viewController + animateOpenBackgroundTabFromOriginPoint:command.originPoint + completion:completion]; } // TODO(crbug.com/906525) : Move WebStateListObserving out of
diff --git a/ios/chrome/browser/ui/ntp/BUILD.gn b/ios/chrome/browser/ui/ntp/BUILD.gn index b3b2ff4..a5479f1 100644 --- a/ios/chrome/browser/ui/ntp/BUILD.gn +++ b/ios/chrome/browser/ui/ntp/BUILD.gn
@@ -27,6 +27,7 @@ "//ios/chrome/browser/browser_state", "//ios/chrome/browser/ui/content_suggestions", "//ios/chrome/browser/ui/coordinators:chrome_coordinators", + "//ios/chrome/browser/url_loading", "//ios/chrome/browser/web_state_list", "//ios/public/provider/chrome/browser/voice", "//ios/web/public", @@ -60,6 +61,7 @@ "//ios/chrome/browser/ui/content_suggestions", "//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant", "//ios/chrome/browser/ui/content_suggestions:content_suggestions_ui_util", + "//ios/chrome/browser/url_loading", "//ios/public/provider/chrome/browser/voice", "//ui/base", ] @@ -141,6 +143,7 @@ "//ios/chrome/browser/ui/overscroll_actions", "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/public", + "//ios/chrome/browser/url_loading", "//ios/chrome/browser/web_state_list", "//ios/chrome/common", "//ios/chrome/common/app_group",
diff --git a/ios/chrome/browser/ui/ntp/incognito_view.h b/ios/chrome/browser/ui/ntp/incognito_view.h index dfd0ad0..54dbd9e 100644 --- a/ios/chrome/browser/ui/ntp/incognito_view.h +++ b/ios/chrome/browser/ui/ntp/incognito_view.h
@@ -7,13 +7,14 @@ #import <UIKit/UIKit.h> -@protocol UrlLoader; +class UrlLoadingService; // The scrollview containing the views. Its content's size is constrained on its // superview's size. @interface IncognitoView : UIScrollView -- (instancetype)initWithFrame:(CGRect)frame urlLoader:(id<UrlLoader>)loader; +- (instancetype)initWithFrame:(CGRect)frame + urlLoadingService:(UrlLoadingService*)urlLoadingService; @end
diff --git a/ios/chrome/browser/ui/ntp/incognito_view.mm b/ios/chrome/browser/ui/ntp/incognito_view.mm index 5e01a5f..b1f2def7 100644 --- a/ios/chrome/browser/ui/ntp/incognito_view.mm +++ b/ios/chrome/browser/ui/ntp/incognito_view.mm
@@ -9,10 +9,10 @@ #include "ios/chrome/browser/application_context.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_utils.h" -#import "ios/chrome/browser/ui/url_loader.h" #include "ios/chrome/browser/ui/util/rtl_geometry.h" #include "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" #import "ios/chrome/common/string_util.h" #import "ios/chrome/common/ui_util/constraints_ui_util.h" #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" @@ -117,7 +117,6 @@ } // namespace @implementation IncognitoView { - __weak id<UrlLoader> _loader; UIView* _containerView; UIStackView* _stackView; UILabel* _notSavedLabel; @@ -137,12 +136,16 @@ // |containerView|, the |containerView|'s |topGuide| and |bottomGuide| are // forced to expand, centering the views in between them. NSArray<NSLayoutConstraint*>* _superViewConstraints; + + // The UrlLoadingService associated with this view. + UrlLoadingService* _urlLoadingService; // weak } -- (instancetype)initWithFrame:(CGRect)frame urlLoader:(id<UrlLoader>)loader { +- (instancetype)initWithFrame:(CGRect)frame + urlLoadingService:(UrlLoadingService*)urlLoadingService { self = [super initWithFrame:frame]; if (self) { - _loader = loader; + _urlLoadingService = urlLoadingService; self.alwaysBounceVertical = YES; // The bottom safe area is taken care of with the bottomUnsafeArea guides. @@ -346,7 +349,7 @@ // Triggers a navigation to the help page. - (void)learnMoreButtonPressed { ChromeLoadParams params(GetUrlWithLang(GURL(kLearnMoreIncognitoUrl))); - [_loader loadURLWithParams:params]; + _urlLoadingService->LoadUrlInCurrentTab(params); } // Adds views containing the text of the incognito page to |_stackView|.
diff --git a/ios/chrome/browser/ui/ntp/incognito_view_controller.h b/ios/chrome/browser/ui/ntp/incognito_view_controller.h index 66fcbaf..b965f6f 100644 --- a/ios/chrome/browser/ui/ntp/incognito_view_controller.h +++ b/ios/chrome/browser/ui/ntp/incognito_view_controller.h
@@ -9,14 +9,15 @@ #import "ios/web/public/web_state/ui/crw_native_content.h" +class UrlLoadingService; + @protocol NewTabPageControllerDelegate; -@protocol UrlLoader; @interface IncognitoViewController : UIViewController<CRWNativeContent> // Init with the given loader object. |loader| may be nil, but isn't // retained so it must outlive this controller. -- (id)initWithLoader:(id<UrlLoader>)loader; +- (id)initWithUrlLoadingService:(UrlLoadingService*)urlLoadingService; @end
diff --git a/ios/chrome/browser/ui/ntp/incognito_view_controller.mm b/ios/chrome/browser/ui/ntp/incognito_view_controller.mm index 705a60c..595b396 100644 --- a/ios/chrome/browser/ui/ntp/incognito_view_controller.mm +++ b/ios/chrome/browser/ui/ntp/incognito_view_controller.mm
@@ -9,8 +9,8 @@ #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/ntp/incognito_view.h" -#import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -19,26 +19,25 @@ @interface IncognitoViewController () // The scrollview containing the actual views. @property(nonatomic, strong) IncognitoView* incognitoView; -@property(nonatomic, weak) id<UrlLoader> loader; @end -@implementation IncognitoViewController +@implementation IncognitoViewController { + // The UrlLoadingService associated with this view. + UrlLoadingService* _urlLoadingService; // weak +} -@synthesize incognitoView = _incognitoView; -@synthesize loader = _loader; - -- (id)initWithLoader:(id<UrlLoader>)loader { +- (id)initWithUrlLoadingService:(UrlLoadingService*)urlLoadingService { self = [super init]; if (self) { - _loader = loader; + _urlLoadingService = urlLoadingService; } return self; } - (void)viewDidLoad { self.incognitoView = [[IncognitoView alloc] - initWithFrame:[UIApplication sharedApplication].keyWindow.bounds - urlLoader:self.loader]; + initWithFrame:[UIApplication sharedApplication].keyWindow.bounds + urlLoadingService:_urlLoadingService]; [self.incognitoView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_controller.h b/ios/chrome/browser/ui/ntp/new_tab_page_controller.h index dc653f63..5d8918e 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_controller.h +++ b/ios/chrome/browser/ui/ntp/new_tab_page_controller.h
@@ -50,7 +50,6 @@ // Init with the given url (presumably "chrome://newtab") and loader object. // |loader| may be nil, but isn't retained so it must outlive this controller. - (id)initWithUrl:(const GURL&)url - loader:(id<UrlLoader>)loader focuser:(id<OmniboxFocuser>)focuser browserState:(ios::ChromeBrowserState*)browserState toolbarDelegate:(id<NewTabPageControllerDelegate>)toolbarDelegate
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm index 22429ba..26ec6f0 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm
@@ -20,6 +20,7 @@ #import "ios/chrome/browser/ui/ntp/incognito_view_controller.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_header_constants.h" #include "ios/chrome/browser/ui/util/ui_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #import "ios/chrome/common/ui_util/constraints_ui_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h" @@ -34,7 +35,6 @@ @interface NewTabPageController () { ios::ChromeBrowserState* _browserState; // weak. - __weak id<UrlLoader> _loader; IncognitoViewController* _incognitoController; // The currently visible controller, one of the above. __weak id<CRWNativeContent> _currentController; @@ -88,7 +88,6 @@ @synthesize headerController = _headerController; - (id)initWithUrl:(const GURL&)url - loader:(id<UrlLoader>)loader focuser:(id<OmniboxFocuser>)focuser browserState:(ios::ChromeBrowserState*)browserState toolbarDelegate:(id<NewTabPageControllerDelegate>)toolbarDelegate @@ -105,7 +104,6 @@ if (self) { DCHECK(browserState); _browserState = browserState; - _loader = loader; _parentViewController = parentViewController; _dispatcher = dispatcher; _focuser = focuser; @@ -116,17 +114,18 @@ _view = [[UIView alloc] initWithFrame:CGRectZero]; bool isIncognito = _browserState->IsOffTheRecord(); + UrlLoadingService* urlLoadingService = + UrlLoadingServiceFactory::GetForBrowserState(_browserState); UIViewController* panelController = nil; if (isIncognito) { - _incognitoController = - [[IncognitoViewController alloc] initWithLoader:_loader]; + _incognitoController = [[IncognitoViewController alloc] + initWithUrlLoadingService:urlLoadingService]; panelController = _incognitoController; _currentController = self.incognitoController; } else { self.contentSuggestionsCoordinator = [ [ContentSuggestionsCoordinator alloc] initWithBaseViewController:nil]; - self.contentSuggestionsCoordinator.URLLoader = _loader; self.contentSuggestionsCoordinator.browserState = _browserState; self.contentSuggestionsCoordinator.dispatcher = self.dispatcher; self.contentSuggestionsCoordinator.webStateList =
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h index a324400..6de8eeb 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h +++ b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.h
@@ -38,8 +38,6 @@ // ViewController associated with this coordinator. @property(nonatomic, strong, readonly) UIViewController* viewController; -// URL loader to pass to ContentSuggestionsCoordinator. -@property(nonatomic, weak) id<UrlLoader> URLLoader; // The web state list to pass to ContentSuggestionsCoordinator. @property(nonatomic, assign) WebStateList* webStateList; // The toolbar delegate to pass to ContentSuggestionsCoordinator.
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm index 7ca4021..f8ffc0c 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator.mm
@@ -10,6 +10,7 @@ #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller.h" #import "ios/chrome/browser/ui/ntp/incognito_view_controller.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" @@ -47,18 +48,18 @@ DCHECK(self.browserState); DCHECK(self.webStateList); DCHECK(self.dispatcher); - DCHECK(self.URLLoader); DCHECK(self.toolbarDelegate); if (self.browserState->IsOffTheRecord()) { DCHECK(!self.incognitoViewController); - self.incognitoViewController = - [[IncognitoViewController alloc] initWithLoader:self.URLLoader]; + UrlLoadingService* urlLoadingService = + UrlLoadingServiceFactory::GetForBrowserState(self.browserState); + self.incognitoViewController = [[IncognitoViewController alloc] + initWithUrlLoadingService:urlLoadingService]; } else { DCHECK(!self.contentSuggestionsCoordinator); self.contentSuggestionsCoordinator = [[ContentSuggestionsCoordinator alloc] initWithBaseViewController:nil]; - self.contentSuggestionsCoordinator.URLLoader = self.URLLoader; self.contentSuggestionsCoordinator.dispatcher = self.dispatcher; self.contentSuggestionsCoordinator.browserState = self.browserState; self.contentSuggestionsCoordinator.webStateList = self.webStateList;
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator_unittest.mm b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator_unittest.mm index a2bde15..8d1d756 100644 --- a/ios/chrome/browser/ui/ntp/new_tab_page_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/ntp/new_tab_page_coordinator_unittest.mm
@@ -54,7 +54,6 @@ IOSChromeLargeIconServiceFactory::GetDefaultFactory()); browser_state_ = test_cbs_builder.Build(); - loader_ = OCMProtocolMock(@protocol(UrlLoader)); toolbar_delegate_ = OCMProtocolMock(@protocol(NewTabPageControllerDelegate)); dispatcher_ = OCMProtocolMock(@protocol(NewTabPageTabDispatcher)); @@ -71,7 +70,6 @@ coordinator_ = [[NewTabPageCoordinator alloc] initWithBrowserState:browser_state_.get()]; } - coordinator_.URLLoader = loader_; coordinator_.toolbarDelegate = toolbar_delegate_; coordinator_.dispatcher = dispatcher_; coordinator_.webStateList = web_state_list_.get(); @@ -79,7 +77,6 @@ id dispatcher_; id toolbar_delegate_; - id loader_; id delegate_; std::unique_ptr<WebStateList> web_state_list_; FakeWebStateListDelegate web_state_list_delegate_;
diff --git a/ios/chrome/browser/ui/qr_scanner/BUILD.gn b/ios/chrome/browser/ui/qr_scanner/BUILD.gn index 6c3ed1b9..0737ab7 100644 --- a/ios/chrome/browser/ui/qr_scanner/BUILD.gn +++ b/ios/chrome/browser/ui/qr_scanner/BUILD.gn
@@ -75,6 +75,7 @@ "//ios/chrome/browser/ui/omnibox", "//ios/chrome/browser/ui/toolbar", "//ios/chrome/browser/ui/toolbar/public:feature_flags", + "//ios/chrome/browser/url_loading", "//ios/chrome/test/app:test_support", "//ios/chrome/test/base", "//ios/chrome/test/earl_grey:test_support",
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm index 53b4ef8b..4318f26 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
@@ -22,6 +22,8 @@ #include "ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h" #import "ios/chrome/browser/ui/toolbar/public/features.h" #include "ios/chrome/browser/ui/util/ui_util.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/chrome/test/app/chrome_test_util.h" @@ -422,7 +424,8 @@ web::NavigationManager::WebLoadParams params(replacementURL); params.transition_type = transition; ChromeLoadParams chromeParams(params); - [self.URLLoader loadURLWithParams:chromeParams]; + UrlLoadingServiceFactory::GetForBrowserState(self.browserState) + ->LoadUrlInCurrentTab(chromeParams); [self cancelOmniboxEdit]; }; load_GURL_from_location_bar_swizzler_.reset(new ScopedBlockSwizzler(
diff --git a/ios/chrome/browser/ui/reading_list/offline_page_native_content.h b/ios/chrome/browser/ui/reading_list/offline_page_native_content.h index ddf0db4..c722208 100644 --- a/ios/chrome/browser/ui/reading_list/offline_page_native_content.h +++ b/ios/chrome/browser/ui/reading_list/offline_page_native_content.h
@@ -27,14 +27,14 @@ // chrome://offline/distillation_id/page.html // If |URL| contain a virtual URL in its query params, this will be returned by // the |OfflinePageNativeContent virtualURL| method. -- (instancetype)initWithLoader:(id<UrlLoader>)loader - browserState:(web::BrowserState*)browserState - webState:(web::WebState*)webState - URL:(const GURL&)URL NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithBrowserState:(web::BrowserState*)browserState + webState:(web::WebState*)webState + URL:(const GURL&)URL NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithLoader:(id<UrlLoader>)loader - staticHTMLViewController:(StaticHtmlViewController*)HTMLViewController - URL:(const GURL&)URL NS_UNAVAILABLE; +- (instancetype)initWithStaticHTMLViewController: + (StaticHtmlViewController*)HTMLViewController + URL:(const GURL&)URL + NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm b/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm index cd1c109a..55998688 100644 --- a/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm +++ b/ios/chrome/browser/ui/reading_list/offline_page_native_content.mm
@@ -41,11 +41,9 @@ BOOL _restored; } -- (instancetype)initWithLoader:(id<UrlLoader>)loader - browserState:(web::BrowserState*)browserState - webState:(web::WebState*)webState - URL:(const GURL&)URL { - DCHECK(loader); +- (instancetype)initWithBrowserState:(web::BrowserState*)browserState + webState:(web::WebState*)webState + URL:(const GURL&)URL { DCHECK(browserState); DCHECK(URL.is_valid()); @@ -66,9 +64,7 @@ _entryURL = reading_list::EntryURLForOfflineURL(URL); _virtualURL = reading_list::VirtualURLForOfflineURL(URL); - return [super initWithLoader:loader - staticHTMLViewController:HTMLViewController - URL:URL]; + return [super initWithStaticHTMLViewController:HTMLViewController URL:URL]; } - (void)willBeDismissed {
diff --git a/ios/chrome/browser/ui/reading_list/offline_page_native_content_unittest.mm b/ios/chrome/browser/ui/reading_list/offline_page_native_content_unittest.mm index d0c556e..151e2a2 100644 --- a/ios/chrome/browser/ui/reading_list/offline_page_native_content_unittest.mm +++ b/ios/chrome/browser/ui/reading_list/offline_page_native_content_unittest.mm
@@ -10,15 +10,12 @@ #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/reading_list/offline_url_utils.h" #import "ios/chrome/browser/ui/static_content/static_html_view_controller.h" -#import "ios/chrome/browser/ui/url_loader.h" #import "ios/web/public/navigation_item.h" #import "ios/web/public/navigation_manager.h" #import "ios/web/public/test/web_test_with_web_state.h" #import "ios/web/public/web_state/web_state.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" -#import "third_party/ocmock/OCMock/OCMock.h" -#include "third_party/ocmock/gtest_support.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -40,15 +37,12 @@ GURL distilled_url("http://foo.bar/distilled"); GURL url = reading_list::OfflineURLForPath( base::FilePath("offline_id/page.html"), entry_url, distilled_url); - id<UrlLoader> loader = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; OfflinePageNativeContent* content = [[OfflinePageNativeContent alloc] - initWithLoader:loader - browserState:chrome_browser_state_.get() - webState:web_state() - URL:url]; + initWithBrowserState:chrome_browser_state_.get() + webState:web_state() + URL:url]; ASSERT_EQ(url, [content url]); ASSERT_EQ(distilled_url, [content virtualURL]); - ASSERT_OCMOCK_VERIFY((OCMockObject*)loader); } // Checks that dismissing offline page restores EntryURL. @@ -64,15 +58,12 @@ GURL url = reading_list::OfflineURLForPath( base::FilePath("offline_id/page.html"), entry_url, virtual_url); - id<UrlLoader> loader = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; OfflinePageNativeContent* content = [[OfflinePageNativeContent alloc] - initWithLoader:loader - browserState:chrome_browser_state_.get() - webState:web_state() - URL:url]; + initWithBrowserState:chrome_browser_state_.get() + webState:web_state() + URL:url]; ASSERT_EQ(url, [content url]); ASSERT_EQ(virtual_url, [content virtualURL]); - ASSERT_OCMOCK_VERIFY((OCMockObject*)loader); [content willBeDismissed]; DCHECK_EQ(item->GetURL(), entry_url); DCHECK_EQ(item->GetVirtualURL(), entry_url);
diff --git a/ios/chrome/browser/ui/static_content/BUILD.gn b/ios/chrome/browser/ui/static_content/BUILD.gn index 61ec53e..d0a0352 100644 --- a/ios/chrome/browser/ui/static_content/BUILD.gn +++ b/ios/chrome/browser/ui/static_content/BUILD.gn
@@ -12,7 +12,9 @@ ] deps = [ "//base", + "//ios/chrome/browser/browser_state", "//ios/chrome/browser/ui", + "//ios/chrome/browser/url_loading", "//ios/web", "//net", "//ui/base", @@ -33,6 +35,7 @@ "//ios/chrome/app/strings", "//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/ui", + "//ios/chrome/browser/url_loading", "//ios/testing:ocmock_support", "//ios/web", "//ios/web/public/test",
diff --git a/ios/chrome/browser/ui/static_content/static_html_native_content.h b/ios/chrome/browser/ui/static_content/static_html_native_content.h index b420152b..efcfd5f8 100644 --- a/ios/chrome/browser/ui/static_content/static_html_native_content.h +++ b/ios/chrome/browser/ui/static_content/static_html_native_content.h
@@ -13,7 +13,6 @@ class GURL; @class StaticHtmlViewController; -@protocol UrlLoader; namespace web { class BrowserState; @@ -25,19 +24,18 @@ // application bundle, or obtained by a |HtmlGenerator|. @interface StaticHtmlNativeContent : NSObject<CRWNativeContent> -- (instancetype)initWithLoader:(id<UrlLoader>)loader - staticHTMLViewController:(StaticHtmlViewController*)HTMLViewController - URL:(const GURL&)URL NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithStaticHTMLViewController: + (StaticHtmlViewController*)HTMLViewController + URL:(const GURL&)URL + NS_DESIGNATED_INITIALIZER; // Convenience initializer. Creates a StaticHtmlNativeContent that displays // the resource at |resourcePath|. // |resourcePath| is the location of the static page to display, relative to the // root of the application bundle. -// |loader| is the loader to use to follow navigation. Cannot be nil. // |browserState| is the user browser state and must not be null. // |URL| is the url of the page. - (instancetype)initWithResourcePathResource:(NSString*)resourcePath - loader:(id<UrlLoader>)loader browserState:(web::BrowserState*)browserState url:(const GURL&)URL;
diff --git a/ios/chrome/browser/ui/static_content/static_html_native_content.mm b/ios/chrome/browser/ui/static_content/static_html_native_content.mm index 167ca0150..a6a4e01 100644 --- a/ios/chrome/browser/ui/static_content/static_html_native_content.mm +++ b/ios/chrome/browser/ui/static_content/static_html_native_content.mm
@@ -7,7 +7,6 @@ #include "base/logging.h" #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h" #include "ios/chrome/browser/ui/static_content/static_html_view_controller.h" -#import "ios/chrome/browser/ui/url_loader.h" #include "ios/web/public/referrer.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -16,9 +15,9 @@ @interface StaticHtmlNativeContent () // Designated initializer. -- (instancetype)initWithLoader:(id<UrlLoader>)loader - staticHTMLViewController:(StaticHtmlViewController*)HTMLViewController - URL:(const GURL&)URL; +- (instancetype)initWithStaticHTMLViewController: + (StaticHtmlViewController*)HTMLViewController + URL:(const GURL&)URL; @end @implementation StaticHtmlNativeContent { @@ -29,8 +28,6 @@ // The static HTML view controller that is used to display the content in // a web view. StaticHtmlViewController* _staticHTMLViewController; - // Responsible for loading a particular URL. - __weak id<UrlLoader> _loader; // weak // The controller handling the overscroll actions. OverscrollActionsController* _overscrollActionsController; } @@ -38,36 +35,29 @@ #pragma mark - #pragma mark Public -- (instancetype)initWithLoader:(id<UrlLoader>)loader - staticHTMLViewController:(StaticHtmlViewController*)HTMLViewController - URL:(const GURL&)URL { - DCHECK(loader); +- (instancetype)initWithStaticHTMLViewController: + (StaticHtmlViewController*)HTMLViewController + URL:(const GURL&)URL { DCHECK(HTMLViewController); // No DCHECK for URL (invalid URL is a valid input). if (self = [super init]) { web::Referrer referrer(URL, web::ReferrerPolicyDefault); - [HTMLViewController setLoader:loader referrer:referrer]; _URL = URL; - _loader = loader; _staticHTMLViewController = HTMLViewController; } return self; } - (instancetype)initWithResourcePathResource:(NSString*)resourcePath - loader:(id<UrlLoader>)loader browserState:(web::BrowserState*)browserState url:(const GURL&)URL { - DCHECK(loader); DCHECK(browserState); DCHECK(URL.is_valid()); DCHECK(resourcePath); StaticHtmlViewController* HTMLViewController = [[StaticHtmlViewController alloc] initWithResource:resourcePath browserState:browserState]; - return [self initWithLoader:loader - staticHTMLViewController:HTMLViewController - URL:URL]; + return [self initWithStaticHTMLViewController:HTMLViewController URL:URL]; } - (void)dealloc {
diff --git a/ios/chrome/browser/ui/static_content/static_html_native_content_unittest.mm b/ios/chrome/browser/ui/static_content/static_html_native_content_unittest.mm index 8cd678a..9f64523 100644 --- a/ios/chrome/browser/ui/static_content/static_html_native_content_unittest.mm +++ b/ios/chrome/browser/ui/static_content/static_html_native_content_unittest.mm
@@ -44,32 +44,26 @@ TEST_F(StaticHtmlNativeContentTest, BasicResourceTest) { GURL url("chrome://foo"); - id<UrlLoader> loader = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; StaticHtmlNativeContent* content = [[StaticHtmlNativeContent alloc] initWithResourcePathResource:@"about_credits.html" - loader:loader browserState:chrome_browser_state_.get() url:url]; ASSERT_EQ(url, [content url]); - ASSERT_OCMOCK_VERIFY((OCMockObject*)loader); } TEST_F(StaticHtmlNativeContentTest, BasicInitTest) { GURL url("chrome://foo"); - id<UrlLoader> loader = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; StaticHtmlNativeContentTestGenerator* generator = [[StaticHtmlNativeContentTestGenerator alloc] init]; StaticHtmlViewController* viewController = [[StaticHtmlViewController alloc] initWithGenerator:generator browserState:chrome_browser_state_.get()]; - StaticHtmlNativeContent* content = - [[StaticHtmlNativeContent alloc] initWithLoader:loader - staticHTMLViewController:viewController - URL:url]; + StaticHtmlNativeContent* content = [[StaticHtmlNativeContent alloc] + initWithStaticHTMLViewController:viewController + URL:url]; ASSERT_EQ(url, [content url]); - ASSERT_OCMOCK_VERIFY((OCMockObject*)loader); } } // namespace
diff --git a/ios/chrome/browser/ui/static_content/static_html_view_controller.h b/ios/chrome/browser/ui/static_content/static_html_view_controller.h index 8c2e99f..8d9c6f91 100644 --- a/ios/chrome/browser/ui/static_content/static_html_view_controller.h +++ b/ios/chrome/browser/ui/static_content/static_html_view_controller.h
@@ -78,10 +78,6 @@ allowingReadAccessToURL:(const GURL&)resourcesRoot browserState:(web::BrowserState*)browserState; -// Set the |loader| to use to allow navigation to external URL. The |referrer| -// is the URL that will be used as referrer for those navigations. -- (void)setLoader:(id<UrlLoader>)loader referrer:(const web::Referrer&)referrer; - // Asynchronously executes the supplied JavaScript. Calls |completionHandler| // with results of the execution. If the controller cannot execute JS at the // moment, |completionHandler| is called with an NSError. The
diff --git a/ios/chrome/browser/ui/static_content/static_html_view_controller.mm b/ios/chrome/browser/ui/static_content/static_html_view_controller.mm index cef4375..a76349c 100644 --- a/ios/chrome/browser/ui/static_content/static_html_view_controller.mm +++ b/ios/chrome/browser/ui/static_content/static_html_view_controller.mm
@@ -11,8 +11,10 @@ #include "base/logging.h" #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/url_loading/url_loading_service.h" +#import "ios/chrome/browser/url_loading/url_loading_service_factory.h" #import "ios/web/public/navigation_manager.h" -#include "ios/web/public/referrer.h" #import "ios/web/public/web_state/ui/crw_context_menu_delegate.h" #import "ios/web/public/web_state/ui/crw_native_content.h" #import "ios/web/public/web_view_creation_util.h" @@ -50,9 +52,6 @@ @interface StaticHtmlViewController ()<CRWContextMenuDelegate, WKNavigationDelegate> { @private - // The referrer that will be passed when navigating from this page. - web::Referrer referrer_; - // The URL that will be passed to the web page when loading. // If the page is displaying a local HTML file, it contains the file URL to // the file. @@ -80,9 +79,6 @@ // The delegate of the native content. __weak id<CRWNativeContentDelegate> delegate_; - - // The loader to navigate from the page. - __weak id<UrlLoader> loader_; } // Returns the URL of the static page to display. @@ -137,12 +133,6 @@ [webView_ removeObserver:self forKeyPath:@"title"]; } -- (void)setLoader:(id<UrlLoader>)loader - referrer:(const web::Referrer&)referrer { - loader_ = loader; - referrer_ = referrer; -} - - (void)executeJavaScript:(NSString*)script completionHandler:(web::JavaScriptResultBlock)handler { [webView_ evaluateJavaScript:script completionHandler:handler]; @@ -239,12 +229,15 @@ if ([[request URL] isEqual:[self resourceURL]]) return YES; - // All other navigation URLs will be loaded by our UrlLoader if one exists and + // All other navigation URLs will be loaded by url loading service // if they are issued by the main frame. - if (loader_ && fromMainFrame) { + if (fromMainFrame) { dispatch_async(dispatch_get_main_queue(), ^{ ChromeLoadParams params(net::GURLWithNSURL([request URL])); - [loader_ loadURLWithParams:params]; + ios::ChromeBrowserState* chrome_browser_state = + ios::ChromeBrowserState::FromBrowserState(browserState_); + UrlLoadingServiceFactory::GetForBrowserState(chrome_browser_state) + ->LoadUrlInCurrentTab(params); }); } return NO;
diff --git a/ios/chrome/browser/ui/static_content/static_html_view_controller_unittest.mm b/ios/chrome/browser/ui/static_content/static_html_view_controller_unittest.mm index 0f5aaa05..de42863 100644 --- a/ios/chrome/browser/ui/static_content/static_html_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/static_content/static_html_view_controller_unittest.mm
@@ -10,6 +10,8 @@ #import "base/test/ios/wait_util.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/ui/url_loader.h" +#include "ios/chrome/browser/url_loading/test_url_loading_service.h" +#include "ios/chrome/browser/url_loading/url_loading_service_factory.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/testing/ocmock_complex_type_helper.h" #include "ios/web/public/referrer.h" @@ -103,7 +105,11 @@ protected: void SetUp() override { PlatformTest::SetUp(); - chrome_browser_state_ = TestChromeBrowserState::Builder().Build(); + TestChromeBrowserState::Builder test_cbs_builder; + test_cbs_builder.AddTestingFactory( + UrlLoadingServiceFactory::GetInstance(), + UrlLoadingServiceFactory::GetDefaultFactory()); + chrome_browser_state_ = test_cbs_builder.Build(); } web::TestWebThreadBundle thread_bundle_; @@ -124,7 +130,6 @@ StaticHtmlViewController* content = [[StaticHtmlViewController alloc] initWithResource:@"terms_en.html" browserState:chrome_browser_state_.get()]; - [content setLoader:loader referrer:referrer]; [content setDelegate:delegate]; [[(OCMockObject*)delegate expect] nativeContent:content @@ -135,7 +140,12 @@ }]]; [content triggerPendingLoad]; DryRunLoop(false); - ASSERT_OCMOCK_VERIFY(loader); + + TestUrlLoadingService* url_loader = + (TestUrlLoadingService*)UrlLoadingServiceFactory::GetForBrowserState( + chrome_browser_state_.get()); + EXPECT_EQ(GURL("terms_en.html"), url_loader->last_web_params.url); + ASSERT_OCMOCK_VERIFY((OCMockObject*)delegate); id block = [(id) ^ (const GURL& url, const web::Referrer& referrer, ui::PageTransition transition, BOOL rendererInitiated) { @@ -173,7 +183,6 @@ allowingReadAccessToURL:net::GURLWithNSURL( [fileURL URLByDeletingLastPathComponent]) browserState:chrome_browser_state_.get()]; - [content setLoader:loader referrer:referrer]; [content setDelegate:delegate]; [[(OCMockObject*)delegate expect] nativeContent:content @@ -184,7 +193,12 @@ }]]; [content triggerPendingLoad]; DryRunLoop(false); - ASSERT_OCMOCK_VERIFY(loader); + + TestUrlLoadingService* url_loader = + (TestUrlLoadingService*)UrlLoadingServiceFactory::GetForBrowserState( + chrome_browser_state_.get()); + EXPECT_EQ(GURL("terms_en.html"), url_loader->last_web_params.url); + ASSERT_OCMOCK_VERIFY((OCMockObject*)delegate); id block = [(id) ^ (const GURL& url, const web::Referrer& referrer, ui::PageTransition transition, BOOL rendererInitiated) { @@ -221,12 +235,7 @@ StaticHtmlViewController* content = [[StaticHtmlViewController alloc] initWithGenerator:generator browserState:chrome_browser_state_.get()]; - id<UrlLoader> loader = [OCMockObject mockForProtocol:@protocol(UrlLoader)]; - [content setLoader:loader - referrer:web::Referrer(GURL("chrome://foo"), - web::ReferrerPolicyDefault)]; [content triggerPendingLoad]; - ASSERT_OCMOCK_VERIFY((OCMockObject*)loader); __block id string_in_page = nil; base::test::ios::WaitUntilCondition(^bool { string_in_page = web::test::ExecuteJavaScript([content webView],
diff --git a/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.h b/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.h index b68741e..dd5344d6 100644 --- a/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.h +++ b/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.h
@@ -19,9 +19,6 @@ // Delegate for this coordinator. // TODO(crbug.com/799446): Change this. @property(nonatomic, weak) id<ToolbarCoordinatorDelegate> delegate; -// URL loader for the toolbar. -// TODO(crbug.com/799446): Remove this. -@property(nonatomic, weak) id<UrlLoader> URLLoader; @end
diff --git a/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm index 79be896..c0805de 100644 --- a/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/primary_toolbar_coordinator.mm
@@ -24,7 +24,6 @@ #import "ios/chrome/browser/ui/toolbar/primary_toolbar_view_controller.h" #import "ios/chrome/browser/ui/toolbar/primary_toolbar_view_controller_delegate.h" #import "ios/chrome/browser/ui/toolbar/toolbar_coordinator_delegate.h" -#import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" @@ -59,7 +58,6 @@ @synthesize delegate = _delegate; @synthesize locationBarCoordinator = _locationBarCoordinator; @synthesize orchestrator = _orchestrator; -@synthesize URLLoader = _URLLoader; #pragma mark - ChromeCoordinator @@ -227,7 +225,6 @@ self.locationBarCoordinator.dispatcher = base::mac::ObjCCastStrict<CommandDispatcher>(self.dispatcher); self.locationBarCoordinator.commandDispatcher = self.commandDispatcher; - self.locationBarCoordinator.URLLoader = self.URLLoader; self.locationBarCoordinator.delegate = self.delegate; self.locationBarCoordinator.webStateList = self.webStateList; self.locationBarCoordinator.popupPositioner = self;
diff --git a/ios/chrome/browser/url_loading/BUILD.gn b/ios/chrome/browser/url_loading/BUILD.gn index bea66357..37e94c7 100644 --- a/ios/chrome/browser/url_loading/BUILD.gn +++ b/ios/chrome/browser/url_loading/BUILD.gn
@@ -5,6 +5,8 @@ source_set("url_loading") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ + "test_url_loading_service.h", + "test_url_loading_service.mm", "url_loading_notifier.h", "url_loading_notifier.mm", "url_loading_notifier_factory.cc", @@ -30,6 +32,7 @@ "//ios/chrome/browser/tabs", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/ntp:util", "//ios/chrome/browser/web", "//ios/chrome/browser/web_state_list", "//ios/web/public",
diff --git a/ios/chrome/browser/url_loading/test_url_loading_service.h b/ios/chrome/browser/url_loading/test_url_loading_service.h new file mode 100644 index 0000000..d4ed907 --- /dev/null +++ b/ios/chrome/browser/url_loading/test_url_loading_service.h
@@ -0,0 +1,33 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_URL_LOADING_TEST_URL_LOADING_SERVICE_H_ +#define IOS_CHROME_BROWSER_URL_LOADING_TEST_URL_LOADING_SERVICE_H_ + +#include "ios/chrome/browser/url_loading/url_loading_service.h" + +class TestUrlLoadingService : public UrlLoadingService { + public: + TestUrlLoadingService(UrlLoadingNotifier* notifier); + + // Opens a url based on |chrome_params|. + void LoadUrlInCurrentTab(const ChromeLoadParams& chrome_params) override; + + // Switches to a tab that matches |web_params| or opens in a new tab. + void SwitchToTab( + const web::NavigationManager::WebLoadParams& web_params) override; + + // Opens a url based on |command| in a new tab. + void OpenUrlInNewTab(OpenNewTabCommand* command) override; + + // These are the last parameters passed to |LoadUrlInCurrentTab|, + // |OpenUrlInNewTab| and |SwitchToTab|. + // TODO(crbug.com/907527): normalize these when all parameters in + // UrlLoadingService are. + web::NavigationManager::WebLoadParams last_web_params; + WindowOpenDisposition last_disposition; + OpenNewTabCommand* last_command; +}; + +#endif // IOS_CHROME_BROWSER_URL_LOADING_TEST_URL_LOADING_SERVICE_H_
diff --git a/ios/chrome/browser/url_loading/test_url_loading_service.mm b/ios/chrome/browser/url_loading/test_url_loading_service.mm new file mode 100644 index 0000000..d811b8f --- /dev/null +++ b/ios/chrome/browser/url_loading/test_url_loading_service.mm
@@ -0,0 +1,31 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/url_loading/test_url_loading_service.h" + +#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" +#import "ios/chrome/browser/url_loading/url_loading_notifier.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +TestUrlLoadingService::TestUrlLoadingService(UrlLoadingNotifier* notifier) + : UrlLoadingService(notifier), last_web_params(GURL()) {} + +void TestUrlLoadingService::LoadUrlInCurrentTab( + const ChromeLoadParams& chrome_params) { + last_web_params = chrome_params.web_params; + last_disposition = chrome_params.disposition; +} + +void TestUrlLoadingService::SwitchToTab( + const web::NavigationManager::WebLoadParams& web_params) { + last_web_params = web_params; + last_disposition = WindowOpenDisposition::SWITCH_TO_TAB; +} + +void TestUrlLoadingService::OpenUrlInNewTab(OpenNewTabCommand* command) { + last_command = command; +}
diff --git a/ios/chrome/browser/url_loading/url_loading_notifier.h b/ios/chrome/browser/url_loading/url_loading_notifier.h index a433d92..8f3509ad 100644 --- a/ios/chrome/browser/url_loading/url_loading_notifier.h +++ b/ios/chrome/browser/url_loading/url_loading_notifier.h
@@ -47,6 +47,20 @@ // The loader initiated the |url| loading successfully. void TabDidOpenUrl(const GURL& url, ui::PageTransition transition_type); + // The loader will open |url| in a new tab. Next state will be + // NewTabDidOpenUrl. + void NewTabWillOpenUrl(const GURL& url, bool in_incognito); + + // The loader initiated the |url| loading in a new tab successfully. + void NewTabDidOpenUrl(const GURL& url, bool in_incognito); + + // The loader will switch to an existing tab with |URL| instead of loading it. + // Next state will be: DidSwitchToTabWithUrl. + void WillSwitchToTabWithUrl(const GURL& url, int new_web_state_index); + + // The loader switched to an existing tab with |URL|. + void DidSwitchToTabWithUrl(const GURL& url, int new_web_state_index); + private: base::ObserverList<UrlLoadingObserverBridge>::Unchecked observers_;
diff --git a/ios/chrome/browser/url_loading/url_loading_notifier.mm b/ios/chrome/browser/url_loading/url_loading_notifier.mm index 5a461487..55ae914 100644 --- a/ios/chrome/browser/url_loading/url_loading_notifier.mm +++ b/ios/chrome/browser/url_loading/url_loading_notifier.mm
@@ -52,3 +52,25 @@ for (auto& observer : observers_) observer.TabDidOpenUrl(url, transition_type); } + +void UrlLoadingNotifier::NewTabWillOpenUrl(const GURL& url, bool in_incognito) { + for (auto& observer : observers_) + observer.NewTabWillOpenUrl(url, in_incognito); +} + +void UrlLoadingNotifier::NewTabDidOpenUrl(const GURL& url, bool in_incognito) { + for (auto& observer : observers_) + observer.NewTabDidOpenUrl(url, in_incognito); +} + +void UrlLoadingNotifier::WillSwitchToTabWithUrl(const GURL& url, + int new_web_state_index) { + for (auto& observer : observers_) + observer.WillSwitchToTabWithUrl(url, new_web_state_index); +} + +void UrlLoadingNotifier::DidSwitchToTabWithUrl(const GURL& url, + int new_web_state_index) { + for (auto& observer : observers_) + observer.DidSwitchToTabWithUrl(url, new_web_state_index); +}
diff --git a/ios/chrome/browser/url_loading/url_loading_observer_bridge.h b/ios/chrome/browser/url_loading/url_loading_observer_bridge.h index d66f8dba..cde6c31 100644 --- a/ios/chrome/browser/url_loading/url_loading_observer_bridge.h +++ b/ios/chrome/browser/url_loading/url_loading_observer_bridge.h
@@ -43,6 +43,26 @@ - (void)tabDidOpenURL:(GURL)URL transitionType:(ui::PageTransition)transitionType; +// The loader will open |URL| in a new tab. Next state will be: +// newTabDidOpenURL. +// Invoked by UrlLoadingObserverBridge::NewTabWillOpenUrl. +- (void)newTabWillOpenURL:(GURL)URL inIncognito:(BOOL)inIncognito; + +// The loader initiated the |URL| loading in a new tab successfully. +// Invoked by UrlLoadingObserverBridge::NewTabDidOpenUrl. +- (void)newTabDidOpenURL:(GURL)URL inIncognito:(BOOL)inIncognito; + +// The loader will switch to an existing tab with |URL| instead of loading it. +// Next state will be: didSwitchToTabWithURL. Invoked by +// UrlLoadingObserverBridge::NewTabWillOpenUrl. +- (void)willSwitchToTabWithURL:(GURL)URL + newWebStateIndex:(NSInteger)newWebStateIndex; + +// The loader switched to an existing tab with |URL|. +// Invoked by UrlLoadingObserverBridge::NewTabDidOpenUrl. +- (void)didSwitchToTabWithURL:(GURL)URL + newWebStateIndex:(NSInteger)newWebStateIndex; + @end // Observer used to update listeners of change of state in url loading. @@ -56,6 +76,12 @@ void TabDidReloadUrl(const GURL& url, ui::PageTransition transition_type); void TabDidOpenUrl(const GURL& url, ui::PageTransition transition_type); + void NewTabWillOpenUrl(const GURL& url, bool in_incognito); + void NewTabDidOpenUrl(const GURL& url, bool in_incognito); + + void WillSwitchToTabWithUrl(const GURL& url, int new_web_state_index); + void DidSwitchToTabWithUrl(const GURL& url, int new_web_state_index); + private: __weak id<URLLoadingObserver> owner_; };
diff --git a/ios/chrome/browser/url_loading/url_loading_observer_bridge.mm b/ios/chrome/browser/url_loading/url_loading_observer_bridge.mm index 9adc9ce..2e4c705 100644 --- a/ios/chrome/browser/url_loading/url_loading_observer_bridge.mm +++ b/ios/chrome/browser/url_loading/url_loading_observer_bridge.mm
@@ -52,3 +52,33 @@ [owner_ tabDidOpenURL:url transitionType:transition_type]; } } + +void UrlLoadingObserverBridge::NewTabWillOpenUrl(const GURL& url, + bool in_incognito) { + if ([owner_ respondsToSelector:@selector(newTabWillOpenURL:inIncognito:)]) { + [owner_ newTabWillOpenURL:url inIncognito:in_incognito]; + } +} + +void UrlLoadingObserverBridge::NewTabDidOpenUrl(const GURL& url, + bool in_incognito) { + if ([owner_ respondsToSelector:@selector(newTabDidOpenURL:inIncognito:)]) { + [owner_ newTabDidOpenURL:url inIncognito:in_incognito]; + } +} + +void UrlLoadingObserverBridge::WillSwitchToTabWithUrl(const GURL& url, + int new_web_state_index) { + if ([owner_ respondsToSelector:@selector(willSwitchToTabWithURL: + newWebStateIndex:)]) { + [owner_ willSwitchToTabWithURL:url newWebStateIndex:new_web_state_index]; + } +} + +void UrlLoadingObserverBridge::DidSwitchToTabWithUrl(const GURL& url, + int new_web_state_index) { + if ([owner_ respondsToSelector:@selector(didSwitchToTabWithURL: + newWebStateIndex:)]) { + [owner_ didSwitchToTabWithURL:url newWebStateIndex:new_web_state_index]; + } +}
diff --git a/ios/chrome/browser/url_loading/url_loading_service.h b/ios/chrome/browser/url_loading/url_loading_service.h index 7666d8d..35cd893 100644 --- a/ios/chrome/browser/url_loading/url_loading_service.h +++ b/ios/chrome/browser/url_loading/url_loading_service.h
@@ -6,6 +6,7 @@ #define IOS_CHROME_BROWSER_URL_LOADING_URL_LOADING_SERVICE_H_ #import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> #include "components/keyed_service/core/keyed_service.h" #import "ios/chrome/browser/ui/chrome_load_params.h" @@ -24,17 +25,17 @@ // Objective-C delegate for UrlLoadingService. @protocol URLLoadingServiceDelegate -// Implementing delegate must switch to a tab that matches |params| or open in a -// new tab. -- (void)switchToTabWithParams: - (const web::NavigationManager::WebLoadParams&)params; - // Implementing delegate must open the url in |command| in a new tab. - (void)openURLInNewTabWithCommand:(OpenNewTabCommand*)command; +// Implementing delegate can do an animation using information in |command| when +// opening a background tab, then call |completion|. +- (void)animateOpenBackgroundTabFromCommand:(OpenNewTabCommand*)command + completion:(void (^)())completion; + @end -// Observer used to update listeners of change of state in url loading. +// Service used to load url in current or new tab. class UrlLoadingService : public KeyedService { public: UrlLoadingService(UrlLoadingNotifier* notifier); @@ -43,13 +44,14 @@ void SetBrowser(Browser* browser); // Opens a url based on |chrome_params|. - void LoadUrlInCurrentTab(const ChromeLoadParams& chrome_params); + virtual void LoadUrlInCurrentTab(const ChromeLoadParams& chrome_params); // Switches to a tab that matches |web_params| or opens in a new tab. - void SwitchToTab(const web::NavigationManager::WebLoadParams& web_params); + virtual void SwitchToTab( + const web::NavigationManager::WebLoadParams& web_params); // Opens a url based on |command| in a new tab. - void OpenUrlInNewTab(OpenNewTabCommand* command); + virtual void OpenUrlInNewTab(OpenNewTabCommand* command); private: __weak id<URLLoadingServiceDelegate> delegate_;
diff --git a/ios/chrome/browser/url_loading/url_loading_service.mm b/ios/chrome/browser/url_loading/url_loading_service.mm index 39106d6..e93f30a 100644 --- a/ios/chrome/browser/url_loading/url_loading_service.mm +++ b/ios/chrome/browser/url_loading/url_loading_service.mm
@@ -4,10 +4,15 @@ #import "ios/chrome/browser/url_loading/url_loading_service.h" +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/main/browser.h" +#import "ios/chrome/browser/tabs/tab.h" +#import "ios/chrome/browser/tabs/tab_model.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h" +#import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/url_loading/url_loading_notifier.h" #import "ios/chrome/browser/url_loading/url_loading_util.h" +#import "ios/chrome/browser/web_state_list/web_state_list.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -54,12 +59,96 @@ void UrlLoadingService::SwitchToTab( const web::NavigationManager::WebLoadParams& web_params) { DCHECK(delegate_); - // TODO(crbug.com/907527): chip at BVC::switchToTabWithParams by moving some - // of it here. - [delegate_ switchToTabWithParams:web_params]; + + const GURL& url = web_params.url; + + WebStateList* web_state_list = browser_->GetWebStateList(); + NSInteger new_web_state_index = + web_state_list->GetIndexOfInactiveWebStateWithURL(url); + bool old_tab_is_ntp_without_history = + IsNTPWithoutHistory(web_state_list->GetActiveWebState()); + + if (new_web_state_index == WebStateList::kInvalidIndex) { + // If the tab containing the URL has been closed. + if (old_tab_is_ntp_without_history) { + // It is NTP, just load the URL. + ChromeLoadParams currentPageParams(web_params); + LoadUrlInCurrentTab(currentPageParams); + } else { + // Open the URL in foreground. + ios::ChromeBrowserState* browser_state = browser_->GetBrowserState(); + OpenNewTabCommand* new_tab_command = + [[OpenNewTabCommand alloc] initWithURL:url + referrer:web::Referrer() + inIncognito:browser_state->IsOffTheRecord() + inBackground:NO + appendTo:kCurrentTab]; + [delegate_ openURLInNewTabWithCommand:new_tab_command]; + } + return; + } + + notifier_->WillSwitchToTabWithUrl(url, new_web_state_index); + + NSInteger old_web_state_index = web_state_list->active_index(); + web_state_list->ActivateWebStateAt(new_web_state_index); + + // Close the tab if it is NTP with no back/forward history to avoid having + // empty tabs. + if (old_tab_is_ntp_without_history) { + web_state_list->CloseWebStateAt(old_web_state_index, + WebStateList::CLOSE_USER_ACTION); + } + + notifier_->DidSwitchToTabWithUrl(url, new_web_state_index); } +// TODO(crbug.com/907527): migrate the extra work done in main_controller when +// [delegate_ openURLInNewTabWithCommand:] is called, and remove +// openURLInNewTabWithCommand from delegate. void UrlLoadingService::OpenUrlInNewTab(OpenNewTabCommand* command) { DCHECK(delegate_); - [delegate_ openURLInNewTabWithCommand:command]; + DCHECK(browser_); + ios::ChromeBrowserState* browser_state = browser_->GetBrowserState(); + + if (command.inIncognito != browser_state->IsOffTheRecord()) { + // When sending an open command that switches modes, ensure the tab + // ends up appended to the end of the model, not just next to what is + // currently selected in the other mode. This is done with the |appendTo| + // parameter. + command.appendTo = kLastTab; + [delegate_ openURLInNewTabWithCommand:command]; + return; + } + + // Notify only after checking incognito match, otherwise the delegate will + // take of changing the mode and try again. Notifying before the checks can + // lead to be calling it twice, and calling 'did' below once. + notifier_->NewTabWillOpenUrl(command.URL, command.inIncognito); + + TabModel* tab_model = browser_->GetTabModel(); + + Tab* adjacent_tab = nil; + if (command.appendTo == kCurrentTab) + adjacent_tab = tab_model.currentTab; + + GURL captured_url = command.URL; + web::Referrer captured_referrer = command.referrer; + auto openTab = ^{ + [tab_model insertTabWithURL:captured_url + referrer:captured_referrer + transition:ui::PAGE_TRANSITION_LINK + opener:adjacent_tab + openedByDOM:NO + atIndex:TabModelConstants::kTabPositionAutomatically + inBackground:command.inBackground]; + + notifier_->NewTabDidOpenUrl(captured_url, command.inIncognito); + }; + + if (!command.inBackground) { + openTab(); + } else { + [delegate_ animateOpenBackgroundTabFromCommand:command completion:openTab]; + } }
diff --git a/ios/chrome/browser/url_loading/url_loading_service_factory.h b/ios/chrome/browser/url_loading/url_loading_service_factory.h index 8c756e5..a2810a00 100644 --- a/ios/chrome/browser/url_loading/url_loading_service_factory.h +++ b/ios/chrome/browser/url_loading/url_loading_service_factory.h
@@ -26,6 +26,10 @@ static UrlLoadingServiceFactory* GetInstance(); + // Returns the default factory used to build TestUrlLoadingServices. Can be + // registered with SetTestingFactory to use test instances during testing. + static TestingFactory GetDefaultFactory(); + private: friend class base::NoDestructor<UrlLoadingServiceFactory>;
diff --git a/ios/chrome/browser/url_loading/url_loading_service_factory.mm b/ios/chrome/browser/url_loading/url_loading_service_factory.mm index bc82866a..71731bc 100644 --- a/ios/chrome/browser/url_loading/url_loading_service_factory.mm +++ b/ios/chrome/browser/url_loading/url_loading_service_factory.mm
@@ -8,6 +8,7 @@ #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/url_loading/test_url_loading_service.h" #include "ios/chrome/browser/url_loading/url_loading_notifier_factory.h" #include "ios/chrome/browser/url_loading/url_loading_service.h" @@ -28,6 +29,20 @@ return instance.get(); } +std::unique_ptr<KeyedService> BuildTestUrlLoadingService( + web::BrowserState* context) { + ios::ChromeBrowserState* browser_state = + ios::ChromeBrowserState::FromBrowserState(context); + return std::make_unique<TestUrlLoadingService>( + UrlLoadingNotifierFactory::GetForBrowserState(browser_state)); +} + +// static +BrowserStateKeyedServiceFactory::TestingFactory +UrlLoadingServiceFactory::GetDefaultFactory() { + return base::BindRepeating(&BuildTestUrlLoadingService); +} + UrlLoadingServiceFactory::UrlLoadingServiceFactory() : BrowserStateKeyedServiceFactory( "UrlLoadingService",
diff --git a/ios/third_party/firebase/BUILD.gn b/ios/third_party/firebase/BUILD.gn index 9fa73ea2..63468f39 100644 --- a/ios/third_party/firebase/BUILD.gn +++ b/ios/third_party/firebase/BUILD.gn
@@ -29,5 +29,6 @@ "GoogleAppMeasurement.framework", "GoogleUtilities.framework", "nanopb.framework", + "StoreKit.framework", ] }
diff --git a/ios/web/public/test/test_web_thread_bundle.h b/ios/web/public/test/test_web_thread_bundle.h index b3be7fd..cc69d3ad 100644 --- a/ios/web/public/test/test_web_thread_bundle.h +++ b/ios/web/public/test/test_web_thread_bundle.h
@@ -5,6 +5,8 @@ #ifndef IOS_WEB_PUBLIC_TEST_TEST_WEB_THREAD_BUNDLE_H_ #define IOS_WEB_PUBLIC_TEST_TEST_WEB_THREAD_BUNDLE_H_ +#include "base/test/scoped_task_environment.h" + // TestWebThreadBundle is a convenience class for creating a set of // TestWebThreads and a task scheduler in unit tests. For most tests, it is // sufficient to just instantiate the TestWebThreadBundle as a member variable. @@ -39,7 +41,7 @@ class TestWebThread; -class TestWebThreadBundle { +class TestWebThreadBundle : public base::test::ScopedTaskEnvironment { public: // Used to specify the type of MessageLoop that backs the UI thread, and // which of the named WebThreads should be backed by a real @@ -50,15 +52,13 @@ REAL_IO_THREAD = 1 << 1, }; - TestWebThreadBundle(); - explicit TestWebThreadBundle(int options); + explicit TestWebThreadBundle(int options = Options::DEFAULT); - ~TestWebThreadBundle(); + ~TestWebThreadBundle() override; private: void Init(int options); - std::unique_ptr<base::MessageLoop> message_loop_; std::unique_ptr<TestWebThread> ui_thread_; std::unique_ptr<TestWebThread> io_thread_;
diff --git a/ios/web/test/test_web_thread_bundle.cc b/ios/web/test/test_web_thread_bundle.cc index 326ffd4..06413e72e 100644 --- a/ios/web/test/test_web_thread_bundle.cc +++ b/ios/web/test/test_web_thread_bundle.cc
@@ -6,53 +6,36 @@ #include <memory> -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" -#include "base/task/task_scheduler/task_scheduler.h" -#include "base/task/task_scheduler/task_scheduler_impl.h" -#include "base/test/scoped_task_environment.h" #include "ios/web/public/test/test_web_thread.h" #include "ios/web/web_thread_impl.h" -#include "net/disk_cache/simple/simple_backend_impl.h" namespace web { -TestWebThreadBundle::TestWebThreadBundle() { - Init(TestWebThreadBundle::DEFAULT); -} - -TestWebThreadBundle::TestWebThreadBundle(int options) { +TestWebThreadBundle::TestWebThreadBundle(int options) + : base::test::ScopedTaskEnvironment( + options == IO_MAINLOOP ? MainThreadType::IO : MainThreadType::UI) { Init(options); } TestWebThreadBundle::~TestWebThreadBundle() { - // To avoid memory leaks, ensure that any tasks posted to the cache pool via - // PostTaskAndReply are able to reply back to the originating thread, by - // flushing the cache pool while the browser threads still exist. - base::RunLoop().RunUntilIdle(); - disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); - // To ensure a clean teardown, each thread's message loop must be flushed - // just before the thread is destroyed. But destroying a fake thread does not + // just before the thread is destroyed. But stopping a fake thread does not // automatically flush the message loop, so do it manually. // See http://crbug.com/247525 for discussion. base::RunLoop().RunUntilIdle(); - io_thread_.reset(); + io_thread_->Stop(); base::RunLoop().RunUntilIdle(); - // This is the point at which the cache pool is normally shut down. So flush - // it again in case any shutdown tasks have been posted to the pool from the - // threads above. - disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); - base::RunLoop().RunUntilIdle(); - ui_thread_.reset(); + ui_thread_->Stop(); base::RunLoop().RunUntilIdle(); - message_loop_.reset(); - - base::TaskScheduler::GetInstance()->FlushForTesting(); - base::TaskScheduler::GetInstance()->Shutdown(); - base::TaskScheduler::GetInstance()->JoinForTesting(); - base::TaskScheduler::SetInstance(nullptr); + // This is required to ensure that all remaining MessageLoop and TaskScheduler + // tasks run in an atomic step. This is a bit different than production where + // the main thread is not flushed after it's done running but this approach is + // preferred in unit tests as running more tasks can merely uncover more + // issues (e.g. if a bad tasks is posted but never blocked upon it could make + // a test flaky whereas by flushing, the test will always fail). + RunUntilIdle(); WebThreadImpl::ResetTaskExecutorForTesting(); } @@ -60,34 +43,16 @@ void TestWebThreadBundle::Init(int options) { WebThreadImpl::CreateTaskExecutor(); - // TODO(crbug.com/903803): Use ScopedTaskEnviroment here instead. - message_loop_ = std::make_unique<base::MessageLoop>( - options & TestWebThreadBundle::IO_MAINLOOP ? base::MessageLoop::TYPE_IO - : base::MessageLoop::TYPE_UI); - - // TODO(crbug.com/826465): TestWebThread won't need MessageLoop* - // once modernized to match its //content equivalent. - ui_thread_.reset(new TestWebThread(WebThread::UI, message_loop_.get())); + ui_thread_ = + std::make_unique<TestWebThread>(WebThread::UI, GetMainThreadTaskRunner()); if (options & TestWebThreadBundle::REAL_IO_THREAD) { - io_thread_.reset(new TestWebThread(WebThread::IO)); + io_thread_ = std::make_unique<TestWebThread>(WebThread::IO); io_thread_->StartIOThread(); } else { - io_thread_.reset(new TestWebThread(WebThread::IO, message_loop_.get())); + io_thread_ = std::make_unique<TestWebThread>(WebThread::IO, + GetMainThreadTaskRunner()); } - - // Copied from ScopedTaskEnvironment::ScopedTaskEnvironment. - // TODO(crbug.com/821034): Bring ScopedTaskEnvironment back in - // TestWebThreadBundle. - constexpr int kMaxThreads = 2; - const base::TimeDelta kSuggestedReclaimTime = base::TimeDelta::Max(); - const base::SchedulerWorkerPoolParams worker_pool_params( - kMaxThreads, kSuggestedReclaimTime); - base::TaskScheduler::SetInstance( - std::make_unique<base::internal::TaskSchedulerImpl>( - "ScopedTaskEnvironment")); - base::TaskScheduler::GetInstance()->Start( - {worker_pool_params, worker_pool_params}); } } // namespace web
diff --git a/ios/web_view/internal/signin/web_view_identity_manager_factory.h b/ios/web_view/internal/signin/web_view_identity_manager_factory.h index cd6c6fc..0fa7385 100644 --- a/ios/web_view/internal/signin/web_view_identity_manager_factory.h +++ b/ios/web_view/internal/signin/web_view_identity_manager_factory.h
@@ -27,6 +27,10 @@ // Returns an instance of the WebViewIdentityManagerFactory singleton. static WebViewIdentityManagerFactory* GetInstance(); + // Ensures that IdentityManagerFactory and the factories on which it depends + // are built. + static void EnsureFactoryAndDependeeFactoriesBuilt(); + private: friend class base::NoDestructor<WebViewIdentityManagerFactory>;
diff --git a/ios/web_view/internal/signin/web_view_identity_manager_factory.mm b/ios/web_view/internal/signin/web_view_identity_manager_factory.mm index 39fc486f..6e37aa3 100644 --- a/ios/web_view/internal/signin/web_view_identity_manager_factory.mm +++ b/ios/web_view/internal/signin/web_view_identity_manager_factory.mm
@@ -77,6 +77,15 @@ return instance.get(); } +// static +void WebViewIdentityManagerFactory::EnsureFactoryAndDependeeFactoriesBuilt() { + WebViewIdentityManagerFactory::GetInstance(); + WebViewAccountTrackerServiceFactory::GetInstance(); + WebViewGaiaCookieManagerServiceFactory::GetInstance(); + WebViewOAuth2TokenServiceFactory::GetInstance(); + WebViewSigninManagerFactory::GetInstance(); +} + std::unique_ptr<KeyedService> WebViewIdentityManagerFactory::BuildServiceInstanceFor( web::BrowserState* browser_state) const {
diff --git a/ios/web_view/internal/web_view_browser_state.mm b/ios/web_view/internal/web_view_browser_state.mm index f75e0ee..6eb13da 100644 --- a/ios/web_view/internal/web_view_browser_state.mm +++ b/ios/web_view/internal/web_view_browser_state.mm
@@ -40,13 +40,9 @@ #include "ios/web_view/internal/passwords/web_view_password_store_factory.h" #include "ios/web_view/internal/pref_names.h" #include "ios/web_view/internal/signin/web_view_account_fetcher_service_factory.h" -#include "ios/web_view/internal/signin/web_view_account_tracker_service_factory.h" -#include "ios/web_view/internal/signin/web_view_gaia_cookie_manager_service_factory.h" #include "ios/web_view/internal/signin/web_view_identity_manager_factory.h" -#include "ios/web_view/internal/signin/web_view_oauth2_token_service_factory.h" #include "ios/web_view/internal/signin/web_view_signin_client_factory.h" #include "ios/web_view/internal/signin/web_view_signin_error_controller_factory.h" -#include "ios/web_view/internal/signin/web_view_signin_manager_factory.h" #import "ios/web_view/internal/sync/web_view_gcm_profile_service_factory.h" #import "ios/web_view/internal/sync/web_view_model_type_store_service_factory.h" #import "ios/web_view/internal/sync/web_view_profile_invalidation_provider_factory.h" @@ -203,13 +199,9 @@ WebViewCookieSettingsFactory::GetInstance(); WebViewHostContentSettingsMapFactory::GetInstance(); WebViewAccountFetcherServiceFactory::GetInstance(); - WebViewAccountTrackerServiceFactory::GetInstance(); - WebViewGaiaCookieManagerServiceFactory::GetInstance(); - WebViewOAuth2TokenServiceFactory::GetInstance(); WebViewSigninClientFactory::GetInstance(); WebViewSigninErrorControllerFactory::GetInstance(); - WebViewSigninManagerFactory::GetInstance(); - WebViewIdentityManagerFactory::GetInstance(); + WebViewIdentityManagerFactory::EnsureFactoryAndDependeeFactoriesBuilt(); WebViewGCMProfileServiceFactory::GetInstance(); WebViewProfileInvalidationProviderFactory::GetInstance(); WebViewProfileSyncServiceFactory::GetInstance();
diff --git a/media/audio/audio_features.cc b/media/audio/audio_features.cc index ae38fa4..cfb0b53 100644 --- a/media/audio/audio_features.cc +++ b/media/audio/audio_features.cc
@@ -12,10 +12,6 @@ base::FEATURE_DISABLED_BY_DEFAULT}; #if defined(OS_CHROMEOS) -// Allows experimentally enables mediaDevices.enumerateDevices() on ChromeOS. -// Default disabled (crbug.com/554168). -const base::Feature kEnumerateAudioDevices{"EnumerateAudioDevices", - base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kCrOSSystemAEC{"CrOSSystemAEC", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kCrOSSystemAECDeactivatedGroups{
diff --git a/media/audio/audio_features.h b/media/audio/audio_features.h index 0d686a3..abf4c66 100644 --- a/media/audio/audio_features.h +++ b/media/audio/audio_features.h
@@ -14,7 +14,6 @@ MEDIA_EXPORT extern const base::Feature kDumpOnAudioServiceHang; #if defined(OS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kEnumerateAudioDevices; MEDIA_EXPORT extern const base::Feature kCrOSSystemAEC; MEDIA_EXPORT extern const base::Feature kCrOSSystemAECDeactivatedGroups; #endif
diff --git a/media/audio/cras/audio_manager_cras.cc b/media/audio/cras/audio_manager_cras.cc index e1e356c..46284efb 100644 --- a/media/audio/cras/audio_manager_cras.cc +++ b/media/audio/cras/audio_manager_cras.cc
@@ -133,29 +133,27 @@ device_names->push_back(AudioDeviceName::CreateDefault()); - if (base::FeatureList::IsEnabled(features::kEnumerateAudioDevices)) { - chromeos::AudioDeviceList devices; - GetAudioDevices(&devices); + chromeos::AudioDeviceList devices; + GetAudioDevices(&devices); - // |dev_idx_map| is a map of dev_index and their audio devices. - std::map<int, chromeos::AudioDeviceList> dev_idx_map; - for (const auto& device : devices) { - if (device.is_input != is_input || !device.is_for_simple_usage()) - continue; + // |dev_idx_map| is a map of dev_index and their audio devices. + std::map<int, chromeos::AudioDeviceList> dev_idx_map; + for (const auto& device : devices) { + if (device.is_input != is_input || !device.is_for_simple_usage()) + continue; - dev_idx_map[dev_index_of(device.id)].push_back(device); - } + dev_idx_map[dev_index_of(device.id)].push_back(device); + } - for (const auto& item : dev_idx_map) { - if (1 == item.second.size()) { - const chromeos::AudioDevice& device = item.second.front(); - device_names->emplace_back(device.display_name, - base::NumberToString(device.id)); - } else { - // Create virtual device name for audio nodes that share the same device - // index. - ProcessVirtualDeviceName(device_names, item.second); - } + for (const auto& item : dev_idx_map) { + if (1 == item.second.size()) { + const chromeos::AudioDevice& device = item.second.front(); + device_names->emplace_back(device.display_name, + base::NumberToString(device.id)); + } else { + // Create virtual device name for audio nodes that share the same device + // index. + ProcessVirtualDeviceName(device_names, item.second); } } } @@ -216,9 +214,6 @@ std::string AudioManagerCras::GetAssociatedOutputDeviceID( const std::string& input_device_id) { - if (!base::FeatureList::IsEnabled(features::kEnumerateAudioDevices)) - return ""; - chromeos::AudioDeviceList devices; GetAudioDevices(&devices);
diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc index 69e250f3..6cdc015 100644 --- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -2599,14 +2599,17 @@ } void V4L2VideoDecodeAccelerator::SendBufferToClient( - size_t buffer_index, + size_t output_buffer_index, int32_t bitstream_buffer_id, V4L2ReadableBufferRef vda_buffer) { DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); DCHECK_GE(bitstream_buffer_id, 0); - OutputRecord& output_record = output_buffer_map_[buffer_index]; + OutputRecord& output_record = output_buffer_map_[output_buffer_index]; DCHECK_EQ(buffers_at_client_.count(output_record.picture_id), 0u); + // We need to keep the VDA buffer for now, as the IP still needs to be told + // which buffer to use so we cannot use this buffer index before the client + // has returned the corresponding IP buffer. buffers_at_client_.emplace(output_record.picture_id, std::move(vda_buffer)); // TODO(hubbe): Insert correct color space. http://crbug.com/647725 const Picture picture(output_record.picture_id, bitstream_buffer_id, @@ -2670,9 +2673,9 @@ void V4L2VideoDecodeAccelerator::FrameProcessed( int32_t bitstream_buffer_id, - int output_buffer_index, + int ip_buffer_index, scoped_refptr<VideoFrame> frame) { - DVLOGF(4) << "output_buffer_index=" << output_buffer_index + DVLOGF(4) << "ip_buffer_index=" << ip_buffer_index << ", bitstream_buffer_id=" << bitstream_buffer_id; DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); // TODO(crbug.com/921825): Remove this workaround once reset callback is @@ -2696,12 +2699,14 @@ << bitstream_buffer_id; return; } - DCHECK_GE(output_buffer_index, 0); - DCHECK_LT(output_buffer_index, static_cast<int>(output_buffer_map_.size())); + DCHECK_GE(ip_buffer_index, 0); + DCHECK_LT(ip_buffer_index, static_cast<int>(output_buffer_map_.size())); - OutputRecord& output_record = output_buffer_map_[output_buffer_index]; - DVLOGF(4) << "picture_id=" << output_record.picture_id; - DCHECK_NE(output_record.picture_id, -1); + // This is the output record for the buffer received from the IP, which index + // may differ from the buffer used by the VDA. + OutputRecord& ip_output_record = output_buffer_map_[ip_buffer_index]; + DVLOGF(4) << "picture_id=" << ip_output_record.picture_id; + DCHECK_NE(ip_output_record.picture_id, -1); // If the picture has not been cleared yet, this means it is the first time // we are seeing this buffer from the image processor. Schedule a call to @@ -2709,23 +2714,27 @@ // guaranteed that CreateEGLImageFor will complete before the picture is sent // to the client as both events happen on the child thread due to the picture // uncleared status. - if (output_record.texture_id != 0 && !output_record.cleared) { + if (ip_output_record.texture_id != 0 && !ip_output_record.cleared) { DCHECK(frame->HasDmaBufs()); child_task_runner_->PostTask( FROM_HERE, - base::BindOnce( - &V4L2VideoDecodeAccelerator::CreateEGLImageFor, weak_this_, - output_buffer_index, output_record.picture_id, - media::DuplicateFDs(frame->DmabufFds()), output_record.texture_id, - egl_image_size_, egl_image_format_fourcc_)); + base::BindOnce(&V4L2VideoDecodeAccelerator::CreateEGLImageFor, + weak_this_, ip_buffer_index, + ip_output_record.picture_id, + media::DuplicateFDs(frame->DmabufFds()), + ip_output_record.texture_id, egl_image_size_, + egl_image_format_fourcc_)); } // Remove our job from the IP jobs queue DCHECK_GT(buffers_at_ip_.size(), 0u); DCHECK(buffers_at_ip_.front().first == bitstream_buffer_id); - SendBufferToClient(output_buffer_index, bitstream_buffer_id, - std::move(buffers_at_ip_.front().second)); + // This is the VDA buffer used as input of the IP. + V4L2ReadableBufferRef vda_buffer = std::move(buffers_at_ip_.front().second); buffers_at_ip_.pop(); + + SendBufferToClient(ip_buffer_index, bitstream_buffer_id, + std::move(vda_buffer)); // Flush or resolution change may be waiting image processor to finish. if (buffers_at_ip_.empty()) { NotifyFlushDoneIfNeeded();
diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index 8082ebcb..ff592fdd 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn
@@ -324,6 +324,7 @@ public_deps = [ "//ipc", + "//remoting/proto", ] if (is_posix) {
diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc index 52a3135..df2720f 100644 --- a/remoting/host/policy_watcher_unittest.cc +++ b/remoting/host/policy_watcher_unittest.cc
@@ -520,7 +520,7 @@ mock_log.StopCapturingLogs(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PolicyWatcherTest, MisspelledPolicyTest, ::testing::Values("RemoteAccessHostDomainX",
diff --git a/remoting/host/security_key/BUILD.gn b/remoting/host/security_key/BUILD.gn index 5a0e95f3..d698d75 100644 --- a/remoting/host/security_key/BUILD.gn +++ b/remoting/host/security_key/BUILD.gn
@@ -102,6 +102,7 @@ ] deps = [ "//mojo/core/test:test_support", + "//remoting:test_support", ] if (is_posix) {
diff --git a/remoting/host/third_party_auth_config_unittest.cc b/remoting/host/third_party_auth_config_unittest.cc index cd602832..cd585a38 100644 --- a/remoting/host/third_party_auth_config_unittest.cc +++ b/remoting/host/third_party_auth_config_unittest.cc
@@ -104,14 +104,14 @@ // We validate https-vs-http only on Release builds to help with manual testing. #if defined(NDEBUG) -INSTANTIATE_TEST_CASE_P(ThirdPartyAuthConfig, - InvalidUrlTest, - ::testing::Values("http://insecure.com", - "I am not a URL")); +INSTANTIATE_TEST_SUITE_P(ThirdPartyAuthConfig, + InvalidUrlTest, + ::testing::Values("http://insecure.com", + "I am not a URL")); #else -INSTANTIATE_TEST_CASE_P(ThirdPartyAuthConfig, - InvalidUrlTest, - ::testing::Values("I am not a URL")); +INSTANTIATE_TEST_SUITE_P(ThirdPartyAuthConfig, + InvalidUrlTest, + ::testing::Values("I am not a URL")); #endif TEST(ThirdPartyAuthConfig, ParseInvalidCombination) {
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc index 6496a62..31c61c01 100644 --- a/remoting/protocol/connection_unittest.cc +++ b/remoting/protocol/connection_unittest.cc
@@ -465,8 +465,8 @@ DISALLOW_COPY_AND_ASSIGN(ConnectionTest); }; -INSTANTIATE_TEST_CASE_P(Ice, ConnectionTest, ::testing::Values(false)); -INSTANTIATE_TEST_CASE_P(Webrtc, ConnectionTest, ::testing::Values(true)); +INSTANTIATE_TEST_SUITE_P(Ice, ConnectionTest, ::testing::Values(false)); +INSTANTIATE_TEST_SUITE_P(Webrtc, ConnectionTest, ::testing::Values(true)); TEST_P(ConnectionTest, RejectConnection) { EXPECT_CALL(client_event_handler_,
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc index efc1cd4..8bd9cb8 100644 --- a/remoting/protocol/negotiating_authenticator_unittest.cc +++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -208,7 +208,7 @@ } }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PairingParams, NegotiatingPairingAuthenticatorTest, testing::Values(
diff --git a/remoting/test/codec_perftest.cc b/remoting/test/codec_perftest.cc index 916b127..a12fff2 100644 --- a/remoting/test/codec_perftest.cc +++ b/remoting/test/codec_perftest.cc
@@ -46,18 +46,18 @@ std::unique_ptr<VideoEncoderVpx> encoder_; }; -INSTANTIATE_TEST_CASE_P(VP8, - CodecPerfTest, - ::testing::Values(CodecParams(false, false, false))); -INSTANTIATE_TEST_CASE_P(VP9, - CodecPerfTest, - ::testing::Values(CodecParams(true, false, false))); -INSTANTIATE_TEST_CASE_P(VP9Lossless, - CodecPerfTest, - ::testing::Values(CodecParams(true, true, false))); -INSTANTIATE_TEST_CASE_P(VP9LosslessColor, - CodecPerfTest, - ::testing::Values(CodecParams(true, false, true))); +INSTANTIATE_TEST_SUITE_P(VP8, + CodecPerfTest, + ::testing::Values(CodecParams(false, false, false))); +INSTANTIATE_TEST_SUITE_P(VP9, + CodecPerfTest, + ::testing::Values(CodecParams(true, false, false))); +INSTANTIATE_TEST_SUITE_P(VP9Lossless, + CodecPerfTest, + ::testing::Values(CodecParams(true, true, false))); +INSTANTIATE_TEST_SUITE_P(VP9LosslessColor, + CodecPerfTest, + ::testing::Values(CodecParams(true, false, true))); TEST_P(CodecPerfTest, EncodeLatency) { const int kTotalFrames = 300;
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index 66bd51a..171661d 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.cc
@@ -422,18 +422,18 @@ DISALLOW_COPY_AND_ASSIGN(ProtocolPerfTest); }; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( NoDelay, ProtocolPerfTest, ::testing::Values(NetworkPerformanceParams(0, 0, 0, 0, 0.0, 0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( HighLatency, ProtocolPerfTest, ::testing::Values(NetworkPerformanceParams(0, 0, 300, 30, 0.0, 0), NetworkPerformanceParams(0, 0, 30, 10, 0.0, 0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OutOfOrder, ProtocolPerfTest, ::testing::Values(NetworkPerformanceParams(0, 0, 2, 0, 0.01, 0), @@ -442,7 +442,7 @@ NetworkPerformanceParams(0, 0, 300, 20, 0.01, 0), NetworkPerformanceParams(0, 0, 300, 20, 0.1, 0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LimitedBandwidth, ProtocolPerfTest, ::testing::Values( @@ -459,7 +459,7 @@ NetworkPerformanceParams(800, 0.25, 130, 5, 0.00, 0), NetworkPerformanceParams(800, 1.0, 130, 5, 0.00, 0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SlowSignaling, ProtocolPerfTest, ::testing::Values(NetworkPerformanceParams(8000, 0.25, 30, 0, 0.0, 50),
diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc index f3ffb33..cdeb210 100644 --- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc +++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
@@ -239,28 +239,28 @@ _exit(1); \ } -TEST_BASELINE_SIGSYS(__NR_acct); -TEST_BASELINE_SIGSYS(__NR_chroot); -TEST_BASELINE_SIGSYS(__NR_fanotify_init); -TEST_BASELINE_SIGSYS(__NR_fgetxattr); -TEST_BASELINE_SIGSYS(__NR_getcpu); -TEST_BASELINE_SIGSYS(__NR_getitimer); -TEST_BASELINE_SIGSYS(__NR_init_module); -TEST_BASELINE_SIGSYS(__NR_io_cancel); -TEST_BASELINE_SIGSYS(__NR_keyctl); -TEST_BASELINE_SIGSYS(__NR_mq_open); -TEST_BASELINE_SIGSYS(__NR_ptrace); -TEST_BASELINE_SIGSYS(__NR_sched_setaffinity); -TEST_BASELINE_SIGSYS(__NR_setpgid); -TEST_BASELINE_SIGSYS(__NR_swapon); -TEST_BASELINE_SIGSYS(__NR_sysinfo); -TEST_BASELINE_SIGSYS(__NR_syslog); -TEST_BASELINE_SIGSYS(__NR_timer_create); +TEST_BASELINE_SIGSYS(__NR_acct) +TEST_BASELINE_SIGSYS(__NR_chroot) +TEST_BASELINE_SIGSYS(__NR_fanotify_init) +TEST_BASELINE_SIGSYS(__NR_fgetxattr) +TEST_BASELINE_SIGSYS(__NR_getcpu) +TEST_BASELINE_SIGSYS(__NR_getitimer) +TEST_BASELINE_SIGSYS(__NR_init_module) +TEST_BASELINE_SIGSYS(__NR_io_cancel) +TEST_BASELINE_SIGSYS(__NR_keyctl) +TEST_BASELINE_SIGSYS(__NR_mq_open) +TEST_BASELINE_SIGSYS(__NR_ptrace) +TEST_BASELINE_SIGSYS(__NR_sched_setaffinity) +TEST_BASELINE_SIGSYS(__NR_setpgid) +TEST_BASELINE_SIGSYS(__NR_swapon) +TEST_BASELINE_SIGSYS(__NR_sysinfo) +TEST_BASELINE_SIGSYS(__NR_syslog) +TEST_BASELINE_SIGSYS(__NR_timer_create) #if !defined(__aarch64__) -TEST_BASELINE_SIGSYS(__NR_eventfd); -TEST_BASELINE_SIGSYS(__NR_inotify_init); -TEST_BASELINE_SIGSYS(__NR_vserver); +TEST_BASELINE_SIGSYS(__NR_eventfd) +TEST_BASELINE_SIGSYS(__NR_inotify_init) +TEST_BASELINE_SIGSYS(__NR_vserver) #endif #if defined(LIBC_GLIBC) && !defined(OS_CHROMEOS)
diff --git a/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc b/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc index c16cd72..d45bc87 100644 --- a/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc +++ b/sandbox/linux/seccomp-bpf/bpf_tests_unittest.cc
@@ -130,7 +130,7 @@ // This is the most powerful and complex way to create a BPF test, but it // requires a full class definition (BasicBPFTesterDelegate). -BPF_TEST_D(BPFTest, BPFTestWithDelegateClass, BasicBPFTesterDelegate); +BPF_TEST_D(BPFTest, BPFTestWithDelegateClass, BasicBPFTesterDelegate) // This is the simplest form of BPF tests. BPF_TEST_C(BPFTest, BPFTestWithInlineTest, EnosysPtracePolicy) {
diff --git a/services/device/generic_sensor/linux/sensor_data_linux.cc b/services/device/generic_sensor/linux/sensor_data_linux.cc index 38d7870..0a69f39 100644 --- a/services/device/generic_sensor/linux/sensor_data_linux.cc +++ b/services/device/generic_sensor/linux/sensor_data_linux.cc
@@ -141,9 +141,9 @@ SensorTraits<SensorType::GYROSCOPE>::kDefaultFrequency); } -// TODO(maksims): Verify magnitometer works correctly on a chromebook when +// TODO(maksims): Verify magnetometer works correctly on a chromebook when // I get one with that sensor onboard. -void InitMagnitometerSensorData(SensorPathsLinux* data) { +void InitMagnetometerSensorData(SensorPathsLinux* data) { std::vector<std::string> file_names_x{"in_magn_x_raw"}; std::vector<std::string> file_names_y{"in_magn_y_raw"}; std::vector<std::string> file_names_z{"in_magn_z_raw"}; @@ -186,7 +186,7 @@ InitGyroscopeSensorData(data); break; case SensorType::MAGNETOMETER: - InitMagnitometerSensorData(data); + InitMagnetometerSensorData(data); break; default: return false;
diff --git a/services/device/geolocation/network_location_provider_unittest.cc b/services/device/geolocation/network_location_provider_unittest.cc index c37d75f7..71fb266 100644 --- a/services/device/geolocation/network_location_provider_unittest.cc +++ b/services/device/geolocation/network_location_provider_unittest.cc
@@ -134,7 +134,8 @@ LocationProvider* CreateProvider(bool set_permission_granted, const std::string& api_key = std::string()) { LocationProvider* provider = new NetworkLocationProvider( - shared_url_loader_factory_, api_key, last_position_cache_.get()); + test_url_loader_factory_.GetSafeWeakWrapper(), api_key, + last_position_cache_.get()); if (set_permission_granted) provider->OnPermissionGranted(); return provider; @@ -142,10 +143,7 @@ protected: GeolocationNetworkProviderTest() - : shared_url_loader_factory_( - new network::WeakWrapperSharedURLLoaderFactory( - &test_url_loader_factory_)), - wifi_data_provider_(MockWifiDataProvider::CreateInstance()), + : wifi_data_provider_(MockWifiDataProvider::CreateInstance()), last_position_cache_(std::make_unique<TestLastPositionCache>()) { // TODO(joth): Really these should be in SetUp, not here, but they take no // effect on Mac OS Release builds if done there. I kid not. Figure out why. @@ -153,10 +151,6 @@ MockWifiDataProvider::GetInstance); } - ~GeolocationNetworkProviderTest() override { - shared_url_loader_factory_->Detach(); - } - static int IndexToChannel(int index) { return index + 4; } // Creates wifi data containing the specified number of access points, with @@ -292,8 +286,6 @@ const base::MessageLoop main_message_loop_; network::TestURLLoaderFactory test_url_loader_factory_; - const scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> - shared_url_loader_factory_; const scoped_refptr<MockWifiDataProvider> wifi_data_provider_; std::unique_ptr<NetworkLocationProvider::LastPositionCache> last_position_cache_;
diff --git a/services/identity/public/cpp/accounts_cookie_mutator.h b/services/identity/public/cpp/accounts_cookie_mutator.h index d2020be1..de813d5 100644 --- a/services/identity/public/cpp/accounts_cookie_mutator.h +++ b/services/identity/public/cpp/accounts_cookie_mutator.h
@@ -6,6 +6,7 @@ #define SERVICES_IDENTITY_PUBLIC_CPP_ACCOUNTS_COOKIE_MUTATOR_H_ #include <string> +#include <vector> #include "base/macros.h" #include "google_apis/gaia/gaia_auth_fetcher.h" @@ -32,6 +33,20 @@ const std::string& access_token, gaia::GaiaSource source) = 0; + // Updates the state of the Gaia cookie to contain |account_ids|, including + // removal of any accounts that are currently present in the cookie but not + // contained in |account_ids|. |set_accounts_in_cookies_completed_callback| + // will be invoked with the result of the operation: if the error is equal to + // GoogleServiceAuthError::AuthErrorNone() then the operation succeeded. + // Notably, if there are accounts being added for which IdentityManager does + // not have refresh tokens, the operation will fail with a + // GoogleServiceAuthError::USER_NOT_SIGNED_UP error. + virtual void SetAccountsInCookie( + const std::vector<std::string>& account_ids, + gaia::GaiaSource source, + base::OnceCallback<void(const GoogleServiceAuthError& error)> + set_accounts_in_cookies_completed_callback) = 0; + // Triggers a ListAccounts fetch. Can be used in circumstances where clients // know that the contents of the Gaia cookie might have changed. virtual void TriggerCookieJarUpdate() = 0;
diff --git a/services/identity/public/cpp/accounts_cookie_mutator_impl.cc b/services/identity/public/cpp/accounts_cookie_mutator_impl.cc index ce6c0d85c..5d6be8bd 100644 --- a/services/identity/public/cpp/accounts_cookie_mutator_impl.cc +++ b/services/identity/public/cpp/accounts_cookie_mutator_impl.cc
@@ -4,6 +4,8 @@ #include "services/identity/public/cpp/accounts_cookie_mutator_impl.h" +#include <vector> + #include "components/signin/core/browser/gaia_cookie_manager_service.h" namespace identity { @@ -30,6 +32,16 @@ account_id, access_token, source); } +void AccountsCookieMutatorImpl::SetAccountsInCookie( + const std::vector<std::string>& account_ids, + gaia::GaiaSource source, + base::OnceCallback<void(const GoogleServiceAuthError& error)> + set_accounts_in_cookies_completed_callback) { + gaia_cookie_manager_service_->SetAccountsInCookie( + account_ids, source, + std::move(set_accounts_in_cookies_completed_callback)); +} + void AccountsCookieMutatorImpl::TriggerCookieJarUpdate() { gaia_cookie_manager_service_->TriggerListAccounts(); }
diff --git a/services/identity/public/cpp/accounts_cookie_mutator_impl.h b/services/identity/public/cpp/accounts_cookie_mutator_impl.h index a9ee7db8..efa68af 100644 --- a/services/identity/public/cpp/accounts_cookie_mutator_impl.h +++ b/services/identity/public/cpp/accounts_cookie_mutator_impl.h
@@ -6,6 +6,7 @@ #define SERVICES_IDENTITY_PUBLIC_CPP_ACCOUNTS_COOKIE_MUTATOR_IMPL_H_ #include <string> +#include <vector> #include "base/macros.h" #include "services/identity/public/cpp/accounts_cookie_mutator.h" @@ -33,6 +34,12 @@ const std::string& access_token, gaia::GaiaSource source) override; + void SetAccountsInCookie( + const std::vector<std::string>& account_ids, + gaia::GaiaSource source, + base::OnceCallback<void(const GoogleServiceAuthError& error)> + set_accounts_in_cookies_completed_callback) override; + void TriggerCookieJarUpdate() override; void ForceTriggerOnAddAccountToCookieCompleted(
diff --git a/services/identity/public/cpp/accounts_cookie_mutator_unittest.cc b/services/identity/public/cpp/accounts_cookie_mutator_unittest.cc index f0bcf55..1339b5c 100644 --- a/services/identity/public/cpp/accounts_cookie_mutator_unittest.cc +++ b/services/identity/public/cpp/accounts_cookie_mutator_unittest.cc
@@ -5,6 +5,7 @@ #include "services/identity/public/cpp/accounts_cookie_mutator.h" #include <utility> +#include <vector> #include "base/bind.h" #include "base/run_loop.h" @@ -25,13 +26,27 @@ namespace { const char kTestUnavailableAccountId[] = "unavailable_account_id"; +const char kTestOtherUnavailableAccountId[] = "other_unavailable_account_id"; const char kTestAccountEmail[] = "test_user@test.com"; +const char kTestOtherAccountEmail[] = "test_other_user@test.com"; const char kTestAccountGaiaId[] = "gaia_id_for_test_user_test.com"; const char kTestAccessToken[] = "access_token"; const char kTestUberToken[] = "test_uber_token"; +const char kTestOAuthMultiLoginResponse[] = R"( + { "status": "OK", + "cookies":[ + { + "name":"CookieName", + "value":"CookieValue", + "domain":".google.com", + "path":"/" + } + ] + })"; enum class AccountsCookiesMutatorAction { kAddAccountToCookie, + kSetAccountsInCookie, kTriggerCookieJarUpdateNoAccounts, kTriggerCookieJarUpdateOneAccount, }; @@ -131,6 +146,15 @@ .spec(), std::string(), net::HTTP_OK); break; + case AccountsCookiesMutatorAction::kSetAccountsInCookie: + test_url_loader_factory_.AddResponse( + GaiaUrls::GetInstance() + ->oauth_multilogin_url() + .Resolve(base::StringPrintf("?source=%s", + GaiaConstants::kChromeSource)) + .spec(), + std::string(kTestOAuthMultiLoginResponse), net::HTTP_OK); + break; case AccountsCookiesMutatorAction::kTriggerCookieJarUpdateNoAccounts: signin::SetListAccountsResponseNoAccounts(&test_url_loader_factory_); break; @@ -268,6 +292,84 @@ run_loop.Run(); } +// Test that trying to set a list of accounts in the cookie jar where none of +// those accounts have refresh tokens in IdentityManager results in an error. +TEST_F(AccountsCookieMutatorTest, SetAccountsInCookie_AllNonExistingAccounts) { + PrepareURLLoaderResponsesForAction( + AccountsCookiesMutatorAction::kSetAccountsInCookie); + + base::RunLoop run_loop; + std::vector<std::string> accounts_ids = {kTestUnavailableAccountId, + kTestOtherUnavailableAccountId}; + accounts_cookie_mutator()->SetAccountsInCookie( + accounts_ids, gaia::GaiaSource::kChrome, + base::BindOnce( + [](base::OnceClosure quit_closure, + const GoogleServiceAuthError& error) { + EXPECT_EQ(error.state(), + GoogleServiceAuthError::USER_NOT_SIGNED_UP); + std::move(quit_closure).Run(); + }, + run_loop.QuitClosure())); + + run_loop.Run(); +} + +// Test that trying to set a list of accounts in the cookie jar where some of +// those accounts have no refresh tokens in IdentityManager results in an error. +TEST_F(AccountsCookieMutatorTest, SetAccountsInCookie_SomeNonExistingAccounts) { + PrepareURLLoaderResponsesForAction( + AccountsCookiesMutatorAction::kSetAccountsInCookie); + + std::string account_id = AddAcountWithRefreshToken(kTestAccountEmail); + base::RunLoop run_loop; + std::vector<std::string> accounts_ids = {account_id, + kTestUnavailableAccountId}; + accounts_cookie_mutator()->SetAccountsInCookie( + accounts_ids, gaia::GaiaSource::kChrome, + base::BindOnce( + [](base::OnceClosure quit_closure, + const GoogleServiceAuthError& error) { + EXPECT_EQ(error.state(), + GoogleServiceAuthError::USER_NOT_SIGNED_UP); + std::move(quit_closure).Run(); + }, + run_loop.QuitClosure())); + run_loop.Run(); +} + +// Test that trying to set a list of accounts in the cookie jar where all of +// those accounts have refresh tokens in IdentityManager results in them being +// successfully set. +TEST_F(AccountsCookieMutatorTest, SetAccountsInCookie_AllExistingAccounts) { + PrepareURLLoaderResponsesForAction( + AccountsCookiesMutatorAction::kSetAccountsInCookie); + + std::string account_id = AddAcountWithRefreshToken(kTestAccountEmail); + std::string other_account_id = + AddAcountWithRefreshToken(kTestOtherAccountEmail); + base::RunLoop run_loop; + std::vector<std::string> accounts_ids = {account_id, other_account_id}; + accounts_cookie_mutator()->SetAccountsInCookie( + accounts_ids, gaia::GaiaSource::kChrome, + base::BindOnce( + [](base::OnceClosure quit_closure, + const GoogleServiceAuthError& error) { + EXPECT_EQ(error.state(), GoogleServiceAuthError::NONE); + std::move(quit_closure).Run(); + }, + run_loop.QuitClosure())); + + identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( + account_id, kTestAccessToken, + base::Time::Now() + base::TimeDelta::FromHours(1)); + identity_test_env()->WaitForAccessTokenRequestIfNecessaryAndRespondWithToken( + other_account_id, kTestAccessToken, + base::Time::Now() + base::TimeDelta::FromHours(1)); + + run_loop.Run(); +} + // Test triggering the update of a cookie jar with no accounts works. TEST_F(AccountsCookieMutatorTest, TriggerCookieJarUpdate_NoListedAccounts) { PrepareURLLoaderResponsesForAction(
diff --git a/services/network/websocket_factory.cc b/services/network/websocket_factory.cc index c3d64978..a61bb29 100644 --- a/services/network/websocket_factory.cc +++ b/services/network/websocket_factory.cc
@@ -12,6 +12,7 @@ #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/websocket.h" #include "url/origin.h" +#include "url/url_constants.h" namespace network { @@ -61,8 +62,13 @@ } bool CanReadRawCookies(const GURL& url) override { + DCHECK(url.SchemeIsWSOrWSS()); + GURL::Replacements replace_scheme; + replace_scheme.SetSchemeStr( + url.SchemeIs(url::kWssScheme) ? url::kHttpsScheme : url::kHttpScheme); + GURL url_to_check = url.ReplaceComponents(replace_scheme); return factory_->context_->network_service()->HasRawHeadersAccess( - process_id_, url); + process_id_, url_to_check); } void OnCreateURLRequest(int child_id,
diff --git a/storage/browser/fileapi/file_system_url.cc b/storage/browser/fileapi/file_system_url.cc index b90cf29..e28b1f8 100644 --- a/storage/browser/fileapi/file_system_url.cc +++ b/storage/browser/fileapi/file_system_url.cc
@@ -26,7 +26,7 @@ FileSystemURL::FileSystemURL(const FileSystemURL& other) = default; -FileSystemURL::FileSystemURL(FileSystemURL&& other) noexcept = default; +FileSystemURL::FileSystemURL(FileSystemURL&& other) = default; FileSystemURL& FileSystemURL::operator=(FileSystemURL&& rhs) = default;
diff --git a/storage/browser/fileapi/file_system_url.h b/storage/browser/fileapi/file_system_url.h index 8220812..f6b8813 100644 --- a/storage/browser/fileapi/file_system_url.h +++ b/storage/browser/fileapi/file_system_url.h
@@ -82,7 +82,7 @@ FileSystemURL(const FileSystemURL& other); // Constructs FileSystemURL with the contents of |other|, which is left in // valid but unspecified state. - FileSystemURL(FileSystemURL&& other) noexcept; + FileSystemURL(FileSystemURL&& other); ~FileSystemURL(); // Replaces the contents with those of |rhs|, which is left in valid but
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 85916e7b..0593469 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -948,6 +948,27 @@ ] } ], + "BackgroundTaskSchedulerForBackgroundSync": [ + { + "platforms": [ + "android" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "BackgroundTaskSchedulerForBackgroundSync" + ] + }, + { + "name": "Control", + "disable_features": [ + "BackgroundTaskSchedulerForBackgroundSync" + ] + } + ] + } + ], "BackgroundVideoOptimizations": [ { "platforms": [
diff --git a/third_party/blink/common/user_agent/OWNERS b/third_party/blink/common/user_agent/OWNERS new file mode 100644 index 0000000..83a084b --- /dev/null +++ b/third_party/blink/common/user_agent/OWNERS
@@ -0,0 +1,7 @@ +mkwst@chromium.org + +per-file *.typemap=set noparent +per-file *.typemap=file://ipc/SECURITY_OWNERS + +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/third_party/blink/common/user_agent/user_agent_mojom_traits.cc b/third_party/blink/common/user_agent/user_agent_mojom_traits.cc new file mode 100644 index 0000000..e230430 --- /dev/null +++ b/third_party/blink/common/user_agent/user_agent_mojom_traits.cc
@@ -0,0 +1,39 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/public/common/user_agent/user_agent_mojom_traits.h" + +#include <string> + +namespace mojo { + +bool StructTraits<blink::mojom::UserAgentMetadataDataView, + ::blink::UserAgentMetadata>:: + Read(blink::mojom::UserAgentMetadataDataView data, + ::blink::UserAgentMetadata* out) { + std::string string; + if (!data.ReadBrand(&string)) + return false; + out->brand = string; + + if (!data.ReadVersion(&string)) + return false; + out->version = string; + + if (!data.ReadPlatform(&string)) + return false; + out->platform = string; + + if (!data.ReadArchitecture(&string)) + return false; + out->architecture = string; + + if (!data.ReadModel(&string)) + return false; + out->model = string; + + return true; +} + +} // namespace mojo
diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index 74013706..de3e820 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn
@@ -95,6 +95,7 @@ "service_worker/service_worker_status_code.h", "service_worker/service_worker_type_converters.h", "service_worker/service_worker_utils.h", + "user_agent/user_agent_metadata.h", ] public_deps = [
diff --git a/third_party/blink/public/common/user_agent/OWNERS b/third_party/blink/public/common/user_agent/OWNERS new file mode 100644 index 0000000..83a084b --- /dev/null +++ b/third_party/blink/public/common/user_agent/OWNERS
@@ -0,0 +1,7 @@ +mkwst@chromium.org + +per-file *.typemap=set noparent +per-file *.typemap=file://ipc/SECURITY_OWNERS + +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/third_party/blink/public/common/user_agent/user_agent_metadata.h b/third_party/blink/public/common/user_agent/user_agent_metadata.h new file mode 100644 index 0000000..293ca1a --- /dev/null +++ b/third_party/blink/public/common/user_agent/user_agent_metadata.h
@@ -0,0 +1,24 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_METADATA_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_METADATA_H_ + +#include <string> + +#include "third_party/blink/public/common/common_export.h" + +namespace blink { + +struct BLINK_COMMON_EXPORT UserAgentMetadata { + std::string brand; + std::string version; + std::string platform; + std::string architecture; + std::string model; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_METADATA_H_
diff --git a/third_party/blink/public/common/user_agent/user_agent_metadata.typemap b/third_party/blink/public/common/user_agent/user_agent_metadata.typemap new file mode 100644 index 0000000..ea01ea4 --- /dev/null +++ b/third_party/blink/public/common/user_agent/user_agent_metadata.typemap
@@ -0,0 +1,15 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +mojom = "//third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom" +public_headers = [ + "//third_party/blink/public/common/user_agent/user_agent_metadata.h", + "//third_party/blink/public/common/common_export.h", +] +traits_headers = + [ "//third_party/blink/public/common/user_agent/user_agent_mojom_traits.h" ] +sources = [ + "//third_party/blink/common/user_agent/user_agent_mojom_traits.cc", +] +type_mappings = [ "blink.mojom.UserAgentMetadata=blink::UserAgentMetadata" ]
diff --git a/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h b/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h new file mode 100644 index 0000000..42befca --- /dev/null +++ b/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h
@@ -0,0 +1,44 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_MOJOM_TRAITS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_MOJOM_TRAITS_H_ + +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" + +#include <string> + +#include "mojo/public/cpp/bindings/struct_traits.h" +#include "third_party/blink/public/common/common_export.h" +#include "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom.h" + +namespace mojo { + +template <> +struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::UserAgentMetadataDataView, + ::blink::UserAgentMetadata> { + static const std::string& brand(const ::blink::UserAgentMetadata& data) { + return data.brand; + } + static const std::string& version(const ::blink::UserAgentMetadata& data) { + return data.version; + } + static const std::string& platform(const ::blink::UserAgentMetadata& data) { + return data.platform; + } + static const std::string& architecture( + const ::blink::UserAgentMetadata& data) { + return data.architecture; + } + static const std::string& model(const ::blink::UserAgentMetadata& data) { + return data.model; + } + + static bool Read(blink::mojom::UserAgentMetadataDataView data, + ::blink::UserAgentMetadata* out); +}; + +} // namespace mojo + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_USER_AGENT_USER_AGENT_MOJOM_TRAITS_H_
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index 52434a2..fe52da4 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -84,6 +84,7 @@ "speech/speech_recognition_result.mojom", "speech/speech_recognizer.mojom", "use_counter/css_property_id.mojom", + "user_agent/user_agent_metadata.mojom", "v8_cache_options.mojom", "wake_lock/wake_lock.mojom", "webaudio/audio_context_manager.mojom",
diff --git a/third_party/blink/public/mojom/user_agent/OWNERS b/third_party/blink/public/mojom/user_agent/OWNERS new file mode 100644 index 0000000..7b3fdc7b --- /dev/null +++ b/third_party/blink/public/mojom/user_agent/OWNERS
@@ -0,0 +1,4 @@ +mkwst@chromium.org + +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom b/third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom new file mode 100644 index 0000000..061b101 --- /dev/null +++ b/third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom
@@ -0,0 +1,13 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +struct UserAgentMetadata { + string brand; + string version; + string platform; + string architecture; + string model; +};
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h index e1429ed..55bd97c 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h
@@ -47,6 +47,7 @@ #include "mojo/public/cpp/system/message_pipe.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/loader/code_cache.mojom-shared.h" #include "third_party/blink/public/platform/blame_context.h" #include "third_party/blink/public/platform/code_cache_loader.h" @@ -377,6 +378,12 @@ // Returns the User-Agent string. virtual WebString UserAgent() { return WebString(); } + // Returns the User Agent metadata. This will replace `UserAgent()` if we + // end up shipping https://github.com/WICG/ua-client-hints. + virtual blink::UserAgentMetadata UserAgentMetadata() { + return blink::UserAgentMetadata(); + } + // A suggestion to cache this metadata in association with this URL. virtual void CacheMetadata(blink::mojom::CodeCacheType cache_type, const WebURL&,
diff --git a/third_party/blink/public/public_typemaps.gni b/third_party/blink/public/public_typemaps.gni index b5f261f..0b8379e 100644 --- a/third_party/blink/public/public_typemaps.gni +++ b/third_party/blink/public/public_typemaps.gni
@@ -13,4 +13,5 @@ "//third_party/blink/public/common/mediastream/media_stream.typemap", "//third_party/blink/public/common/notifications/notification_types.typemap", "//third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap", + "//third_party/blink/public/common/user_agent/user_agent_metadata.typemap", ]
diff --git a/third_party/blink/renderer/SpecMapping.md b/third_party/blink/renderer/SpecMapping.md index 8fa06e5..0786630c 100644 --- a/third_party/blink/renderer/SpecMapping.md +++ b/third_party/blink/renderer/SpecMapping.md
@@ -18,15 +18,15 @@ [Frame]: https://cs.chromium.org/src/third_party/blink/renderer/core/frame/frame.h [LocalFrame]: https://cs.chromium.org/src/third_party/blink/renderer/core/frame/local_frame.h -### [origins](https://html.spec.whatwg.org/multipage/browsers.html#concept-origin) +### [origins](https://html.spec.whatwg.org/C/#concept-origin) An origin corresponds to the [SecurityOrigin]. You can test for [same-origin] using `SecurityOrigin::canAccess` and for [same-origin domain] using `SecurityOrigin::isSameSchemeHostPort`. [SecurityOrigin]: https://cs.chromium.org/src/third_party/blink/renderer/platform/weborigin/security_origin.h -[same-origin]: https://html.spec.whatwg.org/multipage/browsers.html#same-origin -[same-origin domain]: https://html.spec.whatwg.org/multipage/browsers.html#same-origin-domain +[same-origin]: https://html.spec.whatwg.org/C/#same-origin +[same-origin domain]: https://html.spec.whatwg.org/C/#same-origin-domain ### [Window object](https://html.spec.whatwg.org/C/#window) @@ -42,11 +42,11 @@ The WindowProxy is part of the bindings implemented by the [WindowProxy class](https://cs.chromium.org/Source/bindings/core/v8/WindowProxy.h). -### [canvas](https://html.spec.whatwg.org/multipage/scripting.html#the-canvas-element) +### [canvas](https://html.spec.whatwg.org/C/#the-canvas-element) An HTML element into which drawing can be performed imperatively via JavaScript. Multiple -[context types](https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-getcontext) +[context types](https://html.spec.whatwg.org/C/#dom-canvas-getcontext) are supported for different use cases. The main element's sources are in [HTMLCanvasElement]. Contexts are implemented @@ -58,7 +58,7 @@ The [2D canvas context] is implemented in [modules/canvas2d]. -[2D canvas context]: https://html.spec.whatwg.org/multipage/scripting.html#canvasrenderingcontext2d +[2D canvas context]: https://html.spec.whatwg.org/C/#canvasrenderingcontext2d [modules/canvas2d]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/canvas2d/
diff --git a/third_party/blink/renderer/bindings/IDLExtendedAttributes.md b/third_party/blink/renderer/bindings/IDLExtendedAttributes.md index bafe300..59072083 100644 --- a/third_party/blink/renderer/bindings/IDLExtendedAttributes.md +++ b/third_party/blink/renderer/bindings/IDLExtendedAttributes.md
@@ -142,10 +142,10 @@ ### [CEReactions] _(m, a)_ -Standard: [CEReactions](https://html.spec.whatwg.org/multipage/scripting.html#cereactions) +Standard: [CEReactions](https://html.spec.whatwg.org/C/#cereactions) Summary: `[CEReactions]` indicates that -[custom element reactions](https://html.spec.whatwg.org/multipage/scripting.html#concept-custom-element-reaction) +[custom element reactions](https://html.spec.whatwg.org/C/#concept-custom-element-reaction) are triggered for this method or attribute. Usage: `[CEReactions]` takes no arguments. @@ -304,7 +304,7 @@ ### [HTMLConstructor] -Standard: [HTMLConstructor](https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors) +Standard: [HTMLConstructor](https://html.spec.whatwg.org/C/#html-element-constructors) Summary: HTML Elements have special constructor behavior. Interface object of given interface with the `[HTMLConstructor]` attribute will have specific behavior when called. @@ -484,7 +484,7 @@ ### [Serializable] _(i)_ -Standard: [Serializable](https://html.spec.whatwg.org/multipage/structured-data.html#serializable) +Standard: [Serializable](https://html.spec.whatwg.org/C/#serializable) Summary: Serializable objects support being serialized, and later deserialized, for persistence in storage APIs or for passing with `postMessage()`. @@ -498,7 +498,7 @@ ### [Transferable] _(i)_ -Standard: [Transferable](https://html.spec.whatwg.org/multipage/structured-data.html#transferable) +Standard: [Transferable](https://html.spec.whatwg.org/C/#transferable) Summary: Transferable objects support being transferred across Realms with `postMessage()`. @@ -1656,4 +1656,4 @@ THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *** -[CrossOriginProperties]: https://html.spec.whatwg.org/multipage/browsers.html#crossoriginproperties-(-o-) +[CrossOriginProperties]: https://html.spec.whatwg.org/C/#crossoriginproperties-(-o-)
diff --git a/third_party/blink/renderer/bindings/core/v8/V8BindingDesign.md b/third_party/blink/renderer/bindings/core/v8/V8BindingDesign.md index 451055b6..6c483b8 100644 --- a/third_party/blink/renderer/bindings/core/v8/V8BindingDesign.md +++ b/third_party/blink/renderer/bindings/core/v8/V8BindingDesign.md
@@ -117,9 +117,9 @@ (not the context of `<iframe>`). The entered context is a concept to implement the -[entry settings object](https://html.spec.whatwg.org/multipage/webappapis.html#entry-settings-object) +[entry settings object](https://html.spec.whatwg.org/C/#entry-settings-object) of the HTML spec. The current context is a concept to implement the -[incumbent settings object](https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object) +[incumbent settings object](https://html.spec.whatwg.org/C/#incumbent-settings-object) of the HTML spec. In summary, the entered context is a context from which the current JavaScript
diff --git a/third_party/blink/renderer/bindings/core/v8/binding_security.cc b/third_party/blink/renderer/bindings/core/v8/binding_security.cc index b720ebd..85c2073 100644 --- a/third_party/blink/renderer/bindings/core/v8/binding_security.cc +++ b/third_party/blink/renderer/bindings/core/v8/binding_security.cc
@@ -385,7 +385,7 @@ return true; // According to - // https://html.spec.whatwg.org/multipage/browsers.html#security-location, + // https://html.spec.whatwg.org/C/#security-location, // cross-origin script access to a few properties of Location is allowed. // Location already implements the necessary security checks. if (wrapper_type_info->Equals(V8Location::GetWrapperTypeInfo()))
diff --git a/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc b/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc index b87d4471..f3c5c8d 100644 --- a/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc +++ b/third_party/blink/renderer/bindings/core/v8/custom/v8_window_custom.cc
@@ -210,11 +210,11 @@ // Note that named access on WindowProxy is allowed in the cross-origin case. // 7.4.5 [[GetOwnProperty]] (P), step 6. - // https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-getownproperty + // https://html.spec.whatwg.org/C/#windowproxy-getownproperty // // 7.3.3 Named access on the Window object // The document-tree child browsing context name property set - // https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-browsing-context-name-property-set + // https://html.spec.whatwg.org/C/#document-tree-child-browsing-context-name-property-set Frame* child = frame->Tree().ScopedChild(name); if (child) { UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), @@ -252,7 +252,7 @@ CurrentDOMWindow(info.GetIsolate()), window, BindingSecurity::ErrorReportOption::kDoNotReport)) { // HTML 7.2.3.3 CrossOriginGetOwnPropertyHelper ( O, P ) - // https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-) + // https://html.spec.whatwg.org/C/#crossorigingetownpropertyhelper-(-o,-p-) // step 3. If P is "then", @@toStringTag, @@hasInstance, or // @@isConcatSpreadable, then return PropertyDescriptor{ [[Value]]: // undefined, [[Writable]]: false, [[Enumerable]]: false,
diff --git a/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc b/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc index c3bacc5..bb9e376 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc +++ b/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc
@@ -76,7 +76,7 @@ // order, which says it should be done in step 10. There is no behavioral // difference but the advantage that we can use listener's |ScriptState| // after it get compiled. - // https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-value + // https://html.spec.whatwg.org/C/#event-handler-value v8::Local<v8::Value> listener = GetListenerObject(*event->currentTarget()); if (listener.IsEmpty() || !listener->IsObject())
diff --git a/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h b/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h index 1e47648..ed489c7 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h +++ b/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h
@@ -36,7 +36,7 @@ // content attribute to get compiled, potentially unsuccessfully. // // Implements "get the current value of the event handler". - // https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler + // https://html.spec.whatwg.org/C/#getting-the-current-value-of-the-event-handler // Returns v8::Null with firing error event instead of throwing an exception // on failing to compile the uncompiled script body in eventHandler's value. // Also, this can return empty because of crbug.com/881688 .
diff --git a/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc b/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc index ab11c08..4cd2b2c 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc +++ b/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc
@@ -34,7 +34,7 @@ v8::Local<v8::Function> listener) { DCHECK(!HasCompiledHandler()); - // https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler + // https://html.spec.whatwg.org/C/#getting-the-current-value-of-the-event-handler // Step 12: Set eventHandler's value to the result of creating a Web IDL // EventHandler callback function object whose object reference is function // and whose callback context is settings object.
diff --git a/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc b/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc index cfc4131..8a55626 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc +++ b/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc
@@ -27,7 +27,7 @@ } // Implements Step 3. of "get the current value of the event handler" -// https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler +// https://html.spec.whatwg.org/C/#getting-the-current-value-of-the-event-handler v8::Local<v8::Value> JSEventHandlerForContentAttribute::GetCompiledHandler( EventTarget& event_target) { // Do not compile the same code twice.
diff --git a/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h b/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h index bf3af880..66aba9ac 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h +++ b/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h
@@ -66,7 +66,7 @@ // The compiled v8::Function is returned and |JSEventHandler::event_handler_| // gets initialized with it if lazy compilation succeeds. // Otherwise, v8::Null is returned. - // https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler + // https://html.spec.whatwg.org/C/#getting-the-current-value-of-the-event-handler v8::Local<v8::Value> GetCompiledHandler(EventTarget&); // Lazy compilation for content attribute should be tried only once, but we
diff --git a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h index 93e544b..2a3cef6 100644 --- a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h +++ b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h
@@ -17,7 +17,7 @@ // ReferrerScriptInfo carries a copy of "referencing script's" info referenced // in HTML Spec: "HostImportModuleDynamically" algorithm. -// https://html.spec.whatwg.org/multipage/webappapis.html#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability) +// https://html.spec.whatwg.org/C/#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability) class CORE_EXPORT ReferrerScriptInfo { public: ReferrerScriptInfo() {} @@ -62,7 +62,7 @@ private: // Spec: "referencing script's base URL" - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-base-url + // https://html.spec.whatwg.org/C/#concept-script-base-url // // If base_url_.IsNull(), refer to ScriptOrigin::ResourceName() instead. // Note: This improves the chance of getting into the fast path in @@ -71,7 +71,7 @@ // Spec: "referencing script's credentials mode" // The default value is "same-origin" per: - // https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options + // https://html.spec.whatwg.org/C/#default-classic-script-fetch-options const network::mojom::FetchCredentialsMode credentials_mode_ = network::mojom::FetchCredentialsMode::kSameOrigin; @@ -80,12 +80,12 @@ // Spec: "referencing script's parser state" // The default value is "not-parser-inserted" per: - // https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options + // https://html.spec.whatwg.org/C/#default-classic-script-fetch-options const ParserDisposition parser_state_ = kNotParserInserted; // Spec: "referencing script's referrer policy" // The default value is "the empty string" per: - // https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options + // https://html.spec.whatwg.org/C/#default-classic-script-fetch-options const network::mojom::ReferrerPolicy referrer_policy_ = network::mojom::ReferrerPolicy::kDefault; };
diff --git a/third_party/blink/renderer/bindings/core/v8/script_controller.cc b/third_party/blink/renderer/bindings/core/v8/script_controller.cc index 3151eb6..abaa977c 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_controller.cc
@@ -249,7 +249,7 @@ v8::HandleScope handle_scope(GetIsolate()); - // https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate + // https://html.spec.whatwg.org/C/#navigate // Step 12.8 "Let base URL be settings object's API base URL." [spec text] KURL base_url = owner_document->BaseURL();
diff --git a/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.cc b/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.cc index 0f49d3ad..828f6f7 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.cc
@@ -200,7 +200,7 @@ return ToHTMLElement(element); } -// https://html.spec.whatwg.org/multipage/scripting.html#upgrades +// https://html.spec.whatwg.org/C/#upgrades bool ScriptCustomElementDefinition::RunConstructor(Element& element) { if (!script_state_->ContextIsValid()) return false;
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h index 0702f58f..2a6b2a5 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h +++ b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h
@@ -110,7 +110,7 @@ // This enumeration specifies whether we're serializing a value for storage; // e.g. when writing to IndexedDB. This corresponds to the forStorage flag of // the HTML spec: - // https://html.spec.whatwg.org/multipage/infrastructure.html#safe-passing-of-structured-data + // https://html.spec.whatwg.org/C/#safe-passing-of-structured-data enum StoragePolicy { // Not persisted; used only during the execution of the browser. kNotForStorage,
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc index 19b2d96..e382130 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc
@@ -145,7 +145,7 @@ ExceptionState& exception_state) { // TODO(jbroman): Strictly speaking, this is not correct; transfer should // occur in the order of the transfer list. - // https://html.spec.whatwg.org/multipage/infrastructure.html#structuredclonewithtransfer + // https://html.spec.whatwg.org/C/#structuredclonewithtransfer v8::Isolate* isolate = script_state_->GetIsolate();
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.h b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.h index e159a1e..3cc048a2 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.h +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.h
@@ -23,7 +23,7 @@ class Transferables; // Serializes V8 values according to the HTML structured clone algorithm: -// https://html.spec.whatwg.org/multipage/infrastructure.html#structured-clone +// https://html.spec.whatwg.org/C/#structured-clone // // Supports only basic JavaScript objects and core DOM types. Support for // modules types is implemented in a subclass.
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.cc b/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.cc index 1a0d6564..ea53525 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.cc
@@ -21,7 +21,7 @@ namespace blink { -// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors +// https://html.spec.whatwg.org/C/#html-element-constructors void V8HTMLConstructor::HtmlConstructor( const v8::FunctionCallbackInfo<v8::Value>& info, const WrapperTypeInfo& wrapper_type_info,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.h b/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.h index a8f2ec4..784f4aab 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_html_constructor.h
@@ -11,7 +11,7 @@ namespace blink { -// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors +// https://html.spec.whatwg.org/C/#html-element-constructors class CORE_EXPORT V8HTMLConstructor { STATIC_ONLY(V8HTMLConstructor);
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc index 796219b..f94ce5c 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc
@@ -459,7 +459,7 @@ v8::Local<v8::Value> exception) { DCHECK(!exception.IsEmpty()); - // https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error + // https://html.spec.whatwg.org/C/#report-the-error v8::Local<v8::Message> message = v8::Exception::CreateMessage(isolate, exception); if (IsMainThread())
diff --git a/third_party/blink/renderer/bindings/scripts/v8_callback_function.py b/third_party/blink/renderer/bindings/scripts/v8_callback_function.py index 515ab77..eb70d7f 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_callback_function.py +++ b/third_party/blink/renderer/bindings/scripts/v8_callback_function.py
@@ -12,6 +12,7 @@ CALLBACK_FUNCTION_H_INCLUDES = frozenset([ 'platform/bindings/callback_function_base.h', + 'platform/bindings/v8_value_or_script_wrappable_adapter.h', 'platform/wtf/forward.h', ]) CALLBACK_FUNCTION_CPP_INCLUDES = frozenset([ @@ -64,7 +65,7 @@ return find_forward_declaration(idl_type.element_type) return None - declarations = set(['ScriptWrappable']) + declarations = set() for argument in callback_function.arguments: name = find_forward_declaration(argument.idl_type) if name: @@ -93,7 +94,7 @@ else: return cpp_type - argument_declarations = ['ScriptWrappable* callback_this_value'] + argument_declarations = ['bindings::V8ValueOrScriptWrappableAdapter callback_this_value'] argument_declarations.extend( '%s %s' % (argument_cpp_type(argument), argument.name) for argument in arguments)
diff --git a/third_party/blink/renderer/bindings/scripts/v8_callback_interface.py b/third_party/blink/renderer/bindings/scripts/v8_callback_interface.py index 66ebc67..d61d406 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_callback_interface.py +++ b/third_party/blink/renderer/bindings/scripts/v8_callback_interface.py
@@ -41,6 +41,7 @@ CALLBACK_INTERFACE_H_INCLUDES = frozenset([ 'platform/bindings/callback_interface_base.h', + 'platform/bindings/v8_value_or_script_wrappable_adapter.h', ]) CALLBACK_INTERFACE_CPP_INCLUDES = frozenset([ 'bindings/core/v8/generated_code_helper.h', @@ -163,12 +164,11 @@ 'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value( argument.name, isolate='GetIsolate()', creation_context='argument_creation_context'), - 'handle': '%sHandle' % argument.name, 'name': argument.name, 'v8_name': 'v8_' + argument.name, } - argument_declarations = ['ScriptWrappable* callback_this_value'] + argument_declarations = ['bindings::V8ValueOrScriptWrappableAdapter callback_this_value'] argument_declarations.extend( '%s %s' % (argument.idl_type.callback_cpp_type, argument.name) for argument in arguments)
diff --git a/third_party/blink/renderer/bindings/scripts/v8_interface.py b/third_party/blink/renderer/bindings/scripts/v8_interface.py index 7ea0940c..65160189e 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_interface.py +++ b/third_party/blink/renderer/bindings/scripts/v8_interface.py
@@ -333,7 +333,7 @@ # [HTMLConstructor] has_html_constructor = 'HTMLConstructor' in extended_attributes - # https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors + # https://html.spec.whatwg.org/C/#html-element-constructors if has_html_constructor: if ('Constructor' in extended_attributes) or ('NoInterfaceObject' in extended_attributes): raise Exception('[Constructor] and [NoInterfaceObject] MUST NOT be'
diff --git a/third_party/blink/renderer/bindings/scripts/v8_methods.py b/third_party/blink/renderer/bindings/scripts/v8_methods.py index f63b86a..6d067908 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_methods.py +++ b/third_party/blink/renderer/bindings/scripts/v8_methods.py
@@ -434,7 +434,7 @@ # History.pushState and History.replaceState are explicitly specified as # serializing the value for storage. The default is to not serialize for - # storage. See https://html.spec.whatwg.org/multipage/browsers.html#dom-history-pushstate + # storage. See https://html.spec.whatwg.org/C/#dom-history-pushstate if idl_type.name == 'SerializedScriptValue': for_storage = (interface_name == 'History' and method.name in ('pushState', 'replaceState'))
diff --git a/third_party/blink/renderer/bindings/templates/callback_invoke.cc.tmpl b/third_party/blink/renderer/bindings/templates/callback_invoke.cc.tmpl index 6c5ae31b..5222232 100644 --- a/third_party/blink/renderer/bindings/templates/callback_invoke.cc.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_invoke.cc.tmpl
@@ -143,18 +143,23 @@ {% endif %} {# Fill |this_arg|. #} {% if invoke_or_construct == 'invoke' %} - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } {% elif interface_or_function == 'callback interface' %} if (!IsCallbackObjectCallable()) { // step 11. If value's interface is not a single operation callback // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } {% endif %}
diff --git a/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl b/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl index 91e2184..e736908 100644 --- a/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl +++ b/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl
@@ -280,7 +280,7 @@ {% endif %} {% else %} // HTML 7.2.3.3 CrossOriginGetOwnPropertyHelper ( O, P ) - // https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-) + // https://html.spec.whatwg.org/C/#crossorigingetownpropertyhelper-(-o,-p-) // step 3. If P is "then", @@toStringTag, @@hasInstance, or // @@isConcatSpreadable, then return PropertyDescriptor{ [[Value]]: // undefined, [[Writable]]: false, [[Enumerable]]: false,
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc index fa60843..42a8df2 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.cc
@@ -27,7 +27,7 @@ return "V8AnyCallbackFunctionOptionalAnyArg"; } -v8::Maybe<ScriptValue> V8AnyCallbackFunctionOptionalAnyArg::Invoke(ScriptWrappable* callback_this_value, ScriptValue optionalAnyArg) { +v8::Maybe<ScriptValue> V8AnyCallbackFunctionOptionalAnyArg::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue optionalAnyArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "AnyCallbackFunctionOptionalAnyArg", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -213,7 +218,7 @@ } } -v8::Maybe<ScriptValue> V8PersistentCallbackFunction<V8AnyCallbackFunctionOptionalAnyArg>::Invoke(ScriptWrappable* callback_this_value, ScriptValue optionalAnyArg) { +v8::Maybe<ScriptValue> V8PersistentCallbackFunction<V8AnyCallbackFunctionOptionalAnyArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue optionalAnyArg) { return Proxy()->Invoke( callback_this_value, optionalAnyArg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h index 0dfba63..3c782dc 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_optional_any_arg.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8AnyCallbackFunctionOptionalAnyArg final : public CallbackFunctionBase { public: static V8AnyCallbackFunctionOptionalAnyArg* Create(v8::Local<v8::Function> callback_function) { @@ -34,7 +33,7 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<ScriptValue> Invoke(ScriptWrappable* callback_this_value, ScriptValue optionalAnyArg) WARN_UNUSED_RESULT; + v8::Maybe<ScriptValue> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue optionalAnyArg) WARN_UNUSED_RESULT; // Performs "construct". // https://heycam.github.io/webidl/#construct-a-callback-function @@ -53,7 +52,7 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<ScriptValue> Invoke(ScriptWrappable* callback_this_value, ScriptValue optionalAnyArg) WARN_UNUSED_RESULT; + v8::Maybe<ScriptValue> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, ScriptValue optionalAnyArg) WARN_UNUSED_RESULT; private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc index 0155e9e..b3f0dbc 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.cc
@@ -27,7 +27,7 @@ return "V8AnyCallbackFunctionVariadicAnyArgs"; } -v8::Maybe<ScriptValue> V8AnyCallbackFunctionVariadicAnyArgs::Invoke(ScriptWrappable* callback_this_value, const Vector<ScriptValue>& arguments) { +v8::Maybe<ScriptValue> V8AnyCallbackFunctionVariadicAnyArgs::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<ScriptValue>& arguments) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "AnyCallbackFunctionVariadicAnyArgs", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -215,7 +220,7 @@ } } -v8::Maybe<ScriptValue> V8PersistentCallbackFunction<V8AnyCallbackFunctionVariadicAnyArgs>::Invoke(ScriptWrappable* callback_this_value, const Vector<ScriptValue>& arguments) { +v8::Maybe<ScriptValue> V8PersistentCallbackFunction<V8AnyCallbackFunctionVariadicAnyArgs>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<ScriptValue>& arguments) { return Proxy()->Invoke( callback_this_value, arguments); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h index 0f24626..407e931 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_any_callback_function_variadic_any_args.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8AnyCallbackFunctionVariadicAnyArgs final : public CallbackFunctionBase { public: static V8AnyCallbackFunctionVariadicAnyArgs* Create(v8::Local<v8::Function> callback_function) { @@ -34,7 +33,7 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<ScriptValue> Invoke(ScriptWrappable* callback_this_value, const Vector<ScriptValue>& arguments) WARN_UNUSED_RESULT; + v8::Maybe<ScriptValue> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<ScriptValue>& arguments) WARN_UNUSED_RESULT; // Performs "construct". // https://heycam.github.io/webidl/#construct-a-callback-function @@ -53,7 +52,7 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<ScriptValue> Invoke(ScriptWrappable* callback_this_value, const Vector<ScriptValue>& arguments) WARN_UNUSED_RESULT; + v8::Maybe<ScriptValue> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<ScriptValue>& arguments) WARN_UNUSED_RESULT; private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc index bb50b29..14df321 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.cc
@@ -27,7 +27,7 @@ return "V8LongCallbackFunction"; } -v8::Maybe<int32_t> V8LongCallbackFunction::Invoke(ScriptWrappable* callback_this_value, int32_t num1, int32_t num2) { +v8::Maybe<int32_t> V8LongCallbackFunction::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "LongCallbackFunction", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -116,7 +121,7 @@ } } -v8::Maybe<int32_t> V8PersistentCallbackFunction<V8LongCallbackFunction>::Invoke(ScriptWrappable* callback_this_value, int32_t num1, int32_t num2) { +v8::Maybe<int32_t> V8PersistentCallbackFunction<V8LongCallbackFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) { return Proxy()->Invoke( callback_this_value, num1, num2); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h index 25d5c4eff..4c9887b 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_long_callback_function.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8LongCallbackFunction final : public CallbackFunctionBase { public: static V8LongCallbackFunction* Create(v8::Local<v8::Function> callback_function) { @@ -34,7 +33,7 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<int32_t> Invoke(ScriptWrappable* callback_this_value, int32_t num1, int32_t num2) WARN_UNUSED_RESULT; + v8::Maybe<int32_t> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) WARN_UNUSED_RESULT; }; template <> @@ -49,7 +48,7 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<int32_t> Invoke(ScriptWrappable* callback_this_value, int32_t num1, int32_t num2) WARN_UNUSED_RESULT; + v8::Maybe<int32_t> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, int32_t num1, int32_t num2) WARN_UNUSED_RESULT; private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc index 9f791d90..f0375669 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.cc
@@ -27,7 +27,7 @@ return "V8StringSequenceCallbackFunctionLongSequenceArg"; } -v8::Maybe<Vector<String>> V8StringSequenceCallbackFunctionLongSequenceArg::Invoke(ScriptWrappable* callback_this_value, const Vector<int32_t>& arg) { +v8::Maybe<Vector<String>> V8StringSequenceCallbackFunctionLongSequenceArg::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "StringSequenceCallbackFunctionLongSequenceArg", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -115,7 +120,7 @@ } } -v8::Maybe<Vector<String>> V8PersistentCallbackFunction<V8StringSequenceCallbackFunctionLongSequenceArg>::Invoke(ScriptWrappable* callback_this_value, const Vector<int32_t>& arg) { +v8::Maybe<Vector<String>> V8PersistentCallbackFunction<V8StringSequenceCallbackFunctionLongSequenceArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) { return Proxy()->Invoke( callback_this_value, arg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h index de77151..b7902840 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_string_sequence_callback_function_long_sequence_arg.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8StringSequenceCallbackFunctionLongSequenceArg final : public CallbackFunctionBase { public: static V8StringSequenceCallbackFunctionLongSequenceArg* Create(v8::Local<v8::Function> callback_function) { @@ -34,7 +33,7 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<Vector<String>> Invoke(ScriptWrappable* callback_this_value, const Vector<int32_t>& arg) WARN_UNUSED_RESULT; + v8::Maybe<Vector<String>> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) WARN_UNUSED_RESULT; }; template <> @@ -49,7 +48,7 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<Vector<String>> Invoke(ScriptWrappable* callback_this_value, const Vector<int32_t>& arg) WARN_UNUSED_RESULT; + v8::Maybe<Vector<String>> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const Vector<int32_t>& arg) WARN_UNUSED_RESULT; private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc index bb04992b..9706bfbe 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.cc
@@ -25,7 +25,7 @@ return "V8TestCallbackInterface"; } -v8::Maybe<void> V8TestCallbackInterface::voidMethod(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8TestCallbackInterface::voidMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -95,11 +95,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -128,7 +128,7 @@ return v8::JustVoid(); } -v8::Maybe<bool> V8TestCallbackInterface::booleanMethod(ScriptWrappable* callback_this_value) { +v8::Maybe<bool> V8TestCallbackInterface::booleanMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -198,11 +198,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -243,7 +243,7 @@ } } -v8::Maybe<void> V8TestCallbackInterface::voidMethodBooleanArg(ScriptWrappable* callback_this_value, bool boolArg) { +v8::Maybe<void> V8TestCallbackInterface::voidMethodBooleanArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, bool boolArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -313,11 +313,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -351,7 +351,7 @@ return v8::JustVoid(); } -v8::Maybe<void> V8TestCallbackInterface::voidMethodSequenceArg(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) { +v8::Maybe<void> V8TestCallbackInterface::voidMethodSequenceArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -421,11 +421,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -459,7 +459,7 @@ return v8::JustVoid(); } -v8::Maybe<void> V8TestCallbackInterface::voidMethodFloatArg(ScriptWrappable* callback_this_value, float floatArg) { +v8::Maybe<void> V8TestCallbackInterface::voidMethodFloatArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, float floatArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -529,11 +529,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -567,7 +567,7 @@ return v8::JustVoid(); } -v8::Maybe<void> V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { +v8::Maybe<void> V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -637,11 +637,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -675,7 +675,7 @@ return v8::JustVoid(); } -v8::Maybe<void> V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) { +v8::Maybe<void> V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -745,11 +745,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -784,7 +784,7 @@ return v8::JustVoid(); } -v8::Maybe<void> V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptWrappable* callback_this_value, const String& stringArg) { +v8::Maybe<void> V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& stringArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -854,11 +854,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -892,7 +892,7 @@ return v8::JustVoid(); } -v8::Maybe<void> V8TestCallbackInterface::customVoidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { +v8::Maybe<void> V8TestCallbackInterface::customVoidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestCallbackInterface", @@ -962,11 +962,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -1000,47 +1000,47 @@ return v8::JustVoid(); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethod(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { return Proxy()->voidMethod( callback_this_value); } -v8::Maybe<bool> V8PersistentCallbackInterface<V8TestCallbackInterface>::booleanMethod(ScriptWrappable* callback_this_value) { +v8::Maybe<bool> V8PersistentCallbackInterface<V8TestCallbackInterface>::booleanMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { return Proxy()->booleanMethod( callback_this_value); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodBooleanArg(ScriptWrappable* callback_this_value, bool boolArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodBooleanArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, bool boolArg) { return Proxy()->voidMethodBooleanArg( callback_this_value, boolArg); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodSequenceArg(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodSequenceArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) { return Proxy()->voidMethodSequenceArg( callback_this_value, sequenceArg); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodFloatArg(ScriptWrappable* callback_this_value, float floatArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodFloatArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, float floatArg) { return Proxy()->voidMethodFloatArg( callback_this_value, floatArg); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { return Proxy()->voidMethodTestInterfaceEmptyArg( callback_this_value, testInterfaceEmptyArg); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodTestInterfaceEmptyStringArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::voidMethodTestInterfaceEmptyStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) { return Proxy()->voidMethodTestInterfaceEmptyStringArg( callback_this_value, testInterfaceEmptyArg, stringArg); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::callbackWithThisValueVoidMethodStringArg(ScriptWrappable* callback_this_value, const String& stringArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::callbackWithThisValueVoidMethodStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& stringArg) { return Proxy()->callbackWithThisValueVoidMethodStringArg( callback_this_value, stringArg); } -v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::customVoidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { +v8::Maybe<void> V8PersistentCallbackInterface<V8TestCallbackInterface>::customVoidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) { return Proxy()->customVoidMethodTestInterfaceEmptyArg( callback_this_value, testInterfaceEmptyArg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h index 3a72e75..e6047b9 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_interface.h
@@ -13,6 +13,7 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_interface_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" namespace blink { @@ -34,39 +35,39 @@ // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> voidMethod(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<void> voidMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<bool> booleanMethod(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<bool> booleanMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> voidMethodBooleanArg(ScriptWrappable* callback_this_value, bool boolArg) WARN_UNUSED_RESULT; + v8::Maybe<void> voidMethodBooleanArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, bool boolArg) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> voidMethodSequenceArg(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) WARN_UNUSED_RESULT; + v8::Maybe<void> voidMethodSequenceArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> voidMethodFloatArg(ScriptWrappable* callback_this_value, float floatArg) WARN_UNUSED_RESULT; + v8::Maybe<void> voidMethodFloatArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, float floatArg) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> voidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; + v8::Maybe<void> voidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> voidMethodTestInterfaceEmptyStringArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) WARN_UNUSED_RESULT; + v8::Maybe<void> voidMethodTestInterfaceEmptyStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> callbackWithThisValueVoidMethodStringArg(ScriptWrappable* callback_this_value, const String& stringArg) WARN_UNUSED_RESULT; + v8::Maybe<void> callbackWithThisValueVoidMethodStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& stringArg) WARN_UNUSED_RESULT; // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<void> customVoidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; + v8::Maybe<void> customVoidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; }; template <> @@ -78,15 +79,15 @@ : V8PersistentCallbackInterfaceBase(callback_interface) {} ~V8PersistentCallbackInterface() override = default; - CORE_EXPORT v8::Maybe<void> voidMethod(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<bool> booleanMethod(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> voidMethodBooleanArg(ScriptWrappable* callback_this_value, bool boolArg) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> voidMethodSequenceArg(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> voidMethodFloatArg(ScriptWrappable* callback_this_value, float floatArg) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> voidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> voidMethodTestInterfaceEmptyStringArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> callbackWithThisValueVoidMethodStringArg(ScriptWrappable* callback_this_value, const String& stringArg) WARN_UNUSED_RESULT; - CORE_EXPORT v8::Maybe<void> customVoidMethodTestInterfaceEmptyArg(ScriptWrappable* callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> voidMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<bool> booleanMethod(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> voidMethodBooleanArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, bool boolArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> voidMethodSequenceArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceEmpty>>& sequenceArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> voidMethodFloatArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, float floatArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> voidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> voidMethodTestInterfaceEmptyStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> callbackWithThisValueVoidMethodStringArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& stringArg) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<void> customVoidMethodTestInterfaceEmptyArg(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, TestInterfaceEmpty* testInterfaceEmptyArg) WARN_UNUSED_RESULT; private: V8CallbackInterface* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_check_security.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_check_security.cc index 1f69fb6..09f91b9 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_check_security.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_check_security.cc
@@ -734,7 +734,7 @@ } // HTML 7.2.3.3 CrossOriginGetOwnPropertyHelper ( O, P ) - // https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-) + // https://html.spec.whatwg.org/C/#crossorigingetownpropertyhelper-(-o,-p-) // step 3. If P is "then", @@toStringTag, @@hasInstance, or // @@isConcatSpreadable, then return PropertyDescriptor{ [[Value]]: // undefined, [[Writable]]: false, [[Enumerable]]: false,
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc index 2be000d..f475f2f 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.cc
@@ -83,7 +83,7 @@ return "V8TestLegacyCallbackInterface"; } -v8::Maybe<uint16_t> V8TestLegacyCallbackInterface::acceptNode(ScriptWrappable* callback_this_value, Node* node) { +v8::Maybe<uint16_t> V8TestLegacyCallbackInterface::acceptNode(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, Node* node) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TestLegacyCallbackInterface", @@ -153,11 +153,11 @@ // interface, or if !IsCallable(O) is false, set thisArg to O (overriding // the provided value). this_arg = CallbackObject(); - } else if (!callback_this_value) { + } else if (callback_this_value.IsEmpty()) { // step 2. If thisArg was not given, let thisArg be undefined. this_arg = v8::Undefined(GetIsolate()); } else { - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + this_arg = callback_this_value.V8Value(callback_relevant_script_state); } // step: Let esArgs be the result of converting args to an ECMAScript @@ -203,7 +203,7 @@ } } -v8::Maybe<uint16_t> V8PersistentCallbackInterface<V8TestLegacyCallbackInterface>::acceptNode(ScriptWrappable* callback_this_value, Node* node) { +v8::Maybe<uint16_t> V8PersistentCallbackInterface<V8TestLegacyCallbackInterface>::acceptNode(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, Node* node) { return Proxy()->acceptNode( callback_this_value, node); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h index da89c7e..69b2b62 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_legacy_callback_interface.h
@@ -14,6 +14,7 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_interface_base.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/bindings/wrapper_type_info.h" namespace blink { @@ -47,7 +48,7 @@ // Performs "call a user object's operation". // https://heycam.github.io/webidl/#call-a-user-objects-operation - v8::Maybe<uint16_t> acceptNode(ScriptWrappable* callback_this_value, Node* node) WARN_UNUSED_RESULT; + v8::Maybe<uint16_t> acceptNode(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, Node* node) WARN_UNUSED_RESULT; }; template <> @@ -59,7 +60,7 @@ : V8PersistentCallbackInterfaceBase(callback_interface) {} ~V8PersistentCallbackInterface() override = default; - CORE_EXPORT v8::Maybe<uint16_t> acceptNode(ScriptWrappable* callback_this_value, Node* node) WARN_UNUSED_RESULT; + CORE_EXPORT v8::Maybe<uint16_t> acceptNode(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, Node* node) WARN_UNUSED_RESULT; private: V8CallbackInterface* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc index ac079eff..863a7b4 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.cc
@@ -26,7 +26,7 @@ return "V8TreatNonObjectAsNullBooleanFunction"; } -v8::Maybe<bool> V8TreatNonObjectAsNullBooleanFunction::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<bool> V8TreatNonObjectAsNullBooleanFunction::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TreatNonObjectAsNullBooleanFunction", @@ -83,7 +83,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -123,7 +128,7 @@ } } -v8::Maybe<bool> V8PersistentCallbackFunction<V8TreatNonObjectAsNullBooleanFunction>::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<bool> V8PersistentCallbackFunction<V8TreatNonObjectAsNullBooleanFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { return Proxy()->Invoke( callback_this_value); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h index b7447de..2c06458 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_boolean_function.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8TreatNonObjectAsNullBooleanFunction final : public CallbackFunctionBase { public: static V8TreatNonObjectAsNullBooleanFunction* Create(v8::Local<v8::Object> callback_function) { @@ -34,7 +33,7 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<bool> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<bool> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; }; template <> @@ -49,7 +48,7 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<bool> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<bool> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc index 004aecc..55d7c414 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.cc
@@ -26,7 +26,7 @@ return "V8TreatNonObjectAsNullVoidFunction"; } -v8::Maybe<void> V8TreatNonObjectAsNullVoidFunction::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8TreatNonObjectAsNullVoidFunction::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "TreatNonObjectAsNullVoidFunction", @@ -72,7 +72,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -100,7 +105,7 @@ return v8::JustVoid(); } -void V8TreatNonObjectAsNullVoidFunction::InvokeAndReportException(ScriptWrappable* callback_this_value) { +void V8TreatNonObjectAsNullVoidFunction::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -110,12 +115,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction>::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { return Proxy()->Invoke( callback_this_value); } -void V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction>::InvokeAndReportException(ScriptWrappable* callback_this_value) { +void V8PersistentCallbackFunction<V8TreatNonObjectAsNullVoidFunction>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { Proxy()->InvokeAndReportException( callback_this_value); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h index 6328ae7c..4c37c90b 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_treat_non_object_as_null_void_function.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8TreatNonObjectAsNullVoidFunction final : public CallbackFunctionBase { public: static V8TreatNonObjectAsNullVoidFunction* Create(v8::Local<v8::Object> callback_function) { @@ -34,11 +33,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); }; template <> @@ -53,8 +52,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc index b7de3e0b..edf556a 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.cc
@@ -26,7 +26,7 @@ return "V8VoidCallbackFunction"; } -v8::Maybe<void> V8VoidCallbackFunction::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8VoidCallbackFunction::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunction", @@ -69,7 +69,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -97,7 +102,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunction::InvokeAndReportException(ScriptWrappable* callback_this_value) { +void V8VoidCallbackFunction::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -107,12 +112,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunction>::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunction>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { return Proxy()->Invoke( callback_this_value); } -void V8PersistentCallbackFunction<V8VoidCallbackFunction>::InvokeAndReportException(ScriptWrappable* callback_this_value) { +void V8PersistentCallbackFunction<V8VoidCallbackFunction>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { Proxy()->InvokeAndReportException( callback_this_value); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h index c282f17..0c879c1 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8VoidCallbackFunction final : public CallbackFunctionBase { public: static V8VoidCallbackFunction* Create(v8::Local<v8::Function> callback_function) { @@ -34,11 +33,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); }; template <> @@ -53,8 +52,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc index 6b20056..86e9169 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.cc
@@ -27,7 +27,7 @@ return "V8VoidCallbackFunctionDictionaryArg"; } -v8::Maybe<void> V8VoidCallbackFunctionDictionaryArg::Invoke(ScriptWrappable* callback_this_value, const TestDictionary*& arg) { +v8::Maybe<void> V8VoidCallbackFunctionDictionaryArg::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunctionDictionaryArg", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -103,7 +108,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunctionDictionaryArg::InvokeAndReportException(ScriptWrappable* callback_this_value, const TestDictionary*& arg) { +void V8VoidCallbackFunctionDictionaryArg::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -113,12 +118,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg>::Invoke(ScriptWrappable* callback_this_value, const TestDictionary*& arg) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) { return Proxy()->Invoke( callback_this_value, arg); } -void V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg>::InvokeAndReportException(ScriptWrappable* callback_this_value, const TestDictionary*& arg) { +void V8PersistentCallbackFunction<V8VoidCallbackFunctionDictionaryArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) { Proxy()->InvokeAndReportException( callback_this_value, arg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h index cdfa2b6..b7cbc70 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_dictionary_arg.h
@@ -13,11 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; class TestDictionary; class CORE_EXPORT V8VoidCallbackFunctionDictionaryArg final : public CallbackFunctionBase { @@ -35,11 +35,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const TestDictionary*& arg) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value, const TestDictionary*& arg); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg); }; template <> @@ -54,8 +54,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const TestDictionary*& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value, const TestDictionary*& arg); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const TestDictionary*& arg); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc index be15904e..21e48c17 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.cc
@@ -27,7 +27,7 @@ return "V8VoidCallbackFunctionEnumArg"; } -v8::Maybe<void> V8VoidCallbackFunctionEnumArg::Invoke(ScriptWrappable* callback_this_value, const String& arg) { +v8::Maybe<void> V8VoidCallbackFunctionEnumArg::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunctionEnumArg", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // Enum values provided by Blink must be valid, otherwise typo. #if DCHECK_IS_ON() @@ -123,7 +128,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunctionEnumArg::InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg) { +void V8VoidCallbackFunctionEnumArg::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -133,12 +138,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg>::Invoke(ScriptWrappable* callback_this_value, const String& arg) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { return Proxy()->Invoke( callback_this_value, arg); } -void V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg>::InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg) { +void V8PersistentCallbackFunction<V8VoidCallbackFunctionEnumArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { Proxy()->InvokeAndReportException( callback_this_value, arg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h index af3de796..5278bc6 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_enum_arg.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8VoidCallbackFunctionEnumArg final : public CallbackFunctionBase { public: static V8VoidCallbackFunctionEnumArg* Create(v8::Local<v8::Function> callback_function) { @@ -34,11 +33,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const String& arg) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); }; template <> @@ -53,8 +52,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const String& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc index e58423e..72066b11 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.cc
@@ -27,7 +27,7 @@ return "V8VoidCallbackFunctionInterfaceArg"; } -v8::Maybe<void> V8VoidCallbackFunctionInterfaceArg::Invoke(ScriptWrappable* callback_this_value, HTMLDivElement* divElement) { +v8::Maybe<void> V8VoidCallbackFunctionInterfaceArg::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunctionInterfaceArg", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -103,7 +108,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunctionInterfaceArg::InvokeAndReportException(ScriptWrappable* callback_this_value, HTMLDivElement* divElement) { +void V8VoidCallbackFunctionInterfaceArg::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -113,12 +118,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg>::Invoke(ScriptWrappable* callback_this_value, HTMLDivElement* divElement) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) { return Proxy()->Invoke( callback_this_value, divElement); } -void V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg>::InvokeAndReportException(ScriptWrappable* callback_this_value, HTMLDivElement* divElement) { +void V8PersistentCallbackFunction<V8VoidCallbackFunctionInterfaceArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) { Proxy()->InvokeAndReportException( callback_this_value, divElement); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h index 40b989c..4631276 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_interface_arg.h
@@ -13,12 +13,12 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { class HTMLDivElement; -class ScriptWrappable; class CORE_EXPORT V8VoidCallbackFunctionInterfaceArg final : public CallbackFunctionBase { public: @@ -35,11 +35,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, HTMLDivElement* divElement) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value, HTMLDivElement* divElement); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement); }; template <> @@ -54,8 +54,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, HTMLDivElement* divElement) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value, HTMLDivElement* divElement); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, HTMLDivElement* divElement); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc index 3a3562b..139785e 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.cc
@@ -28,7 +28,7 @@ return "V8VoidCallbackFunctionTestInterfaceSequenceArg"; } -v8::Maybe<void> V8VoidCallbackFunctionTestInterfaceSequenceArg::Invoke(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { +v8::Maybe<void> V8VoidCallbackFunctionTestInterfaceSequenceArg::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunctionTestInterfaceSequenceArg", @@ -71,7 +71,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -104,7 +109,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunctionTestInterfaceSequenceArg::InvokeAndReportException(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { +void V8VoidCallbackFunctionTestInterfaceSequenceArg::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -114,12 +119,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg>::Invoke(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { return Proxy()->Invoke( callback_this_value, arg); } -void V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg>::InvokeAndReportException(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { +void V8PersistentCallbackFunction<V8VoidCallbackFunctionTestInterfaceSequenceArg>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) { Proxy()->InvokeAndReportException( callback_this_value, arg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h index 2602cc3..566cee0 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_test_interface_sequence_arg.h
@@ -13,11 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; class TestInterfaceImplementation; class CORE_EXPORT V8VoidCallbackFunctionTestInterfaceSequenceArg final : public CallbackFunctionBase { @@ -35,11 +35,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg); }; template <> @@ -54,8 +54,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const HeapVector<Member<TestInterfaceImplementation>>& arg); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc index 64d2a5d..1e6dad30 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.cc
@@ -27,7 +27,7 @@ return "V8VoidCallbackFunctionTypedef"; } -v8::Maybe<void> V8VoidCallbackFunctionTypedef::Invoke(ScriptWrappable* callback_this_value, const String& arg) { +v8::Maybe<void> V8VoidCallbackFunctionTypedef::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunctionTypedef", @@ -70,7 +70,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -103,7 +108,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunctionTypedef::InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg) { +void V8VoidCallbackFunctionTypedef::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -113,12 +118,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef>::Invoke(ScriptWrappable* callback_this_value, const String& arg) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { return Proxy()->Invoke( callback_this_value, arg); } -void V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef>::InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg) { +void V8PersistentCallbackFunction<V8VoidCallbackFunctionTypedef>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) { Proxy()->InvokeAndReportException( callback_this_value, arg); }
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h index 8aeaf9af..cc98eb4 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_void_callback_function_typedef.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class CORE_EXPORT V8VoidCallbackFunctionTypedef final : public CallbackFunctionBase { public: static V8VoidCallbackFunctionTypedef* Create(v8::Local<v8::Function> callback_function) { @@ -34,11 +33,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const String& arg) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); }; template <> @@ -53,8 +52,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value, const String& arg) WARN_UNUSED_RESULT; - CORE_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value, const String& arg); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg) WARN_UNUSED_RESULT; + CORE_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value, const String& arg); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc index a0260ea..11e97cee 100644 --- a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc +++ b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.cc
@@ -26,7 +26,7 @@ return "V8VoidCallbackFunctionModules"; } -v8::Maybe<void> V8VoidCallbackFunctionModules::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8VoidCallbackFunctionModules::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { ScriptState* callback_relevant_script_state = CallbackRelevantScriptStateOrThrowException( "VoidCallbackFunctionModules", @@ -69,7 +69,12 @@ function = CallbackFunction(); v8::Local<v8::Value> this_arg; - this_arg = ToV8(callback_this_value, callback_relevant_script_state); + if (callback_this_value.IsEmpty()) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = callback_this_value.V8Value(callback_relevant_script_state); + } // step: Let esArgs be the result of converting args to an ECMAScript // arguments list. If this throws an exception, set completion to the @@ -97,7 +102,7 @@ return v8::JustVoid(); } -void V8VoidCallbackFunctionModules::InvokeAndReportException(ScriptWrappable* callback_this_value) { +void V8VoidCallbackFunctionModules::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); @@ -107,12 +112,12 @@ ALLOW_UNUSED_LOCAL(maybe_result); } -v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionModules>::Invoke(ScriptWrappable* callback_this_value) { +v8::Maybe<void> V8PersistentCallbackFunction<V8VoidCallbackFunctionModules>::Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { return Proxy()->Invoke( callback_this_value); } -void V8PersistentCallbackFunction<V8VoidCallbackFunctionModules>::InvokeAndReportException(ScriptWrappable* callback_this_value) { +void V8PersistentCallbackFunction<V8VoidCallbackFunctionModules>::InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) { Proxy()->InvokeAndReportException( callback_this_value); }
diff --git a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h index 7171e496..5f90cd6 100644 --- a/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h +++ b/third_party/blink/renderer/bindings/tests/results/modules/v8_void_callback_function_modules.h
@@ -13,12 +13,11 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { -class ScriptWrappable; - class MODULES_EXPORT V8VoidCallbackFunctionModules final : public CallbackFunctionBase { public: static V8VoidCallbackFunctionModules* Create(v8::Local<v8::Function> callback_function) { @@ -34,11 +33,11 @@ // Performs "invoke". // https://heycam.github.io/webidl/#es-invoking-callback-functions - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; // Performs "invoke", and then reports an exception, if any, to the global // error handler such as DevTools' console. - void InvokeAndReportException(ScriptWrappable* callback_this_value); + void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); }; template <> @@ -53,8 +52,8 @@ // Returns a wrapper-tracing version of this callback function. V8CallbackFunction* ToNonV8Persistent() { return Proxy(); } - v8::Maybe<void> Invoke(ScriptWrappable* callback_this_value) WARN_UNUSED_RESULT; - MODULES_EXPORT void InvokeAndReportException(ScriptWrappable* callback_this_value); + v8::Maybe<void> Invoke(bindings::V8ValueOrScriptWrappableAdapter callback_this_value) WARN_UNUSED_RESULT; + MODULES_EXPORT void InvokeAndReportException(bindings::V8ValueOrScriptWrappableAdapter callback_this_value); private: V8CallbackFunction* Proxy() {
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl index 5ff29d8..039ec51 100644 --- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl +++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl
@@ -162,7 +162,7 @@ {# Check for equality in case we can bail out before creating a new NinePieceImage. #} {% if modifier_type == 'Outset' %} if (style_building_utils::BorderImageLengthMatchesAllSides(current_image.Outset(), - BorderImageLength(Length(0, kFixed)))) + BorderImageLength(Length::Fixed(0)))) return; {% elif modifier_type == 'Repeat' %} if (current_image.HorizontalRule() == kStretchImageRule && @@ -172,17 +172,17 @@ // Masks have a different initial value for slices. Preserve the value of 0 // for backwards compatibility. if (current_image.Fill() == true && - style_building_utils::LengthMatchesAllSides(current_image.ImageSlices(), Length(0, kFixed))) + style_building_utils::LengthMatchesAllSides(current_image.ImageSlices(), Length::Fixed(0))) return; {% elif modifier_type == 'Slice' and not is_mask_box %} if (current_image.Fill() == false && - style_building_utils::LengthMatchesAllSides(current_image.ImageSlices(), Length(100, kPercent))) + style_building_utils::LengthMatchesAllSides(current_image.ImageSlices(), Length::Percent(100))) return; {% elif modifier_type == 'Width' and is_mask_box %} // Masks have a different initial value for widths. Preserve the value of // 'auto' for backwards compatibility. if (style_building_utils::BorderImageLengthMatchesAllSides(current_image.BorderSlices(), - BorderImageLength(Length(kAuto)))) + BorderImageLength(Length::Auto()))) return; {% elif modifier_type == 'Width' and not is_mask_box %} if (style_building_utils::BorderImageLengthMatchesAllSides(current_image.BorderSlices(), @@ -191,18 +191,18 @@ {% endif %} NinePieceImage image(current_image); {% if modifier_type == 'Outset' %} - image.SetOutset(Length(0, kFixed)); + image.SetOutset(Length::Fixed(0)); {% elif modifier_type == 'Repeat' %} image.SetHorizontalRule(kStretchImageRule); image.SetVerticalRule(kStretchImageRule); {% elif modifier_type == 'Slice' and is_mask_box %} - image.SetImageSlices(LengthBox({{ (['Length(0, kFixed)']*4) | join(', ') }})); + image.SetImageSlices(LengthBox({{ (['Length::Fixed(0)']*4) | join(', ') }})); image.SetFill(true); {% elif modifier_type == 'Slice' and not is_mask_box %} - image.SetImageSlices(LengthBox({{ (['Length(100, kPercent)']*4) | join(', ') }})); + image.SetImageSlices(LengthBox({{ (['Length::Percent(100)']*4) | join(', ') }})); image.SetFill(false); {% elif modifier_type == 'Width' %} - image.SetBorderSlices({{ 'Length(kAuto)' if is_mask_box else '1.0' }}); + image.SetBorderSlices({{ 'Length::Auto()' if is_mask_box else '1.0' }}); {% endif %} state.Style()->{{setter}}(image); {% endcall %}
diff --git a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl index 9de161a..752078d 100644 --- a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl +++ b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_initial_values.h.tmpl
@@ -68,15 +68,15 @@ } // -webkit-perspective-origin-x - static Length InitialPerspectiveOriginX() { return Length(50.0, kPercent); } + static Length InitialPerspectiveOriginX() { return Length::Percent(50.0); } // -webkit-perspective-origin-y - static Length InitialPerspectiveOriginY() { return Length(50.0, kPercent); } + static Length InitialPerspectiveOriginY() { return Length::Percent(50.0); } // -webkit-transform-origin-x - static Length InitialTransformOriginX() { return Length(50.0, kPercent); } + static Length InitialTransformOriginX() { return Length::Percent(50.0); } // -webkit-transform-origin-y - static Length InitialTransformOriginY() { return Length(50.0, kPercent); } + static Length InitialTransformOriginY() { return Length::Percent(50.0); } // -webkit-transform-origin-z static float InitialTransformOriginZ() { return 0; }
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index ade018d..06e29b6 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -2113,7 +2113,7 @@ "page/focus_controller_test.cc", "page/page_popup_client_test.cc", "page/print_context_test.cc", - "page/scrolling/fragment_anchor_test.cc", + "page/scrolling/element_fragment_anchor_test.cc", "page/scrolling/main_thread_scrolling_reasons_test.cc", "page/scrolling/root_scroller_test.cc", "page/scrolling/scroll_into_view_test.cc", @@ -2121,6 +2121,7 @@ "page/scrolling/scroll_state_test.cc", "page/scrolling/scrolling_coordinator_test.cc", "page/scrolling/snap_coordinator_test.cc", + "page/scrolling/text_fragment_anchor_test.cc", "page/slot_scoped_traversal_test.cc", "page/spatial_navigation_test.cc", "page/touch_adjustment_test.cc",
diff --git a/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc b/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc index 8a077911..ee5cb16 100644 --- a/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc +++ b/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc
@@ -83,8 +83,8 @@ return Unwrap( CSSPositionAxisListInterpolationType::ConvertPositionAxisCSSValue( *coordinate)); - return Unwrap(LengthInterpolationFunctions::MaybeConvertLength( - Length(50, kPercent), 1)); + return Unwrap( + LengthInterpolationFunctions::MaybeConvertLength(Length::Percent(50), 1)); } std::unique_ptr<InterpolableValue> ConvertCoordinate(
diff --git a/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc index 02b0d00..c128890 100644 --- a/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc
@@ -430,14 +430,14 @@ return clampTo<double>(ToInterpolableNumber(list.Get(index))->Value(), 0); case SideType::kAuto: - return Length(kAuto); + return Length::Auto(); case SideType::kLength: return LengthInterpolationFunctions::CreateLength( *list.Get(index), non_interpolable_values[index].get(), state.CssToLengthConversionData(), kValueRangeNonNegative); default: NOTREACHED(); - return Length(kAuto); + return Length::Auto(); } }; BorderImageLengthBox box(convert_side(kSideTop), convert_side(kSideRight),
diff --git a/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc index e66554d..8046ee4 100644 --- a/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc
@@ -180,10 +180,10 @@ if (underlying_autos.is_auto) return nullptr; LengthBox neutral_box( - underlying_autos.is_top_auto ? Length(kAuto) : Length(0, kFixed), - underlying_autos.is_right_auto ? Length(kAuto) : Length(0, kFixed), - underlying_autos.is_bottom_auto ? Length(kAuto) : Length(0, kFixed), - underlying_autos.is_left_auto ? Length(kAuto) : Length(0, kFixed)); + underlying_autos.is_top_auto ? Length::Auto() : Length::Fixed(0), + underlying_autos.is_right_auto ? Length::Auto() : Length::Fixed(0), + underlying_autos.is_bottom_auto ? Length::Auto() : Length::Fixed(0), + underlying_autos.is_left_auto ? Length::Auto() : Length::Fixed(0)); return CreateClipValue(neutral_box, 1); } @@ -287,7 +287,7 @@ const InterpolableList& list = ToInterpolableList(interpolable_value); const auto& convert_index = [&list, &state](bool is_auto, wtf_size_t index) { if (is_auto) - return Length(kAuto); + return Length::Auto(); return LengthInterpolationFunctions::CreateLength( *list.Get(index), nullptr, state.CssToLengthConversionData(), kValueRangeAll);
diff --git a/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc index ac3b543..bcddce8 100644 --- a/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc
@@ -162,10 +162,14 @@ conversion_checkers.push_back( UnderlyingSliceTypesChecker::Create(underlying_types)); LengthBox zero_box( - Length(0, underlying_types.is_number[kSideTop] ? kFixed : kPercent), - Length(0, underlying_types.is_number[kSideRight] ? kFixed : kPercent), - Length(0, underlying_types.is_number[kSideBottom] ? kFixed : kPercent), - Length(0, underlying_types.is_number[kSideLeft] ? kFixed : kPercent)); + underlying_types.is_number[kSideTop] ? Length::Fixed(0) + : Length::Percent(0), + underlying_types.is_number[kSideRight] ? Length::Fixed(0) + : Length::Percent(0), + underlying_types.is_number[kSideBottom] ? Length::Fixed(0) + : Length::Percent(0), + underlying_types.is_number[kSideLeft] ? Length::Fixed(0) + : Length::Percent(0)); return ConvertImageSlice(ImageSlice(zero_box, underlying_types.fill), 1); } @@ -272,9 +276,8 @@ const auto& convert_side = [&types, &list, &style](wtf_size_t index) { float value = clampTo<float>(ToInterpolableNumber(list.Get(index))->Value(), 0); - return types.is_number[index] - ? Length(value * style.EffectiveZoom(), kFixed) - : Length(value, kPercent); + return types.is_number[index] ? Length::Fixed(value * style.EffectiveZoom()) + : Length::Percent(value); }; LengthBox box(convert_side(kSideTop), convert_side(kSideRight), convert_side(kSideBottom), convert_side(kSideLeft));
diff --git a/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc index 2699091..f94809b 100644 --- a/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc
@@ -137,7 +137,7 @@ ToCSSTextIndentNonInterpolableValue(*underlying.non_interpolable_value) .Mode(); conversion_checkers.push_back(UnderlyingIndentModeChecker::Create(mode)); - return CreateValue(Length(0, kFixed), mode, 1); + return CreateValue(Length::Fixed(0), mode, 1); } InterpolationValue CSSTextIndentInterpolationType::MaybeConvertInitial(
diff --git a/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc index fb731e6..69a4e5e 100644 --- a/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc
@@ -90,7 +90,7 @@ translate->Y(), zoom) .interpolable_value); result->Set(kTranslateZ, LengthInterpolationFunctions::MaybeConvertLength( - Length(translate->Z(), kFixed), zoom) + Length::Fixed(translate->Z()), zoom) .interpolable_value); return InterpolationValue(std::move(result)); }
diff --git a/third_party/blink/renderer/core/animation/length_interpolation_functions.cc b/third_party/blink/renderer/core/animation/length_interpolation_functions.cc index cbf455a..bdf01ce 100644 --- a/third_party/blink/renderer/core/animation/length_interpolation_functions.cc +++ b/third_party/blink/renderer/core/animation/length_interpolation_functions.cc
@@ -196,10 +196,9 @@ range)); } if (has_percentage) - return Length(ClampToRange(percentage, range), kPercent); - return Length( - CSSPrimitiveValue::ClampToCSSLengthRange(ClampToRange(pixels, range)), - kFixed); + return Length::Percent(ClampToRange(percentage, range)); + return Length::Fixed( + CSSPrimitiveValue::ClampToCSSLengthRange(ClampToRange(pixels, range))); } const CSSValue* LengthInterpolationFunctions::CreateCSSValue(
diff --git a/third_party/blink/renderer/core/animation/length_list_property_functions.cc b/third_party/blink/renderer/core/animation/length_list_property_functions.cc index 10b57c6..c5a2cc7 100644 --- a/third_party/blink/renderer/core/animation/length_list_property_functions.cc +++ b/third_party/blink/renderer/core/animation/length_list_property_functions.cc
@@ -123,7 +123,7 @@ Vector<Length>& result) { result.push_back(transform_origin.X()); result.push_back(transform_origin.Y()); - result.push_back(Length(transform_origin.Z(), kFixed)); + result.push_back(Length::Fixed(transform_origin.Z())); return true; }
diff --git a/third_party/blink/renderer/core/animation/length_property_functions.cc b/third_party/blink/renderer/core/animation/length_property_functions.cc index d0ea0f2..c11eb097 100644 --- a/third_party/blink/renderer/core/animation/length_property_functions.cc +++ b/third_party/blink/renderer/core/animation/length_property_functions.cc
@@ -106,15 +106,14 @@ case CSSPropertyBorderLeftWidth: case CSSPropertyBorderRightWidth: case CSSPropertyBorderTopWidth: - result = Length(ComputedStyleInitialValues::InitialBorderWidth(), kFixed); + result = Length::Fixed(ComputedStyleInitialValues::InitialBorderWidth()); return true; case CSSPropertyOutlineWidth: - result = - Length(ComputedStyleInitialValues::InitialOutlineWidth(), kFixed); + result = Length::Fixed(ComputedStyleInitialValues::InitialOutlineWidth()); return true; case CSSPropertyColumnRuleWidth: result = - Length(ComputedStyleInitialValues::InitialColumnRuleWidth(), kFixed); + Length::Fixed(ComputedStyleInitialValues::InitialColumnRuleWidth()); return true; default: @@ -230,31 +229,31 @@ return true; case CSSPropertyBorderBottomWidth: - result = Length(style.BorderBottomWidth(), kFixed); + result = Length::Fixed(style.BorderBottomWidth()); return true; case CSSPropertyBorderLeftWidth: - result = Length(style.BorderLeftWidth(), kFixed); + result = Length::Fixed(style.BorderLeftWidth()); return true; case CSSPropertyBorderRightWidth: - result = Length(style.BorderRightWidth(), kFixed); + result = Length::Fixed(style.BorderRightWidth()); return true; case CSSPropertyBorderTopWidth: - result = Length(style.BorderTopWidth(), kFixed); + result = Length::Fixed(style.BorderTopWidth()); return true; case CSSPropertyLetterSpacing: - result = Length(style.LetterSpacing(), kFixed); + result = Length::Fixed(style.LetterSpacing()); return true; case CSSPropertyOutlineOffset: - result = Length(style.OutlineOffset(), kFixed); + result = Length::Fixed(style.OutlineOffset()); return true; case CSSPropertyOutlineWidth: - result = Length(style.OutlineWidth(), kFixed); + result = Length::Fixed(style.OutlineWidth()); return true; case CSSPropertyWebkitBorderHorizontalSpacing: - result = Length(style.HorizontalBorderSpacing(), kFixed); + result = Length::Fixed(style.HorizontalBorderSpacing()); return true; case CSSPropertyWebkitBorderVerticalSpacing: - result = Length(style.VerticalBorderSpacing(), kFixed); + result = Length::Fixed(style.VerticalBorderSpacing()); return true; case CSSPropertyRowGap: if (style.RowGap().IsNormal()) @@ -267,13 +266,13 @@ result = style.ColumnGap().GetLength(); return true; case CSSPropertyColumnRuleWidth: - result = Length(style.ColumnRuleWidth(), kFixed); + result = Length::Fixed(style.ColumnRuleWidth()); return true; case CSSPropertyWebkitTransformOriginZ: - result = Length(style.TransformOriginZ(), kFixed); + result = Length::Fixed(style.TransformOriginZ()); return true; case CSSPropertyWordSpacing: - result = Length(style.WordSpacing(), kFixed); + result = Length::Fixed(style.WordSpacing()); return true; case CSSPropertyBaselineShift: @@ -290,7 +289,7 @@ case CSSPropertyPerspective: if (!style.HasPerspective()) return false; - result = Length(style.Perspective(), kFixed); + result = Length::Fixed(style.Perspective()); return true; case CSSPropertyStrokeWidth: DCHECK(!IsZoomedLength(CSSProperty::Get(CSSPropertyStrokeWidth))); @@ -304,7 +303,7 @@ case CSSPropertyColumnWidth: if (style.HasAutoColumnWidth()) return false; - result = Length(style.ColumnWidth(), kFixed); + result = Length::Fixed(style.ColumnWidth()); return true; default: return false;
diff --git a/third_party/blink/renderer/core/animation/number_property_functions.cc b/third_party/blink/renderer/core/animation/number_property_functions.cc index 77bac29f..fd3845d 100644 --- a/third_party/blink/renderer/core/animation/number_property_functions.cc +++ b/third_party/blink/renderer/core/animation/number_property_functions.cc
@@ -140,7 +140,7 @@ style.SetFloodOpacity(value); return true; case CSSPropertyLineHeight: - style.SetLineHeight(Length(value * 100, kPercent)); + style.SetLineHeight(Length::Percent(value * 100)); return true; case CSSPropertyOpacity: style.SetOpacity(value);
diff --git a/third_party/blink/renderer/core/animation/size_interpolation_functions.cc b/third_party/blink/renderer/core/animation/size_interpolation_functions.cc index a7032b228..6488247 100644 --- a/third_party/blink/renderer/core/animation/size_interpolation_functions.cc +++ b/third_party/blink/renderer/core/animation/size_interpolation_functions.cc
@@ -180,7 +180,7 @@ const CSSToLengthConversionData& conversion_data) { if (non_interpolable_value.IsKeyword()) { DCHECK_EQ(non_interpolable_value.Keyword(), CSSValueAuto); - return Length(kAuto); + return Length::Auto(); } return LengthInterpolationFunctions::CreateLength( interpolable_value, non_interpolable_value.LengthNonInterpolableValue(),
diff --git a/third_party/blink/renderer/core/core_idl_files.gni b/third_party/blink/renderer/core/core_idl_files.gni index da867fb..33b5a2f 100644 --- a/third_party/blink/renderer/core/core_idl_files.gni +++ b/third_party/blink/renderer/core/core_idl_files.gni
@@ -548,6 +548,7 @@ "frame/navigator_on_line.idl", "frame/navigator_scheduling.idl", "frame/navigator_user_activation.idl", + "frame/navigator_user_agent.idl", "frame/window_event_handlers.idl", "frame/window_or_worker_global_scope.idl", "fullscreen/document_fullscreen.idl", @@ -653,6 +654,7 @@ "frame/scroll_into_view_options.idl", "frame/scroll_options.idl", "frame/scroll_to_options.idl", + "frame/user_agent.idl", "frame/window_post_message_options.idl", "fullscreen/fullscreen_options.idl", "geometry/dom_matrix_2d_init.idl",
diff --git a/third_party/blink/renderer/core/css/basic_shape_functions.cc b/third_party/blink/renderer/core/css/basic_shape_functions.cc index f27bc7ff..78bd7d9a 100644 --- a/third_party/blink/renderer/core/css/basic_shape_functions.cc +++ b/third_party/blink/renderer/core/css/basic_shape_functions.cc
@@ -206,14 +206,14 @@ static Length ConvertToLength(const StyleResolverState& state, const CSSPrimitiveValue* value) { if (!value) - return Length(0, kFixed); + return Length::Fixed(0); return value->ConvertToLength(state.CssToLengthConversionData()); } static LengthSize ConvertToLengthSize(const StyleResolverState& state, const CSSValuePair* value) { if (!value) - return LengthSize(Length(0, kFixed), Length(0, kFixed)); + return LengthSize(Length::Fixed(0), Length::Fixed(0)); return LengthSize( ConvertToLength(state, &ToCSSPrimitiveValue(value->First())), @@ -224,7 +224,7 @@ const StyleResolverState& state, CSSValue* value) { BasicShapeCenterCoordinate::Direction direction; - Length offset = Length(0, kFixed); + Length offset = Length::Fixed(0); CSSValueID keyword = CSSValueTop; if (!value) { @@ -250,7 +250,7 @@ break; case CSSValueCenter: direction = BasicShapeCenterCoordinate::kTopLeft; - offset = Length(50, kPercent); + offset = Length::Percent(50); break; default: NOTREACHED();
diff --git a/third_party/blink/renderer/core/css/css_primitive_value.cc b/third_party/blink/renderer/core/css/css_primitive_value.cc index 11e9d16..fa435f0 100644 --- a/third_party/blink/renderer/core/css/css_primitive_value.cc +++ b/third_party/blink/renderer/core/css/css_primitive_value.cc
@@ -282,8 +282,8 @@ template <> Length CSSPrimitiveValue::ComputeLength( const CSSToLengthConversionData& conversion_data) const { - return Length(ClampToCSSLengthRange(ComputeLengthDouble(conversion_data)), - kFixed); + return Length::Fixed( + ClampToCSSLengthRange(ComputeLengthDouble(conversion_data))); } template <> @@ -406,7 +406,7 @@ if (IsLength()) return ComputeLength<Length>(conversion_data); if (IsPercentage()) - return Length(GetDoubleValue(), kPercent); + return Length::Percent(GetDoubleValue()); DCHECK(IsCalculated()); return Length(CssCalcValue()->ToCalcValue(conversion_data)); }
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index 316e06a..6ffc1ab 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -1026,7 +1026,7 @@ field_group: "surround", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], - default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", + default_value: "LengthSize(Length::Fixed(0), Length::Fixed(0))", type_name: "LengthSize", converter: "ConvertRadius", typedom_types: ["Length", "Percentage"], @@ -1038,7 +1038,7 @@ field_group: "surround", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], - default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", + default_value: "LengthSize(Length::Fixed(0), Length::Fixed(0))", type_name: "LengthSize", converter: "ConvertRadius", typedom_types: ["Length", "Percentage"], @@ -1238,7 +1238,7 @@ field_group: "surround", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], - default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", + default_value: "LengthSize(Length::Fixed(0), Length::Fixed(0))", type_name: "LengthSize", converter: "ConvertRadius", typedom_types: ["Length", "Percentage"], @@ -1250,7 +1250,7 @@ field_group: "surround", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], - default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", + default_value: "LengthSize(Length::Fixed(0), Length::Fixed(0))", type_name: "LengthSize", converter: "ConvertRadius", typedom_types: ["Length", "Percentage"], @@ -1639,7 +1639,7 @@ interpolable: true, field_group: "*", field_template: "<length>", - default_value: "Length(kAuto)", + default_value: "Length::Auto()", converter: "ConvertLengthOrAuto", typedom_types: ["Keyword", "Length", "Percentage"], keywords: ["auto"] @@ -1716,7 +1716,7 @@ field_template: "external", include_paths: ["third_party/blink/renderer/platform/wtf/vector.h", "third_party/blink/renderer/core/style/grid_track_size.h"], - default_value: "Vector<GridTrackSize>(1, GridTrackSize(Length(kAuto)))", + default_value: "Vector<GridTrackSize>(1, GridTrackSize(Length::Auto()))", type_name: "Vector<GridTrackSize>", converter: "ConvertGridTrackSizeList", keywords: ["auto", "min-content", "max-content"], @@ -1743,7 +1743,7 @@ field_template: "external", include_paths: ["third_party/blink/renderer/platform/wtf/vector.h", "third_party/blink/renderer/core/style/grid_track_size.h"], - default_value: "Vector<GridTrackSize>(1, GridTrackSize(Length(kAuto)))", + default_value: "Vector<GridTrackSize>(1, GridTrackSize(Length::Auto()))", type_name: "Vector<GridTrackSize>", converter: "ConvertGridTrackSizeList", keywords: ["auto", "min-content", "max-content"], @@ -1964,7 +1964,7 @@ inherited: true, field_group: "inherited", field_template: "<length>", - default_value: "Length(-100.0, kPercent)", + default_value: "Length::Percent(-100.0)", getter: "SpecifiedLineHeight", computed_style_custom_functions: ["getter"], converter: "ConvertLineHeight", @@ -2038,7 +2038,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertQuirkyLength", keywords: ["auto"], typedom_types: ["Keyword", "Length", "Percentage"] @@ -2050,7 +2050,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertQuirkyLength", keywords: ["auto"], typedom_types: ["Keyword", "Length", "Percentage"] @@ -2062,7 +2062,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertQuirkyLength", keywords: ["auto"], typedom_types: ["Keyword", "Length", "Percentage"] @@ -2074,7 +2074,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertQuirkyLength", keywords: ["auto"], typedom_types: ["Keyword", "Length", "Percentage"] @@ -2139,7 +2139,7 @@ interpolable: true, field_group: "box", field_template: "<length>", - default_value: "Length(kMaxSizeNone)", + default_value: "Length::MaxSizeNone()", converter: "ConvertLengthMaxSizing", keywords: ["none"], typedom_types: ["Keyword", "Length", "Percentage"] @@ -2151,7 +2151,7 @@ interpolable: true, field_group: "box", field_template: "<length>", - default_value: "Length(kMaxSizeNone)", + default_value: "Length::MaxSizeNone()", converter: "ConvertLengthMaxSizing", keywords: ["none"], typedom_types: ["Keyword", "Length", "Percentage"] @@ -2211,7 +2211,7 @@ field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], - default_value: "LengthPoint(Length(50.0, kPercent), Length(50.0, kPercent))", + default_value: "LengthPoint(Length::Percent(50.0), Length::Percent(50.0))", type_name: "LengthPoint", converter: "ConvertPosition", typedom_types: ["Keyword", "Position"], @@ -2224,7 +2224,7 @@ field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], - default_value: "LengthPoint(Length(kAuto), Length(kAuto))", + default_value: "LengthPoint(Length::Auto(), Length::Auto())", type_name: "LengthPoint", converter: "ConvertPositionOrAuto", keywords: ["auto"], @@ -2236,7 +2236,7 @@ interpolable: true, field_group: "*", field_template: "<length>", - default_value: "Length(0, kFixed)", + default_value: "Length::Fixed(0)", converter: "ConvertLength", typedom_types: ["Length", "Percentage"] }, @@ -2262,7 +2262,7 @@ field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], - default_value: "LengthPoint(Length(kAuto), Length(kAuto))", + default_value: "LengthPoint(Length::Auto(), Length::Auto())", type_name: "LengthPoint", converter: "ConvertPositionOrAuto", keywords: ["auto"], @@ -2442,7 +2442,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertLength", typedom_types: ["Keyword", "Length", "Percentage"] }, @@ -2453,7 +2453,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertLength", typedom_types: ["Keyword", "Length", "Percentage"] }, @@ -2464,7 +2464,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertLength", typedom_types: ["Keyword", "Length", "Percentage"] }, @@ -2475,7 +2475,7 @@ layout_dependent: true, field_group: "surround", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", converter: "ConvertLength", typedom_types: ["Keyword", "Length", "Percentage"] }, @@ -2508,7 +2508,7 @@ field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], - default_value: "LengthPoint(Length(50.0, kPercent), Length(50.0, kPercent))", + default_value: "LengthPoint(Length::Percent(50.0), Length::Percent(50.0))", type_name: "LengthPoint", converter: "ConvertPosition", typedom_types: ["Position"] @@ -2834,7 +2834,7 @@ interpolable: true, field_group: "*", field_template: "<length>", - default_value: "Length(0, kFixed)", + default_value: "Length::Fixed(0)", converter: "ConvertLength", keywords: ["none"], typedom_types: ["Length", "Percentage"] @@ -3100,7 +3100,7 @@ inherited: true, field_group: "*", field_template: "<length>", - default_value: "Length(kFixed)", + default_value: "Length::Fixed()", style_builder_custom_functions: ["initial", "inherit", "value"], typedom_types: ["Length", "Percentage"] }, @@ -3237,7 +3237,7 @@ field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/core/style/transform_origin.h"], - default_value: "TransformOrigin(Length(50.0, kPercent), Length(50.0, kPercent), 0)", + default_value: "TransformOrigin(Length::Percent(50.0), Length::Percent(50.0), 0)", getter: "GetTransformOrigin", type_name: "TransformOrigin", converter: "ConvertTransformOrigin",
diff --git a/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc index a16199c..1cedbe1 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc
@@ -64,7 +64,7 @@ switch (ToCSSIdentifierValue(value).GetValueID()) { case CSSValueBaseline: svg_style.SetBaselineShift(BS_LENGTH); - svg_style.SetBaselineShiftValue(Length(kFixed)); + svg_style.SetBaselineShiftValue(Length::Fixed()); return; case CSSValueSub: svg_style.SetBaselineShift(BS_SUB);
diff --git a/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc index 4377366..d029aee 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc
@@ -22,7 +22,7 @@ ToCSSIdentifierValue(value).GetValueID() != CSSValueWebkitMatchParent) { // Special case for th elements - UA stylesheet text-align does not apply if // parent's computed value for text-align is not its initial value - // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 + // https://html.spec.whatwg.org/C/#tables-2 const CSSIdentifierValue& ident_value = ToCSSIdentifierValue(value); if (ident_value.GetValueID() == CSSValueInternalCenter && state.ParentStyle()->GetTextAlign() !=
diff --git a/third_party/blink/renderer/core/css/resolver/css_to_style_map.cc b/third_party/blink/renderer/core/css/resolver/css_to_style_map.cc index 944103d..38966d6e 100644 --- a/third_party/blink/renderer/core/css/resolver/css_to_style_map.cc +++ b/third_party/blink/renderer/core/css/resolver/css_to_style_map.cc
@@ -568,8 +568,8 @@ static Length ConvertBorderImageSliceSide(const CSSPrimitiveValue& value) { if (value.IsPercentage()) - return Length(value.GetDoubleValue(), kPercent); - return Length(round(value.GetDoubleValue()), kFixed); + return Length::Percent(value.GetDoubleValue()); + return Length::Fixed(round(value.GetDoubleValue())); } void CSSToStyleMap::MapNinePieceImageSlice(StyleResolverState&, @@ -611,7 +611,7 @@ StyleResolverState& state, const CSSValue& value) { if (!value.IsQuadValue()) - return BorderImageLengthBox(Length(kAuto)); + return BorderImageLengthBox(Length::Auto()); const CSSQuadValue& slices = ToCSSQuadValue(value); // Set up a border image length box to represent our image slices.
diff --git a/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc b/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc index 8b147e0..82077dc 100644 --- a/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc
@@ -212,7 +212,7 @@ break; } case CSSValueBlur: { - Length std_deviation = Length(0, kFixed); + Length std_deviation = Length::Fixed(0); if (filter_value->length() >= 1) { std_deviation = first_value->ConvertToLength(conversion_data); } @@ -296,7 +296,7 @@ break; } case CSSValueBlur: { - Length std_deviation = Length(0, kFixed); + Length std_deviation = Length::Fixed(0); if (filter_value->length() >= 1) { std_deviation = first_value->ConvertToLength(conversion_data); }
diff --git a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc index 0b552a6..a358499 100644 --- a/third_party/blink/renderer/core/css/resolver/style_adjuster.cc +++ b/third_party/blink/renderer/core/css/resolver/style_adjuster.cc
@@ -196,7 +196,7 @@ // Certain elements (<a>, <font>) override text decoration colors. "The font // element is expected to override the color of any text decoration that spans // the text of the element to the used value of the element's 'color' property." -// (https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3) +// (https://html.spec.whatwg.org/C/#phrasing-content-3) // The <a> behavior is non-standard. static bool OverridesTextDecorationColors(const Element* element) { return element &&
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index 90a2408..0f3d3358 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -69,11 +69,11 @@ if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == CSSValueMinContent) - return Length(kMinContent); + return Length::MinContent(); if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == CSSValueMaxContent) - return Length(kMaxContent); + return Length::MaxContent(); return StyleBuilderConverter::ConvertLengthOrAuto(state, value); } @@ -1005,7 +1005,7 @@ const CSSValue& value) { if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == CSSValueAuto) - return Length(kAuto); + return Length::Auto(); return ToCSSPrimitiveValue(value).ConvertToLength( state.CssToLengthConversionData()); } @@ -1019,17 +1019,17 @@ switch (identifier_value.GetValueID()) { case CSSValueMinContent: case CSSValueWebkitMinContent: - return Length(kMinContent); + return Length::MinContent(); case CSSValueMaxContent: case CSSValueWebkitMaxContent: - return Length(kMaxContent); + return Length::MaxContent(); case CSSValueWebkitFillAvailable: - return Length(kFillAvailable); + return Length::FillAvailable(); case CSSValueWebkitFitContent: case CSSValueFitContent: - return Length(kFitContent); + return Length::FitContent(); case CSSValueAuto: - return Length(kAuto); + return Length::Auto(); default: NOTREACHED(); return Length(); @@ -1040,7 +1040,7 @@ const CSSValue& value) { if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == CSSValueNone) - return Length(kMaxSizeNone); + return Length::MaxSizeNone(); return ConvertLengthSizing(state, value); } @@ -1071,22 +1071,19 @@ LineHeightToLengthConversionData(state)); } if (primitive_value.IsPercentage()) { - return Length( + return Length::Fixed( (state.Style()->ComputedFontSize() * primitive_value.GetIntValue()) / - 100.0, - kFixed); + 100.0); } if (primitive_value.IsNumber()) { - return Length(clampTo<float>(primitive_value.GetDoubleValue() * 100.0), - kPercent); + return Length::Percent( + clampTo<float>(primitive_value.GetDoubleValue() * 100.0)); } if (primitive_value.IsCalculated()) { Length zoomed_length = Length(primitive_value.CssCalcValue()->ToCalcValue( LineHeightToLengthConversionData(state))); - return Length( - ValueForLength(zoomed_length, - LayoutUnit(state.Style()->ComputedFontSize())), - kFixed); + return Length::Fixed(ValueForLength( + zoomed_length, LayoutUnit(state.Style()->ComputedFontSize()))); } } @@ -1153,7 +1150,7 @@ if (value.IsValuePair()) return ConvertPosition(state, value); DCHECK(ToCSSIdentifierValue(value).GetValueID() == CSSValueAuto); - return LengthPoint(Length(kAuto), Length(kAuto)); + return LengthPoint(Length::Auto(), Length::Auto()); } static float ConvertPerspectiveLength( @@ -1550,7 +1547,7 @@ const CSSValueList& list = ToCSSValueList(value); DCHECK_LE(list.length(), 3u); Length tx = ConvertLength(state, list.Item(0)); - Length ty(0, kFixed); + Length ty = Length::Fixed(0); double tz = 0; if (list.length() >= 2) ty = ConvertLength(state, list.Item(1));
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h index 933d95e..bbfbfaf 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h
@@ -328,11 +328,11 @@ if (value.IsIdentifierValue()) { switch (ToCSSIdentifierValue(value).GetValueID()) { case cssValueFor0: - return Length(0, kPercent); + return Length::Percent(0); case cssValueFor100: - return Length(100, kPercent); + return Length::Percent(100); case CSSValueCenter: - return Length(50, kPercent); + return Length::Percent(50); default: NOTREACHED(); }
diff --git a/third_party/blink/renderer/core/css/resolver/transform_builder.cc b/third_party/blink/renderer/core/css/resolver/transform_builder.cc index d081b6b6..e338e971 100644 --- a/third_party/blink/renderer/core/css/resolver/transform_builder.cc +++ b/third_party/blink/renderer/core/css/resolver/transform_builder.cc
@@ -188,8 +188,8 @@ case TransformOperation::kTranslate: case TransformOperation::kTranslateX: case TransformOperation::kTranslateY: { - Length tx = Length(0, kFixed); - Length ty = Length(0, kFixed); + Length tx = Length::Fixed(0); + Length ty = Length::Fixed(0); if (transform_type == TransformOperation::kTranslateY) ty = ConvertToFloatLength(first_value, conversion_data); else { @@ -209,8 +209,8 @@ } case TransformOperation::kTranslateZ: case TransformOperation::kTranslate3D: { - Length tx = Length(0, kFixed); - Length ty = Length(0, kFixed); + Length tx = Length::Fixed(0); + Length ty = Length::Fixed(0); double tz = 0; if (transform_type == TransformOperation::kTranslateZ) { tz = first_value.ComputeLength<double>(conversion_data);
diff --git a/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc b/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc index c4cb3ec..058dfd6d 100644 --- a/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc
@@ -296,9 +296,9 @@ if (value->IsIdentifierValue()) { CSSValueID value_id = ToCSSIdentifierValue(value)->GetValueID(); if (value_id == CSSValueInternalExtendToZoom) - return Length(kExtendToZoom); + return Length::ExtendToZoom(); if (value_id == CSSValueAuto) - return Length(kAuto); + return Length::Auto(); } const CSSPrimitiveValue* primitive_value = ToCSSPrimitiveValue(value);
diff --git a/third_party/blink/renderer/core/css/style_sheet_contents.cc b/third_party/blink/renderer/core/css/style_sheet_contents.cc index 03fb43b..f742e53 100644 --- a/third_party/blink/renderer/core/css/style_sheet_contents.cc +++ b/third_party/blink/renderer/core/css/style_sheet_contents.cc
@@ -32,7 +32,6 @@ #include "third_party/blink/renderer/core/frame/use_counter.h" #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/loader/resource/css_style_sheet_resource.h" -#include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" @@ -332,7 +331,6 @@ TRACE_EVENT1( "blink,devtools.timeline", "ParseAuthorStyleSheet", "data", inspector_parse_author_style_sheet_event::Data(cached_style_sheet)); - TimeTicks start_time = CurrentTimeTicks(); const ResourceResponse& response = cached_style_sheet->GetResponse(); CSSStyleSheetResource::MIMETypeCheck mime_type_check = @@ -353,11 +351,6 @@ CSSParserContext::CreateWithStyleSheetContents(ParserContext(), this); CSSParser::ParseSheet(context, this, sheet_text, CSSDeferPropertyParsing::kYes); - - DEFINE_STATIC_LOCAL(CustomCountHistogram, parse_histogram, - ("Style.AuthorStyleSheet.ParseTime", 0, 10000000, 50)); - TimeDelta parse_duration = (CurrentTimeTicks() - start_time); - parse_histogram.CountMicroseconds(parse_duration); } ParseSheetResult StyleSheetContents::ParseString(const String& sheet_text,
diff --git a/third_party/blink/renderer/core/css/threaded/filter_operation_resolver_threaded_test.cc b/third_party/blink/renderer/core/css/threaded/filter_operation_resolver_threaded_test.cc index fbe080b..a4942a8 100644 --- a/third_party/blink/renderer/core/css/threaded/filter_operation_resolver_threaded_test.cc +++ b/third_party/blink/renderer/core/css/threaded/filter_operation_resolver_threaded_test.cc
@@ -60,8 +60,7 @@ FilterOperations fo = FilterOperationResolver::CreateOffscreenFilterOperations(*value, font); ASSERT_EQ(fo.size(), 1ul); - EXPECT_EQ(*fo.at(0), - *BlurFilterOperation::Create(Length(10, LengthType::kFixed))); + EXPECT_EQ(*fo.at(0), *BlurFilterOperation::Create(Length::Fixed(10))); }); }
diff --git a/third_party/blink/renderer/core/dom/character_data.cc b/third_party/blink/renderer/core/dom/character_data.cc index 956c1942..61389c52 100644 --- a/third_party/blink/renderer/core/dom/character_data.cc +++ b/third_party/blink/renderer/core/dom/character_data.cc
@@ -227,7 +227,7 @@ // Skip DOM mutation events if the modification is from parser. // Note that mutation observer events will still fire. - // Spec: https://html.spec.whatwg.org/multipage/syntax.html#insert-a-character + // Spec: https://html.spec.whatwg.org/C/#insert-a-character if (source != kUpdateFromParser && !IsInShadowTree()) { if (GetDocument().HasListenerType( Document::kDOMCharacterDataModifiedListener)) {
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 88c0cdc..b49208f 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -932,7 +932,7 @@ CreateElementFlags flags) { Element* element = nullptr; if (qname.NamespaceURI() == html_names::xhtmlNamespaceURI) { - // https://html.spec.whatwg.org/multipage/dom.html#elements-in-the-dom:element-interface + // https://html.spec.whatwg.org/C/#elements-in-the-dom:element-interface element = HTMLElementFactory::Create(qname.LocalName(), *this, flags); if (!element) { // 6. If name is a valid custom element name, then return @@ -4341,7 +4341,7 @@ // For srcdoc documents without their own policy, walk up the frame // tree to find the document that is either not a srcdoc or doesn't // have its own policy. This algorithm is defined in - // https://html.spec.whatwg.org/multipage/window-object.html#set-up-a-window-environment-settings-object. + // https://html.spec.whatwg.org/C/#set-up-a-window-environment-settings-object. if (!frame_ || policy != network::mojom::ReferrerPolicy::kDefault || !IsSrcdocDocument()) { return policy; @@ -5848,7 +5848,7 @@ // static bool Document::ShouldInheritSecurityOriginFromOwner(const KURL& url) { - // https://html.spec.whatwg.org/multipage/browsers.html#origin + // https://html.spec.whatwg.org/C/#origin // // If a Document is the initial "about:blank" document The origin and // effective script origin of the Document are those it was assigned when its
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index 8818bea..13e9412f 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -681,7 +681,7 @@ // comments surrounding their declaration. // Document base URL. - // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url + // https://html.spec.whatwg.org/C/#document-base-url const KURL& BaseURL() const final; void SetBaseURLOverride(const KURL&); const KURL& BaseURLOverride() const { return base_url_override_; } @@ -690,7 +690,7 @@ void ProcessBaseElement(); // Fallback base URL. - // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url + // https://html.spec.whatwg.org/C/#fallback-base-url KURL FallbackBaseURL() const; // Creates URL based on passed relative url and this documents base URL. @@ -743,7 +743,7 @@ bool InNoQuirksMode() const { return compatibility_mode_ == kNoQuirksMode; } bool InLineHeightQuirksMode() const { return !InNoQuirksMode(); } - // https://html.spec.whatwg.org/multipage/dom.html#documentreadystate + // https://html.spec.whatwg.org/C/#documentreadystate enum DocumentReadyState { kLoading, kInteractive, kComplete }; void SetReadyState(DocumentReadyState); @@ -969,7 +969,7 @@ static bool HasValidNamespaceForAttributes(const QualifiedName&); // "body element" as defined by HTML5 - // (https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2). + // (https://html.spec.whatwg.org/C/#the-body-element-2). // That is, the first body or frameset child of the document element. HTMLElement* body() const; @@ -1490,7 +1490,7 @@ // TODO(binji): See http://crbug.com/798572. This implementation shares the // same agent cluster ID for any one document. The proper implementation of // this function must follow the rules described here: - // https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism. + // https://html.spec.whatwg.org/C/#integration-with-the-javascript-agent-cluster-formalism. // // Even with this simple implementation, we can prevent sharing // SharedArrayBuffers and WebAssembly modules with workers that happen to be
diff --git a/third_party/blink/renderer/core/dom/document_and_element_event_handlers.idl b/third_party/blink/renderer/core/dom/document_and_element_event_handlers.idl index c1b1362a..a42404f 100644 --- a/third_party/blink/renderer/core/dom/document_and_element_event_handlers.idl +++ b/third_party/blink/renderer/core/dom/document_and_element_event_handlers.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/webappapis.html#documentandelementeventhandlers +// https://html.spec.whatwg.org/C/#documentandelementeventhandlers [ LegacyTreatAsPartialInterface,
diff --git a/third_party/blink/renderer/core/dom/dom_string_list.idl b/third_party/blink/renderer/core/dom/dom_string_list.idl index aabd5f5..4be5453 100644 --- a/third_party/blink/renderer/core/dom/dom_string_list.idl +++ b/third_party/blink/renderer/core/dom/dom_string_list.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/infrastructure.html#domstringlist +// https://html.spec.whatwg.org/C/#domstringlist [Exposed=(Window,Worker)] interface DOMStringList {
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 0070e18..f16e254 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -115,7 +115,7 @@ kNone, }; -// https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter +// https://html.spec.whatwg.org/C/#dom-document-nameditem-filter enum class NamedItemType { kNone, kName, @@ -780,7 +780,7 @@ // Elements that may have an insertion mode other than "in body" should // override this and return true. - // https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately + // https://html.spec.whatwg.org/C/#reset-the-insertion-mode-appropriately virtual bool HasNonInBodyInsertionMode() const { return false; } bool CanContainRangeEndPoint() const override { return true; }
diff --git a/third_party/blink/renderer/core/dom/frame_request_callback.idl b/third_party/blink/renderer/core/dom/frame_request_callback.idl index 927a889..4640fec2 100644 --- a/third_party/blink/renderer/core/dom/frame_request_callback.idl +++ b/third_party/blink/renderer/core/dom/frame_request_callback.idl
@@ -28,6 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/window-object.html#framerequestcallback +// https://html.spec.whatwg.org/C/#framerequestcallback callback FrameRequestCallback = void(DOMHighResTimeStamp highResTime);
diff --git a/third_party/blink/renderer/core/dom/mutation_observer.cc b/third_party/blink/renderer/core/dom/mutation_observer.cc index a14b7aa..e15b9e3 100644 --- a/third_party/blink/renderer/core/dom/mutation_observer.cc +++ b/third_party/blink/renderer/core/dom/mutation_observer.cc
@@ -231,7 +231,7 @@ // TODO(hayato): We should have a SlotChangeList for each unit of related // similar-origin browsing context. -// https://html.spec.whatwg.org/multipage/browsers.html#unit-of-related-similar-origin-browsing-contexts +// https://html.spec.whatwg.org/C/#unit-of-related-similar-origin-browsing-contexts static SlotChangeList& ActiveSlotChangeList() { DEFINE_STATIC_LOCAL(Persistent<SlotChangeList>, slot_change_list, (MakeGarbageCollected<SlotChangeList>()));
diff --git a/third_party/blink/renderer/core/dom/node.h b/third_party/blink/renderer/core/dom/node.h index 20dc728..1c39afe 100644 --- a/third_party/blink/renderer/core/dom/node.h +++ b/third_party/blink/renderer/core/dom/node.h
@@ -570,7 +570,7 @@ virtual bool ShouldHaveFocusAppearance() const; // Whether the node is inert: - // https://html.spec.whatwg.org/multipage/interaction.html#inert + // https://html.spec.whatwg.org/C/#inert // https://github.com/WICG/inert/blob/master/README.md // This can't be in Element because text nodes must be recognized as // inert to prevent text selection.
diff --git a/third_party/blink/renderer/core/dom/scripted_animation_controller.h b/third_party/blink/renderer/core/dom/scripted_animation_controller.h index 6b088872..bb9d9cd 100644 --- a/third_party/blink/renderer/core/dom/scripted_animation_controller.h +++ b/third_party/blink/renderer/core/dom/scripted_animation_controller.h
@@ -78,7 +78,7 @@ HeapVector<Member<MediaQueryListListener>>&); // Invokes callbacks, dispatches events, etc. The order is defined by HTML: - // https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model + // https://html.spec.whatwg.org/C/#event-loop-processing-model void ServiceScriptedAnimations(base::TimeTicks monotonic_time_now); void Pause();
diff --git a/third_party/blink/renderer/core/editing/element_inner_text.cc b/third_party/blink/renderer/core/editing/element_inner_text.cc index a407390..3374096 100644 --- a/third_party/blink/renderer/core/editing/element_inner_text.cc +++ b/third_party/blink/renderer/core/editing/element_inner_text.cc
@@ -35,7 +35,7 @@ // The implementation of Element#innerText algorithm[1]. // [1] -// https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute +// https://html.spec.whatwg.org/C/#the-innertext-idl-attribute class ElementInnerTextCollector final { public: ElementInnerTextCollector() = default; @@ -137,7 +137,7 @@ // Note: Just being off-screen does not mean the element is not being rendered. // The presence of the "hidden" attribute normally means the element is not // being rendered, though this might be overridden by the style sheets. -// From https://html.spec.whatwg.org/multipage/rendering.html#being-rendered +// From https://html.spec.whatwg.org/C/#being-rendered // static bool ElementInnerTextCollector::IsBeingRendered(const Node& node) { return node.GetLayoutObject();
diff --git a/third_party/blink/renderer/core/editing/ime/input_method_controller.cc b/third_party/blink/renderer/core/editing/ime/input_method_controller.cc index 8cecdfb0..822e5a98 100644 --- a/third_party/blink/renderer/core/editing/ime/input_method_controller.cc +++ b/third_party/blink/renderer/core/editing/ime/input_method_controller.cc
@@ -321,7 +321,7 @@ // We set the autocapitalization flag corresponding to the "used // autocapitalization hint" for the focused element: - // https://html.spec.whatwg.org/multipage/interaction.html#used-autocapitalization-hint + // https://html.spec.whatwg.org/C/#used-autocapitalization-hint if (auto* input = ToHTMLInputElementOrNull(*html_element)) { const AtomicString& input_type = input->type(); if (input_type == input_type_names::kEmail ||
diff --git a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc index bc0c5eb6..53dfa1a 100644 --- a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc +++ b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc
@@ -653,7 +653,7 @@ } static bool ShouldEmitExtraNewlineForNode(const Node* node) { - // https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute + // https://html.spec.whatwg.org/C/#the-innertext-idl-attribute // Append two required linebreaks after a P element. LayoutObject* r = node->GetLayoutObject(); if (!r || !r->IsBox())
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc index 0ae4b8eb..2034cb8 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc +++ b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.cc
@@ -46,6 +46,41 @@ namespace blink { +class MarkupAccumulator::NamespaceContext final { + USING_FAST_MALLOC(MarkupAccumulator::NamespaceContext); + + public: + // https://w3c.github.io/DOM-Parsing/#dfn-add + void Add(const AtomicString& prefix, const AtomicString& namespace_uri) { + const AtomicString& non_null_prefix = prefix ? prefix : g_empty_atom; + prefix_ns_map_.Set(non_null_prefix, namespace_uri); + auto result = ns_prefixes_map_.insert( + namespace_uri ? namespace_uri : g_empty_atom, Vector<AtomicString>()); + result.stored_value->value.push_back(non_null_prefix); + } + + AtomicString LookupNamespaceURI(const AtomicString& prefix) const { + return prefix_ns_map_.at(prefix ? prefix : g_empty_atom); + } + + const Vector<AtomicString> PrefixList(const AtomicString& ns) const { + return ns_prefixes_map_.at(ns ? ns : g_empty_atom); + } + + private: + using PrefixToNamespaceMap = HashMap<AtomicString, AtomicString>; + PrefixToNamespaceMap prefix_ns_map_; + + // Map a namespace URI to a list of prefixes. + // https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map + using NamespaceToPrefixesMap = HashMap<AtomicString, Vector<AtomicString>>; + NamespaceToPrefixesMap ns_prefixes_map_; + + // TODO(tkent): Add 'context namespace' field. It is required to fix + // crbug.com/929035. + // https://w3c.github.io/DOM-Parsing/#dfn-context-namespace +}; + MarkupAccumulator::MarkupAccumulator(EAbsoluteURLs resolve_urls_method, SerializationType serialization_type) : formatter_(resolve_urls_method, serialization_type) {} @@ -92,7 +127,7 @@ } void MarkupAccumulator::AppendElement(const Element& element) { - // https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-serialisation-algorithm + // https://html.spec.whatwg.org/C/#html-fragment-serialisation-algorithm RecordNamespaceInformation(element); AppendStartTagOpen(element); @@ -149,6 +184,11 @@ // 3.4. Let candidate prefix be null. AtomicString candidate_prefix; + if (attribute_namespace.IsNull()) { + MarkupFormatter::AppendAttribute(markup_, candidate_prefix, + attribute.LocalName(), value, false); + return; + } // 3.5. If attribute namespace is not null, then run these sub-steps: // 3.5.1. Let candidate prefix be the result of retrieving a preferred @@ -162,11 +202,6 @@ if (attribute_namespace == xmlns_names::kNamespaceURI) { if (!attribute.Prefix() && attribute.LocalName() != g_xmlns_atom) candidate_prefix = g_xmlns_atom; - } else if (attribute_namespace == xml_names::kNamespaceURI) { - // TODO(tkent): Remove this block when we implement 'retrieving a - // preferred prefix string'. - if (!candidate_prefix) - candidate_prefix = g_xml_atom; } else { // TODO(tkent): Remove this block. The standard and Firefox don't // have this behavior. @@ -202,10 +237,8 @@ // xmlns and xmlns:prefix attributes should be handled by another branch in // AppendAttributeAsXMLWithNamespace(). DCHECK_NE(attribute.NamespaceURI(), xmlns_names::kNamespaceURI); - - // Attributes are in the null namespace by default. - if (!attribute.NamespaceURI()) - return false; + // Null namespace is checked earlier in AppendAttributeAsXMLWithNamespace(). + DCHECK(attribute.NamespaceURI()); // Attributes without a prefix will need one generated for them, and an xmlns // attribute for that prefix. @@ -243,16 +276,13 @@ // We can't do |namespace_stack_.emplace_back(namespace_stack_.back())| // because back() returns a reference in the vector backing, and // emplace_back() can reallocate it. - namespace_stack_.push_back(PrefixToNamespaceMap(namespace_stack_.back())); - ns_prefixes_map_stack_.push_back( - NamespaceToPrefixesMap(ns_prefixes_map_stack_.back())); + namespace_stack_.push_back(NamespaceContext(namespace_stack_.back())); } void MarkupAccumulator::PopNamespaces(const Element& element) { if (SerializeAsHTMLDocument(element)) return; namespace_stack_.pop_back(); - ns_prefixes_map_stack_.pop_back(); } // https://w3c.github.io/DOM-Parsing/#dfn-recording-the-namespace-information @@ -282,7 +312,7 @@ return preferred_prefix; const Vector<AtomicString>& candidate_list = - ns_prefixes_map_stack_.back().at(ns ? ns : g_empty_atom); + namespace_stack_.back().PrefixList(ns); // Get the last effective prefix. // // <el1 xmlns:p="U1" xmlns:q="U1"> @@ -311,18 +341,13 @@ return g_null_atom; } -// https://w3c.github.io/DOM-Parsing/#dfn-add void MarkupAccumulator::AddPrefix(const AtomicString& prefix, const AtomicString& namespace_uri) { - const AtomicString& non_null_prefix = prefix ? prefix : g_empty_atom; - namespace_stack_.back().Set(non_null_prefix, namespace_uri); - auto result = ns_prefixes_map_stack_.back().insert( - namespace_uri ? namespace_uri : g_empty_atom, Vector<AtomicString>()); - result.stored_value->value.push_back(non_null_prefix); + namespace_stack_.back().Add(prefix, namespace_uri); } AtomicString MarkupAccumulator::LookupNamespaceURI(const AtomicString& prefix) { - return namespace_stack_.back().at(prefix ? prefix : g_empty_atom); + return namespace_stack_.back().LookupNamespaceURI(prefix); } // https://w3c.github.io/DOM-Parsing/#dfn-generating-a-prefix @@ -423,7 +448,6 @@ DCHECK_EQ(namespace_stack_.size(), 0u); // 2. Let prefix map be a new namespace prefix map. namespace_stack_.emplace_back(); - ns_prefixes_map_stack_.emplace_back(); // 3. Add the XML namespace with prefix value "xml" to prefix map. AddPrefix(g_xml_atom, xml_names::kNamespaceURI); // 4. Let prefix index be a generated namespace prefix index with value 1.
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h index ae4c8163..97d5772 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h +++ b/third_party/blink/renderer/core/editing/serializers/markup_accumulator.h
@@ -107,13 +107,10 @@ template <typename Strategy> void SerializeNodesWithNamespaces(const Node& target_node, EChildrenOnly children_only); - using PrefixToNamespaceMap = HashMap<AtomicString, AtomicString>; - using NamespaceToPrefixesMap = HashMap<AtomicString, Vector<AtomicString>>; - // TODO(tkent): Make a class consists of these two maps. - Vector<PrefixToNamespaceMap> namespace_stack_; - // Map a namespace URI to a list of prefixes. - // https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map - Vector<NamespaceToPrefixesMap> ns_prefixes_map_stack_; + + class NamespaceContext; + Vector<NamespaceContext> namespace_stack_; + // https://w3c.github.io/DOM-Parsing/#dfn-generated-namespace-prefix-index uint32_t prefix_index_;
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc index 06a407b1..0d7aeec0 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc +++ b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc
@@ -314,7 +314,7 @@ void MarkupFormatter::AppendAttributeAsHTML(StringBuilder& result, const Attribute& attribute, const String& value) { - // https://html.spec.whatwg.org/multipage/parsing.html#attribute's-serialised-name + // https://html.spec.whatwg.org/C/#attribute's-serialised-name QualifiedName prefixed_name = attribute.GetName(); if (attribute.NamespaceURI() == xmlns_names::kNamespaceURI) { if (!attribute.Prefix() && attribute.LocalName() != g_xmlns_atom)
diff --git a/third_party/blink/renderer/core/events/drag_event.idl b/third_party/blink/renderer/core/events/drag_event.idl index 57bfcec..ba9e583 100644 --- a/third_party/blink/renderer/core/events/drag_event.idl +++ b/third_party/blink/renderer/core/events/drag_event.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/interaction.html#dragevent +// https://html.spec.whatwg.org/C/#dragevent [ Exposed=Window,
diff --git a/third_party/blink/renderer/core/events/drag_event_init.idl b/third_party/blink/renderer/core/events/drag_event_init.idl index ccf5837..91ec2b6 100644 --- a/third_party/blink/renderer/core/events/drag_event_init.idl +++ b/third_party/blink/renderer/core/events/drag_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/interaction.html#drageventinit +// https://html.spec.whatwg.org/C/#drageventinit dictionary DragEventInit : MouseEventInit { [ImplementedAs=getDataTransfer] DataTransfer? dataTransfer;
diff --git a/third_party/blink/renderer/core/events/error_event.cc b/third_party/blink/renderer/core/events/error_event.cc index 8421fe0..635b06d 100644 --- a/third_party/blink/renderer/core/events/error_event.cc +++ b/third_party/blink/renderer/core/events/error_event.cc
@@ -41,7 +41,7 @@ ErrorEvent* ErrorEvent::CreateSanitizedError(ScriptState* script_state) { // "6. If script's muted errors is true, then set message to "Script error.", // urlString to the empty string, line and col to 0, and errorValue to null." - // https://html.spec.whatwg.org/multipage/webappapis.html#runtime-script-errors:muted-errors + // https://html.spec.whatwg.org/C/#runtime-script-errors:muted-errors DCHECK(script_state); return MakeGarbageCollected<ErrorEvent>( "Script error.", SourceLocation::Create(String(), 0, 0, nullptr),
diff --git a/third_party/blink/renderer/core/events/error_event.idl b/third_party/blink/renderer/core/events/error_event.idl index 89d3b0c..91f3e0d 100644 --- a/third_party/blink/renderer/core/events/error_event.idl +++ b/third_party/blink/renderer/core/events/error_event.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface +// https://html.spec.whatwg.org/C/#the-errorevent-interface [ Constructor(DOMString type, optional ErrorEventInit eventInitDict),
diff --git a/third_party/blink/renderer/core/events/error_event_init.idl b/third_party/blink/renderer/core/events/error_event_init.idl index 8a48d18..29426b7 100644 --- a/third_party/blink/renderer/core/events/error_event_init.idl +++ b/third_party/blink/renderer/core/events/error_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface +// https://html.spec.whatwg.org/C/#the-errorevent-interface dictionary ErrorEventInit : EventInit { DOMString message;
diff --git a/third_party/blink/renderer/core/events/hash_change_event.idl b/third_party/blink/renderer/core/events/hash_change_event.idl index d317e1b..8e38fdb 100644 --- a/third_party/blink/renderer/core/events/hash_change_event.idl +++ b/third_party/blink/renderer/core/events/hash_change_event.idl
@@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/multipage/browsers.html#the-hashchangeevent-interface +// https://html.spec.whatwg.org/C/#the-hashchangeevent-interface [ Constructor(DOMString type, optional HashChangeEventInit eventInitDict),
diff --git a/third_party/blink/renderer/core/events/hash_change_event_init.idl b/third_party/blink/renderer/core/events/hash_change_event_init.idl index 495ba59..2be009e 100644 --- a/third_party/blink/renderer/core/events/hash_change_event_init.idl +++ b/third_party/blink/renderer/core/events/hash_change_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/browsers.html#hashchangeevent +// https://html.spec.whatwg.org/C/#hashchangeevent dictionary HashChangeEventInit : EventInit { DOMString oldURL;
diff --git a/third_party/blink/renderer/core/events/message_event.idl b/third_party/blink/renderer/core/events/message_event.idl index 250ed2c..e88852e 100644 --- a/third_party/blink/renderer/core/events/message_event.idl +++ b/third_party/blink/renderer/core/events/message_event.idl
@@ -25,7 +25,7 @@ * */ -// https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces +// https://html.spec.whatwg.org/C/#the-messageevent-interfaces [ Constructor(DOMString type, optional MessageEventInit eventInitDict),
diff --git a/third_party/blink/renderer/core/events/message_event_init.idl b/third_party/blink/renderer/core/events/message_event_init.idl index d874b15..2e4d36e 100644 --- a/third_party/blink/renderer/core/events/message_event_init.idl +++ b/third_party/blink/renderer/core/events/message_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces +// https://html.spec.whatwg.org/C/#the-messageevent-interfaces dictionary MessageEventInit : EventInit { any data;
diff --git a/third_party/blink/renderer/core/events/mouse_event.idl b/third_party/blink/renderer/core/events/mouse_event.idl index 3135644..c6728eb 100644 --- a/third_party/blink/renderer/core/events/mouse_event.idl +++ b/third_party/blink/renderer/core/events/mouse_event.idl
@@ -68,7 +68,7 @@ [MeasureAs=MouseEventMovementY] readonly attribute long movementY; // Canvas Hit Regions - // https://html.spec.whatwg.org/multipage/scripting.html#MouseEvent-partial + // https://html.spec.whatwg.org/C/#MouseEvent-partial [RuntimeEnabled=CanvasHitRegion] readonly attribute DOMString? region; // Non-standard
diff --git a/third_party/blink/renderer/core/events/mouse_event_init.idl b/third_party/blink/renderer/core/events/mouse_event_init.idl index 001c4ad5..75c88c3f 100644 --- a/third_party/blink/renderer/core/events/mouse_event_init.idl +++ b/third_party/blink/renderer/core/events/mouse_event_init.idl
@@ -19,6 +19,6 @@ long movementY = 0; // Canvas Hit Regions - // https://html.spec.whatwg.org/multipage/scripting.html#hit-regions:mouseeventinit + // https://html.spec.whatwg.org/C/#hit-regions:mouseeventinit DOMString? region = null; };
diff --git a/third_party/blink/renderer/core/events/page_transition_event.idl b/third_party/blink/renderer/core/events/page_transition_event.idl index eb7e57cb..9e85111 100644 --- a/third_party/blink/renderer/core/events/page_transition_event.idl +++ b/third_party/blink/renderer/core/events/page_transition_event.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/browsers.html#the-pagetransitionevent-interface +// https://html.spec.whatwg.org/C/#the-pagetransitionevent-interface [ Constructor(DOMString type, optional PageTransitionEventInit eventInitDict),
diff --git a/third_party/blink/renderer/core/events/page_transition_event_init.idl b/third_party/blink/renderer/core/events/page_transition_event_init.idl index 2571f08..024e3f0 100644 --- a/third_party/blink/renderer/core/events/page_transition_event_init.idl +++ b/third_party/blink/renderer/core/events/page_transition_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/browsers.html#the-pagetransitionevent-interface +// https://html.spec.whatwg.org/C/#the-pagetransitionevent-interface dictionary PageTransitionEventInit : EventInit { boolean persisted;
diff --git a/third_party/blink/renderer/core/events/pop_state_event.idl b/third_party/blink/renderer/core/events/pop_state_event.idl index b632977..874f5e5 100644 --- a/third_party/blink/renderer/core/events/pop_state_event.idl +++ b/third_party/blink/renderer/core/events/pop_state_event.idl
@@ -24,7 +24,7 @@ * */ -// https://html.spec.whatwg.org/multipage/browsers.html#the-popstateevent-interface +// https://html.spec.whatwg.org/C/#the-popstateevent-interface [ Constructor(DOMString type, optional PopStateEventInit eventInitDict),
diff --git a/third_party/blink/renderer/core/events/pop_state_event_init.idl b/third_party/blink/renderer/core/events/pop_state_event_init.idl index ce7ae0f..94e3978 100644 --- a/third_party/blink/renderer/core/events/pop_state_event_init.idl +++ b/third_party/blink/renderer/core/events/pop_state_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/browsers.html#the-popstateevent-interface +// https://html.spec.whatwg.org/C/#the-popstateevent-interface dictionary PopStateEventInit : EventInit { any state;
diff --git a/third_party/blink/renderer/core/execution_context/context_lifecycle_state_observer.h b/third_party/blink/renderer/core/execution_context/context_lifecycle_state_observer.h index 86a067e..2607f47 100644 --- a/third_party/blink/renderer/core/execution_context/context_lifecycle_state_observer.h +++ b/third_party/blink/renderer/core/execution_context/context_lifecycle_state_observer.h
@@ -49,7 +49,7 @@ // observable effect on web-visible state, on should suspend that activity while // the page is paused by overriding ContextLifecycleStateChanged(). // -// https://html.spec.whatwg.org/multipage/webappapis.html#pause +// https://html.spec.whatwg.org/C/#pause // https://wicg.github.io/page-lifecycle/spec.html class CORE_EXPORT ContextLifecycleStateObserver : public ContextLifecycleObserver {
diff --git a/third_party/blink/renderer/core/exported/local_frame_client_impl.cc b/third_party/blink/renderer/core/exported/local_frame_client_impl.cc index 71a0105..11a3fa6 100644 --- a/third_party/blink/renderer/core/exported/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/exported/local_frame_client_impl.cc
@@ -795,6 +795,13 @@ return user_agent_; } +blink::UserAgentMetadata LocalFrameClientImpl::UserAgentMetadata() { + // TODO(mkwst): Support devtools override. + if (user_agent_metadata_.brand.empty()) + user_agent_metadata_ = Platform::Current()->UserAgentMetadata(); + return user_agent_metadata_; +} + String LocalFrameClientImpl::DoNotTrackValue() { WebString do_not_track = web_frame_->Client()->DoNotTrackValue(); if (!do_not_track.IsEmpty())
diff --git a/third_party/blink/renderer/core/exported/local_frame_client_impl.h b/third_party/blink/renderer/core/exported/local_frame_client_impl.h index ac2e43a..9649280 100644 --- a/third_party/blink/renderer/core/exported/local_frame_client_impl.h +++ b/third_party/blink/renderer/core/exported/local_frame_client_impl.h
@@ -173,6 +173,7 @@ DocumentLoader* document_loader, std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) override; WTF::String UserAgent() override; + blink::UserAgentMetadata UserAgentMetadata() override; WTF::String DoNotTrackValue() override; void TransitionToCommittedForNewPage() override; LocalFrame* CreateFrame(const WTF::AtomicString& name, @@ -309,6 +310,7 @@ Member<WebLocalFrameImpl> web_frame_; String user_agent_; + blink::UserAgentMetadata user_agent_metadata_; mojom::blink::DocumentInterfaceBrokerPtr document_interface_broker_; };
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index 611b344..537a049 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -1307,8 +1307,8 @@ document->GetViewportData().GetViewportDescription(); // Choose a width that's not going match the viewport width of the loaded // document. - description.min_width = Length(100, blink::kFixed); - description.max_width = Length(100, blink::kFixed); + description.min_width = Length::Fixed(100); + description.max_width = Length::Fixed(100); web_view_helper.GetWebView()->UpdatePageDefinedViewportConstraints( description); @@ -2383,8 +2383,8 @@ ->GetDocument() ->GetViewportData(); ViewportDescription description = viewport.GetViewportDescription(); - description.min_width = Length(321, blink::kFixed); - description.max_width = Length(321, blink::kFixed); + description.min_width = Length::Fixed(321); + description.max_width = Length::Fixed(321); viewport.SetViewportDescription(description); UpdateAllLifecyclePhases(web_view_helper.GetWebView()); EXPECT_EQ(321, web_view_helper.GetWebView() @@ -2393,8 +2393,8 @@ ->GetLayoutSize() .Width()); - description.min_width = Length(320, blink::kFixed); - description.max_width = Length(320, blink::kFixed); + description.min_width = Length::Fixed(320); + description.max_width = Length::Fixed(320); viewport.SetViewportDescription(description); UpdateAllLifecyclePhases(web_view_helper.GetWebView()); EXPECT_EQ(600, web_view_helper.GetWebView() @@ -2404,7 +2404,7 @@ .Width()); description = viewport.GetViewportDescription(); - description.max_height = Length(1000, blink::kFixed); + description.max_height = Length::Fixed(1000); viewport.SetViewportDescription(description); UpdateAllLifecyclePhases(web_view_helper.GetWebView()); EXPECT_EQ(1000, web_view_helper.GetWebView() @@ -2413,7 +2413,7 @@ ->GetLayoutSize() .Height()); - description.max_height = Length(320, blink::kFixed); + description.max_height = Length::Fixed(320); viewport.SetViewportDescription(description); UpdateAllLifecyclePhases(web_view_helper.GetWebView()); EXPECT_EQ(800, web_view_helper.GetWebView()
diff --git a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc index 19e4331..12f52f3 100644 --- a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc +++ b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc
@@ -208,7 +208,7 @@ DCHECK(IsMainThread()); // The HTML spec requires to queue a connect event using the DOM manipulation // task source. - // https://html.spec.whatwg.org/multipage/workers.html#shared-workers-and-the-sharedworker-interface + // https://html.spec.whatwg.org/C/#shared-workers-and-the-sharedworker-interface PostCrossThreadTask( *GetWorkerThread()->GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, CrossThreadBind(&WebSharedWorkerImpl::ConnectTaskOnWorkerThread, @@ -320,7 +320,7 @@ // Creates 'outside settings' used in the "Processing model" algorithm in the // HTML spec: - // https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model + // https://html.spec.whatwg.org/C/#worker-processing-model // // TODO(nhiroki): According to the spec, the 'outside settings' should // correspond to the Document that called 'new SharedWorker()'. However, @@ -361,7 +361,7 @@ kV8CacheOptionsDefault, nullptr /* worklet_module_response_map */, std::move(pending_interface_provider_)); StartWorkerThread(std::move(creation_params), script_request_url_, - String() /* source_code */, outside_settings_object); + String() /* source_code */, *outside_settings_object); return; } @@ -396,7 +396,8 @@ kV8CacheOptionsDefault, nullptr /* worklet_module_response_map */, std::move(pending_interface_provider_)); StartWorkerThread(std::move(creation_params), script_response_url, - main_script_loader_->SourceText(), outside_settings_object); + main_script_loader_->SourceText(), + *outside_settings_object); main_script_loader_ = nullptr; } @@ -404,7 +405,7 @@ std::unique_ptr<GlobalScopeCreationParams> global_scope_creation_params, const KURL& script_response_url, const String& source_code, - FetchClientSettingsObjectSnapshot* outside_settings_object) { + const FetchClientSettingsObjectSnapshot& outside_settings_object) { DCHECK(IsMainThread()); reporting_proxy_ = MakeGarbageCollected<SharedWorkerReportingProxy>( this, parent_execution_context_task_runners_);
diff --git a/third_party/blink/renderer/core/exported/web_shared_worker_impl.h b/third_party/blink/renderer/core/exported/web_shared_worker_impl.h index c52d5092..df88e5c 100644 --- a/third_party/blink/renderer/core/exported/web_shared_worker_impl.h +++ b/third_party/blink/renderer/core/exported/web_shared_worker_impl.h
@@ -128,7 +128,7 @@ std::unique_ptr<GlobalScopeCreationParams>, const KURL& script_response_url, const String& source_code, - FetchClientSettingsObjectSnapshot* outside_settings_object); + const FetchClientSettingsObjectSnapshot& outside_settings_object); WorkerClients* CreateWorkerClients(); void ConnectTaskOnWorkerThread(MessagePortChannel);
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index d0382eda..cab2ce7 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2564,7 +2564,7 @@ Length default_min_width = document->GetViewportData().ViewportDefaultMinWidth(); if (default_min_width.IsAuto()) - default_min_width = Length(kExtendToZoom); + default_min_width = Length::ExtendToZoom(); ViewportDescription adjusted_description = description; if (SettingsImpl()->ViewportMetaLayoutSizeQuirk() && @@ -2573,10 +2573,10 @@ if (adjusted_description.max_width.IsFixed() && adjusted_description.max_width.Value() <= kLegacyWidthSnappingMagicNumber) - adjusted_description.max_width = Length(kDeviceWidth); + adjusted_description.max_width = Length::DeviceWidth(); if (adjusted_description.max_height.IsFixed() && adjusted_description.max_height.Value() <= size_.height) - adjusted_description.max_height = Length(kDeviceHeight); + adjusted_description.max_height = Length::DeviceHeight(); adjusted_description.min_width = adjusted_description.max_width; adjusted_description.min_height = adjusted_description.max_height; } @@ -2591,7 +2591,7 @@ GetPageScaleConstraintsSet().UserAgentConstraints().initial_scale * DeviceScaleFactor() <= 1) { - if (description.max_width == Length(kDeviceWidth) || + if (description.max_width == Length::DeviceWidth() || (description.max_width.IsAuto() && GetPageScaleConstraintsSet().PageDefinedConstraints().initial_scale == 1.0f))
diff --git a/third_party/blink/renderer/core/fetch/fetch_manager.cc b/third_party/blink/renderer/core/fetch/fetch_manager.cc index 06bf76a..30897ef 100644 --- a/third_party/blink/renderer/core/fetch/fetch_manager.cc +++ b/third_party/blink/renderer/core/fetch/fetch_manager.cc
@@ -742,9 +742,10 @@ request.SetSkipServiceWorker(is_isolated_world_); if (fetch_request_data_->Keepalive()) { - if (!cors::IsCorsSafelistedMethod(request.HttpMethod()) || - !cors::ContainsOnlyCorsSafelistedOrForbiddenHeaders( - request.HttpHeaderFields())) { + if (cors::IsCorsEnabledRequestMode(fetch_request_data_->Mode()) && + (!cors::IsCorsSafelistedMethod(request.HttpMethod()) || + !cors::ContainsOnlyCorsSafelistedOrForbiddenHeaders( + request.HttpHeaderFields()))) { PerformNetworkError( "Preflight request for request with keepalive " "specified is currently not supported");
diff --git a/third_party/blink/renderer/core/frame/BUILD.gn b/third_party/blink/renderer/core/frame/BUILD.gn index 9ba1a67..573d070 100644 --- a/third_party/blink/renderer/core/frame/BUILD.gn +++ b/third_party/blink/renderer/core/frame/BUILD.gn
@@ -111,6 +111,8 @@ "navigator_scheduling.h", "navigator_user_activation.cc", "navigator_user_activation.h", + "navigator_user_agent.cc", + "navigator_user_agent.h", "opened_frame_tracker.cc", "opened_frame_tracker.h", "page_scale_constraints.cc",
diff --git a/third_party/blink/renderer/core/frame/OWNERS b/third_party/blink/renderer/core/frame/OWNERS index 7d06251e..67496f48f 100644 --- a/third_party/blink/renderer/core/frame/OWNERS +++ b/third_party/blink/renderer/core/frame/OWNERS
@@ -2,5 +2,8 @@ dcheng@chromium.org japhet@chromium.org +per-file *_type_converter*.*=set noparent +per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS + # TEAM: platform-architecture-dev@chromium.org # COMPONENT: Blink>Internals
diff --git a/third_party/blink/renderer/core/frame/frame_owner.h b/third_party/blink/renderer/core/frame/frame_owner.h index 2c524470..734fa1e 100644 --- a/third_party/blink/renderer/core/frame/frame_owner.h +++ b/third_party/blink/renderer/core/frame/frame_owner.h
@@ -58,7 +58,7 @@ // Returns the 'name' content attribute value of the browsing context // container. - // https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-container + // https://html.spec.whatwg.org/C/#browsing-context-container virtual AtomicString BrowsingContextContainerName() const = 0; virtual ScrollbarMode ScrollingMode() const = 0; virtual int MarginWidth() const = 0;
diff --git a/third_party/blink/renderer/core/frame/history.cc b/third_party/blink/renderer/core/frame/history.cc index 3292326..b7753d11 100644 --- a/third_party/blink/renderer/core/frame/history.cc +++ b/third_party/blink/renderer/core/frame/history.cc
@@ -201,7 +201,7 @@ // We intentionally call reload() for the current frame if delta is zero. // Otherwise, navigation happens on the root frame. // This behavior is designed in the following spec. - // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go + // https://html.spec.whatwg.org/C/#dom-history-go GetFrame()->Reload(WebFrameLoadType::kReload, ClientRedirectPolicy::kClientRedirect); }
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index 8841d69e..daf6c8f00 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -902,7 +902,7 @@ // Since sandboxing turns the origin into an opaque origin it needs to also // be considered when deciding whether to reuse it. // Spec: - // https://html.spec.whatwg.org/multipage/browsing-the-web.html#initialise-the-document-object + // https://html.spec.whatwg.org/C/#initialise-the-document-object if (csp && (csp->GetSandboxMask() & kSandboxOrigin)) { return false; }
diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h index bfe536f..5f8c0f8c 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client.h +++ b/third_party/blink/renderer/core/frame/local_frame_client.h
@@ -34,6 +34,7 @@ #include <memory> #include "third_party/blink/public/common/feature_policy/feature_policy.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/frame/navigation_initiator.mojom-blink.h" #include "third_party/blink/public/mojom/portal/portal.mojom-blink.h" #include "third_party/blink/public/platform/web_content_security_policy_struct.h" @@ -252,6 +253,7 @@ std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) = 0; virtual String UserAgent() = 0; + virtual blink::UserAgentMetadata UserAgentMetadata() = 0; virtual String DoNotTrackValue() = 0;
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index a064077..a52936a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -50,6 +50,7 @@ #include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h" #include "third_party/blink/renderer/core/frame/browser_controls.h" #include "third_party/blink/renderer/core/frame/event_handler_registry.h" +#include "third_party/blink/renderer/core/frame/find_in_page.h" #include "third_party/blink/renderer/core/frame/frame_overlay.h" #include "third_party/blink/renderer/core/frame/frame_view_auto_size_info.h" #include "third_party/blink/renderer/core/frame/link_highlights.h" @@ -1344,7 +1345,19 @@ } void LocalFrameView::ProcessUrlFragment(const KURL& url, bool should_scroll) { - fragment_anchor_ = FragmentAnchor::TryCreate(url, should_scroll, *frame_); + // We want to create the anchor even if we don't need to scroll. This ensures + // all the side effects like setting CSS :target are correctly set. + FragmentAnchor* anchor = FragmentAnchor::TryCreate(url, *frame_); + + if (anchor && should_scroll) { + fragment_anchor_ = anchor; + fragment_anchor_->Installed(); + + // Layout needs to be clean for scrolling but if layout is needed, we'll + // invoke after layout is completed so no need to do it here. + if (!NeedsLayout()) + InvokeFragmentAnchor(); + } } void LocalFrameView::SetLayoutSize(const IntSize& size) { @@ -1661,8 +1674,7 @@ } void LocalFrameView::InvokeFragmentAnchor() { - FragmentAnchor* fragment_anchor = fragment_anchor_; - if (!fragment_anchor) + if (!fragment_anchor_) return; if (!fragment_anchor_->Invoke())
diff --git a/third_party/blink/renderer/core/frame/location.idl b/third_party/blink/renderer/core/frame/location.idl index ba5f568..ea47333 100644 --- a/third_party/blink/renderer/core/frame/location.idl +++ b/third_party/blink/renderer/core/frame/location.idl
@@ -39,7 +39,7 @@ // *existing* document at a different origin. // However, *reading* |href|, or accessing any component, is a security // problem, since that allows tracking navigation. - // https://html.spec.whatwg.org/multipage/browsers.html#crossoriginproperties-(-o-) + // https://html.spec.whatwg.org/C/#crossoriginproperties-(-o-) [CallWith=Isolate, CrossOrigin, RaisesException, Unforgeable] void replace(URLString url); [Unforgeable] void reload();
diff --git a/third_party/blink/renderer/core/frame/navigator.cc b/third_party/blink/renderer/core/frame/navigator.cc index 3e5a25e3..71b32975 100644 --- a/third_party/blink/renderer/core/frame/navigator.cc +++ b/third_party/blink/renderer/core/frame/navigator.cc
@@ -23,6 +23,7 @@ #include "third_party/blink/renderer/core/frame/navigator.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -72,6 +73,14 @@ return GetFrame()->Loader().UserAgent(); } +UserAgentMetadata Navigator::GetUserAgentMetadata() const { + // If the frame is already detached it no longer has a meaningful useragent. + if (!GetFrame() || !GetFrame()->GetPage()) + return blink::UserAgentMetadata(); + + return GetFrame()->Loader().UserAgentMetadata(); +} + bool Navigator::cookieEnabled() const { if (!GetFrame()) return false;
diff --git a/third_party/blink/renderer/core/frame/navigator.h b/third_party/blink/renderer/core/frame/navigator.h index fc3707c..3c049fc 100644 --- a/third_party/blink/renderer/core/frame/navigator.h +++ b/third_party/blink/renderer/core/frame/navigator.h
@@ -20,6 +20,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_NAVIGATOR_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_NAVIGATOR_H_ +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/frame/navigator_concurrent_hardware.h" @@ -27,6 +28,7 @@ #include "third_party/blink/renderer/core/frame/navigator_id.h" #include "third_party/blink/renderer/core/frame/navigator_language.h" #include "third_party/blink/renderer/core/frame/navigator_on_line.h" +#include "third_party/blink/renderer/core/frame/navigator_user_agent.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/supplementable.h" @@ -42,6 +44,7 @@ public NavigatorID, public NavigatorLanguage, public NavigatorOnLine, + public NavigatorUserAgent, public DOMWindowClient, public Supplementable<Navigator> { DEFINE_WRAPPERTYPEINFO(); @@ -67,6 +70,7 @@ String userAgent() const override; String GetAcceptLanguages() override; + UserAgentMetadata GetUserAgentMetadata() const override; void Trace(blink::Visitor*) override; };
diff --git a/third_party/blink/renderer/core/frame/navigator.idl b/third_party/blink/renderer/core/frame/navigator.idl index abb8330..9b1c330 100644 --- a/third_party/blink/renderer/core/frame/navigator.idl +++ b/third_party/blink/renderer/core/frame/navigator.idl
@@ -39,3 +39,4 @@ Navigator implements NavigatorLanguage; Navigator implements NavigatorOnLine; Navigator implements NavigatorAutomationInformation; +Navigator implements NavigatorUserAgent;
diff --git a/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl b/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl index af79103..8976b5f 100644 --- a/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl +++ b/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/workers.html#navigator.hardwareconcurrency +// https://html.spec.whatwg.org/C/#navigator.hardwareconcurrency [ NoInterfaceObject,
diff --git a/third_party/blink/renderer/core/frame/navigator_cookies.idl b/third_party/blink/renderer/core/frame/navigator_cookies.idl index c77322a1..12b9b92 100644 --- a/third_party/blink/renderer/core/frame/navigator_cookies.idl +++ b/third_party/blink/renderer/core/frame/navigator_cookies.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/webappapis.html#cookies +// https://html.spec.whatwg.org/C/#cookies [NoInterfaceObject] interface NavigatorCookies {
diff --git a/third_party/blink/renderer/core/frame/navigator_user_agent.cc b/third_party/blink/renderer/core/frame/navigator_user_agent.cc new file mode 100644 index 0000000..c9be1c7 --- /dev/null +++ b/third_party/blink/renderer/core/frame/navigator_user_agent.cc
@@ -0,0 +1,30 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/frame/navigator_user_agent.h" + +#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/core/frame/user_agent.h" + +namespace blink { + +ScriptPromise NavigatorUserAgent::getUserAgent(ScriptState* script_state) { + ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); + ScriptPromise promise = resolver->Promise(); + + blink::UserAgentMetadata metadata = GetUserAgentMetadata(); + blink::UserAgent* idl_metadata = blink::UserAgent::Create(); + + idl_metadata->setBrand(String::FromUTF8(metadata.brand.data())); + idl_metadata->setVersion(String::FromUTF8(metadata.version.data())); + idl_metadata->setPlatform(String::FromUTF8(metadata.platform.data())); + idl_metadata->setArchitecture(String::FromUTF8(metadata.architecture.data())); + idl_metadata->setModel(String::FromUTF8(metadata.model.data())); + resolver->Resolve(idl_metadata); + + return promise; +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/frame/navigator_user_agent.h b/third_party/blink/renderer/core/frame/navigator_user_agent.h new file mode 100644 index 0000000..def5dda --- /dev/null +++ b/third_party/blink/renderer/core/frame/navigator_user_agent.h
@@ -0,0 +1,25 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_NAVIGATOR_USER_AGENT_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_NAVIGATOR_USER_AGENT_H_ + +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +class ScriptPromise; +class ScriptState; +class CORE_EXPORT NavigatorUserAgent { + public: + ScriptPromise getUserAgent(ScriptState*); + + virtual UserAgentMetadata GetUserAgentMetadata() const = 0; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_NAVIGATOR_USER_AGENT_H_
diff --git a/third_party/blink/renderer/core/frame/navigator_user_agent.idl b/third_party/blink/renderer/core/frame/navigator_user_agent.idl new file mode 100644 index 0000000..b9aa924 --- /dev/null +++ b/third_party/blink/renderer/core/frame/navigator_user_agent.idl
@@ -0,0 +1,12 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://github.com/WICG/ua-client-hints +[ + NoInterfaceObject, // Always used on target of 'implements' + RuntimeEnabled=UserAgentClientHint, + Exposed=Window +] interface NavigatorUserAgent { + [SecureContext, CallWith=ScriptState] Promise<UserAgent> getUserAgent(); +};
diff --git a/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc b/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc index 148e0a7..55ba414 100644 --- a/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc +++ b/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc
@@ -201,9 +201,9 @@ bool reset_initial_scale = false; if (description.zoom == -1) { if (description.max_width.IsAuto() || - description.max_width.GetType() == kExtendToZoom) + description.max_width.IsExtendToZoom()) reset_initial_scale = true; - if (use_wide_viewport || description.max_width.GetType() == kDeviceWidth) + if (use_wide_viewport || description.max_width.IsDeviceWidth()) reset_initial_scale = true; } if (reset_initial_scale) @@ -226,8 +226,7 @@ if (page_defined_constraints_.maximum_scale != -1) page_defined_constraints_.maximum_scale *= target_density_dpi_factor; if (wide_viewport_quirk_enabled && - (!use_wide_viewport || - description.max_width.GetType() == kDeviceWidth)) { + (!use_wide_viewport || description.max_width.IsDeviceWidth())) { adjusted_layout_size_width /= target_density_dpi_factor; adjusted_layout_size_height /= target_density_dpi_factor; } @@ -236,7 +235,7 @@ if (wide_viewport_quirk_enabled) { if (use_wide_viewport && (description.max_width.IsAuto() || - description.max_width.GetType() == kExtendToZoom) && + description.max_width.IsExtendToZoom()) && description.zoom != 1.0f) { if (layout_fallback_width) adjusted_layout_size_width = layout_fallback_width; @@ -244,9 +243,8 @@ adjusted_layout_size_width, FloatSize(icb_size_)); } else if (!use_wide_viewport) { const float non_wide_scale = - description.zoom < 1 && - description.max_width.GetType() != kDeviceWidth && - description.max_width.GetType() != kDeviceHeight + description.zoom < 1 && !description.max_width.IsDeviceWidth() && + !description.max_width.IsDeviceHeight() ? -1 : old_initial_scale; adjusted_layout_size_width = GetLayoutWidthForNonWideViewport( @@ -254,9 +252,9 @@ target_density_dpi_factor; float new_initial_scale = target_density_dpi_factor; if (user_agent_constraints_.initial_scale != -1 && - (description.max_width.GetType() == kDeviceWidth || + (description.max_width.IsDeviceWidth() || ((description.max_width.IsAuto() || - description.max_width.GetType() == kExtendToZoom) && + description.max_width.IsExtendToZoom()) && description.zoom == -1))) { adjusted_layout_size_width /= user_agent_constraints_.initial_scale; new_initial_scale = user_agent_constraints_.initial_scale; @@ -284,8 +282,8 @@ page_defined_constraints_.maximum_scale = page_defined_constraints_.initial_scale; if (description.max_width.IsAuto() || - description.max_width.GetType() == kExtendToZoom || - description.max_width.GetType() == kDeviceWidth) { + description.max_width.IsExtendToZoom() || + description.max_width.IsDeviceWidth()) { adjusted_layout_size_width = icb_size_.Width() / target_density_dpi_factor; adjusted_layout_size_height = ComputeHeightByAspectRatio(
diff --git a/third_party/blink/renderer/core/frame/user_agent.idl b/third_party/blink/renderer/core/frame/user_agent.idl new file mode 100644 index 0000000..2223b79 --- /dev/null +++ b/third_party/blink/renderer/core/frame/user_agent.idl
@@ -0,0 +1,14 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://github.com/WICG/ua-client-hints +[ + Exposed=Window +] dictionary UserAgent { + DOMString brand = ""; + DOMString version = ""; + DOMString platform = ""; + DOMString architecture = ""; + DOMString model = ""; +};
diff --git a/third_party/blink/renderer/core/frame/window.idl b/third_party/blink/renderer/core/frame/window.idl index 51138a27..e681b67b 100644 --- a/third_party/blink/renderer/core/frame/window.idl +++ b/third_party/blink/renderer/core/frame/window.idl
@@ -93,7 +93,7 @@ void queueMicrotask(VoidFunction callback); // AnimationFrameProvider mixin - // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames + // https://html.spec.whatwg.org/C/#animation-frames [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(FrameRequestCallback callback); void cancelAnimationFrame(long handle);
diff --git a/third_party/blink/renderer/core/frame/window_event_handlers.idl b/third_party/blink/renderer/core/frame/window_event_handlers.idl index 2ee41ea..595cf78 100644 --- a/third_party/blink/renderer/core/frame/window_event_handlers.idl +++ b/third_party/blink/renderer/core/frame/window_event_handlers.idl
@@ -27,7 +27,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/webappapis.html#windoweventhandlers +// https://html.spec.whatwg.org/C/#windoweventhandlers [ LegacyTreatAsPartialInterface,
diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc index 456df69..c8bbd0f1 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
@@ -204,7 +204,7 @@ Unfullscreen(*element); } -// https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use +// https://html.spec.whatwg.org/C/#allowed-to-use bool AllowedToUseFullscreen(const Document& document, ReportOptions report_on_failure) { // To determine whether a Document object |document| is allowed to use the
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index 9c6ea82..3e6826a 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -1320,7 +1320,7 @@ // An element is a supported interactive canvas fallback element if it is one // of the following: - // https://html.spec.whatwg.org/multipage/scripting.html#supported-interactive-canvas-fallback-element + // https://html.spec.whatwg.org/C/#supported-interactive-canvas-fallback-element // An a element that represents a hyperlink and that does not have any img // descendants.
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.idl b/third_party/blink/renderer/core/html/canvas/html_canvas_element.idl index f62bc324..52b7425 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.idl +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.idl
@@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/canvas.html#the-canvas-element +// https://html.spec.whatwg.org/C/#the-canvas-element [HTMLConstructor] interface HTMLCanvasElement : HTMLElement { @@ -44,5 +44,5 @@ [HighEntropy, RuntimeEnabled=CanvasColorManagement, MeasureAs=CanvasConvertToBlob, RaisesException, CallWith=ScriptState] Promise<Blob> convertToBlob(optional ImageEncodeOptions options); }; -// https://html.spec.whatwg.org/multipage/canvas.html#blobcallback +// https://html.spec.whatwg.org/C/#blobcallback callback BlobCallback = void (Blob? blob);
diff --git a/third_party/blink/renderer/core/html/custom/ce_reactions_scope.h b/third_party/blink/renderer/core/html/custom/ce_reactions_scope.h index 8578963..650d010c 100644 --- a/third_party/blink/renderer/core/html/custom/ce_reactions_scope.h +++ b/third_party/blink/renderer/core/html/custom/ce_reactions_scope.h
@@ -16,7 +16,7 @@ class CustomElementReaction; class Element; -// https://html.spec.whatwg.org/multipage/scripting.html#cereactions +// https://html.spec.whatwg.org/C/#cereactions class CORE_EXPORT CEReactionsScope final { STACK_ALLOCATED();
diff --git a/third_party/blink/renderer/core/html/custom/custom_element.cc b/third_party/blink/renderer/core/html/custom/custom_element.cc index 67956f5..8e4c863 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element.cc
@@ -198,7 +198,7 @@ DCHECK(ShouldCreateCustomElement(tag_name)); // "create an element for a token": - // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token + // https://html.spec.whatwg.org/C/#create-an-element-for-the-token // 7. If this step throws an exception, let element be instead a new element // that implements HTMLUnknownElement, with no attributes, namespace set to @@ -212,7 +212,7 @@ void CustomElement::Enqueue(Element& element, CustomElementReaction& reaction) { // To enqueue an element on the appropriate element queue - // https://html.spec.whatwg.org/multipage/scripting.html#enqueue-an-element-on-the-appropriate-element-queue + // https://html.spec.whatwg.org/C/#enqueue-an-element-on-the-appropriate-element-queue // If the custom element reactions stack is not empty, then // Add element to the current element queue. @@ -296,7 +296,7 @@ void CustomElement::TryToUpgrade(Element& element, bool upgrade_invisible_elements) { // Try to upgrade an element - // https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade + // https://html.spec.whatwg.org/C/#concept-try-upgrade DCHECK_EQ(element.GetCustomElementState(), CustomElementState::kUndefined);
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_definition.cc b/third_party/blink/renderer/core/html/custom/custom_element_definition.cc index 62d852a..ef9e100 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_definition.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_definition.cc
@@ -186,7 +186,7 @@ construction_stack_.pop_back(); } -// https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element +// https://html.spec.whatwg.org/C/#concept-upgrade-an-element void CustomElementDefinition::Upgrade(Element& element) { DCHECK_EQ(element.GetCustomElementState(), CustomElementState::kUndefined); @@ -287,7 +287,7 @@ Element& element) { // Avoid synchronizing all attributes unless it is needed, while enqueing // callbacks "in order" as defined in the spec. - // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element + // https://html.spec.whatwg.org/C/#concept-upgrade-an-element for (const AtomicString& name : observed_attributes_) element.SynchronizeAttribute(name); for (const auto& attribute : element.AttributesWithoutUpdate()) {
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_definition_builder.h b/third_party/blink/renderer/core/html/custom/custom_element_definition_builder.h index efc56d56..eab6ef0 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_definition_builder.h +++ b/third_party/blink/renderer/core/html/custom/custom_element_definition_builder.h
@@ -18,7 +18,7 @@ // Implement CustomElementDefinitionBuilder to provide // technology-specific steps for CustomElementRegistry.define. -// https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-define +// https://html.spec.whatwg.org/C/#dom-customelementsregistry-define class CORE_EXPORT CustomElementDefinitionBuilder { STACK_ALLOCATED();
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_descriptor.h b/third_party/blink/renderer/core/html/custom/custom_element_descriptor.h index d24e368a..59e781b 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_descriptor.h +++ b/third_party/blink/renderer/core/html/custom/custom_element_descriptor.h
@@ -14,7 +14,7 @@ namespace blink { // Describes what elements a custom element definition applies to. -// https://html.spec.whatwg.org/multipage/scripting.html#custom-elements-core-concepts +// https://html.spec.whatwg.org/C/#custom-elements-core-concepts // // There are two kinds of definitions: //
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc b/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc index cfa12de..1145659 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_factory.cc
@@ -23,7 +23,7 @@ void Invoke(Element& element) override { // Don't call Upgrade() if it's already upgraded. Multiple upgrade reactions // could be enqueued because the state changes in step 10 of upgrades. - // https://html.spec.whatwg.org/multipage/scripting.html#upgrades + // https://html.spec.whatwg.org/C/#upgrades if (element.GetCustomElementState() == CustomElementState::kUndefined) { // Don't upgrade elements inside an invisible-static tree, unless it was // triggered by CustomElementRegistry::upgrade.
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue.cc b/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue.cc index 386f02a9..0f7c3ea 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue.cc
@@ -35,7 +35,7 @@ // Unlike V0CustomElementsCallbackQueue, reactions are always // inserted by steps which bump the global element queue. This // means we do not need queue "owner" guards. - // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reactions + // https://html.spec.whatwg.org/C/#custom-element-reactions Clear(); }
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.cc b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.cc index da990e8..990283ba 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.cc
@@ -81,7 +81,7 @@ void CustomElementReactionStack::EnqueueToBackupQueue( Element& element, CustomElementReaction& reaction) { - // https://html.spec.whatwg.org/multipage/scripting.html#backup-element-queue + // https://html.spec.whatwg.org/C/#backup-element-queue DCHECK(!CEReactionsScope::Current()); DCHECK(stack_.IsEmpty());
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h index b445589..cac449fe7 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h
@@ -16,7 +16,7 @@ class CustomElementReactionQueue; class Element; -// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reactions +// https://html.spec.whatwg.org/C/#custom-element-reactions class CORE_EXPORT CustomElementReactionStack final : public GarbageCollected<CustomElementReactionStack>, public NameClient {
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_registry.cc b/third_party/blink/renderer/core/html/custom/custom_element_registry.cc index 06817ada..42546eb 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_registry.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_registry.cc
@@ -233,7 +233,7 @@ return definition; } -// https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-get +// https://html.spec.whatwg.org/C/#dom-customelementsregistry-get ScriptValue CustomElementRegistry::get(const AtomicString& name) { CustomElementDefinition* definition = DefinitionForName(name); if (!definition) { @@ -244,7 +244,7 @@ return definition->GetConstructorForScript(); } -// https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-element-definition +// https://html.spec.whatwg.org/C/#look-up-a-custom-element-definition // At this point, what the spec calls 'is' is 'name' from desc CustomElementDefinition* CustomElementRegistry::DefinitionFor( const CustomElementDescriptor& desc) const { @@ -310,7 +310,7 @@ set->insert(&candidate); } -// https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-whendefined +// https://html.spec.whatwg.org/C/#dom-customelementsregistry-whendefined ScriptPromise CustomElementRegistry::whenDefined( ScriptState* script_state, const AtomicString& name, @@ -351,7 +351,7 @@ sorter.Sorted(elements, document); } -// https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-upgrade +// https://html.spec.whatwg.org/C/#dom-customelementregistry-upgrade void CustomElementRegistry::upgrade(Node* root) { DCHECK(root);
diff --git a/third_party/blink/renderer/core/html/document_all_name_collection.cc b/third_party/blink/renderer/core/html/document_all_name_collection.cc index 777fd7f..ad24083 100644 --- a/third_party/blink/renderer/core/html/document_all_name_collection.cc +++ b/third_party/blink/renderer/core/html/document_all_name_collection.cc
@@ -12,7 +12,7 @@ : HTMLNameCollection(document, kDocumentAllNamedItems, name) {} bool DocumentAllNameCollection::ElementMatches(const Element& element) const { - // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#all-named-elements + // https://html.spec.whatwg.org/C/#all-named-elements // Match below type of elements by name but any type of element by id. if (element.HasTagName(html_names::kATag) || element.HasTagName(html_names::kButtonTag) ||
diff --git a/third_party/blink/renderer/core/html/document_name_collection.cc b/third_party/blink/renderer/core/html/document_name_collection.cc index b18136f..30b07813 100644 --- a/third_party/blink/renderer/core/html/document_name_collection.cc +++ b/third_party/blink/renderer/core/html/document_name_collection.cc
@@ -13,7 +13,7 @@ const AtomicString& name) : HTMLNameCollection(document, kDocumentNamedItems, name) {} -// https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter +// https://html.spec.whatwg.org/C/#dom-document-nameditem-filter bool DocumentNameCollection::ElementMatches(const HTMLElement& element) const { // Match images, forms, embeds, objects and iframes by name, // object by id, and images by id but only if they have
diff --git a/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc b/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc index 886ff81..b25f10d 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc +++ b/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc
@@ -586,7 +586,7 @@ *style, child_element->textContent()); } } - style->SetWidth(Length(ceilf(width), kFixed)); + style->SetWidth(Length::Fixed(ceilf(width))); return style; }
diff --git a/third_party/blink/renderer/core/html/forms/form_associated.h b/third_party/blink/renderer/core/html/forms/form_associated.h index ee155b92..9590a02 100644 --- a/third_party/blink/renderer/core/html/forms/form_associated.h +++ b/third_party/blink/renderer/core/html/forms/form_associated.h
@@ -10,7 +10,7 @@ class HTMLFormElement; // Contains code to associate form with a form associated element -// https://html.spec.whatwg.org/multipage/forms.html#form-associated-element +// https://html.spec.whatwg.org/C/#form-associated-element class FormAssociated { public: // HTMLFormElement can be null
diff --git a/third_party/blink/renderer/core/html/forms/form_data.cc b/third_party/blink/renderer/core/html/forms/form_data.cc index 8a4627a0..190b3283 100644 --- a/third_party/blink/renderer/core/html/forms/form_data.cc +++ b/third_party/blink/renderer/core/html/forms/form_data.cc
@@ -79,7 +79,7 @@ }; String Normalize(const String& input) { - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#append-an-entry + // https://html.spec.whatwg.org/C/#append-an-entry return ReplaceUnmatchedSurrogates(NormalizeLineEndingsToCRLF(input)); }
diff --git a/third_party/blink/renderer/core/html/forms/form_data_event.idl b/third_party/blink/renderer/core/html/forms/form_data_event.idl index e507662..f9ed6849 100644 --- a/third_party/blink/renderer/core/html/forms/form_data_event.idl +++ b/third_party/blink/renderer/core/html/forms/form_data_event.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#formdataevent +// https://html.spec.whatwg.org/C/#formdataevent [ Constructor(DOMString type, optional FormDataEventInit eventInitDict),
diff --git a/third_party/blink/renderer/core/html/forms/form_data_event_init.idl b/third_party/blink/renderer/core/html/forms/form_data_event_init.idl index 3872929..ae477b97 100644 --- a/third_party/blink/renderer/core/html/forms/form_data_event_init.idl +++ b/third_party/blink/renderer/core/html/forms/form_data_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#formdataeventinit +// https://html.spec.whatwg.org/C/#formdataeventinit dictionary FormDataEventInit : EventInit { required FormData formData;
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.cc b/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.cc index b53738b..4542c48 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.cc +++ b/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.cc
@@ -130,7 +130,7 @@ // TODO(tkent): Share the code with autofill::FormStructure:: // ParseFieldTypesFromAutocompleteAttributes(). - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-processing-model + // https://html.spec.whatwg.org/C/#autofill-processing-model // 1. If the element has no autocomplete attribute, then jump to the step // labeled default. const AtomicString& value = FastGetAttribute(html_names::kAutocompleteAttr);
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.h b/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.h index 7ce8a72..ccaaa70f 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.h +++ b/third_party/blink/renderer/core/html/forms/html_form_control_element_with_state.h
@@ -60,7 +60,7 @@ private: bool ShouldForceLegacyLayout() const final { return true; } - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-anchor-mantle + // https://html.spec.whatwg.org/C/#autofill-anchor-mantle bool IsWearingAutofillAnchorMantle() const; };
diff --git a/third_party/blink/renderer/core/html/forms/html_form_element.cc b/third_party/blink/renderer/core/html/forms/html_form_element.cc index 6a73a896..a5bfbfa6 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_form_element.cc
@@ -354,7 +354,7 @@ if (!view || !frame || !frame->GetPage()) return; - // https://html.spec.whatwg.org/multipage/forms.html#form-submission-algorithm + // https://html.spec.whatwg.org/C/#form-submission-algorithm // 2. If form document is not connected, has no associated browsing context, // or its active sandboxing flag set has its sandboxed forms browsing // context flag set, then abort these steps without doing anything.
diff --git a/third_party/blink/renderer/core/html/forms/html_form_element.h b/third_party/blink/renderer/core/html/forms/html_form_element.h index 48e8bd0b..23befd3 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_element.h +++ b/third_party/blink/renderer/core/html/forms/html_form_element.h
@@ -92,7 +92,7 @@ void setMethod(const AtomicString&); // Find the 'default button.' - // https://html.spec.whatwg.org/multipage/forms.html#default-button + // https://html.spec.whatwg.org/C/#default-button HTMLFormControlElement* FindDefaultButton() const; bool checkValidity(); @@ -111,7 +111,7 @@ void InvalidateDefaultButtonStyle() const; // 'construct the entry list' - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set + // https://html.spec.whatwg.org/C/#constructing-the-form-data-set // Returns nullptr if this form is already running this function. FormData* ConstructEntryList(HTMLFormControlElement* submit_button, const WTF::TextEncoding& encoding); @@ -165,7 +165,7 @@ // Do not access image_elements_ directly. Use ImageElements() instead. HeapVector<Member<HTMLImageElement>> image_elements_; - // https://html.spec.whatwg.org/multipage/forms.html#planned-navigation + // https://html.spec.whatwg.org/C/#planned-navigation // Unlike the specification, we use this only for web-exposed submit() // function in 'submit' event handler. Member<FormSubmission> planned_navigation_;
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.cc b/third_party/blink/renderer/core/html/forms/html_input_element.cc index 2a29a0e..e197fd7 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element.cc
@@ -461,7 +461,7 @@ ValueMode new_value_mode = input_type_->GetValueMode(); - // https://html.spec.whatwg.org/multipage/forms.html#input-type-change + // https://html.spec.whatwg.org/C/#input-type-change // // 1. If the previous state of the element's type attribute put the value IDL // attribute in the value mode, and the element's value is not the empty
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.h b/third_party/blink/renderer/core/html/forms/html_input_element.h index 43e0f412..ddcb54e 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.h +++ b/third_party/blink/renderer/core/html/forms/html_input_element.h
@@ -409,11 +409,11 @@ // The value string in |value| value mode. String non_attribute_value_; unsigned size_; - // https://html.spec.whatwg.org/multipage/forms.html#concept-input-value-dirty-flag + // https://html.spec.whatwg.org/C/#concept-input-value-dirty-flag unsigned has_dirty_value_ : 1; - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-checked + // https://html.spec.whatwg.org/C/#concept-fe-checked unsigned is_checked_ : 1; - // https://html.spec.whatwg.org/multipage/forms.html#concept-input-checked-dirty-flag + // https://html.spec.whatwg.org/C/#concept-input-checked-dirty-flag unsigned dirty_checkedness_ : 1; unsigned is_indeterminate_ : 1; unsigned is_activated_submit_ : 1;
diff --git a/third_party/blink/renderer/core/html/forms/html_label_element.cc b/third_party/blink/renderer/core/html/forms/html_label_element.cc index 906743e..0c286917 100644 --- a/third_party/blink/renderer/core/html/forms/html_label_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_label_element.cc
@@ -52,7 +52,7 @@ } HTMLElement* HTMLLabelElement::control() const { - // https://html.spec.whatwg.org/multipage/forms.html#labeled-control + // https://html.spec.whatwg.org/C/#labeled-control const AtomicString& control_id = getAttribute(kForAttr); if (control_id.IsNull()) { // "If the for attribute is not specified, but the label element has a
diff --git a/third_party/blink/renderer/core/html/forms/html_option_element.h b/third_party/blink/renderer/core/html/forms/html_option_element.h index fb3c45f..a4432a9 100644 --- a/third_party/blink/renderer/core/html/forms/html_option_element.h +++ b/third_party/blink/renderer/core/html/forms/html_option_element.h
@@ -111,10 +111,10 @@ void UpdateLabel(); // Represents 'selectedness'. - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-selectedness + // https://html.spec.whatwg.org/C/#concept-option-selectedness bool is_selected_; // Represents 'dirtiness'. - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-dirtiness + // https://html.spec.whatwg.org/C/#concept-option-dirtiness bool is_dirty_ = false; };
diff --git a/third_party/blink/renderer/core/html/forms/html_select_element.cc b/third_party/blink/renderer/core/html/forms/html_select_element.cc index 43680a4..29fad5a8 100644 --- a/third_party/blink/renderer/core/html/forms/html_select_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_select_element.cc
@@ -793,7 +793,7 @@ } void HTMLSelectElement::ResetToDefaultSelection(ResetReason reason) { - // https://html.spec.whatwg.org/multipage/forms.html#ask-for-a-reset + // https://html.spec.whatwg.org/C/#ask-for-a-reset if (IsMultiple()) return; HTMLOptionElement* first_enabled_option = nullptr;
diff --git a/third_party/blink/renderer/core/html/forms/input_type.cc b/third_party/blink/renderer/core/html/forms/input_type.cc index 340fe9a..55126511 100644 --- a/third_party/blink/renderer/core/html/forms/input_type.cc +++ b/third_party/blink/renderer/core/html/forms/input_type.cc
@@ -354,7 +354,7 @@ return std::make_pair(TypeMismatchText(), g_empty_string); if (PatternMismatch(value)) { - // https://html.spec.whatwg.org/multipage/forms.html#attr-input-pattern + // https://html.spec.whatwg.org/C/#attr-input-pattern // When an input element has a pattern attribute specified, authors // should include a title attribute to give a description of the // pattern. User agents may use the contents of this attribute, if it @@ -675,7 +675,7 @@ AnyStepHandling any_step_handling, TextFieldEventBehavior event_behavior, ExceptionState& exception_state) { - // https://html.spec.whatwg.org/multipage/forms.html#dom-input-stepup + // https://html.spec.whatwg.org/C/#dom-input-stepup StepRange step_range(CreateStepRange(any_step_handling)); // 2. If the element has no allowed value step, then throw an
diff --git a/third_party/blink/renderer/core/html/forms/input_type.h b/third_party/blink/renderer/core/html/forms/input_type.h index 22475ab26..1108f59 100644 --- a/third_party/blink/renderer/core/html/forms/input_type.h +++ b/third_party/blink/renderer/core/html/forms/input_type.h
@@ -91,7 +91,7 @@ // is missing. virtual String DefaultLabel() const; - // https://html.spec.whatwg.org/multipage/forms.html#dom-input-value + // https://html.spec.whatwg.org/C/#dom-input-value enum class ValueMode { kValue, kDefault, kDefaultOn, kFilename }; virtual ValueMode GetValueMode() const = 0;
diff --git a/third_party/blink/renderer/core/html/forms/listed_element.h b/third_party/blink/renderer/core/html/forms/listed_element.h index d79eab1..62c5a78 100644 --- a/third_party/blink/renderer/core/html/forms/listed_element.h +++ b/third_party/blink/renderer/core/html/forms/listed_element.h
@@ -44,7 +44,7 @@ class ValidationMessageClient; class ValidityState; -// https://html.spec.whatwg.org/multipage/forms.html#category-listed +// https://html.spec.whatwg.org/C/#category-listed class CORE_EXPORT ListedElement : public GarbageCollectedMixin { public: virtual ~ListedElement(); @@ -118,9 +118,9 @@ bool IsValidElement(); // Returns true if // - this is not a candidate for constraint validation, or - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#candidate-for-constraint-validation + // https://html.spec.whatwg.org/C/#candidate-for-constraint-validation // - this satisfies its constraints - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fv-valid + // https://html.spec.whatwg.org/C/#concept-fv-valid bool IsNotCandidateOrValid(); // This must be called when a validation constraint or control value is @@ -144,7 +144,7 @@ // This is for HTMLFieldSetElement class. void AncestorDisabledStateWasChanged(); - // https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled + // https://html.spec.whatwg.org/C/#concept-element-disabled bool IsActuallyDisabled() const; // Returns a static value of class-level support of the state restore
diff --git a/third_party/blink/renderer/core/html/forms/range_input_type.cc b/third_party/blink/renderer/core/html/forms/range_input_type.cc index 34d7308..8766fc2 100644 --- a/third_party/blink/renderer/core/html/forms/range_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/range_input_type.cc
@@ -144,7 +144,7 @@ GetElement().FastGetAttribute(kStepAttr)); // Range type always has range limitations because it has default // minimum/maximum. - // https://html.spec.whatwg.org/multipage/forms.html#range-state-(type=range):concept-input-min-default + // https://html.spec.whatwg.org/C/#range-state-(type=range):concept-input-min-default const bool kHasRangeLimitations = true; return StepRange(step_base, minimum, maximum, kHasRangeLimitations, step, step_description);
diff --git a/third_party/blink/renderer/core/html/forms/step_range.h b/third_party/blink/renderer/core/html/forms/step_range.h index 9bd9daad..b62c182 100644 --- a/third_party/blink/renderer/core/html/forms/step_range.h +++ b/third_party/blink/renderer/core/html/forms/step_range.h
@@ -83,7 +83,7 @@ bool HasStep() const { return has_step_; } Decimal Maximum() const { return maximum_; } Decimal Minimum() const { return minimum_; } - // https://html.spec.whatwg.org/multipage/forms.html#have-range-limitations + // https://html.spec.whatwg.org/C/#have-range-limitations bool HasRangeLimitations() const { return has_range_limitations_; } static Decimal ParseStep(AnyStepHandling, const StepDescription&,
diff --git a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc index 62b9ee0..22a7d4e 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc +++ b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc
@@ -78,7 +78,7 @@ style->InheritFrom(OwnerShadowHost()->ComputedStyleRef()); style->SetFlexGrow(1); - style->SetMinWidth(Length(0, kFixed)); + style->SetMinWidth(Length::Fixed(0)); style->SetDisplay(EDisplay::kBlock); style->SetDirection(TextDirection::kLtr);
diff --git a/third_party/blink/renderer/core/html/html_base_element.cc b/third_party/blink/renderer/core/html/html_base_element.cc index 24a433a8c..607a6676 100644 --- a/third_party/blink/renderer/core/html/html_base_element.cc +++ b/third_party/blink/renderer/core/html/html_base_element.cc
@@ -81,7 +81,7 @@ // relative to the document's base URL; base elements like this one can be // used to set that base URL. Thus we need to resolve relative to the // document's fallback base URL and ignore the base URL. - // https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href + // https://html.spec.whatwg.org/C/#dom-base-href const AtomicString& attribute_value = FastGetAttribute(kHrefAttr); if (attribute_value.IsNull())
diff --git a/third_party/blink/renderer/core/html/html_collection.cc b/third_party/blink/renderer/core/html/html_collection.cc index b869222..0abc7e93 100644 --- a/third_party/blink/renderer/core/html/html_collection.cc +++ b/third_party/blink/renderer/core/html/html_collection.cc
@@ -336,7 +336,7 @@ return nullptr; } -// https://html.spec.whatwg.org/multipage/infrastructure.html#all-named-elements +// https://html.spec.whatwg.org/C/#all-named-elements // The document.all collection returns only certain types of elements by name, // although it returns any type of element by id. static inline bool NameShouldBeVisibleInDocumentAll(
diff --git a/third_party/blink/renderer/core/html/html_data_element.idl b/third_party/blink/renderer/core/html/html_data_element.idl index 6f65099..3006a5c 100644 --- a/third_party/blink/renderer/core/html/html_data_element.idl +++ b/third_party/blink/renderer/core/html/html_data_element.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-data-element +// https://html.spec.whatwg.org/C/#the-data-element [HTMLConstructor] interface HTMLDataElement : HTMLElement {
diff --git a/third_party/blink/renderer/core/html/html_dimension.cc b/third_party/blink/renderer/core/html/html_dimension.cc index e1b0caf..a60bb14 100644 --- a/third_party/blink/renderer/core/html/html_dimension.cc +++ b/third_party/blink/renderer/core/html/html_dimension.cc
@@ -187,7 +187,7 @@ return true; } -// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-dimension-values +// https://html.spec.whatwg.org/C/#rules-for-parsing-dimension-values bool ParseDimensionValue(const String& input, HTMLDimension& dimension) { if (input.IsEmpty()) return false;
diff --git a/third_party/blink/renderer/core/html/html_element.cc b/third_party/blink/renderer/core/html/html_element.cc index f9a5028..f65eace 100644 --- a/third_party/blink/renderer/core/html/html_element.cc +++ b/third_party/blink/renderer/core/html/html_element.cc
@@ -1008,7 +1008,7 @@ bool HTMLElement::HasDirectionAuto() const { // <bdi> defaults to dir="auto" - // https://html.spec.whatwg.org/multipage/semantics.html#the-bdi-element + // https://html.spec.whatwg.org/C/#the-bdi-element const AtomicString& direction = FastGetAttribute(kDirAttr); return (IsHTMLBDIElement(*this) && direction == g_null_atom) || DeprecatedEqualIgnoringCase(direction, "auto");
diff --git a/third_party/blink/renderer/core/html/html_element.h b/third_party/blink/renderer/core/html/html_element.h index 7ea5752..69b6940 100644 --- a/third_party/blink/renderer/core/html/html_element.h +++ b/third_party/blink/renderer/core/html/html_element.h
@@ -109,7 +109,7 @@ virtual bool IsHTMLUnknownElement() const { return false; } virtual bool IsPluginElement() const { return false; } - // https://html.spec.whatwg.org/multipage/forms.html#category-label + // https://html.spec.whatwg.org/C/#category-label virtual bool IsLabelable() const; // |labels| IDL attribute implementation for IsLabelable()==true elements. LabelsNodeList* labels();
diff --git a/third_party/blink/renderer/core/html/html_embed_element.cc b/third_party/blink/renderer/core/html/html_embed_element.cc index ced7efac..b3d614d 100644 --- a/third_party/blink/renderer/core/html/html_embed_element.cc +++ b/third_party/blink/renderer/core/html/html_embed_element.cc
@@ -181,7 +181,7 @@ if (IsImageType()) return HTMLPlugInElement::LayoutObjectIsNeeded(style); - // https://html.spec.whatwg.org/multipage/embedded-content.html#the-embed-element + // https://html.spec.whatwg.org/C/#the-embed-element // While any of the following conditions are occurring, any plugin // instantiated for the element must be removed, and the embed element // represents nothing:
diff --git a/third_party/blink/renderer/core/html/html_image_element.h b/third_party/blink/renderer/core/html/html_image_element.h index e8769a36..9cf024e 100644 --- a/third_party/blink/renderer/core/html/html_image_element.h +++ b/third_party/blink/renderer/core/html/html_image_element.h
@@ -181,7 +181,7 @@ protected: // Controls how an image element appears in the layout. See: - // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request + // https://html.spec.whatwg.org/C/#image-request enum class LayoutDisposition : uint8_t { // Displayed as a partially or completely loaded image. Corresponds to the // `current request` state being: `unavailable`, `partially available`, or
diff --git a/third_party/blink/renderer/core/html/html_image_fallback_helper.cc b/third_party/blink/renderer/core/html/html_image_fallback_helper.cc index ac14855..d55f46f 100644 --- a/third_party/blink/renderer/core/html/html_image_fallback_helper.cc +++ b/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
@@ -116,7 +116,7 @@ image_has_intrinsic_dimensions && (element.GetDocument().InQuirksMode() || image_has_no_alt_attribute); if (treat_as_replaced) { - // https://html.spec.whatwg.org/multipage/rendering.html#images-3: + // https://html.spec.whatwg.org/C/#images-3: // "If the element does not represent an image, but the element already has // intrinsic dimensions (e.g. from the dimension attributes or CSS rules), // and either: the user agent has reason to believe that the image will
diff --git a/third_party/blink/renderer/core/html/html_meta_element.cc b/third_party/blink/renderer/core/html/html_meta_element.cc index 1c67a206..915e3df 100644 --- a/third_party/blink/renderer/core/html/html_meta_element.cc +++ b/third_party/blink/renderer/core/html/html_meta_element.cc
@@ -185,9 +185,9 @@ // 4) Other keywords and unknown values translate to auto. if (DeprecatedEqualIgnoringCase(value_string, "device-width")) - return Length(kDeviceWidth); + return Length::DeviceWidth(); if (DeprecatedEqualIgnoringCase(value_string, "device-height")) - return Length(kDeviceHeight); + return Length::DeviceHeight(); bool ok; @@ -204,7 +204,7 @@ value = document->GetPage()->GetChromeClient().WindowToViewportScalar(value); } - return Length(ClampLengthValue(value), kFixed); + return Length::Fixed(ClampLengthValue(value)); } float HTMLMetaElement::ParseViewportValueAsZoom( @@ -330,14 +330,14 @@ const Length& width = ParseViewportValueAsLength(document, report_warnings, key_string, value_string); if (!width.IsAuto()) { - description.min_width = Length(kExtendToZoom); + description.min_width = Length::ExtendToZoom(); description.max_width = width; } } else if (key_string == "height") { const Length& height = ParseViewportValueAsLength(document, report_warnings, key_string, value_string); if (!height.IsAuto()) { - description.min_height = Length(kExtendToZoom); + description.min_height = Length::ExtendToZoom(); description.max_height = height; } } else if (key_string == "initial-scale") {
diff --git a/third_party/blink/renderer/core/html/html_object_element.h b/third_party/blink/renderer/core/html/html_object_element.h index 3ae37a65..d04d10d0 100644 --- a/third_party/blink/renderer/core/html/html_object_element.h +++ b/third_party/blink/renderer/core/html/html_object_element.h
@@ -36,7 +36,7 @@ // Inheritance of ListedElement was used for NPAPI form association, but // is still kept here so that legacy APIs such as form attribute can keep // working according to the spec. See: -// https://html.spec.whatwg.org/multipage/embedded-content.html#the-object-element +// https://html.spec.whatwg.org/C/#the-object-element class CORE_EXPORT HTMLObjectElement final : public HTMLPlugInElement, public ListedElement, public FormAssociated {
diff --git a/third_party/blink/renderer/core/html/html_table_row_element_test.cc b/third_party/blink/renderer/core/html/html_table_row_element_test.cc index 5ba4120..cdf795e 100644 --- a/third_party/blink/renderer/core/html/html_table_row_element_test.cc +++ b/third_party/blink/renderer/core/html/html_table_row_element_test.cc
@@ -12,7 +12,7 @@ namespace blink { // rowIndex -// https://html.spec.whatwg.org/multipage/tables.html#dom-tr-rowindex +// https://html.spec.whatwg.org/C/#dom-tr-rowindex TEST(HTMLTableRowElementTest, rowIndex_notInTable) { Document* document = Document::CreateForTest();
diff --git a/third_party/blink/renderer/core/html/html_template_element.cc b/third_party/blink/renderer/core/html/html_template_element.cc index 50f7864..06b8ea3 100644 --- a/third_party/blink/renderer/core/html/html_template_element.cc +++ b/third_party/blink/renderer/core/html/html_template_element.cc
@@ -57,7 +57,7 @@ return content_.Get(); } -// https://html.spec.whatwg.org/multipage/scripting.html#the-template-element:concept-node-clone-ext +// https://html.spec.whatwg.org/C/#the-template-element:concept-node-clone-ext void HTMLTemplateElement::CloneNonAttributePropertiesFrom( const Element& source, CloneChildrenFlag flag) {
diff --git a/third_party/blink/renderer/core/html/html_time_element.idl b/third_party/blink/renderer/core/html/html_time_element.idl index 48677ffe..3f6e0c95 100644 --- a/third_party/blink/renderer/core/html/html_time_element.idl +++ b/third_party/blink/renderer/core/html/html_time_element.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-time-element +// https://html.spec.whatwg.org/C/#the-time-element [HTMLConstructor] interface HTMLTimeElement : HTMLElement {
diff --git a/third_party/blink/renderer/core/html/image_document.cc b/third_party/blink/renderer/core/html/image_document.cc index 0638e3e..f68b9ef 100644 --- a/third_party/blink/renderer/core/html/image_document.cc +++ b/third_party/blink/renderer/core/html/image_document.cc
@@ -262,7 +262,7 @@ // Adding a UA shadow root here is because the container <div> should be // hidden so that only the <img> element should be visible in <body>, // according to the spec: - // https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-media + // https://html.spec.whatwg.org/C/#read-media ShadowRoot& shadow_root = body->EnsureUserAgentShadowRoot(); shadow_root.AppendChild(div_element_); } else {
diff --git a/third_party/blink/renderer/core/html/lazy_load_frame_observer.cc b/third_party/blink/renderer/core/html/lazy_load_frame_observer.cc index 40d89cf..96facfd 100644 --- a/third_party/blink/renderer/core/html/lazy_load_frame_observer.cc +++ b/third_party/blink/renderer/core/html/lazy_load_frame_observer.cc
@@ -116,9 +116,8 @@ was_recorded_as_deferred_ = false; lazy_load_intersection_observer_ = IntersectionObserver::Create( - {Length(GetLazyFrameLoadingViewportDistanceThresholdPx( - element_->GetDocument()), - kFixed)}, + {Length::Fixed(GetLazyFrameLoadingViewportDistanceThresholdPx( + element_->GetDocument()))}, {std::numeric_limits<float>::min()}, &element_->GetDocument(), WTF::BindRepeating(&LazyLoadFrameObserver::LoadIfHiddenOrNearViewport, WrapWeakPersistent(this)));
diff --git a/third_party/blink/renderer/core/html/lazy_load_image_observer.cc b/third_party/blink/renderer/core/html/lazy_load_image_observer.cc index 2f10b82..f1cfd96 100644 --- a/third_party/blink/renderer/core/html/lazy_load_image_observer.cc +++ b/third_party/blink/renderer/core/html/lazy_load_image_observer.cc
@@ -103,8 +103,8 @@ "Images loaded lazily and replaced with placeholders. Load events are " "deferred. See https://crbug.com/846170")); lazy_load_intersection_observer_ = IntersectionObserver::Create( - {Length(GetLazyImageLoadingViewportDistanceThresholdPx(*root_document), - kFixed)}, + {Length::Fixed( + GetLazyImageLoadingViewportDistanceThresholdPx(*root_document))}, {std::numeric_limits<float>::min()}, root_document, WTF::BindRepeating(&LazyLoadImageObserver::LoadIfNearViewport, WrapWeakPersistent(this)));
diff --git a/third_party/blink/renderer/core/html/list_item_ordinal.h b/third_party/blink/renderer/core/html/list_item_ordinal.h index 2de3354..c830556 100644 --- a/third_party/blink/renderer/core/html/list_item_ordinal.h +++ b/third_party/blink/renderer/core/html/list_item_ordinal.h
@@ -39,7 +39,7 @@ class Node; // Represents an "ordinal value" and its related algorithms: -// https://html.spec.whatwg.org/multipage/grouping-content.html#ordinal-value +// https://html.spec.whatwg.org/C/#ordinal-value // // The ordinal value is determined by the DOM tree order. However, since any // elements with 'display: list-item' can be list items, the layout tree
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 8f3f91e..eecab41 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -2905,7 +2905,7 @@ const AtomicString& label, const AtomicString& language, ExceptionState& exception_state) { - // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-addtexttrack + // https://html.spec.whatwg.org/C/#dom-media-addtexttrack // The addTextTrack(kind, label, language) method of media elements, when // invoked, must run the following steps:
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index 75753e3..68807403 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h
@@ -515,7 +515,7 @@ // Generally the presence of the loop attribute should be considered to mean // playback has not "ended", as "ended" and "looping" are mutually exclusive. // See - // https://html.spec.whatwg.org/multipage/embedded-content.html#ended-playback + // https://html.spec.whatwg.org/C/#ended-playback enum class LoopCondition { kIncluded, kIgnored }; bool EndedPlayback(LoopCondition = LoopCondition::kIncluded) const;
diff --git a/third_party/blink/renderer/core/html/parser/html_construction_site.cc b/third_party/blink/renderer/core/html/parser/html_construction_site.cc index 469e175..98285a5 100644 --- a/third_party/blink/renderer/core/html/parser/html_construction_site.cc +++ b/third_party/blink/renderer/core/html/parser/html_construction_site.cc
@@ -871,7 +871,7 @@ } // "create an element for a token" -// https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token +// https://html.spec.whatwg.org/C/#create-an-element-for-the-token Element* HTMLConstructionSite::CreateElement( AtomicHTMLToken* token, const AtomicString& namespace_uri) {
diff --git a/third_party/blink/renderer/core/html/parser/html_construction_site.h b/third_party/blink/renderer/core/html/parser/html_construction_site.h index fe5e571..6a00a155 100644 --- a/third_party/blink/renderer/core/html/parser/html_construction_site.h +++ b/third_party/blink/renderer/core/html/parser/html_construction_site.h
@@ -275,9 +275,9 @@ // and a Document in all other cases. Member<ContainerNode> attachment_root_; - // https://html.spec.whatwg.org/multipage/syntax.html#head-element-pointer + // https://html.spec.whatwg.org/C/#head-element-pointer Member<HTMLStackItem> head_; - // https://html.spec.whatwg.org/multipage/syntax.html#form-element-pointer + // https://html.spec.whatwg.org/C/#form-element-pointer Member<HTMLFormElement> form_; mutable HTMLElementStack open_elements_; mutable HTMLFormattingElementList active_formatting_elements_;
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_idioms.cc b/third_party/blink/renderer/core/html/parser/html_parser_idioms.cc index 4200c56..c870dda 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_idioms.cc +++ b/third_party/blink/renderer/core/html/parser/html_parser_idioms.cc
@@ -199,12 +199,12 @@ const CharacterType* end, unsigned& value) { // This function is an implementation of the following algorithm: - // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers + // https://html.spec.whatwg.org/C/#rules-for-parsing-non-negative-integers // However, in order to support integers >= 2^31, we fold [1] into this. // 'Step N' in the following comments refers to [1]. // // [1] - // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers + // https://html.spec.whatwg.org/C/#rules-for-parsing-integers // Step 4: Skip whitespace. SkipWhile<CharacterType, IsHTMLSpace<CharacterType>>(position, end); @@ -241,7 +241,7 @@ return ParseHTMLNonNegativeIntegerInternal(start, start + length, value); } -// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers +// https://html.spec.whatwg.org/C/#rules-for-parsing-non-negative-integers bool ParseHTMLNonNegativeInteger(const String& input, unsigned& value) { return ParseHTMLNonNegativeIntegerInternal(input, value) == WTF::NumberParsingResult::kSuccess; @@ -301,7 +301,7 @@ return numbers; } -// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-list-of-floating-point-numbers +// https://html.spec.whatwg.org/C/#rules-for-parsing-a-list-of-floating-point-numbers Vector<double> ParseHTMLListOfFloatingPointNumbers(const String& input) { unsigned length = input.length(); if (!length || input.Is8Bit()) @@ -314,7 +314,7 @@ static const char kCharsetString[] = "charset"; static const size_t kCharsetLength = sizeof("charset") - 1; -// https://html.spec.whatwg.org/multipage/infrastructure.html#extracting-character-encodings-from-meta-elements +// https://html.spec.whatwg.org/C/#extracting-character-encodings-from-meta-elements String ExtractCharset(const String& value) { wtf_size_t pos = 0; unsigned length = value.length();
diff --git a/third_party/blink/renderer/core/html/parser/html_parser_idioms.h b/third_party/blink/renderer/core/html/parser/html_parser_idioms.h index 1048d15..58ff21f 100644 --- a/third_party/blink/renderer/core/html/parser/html_parser_idioms.h +++ b/third_party/blink/renderer/core/html/parser/html_parser_idioms.h
@@ -63,14 +63,14 @@ // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-negative-integers CORE_EXPORT bool ParseHTMLNonNegativeInteger(const String&, unsigned&); -// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#clamped-to-the-range +// https://html.spec.whatwg.org/C/#clamped-to-the-range // without default value processing. bool ParseHTMLClampedNonNegativeInteger(const String&, unsigned min, unsigned max, unsigned&); -// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-list-of-floating-point-numbers +// https://html.spec.whatwg.org/C/#rules-for-parsing-a-list-of-floating-point-numbers CORE_EXPORT Vector<double> ParseHTMLListOfFloatingPointNumbers(const String&); typedef Vector<std::pair<String, String>> HTMLAttributeList;
diff --git a/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc b/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc index c9ece165..637d43e 100644 --- a/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc +++ b/third_party/blink/renderer/core/html/parser/html_srcset_parser.cc
@@ -71,7 +71,7 @@ int ToInt(const CharType* attribute, bool& is_valid) { unsigned position = 0; // Make sure the integer is a valid non-negative integer - // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-non-negative-integer + // https://html.spec.whatwg.org/C/#valid-non-negative-integer unsigned length_excluding_descriptor = length - 1; while (position < length_excluding_descriptor) { if (!IsASCIIDigit(*(attribute + start + position))) { @@ -87,7 +87,7 @@ template <typename CharType> float ToFloat(const CharType* attribute, bool& is_valid) { // Make sure the is a valid floating point number - // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number + // https://html.spec.whatwg.org/C/#valid-floating-point-number unsigned length_excluding_descriptor = length - 1; if (length_excluding_descriptor > 0 && *(attribute + start) == '+') { is_valid = false;
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc index 2938897d..79a0fda 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc
@@ -459,7 +459,7 @@ } // "Any other start tag" bullet in -// https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign +// https://html.spec.whatwg.org/C/#parsing-main-inforeign static void AdjustSVGTagNameCase(AtomicHTMLToken* token) { static PrefixedNameToQualifiedNameMap* case_map = nullptr; if (!case_map) { @@ -490,12 +490,12 @@ } } -// https://html.spec.whatwg.org/multipage/parsing.html#adjust-svg-attributes +// https://html.spec.whatwg.org/C/#adjust-svg-attributes static void AdjustSVGAttributes(AtomicHTMLToken* token) { AdjustAttributes<svg_names::GetAttrs, svg_names::kAttrsCount>(token); } -// https://html.spec.whatwg.org/multipage/parsing.html#adjust-mathml-attributes +// https://html.spec.whatwg.org/C/#adjust-mathml-attributes static void AdjustMathMLAttributes(AtomicHTMLToken* token) { AdjustAttributes<mathml_names::GetAttrs, mathml_names::kAttrsCount>(token); }
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc index 24ff8c3ae..73e44eb7 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder_simulator.cc
@@ -252,7 +252,7 @@ return simulated_token; } -// https://html.spec.whatwg.org/multipage/parsing.html#html-integration-point +// https://html.spec.whatwg.org/C/#html-integration-point bool HTMLTreeBuilderSimulator::IsHTMLIntegrationPointForStartTag( const CompactHTMLToken& token) const { DCHECK(token.GetType() == HTMLToken::kStartTag) << token.GetType(); @@ -278,7 +278,7 @@ return false; } -// https://html.spec.whatwg.org/multipage/parsing.html#html-integration-point +// https://html.spec.whatwg.org/C/#html-integration-point bool HTMLTreeBuilderSimulator::IsHTMLIntegrationPointForEndTag( const CompactHTMLToken& token) const { if (token.GetType() != HTMLToken::kEndTag)
diff --git a/third_party/blink/renderer/core/html/rel_list.cc b/third_party/blink/renderer/core/html/rel_list.cc index f279eefdb..254b3ef 100644 --- a/third_party/blink/renderer/core/html/rel_list.cc +++ b/third_party/blink/renderer/core/html/rel_list.cc
@@ -40,7 +40,7 @@ bool RelList::ValidateTokenValue(const AtomicString& token_value, ExceptionState&) const { - // https://html.spec.whatwg.org/multipage/links.html#linkTypes + // https://html.spec.whatwg.org/C/#linkTypes if (GetElement().HasTagName(html_names::kLinkTag)) { if (SupportedTokensLink().Contains(token_value) || token_value == "modulepreload") {
diff --git a/third_party/blink/renderer/core/html/table_constants.h b/third_party/blink/renderer/core/html/table_constants.h index cbb7fb2..9cb86a0 100644 --- a/third_party/blink/renderer/core/html/table_constants.h +++ b/third_party/blink/renderer/core/html/table_constants.h
@@ -7,14 +7,14 @@ namespace blink { -// https://html.spec.whatwg.org/multipage/tables.html#dom-colgroup-span -// https://html.spec.whatwg.org/multipage/tables.html#dom-col-span -// https://html.spec.whatwg.org/multipage/tables.html#dom-tdth-colspan +// https://html.spec.whatwg.org/C/#dom-colgroup-span +// https://html.spec.whatwg.org/C/#dom-col-span +// https://html.spec.whatwg.org/C/#dom-tdth-colspan constexpr unsigned kDefaultColSpan = 1u; constexpr unsigned kMinColSpan = 1u; constexpr unsigned kMaxColSpan = 1000u; -// https://html.spec.whatwg.org/multipage/tables.html#dom-tdth-rowspan +// https://html.spec.whatwg.org/C/#dom-tdth-rowspan constexpr unsigned kDefaultRowSpan = 1u; constexpr unsigned kMaxRowSpan = 65534u; constexpr unsigned kMinRowSpan = 0;
diff --git a/third_party/blink/renderer/core/html/track/automatic_track_selection.cc b/third_party/blink/renderer/core/html/track/automatic_track_selection.cc index a52ac20..792173dd 100644 --- a/third_party/blink/renderer/core/html/track/automatic_track_selection.cc +++ b/third_party/blink/renderer/core/html/track/automatic_track_selection.cc
@@ -141,7 +141,7 @@ const TrackGroup& group) { DCHECK(group.tracks.size()); - // https://html.spec.whatwg.org/multipage/embedded-content.html#honor-user-preferences-for-automatic-text-track-selection + // https://html.spec.whatwg.org/C/#honor-user-preferences-for-automatic-text-track-selection // 4. If there are any text tracks in the media element's list of text // tracks whose text track kind is metadata that correspond to track
diff --git a/third_party/blink/renderer/core/html/track/text_track.cc b/third_party/blink/renderer/core/html/track/text_track.cc index 7a05be9..6bc0fe0 100644 --- a/third_party/blink/renderer/core/html/track/text_track.cc +++ b/third_party/blink/renderer/core/html/track/text_track.cc
@@ -217,7 +217,7 @@ if (std::isnan(cue->startTime()) || std::isnan(cue->endTime())) return; - // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-addcue + // https://html.spec.whatwg.org/C/#dom-texttrack-addcue // The addCue(cue) method of TextTrack objects, when invoked, must run the // following steps: @@ -242,7 +242,7 @@ void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exception_state) { DCHECK(cue); - // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-removecue + // https://html.spec.whatwg.org/C/#dom-texttrack-removecue // The removeCue(cue) method of TextTrack objects, when invoked, must run the // following steps:
diff --git a/third_party/blink/renderer/core/html/track/track_event.idl b/third_party/blink/renderer/core/html/track/track_event.idl index ac013fb..4bf135e 100644 --- a/third_party/blink/renderer/core/html/track/track_event.idl +++ b/third_party/blink/renderer/core/html/track/track_event.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/embedded-content.html#the-trackevent-interface +// https://html.spec.whatwg.org/C/#the-trackevent-interface [ Constructor(DOMString type, optional TrackEventInit eventInitDict)
diff --git a/third_party/blink/renderer/core/html/track/track_event_init.idl b/third_party/blink/renderer/core/html/track/track_event_init.idl index f37955a..bb0611ae 100644 --- a/third_party/blink/renderer/core/html/track/track_event_init.idl +++ b/third_party/blink/renderer/core/html/track/track_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/embedded-content.html#the-trackevent-interface +// https://html.spec.whatwg.org/C/#the-trackevent-interface dictionary TrackEventInit : EventInit { (VideoTrack or AudioTrack or TextTrack)? track;
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap.idl b/third_party/blink/renderer/core/imagebitmap/image_bitmap.idl index c27b0b3b9..706633c 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap.idl +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#images-2 +// https://html.spec.whatwg.org/C/#images-2 [ Exposed=(Window,Worker),
diff --git a/third_party/blink/renderer/core/input/mouse_event_manager.cc b/third_party/blink/renderer/core/input/mouse_event_manager.cc index e1ca5a0..756593f5 100644 --- a/third_party/blink/renderer/core/input/mouse_event_manager.cc +++ b/third_party/blink/renderer/core/input/mouse_event_manager.cc
@@ -1036,7 +1036,7 @@ return WebInputEventResult::kNotHandled; // We should be setting relatedTarget correctly following the spec: - // https://html.spec.whatwg.org/multipage/interaction.html#dragevent + // https://html.spec.whatwg.org/C/#dragevent // At the same time this should prevent exposing a node from another document. if (related_target && related_target->GetDocument() != drag_target->GetDocument())
diff --git a/third_party/blink/renderer/core/input/touch.idl b/third_party/blink/renderer/core/input/touch.idl index af13543..223edc2 100644 --- a/third_party/blink/renderer/core/input/touch.idl +++ b/third_party/blink/renderer/core/input/touch.idl
@@ -44,6 +44,6 @@ readonly attribute float force; // Canvas Hit Regions - // https://html.spec.whatwg.org/multipage/scripting.html#Touch-partial + // https://html.spec.whatwg.org/C/#Touch-partial [RuntimeEnabled=CanvasHitRegion] readonly attribute DOMString? region; };
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc b/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc index bdb377a..7abf8a13 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_geometry.cc
@@ -55,7 +55,7 @@ return LayoutUnit(static_cast<int>(reference_length.ToFloat() * length.Percent() / 100.0)); } - DCHECK_EQ(length.GetType(), kFixed); + DCHECK(length.IsFixed()); return LayoutUnit(length.IntValue()); }
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc b/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc index 328652df..c6579ce 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
@@ -85,16 +85,16 @@ const CSSParserToken& token = token_range.ConsumeIncludingWhitespace(); switch (token.GetType()) { case kPercentageToken: - root_margin.push_back(Length(token.NumericValue(), kPercent)); + root_margin.push_back(Length::Percent(token.NumericValue())); break; case kDimensionToken: switch (token.GetUnitType()) { case CSSPrimitiveValue::UnitType::kPixels: root_margin.push_back( - Length(static_cast<int>(floor(token.NumericValue())), kFixed)); + Length::Fixed(static_cast<int>(floor(token.NumericValue())))); break; case CSSPrimitiveValue::UnitType::kPercentage: - root_margin.push_back(Length(token.NumericValue(), kPercent)); + root_margin.push_back(Length::Percent(token.NumericValue())); break; default: exception_state.ThrowDOMException(
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc index bd07119b..2c25e277 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.cc
@@ -58,7 +58,7 @@ void LayoutWorkletGlobalScopeProxy::FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode credentials_mode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks* pending_tasks) { DCHECK(IsMainThread());
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h index f6bcd14..d933e5e9 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h +++ b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope_proxy.h
@@ -35,7 +35,7 @@ void FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks*) override; void WorkletObjectDestroyed() override;
diff --git a/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.cc b/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.cc index 8ca78288..060399833 100644 --- a/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.cc +++ b/third_party/blink/renderer/core/layout/grid_track_sizing_algorithm.cc
@@ -850,14 +850,14 @@ // Collapse empty auto repeat tracks if auto-fit. if (grid_.HasAutoRepeatEmptyTracks(direction) && grid_.IsEmptyAutoRepeatTrack(direction, translated_index)) - return {Length(kFixed), kLengthTrackSizing}; + return {Length::Fixed(), kLengthTrackSizing}; const GridTrackSize& track_size = RawGridTrackSize(direction, translated_index); if (track_size.IsFitContent()) { return IsRelativeGridLengthAsAuto(track_size.FitContentTrackBreadth(), direction) - ? GridTrackSize(Length(kAuto), Length(kMaxContent)) + ? GridTrackSize(Length::Auto(), Length::MaxContent()) : track_size; } @@ -872,9 +872,9 @@ WebFeature::kGridRowTrackPercentIndefiniteHeight); } if (min_track_breadth.HasPercentage()) - min_track_breadth = Length(kAuto); + min_track_breadth = Length::Auto(); if (max_track_breadth.HasPercentage()) - max_track_breadth = Length(kAuto); + max_track_breadth = Length::Auto(); } // Flex sizes are invalid as a min sizing function. However we still can have @@ -883,7 +883,7 @@ // TODO(jfernandez): https://github.com/w3c/csswg-drafts/issues/2611 // TODO(jfernandez): We may have to change IsIntrinsicSizedGridArea too. if (min_track_breadth.IsFlex()) - min_track_breadth = Length(kAuto); + min_track_breadth = Length::Auto(); return GridTrackSize(min_track_breadth, max_track_breadth); }
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 17c5754..d2a202c 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -3153,10 +3153,10 @@ if (containing_block_style.IsLeftToRightDirection() != StyleRef().IsLeftToRightDirection()) { if (!margin_start_length.IsAuto()) - margin_end_length = Length(kAuto); + margin_end_length = Length::Auto(); } else { if (!margin_end_length.IsAuto()) - margin_start_length = Length(kAuto); + margin_start_length = Length::Auto(); } } @@ -3272,11 +3272,10 @@ // The parent box is flexing us, so it has increased or decreased our // height. We have to grab our cached flexible height. if (HasOverrideLogicalHeight()) { - h = Length(OverrideLogicalHeight(), kFixed); + h = Length::Fixed(OverrideLogicalHeight()); } else if (treat_as_replaced) { - h = Length( - ComputeReplacedLogicalHeight() + BorderAndPaddingLogicalHeight(), - kFixed); + h = Length::Fixed(ComputeReplacedLogicalHeight() + + BorderAndPaddingLogicalHeight()); } else { h = StyleRef().LogicalHeight(); check_min_max_height = true; @@ -3287,9 +3286,8 @@ // https://bugs.webkit.org/show_bug.cgi?id=46418 if (h.IsAuto() && in_horizontal_box && ToLayoutDeprecatedFlexibleBox(Parent())->IsStretchingChildren()) { - h = Length( - ParentBox()->ContentLogicalHeight() - MarginBefore() - MarginAfter(), - kFixed); + h = Length::Fixed(ParentBox()->ContentLogicalHeight() - MarginBefore() - + MarginAfter()); check_min_max_height = false; } @@ -4751,7 +4749,7 @@ height_size_type == kMainOrPreferredSize || !logical_height_length.IsAuto()); if (height_size_type == kMinSize && logical_height_length.IsAuto()) - logical_height_length = Length(0, kFixed); + logical_height_length = Length::Fixed(0); // 'top' and 'bottom' cannot both be 'auto' because 'top would of been // converted to the static position in computePositionedLogicalHeight() @@ -5429,7 +5427,7 @@ } bool LayoutBox::PercentageLogicalHeightIsResolvable() const { - Length fake_length(100, kPercent); + Length fake_length = Length::Percent(100); return ComputePercentageLogicalHeight(fake_length) != -1; }
diff --git a/third_party/blink/renderer/core/layout/layout_button.cc b/third_party/blink/renderer/core/layout/layout_button.cc index 0ff22292a..f58451fb 100644 --- a/third_party/blink/renderer/core/layout/layout_button.cc +++ b/third_party/blink/renderer/core/layout/layout_button.cc
@@ -59,7 +59,7 @@ DCHECK_EQ(inner_, child); child_style.SetFlexGrow(1.0f); // min-width: 0; is needed for correct shrinking. - child_style.SetMinWidth(Length(0, kFixed)); + child_style.SetMinWidth(Length::Fixed(0)); // Use margin:auto instead of align-items:center to get safe centering, i.e. // when the content overflows, treat it the same as align-items: flex-start. child_style.SetMarginTop(Length());
diff --git a/third_party/blink/renderer/core/layout/layout_flexible_box.cc b/third_party/blink/renderer/core/layout/layout_flexible_box.cc index a30a307a..8cb06d3 100644 --- a/third_party/blink/renderer/core/layout/layout_flexible_box.cc +++ b/third_party/blink/renderer/core/layout/layout_flexible_box.cc
@@ -1039,7 +1039,7 @@ sizes.min_size = std::max(LayoutUnit(), sizes.min_size); } else if (algorithm.ShouldApplyMinSizeAutoForChild(child)) { LayoutUnit content_size = - ComputeMainAxisExtentForChild(child, kMinSize, Length(kMinContent)); + ComputeMainAxisExtentForChild(child, kMinSize, Length::MinContent()); DCHECK_GE(content_size, LayoutUnit()); if (HasAspectRatio(child) && child.IntrinsicSize().Height() > 0) content_size = @@ -1108,7 +1108,7 @@ // 2) of the flexbox spec. // We need to check for the flexbox to have a definite main size. // We make up a percentage to check whether we have a definite size. - if (!MainAxisLengthIsDefinite(child, Length(0, kPercent))) + if (!MainAxisLengthIsDefinite(child, Length::Percent(0))) return false; if (MainAxisIsInlineAxis(child))
diff --git a/third_party/blink/renderer/core/layout/layout_list_item.cc b/third_party/blink/renderer/core/layout/layout_list_item.cc index daa7aed..4529fee 100644 --- a/third_party/blink/renderer/core/layout/layout_list_item.cc +++ b/third_party/blink/renderer/core/layout/layout_list_item.cc
@@ -205,7 +205,7 @@ marker_parent = nullptr; } } else if (line_box_parent) { - ForceLogicalHeight(*marker_parent, Length(0, kFixed)); + ForceLogicalHeight(*marker_parent, Length::Fixed(0)); } } @@ -216,7 +216,7 @@ // Create marker_container and set its LogicalHeight to 0px. LayoutBlock* marker_container = CreateAnonymousBlock(); if (line_box_parent) - ForceLogicalHeight(*marker_container, Length(0, kFixed)); + ForceLogicalHeight(*marker_container, Length::Fixed(0)); marker_container->AddChild(marker_, FirstNonMarkerChild(marker_container)); AddChild(marker_container, before_child);
diff --git a/third_party/blink/renderer/core/layout/layout_list_marker.cc b/third_party/blink/renderer/core/layout/layout_list_marker.cc index 99284c0..15986960 100644 --- a/third_party/blink/renderer/core/layout/layout_list_marker.cc +++ b/third_party/blink/renderer/core/layout/layout_list_marker.cc
@@ -282,8 +282,8 @@ InlineMarginsForOutside(style, IsImage(), MinPreferredLogicalWidth()); } - Length start_length(margin_start, kFixed); - Length end_length(margin_end, kFixed); + Length start_length = Length::Fixed(margin_start); + Length end_length = Length::Fixed(margin_end); if (start_length != style.MarginStart() || end_length != style.MarginEnd()) { scoped_refptr<ComputedStyle> new_style = ComputedStyle::Clone(style);
diff --git a/third_party/blink/renderer/core/layout/layout_menu_list.cc b/third_party/blink/renderer/core/layout/layout_menu_list.cc index 5a6f950..2ee46c4 100644 --- a/third_party/blink/renderer/core/layout/layout_menu_list.cc +++ b/third_party/blink/renderer/core/layout/layout_menu_list.cc
@@ -120,7 +120,7 @@ inner_style.SetFlexGrow(1); inner_style.SetFlexShrink(1); // min-width: 0; is needed for correct shrinking. - inner_style.SetMinWidth(Length(0, kFixed)); + inner_style.SetMinWidth(Length::Fixed(0)); // Use margin:auto instead of align-items:center to get safe centering, i.e. // when the content overflows, treat it the same as align-items: flex-start. @@ -132,22 +132,21 @@ inner_style.SetAlignSelfPosition(ItemPosition::kFlexStart); } - Length padding_start = Length( - LayoutTheme::GetTheme().PopupInternalPaddingStart(StyleRef()), kFixed); + Length padding_start = Length::Fixed( + LayoutTheme::GetTheme().PopupInternalPaddingStart(StyleRef())); Length padding_end = - Length(LayoutTheme::GetTheme().PopupInternalPaddingEnd( - GetFrameView()->GetChromeClient(), StyleRef()), - kFixed); + Length::Fixed(LayoutTheme::GetTheme().PopupInternalPaddingEnd( + GetFrameView()->GetChromeClient(), StyleRef())); inner_style.SetPaddingLeft(StyleRef().Direction() == TextDirection::kLtr ? padding_start : padding_end); inner_style.SetPaddingRight(StyleRef().Direction() == TextDirection::kLtr ? padding_end : padding_start); - inner_style.SetPaddingTop(Length( - LayoutTheme::GetTheme().PopupInternalPaddingTop(StyleRef()), kFixed)); - inner_style.SetPaddingBottom(Length( - LayoutTheme::GetTheme().PopupInternalPaddingBottom(StyleRef()), kFixed)); + inner_style.SetPaddingTop(Length::Fixed( + LayoutTheme::GetTheme().PopupInternalPaddingTop(StyleRef()))); + inner_style.SetPaddingBottom(Length::Fixed( + LayoutTheme::GetTheme().PopupInternalPaddingBottom(StyleRef()))); inner_style.SetTextAlign(StyleRef().IsLeftToRightDirection() ? ETextAlign::kLeft : ETextAlign::kRight);
diff --git a/third_party/blink/renderer/core/layout/layout_table.h b/third_party/blink/renderer/core/layout/layout_table.h index 92feaf2f..f8b75d1 100644 --- a/third_party/blink/renderer/core/layout/layout_table.h +++ b/third_party/blink/renderer/core/layout/layout_table.h
@@ -57,7 +57,7 @@ // - zero or more LayoutTableCaption // - zero or more LayoutTableSection // This is aligned with what HTML5 expects: -// https://html.spec.whatwg.org/multipage/tables.html#the-table-element +// https://html.spec.whatwg.org/C/#the-table-element // with one difference: we allow more than one caption as we follow what // CSS expects (https://bugs.webkit.org/show_bug.cgi?id=69773). // Those expectations are enforced by LayoutTable::addChild, that wraps unknown
diff --git a/third_party/blink/renderer/core/layout/layout_table_cell.cc b/third_party/blink/renderer/core/layout/layout_table_cell.cc index 85607f2..482bfd8 100644 --- a/third_party/blink/renderer/core/layout/layout_table_cell.cc +++ b/third_party/blink/renderer/core/layout/layout_table_cell.cc
@@ -171,11 +171,11 @@ // Column widths specified on <col> apply to the border box of the cell, see // bug 8126. // FIXME: Why is border/padding ignored in the negative width case? - if (col_width_sum > 0) - return Length( - std::max(0, col_width_sum - BorderAndPaddingLogicalWidth().Ceil()), - kFixed); - return Length(col_width_sum, kFixed); + if (col_width_sum > 0) { + return Length::Fixed( + std::max(0, col_width_sum - BorderAndPaddingLogicalWidth().Ceil())); + } + return Length::Fixed(col_width_sum); } void LayoutTableCell::ComputePreferredLogicalWidths() {
diff --git a/third_party/blink/renderer/core/layout/layout_theme.cc b/third_party/blink/renderer/core/layout/layout_theme.cc index e01bd3db..d7df2dfe 100644 --- a/third_party/blink/renderer/core/layout/layout_theme.cc +++ b/third_party/blink/renderer/core/layout/layout_theme.cc
@@ -898,9 +898,9 @@ // static void LayoutTheme::SetSizeIfAuto(ComputedStyle& style, const IntSize& size) { if (style.Width().IsIntrinsicOrAuto()) - style.SetWidth(Length(size.Width(), kFixed)); + style.SetWidth(Length::Fixed(size.Width())); if (style.Height().IsIntrinsicOrAuto()) - style.SetHeight(Length(size.Height(), kFixed)); + style.SetHeight(Length::Fixed(size.Height())); } // static @@ -925,8 +925,8 @@ // static void LayoutTheme::SetMinimumSizeIfAuto(ComputedStyle& style, const IntSize& size) { - LengthSize length_size(Length(size.Width(), kFixed), - Length(size.Height(), kFixed)); + LengthSize length_size(Length::Fixed(size.Width()), + Length::Fixed(size.Height())); SetMinimumSize(style, &length_size); }
diff --git a/third_party/blink/renderer/core/layout/layout_theme_default.cc b/third_party/blink/renderer/core/layout/layout_theme_default.cc index 5c154fb..6e1aae5 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_default.cc +++ b/third_party/blink/renderer/core/layout/layout_theme_default.cc
@@ -171,11 +171,11 @@ // FIXME: Mock theme doesn't handle zoomed sliders. float zoom_level = UseMockTheme() ? 1 : style.EffectiveZoom(); if (style.Appearance() == kSliderThumbHorizontalPart) { - style.SetWidth(Length(size.Width() * zoom_level, kFixed)); - style.SetHeight(Length(size.Height() * zoom_level, kFixed)); + style.SetWidth(Length::Fixed(size.Width() * zoom_level)); + style.SetHeight(Length::Fixed(size.Height() * zoom_level)); } else if (style.Appearance() == kSliderThumbVerticalPart) { - style.SetWidth(Length(size.Height() * zoom_level, kFixed)); - style.SetHeight(Length(size.Width() * zoom_level, kFixed)); + style.SetWidth(Length::Fixed(size.Height() * zoom_level)); + style.SetHeight(Length::Fixed(size.Width() * zoom_level)); } } @@ -224,8 +224,8 @@ WebThemeEngine::kPartInnerSpinButton); float zoom_level = style.EffectiveZoom(); - style.SetWidth(Length(size.Width() * zoom_level, kFixed)); - style.SetMinWidth(Length(size.Width() * zoom_level, kFixed)); + style.SetWidth(Length::Fixed(size.Width() * zoom_level)); + style.SetMinWidth(Length::Fixed(size.Width() * zoom_level)); } bool LayoutThemeDefault::ShouldOpenPickerWithF4Key() const { @@ -296,8 +296,8 @@ int cancel_button_size = static_cast<int>(lroundf(std::min( std::max(kMinCancelButtonSize, kDefaultCancelButtonSize * font_scale), kMaxCancelButtonSize))); - style.SetWidth(Length(cancel_button_size, kFixed)); - style.SetHeight(Length(cancel_button_size, kFixed)); + style.SetWidth(Length::Fixed(cancel_button_size)); + style.SetHeight(Length::Fixed(cancel_button_size)); } void LayoutThemeDefault::AdjustMenuListStyle(ComputedStyle& style,
diff --git a/third_party/blink/renderer/core/layout/layout_theme_mac.mm b/third_party/blink/renderer/core/layout/layout_theme_mac.mm index 2563c9fb7..7929f5f 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_mac.mm +++ b/third_party/blink/renderer/core/layout/layout_theme_mac.mm
@@ -556,9 +556,9 @@ // account. IntSize size = SizeForFont(style, sizes); if (style.Width().IsIntrinsicOrAuto() && size.Width() > 0) - style.SetWidth(Length(size.Width(), kFixed)); + style.SetWidth(Length::Fixed(size.Width())); if (style.Height().IsAuto() && size.Height() > 0) - style.SetHeight(Length(size.Height(), kFixed)); + style.SetHeight(Length::Fixed(size.Height())); } void LayoutThemeMac::SetFontFromControlSize(ComputedStyle& style, @@ -641,7 +641,7 @@ style.ResetPadding(); // Height is locked to auto. - style.SetHeight(Length(kAuto)); + style.SetHeight(Length::Auto()); // White-space is locked to pre. style.SetWhiteSpace(EWhiteSpace::kPre); @@ -726,7 +726,7 @@ int(kBaseBorderRadius + font_scale - 1))); // FIXME: Round up? const int kMinHeight = 15; - style.SetMinHeight(Length(kMinHeight, kFixed)); + style.SetMinHeight(Length::Fixed(kMinHeight)); style.SetLineHeight(ComputedStyleInitialValues::InitialLineHeight()); } @@ -808,7 +808,7 @@ style.SetBorderTopStyle(EBorderStyle::kInset); // Override height. - style.SetHeight(Length(kAuto)); + style.SetHeight(Length::Auto()); SetSearchFieldSize(style); NSControlSize control_size = ControlSizeForFont(style); @@ -817,10 +817,10 @@ const int vertical_padding = 1 * style.EffectiveZoom(); const int horizontal_padding = SearchFieldHorizontalPaddings()[control_size] * style.EffectiveZoom(); - style.SetPaddingLeft(Length(horizontal_padding, kFixed)); - style.SetPaddingRight(Length(horizontal_padding, kFixed)); - style.SetPaddingTop(Length(vertical_padding, kFixed)); - style.SetPaddingBottom(Length(vertical_padding, kFixed)); + style.SetPaddingLeft(Length::Fixed(horizontal_padding)); + style.SetPaddingRight(Length::Fixed(horizontal_padding)); + style.SetPaddingTop(Length::Fixed(vertical_padding)); + style.SetPaddingBottom(Length::Fixed(vertical_padding)); SetFontFromControlSize(style, control_size); @@ -836,8 +836,8 @@ void LayoutThemeMac::AdjustSearchFieldCancelButtonStyle( ComputedStyle& style) const { IntSize size = SizeForSystemFont(style, CancelButtonSizes()); - style.SetWidth(Length(size.Width(), kFixed)); - style.SetHeight(Length(size.Height(), kFixed)); + style.SetWidth(Length::Fixed(size.Width())); + style.SetHeight(Length::Fixed(size.Height())); style.SetBoxShadow(nullptr); } @@ -855,7 +855,7 @@ int height = ProgressBarHeights()[control_size] * zoom_level; // Now inflate it to account for the shadow. - style.SetMinHeight(Length(height + zoom_level, kFixed)); + style.SetMinHeight(Length::Fixed(height + zoom_level)); } void LayoutThemeMac::AdjustSliderThumbSize(ComputedStyle& style) const { @@ -863,9 +863,9 @@ if (style.Appearance() == kSliderThumbHorizontalPart || style.Appearance() == kSliderThumbVerticalPart) { style.SetWidth( - Length(static_cast<int>(kSliderThumbWidth * zoom_level), kFixed)); + Length::Fixed(static_cast<int>(kSliderThumbWidth * zoom_level))); style.SetHeight( - Length(static_cast<int>(kSliderThumbHeight * zoom_level), kFixed)); + Length::Fixed(static_cast<int>(kSliderThumbHeight * zoom_level))); } }
diff --git a/third_party/blink/renderer/core/layout/layout_theme_mobile.cc b/third_party/blink/renderer/core/layout/layout_theme_mobile.cc index 4a7e186b..dbbfe5be 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_mobile.cc +++ b/third_party/blink/renderer/core/layout/layout_theme_mobile.cc
@@ -58,8 +58,8 @@ IntSize size = Platform::Current()->ThemeEngine()->GetSize( WebThemeEngine::kPartInnerSpinButton); - style.SetWidth(Length(size.Width(), kFixed)); - style.SetMinWidth(Length(size.Width(), kFixed)); + style.SetWidth(Length::Fixed(size.Width())); + style.SetMinWidth(Length::Fixed(size.Width())); } }
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc index ec1143a..912dcea 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc
@@ -449,7 +449,7 @@ TEST_F(NGInlineNodeTest, CreateLineBidiIsolate) { UseLayoutObjectAndAhem(); scoped_refptr<ComputedStyle> style = ComputedStyle::Create(); - style->SetLineHeight(Length(1, kFixed)); + style->SetLineHeight(Length::Fixed(1)); style->GetFont().Update(nullptr); NGInlineNodeForTest node = CreateInlineNode(); node = CreateBidiIsolateNode(node, style.get(), layout_object_);
diff --git a/third_party/blink/renderer/core/layout/ng/layout_ng_fieldset.cc b/third_party/blink/renderer/core/layout/ng/layout_ng_fieldset.cc index eca59a4..78e976c0 100644 --- a/third_party/blink/renderer/core/layout/ng/layout_ng_fieldset.cc +++ b/third_party/blink/renderer/core/layout/ng/layout_ng_fieldset.cc
@@ -54,7 +54,7 @@ new_style->SetJustifyContent(StyleRef().JustifyContent()); // TODO(mstensho): Inherit all properties listed here: - // https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements + // https://html.spec.whatwg.org/C/#the-fieldset-and-legend-elements fieldset_content = LayoutBlock::CreateAnonymousWithParentAndDisplay( this, new_style->Display());
diff --git a/third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.cc b/third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.cc index be144715..05c93c1 100644 --- a/third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.cc +++ b/third_party/blink/renderer/core/layout/ng/list/layout_ng_list_item.cc
@@ -133,8 +133,8 @@ style, EDisplay::kInline); auto margins = LayoutListMarker::InlineMarginsForInside(style, IsMarkerImage()); - marker_style->SetMarginStart(Length(margins.first, kFixed)); - marker_style->SetMarginEnd(Length(margins.second, kFixed)); + marker_style->SetMarginStart(Length::Fixed(margins.first)); + marker_style->SetMarginEnd(Length::Fixed(margins.second)); } else { if (marker_ && !marker_->IsLayoutBlockFlow()) DestroyMarker();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc index 19255ef..57fe1f2c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils.cc
@@ -498,7 +498,7 @@ // This code implements <dialog> static position spec. // // - // https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element + // https://html.spec.whatwg.org/C/#the-dialog-element HTMLDialogElement* dialog_node = ToHTMLDialogElement(dialog.GetNode()); if (dialog_node->GetCenteringMode() == HTMLDialogElement::kNotCentered) return base::nullopt;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc index f22a454..01c0fcd 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc
@@ -54,20 +54,18 @@ LayoutUnit margin_right, LayoutUnit right, WritingMode writing_mode = WritingMode::kHorizontalTb) { - style_->SetLeft(left == NGAuto ? Length(LengthType::kAuto) - : Length(left.ToInt(), LengthType::kFixed)); - style_->SetMarginLeft(margin_left == NGAuto ? Length(LengthType::kAuto) - : Length(margin_left.ToInt(), - LengthType::kFixed)); - style_->SetWidth(width == NGAuto - ? Length(LengthType::kAuto) - : Length(width.ToInt(), LengthType::kFixed)); - style_->SetMarginRight(margin_right == NGAuto ? Length(LengthType::kAuto) - : Length(margin_right.ToInt(), - LengthType::kFixed)); - style_->SetRight(right == NGAuto - ? Length(LengthType::kAuto) - : Length(right.ToInt(), LengthType::kFixed)); + style_->SetLeft(left == NGAuto ? Length::Auto() + : Length::Fixed(left.ToInt())); + style_->SetMarginLeft(margin_left == NGAuto + ? Length::Auto() + : Length::Fixed(margin_left.ToInt())); + style_->SetWidth(width == NGAuto ? Length::Auto() + : Length::Fixed(width.ToInt())); + style_->SetMarginRight(margin_right == NGAuto + ? Length::Auto() + : Length::Fixed(margin_right.ToInt())); + style_->SetRight(right == NGAuto ? Length::Auto() + : Length::Fixed(right.ToInt())); style_->SetWritingMode(writing_mode); } @@ -77,21 +75,17 @@ LayoutUnit margin_bottom, LayoutUnit bottom, WritingMode writing_mode = WritingMode::kHorizontalTb) { - style_->SetTop(top == NGAuto ? Length(LengthType::kAuto) - : Length(top.ToInt(), LengthType::kFixed)); + style_->SetTop(top == NGAuto ? Length::Auto() : Length::Fixed(top.ToInt())); style_->SetMarginTop(margin_top == NGAuto - ? Length(LengthType::kAuto) - : Length(margin_top.ToInt(), LengthType::kFixed)); - style_->SetHeight(height == NGAuto - ? Length(LengthType::kAuto) - : Length(height.ToInt(), LengthType::kFixed)); - style_->SetMarginBottom( - margin_bottom == NGAuto - ? Length(LengthType::kAuto) - : Length(margin_bottom.ToInt(), LengthType::kFixed)); - style_->SetBottom(bottom == NGAuto - ? Length(LengthType::kAuto) - : Length(bottom.ToInt(), LengthType::kFixed)); + ? Length::Auto() + : Length::Fixed(margin_top.ToInt())); + style_->SetHeight(height == NGAuto ? Length::Auto() + : Length::Fixed(height.ToInt())); + style_->SetMarginBottom(margin_bottom == NGAuto + ? Length::Auto() + : Length::Fixed(margin_bottom.ToInt())); + style_->SetBottom(bottom == NGAuto ? Length::Auto() + : Length::Fixed(bottom.ToInt())); style_->SetWritingMode(writing_mode); } @@ -131,8 +125,8 @@ style_->SetBorderLeftWidth(border_left.ToInt()); style_->SetBorderRightWidth(border_right.ToInt()); - style_->SetPaddingLeft(Length(padding_left.ToInt(), LengthType::kFixed)); - style_->SetPaddingRight(Length(padding_right.ToInt(), LengthType::kFixed)); + style_->SetPaddingLeft(Length::Fixed(padding_left.ToInt())); + style_->SetPaddingRight(Length::Fixed(padding_right.ToInt())); // These default to 3 which is not what we want. style_->SetBorderBottomWidth(0); @@ -357,8 +351,8 @@ style_->SetBorderTopWidth(border_top.ToInt()); style_->SetBorderBottomWidth(border_bottom.ToInt()); - style_->SetPaddingTop(Length(padding_top.ToInt(), LengthType::kFixed)); - style_->SetPaddingBottom(Length(padding_bottom.ToInt(), LengthType::kFixed)); + style_->SetPaddingTop(Length::Fixed(padding_top.ToInt())); + style_->SetPaddingBottom(Length::Fixed(padding_bottom.ToInt())); // These default to 3 which is not what we want. style_->SetBorderLeftWidth(0); style_->SetBorderRightWidth(0); @@ -513,10 +507,10 @@ LayoutUnit min{50}; LayoutUnit max{150}; - style_->SetMinWidth(Length(min.ToInt(), LengthType::kFixed)); - style_->SetMaxWidth(Length(max.ToInt(), LengthType::kFixed)); - style_->SetMinHeight(Length(min.ToInt(), LengthType::kFixed)); - style_->SetMaxHeight(Length(max.ToInt(), LengthType::kFixed)); + style_->SetMinWidth(Length::Fixed(min.ToInt())); + style_->SetMaxWidth(Length::Fixed(max.ToInt())); + style_->SetMinHeight(Length::Fixed(min.ToInt())); + style_->SetMaxHeight(Length::Fixed(max.ToInt())); NGBoxStrut ltr_border_padding = ComputeBorders(ltr_space_, *style_) + ComputePadding(ltr_space_, *style_);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 018d7c5..ab4f5ee 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -574,7 +574,7 @@ // perform this calculation differently, e.g. by just ignoring the // *last* quirky margin. // TODO: revisit previous implementation to avoid changing behavior and - // https://html.spec.whatwg.org/multipage/rendering.html#margin-collapsing-quirks + // https://html.spec.whatwg.org/C/#margin-collapsing-quirks LayoutUnit margin_strut_sum = node_.IsQuirkyContainer() ? end_margin_strut.QuirkyContainerSum() : end_margin_strut.Sum();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc index 2048191..c7c8bfe 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -415,13 +415,13 @@ }; // height == auto - run_test(Length(kAuto)); + run_test(Length::Auto()); // Margins are collapsed with the result 200 = std::max(20, 200) // The fragment size 258 == body's margin 8 + child's height 50 + 200 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(258)), fragment->Size()); // height == fixed - run_test(Length(50, kFixed)); + run_test(Length::Fixed(50)); // Margins are not collapsed, so fragment still has margins == 20. // The fragment size 78 == body's margin 8 + child's height 50 + 20 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(78)), fragment->Size()); @@ -469,7 +469,7 @@ }; // with padding - run_test(Length(20, kFixed)); + run_test(Length::Fixed(20)); // 500 = child's height 50 + 2xmargin 400 + paddint-top 20 + // container's margin 30 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(500)), fragment->Size()); @@ -479,7 +479,7 @@ EXPECT_EQ(LayoutUnit(220), child_offset.top); // without padding - run_test(Length(0, kFixed)); + run_test(Length::Fixed(0)); // 450 = 2xmax(body's margin 8, container's margin 30, child's margin 200) + // child's height 50 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(450)), fragment->Size()); @@ -777,11 +777,11 @@ // Base case of no margins. run_test( - /* #zero-top margin-bottom */ Length(0, kFixed), - /* #zero-inner margin-top */ Length(0, kFixed), - /* #zero-inner margin-bottom */ Length(0, kFixed), - /* #zero margin-bottom */ Length(0, kFixed), - /* #inflow margin-top */ Length(0, kFixed)); + /* #zero-top margin-bottom */ Length::Fixed(0), + /* #zero-inner margin-top */ Length::Fixed(0), + /* #zero-inner margin-bottom */ Length::Fixed(0), + /* #zero margin-bottom */ Length::Fixed(0), + /* #inflow margin-top */ Length::Fixed(0)); // #zero, #abs, #inflow should all be positioned at the float. EXPECT_EQ(LayoutUnit(50), zero->Location().Y()); @@ -791,11 +791,11 @@ // A margin strut which resolves to -50 (-70 + 20) adjusts the position of // #zero to the float clearance. run_test( - /* #zero-top margin-bottom */ Length(0, kFixed), - /* #zero-inner margin-top */ Length(-60, kFixed), - /* #zero-inner margin-bottom */ Length(20, kFixed), - /* #zero margin-bottom */ Length(-70, kFixed), - /* #inflow margin-top */ Length(50, kFixed)); + /* #zero-top margin-bottom */ Length::Fixed(0), + /* #zero-inner margin-top */ Length::Fixed(-60), + /* #zero-inner margin-bottom */ Length::Fixed(20), + /* #zero margin-bottom */ Length::Fixed(-70), + /* #inflow margin-top */ Length::Fixed(50)); // #zero is placed at the float, the margin strut is at: // 90 = (50 - (-60 + 20)). @@ -815,11 +815,11 @@ // NOTE: This case below has wildly different results on different browsers, // we may have to change the behaviour here in the future for web compat. run_test( - /* #zero-top margin-bottom */ Length(0, kFixed), - /* #zero-inner margin-top */ Length(70, kFixed), - /* #zero-inner margin-bottom */ Length(-10, kFixed), - /* #zero margin-bottom */ Length(-20, kFixed), - /* #inflow margin-top */ Length(80, kFixed)); + /* #zero-top margin-bottom */ Length::Fixed(0), + /* #zero-inner margin-top */ Length::Fixed(70), + /* #zero-inner margin-bottom */ Length::Fixed(-10), + /* #zero margin-bottom */ Length::Fixed(-20), + /* #inflow margin-top */ Length::Fixed(80)); // #zero is placed at 60 (-10 + 70). EXPECT_EQ(LayoutUnit(60), zero->Location().Y()); @@ -836,11 +836,11 @@ // affected by clearance, it needs to have layout performed again, starting // with an empty margin strut. run_test( - /* #zero-top margin-bottom */ Length(30, kFixed), - /* #zero-inner margin-top */ Length(20, kFixed), - /* #zero-inner margin-bottom */ Length(-10, kFixed), - /* #zero margin-bottom */ Length(0, kFixed), - /* #inflow margin-top */ Length(25, kFixed)); + /* #zero-top margin-bottom */ Length::Fixed(30), + /* #zero-inner margin-top */ Length::Fixed(20), + /* #zero-inner margin-bottom */ Length::Fixed(-10), + /* #zero margin-bottom */ Length::Fixed(0), + /* #inflow margin-top */ Length::Fixed(25)); // #zero is placed at the float, the margin strut is at: // 40 = (50 - (-10 + 20)). @@ -2163,7 +2163,7 @@ }; // #new-fc is small enough to fit on the same line with #float. - run_test(Length(80, kFixed)); + run_test(Length::Fixed(80)); // 100 = float's width, 0 = no margin collapsing EXPECT_THAT(new_fc_offset, NGPhysicalOffset(LayoutUnit(100), LayoutUnit(0))); // 8 = body's margins, 20 = new-fc's margin top(20) collapses with @@ -2171,7 +2171,7 @@ EXPECT_THAT(body_offset, NGPhysicalOffset(LayoutUnit(8), LayoutUnit(20))); // #new-fc is too wide to be positioned on the same line with #float - run_test(Length(120, kFixed)); + run_test(Length::Fixed(120)); // 30 = #float's height EXPECT_THAT(new_fc_offset, NGPhysicalOffset(LayoutUnit(0), LayoutUnit(30))); // 8 = body's margins, no margin collapsing
diff --git a/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc index 9899e56..0b9af17 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc
@@ -480,7 +480,7 @@ const ComputedStyle& style = node.Style(); Length logical_width = style.LogicalWidth(); if (logical_width.IsAuto() && space.IsShrinkToFit()) - logical_width = Length(kFitContent); + logical_width = Length::FitContent(); LayoutBox* box = node.GetLayoutBox(); // If we have usable cached min/max intrinsic sizes, use those if we can. They @@ -1127,7 +1127,7 @@ node.Style().FlexBasis().IsPercentOrCalc())) { // This call has the side-effect of setting HasPercentHeightDescendants // correctly. - node.GetLayoutBox()->ComputePercentageLogicalHeight(Length(0, kPercent)); + node.GetLayoutBox()->ComputePercentageLogicalHeight(Length::Percent(0)); } return NGLogicalSize(
diff --git a/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc b/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc index 92fdc51..83a15f427 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc
@@ -105,57 +105,57 @@ }; TEST_F(NGLengthUtilsTest, testResolveInlineLength) { - EXPECT_EQ(LayoutUnit(60), ResolveInlineLength(Length(30, kPercent))); - EXPECT_EQ(LayoutUnit(150), ResolveInlineLength(Length(150, kFixed))); + EXPECT_EQ(LayoutUnit(60), ResolveInlineLength(Length::Percent(30))); + EXPECT_EQ(LayoutUnit(150), ResolveInlineLength(Length::Fixed(150))); EXPECT_EQ(LayoutUnit(0), - ResolveInlineLength(Length(kAuto), LengthResolveType::kMinSize, + ResolveInlineLength(Length::Auto(), LengthResolveType::kMinSize, LengthResolvePhase::kIntrinsic)); - EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(kAuto))); - EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(kFillAvailable))); + EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length::Auto())); + EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length::FillAvailable())); EXPECT_EQ( LayoutUnit::Max(), - ResolveInlineLength(Length(30, kPercent), LengthResolveType::kMaxSize, + ResolveInlineLength(Length::Percent(30), LengthResolveType::kMaxSize, LengthResolvePhase::kIntrinsic)); EXPECT_EQ( LayoutUnit::Max(), - ResolveInlineLength(Length(kFillAvailable), LengthResolveType::kMaxSize, + ResolveInlineLength(Length::FillAvailable(), LengthResolveType::kMaxSize, LengthResolvePhase::kIntrinsic)); MinMaxSize sizes; sizes.min_size = LayoutUnit(30); sizes.max_size = LayoutUnit(40); EXPECT_EQ( LayoutUnit(30), - ResolveInlineLength(Length(kMinContent), LengthResolveType::kContentSize, + ResolveInlineLength(Length::MinContent(), LengthResolveType::kContentSize, LengthResolvePhase::kLayout, sizes)); EXPECT_EQ( LayoutUnit(40), - ResolveInlineLength(Length(kMaxContent), LengthResolveType::kContentSize, + ResolveInlineLength(Length::MaxContent(), LengthResolveType::kContentSize, LengthResolvePhase::kLayout, sizes)); EXPECT_EQ( LayoutUnit(40), - ResolveInlineLength(Length(kFitContent), LengthResolveType::kContentSize, + ResolveInlineLength(Length::FitContent(), LengthResolveType::kContentSize, LengthResolvePhase::kLayout, sizes)); sizes.max_size = LayoutUnit(800); EXPECT_EQ( LayoutUnit(200), - ResolveInlineLength(Length(kFitContent), LengthResolveType::kContentSize, + ResolveInlineLength(Length::FitContent(), LengthResolveType::kContentSize, LengthResolvePhase::kLayout, sizes)); #if DCHECK_IS_ON() // This should fail a DCHECK. - EXPECT_DEATH_IF_SUPPORTED(ResolveInlineLength(Length(kFitContent)), ""); + EXPECT_DEATH_IF_SUPPORTED(ResolveInlineLength(Length::FitContent()), ""); #endif } TEST_F(NGLengthUtilsTest, testResolveBlockLength) { - EXPECT_EQ(LayoutUnit(90), ResolveBlockLength(Length(30, kPercent))); - EXPECT_EQ(LayoutUnit(150), ResolveBlockLength(Length(150, kFixed))); - EXPECT_EQ(LayoutUnit(0), ResolveBlockLength(Length(kAuto))); - EXPECT_EQ(LayoutUnit(300), ResolveBlockLength(Length(kFillAvailable))); + EXPECT_EQ(LayoutUnit(90), ResolveBlockLength(Length::Percent(30))); + EXPECT_EQ(LayoutUnit(150), ResolveBlockLength(Length::Fixed(150))); + EXPECT_EQ(LayoutUnit(0), ResolveBlockLength(Length::Auto())); + EXPECT_EQ(LayoutUnit(300), ResolveBlockLength(Length::FillAvailable())); - EXPECT_EQ(LayoutUnit(0), ResolveBlockLength(Length(kAuto))); - EXPECT_EQ(LayoutUnit(300), ResolveBlockLength(Length(kFillAvailable))); + EXPECT_EQ(LayoutUnit(0), ResolveBlockLength(Length::Auto())); + EXPECT_EQ(LayoutUnit(300), ResolveBlockLength(Length::FillAvailable())); } TEST_F(NGLengthUtilsTest, testComputeContentContribution) { @@ -166,30 +166,30 @@ NGBoxStrut border_padding; MinMaxSize expected = sizes; - style_->SetLogicalWidth(Length(30, kPercent)); + style_->SetLogicalWidth(Length::Percent(30)); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); - style_->SetLogicalWidth(Length(kFillAvailable)); + style_->SetLogicalWidth(Length::FillAvailable()); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); expected = MinMaxSize{LayoutUnit(150), LayoutUnit(150)}; - style_->SetLogicalWidth(Length(150, kFixed)); + style_->SetLogicalWidth(Length::Fixed(150)); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); expected = sizes; - style_->SetLogicalWidth(Length(kAuto)); + style_->SetLogicalWidth(Length::Auto()); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); expected = MinMaxSize{LayoutUnit(430), LayoutUnit(440)}; - style_->SetPaddingLeft(Length(400, kFixed)); + style_->SetPaddingLeft(Length::Fixed(400)); auto sizes_padding400 = sizes; sizes_padding400 += LayoutUnit(400); NGBoxStrut border_padding400 = {LayoutUnit(400), LayoutUnit(), LayoutUnit(), @@ -199,7 +199,7 @@ sizes_padding400)); expected = MinMaxSize{LayoutUnit(30), LayoutUnit(40)}; - style_->SetPaddingLeft(Length(0, kFixed)); + style_->SetPaddingLeft(Length::Fixed(0)); style_->SetLogicalWidth(Length(CalculationValue::Create( PixelsAndPercent(100, -10), kValueRangeNonNegative))); EXPECT_EQ(expected, @@ -207,23 +207,23 @@ style_->GetWritingMode(), *style_, border_padding, sizes)); expected = MinMaxSize{LayoutUnit(30), LayoutUnit(35)}; - style_->SetLogicalWidth(Length(kAuto)); - style_->SetMaxWidth(Length(35, kFixed)); + style_->SetLogicalWidth(Length::Auto()); + style_->SetMaxWidth(Length::Fixed(35)); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); expected = MinMaxSize{LayoutUnit(80), LayoutUnit(80)}; - style_->SetLogicalWidth(Length(50, kFixed)); - style_->SetMinWidth(Length(80, kFixed)); + style_->SetLogicalWidth(Length::Fixed(50)); + style_->SetMinWidth(Length::Fixed(80)); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); expected = MinMaxSize{LayoutUnit(150), LayoutUnit(150)}; style_ = ComputedStyle::Create(); - style_->SetLogicalWidth(Length(100, kFixed)); - style_->SetPaddingLeft(Length(50, kFixed)); + style_->SetLogicalWidth(Length::Fixed(100)); + style_->SetPaddingLeft(Length::Fixed(50)); auto sizes_padding50 = sizes; NGBoxStrut border_padding50 = {LayoutUnit(50), LayoutUnit(), LayoutUnit(), LayoutUnit()}; @@ -241,18 +241,18 @@ // Content size should never be below zero, even with box-sizing: border-box // and a large padding... expected = MinMaxSize{LayoutUnit(400), LayoutUnit(400)}; - style_->SetPaddingLeft(Length(400, kFixed)); + style_->SetPaddingLeft(Length::Fixed(400)); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding400, sizes_padding400)); expected.min_size = expected.max_size = sizes.min_size + LayoutUnit(400); - style_->SetLogicalWidth(Length(kMinContent)); + style_->SetLogicalWidth(Length::MinContent()); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding400, sizes_padding400)); - style_->SetLogicalWidth(Length(100, kFixed)); - style_->SetMaxWidth(Length(kMaxContent)); + style_->SetLogicalWidth(Length::Fixed(100)); + style_->SetMaxWidth(Length::MaxContent()); // Due to padding and box-sizing, width computes to 400px and max-width to // 440px, so the result is 400. expected = MinMaxSize{LayoutUnit(400), LayoutUnit(400)}; @@ -260,7 +260,7 @@ style_->GetWritingMode(), *style_, border_padding400, sizes_padding400)); expected = MinMaxSize{LayoutUnit(40), LayoutUnit(40)}; - style_->SetPaddingLeft(Length(0, kFixed)); + style_->SetPaddingLeft(Length::Fixed(0)); EXPECT_EQ(expected, ComputeMinAndMaxContentContribution( style_->GetWritingMode(), *style_, border_padding, sizes)); @@ -271,16 +271,16 @@ sizes.min_size = LayoutUnit(30); sizes.max_size = LayoutUnit(40); - style_->SetLogicalWidth(Length(30, kPercent)); + style_->SetLogicalWidth(Length::Percent(30)); EXPECT_EQ(LayoutUnit(60), ComputeInlineSizeForFragment()); - style_->SetLogicalWidth(Length(150, kFixed)); + style_->SetLogicalWidth(Length::Fixed(150)); EXPECT_EQ(LayoutUnit(150), ComputeInlineSizeForFragment()); - style_->SetLogicalWidth(Length(kAuto)); + style_->SetLogicalWidth(Length::Auto()); EXPECT_EQ(LayoutUnit(200), ComputeInlineSizeForFragment()); - style_->SetLogicalWidth(Length(kFillAvailable)); + style_->SetLogicalWidth(Length::FillAvailable()); EXPECT_EQ(LayoutUnit(200), ComputeInlineSizeForFragment()); style_->SetLogicalWidth(Length(CalculationValue::Create( @@ -289,23 +289,23 @@ NGConstraintSpace constraint_space = ConstructConstraintSpace(120, 120, true, true); - style_->SetLogicalWidth(Length(150, kFixed)); + style_->SetLogicalWidth(Length::Fixed(150)); EXPECT_EQ(LayoutUnit(120), ComputeInlineSizeForFragment(constraint_space)); - style_->SetLogicalWidth(Length(200, kFixed)); - style_->SetMaxWidth(Length(80, kPercent)); + style_->SetLogicalWidth(Length::Fixed(200)); + style_->SetMaxWidth(Length::Percent(80)); EXPECT_EQ(LayoutUnit(160), ComputeInlineSizeForFragment()); - style_->SetLogicalWidth(Length(100, kFixed)); - style_->SetMinWidth(Length(80, kPercent)); + style_->SetLogicalWidth(Length::Fixed(100)); + style_->SetMinWidth(Length::Percent(80)); EXPECT_EQ(LayoutUnit(160), ComputeInlineSizeForFragment()); style_ = ComputedStyle::Create(); - style_->SetMarginRight(Length(20, kFixed)); + style_->SetMarginRight(Length::Fixed(20)); EXPECT_EQ(LayoutUnit(180), ComputeInlineSizeForFragment()); - style_->SetLogicalWidth(Length(100, kFixed)); - style_->SetPaddingLeft(Length(50, kFixed)); + style_->SetLogicalWidth(Length::Fixed(100)); + style_->SetPaddingLeft(Length::Fixed(50)); EXPECT_EQ(LayoutUnit(150), ComputeInlineSizeForFragment()); style_->SetBoxSizing(EBoxSizing::kBorderBox); @@ -313,46 +313,46 @@ // Content size should never be below zero, even with box-sizing: border-box // and a large padding... - style_->SetPaddingLeft(Length(400, kFixed)); + style_->SetPaddingLeft(Length::Fixed(400)); EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment()); auto sizes_padding400 = sizes; sizes_padding400 += LayoutUnit(400); // ...and the same goes for fill-available with a large padding. - style_->SetLogicalWidth(Length(kFillAvailable)); + style_->SetLogicalWidth(Length::FillAvailable()); EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment()); constraint_space = ConstructConstraintSpace(120, 140); - style_->SetLogicalWidth(Length(kMinContent)); + style_->SetLogicalWidth(Length::MinContent()); EXPECT_EQ(LayoutUnit(430), ComputeInlineSizeForFragment(constraint_space, sizes_padding400)); - style_->SetLogicalWidth(Length(100, kFixed)); - style_->SetMaxWidth(Length(kMaxContent)); + style_->SetLogicalWidth(Length::Fixed(100)); + style_->SetMaxWidth(Length::MaxContent()); // Due to padding and box-sizing, width computes to 400px and max-width to // 440px, so the result is 400. EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment(constraint_space, sizes_padding400)); - style_->SetPaddingLeft(Length(0, kFixed)); + style_->SetPaddingLeft(Length::Fixed(0)); EXPECT_EQ(LayoutUnit(40), ComputeInlineSizeForFragment(constraint_space, sizes)); } TEST_F(NGLengthUtilsTest, testComputeBlockSizeForFragment) { - style_->SetLogicalHeight(Length(30, kPercent)); + style_->SetLogicalHeight(Length::Percent(30)); EXPECT_EQ(LayoutUnit(90), ComputeBlockSizeForFragment()); - style_->SetLogicalHeight(Length(150, kFixed)); + style_->SetLogicalHeight(Length::Fixed(150)); EXPECT_EQ(LayoutUnit(150), ComputeBlockSizeForFragment()); - style_->SetLogicalHeight(Length(kAuto)); + style_->SetLogicalHeight(Length::Auto()); EXPECT_EQ(LayoutUnit(0), ComputeBlockSizeForFragment()); NGConstraintSpace constraint_space = ConstructConstraintSpace(200, 300); - style_->SetLogicalHeight(Length(kAuto)); + style_->SetLogicalHeight(Length::Auto()); EXPECT_EQ(LayoutUnit(120), ComputeBlockSizeForFragment(constraint_space, LayoutUnit(120))); - style_->SetLogicalHeight(Length(kFillAvailable)); + style_->SetLogicalHeight(Length::FillAvailable()); EXPECT_EQ(LayoutUnit(300), ComputeBlockSizeForFragment()); style_->SetLogicalHeight(Length(CalculationValue::Create( @@ -360,24 +360,24 @@ EXPECT_EQ(LayoutUnit(70), ComputeBlockSizeForFragment()); constraint_space = ConstructConstraintSpace(200, 200, true, true); - style_->SetLogicalHeight(Length(150, kFixed)); + style_->SetLogicalHeight(Length::Fixed(150)); EXPECT_EQ(LayoutUnit(200), ComputeBlockSizeForFragment(constraint_space)); - style_->SetLogicalHeight(Length(300, kFixed)); - style_->SetMaxHeight(Length(80, kPercent)); + style_->SetLogicalHeight(Length::Fixed(300)); + style_->SetMaxHeight(Length::Percent(80)); EXPECT_EQ(LayoutUnit(240), ComputeBlockSizeForFragment()); - style_->SetLogicalHeight(Length(100, kFixed)); - style_->SetMinHeight(Length(80, kPercent)); + style_->SetLogicalHeight(Length::Fixed(100)); + style_->SetMinHeight(Length::Percent(80)); EXPECT_EQ(LayoutUnit(240), ComputeBlockSizeForFragment()); style_ = ComputedStyle::Create(); - style_->SetMarginTop(Length(20, kFixed)); - style_->SetLogicalHeight(Length(kFillAvailable)); + style_->SetMarginTop(Length::Fixed(20)); + style_->SetLogicalHeight(Length::FillAvailable()); EXPECT_EQ(LayoutUnit(280), ComputeBlockSizeForFragment()); - style_->SetLogicalHeight(Length(100, kFixed)); - style_->SetPaddingBottom(Length(50, kFixed)); + style_->SetLogicalHeight(Length::Fixed(100)); + style_->SetPaddingBottom(Length::Fixed(50)); EXPECT_EQ(LayoutUnit(150), ComputeBlockSizeForFragment()); style_->SetBoxSizing(EBoxSizing::kBorderBox); @@ -385,19 +385,19 @@ // Content size should never be below zero, even with box-sizing: border-box // and a large padding... - style_->SetPaddingBottom(Length(400, kFixed)); + style_->SetPaddingBottom(Length::Fixed(400)); EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment()); // ...and the same goes for fill-available with a large padding. - style_->SetLogicalHeight(Length(kFillAvailable)); + style_->SetLogicalHeight(Length::FillAvailable()); EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment()); // TODO(layout-ng): test {min,max}-content on max-height. } TEST_F(NGLengthUtilsTest, testIndefinitePercentages) { - style_->SetMinHeight(Length(20, kFixed)); - style_->SetHeight(Length(20, kPercent)); + style_->SetMinHeight(Length::Fixed(20)); + style_->SetHeight(Length::Percent(20)); EXPECT_EQ(NGSizeIndefinite, ComputeBlockSizeForFragment(ConstructConstraintSpace(200, -1), @@ -411,10 +411,10 @@ } TEST_F(NGLengthUtilsTest, testMargins) { - style_->SetMarginTop(Length(10, kPercent)); - style_->SetMarginRight(Length(52, kFixed)); - style_->SetMarginBottom(Length(kAuto)); - style_->SetMarginLeft(Length(11, kPercent)); + style_->SetMarginTop(Length::Percent(10)); + style_->SetMarginRight(Length::Fixed(52)); + style_->SetMarginBottom(Length::Auto()); + style_->SetMarginLeft(Length::Percent(11)); NGConstraintSpace constraint_space = ConstructConstraintSpace(200, 300); @@ -449,10 +449,10 @@ } TEST_F(NGLengthUtilsTest, testPadding) { - style_->SetPaddingTop(Length(10, kPercent)); - style_->SetPaddingRight(Length(52, kFixed)); - style_->SetPaddingBottom(Length(kAuto)); - style_->SetPaddingLeft(Length(11, kPercent)); + style_->SetPaddingTop(Length::Percent(10)); + style_->SetPaddingRight(Length::Fixed(52)); + style_->SetPaddingBottom(Length::Auto()); + style_->SetPaddingLeft(Length::Percent(11)); style_->SetWritingMode(WritingMode::kVerticalRl); NGConstraintSpace constraint_space = ConstructConstraintSpace( @@ -467,8 +467,8 @@ } TEST_F(NGLengthUtilsTest, testAutoMargins) { - style_->SetMarginRight(Length(kAuto)); - style_->SetMarginLeft(Length(kAuto)); + style_->SetMarginRight(Length::Auto()); + style_->SetMarginLeft(Length::Auto()); LayoutUnit kInlineSize(150); LayoutUnit kAvailableInlineSize(200); @@ -482,15 +482,15 @@ EXPECT_EQ(LayoutUnit(25), margins.inline_start); EXPECT_EQ(LayoutUnit(25), margins.inline_end); - style_->SetMarginLeft(Length(0, kFixed)); + style_->SetMarginLeft(Length::Fixed(0)); margins = NGBoxStrut(); ResolveInlineMargins(*style_, *style_, kAvailableInlineSize, kInlineSize, &margins); EXPECT_EQ(LayoutUnit(0), margins.inline_start); EXPECT_EQ(LayoutUnit(50), margins.inline_end); - style_->SetMarginLeft(Length(kAuto)); - style_->SetMarginRight(Length(0, kFixed)); + style_->SetMarginLeft(Length::Auto()); + style_->SetMarginRight(Length::Fixed(0)); margins = NGBoxStrut(); ResolveInlineMargins(*style_, *style_, kAvailableInlineSize, kInlineSize, &margins); @@ -499,8 +499,8 @@ // Test that we don't end up with negative "auto" margins when the box is too // big. - style_->SetMarginLeft(Length(kAuto)); - style_->SetMarginRight(Length(5000, kFixed)); + style_->SetMarginLeft(Length::Auto()); + style_->SetMarginRight(Length::Fixed(5000)); margins = NGBoxStrut(); margins.inline_end = LayoutUnit(5000); ResolveInlineMargins(*style_, *style_, kAvailableInlineSize, kInlineSize,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_relative_utils_test.cc b/third_party/blink/renderer/core/layout/ng/ng_relative_utils_test.cc index f6d93e5..216d0fa 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_relative_utils_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_relative_utils_test.cc
@@ -33,16 +33,13 @@ LayoutUnit right, LayoutUnit bottom, LayoutUnit left) { - style_->SetTop(top == kAuto ? Length(LengthType::kAuto) - : Length(top.ToInt(), LengthType::kFixed)); - style_->SetRight(right == kAuto - ? Length(LengthType::kAuto) - : Length(right.ToInt(), LengthType::kFixed)); - style_->SetBottom(bottom == kAuto - ? Length(LengthType::kAuto) - : Length(bottom.ToInt(), LengthType::kFixed)); - style_->SetLeft(left == kAuto ? Length(LengthType::kAuto) - : Length(left.ToInt(), LengthType::kFixed)); + style_->SetTop(top == kAuto ? Length::Auto() : Length::Fixed(top.ToInt())); + style_->SetRight(right == kAuto ? Length::Auto() + : Length::Fixed(right.ToInt())); + style_->SetBottom(bottom == kAuto ? Length::Auto() + : Length::Fixed(bottom.ToInt())); + style_->SetLeft(left == kAuto ? Length::Auto() + : Length::Fixed(left.ToInt())); } scoped_refptr<ComputedStyle> style_;
diff --git a/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc b/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc index 9c08a935..102310bc 100644 --- a/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc +++ b/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc
@@ -766,24 +766,28 @@ // columns then empty columns. if (available > 0 && (num_auto || num_auto_empty_cells_only)) { available += alloc_auto; - if (num_auto) + if (num_auto) { DistributeWidthToColumns<float, kAuto, kNonEmptyCells, kInitialWidth, kStartToEnd>(available, total_auto); - if (num_auto_empty_cells_only) + } + if (num_auto_empty_cells_only) { DistributeWidthToColumns<unsigned, kAuto, kEmptyCells, kInitialWidth, kStartToEnd>(available, num_auto_empty_cells_only); + } } // Any remaining available width expands fixed width, percent width, and // non-empty auto width columns, in that order. - if (available > 0 && num_fixed) + if (available > 0 && num_fixed) { DistributeWidthToColumns<float, kFixed, kAllCells, kExtraWidth, kStartToEnd>(available, total_fixed); + } - if (available > 0 && has_percent_ && total_percent < 100) + if (available > 0 && has_percent_ && total_percent < 100) { DistributeWidthToColumns<float, kPercent, kAllCells, kExtraWidth, kStartToEnd>(available, total_percent); + } if (available > 0 && n_eff_cols > num_auto_empty_cells_only) { unsigned total = n_eff_cols - num_auto_empty_cells_only;
diff --git a/third_party/blink/renderer/core/layout/table_layout_algorithm_fixed.cc b/third_party/blink/renderer/core/layout/table_layout_algorithm_fixed.cc index a29cd3e..ab6ccb2 100644 --- a/third_party/blink/renderer/core/layout/table_layout_algorithm_fixed.cc +++ b/third_party/blink/renderer/core/layout/table_layout_algorithm_fixed.cc
@@ -82,7 +82,7 @@ // iterate over all <col> elements unsigned n_eff_cols = table_->NumEffectiveColumns(); width_.resize(n_eff_cols); - width_.Fill(Length(kAuto)); + width_.Fill(Length::Auto()); unsigned current_effective_column = 0; for (LayoutTableCol* col = table_->FirstColumn(); col;
diff --git a/third_party/blink/renderer/core/loader/base_fetch_context.cc b/third_party/blink/renderer/core/loader/base_fetch_context.cc index 5a7fa1cb..3082f4d 100644 --- a/third_party/blink/renderer/core/loader/base_fetch_context.cc +++ b/third_party/blink/renderer/core/loader/base_fetch_context.cc
@@ -90,6 +90,24 @@ return ""; } +// This maps the network::mojom::FetchRequestMode to a string that can be used +// in a `Sec-Fetch-Mode` header. +const char* FetchRequestModeToString(network::mojom::FetchRequestMode mode) { + switch (mode) { + case network::mojom::FetchRequestMode::kSameOrigin: + return "same-origin"; + case network::mojom::FetchRequestMode::kNoCors: + return "no-cors"; + case network::mojom::FetchRequestMode::kCors: + case network::mojom::FetchRequestMode::kCorsWithForcedPreflight: + return "cors"; + case network::mojom::FetchRequestMode::kNavigate: + return "navigate"; + } + NOTREACHED(); + return ""; +} + } // namespace void BaseFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request) { @@ -157,6 +175,9 @@ } request.AddHTTPHeaderField("Sec-Fetch-Dest", destination_value); + request.AddHTTPHeaderField( + "Sec-Fetch-Mode", + FetchRequestModeToString(request.GetFetchRequestMode())); request.AddHTTPHeaderField("Sec-Fetch-Site", site_value); request.AddHTTPHeaderField("Sec-Fetch-User", "?F"); }
diff --git a/third_party/blink/renderer/core/loader/base_fetch_context_test.cc b/third_party/blink/renderer/core/loader/base_fetch_context_test.cc index 4558be5..98625dc 100644 --- a/third_party/blink/renderer/core/loader/base_fetch_context_test.cc +++ b/third_party/blink/renderer/core/loader/base_fetch_context_test.cc
@@ -109,7 +109,7 @@ private: Member<ExecutionContext> execution_context_; - Member<FetchClientSettingsObjectImpl> fetch_client_settings_object_; + Member<const FetchClientSettingsObjectImpl> fetch_client_settings_object_; }; class BaseFetchContextTest : public testing::Test {
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h index 663268b..06b0e6f 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -309,6 +309,9 @@ std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) override {} String UserAgent() override { return ""; } + blink::UserAgentMetadata UserAgentMetadata() override { + return blink::UserAgentMetadata(); + } String DoNotTrackValue() override { return String(); }
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index 19cdced..26add4b 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -1365,6 +1365,11 @@ return user_agent; } +blink::UserAgentMetadata FrameLoader::UserAgentMetadata() const { + // TODO(mkwst): Support overrides. + return Client()->UserAgentMetadata(); +} + void FrameLoader::Detach() { DetachDocumentLoader(document_loader_); DetachDocumentLoader(provisional_document_loader_);
diff --git a/third_party/blink/renderer/core/loader/frame_loader.h b/third_party/blink/renderer/core/loader/frame_loader.h index f694fef..59cce995 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.h +++ b/third_party/blink/renderer/core/loader/frame_loader.h
@@ -34,6 +34,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_FRAME_LOADER_H_ #include "base/macros.h" +#include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/platform/web_scoped_virtual_time_pauser.h" #include "third_party/blink/public/web/web_document_loader.h" #include "third_party/blink/public/web/web_frame_load_type.h" @@ -157,6 +158,7 @@ void DidExplicitOpen(); String UserAgent() const; + blink::UserAgentMetadata UserAgentMetadata() const; void DispatchDidClearWindowObjectInMainWorld(); void DispatchDidClearDocumentOfWindowObject();
diff --git a/third_party/blink/renderer/core/loader/image_loader.cc b/third_party/blink/renderer/core/loader/image_loader.cc index 3a4d178..8f64b82 100644 --- a/third_party/blink/renderer/core/loader/image_loader.cc +++ b/third_party/blink/renderer/core/loader/image_loader.cc
@@ -832,7 +832,7 @@ // The error event should not fire if the image data update is a result of // environment change. - // https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:the-img-element-55 + // https://html.spec.whatwg.org/C/#the-img-element:the-img-element-55 if (!suppress_error_events_) DispatchErrorEvent(); return;
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc b/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc index 66cc339..bd5a923 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc
@@ -93,7 +93,7 @@ level, custom_fetch_type); } -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script +// https://html.spec.whatwg.org/C/#fetch-a-single-module-script void ModuleScriptLoader::FetchInternal( const ModuleScriptFetchRequest& module_request, ResourceFetcher* fetch_client_settings_object_fetcher, @@ -128,7 +128,7 @@ // Step 6. "Set up the module script request given request and options." // [spec text] // [SMSR] - // https://html.spec.whatwg.org/multipage/webappapis.html#set-up-the-module-script-request + // https://html.spec.whatwg.org/C/#set-up-the-module-script-request // [SMSR] "... its parser metadata to options's parser metadata, ..." // [spec text] @@ -195,7 +195,7 @@ // -> set by ResourceFetcher // Note: The fetch request's "origin" isn't specified in - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script + // https://html.spec.whatwg.org/C/#fetch-a-single-module-script // Thus, the "origin" is "client" per // https://fetch.spec.whatwg.org/#concept-request-origin
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc index 4a164a3..3c93ce6 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.cc
@@ -150,7 +150,7 @@ } } -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree +// https://html.spec.whatwg.org/C/#fetch-a-module-script-tree void ModuleTreeLinker::FetchRoot(const KURL& original_url, const ScriptFetchOptions& options) { #if DCHECK_IS_ON() @@ -255,7 +255,7 @@ if (state_ == State::kFetchingSelf) { // Corresponds to top-level calls to - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-the-descendants-of-and-instantiate-a-module-script + // https://html.spec.whatwg.org/C/#fetch-the-descendants-of-and-instantiate-a-module-script // i.e. [IMSGF] with the top-level module fetch flag set (external), or // Step 22 of "prepare a script" (inline). // |module_script| is the top-level module, and will be instantiated @@ -365,7 +365,7 @@ // [FD] Step 6. Let options be the descendant script fetch options for module // script's fetch options. - // https://html.spec.whatwg.org/multipage/webappapis.html#descendant-script-fetch-options + // https://html.spec.whatwg.org/C/#descendant-script-fetch-options // the descendant script fetch options are a new script fetch options whose // items all have the same values, except for the integrity metadata, which is // instead the empty string.
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h index c739ec7f..c1cc15b 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h
@@ -124,7 +124,7 @@ State state_ = State::kInitial; // Correspond to _result_ in - // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure + // https://html.spec.whatwg.org/C/#internal-module-script-graph-fetching-procedure TraceWrapperMember<ModuleScript> result_; bool found_parse_error_ = false;
diff --git a/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.cc b/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.cc index c0596eae..4ed3653 100644 --- a/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.cc +++ b/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.cc
@@ -17,7 +17,7 @@ WorkerGlobalScope* global_scope) : global_scope_(global_scope) {} -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void WorkerModuleScriptFetcher::Fetch( FetchParameters& fetch_params, ResourceFetcher* fetch_client_settings_object_fetcher, @@ -45,7 +45,7 @@ visitor->Trace(global_scope_); } -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void WorkerModuleScriptFetcher::NotifyFinished(Resource* resource) { DCHECK(global_scope_->IsContextThread()); ClearResource();
diff --git a/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.h b/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.h index 7819106..b0097ba9 100644 --- a/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.h +++ b/third_party/blink/renderer/core/loader/modulescript/worker_module_script_fetcher.h
@@ -14,8 +14,8 @@ // WorkerModuleScriptFetcher is an implementation of ModuleScriptFetcher // interface for WebWorkers. This implements the custom "perform the fetch" hook // defined in the HTML spec: -// https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#fetching-scripts-perform-fetch +// https://html.spec.whatwg.org/C/#worker-processing-model class CORE_EXPORT WorkerModuleScriptFetcher final : public GarbageCollectedFinalized<WorkerModuleScriptFetcher>, public ModuleScriptFetcher {
diff --git a/third_party/blink/renderer/core/loader/modulescript/worklet_module_script_fetcher.h b/third_party/blink/renderer/core/loader/modulescript/worklet_module_script_fetcher.h index 44c080a..d82cd4e 100644 --- a/third_party/blink/renderer/core/loader/modulescript/worklet_module_script_fetcher.h +++ b/third_party/blink/renderer/core/loader/modulescript/worklet_module_script_fetcher.h
@@ -16,7 +16,7 @@ // WorkletModuleScriptFetcher is an implementation of ModuleScriptFetcher // interface for Worklets. This implements the custom "perform the fetch" hook // defined in the Worklets spec: -// https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch +// https://html.spec.whatwg.org/C/#fetching-scripts-perform-fetch // https://drafts.css-houdini.org/worklets/#fetch-a-worklet-script // // WorkletModuleScriptFetcher either fetchs a cached result from
diff --git a/third_party/blink/renderer/core/loader/preload_helper.cc b/third_party/blink/renderer/core/loader/preload_helper.cc index 3514b12..59f14e0 100644 --- a/third_party/blink/renderer/core/loader/preload_helper.cc +++ b/third_party/blink/renderer/core/loader/preload_helper.cc
@@ -284,7 +284,7 @@ document.Fetcher()); } -// https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload +// https://html.spec.whatwg.org/C/#link-type-modulepreload void PreloadHelper::ModulePreloadIfNeeded( const LinkLoadParameters& params, Document& document,
diff --git a/third_party/blink/renderer/core/messaging/README.md b/third_party/blink/renderer/core/messaging/README.md index 2de9f39..3efb3d67 100644 --- a/third_party/blink/renderer/core/messaging/README.md +++ b/third_party/blink/renderer/core/messaging/README.md
@@ -4,4 +4,4 @@ - The [Web Messaging API][1] implementation. - Structs and typemaps to efficiently pass SerializedScriptValue over mojo interfaces. -[1]: https://html.spec.whatwg.org/multipage/web-messaging.html#channel-messaging +[1]: https://html.spec.whatwg.org/C/#channel-messaging
diff --git a/third_party/blink/renderer/core/messaging/message_port.cc b/third_party/blink/renderer/core/messaging/message_port.cc index a296a04f..be039ac 100644 --- a/third_party/blink/renderer/core/messaging/message_port.cc +++ b/third_party/blink/renderer/core/messaging/message_port.cc
@@ -243,7 +243,7 @@ MessagePortArray* MessagePort::EntanglePorts( ExecutionContext& context, WebVector<MessagePortChannel> channels) { - // https://html.spec.whatwg.org/multipage/comms.html#message-ports + // https://html.spec.whatwg.org/C/#message-ports // |ports| should be an empty array, not null even when there is no ports. wtf_size_t count = SafeCast<wtf_size_t>(channels.size()); MessagePortArray* port_array = MakeGarbageCollected<MessagePortArray>(count);
diff --git a/third_party/blink/renderer/core/messaging/message_port.idl b/third_party/blink/renderer/core/messaging/message_port.idl index 01d03ad..554b8226 100644 --- a/third_party/blink/renderer/core/messaging/message_port.idl +++ b/third_party/blink/renderer/core/messaging/message_port.idl
@@ -25,7 +25,7 @@ * */ -// https://html.spec.whatwg.org/multipage/web-messaging.html#message-ports +// https://html.spec.whatwg.org/C/#message-ports [ ActiveScriptWrappable,
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.idl b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.idl index 115e1a3..42ed441 100644 --- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.idl +++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/scripting.html#the-offscreencanvas-interface +// https://html.spec.whatwg.org/C/#the-offscreencanvas-interface [ Constructor([EnforceRange] unsigned long width, [EnforceRange] unsigned long height),
diff --git a/third_party/blink/renderer/core/page/BUILD.gn b/third_party/blink/renderer/core/page/BUILD.gn index 5ee83b7..f3619c9 100644 --- a/third_party/blink/renderer/core/page/BUILD.gn +++ b/third_party/blink/renderer/core/page/BUILD.gn
@@ -57,6 +57,8 @@ "print_context.h", "scoped_page_pauser.cc", "scoped_page_pauser.h", + "scrolling/element_fragment_anchor.cc", + "scrolling/element_fragment_anchor.h", "scrolling/fragment_anchor.cc", "scrolling/fragment_anchor.h", "scrolling/overscroll_controller.cc", @@ -79,6 +81,10 @@ "scrolling/snap_coordinator.h", "scrolling/sticky_position_scrolling_constraints.cc", "scrolling/sticky_position_scrolling_constraints.h", + "scrolling/text_fragment_anchor.cc", + "scrolling/text_fragment_anchor.h", + "scrolling/text_fragment_finder.cc", + "scrolling/text_fragment_finder.h", "scrolling/top_document_root_scroller_controller.cc", "scrolling/top_document_root_scroller_controller.h", "scrolling/viewport_scroll_callback.cc",
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index 1765b65..5c3d84c 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -254,7 +254,7 @@ if (base::FeatureList::IsEnabled(features::kOnionSoupDOMStorage)) { // TODO(dmurph): Don't copy session storage when features.noopener is true: - // https://html.spec.whatwg.org/multipage/browsers.html#copy-session-storage + // https://html.spec.whatwg.org/C/#copy-session-storage // https://crbug.com/771959 CoreInitializer::GetInstance().CloneSessionStorage(old_page, new_namespace_id);
diff --git a/third_party/blink/renderer/core/page/focus_controller.cc b/third_party/blink/renderer/core/page/focus_controller.cc index 476a2e7..8ef3cd21 100644 --- a/third_party/blink/renderer/core/page/focus_controller.cc +++ b/third_party/blink/renderer/core/page/focus_controller.cc
@@ -173,7 +173,7 @@ // @return The focus element that comes after/before start element. // // [1] - // https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation + // https://html.spec.whatwg.org/C/#sequential-focus-navigation // [2] https://w3c.github.io/webcomponents/spec/shadow/#focus-navigation Element* FindFocusableElement(WebFocusType type) { return (type == kWebFocusTypeForward) ? NextFocusableElement()
diff --git a/third_party/blink/renderer/core/page/page.h b/third_party/blink/renderer/core/page/page.h index 47bea747..0592b34 100644 --- a/third_party/blink/renderer/core/page/page.h +++ b/third_party/blink/renderer/core/page/page.h
@@ -125,7 +125,7 @@ // Returns pages related to the current browsing context (excluding the // current page). See also - // https://html.spec.whatwg.org/multipage/browsers.html#unit-of-related-browsing-contexts + // https://html.spec.whatwg.org/C/#unit-of-related-browsing-contexts HeapVector<Member<Page>> RelatedPages(); static void PlatformColorsChanged(); @@ -224,9 +224,9 @@ // Pausing is used to implement the "Optionally, pause while waiting for // the user to acknowledge the message" step of simple dialog processing: - // https://html.spec.whatwg.org/multipage/webappapis.html#simple-dialogs + // https://html.spec.whatwg.org/C/#simple-dialogs // - // Per https://html.spec.whatwg.org/multipage/webappapis.html#pause, no loads + // Per https://html.spec.whatwg.org/C/#pause, no loads // are allowed to start/continue in this state, and all background processing // is also paused. bool Paused() const { return paused_; }
diff --git a/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.cc b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.cc new file mode 100644 index 0000000..dc122fe --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.cc
@@ -0,0 +1,240 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.h" + +#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/dom/node.h" +#include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/frame/scroll_into_view_options.h" +#include "third_party/blink/renderer/core/svg/svg_svg_element.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" + +namespace blink { + +namespace { + +constexpr char kCssFragmentIdentifierPrefix[] = "targetElement="; +constexpr size_t kCssFragmentIdentifierPrefixLength = + base::size(kCssFragmentIdentifierPrefix); + +bool ParseCSSFragmentIdentifier(const String& fragment, String* selector) { + size_t pos = fragment.Find(kCssFragmentIdentifierPrefix); + if (pos == 0) { + *selector = fragment.Substring(kCssFragmentIdentifierPrefixLength - 1); + return true; + } + + return false; +} + +Element* FindCSSFragmentAnchor(const AtomicString& selector, + Document& document) { + DummyExceptionStateForTesting exception_state; + return document.QuerySelector(selector, exception_state); +} + +Node* FindAnchorFromFragment(const String& fragment, Document& doc) { + Element* anchor_node; + String selector; + if (RuntimeEnabledFeatures::CSSFragmentIdentifiersEnabled() && + ParseCSSFragmentIdentifier(fragment, &selector)) { + anchor_node = FindCSSFragmentAnchor(AtomicString(selector), doc); + } else { + anchor_node = doc.FindAnchor(fragment); + } + + // Implement the rule that "" and "top" both mean top of page as in other + // browsers. + if (!anchor_node && + (fragment.IsEmpty() || DeprecatedEqualIgnoringCase(fragment, "top"))) + return &doc; + + return anchor_node; +} + +} // namespace + +ElementFragmentAnchor* ElementFragmentAnchor::TryCreate(const KURL& url, + LocalFrame& frame) { + DCHECK(frame.GetDocument()); + Document& doc = *frame.GetDocument(); + + // If our URL has no ref, then we have no place we need to jump to. + // OTOH If CSS target was set previously, we want to set it to 0, recalc + // and possibly paint invalidation because :target pseudo class may have been + // set (see bug 11321). + // Similarly for svg, if we had a previous svgView() then we need to reset + // the initial view if we don't have a fragment. + if (!url.HasFragmentIdentifier() && !doc.CssTarget() && !doc.IsSVGDocument()) + return nullptr; + + String fragment = url.FragmentIdentifier(); + + Node* anchor_node = nullptr; + + // Try the raw fragment for HTML documents, but skip it for `svgView()`: + if (!doc.IsSVGDocument()) + anchor_node = FindAnchorFromFragment(fragment, doc); + + // https://html.spec.whatwg.org/C/#the-indicated-part-of-the-document + // 5. Let decodedFragment be the result of running UTF-8 decode without BOM + // on fragmentBytes. + if (!anchor_node) { + fragment = DecodeURLEscapeSequences(fragment, DecodeURLMode::kUTF8); + anchor_node = FindAnchorFromFragment(fragment, doc); + } + + // Setting to null will clear the current target. + Element* target = anchor_node && anchor_node->IsElementNode() + ? ToElement(anchor_node) + : nullptr; + doc.SetCSSTarget(target); + + if (doc.IsSVGDocument()) { + if (SVGSVGElement* svg = ToSVGSVGElementOrNull(doc.documentElement())) + svg->SetupInitialView(fragment, target); + } + + if (target) + target->DispatchActivateInvisibleEventIfNeeded(); + + if (doc.IsSVGDocument() && !frame.IsMainFrame()) + return nullptr; + + if (!anchor_node) + return nullptr; + + return MakeGarbageCollected<ElementFragmentAnchor>(*anchor_node, frame); +} + +ElementFragmentAnchor::ElementFragmentAnchor(Node& anchor_node, + LocalFrame& frame) + : anchor_node_(&anchor_node), + frame_(&frame), + needs_focus_(!anchor_node.IsDocumentNode()) { + DCHECK(frame_->View()); +} + +bool ElementFragmentAnchor::Invoke() { + if (!frame_ || !anchor_node_) + return false; + + // Don't remove the fragment anchor until focus has been applied. + if (!needs_invoke_) + return needs_focus_; + + Document& doc = *frame_->GetDocument(); + + if (!doc.IsRenderingReady() || !frame_->View()) + return true; + + Frame* boundary_frame = frame_->FindUnsafeParentScrollPropagationBoundary(); + + // FIXME: Handle RemoteFrames + if (boundary_frame && boundary_frame->IsLocalFrame()) { + ToLocalFrame(boundary_frame) + ->View() + ->SetSafeToPropagateScrollToParent(false); + } + + Element* element_to_scroll = anchor_node_->IsElementNode() + ? ToElement(anchor_node_) + : doc.documentElement(); + if (element_to_scroll) { + ScrollIntoViewOptions* options = ScrollIntoViewOptions::Create(); + options->setBlock("start"); + options->setInlinePosition("nearest"); + element_to_scroll->ScrollIntoViewNoVisualUpdate(options); + } + + if (boundary_frame && boundary_frame->IsLocalFrame()) { + ToLocalFrame(boundary_frame) + ->View() + ->SetSafeToPropagateScrollToParent(true); + } + + if (AXObjectCache* cache = doc.ExistingAXObjectCache()) + cache->HandleScrolledToAnchor(anchor_node_); + + // Scroll into view above will cause us to clear needs_invoke_ via the + // DidScroll so recompute it here. + needs_invoke_ = !doc.IsLoadCompleted() || needs_focus_; + + return needs_invoke_; +} + +void ElementFragmentAnchor::Installed() { + DCHECK(frame_->GetDocument()); + + // If rendering isn't ready yet, we'll focus and scroll as part of the + // document lifecycle. + if (frame_->GetDocument()->IsRenderingReady()) + ApplyFocusIfNeeded(); + + needs_invoke_ = true; +} + +void ElementFragmentAnchor::DidScroll(ScrollType type) { + if (!IsExplicitScrollType(type)) + return; + + // If the user/page scrolled, avoid clobbering the scroll offset by removing + // the anchor on the next invocation. Note: we may get here as a result of + // calling Invoke() because of the ScrollIntoView but that's ok because + // needs_invoke_ is recomputed at the end of that method. + needs_invoke_ = false; +} + +void ElementFragmentAnchor::DidCompleteLoad() { + DCHECK(frame_); + DCHECK(frame_->View()); + + // If there is a pending layout, the fragment anchor will be cleared when it + // finishes. + if (!frame_->View()->NeedsLayout()) + needs_invoke_ = false; +} + +void ElementFragmentAnchor::Trace(blink::Visitor* visitor) { + visitor->Trace(anchor_node_); + visitor->Trace(frame_); + FragmentAnchor::Trace(visitor); +} + +void ElementFragmentAnchor::PerformPreRafActions() { + ApplyFocusIfNeeded(); +} + +void ElementFragmentAnchor::ApplyFocusIfNeeded() { + // SVG images can load synchronously during style recalc but it's ok to focus + // since we disallow scripting. For everything else, focus() could run script + // so make sure we're at a valid point to do so. + DCHECK(frame_->GetDocument()->IsSVGDocument() || + !ScriptForbiddenScope::IsScriptForbidden()); + + if (!needs_focus_) + return; + + if (!frame_->GetDocument()->IsRenderingReady()) + return; + + // If the anchor accepts keyboard focus and fragment scrolling is allowed, + // move focus there to aid users relying on keyboard navigation. + // If anchorNode is not focusable or fragment scrolling is not allowed, + // clear focus, which matches the behavior of other browsers. + frame_->GetDocument()->UpdateStyleAndLayoutTree(); + if (anchor_node_->IsElementNode() && ToElement(anchor_node_)->IsFocusable()) { + ToElement(anchor_node_)->focus(); + } else { + frame_->GetDocument()->SetSequentialFocusNavigationStartingPoint( + anchor_node_); + frame_->GetDocument()->ClearFocusedElement(); + } + needs_focus_ = false; +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.h b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.h new file mode 100644 index 0000000..aee9df7f --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.h
@@ -0,0 +1,76 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_ELEMENT_FRAGMENT_ANCHOR_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_ELEMENT_FRAGMENT_ANCHOR_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/page/scrolling/fragment_anchor.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/scroll/scroll_types.h" + +namespace blink { + +class LocalFrame; +class KURL; + +// An element fragment anchor is a FragmentAnchor based on a single element. +// This is the traditional fragment anchor of the web. For example, the fragment +// string will be used to find an element in the page with a matching id and use +// that to scroll into view and focus. +// +// While the page is loading, the fragment anchor tries to repeatedly scroll +// the element into view since it's position may change as a result of layouts. +// TODO(bokan): Maybe we no longer need the repeated scrolling since that +// should be handled by scroll-anchoring? +class CORE_EXPORT ElementFragmentAnchor final : public FragmentAnchor { + public: + // Parses the URL fragment and, if possible, creates and returns a fragment + // based on an Element in the page. Returns nullptr otherwise. Produces side + // effects related to fragment targeting in the page in either case. + static ElementFragmentAnchor* TryCreate(const KURL& url, LocalFrame& frame); + + ElementFragmentAnchor(Node& anchor_node, LocalFrame& frame); + ~ElementFragmentAnchor() override = default; + + // Will attempt to scroll the anchor into view. + bool Invoke() override; + + // Will attempt to focus the anchor. + void Installed() override; + + // Used to let the anchor know the frame's been scrolled and so we should + // abort keeping the fragment target in view to avoid fighting with user + // scrolls. + void DidScroll(ScrollType type) override; + + // Attempts to focus the anchor if we couldn't focus right after install + // (because rendering was blocked at the time). This can cause script to run + // so we can't do it in Invoke. + void PerformPreRafActions() override; + + // We can dispose of the fragment once load has been completed. + void DidCompleteLoad() override; + + void Trace(blink::Visitor*) override; + + private: + void ApplyFocusIfNeeded(); + + WeakMember<Node> anchor_node_; + Member<LocalFrame> frame_; + bool needs_focus_; + + // While this is true, the fragment is still "active" in the sense that we + // want the owner to continue calling Invoke(). Once this is false, calling + // Invoke has no effect and the fragment can be disposed (unless focus is + // still needed). + bool needs_invoke_ = false; + + DISALLOW_COPY_AND_ASSIGN(ElementFragmentAnchor); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_ELEMENT_FRAGMENT_ANCHOR_H_
diff --git a/third_party/blink/renderer/core/page/scrolling/fragment_anchor_test.cc b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc similarity index 96% rename from third_party/blink/renderer/core/page/scrolling/fragment_anchor_test.cc rename to third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc index 022d8ba..c22426d 100644 --- a/third_party/blink/renderer/core/page/scrolling/fragment_anchor_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc
@@ -21,13 +21,13 @@ using test::RunPendingTasks; -class FragmentAnchorTest : public SimTest {}; +class ElementFragmentAnchorTest : public SimTest {}; // Ensure that the focus event handler is run before the rAF callback. We'll // change the background color from a rAF set in the focus handler and make // sure the computed background color of that frame was changed. See: // https://groups.google.com/a/chromium.org/d/msg/blink-dev/5BJSTl-FMGY/JMtaKqGhBAAJ -TEST_F(FragmentAnchorTest, FocusHandlerRunBeforeRaf) { +TEST_F(ElementFragmentAnchorTest, FocusHandlerRunBeforeRaf) { SimRequest main_resource("https://example.com/test.html", "text/html"); SimSubresourceRequest css_resource("https://example.com/sheet.css", "text/css");
diff --git a/third_party/blink/renderer/core/page/scrolling/fragment_anchor.cc b/third_party/blink/renderer/core/page/scrolling/fragment_anchor.cc index 993d6fc5..4587d39 100644 --- a/third_party/blink/renderer/core/page/scrolling/fragment_anchor.cc +++ b/third_party/blink/renderer/core/page/scrolling/fragment_anchor.cc
@@ -4,239 +4,23 @@ #include "third_party/blink/renderer/core/page/scrolling/fragment_anchor.h" -#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h" -#include "third_party/blink/renderer/core/dom/document.h" -#include "third_party/blink/renderer/core/dom/element.h" -#include "third_party/blink/renderer/core/dom/node.h" -#include "third_party/blink/renderer/core/frame/local_frame.h" -#include "third_party/blink/renderer/core/frame/scroll_into_view_options.h" -#include "third_party/blink/renderer/core/svg/svg_svg_element.h" -#include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/core/page/scrolling/element_fragment_anchor.h" +#include "third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace { - -constexpr char kCssFragmentIdentifierPrefix[] = "targetElement="; -constexpr size_t kCssFragmentIdentifierPrefixLength = - base::size(kCssFragmentIdentifierPrefix); - -bool ParseCSSFragmentIdentifier(const String& fragment, String* selector) { - size_t pos = fragment.Find(kCssFragmentIdentifierPrefix); - if (pos == 0) { - *selector = fragment.Substring(kCssFragmentIdentifierPrefixLength - 1); - return true; - } - - return false; -} - -Element* FindCSSFragmentAnchor(const AtomicString& selector, - Document& document) { - DummyExceptionStateForTesting exception_state; - return document.QuerySelector(selector, exception_state); -} - -Node* FindAnchorFromFragment(const String& fragment, Document& doc) { - Element* anchor_node; - String selector; - if (RuntimeEnabledFeatures::CSSFragmentIdentifiersEnabled() && - ParseCSSFragmentIdentifier(fragment, &selector)) { - anchor_node = FindCSSFragmentAnchor(AtomicString(selector), doc); - } else { - anchor_node = doc.FindAnchor(fragment); - } - - // Implement the rule that "" and "top" both mean top of page as in other - // browsers. - if (!anchor_node && - (fragment.IsEmpty() || DeprecatedEqualIgnoringCase(fragment, "top"))) - return &doc; - - return anchor_node; -} - -} // namespace - FragmentAnchor* FragmentAnchor::TryCreate(const KURL& url, - bool needs_invoke, LocalFrame& frame) { - DCHECK(frame.GetDocument()); - Document& doc = *frame.GetDocument(); + FragmentAnchor* anchor = nullptr; - // If our URL has no ref, then we have no place we need to jump to. - // OTOH If CSS target was set previously, we want to set it to 0, recalc - // and possibly paint invalidation because :target pseudo class may have been - // set (see bug 11321). - // Similarly for svg, if we had a previous svgView() then we need to reset - // the initial view if we don't have a fragment. - if (!url.HasFragmentIdentifier() && !doc.CssTarget() && !doc.IsSVGDocument()) - return nullptr; - - String fragment = url.FragmentIdentifier(); - - Node* anchor_node = nullptr; - - // Try the raw fragment for HTML documents, but skip it for `svgView()`: - if (!doc.IsSVGDocument()) - anchor_node = FindAnchorFromFragment(fragment, doc); - - // https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document - // 5. Let decodedFragment be the result of running UTF-8 decode without BOM - // on fragmentBytes. - if (!anchor_node) { - fragment = DecodeURLEscapeSequences(fragment, DecodeURLMode::kUTF8); - anchor_node = FindAnchorFromFragment(fragment, doc); - } - - // Setting to null will clear the current target. - Element* target = anchor_node && anchor_node->IsElementNode() - ? ToElement(anchor_node) - : nullptr; - doc.SetCSSTarget(target); - - if (doc.IsSVGDocument()) { - if (SVGSVGElement* svg = ToSVGSVGElementOrNull(doc.documentElement())) - svg->SetupInitialView(fragment, target); - } - - if (target) - target->DispatchActivateInvisibleEventIfNeeded(); - - if (doc.IsSVGDocument() && !frame.IsMainFrame()) - return nullptr; - - if (!anchor_node || !needs_invoke) - return nullptr; - - auto* anchor = MakeGarbageCollected<FragmentAnchor>(*anchor_node, frame); - - // If rendering isn't ready yet, we'll focus and scroll as part of the - // document lifecycle. - if (doc.IsRenderingReady()) { - anchor->ApplyFocusIfNeeded(); - - // Layout needs to be clean for scrolling but if layout is needed, we'll - // invoke after layout is completed so no need to do it here. Note, the - // view may have been detached by script run during focus() call. - if (frame.View() && !frame.View()->NeedsLayout()) - anchor->Invoke(); + anchor = ElementFragmentAnchor::TryCreate(url, frame); + if (!anchor) { + if (RuntimeEnabledFeatures::TextFragmentIdentifiersEnabled()) + anchor = TextFragmentAnchor::TryCreate(url, frame); } return anchor; } -FragmentAnchor::FragmentAnchor(Node& anchor_node, LocalFrame& frame) - : anchor_node_(&anchor_node), - frame_(&frame), - needs_focus_(!anchor_node.IsDocumentNode()) { - DCHECK(frame_->View()); -} - -bool FragmentAnchor::Invoke() { - if (!frame_ || !anchor_node_) - return false; - - // Don't remove the fragment anchor until focus has been applied. - if (!needs_invoke_) - return needs_focus_; - - Document& doc = *frame_->GetDocument(); - - if (!doc.IsRenderingReady() || !frame_->View()) - return true; - - Frame* boundary_frame = frame_->FindUnsafeParentScrollPropagationBoundary(); - - // FIXME: Handle RemoteFrames - if (boundary_frame && boundary_frame->IsLocalFrame()) { - ToLocalFrame(boundary_frame) - ->View() - ->SetSafeToPropagateScrollToParent(false); - } - - Element* element_to_scroll = anchor_node_->IsElementNode() - ? ToElement(anchor_node_) - : doc.documentElement(); - if (element_to_scroll) { - ScrollIntoViewOptions* options = ScrollIntoViewOptions::Create(); - options->setBlock("start"); - options->setInlinePosition("nearest"); - element_to_scroll->ScrollIntoViewNoVisualUpdate(options); - } - - if (boundary_frame && boundary_frame->IsLocalFrame()) { - ToLocalFrame(boundary_frame) - ->View() - ->SetSafeToPropagateScrollToParent(true); - } - - if (AXObjectCache* cache = doc.ExistingAXObjectCache()) - cache->HandleScrolledToAnchor(anchor_node_); - - // Scroll into view above will cause us to clear needs_invoke_ via the - // DidScroll so recompute it here. - needs_invoke_ = !doc.IsLoadCompleted() || needs_focus_; - - return needs_invoke_; -} - -void FragmentAnchor::DidScroll(ScrollType type) { - if (!IsExplicitScrollType(type)) - return; - - // If the user/page scrolled, avoid clobbering the scroll offset by removing - // the anchor on the next invocation. Note: we may get here as a result of - // calling Invoke() because of the ScrollIntoView but that's ok because - // needs_invoke_ is recomputed at the end of that method. - needs_invoke_ = false; -} - -void FragmentAnchor::DidCompleteLoad() { - DCHECK(frame_); - DCHECK(frame_->View()); - - // If there is a pending layout, the fragment anchor will be cleared when it - // finishes. - if (!frame_->View()->NeedsLayout()) - needs_invoke_ = false; -} - -void FragmentAnchor::Trace(blink::Visitor* visitor) { - visitor->Trace(anchor_node_); - visitor->Trace(frame_); -} - -void FragmentAnchor::PerformPreRafActions() { - ApplyFocusIfNeeded(); -} - -void FragmentAnchor::ApplyFocusIfNeeded() { - // SVG images can load synchronously during style recalc but it's ok to focus - // since we disallow scripting. For everything else, focus() could run script - // so make sure we're at a valid point to do so. - DCHECK(frame_->GetDocument()->IsSVGDocument() || - !ScriptForbiddenScope::IsScriptForbidden()); - - if (!needs_focus_) - return; - - if (!frame_->GetDocument()->IsRenderingReady()) - return; - - // If the anchor accepts keyboard focus and fragment scrolling is allowed, - // move focus there to aid users relying on keyboard navigation. - // If anchorNode is not focusable or fragment scrolling is not allowed, - // clear focus, which matches the behavior of other browsers. - frame_->GetDocument()->UpdateStyleAndLayoutTree(); - if (anchor_node_->IsElementNode() && ToElement(anchor_node_)->IsFocusable()) { - ToElement(anchor_node_)->focus(); - } else { - frame_->GetDocument()->SetSequentialFocusNavigationStartingPoint( - anchor_node_); - frame_->GetDocument()->ClearFocusedElement(); - } - needs_focus_ = false; -} - } // namespace blink
diff --git a/third_party/blink/renderer/core/page/scrolling/fragment_anchor.h b/third_party/blink/renderer/core/page/scrolling/fragment_anchor.h index 32ee9d16..c92eaa7 100644 --- a/third_party/blink/renderer/core/page/scrolling/fragment_anchor.h +++ b/third_party/blink/renderer/core/page/scrolling/fragment_anchor.h
@@ -14,62 +14,45 @@ class LocalFrame; class KURL; -// This class encapsulates the behavior of a "fragment anchor". A fragment -// anchor allows a page to link to a specific part of a page by specifying an -// element id in the URL fragment. The fragment is the part after the '#' -// character. E.g. navigating to www.example.com/index.html#section3 will find -// the element with id "section3" and focus and scroll it into view. +// This class is an interface for the concept of a "fragment anchor". A +// fragment anchor allows a page to link to a specific part of a page by using +// the URL fragment. The fragment is the part after the '#' character. E.g. +// navigating to www.example.com/index.html#section3 will find the element with +// id "section3" and focus and scroll it into view. // -// While the page is loading, the fragment anchor tries to repeatedly scroll -// the element into view since it's position may change as a result of layouts. -// TODO(bokan): Maybe we no longer need the repeated scrolling since that -// should be handled by scroll-anchoring? -class CORE_EXPORT FragmentAnchor : public GarbageCollected<FragmentAnchor> { +// This class provides an interface that different types of fragment anchors +// can implement, allowing fragments to specify different kinds of anchors. +// Callers should use the TryCreate static method to create and return the +// appropriate type of base class. +class CORE_EXPORT FragmentAnchor + : public GarbageCollectedFinalized<FragmentAnchor> { public: - // Parses the fragment string and tries to create a FragmentAnchor object. If - // an appropriate target was found based on the given fragment, this method - // will create and return a FragmentAnchor object that can be used to keep it - // in view. Otherwise, this will return nullptr. In either case, - // side-effects on the document will be performed, for example, - // setting/clearing :target and svgView(). If needs_invoke is false, only the - // side effects will be performed, the element won't be scrolled/focused and - // this method returns nullptr (e.g. used during history navigation where we - // don't want to clobber the history scroll restoration). + // Parses the fragment string and tries to create a FragmentAnchor object of + // the appropriate derived type. If no anchor could be created from the given + // url, this returns nullptr. In either case, side-effects on the document + // will be performed, for example, setting/clearing :target and svgView(). static FragmentAnchor* TryCreate(const KURL& url, - bool needs_invoke, LocalFrame& frame); - FragmentAnchor(Node& anchor_node, LocalFrame& frame); + FragmentAnchor() = default; virtual ~FragmentAnchor() = default; // Invoking the fragment anchor scrolls it into view and performs any other // desired actions. This is called repeatedly during loading as the lifecycle // is updated to keep the element in view. If true, the anchor should be kept // alive and invoked again. Otherwise it may be disposed. - bool Invoke(); + virtual bool Invoke() = 0; - // Used to let the fragment know the frame's been scrolled and so we should - // abort keeping the fragment target in view to avoid fighting with user - // scrolls. - void DidScroll(ScrollType type); + // This should be called when the anchor is "installed". In other words, when + // the caller receives the FragmentAnchor and stores it. This allows the + // anchor to perform some initialization. + virtual void Installed() = 0; - void PerformPreRafActions(); + virtual void DidScroll(ScrollType type) = 0; + virtual void PerformPreRafActions() = 0; + virtual void DidCompleteLoad() = 0; - void DidCompleteLoad(); - - void Trace(blink::Visitor*); - - private: - void ApplyFocusIfNeeded(); - - WeakMember<Node> anchor_node_; - Member<LocalFrame> frame_; - bool needs_focus_; - - // While this is true, the fragment is still "active" in the sense that we - // want the owner to continue calling Invoke(). Once this is false, calling - // Invoke has no effect and the fragment can be disposed. - bool needs_invoke_ = true; + virtual void Trace(blink::Visitor*) {} }; } // namespace blink
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc new file mode 100644 index 0000000..53753314 --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc
@@ -0,0 +1,145 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h" + +#include "third_party/blink/public/platform/web_scroll_into_view_params.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/editing/editor.h" +#include "third_party/blink/renderer/core/editing/ephemeral_range.h" +#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h" +#include "third_party/blink/renderer/core/editing/visible_units.h" +#include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/layout/layout_object.h" +#include "third_party/blink/renderer/platform/scroll/scroll_alignment.h" + +namespace blink { + +namespace { + +constexpr char kTextFragmentIdentifierPrefix[] = "targetText="; +constexpr size_t kTextFragmentIdentifierPrefixLength = + base::size(kTextFragmentIdentifierPrefix); + +bool ParseTargetTextIdentifier(const String& fragment, + String* start, + String* end) { + if (fragment.Find(kTextFragmentIdentifierPrefix) != 0) + return false; + + size_t comma_pos = fragment.find(','); + size_t start_pos = kTextFragmentIdentifierPrefixLength - 1; + + if (comma_pos == kNotFound) { + *start = fragment.Substring(start_pos); + *end = ""; + } else { + *start = fragment.Substring(start_pos, comma_pos - start_pos); + + size_t second_start_pos = comma_pos + 1; + size_t end_pos = fragment.find('&', comma_pos); + + if (end_pos == kNotFound) + *end = fragment.Substring(second_start_pos); + else + *end = fragment.Substring(second_start_pos, end_pos - second_start_pos); + } + + return true; +} + +} // namespace + +TextFragmentAnchor* TextFragmentAnchor::TryCreate(const KURL& url, + LocalFrame& frame) { + String start; + String end; + + if (!ParseTargetTextIdentifier(url.FragmentIdentifier(), &start, &end)) + return nullptr; + + String decoded_start = DecodeURLEscapeSequences(start, DecodeURLMode::kUTF8); + String decoded_end = DecodeURLEscapeSequences(end, DecodeURLMode::kUTF8); + + return MakeGarbageCollected<TextFragmentAnchor>(decoded_start, decoded_end, + frame); +} + +TextFragmentAnchor::TextFragmentAnchor(const String& start, + const String& end, + LocalFrame& frame) + : start_(start), end_(end), finder_(*this), frame_(&frame) { + DCHECK(frame_->View()); +} + +bool TextFragmentAnchor::Invoke() { + if (search_finished_) + return false; + + // TODO(bokan): We need to add the capability to match a snippet based on + // it's start and end. https://crbug.com/924964. + finder_.FindMatch(start_, *frame_->GetDocument()); + + // Scrolling into view from the call above might cause us to set + // search_finished_ so recompute here. + search_finished_ = frame_->GetDocument()->IsLoadCompleted(); + + return !search_finished_; +} + +void TextFragmentAnchor::Installed() {} + +void TextFragmentAnchor::DidScroll(ScrollType type) { + if (!IsExplicitScrollType(type)) + return; + + search_finished_ = true; +} + +void TextFragmentAnchor::PerformPreRafActions() {} + +void TextFragmentAnchor::DidCompleteLoad() { + // If there is a pending layout we'll finish the search from Invoke. + if (!frame_->View()->NeedsLayout()) + search_finished_ = true; +} + +void TextFragmentAnchor::Trace(blink::Visitor* visitor) { + visitor->Trace(frame_); + FragmentAnchor::Trace(visitor); +} + +void TextFragmentAnchor::DidFindMatch(const EphemeralRangeInFlatTree& range) { + if (search_finished_) + return; + + Document& document = *frame_->GetDocument(); + + document.Markers().RemoveMarkersOfTypes( + DocumentMarker::MarkerTypes::TextMatch()); + + LayoutRect bounding_box = LayoutRect(ComputeTextRect(range)); + + DCHECK(range.Nodes().begin() != range.Nodes().end()); + + Node& node = *range.Nodes().begin(); + + DCHECK(node.GetLayoutObject()); + + node.GetLayoutObject()->ScrollRectToVisible( + bounding_box, + WebScrollIntoViewParams(ScrollAlignment::kAlignCenterIfNeeded, + ScrollAlignment::kAlignCenterIfNeeded, + kProgrammaticScroll)); + + EphemeralRange dom_range = + EphemeralRange(ToPositionInDOMTree(range.StartPosition()), + ToPositionInDOMTree(range.EndPosition())); + document.Markers().AddTextMatchMarker(dom_range, + TextMatchMarker::MatchStatus::kActive); + frame_->GetEditor().SetMarkedTextMatchesAreHighlighted(true); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h new file mode 100644 index 0000000..a7f0aad1 --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h
@@ -0,0 +1,59 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_TEXT_FRAGMENT_ANCHOR_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_TEXT_FRAGMENT_ANCHOR_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/editing/forward.h" +#include "third_party/blink/renderer/core/page/scrolling/fragment_anchor.h" +#include "third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/scroll/scroll_types.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +class LocalFrame; +class KURL; + +class CORE_EXPORT TextFragmentAnchor final : public FragmentAnchor, + TextFragmentFinder::Client { + public: + static TextFragmentAnchor* TryCreate(const KURL& url, LocalFrame& frame); + + TextFragmentAnchor(const String& start, const String& end, LocalFrame& frame); + ~TextFragmentAnchor() override = default; + + bool Invoke() override; + + void Installed() override; + + void DidScroll(ScrollType type) override; + + void PerformPreRafActions() override; + + void DidCompleteLoad() override; + + void Trace(blink::Visitor*) override; + + // TextFragmentFinder::Client interface + void DidFindMatch(const EphemeralRangeInFlatTree& range) override; + + private: + const String start_; + const String end_; + + TextFragmentFinder finder_; + + Member<LocalFrame> frame_; + + bool search_finished_ = false; + + DISALLOW_COPY_AND_ASSIGN(TextFragmentAnchor); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_TEXT_FRAGMENT_ANCHOR_H_
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor_test.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor_test.cc new file mode 100644 index 0000000..83d4609 --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor_test.cc
@@ -0,0 +1,249 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "build/build_config.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" +#include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h" +#include "third_party/blink/renderer/core/frame/local_frame_view.h" +#include "third_party/blink/renderer/core/html/html_element.h" +#include "third_party/blink/renderer/core/layout/layout_object.h" +#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/scroll/scrollable_area.h" +#include "third_party/blink/renderer/core/testing/sim/sim_request.h" +#include "third_party/blink/renderer/core/testing/sim/sim_test.h" +#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" + +namespace blink { + +namespace { + +using test::RunPendingTasks; + +class TextFragmentAnchorTest : public SimTest { + public: + void SetUp() override { + SimTest::SetUp(); + WebView().MainFrameWidget()->Resize(WebSize(800, 600)); + } + + void RunAsyncMatchingTasks() { + auto* scheduler = + ThreadScheduler::Current()->GetWebMainThreadSchedulerForTest(); + blink::scheduler::RunIdleTasksForTesting(scheduler, + base::BindOnce([]() {})); + RunPendingTasks(); + } + + ScrollableArea* LayoutViewport() { + return GetDocument().View()->LayoutViewport(); + } + + IntRect ViewportRect() { + return IntRect(IntPoint(), LayoutViewport()->VisibleContentRect().Size()); + } + + IntRect BoundingRectInFrame(Node& node) { + return node.GetLayoutObject()->AbsoluteBoundingBoxRect(); + } +}; + +// Basic test case, ensure we scroll the matching text into view. +TEST_F(TextFragmentAnchorTest, BasicSmokeTest) { + SimRequest request("https://example.com/test.html#targetText=test", + "text/html"); + LoadURL("https://example.com/test.html#targetText=test"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { + height: 1200px; + } + p { + position: absolute; + top: 1000px; + } + </style> + <p id="text">This is a test page</p> + )HTML"); + Compositor().BeginFrame(); + + RunAsyncMatchingTasks(); + + Element& p = *GetDocument().getElementById("text"); + + EXPECT_TRUE(ViewportRect().Contains(BoundingRectInFrame(p))) + << "<p> Element wasn't scrolled into view, viewport's scroll offset: " + << LayoutViewport()->GetScrollOffset().ToString(); +} + +// Make sure the fragment is uninstalled once the match has been completed. +// This may require a layout since the anchor is uninstalled at invocation +// time. +TEST_F(TextFragmentAnchorTest, RemoveAnchorAfterMatch) { + SimRequest request("https://example.com/test.html#targetText=test", + "text/html"); + LoadURL("https://example.com/test.html#targetText=test"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { + height: 1200px; + } + p { + position: absolute; + top: 1000px; + } + </style> + <p id="text">This is a test page</p> + )HTML"); + Compositor().BeginFrame(); + RunAsyncMatchingTasks(); + + // Force a layout + GetDocument().body()->setAttribute(html_names::kStyleAttr, "height: 1300px"); + Compositor().BeginFrame(); + + EXPECT_FALSE(GetDocument().View()->GetFragmentAnchor()); +} + +// Make sure a non-matching string doesn't cause scroll and the fragment is +// removed when completed. +TEST_F(TextFragmentAnchorTest, NonMatchingString) { + SimRequest request("https://example.com/test.html#targetText=unicorn", + "text/html"); + LoadURL("https://example.com/test.html#targetText=unicorn"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { + height: 1200px; + } + p { + position: absolute; + top: 1000px; + } + </style> + <p id="text">This is a test page</p> + )HTML"); + Compositor().BeginFrame(); + RunAsyncMatchingTasks(); + + EXPECT_EQ(ScrollOffset(), LayoutViewport()->GetScrollOffset()); + + // Force a layout + GetDocument().body()->setAttribute(html_names::kStyleAttr, "height: 1300px"); + Compositor().BeginFrame(); + + EXPECT_FALSE(GetDocument().View()->GetFragmentAnchor()); +} + +// If the targetText=... string matches an id, we should scroll using id +// fragment semantics rather than doing a textual match. +TEST_F(TextFragmentAnchorTest, IdFragmentTakesPrecedence) { + SimRequest request("https://example.com/test.html#targetText=test", + "text/html"); + LoadURL("https://example.com/test.html#targetText=test"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { + height: 2200px; + } + p { + position: absolute; + top: 1000px; + } + div { + position: absolute; + top: 2000px; + } + </style> + <p id="text">This is a test page</p> + <div id="targetText=test"></div> + )HTML"); + Compositor().BeginFrame(); + + RunAsyncMatchingTasks(); + + Element& div = *GetDocument().getElementById("targetText=test"); + + EXPECT_TRUE(ViewportRect().Contains(BoundingRectInFrame(div))) + << "Should have scrolled <div> into view but didn't, scroll offset: " + << LayoutViewport()->GetScrollOffset().ToString(); +} + +// Ensure multiple matches will scroll the first into view. +TEST_F(TextFragmentAnchorTest, MultipleMatches) { + SimRequest request("https://example.com/test.html#targetText=test", + "text/html"); + LoadURL("https://example.com/test.html#targetText=test"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + body { + height: 1200px; + } + #first { + position: absolute; + top: 1000px; + } + #second { + position: absolute; + top: 2000px; + } + </style> + <p id="first">This is a test page</p> + <p id="second">This is a test page</p> + )HTML"); + Compositor().BeginFrame(); + + RunAsyncMatchingTasks(); + + Element& first = *GetDocument().getElementById("first"); + + EXPECT_TRUE(ViewportRect().Contains(BoundingRectInFrame(first))) + << "First <p> wasn't scrolled into view, viewport's scroll offset: " + << LayoutViewport()->GetScrollOffset().ToString(); + + // Ensure we only report one marker. + EXPECT_EQ(1u, GetDocument().Markers().Markers().size()); +} + +// Ensure matching works inside nested blocks. +TEST_F(TextFragmentAnchorTest, NestedBlocks) { + SimRequest request("https://example.com/test.html#targetText=test", + "text/html"); + LoadURL("https://example.com/test.html#targetText=test"); + request.Complete(R"HTML( + <!DOCTYPE html> + <style> + #spacer { + height: 1000px; + } + </style> + <body> + <div id="spacer"> + Some non-matching text + </div> + <div> + <p id="match">This is a test page</p> + </div> + </body> + )HTML"); + Compositor().BeginFrame(); + + RunAsyncMatchingTasks(); + + Element& match = *GetDocument().getElementById("match"); + + EXPECT_TRUE(ViewportRect().Contains(BoundingRectInFrame(match))) + << "<p> wasn't scrolled into view, viewport's scroll offset: " + << LayoutViewport()->GetScrollOffset().ToString(); +} + +} // namespace + +} // namespace blink
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc new file mode 100644 index 0000000..44160e0 --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc
@@ -0,0 +1,58 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h" + +#include <memory> + +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/range.h" +#include "third_party/blink/renderer/core/editing/ephemeral_range.h" +#include "third_party/blink/renderer/core/editing/finder/find_buffer.h" +#include "third_party/blink/renderer/core/editing/position.h" + +namespace blink { + +TextFragmentFinder::TextFragmentFinder(Client& client) : client_(client) {} + +void TextFragmentFinder::FindMatch(const String& search_text, + Document& document) { + search_text_ = search_text; + PositionInFlatTree search_start = + PositionInFlatTree::FirstPositionInNode(document); + + PositionInFlatTree search_end; + if (document.documentElement() && document.documentElement()->lastChild()) { + search_end = + PositionInFlatTree::AfterNode(*document.documentElement()->lastChild()); + } else { + search_end = PositionInFlatTree::LastPositionInNode(document); + } + + // TODO(bokan): Make FindMatch work asynchronously. https://crbug.com/930156. + while (search_start != search_end) { + // Find in the whole block. + FindBuffer buffer(EphemeralRangeInFlatTree(search_start, search_end)); + const FindOptions find_options = kCaseInsensitive; + std::unique_ptr<FindBuffer::Results> match_results = + buffer.FindMatches(search_text_, find_options); + + if (!match_results->IsEmpty()) { + FindBuffer::BufferMatchResult match = match_results->front(); + const EphemeralRangeInFlatTree ephemeral_match_range = + buffer.RangeFromBufferIndex(match.start, match.start + match.length); + client_.DidFindMatch(ephemeral_match_range); + break; + } + + // At this point, all text in the block collected above has been + // processed. Now we move to the next block if there's any, + // otherwise we should stop. + search_start = buffer.PositionAfterBlock(); + if (search_start.IsNull()) + break; + } +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h new file mode 100644 index 0000000..1c180b3 --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h
@@ -0,0 +1,43 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_TEXT_FRAGMENT_FINDER_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_TEXT_FRAGMENT_FINDER_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/editing/forward.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +class Document; + +// This is a helper class to TextFragmentAnchor. It's responsible for actually +// performing the text search for the anchor and returning the results to the +// anchor. +class CORE_EXPORT TextFragmentFinder final { + public: + class Client { + public: + virtual void DidFindMatch(const EphemeralRangeInFlatTree& range) = 0; + }; + + // Client must outlive the finder. + TextFragmentFinder(Client& client); + ~TextFragmentFinder() = default; + + // Begins searching for the given string in the given top-level document. + void FindMatch(const String& search_text, Document& document); + + private: + Client& client_; + + String search_text_; + + DISALLOW_COPY_AND_ASSIGN(TextFragmentFinder); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_TEXT_FRAGMENT_FINDER_H_
diff --git a/third_party/blink/renderer/core/page/viewport_description.cc b/third_party/blink/renderer/core/page/viewport_description.cc index 36832fb..6b3971df 100644 --- a/third_party/blink/renderer/core/page/viewport_description.cc +++ b/third_party/blink/renderer/core/page/viewport_description.cc
@@ -65,7 +65,7 @@ if (length.IsFixed()) return length.GetFloatValue(); - if (length.GetType() == kExtendToZoom) + if (length.IsExtendToZoom()) return ViewportDescription::kValueExtendToZoom; if (length.IsPercent() && direction == kHorizontal) @@ -74,10 +74,10 @@ if (length.IsPercent() && direction == kVertical) return initial_viewport_size.Height() * length.GetFloatValue() / 100.0f; - if (length.GetType() == kDeviceWidth) + if (length.IsDeviceWidth()) return initial_viewport_size.Width(); - if (length.GetType() == kDeviceHeight) + if (length.IsDeviceHeight()) return initial_viewport_size.Height(); NOTREACHED(); @@ -97,11 +97,11 @@ // setting the 'min' value to 'extend-to-zoom' and the 'max' value to the // intended length. In case the UA-defines a min-width, use that as length. if (zoom == ViewportDescription::kValueAuto) { - copy_min_width = Length(kExtendToZoom); + copy_min_width = Length::ExtendToZoom(); copy_max_width = legacy_fallback_width; } else if (max_height.IsAuto()) { - copy_min_width = Length(kExtendToZoom); - copy_max_width = Length(kExtendToZoom); + copy_min_width = Length::ExtendToZoom(); + copy_max_width = Length::ExtendToZoom(); } } @@ -283,8 +283,7 @@ overview_zoom_histogram.Sample(overview_zoom_percent); } - } else if (max_width.GetType() == blink::kDeviceWidth || - max_width.GetType() == blink::kExtendToZoom) { + } else if (max_width.IsDeviceWidth() || max_width.IsExtendToZoom()) { meta_tag_type_histogram.Count( static_cast<int>(ViewportUMAType::kDeviceWidth)); } else {
diff --git a/third_party/blink/renderer/core/page/viewport_test.cc b/third_party/blink/renderer/core/page/viewport_test.cc index f5b7d91..da9ab8d 100644 --- a/third_party/blink/renderer/core/page/viewport_test.cc +++ b/third_party/blink/renderer/core/page/viewport_test.cc
@@ -104,8 +104,8 @@ ->View() ->SetFrameRect(IntRect(IntPoint::Zero(), initial_viewport_size)); ViewportDescription description = page->GetViewportDescription(); - PageScaleConstraints constraints = description.Resolve( - FloatSize(initial_viewport_size), Length(980, blink::kFixed)); + PageScaleConstraints constraints = + description.Resolve(FloatSize(initial_viewport_size), Length::Fixed(980)); constraints.FitToContentsWidth(constraints.layout_size.Width(), initial_width);
diff --git a/third_party/blink/renderer/core/paint/README.md b/third_party/blink/renderer/core/paint/README.md index dbf3dc08..f435fbf 100644 --- a/third_party/blink/renderer/core/paint/README.md +++ b/third_party/blink/renderer/core/paint/README.md
@@ -26,7 +26,7 @@ * Stacking contexts: elements with non-auto z-indices or other properties that affect stacking e.g. transform, opacity, blend-mode. - * Replaced normal-flow stacking elements: [replaced elements](https://html.spec.whatwg.org/multipage/rendering.html#replaced-elements) + * Replaced normal-flow stacking elements: [replaced elements](https://html.spec.whatwg.org/C/#replaced-elements) that do not have non-auto z-index but are stacking contexts for elements below them. Right now the only example is SVG <foreignObject>. The difference between these elements and regular stacking contexts is
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc b/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc index 4089594..2dd2fa1d 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc +++ b/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc
@@ -159,7 +159,7 @@ // where the resulting width in the non-overlapping dimension will round to a // larger width. BorderImageLength top_bottom(10); - BorderImageLength left_right(Length(11, kFixed)); + BorderImageLength left_right(Length::Fixed(11)); nine_piece.SetBorderSlices( BorderImageLengthBox(top_bottom, left_right, top_bottom, left_right)); grid = NinePieceImageGrid(nine_piece, image_size, border_image_area, @@ -202,8 +202,8 @@ IntRect(0, 0, 100, 100), IntRectOutsets(0, 0, 0, 0), true, - LengthBox(Length(0, kFixed), Length(0, kFixed), Length(0, kFixed), - Length(0, kFixed)), + LengthBox(Length::Fixed(0), Length::Fixed(0), Length::Fixed(0), + Length::Fixed(0)), kStretchImageRule, kStretchImageRule, { @@ -231,8 +231,8 @@ IntRect(0, 0, 100, 100), IntRectOutsets(0, 0, 10, 0), true, - LengthBox(Length(20, kPercent), Length(20, kPercent), - Length(20, kPercent), Length(20, kPercent)), + LengthBox(Length::Percent(20), Length::Percent(20), Length::Percent(20), + Length::Percent(20)), kStretchImageRule, kStretchImageRule, { @@ -260,8 +260,8 @@ IntRect(0, 0, 100, 100), IntRectOutsets(10, 10, 10, 10), false, - LengthBox(Length(20, kPercent), Length(20, kPercent), - Length(20, kPercent), Length(20, kPercent)), + LengthBox(Length::Percent(20), Length::Percent(20), Length::Percent(20), + Length::Percent(20)), kStretchImageRule, kStretchImageRule, { @@ -289,8 +289,8 @@ IntRect(0, 0, 100, 100), IntRectOutsets(0, 0, 0, 10), false, - LengthBox(Length(20, kPercent), Length(20, kPercent), - Length(20, kPercent), Length(20, kPercent)), + LengthBox(Length::Percent(20), Length::Percent(20), Length::Percent(20), + Length::Percent(20)), kStretchImageRule, kRoundImageRule, { @@ -319,8 +319,8 @@ IntRect(0, 0, 100, 100), IntRectOutsets(10, 10, 10, 10), true, - LengthBox(Length(0, kFixed), Length(0, kFixed), Length(0, kFixed), - Length(0, kFixed)), + LengthBox(Length::Fixed(0), Length::Fixed(0), Length::Fixed(0), + Length::Fixed(0)), kStretchImageRule, kSpaceImageRule, {
diff --git a/third_party/blink/renderer/core/script/BUILD.gn b/third_party/blink/renderer/core/script/BUILD.gn index b02fb078..d552200 100644 --- a/third_party/blink/renderer/core/script/BUILD.gn +++ b/third_party/blink/renderer/core/script/BUILD.gn
@@ -38,6 +38,8 @@ "module_pending_script.h", "module_script.cc", "module_script.h", + "parsed_specifier.cc", + "parsed_specifier.h", "pending_script.cc", "pending_script.h", "script.h",
diff --git a/third_party/blink/renderer/core/script/README.md b/third_party/blink/renderer/core/script/README.md index a7a6fbe..5f2e65d 100644 --- a/third_party/blink/renderer/core/script/README.md +++ b/third_party/blink/renderer/core/script/README.md
@@ -8,16 +8,16 @@ This directory implements the following scripting concepts in the HTML spec: -* [`<script>` elements](https://html.spec.whatwg.org/multipage/scripting.html#the-script-element) +* [`<script>` elements](https://html.spec.whatwg.org/C/#the-script-element) * Interactions between scripts and HTML/XML documents/parsers -* A part of [Scripting](https://html.spec.whatwg.org/multipage/webappapis.html#scripting) - * [scripts](https://html.spec.whatwg.org/multipage/webappapis.html#definitions-2) - * [classic scripts](https://html.spec.whatwg.org/multipage/webappapis.html#classic-script) - * [module scripts](https://html.spec.whatwg.org/multipage/webappapis.html#module-script) - * [Fetching](https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts) scripts - * [creating](https://html.spec.whatwg.org/multipage/webappapis.html#creating-scripts) scripts - * [calling](https://html.spec.whatwg.org/multipage/webappapis.html#calling-scripts) scripts - * [Integration with the JavaScript module system](https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system) +* A part of [Scripting](https://html.spec.whatwg.org/C/#scripting) + * [scripts](https://html.spec.whatwg.org/C/#definitions-2) + * [classic scripts](https://html.spec.whatwg.org/C/#classic-script) + * [module scripts](https://html.spec.whatwg.org/C/#module-script) + * [Fetching](https://html.spec.whatwg.org/C/#fetching-scripts) scripts + * [creating](https://html.spec.whatwg.org/C/#creating-scripts) scripts + * [calling](https://html.spec.whatwg.org/C/#calling-scripts) scripts + * [Integration with the JavaScript module system](https://html.spec.whatwg.org/C/#integration-with-the-javascript-module-system) ## See Also
diff --git a/third_party/blink/renderer/core/script/classic_pending_script.h b/third_party/blink/renderer/core/script/classic_pending_script.h index 50fa64f..c9e135d 100644 --- a/third_party/blink/renderer/core/script/classic_pending_script.h +++ b/third_party/blink/renderer/core/script/classic_pending_script.h
@@ -16,7 +16,7 @@ namespace blink { // PendingScript for a classic script -// https://html.spec.whatwg.org/multipage/webappapis.html#classic-script. +// https://html.spec.whatwg.org/C/#classic-script. // // TODO(kochi): The comment below is from pre-oilpan age and may not be correct // now. @@ -29,7 +29,7 @@ USING_GARBAGE_COLLECTED_MIXIN(ClassicPendingScript); public: - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script + // https://html.spec.whatwg.org/C/#fetch-a-classic-script // // For a script from an external file, calls ScriptResource::Fetch() and // creates ClassicPendingScript. Returns nullptr if Fetch() returns nullptr. @@ -111,9 +111,9 @@ const ScriptFetchOptions options_; // "base url" snapshot taken at #prepare-a-script timing. - // https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script + // https://html.spec.whatwg.org/C/#prepare-a-script // which will eventually be used as #concept-script-base-url. - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-base-url + // https://html.spec.whatwg.org/C/#concept-script-base-url const KURL base_url_for_inline_script_; // "element's child text content" snapshot taken at
diff --git a/third_party/blink/renderer/core/script/document_modulator_impl_test.cc b/third_party/blink/renderer/core/script/document_modulator_impl_test.cc index 49d8906..415a10b 100644 --- a/third_party/blink/renderer/core/script/document_modulator_impl_test.cc +++ b/third_party/blink/renderer/core/script/document_modulator_impl_test.cc
@@ -31,7 +31,7 @@ TEST_F(DocumentModulatorImplTest, ResolveModuleSpecifier) { // Taken from examples listed in - // https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier + // https://html.spec.whatwg.org/C/#resolve-a-module-specifier // "The following are valid module specifiers according to the above // algorithm:"
diff --git a/third_party/blink/renderer/core/script/html_parser_script_runner.cc b/third_party/blink/renderer/core/script/html_parser_script_runner.cc index b95c3fb8..5d9c294 100644 --- a/third_party/blink/renderer/core/script/html_parser_script_runner.cc +++ b/third_party/blink/renderer/core/script/html_parser_script_runner.cc
@@ -92,10 +92,10 @@ // cases: // * the script's execution is blocked on the completed load of the script // resource - // (https://html.spec.whatwg.org/multipage/scripting.html#pending-parsing-blocking-script) + // (https://html.spec.whatwg.org/C/#pending-parsing-blocking-script) // * the script's execution is blocked on the load of a style sheet or other // resources that are blocking scripts - // (https://html.spec.whatwg.org/multipage/semantics.html#a-style-sheet-that-is-blocking-scripts) + // (https://html.spec.whatwg.org/C/#a-style-sheet-that-is-blocking-scripts) // // Both of these cases can introduce significant latency when loading a // web page, especially for users on slow connections, since the HTML parser @@ -237,7 +237,7 @@ // Should be correspond to // // <specdef -// href="https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block"> +// href="https://html.spec.whatwg.org/C/#execute-the-script-block"> // // but currently does more than specced, because historically this and // ExecutePendingParserBlockingScriptAndDispatchEvent() was the same method. @@ -506,7 +506,7 @@ // The initial steps for 'An end tag whose tag name is "script"' // <specdef href="https://html.spec.whatwg.org/C/#scriptEndTag"> // <specdef label="prepare-a-script" -// href="https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script"> +// href="https://html.spec.whatwg.org/C/#prepare-a-script"> void HTMLParserScriptRunner::ProcessScriptElementInternal( Element* script, const TextPosition& script_start_position) {
diff --git a/third_party/blink/renderer/core/script/html_parser_script_runner.h b/third_party/blink/renderer/core/script/html_parser_script_runner.h index 9f6a567..b698180 100644 --- a/third_party/blink/renderer/core/script/html_parser_script_runner.h +++ b/third_party/blink/renderer/core/script/html_parser_script_runner.h
@@ -47,7 +47,7 @@ // HTMLParserScriptRunner is responsible for for arranging the execution of // script elements inserted by the parser, according to the rules for // 'An end tag whose tag name is "script"': -// https://html.spec.whatwg.org/multipage/parsing.html#scriptEndTag +// https://html.spec.whatwg.org/C/#scriptEndTag // // If a script blocks parsing, this class is responsible for holding it, and // executing it when required. @@ -134,10 +134,10 @@ Member<Document> document_; Member<HTMLParserScriptRunnerHost> host_; - // https://html.spec.whatwg.org/multipage/scripting.html#pending-parsing-blocking-script + // https://html.spec.whatwg.org/C/#pending-parsing-blocking-script TraceWrapperMember<PendingScript> parser_blocking_script_; - // https://html.spec.whatwg.org/multipage/scripting.html#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing + // https://html.spec.whatwg.org/C/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing HeapDeque<TraceWrapperMember<PendingScript>> scripts_to_execute_after_parsing_;
diff --git a/third_party/blink/renderer/core/script/layered_api.cc b/third_party/blink/renderer/core/script/layered_api.cc index 8596620..85ace6db 100644 --- a/third_party/blink/renderer/core/script/layered_api.cc +++ b/third_party/blink/renderer/core/script/layered_api.cc
@@ -18,6 +18,10 @@ static const char kStdScheme[] = "std"; static const char kInternalScheme[] = "std-internal"; +static const char kImportScheme[] = "import"; + +constexpr char kBuiltinSpecifierPrefix[] = "@std/"; + int GetResourceIDFromPath(const String& path) { for (size_t i = 0; i < base::size(kLayeredAPIResources); ++i) { if (path == kLayeredAPIResources[i].path) { @@ -33,14 +37,26 @@ } // namespace +String GetBuiltinPath(const KURL& url) { + if (url.ProtocolIs(kStdScheme)) + return url.GetPath(); + + const StringView prefix(kBuiltinSpecifierPrefix); + if (url.ProtocolIs(kImportScheme) && url.GetPath().StartsWith(prefix)) + return url.GetPath().Substring(prefix.length()); + + return String(); +} + // https://github.com/drufball/layered-apis/blob/master/spec.md#user-content-layered-api-fetching-url KURL ResolveFetchingURL(const KURL& url) { // <spec step="1">If url's scheme is not "std", return url.</spec> - if (!url.ProtocolIs(kStdScheme)) - return url; - // <spec step="2">Let path be url's path[0].</spec> - const String path = url.GetPath(); + // Note: Also accepts "import:@std/x". + // See the comment at GetBuiltinPath() declaration. + String path = GetBuiltinPath(url); + if (path.IsNull()) + return url; // <spec step="5">If the layered API identified by path is implemented by this // user agent, return the result of parsing the concatenation of "std:" with @@ -57,11 +73,12 @@ } KURL GetInternalURL(const KURL& url) { - if (url.ProtocolIs(kStdScheme)) { + String path = GetBuiltinPath(url); + if (!path.IsNull()) { StringBuilder url_string; url_string.Append(kInternalScheme); url_string.Append("://"); - url_string.Append(url.GetPath()); + url_string.Append(path); url_string.Append("/index.js"); return KURL(NullURL(), url_string.ToString()); }
diff --git a/third_party/blink/renderer/core/script/layered_api.h b/third_party/blink/renderer/core/script/layered_api.h index 91977362..6667730 100644 --- a/third_party/blink/renderer/core/script/layered_api.h +++ b/third_party/blink/renderer/core/script/layered_api.h
@@ -17,6 +17,15 @@ // https://docs.google.com/document/d/1V-WaCZQbBcQJRSYSYBb8Y6p0DOdDpiNDSmD41ui_73s/edit namespace layered_api { +// Returns the path part (`x`) for std:x or import:@std/x URLs. +// For other URLs, returns a null String. +// +// Currently accepts both "std:x" and "import:@std/x", but +// because the spec discussion about notation is ongoing: +// https://github.com/tc39/proposal-javascript-standard-library/issues/12 +// TODO(hiroshige): Update the implementation once the discussion converges. +CORE_EXPORT String GetBuiltinPath(const KURL&); + // https://github.com/drufball/layered-apis/blob/master/spec.md#user-content-layered-api-fetching-url // // Currently fallback syntax is disabled and only "std:x" (not "std:x|y") is
diff --git a/third_party/blink/renderer/core/script/modulator.h b/third_party/blink/renderer/core/script/modulator.h index 591b7787..2926e97 100644 --- a/third_party/blink/renderer/core/script/modulator.h +++ b/third_party/blink/renderer/core/script/modulator.h
@@ -63,18 +63,18 @@ }; // spec: "top-level module fetch flag" -// https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-top-level +// https://html.spec.whatwg.org/C/#fetching-scripts-is-top-level enum class ModuleGraphLevel { kTopLevelModuleFetch, kDependentModuleFetch }; // spec: "custom peform the fetch hook" -// https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch +// https://html.spec.whatwg.org/C/#fetching-scripts-perform-fetch enum class ModuleScriptCustomFetchType { // Fetch module scripts without invoking custom fetch steps. kNone, // Perform custom fetch steps for worker's constructor defined in the HTML // spec: - // https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model + // https://html.spec.whatwg.org/C/#worker-processing-model kWorkerConstructor, // Perform custom fetch steps for Worklet's addModule() function defined in @@ -89,7 +89,7 @@ // A Modulator is an interface for "environment settings object" concept for // module scripts. -// https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object +// https://html.spec.whatwg.org/C/#environment-settings-object // // A Modulator also serves as an entry point for various module spec algorithms. class CORE_EXPORT Modulator : public GarbageCollectedFinalized<Modulator>, @@ -112,12 +112,12 @@ virtual ScriptState* GetScriptState() = 0; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-bc-noscript + // https://html.spec.whatwg.org/C/#concept-bc-noscript // "scripting is disabled for settings's responsible browsing context" virtual bool IsScriptingDisabled() const = 0; - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-worker-script-tree + // https://html.spec.whatwg.org/C/#fetch-a-module-script-tree + // https://html.spec.whatwg.org/C/#fetch-a-module-worker-script-tree // Note that |this| is the "module map settings object" and // ResourceFetcher represents "fetch client settings object" // used in the "fetch a module worker script graph" algorithm. @@ -130,7 +130,7 @@ // Asynchronously retrieve a module script from the module map, or fetch it // and put it in the map if it's not there already. - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script + // https://html.spec.whatwg.org/C/#fetch-a-single-module-script // Note that |this| is the "module map settings object" and // |fetch_client_settings_object_fetcher| represents // "fetch client settings object", which can be different from the @@ -154,7 +154,7 @@ // is still "fetching". virtual ModuleScript* GetFetchedModuleScript(const KURL&) = 0; - // https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier + // https://html.spec.whatwg.org/C/#resolve-a-module-specifier virtual KURL ResolveModuleSpecifier(const String& module_request, const KURL& base_url, String* failure_reason = nullptr) = 0; @@ -165,7 +165,7 @@ const ReferrerScriptInfo&, ScriptPromiseResolver*) = 0; - // https://html.spec.whatwg.org/multipage/webappapis.html#hostgetimportmetaproperties + // https://html.spec.whatwg.org/C/#hostgetimportmetaproperties virtual ModuleImportMeta HostGetImportMetaProperties(ScriptModule) const = 0; virtual bool HasValidContext() = 0; @@ -184,7 +184,7 @@ enum class CaptureEvalErrorFlag : bool { kReport, kCapture }; // ExecuteModule implements #run-a-module-script HTML spec algorithm. - // https://html.spec.whatwg.org/multipage/webappapis.html#run-a-module-script + // https://html.spec.whatwg.org/C/#run-a-module-script // CaptureEvalErrorFlag is used to implement "rethrow errors" parameter in // run-a-module-script. // - When "rethrow errors" is to be set, use kCapture for EvaluateModule().
diff --git a/third_party/blink/renderer/core/script/modulator_impl_base.cc b/third_party/blink/renderer/core/script/modulator_impl_base.cc index 3dc6225..f7f975c 100644 --- a/third_party/blink/renderer/core/script/modulator_impl_base.cc +++ b/third_party/blink/renderer/core/script/modulator_impl_base.cc
@@ -15,6 +15,7 @@ #include "third_party/blink/renderer/core/script/layered_api.h" #include "third_party/blink/renderer/core/script/module_map.h" #include "third_party/blink/renderer/core/script/module_script.h" +#include "third_party/blink/renderer/core/script/parsed_specifier.h" #include "third_party/blink/renderer/core/script/script_module_resolver_impl.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" @@ -45,9 +46,9 @@ } // <specdef label="fetch-a-module-script-tree" -// href="https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree"> +// href="https://html.spec.whatwg.org/C/#fetch-a-module-script-tree"> // <specdef label="fetch-a-module-worker-script-tree" -// href="https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-worker-script-tree"> +// href="https://html.spec.whatwg.org/C/#fetch-a-module-worker-script-tree"> void ModulatorImplBase::FetchTree( const KURL& url, ResourceFetcher* fetch_client_settings_object_fetcher, @@ -108,49 +109,44 @@ } // <specdef href="https://html.spec.whatwg.org/C/#resolve-a-module-specifier"> -KURL ModulatorImplBase::ResolveModuleSpecifier(const String& module_request, +KURL ModulatorImplBase::ResolveModuleSpecifier(const String& specifier, const KURL& base_url, String* failure_reason) { - // <spec step="1">Apply the URL parser to specifier. If the result is not - // failure, return the result.</spec> - KURL url(NullURL(), module_request); - if (url.IsValid()) { - // <spec - // href="https://github.com/drufball/layered-apis/blob/master/spec.md#resolve-a-module-specifier" - // step="1">Let parsed be the result of applying the URL parser to - // specifier. If parsed is not failure, then return the layered API fetching - // URL given parsed and script's base URL.</spec> - if (RuntimeEnabledFeatures::LayeredAPIEnabled()) - return blink::layered_api::ResolveFetchingURL(url); + ParsedSpecifier parsed_specifier = + ParsedSpecifier::Create(specifier, base_url); - return url; - } - - // <spec step="2">If specifier does not start with the character U+002F - // SOLIDUS (/), the two-character sequence U+002E FULL STOP, U+002F SOLIDUS - // (./), or the three-character sequence U+002E FULL STOP, U+002E FULL STOP, - // U+002F SOLIDUS (../), return failure.</spec> - if (!module_request.StartsWith("/") && !module_request.StartsWith("./") && - !module_request.StartsWith("../")) { + if (!parsed_specifier.IsValid()) { if (failure_reason) { *failure_reason = - "Relative references must start with either \"/\", \"./\", or " - "\"../\"."; + "Invalid relative url or base scheme isn't hierarchical."; } return KURL(); } - // <spec step="3">Return the result of applying the URL parser to specifier - // with base URL as the base URL.</spec> - DCHECK(base_url.IsValid()); - KURL absolute_url(base_url, module_request); - if (absolute_url.IsValid()) - return absolute_url; + switch (parsed_specifier.GetType()) { + case ParsedSpecifier::Type::kInvalid: + NOTREACHED(); + return KURL(); - if (failure_reason) { - *failure_reason = "Invalid relative url or base scheme isn't hierarchical."; + case ParsedSpecifier::Type::kBare: + // Allow |@std/x| specifiers if Layered API is enabled. + if (RuntimeEnabledFeatures::LayeredAPIEnabled()) { + if (parsed_specifier.GetImportMapKeyString().StartsWith("@std/")) { + return KURL("import:" + parsed_specifier.GetImportMapKeyString()); + } + } + + // Reject bare specifiers as specced by the pre-ImportMap spec. + if (failure_reason) { + *failure_reason = + "Relative references must start with either \"/\", \"./\", or " + "\"../\"."; + } + return KURL(); + + case ParsedSpecifier::Type::kURL: + return parsed_specifier.GetUrl(); } - return KURL(); } bool ModulatorImplBase::HasValidContext() {
diff --git a/third_party/blink/renderer/core/script/module_import_meta.h b/third_party/blink/renderer/core/script/module_import_meta.h index 3d7a7cd..d6af2ba4 100644 --- a/third_party/blink/renderer/core/script/module_import_meta.h +++ b/third_party/blink/renderer/core/script/module_import_meta.h
@@ -11,7 +11,7 @@ namespace blink { // Represents import.meta data structure, which is the return value of -// https://html.spec.whatwg.org/multipage/webappapis.html#hostgetimportmetaproperties +// https://html.spec.whatwg.org/C/#hostgetimportmetaproperties class CORE_EXPORT ModuleImportMeta final { public: explicit ModuleImportMeta(const String& url) : url_(url) {}
diff --git a/third_party/blink/renderer/core/script/module_map.cc b/third_party/blink/renderer/core/script/module_map.cc index a48f1f2..7e0f3e5 100644 --- a/third_party/blink/renderer/core/script/module_map.cc +++ b/third_party/blink/renderer/core/script/module_map.cc
@@ -15,7 +15,7 @@ namespace blink { // Entry struct represents a value in "module map" spec object. -// https://html.spec.whatwg.org/multipage/webappapis.html#module-map +// https://html.spec.whatwg.org/C/#module-map class ModuleMap::Entry final : public GarbageCollectedFinalized<Entry>, public NameClient, public ModuleScriptLoaderClient {
diff --git a/third_party/blink/renderer/core/script/module_map.h b/third_party/blink/renderer/core/script/module_map.h index 3949ceba..52457cdf 100644 --- a/third_party/blink/renderer/core/script/module_map.h +++ b/third_party/blink/renderer/core/script/module_map.h
@@ -26,7 +26,7 @@ enum class ModuleScriptCustomFetchType; // A ModuleMap implements "module map" spec. -// https://html.spec.whatwg.org/multipage/webappapis.html#module-map +// https://html.spec.whatwg.org/C/#module-map class CORE_EXPORT ModuleMap final : public GarbageCollected<ModuleMap>, public NameClient { class Entry; @@ -41,7 +41,7 @@ void Trace(blink::Visitor*); const char* NameInHeapSnapshot() const override { return "ModuleMap"; } - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script + // https://html.spec.whatwg.org/C/#fetch-a-single-module-script void FetchSingleModuleScript( const ModuleScriptFetchRequest&, ResourceFetcher* fetch_client_settings_object_fetcher,
diff --git a/third_party/blink/renderer/core/script/module_pending_script.h b/third_party/blink/renderer/core/script/module_pending_script.h index d1c15764..b75a48f1 100644 --- a/third_party/blink/renderer/core/script/module_pending_script.h +++ b/third_party/blink/renderer/core/script/module_pending_script.h
@@ -46,7 +46,7 @@ }; // PendingScript for a module script -// https://html.spec.whatwg.org/multipage/webappapis.html#module-script. +// https://html.spec.whatwg.org/C/#module-script. class CORE_EXPORT ModulePendingScript : public PendingScript { public: static ModulePendingScript* Create(ScriptElementBase* element,
diff --git a/third_party/blink/renderer/core/script/module_script.h b/third_party/blink/renderer/core/script/module_script.h index 02c3e136..305035f 100644 --- a/third_party/blink/renderer/core/script/module_script.h +++ b/third_party/blink/renderer/core/script/module_script.h
@@ -22,10 +22,10 @@ namespace blink { // ModuleScript is a model object for the "module script" spec concept. -// https://html.spec.whatwg.org/multipage/webappapis.html#module-script +// https://html.spec.whatwg.org/C/#module-script class CORE_EXPORT ModuleScript final : public Script, public NameClient { public: - // https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-module-script + // https://html.spec.whatwg.org/C/#creating-a-module-script static ModuleScript* Create( const ParkableString& source_text, Modulator*, @@ -95,16 +95,16 @@ friend class ModulatorImplBase; friend class ModuleTreeLinkerTestModulator; - // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object + // https://html.spec.whatwg.org/C/#settings-object Member<Modulator> settings_object_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-record + // https://html.spec.whatwg.org/C/#concept-script-record // TODO(keishi): Visitor only defines a trace method for v8::Value so this // needs to be cast. GC_PLUGIN_IGNORE("757708") TraceWrapperV8Reference<v8::Module> record_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-parse-error + // https://html.spec.whatwg.org/C/#concept-script-parse-error // // |record_|, |parse_error_| and |error_to_rethrow_| are wrapper traced and // kept alive via one or more of following reference graphs: @@ -141,7 +141,7 @@ // will require moderate code changes (e.g. to move compilation timing). TraceWrapperV8Reference<v8::Value> parse_error_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-error-to-rethrow + // https://html.spec.whatwg.org/C/#concept-script-error-to-rethrow TraceWrapperV8Reference<v8::Value> error_to_rethrow_; // For CSP check.
diff --git a/third_party/blink/renderer/core/script/parsed_specifier.cc b/third_party/blink/renderer/core/script/parsed_specifier.cc new file mode 100644 index 0000000..c5ab903 --- /dev/null +++ b/third_party/blink/renderer/core/script/parsed_specifier.cc
@@ -0,0 +1,62 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/script/parsed_specifier.h" + +namespace blink { + +// <specdef href="https://html.spec.whatwg.org/#resolve-a-module-specifier"> +ParsedSpecifier ParsedSpecifier::Create(const String& specifier, + const KURL& base_url) { + // <spec step="1">Apply the URL parser to specifier. If the result is not + // failure, return the result.</spec> + KURL url(NullURL(), specifier); + if (url.IsValid()) + return ParsedSpecifier(url); + + // <spec step="2">If specifier does not start with the character U+002F + // SOLIDUS (/), the two-character sequence U+002E FULL STOP, U+002F SOLIDUS + // (./), or the three-character sequence U+002E FULL STOP, U+002E FULL STOP, + // U+002F SOLIDUS (../), return failure.</spec> + if (!specifier.StartsWith("/") && !specifier.StartsWith("./") && + !specifier.StartsWith("../")) { + // Do not consider an empty specifier as a valid bare specifier. + if (specifier.IsEmpty()) + return ParsedSpecifier(); + + return ParsedSpecifier(specifier); + } + + // <spec step="3">Return the result of applying the URL parser to specifier + // with base URL as the base URL.</spec> + DCHECK(base_url.IsValid()); + KURL absolute_url(base_url, specifier); + if (absolute_url.IsValid()) + return ParsedSpecifier(absolute_url); + + return ParsedSpecifier(); +} + +String ParsedSpecifier::GetImportMapKeyString() const { + switch (GetType()) { + case Type::kInvalid: + return String(); + case Type::kBare: + return bare_specifier_; + case Type::kURL: + return url_.GetString(); + } +} + +KURL ParsedSpecifier::GetUrl() const { + switch (GetType()) { + case Type::kInvalid: + case Type::kBare: + return NullURL(); + case Type::kURL: + return url_; + } +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/script/parsed_specifier.h b/third_party/blink/renderer/core/script/parsed_specifier.h new file mode 100644 index 0000000..93c762e9 --- /dev/null +++ b/third_party/blink/renderer/core/script/parsed_specifier.h
@@ -0,0 +1,70 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_PARSED_SPECIFIER_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_PARSED_SPECIFIER_H_ + +#include "base/macros.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +// ParsedSpecifier represents a parsed specifier, either +// - a non-bare specifier, parsed as a KURL as specced by +// https://html.spec.whatwg.org/#resolve-a-module-specifier or +// - a bare specifier, stored as a String as-is. + +// Non-import-maps cases: +// Bare specifiers should be rejected by callers as resolution errors. +// Then ParsedSpecifier represents the result of +// https://html.spec.whatwg.org/#resolve-a-module-specifier +// and behaves just like a KURL via GetUrl(). + +// Import-maps cases: +// In the import map spec, specifiers are handled mostly as strings, +// occasionally converted to/from URLs. +// In Blink, we pass ParsedSpecifier throughout the import map resolution, +// instead of passing String with occasionally converting to KURL. +// This avoid duplicated URL parsing. +class ParsedSpecifier final { + public: + // Parse |specifier|, which may be a non-bare or bare specifier. + // This implements + // https://html.spec.whatwg.org/#resolve-a-module-specifier + // but doesn't reject bare specifiers, which should be rejected by callers + // if needed. + static ParsedSpecifier Create(const String& specifier, const KURL& base_url); + + enum class Type { kInvalid, kBare, kURL }; + + Type GetType() const { return type_; } + + // Returns the string to be used as the key of import maps. + // This is the bare specifier itself if type is kBare, or + // serialized URL if type is kURL. + String GetImportMapKeyString() const; + + // Returns the URL, if type is kURL, or an null URL otherwise. + KURL GetUrl() const; + + bool IsValid() const { return GetType() != Type::kInvalid; } + + private: + // Invalid specifier. + ParsedSpecifier() : type_(Type::kInvalid) {} + // Non-bare specifier. + explicit ParsedSpecifier(const KURL& url) : type_(Type::kURL), url_(url) {} + // Bare specifier. + explicit ParsedSpecifier(const String& bare_specifier) + : type_(Type::kBare), bare_specifier_(bare_specifier) {} + + const Type type_; + const KURL url_; + const String bare_specifier_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_PARSED_SPECIFIER_H_
diff --git a/third_party/blink/renderer/core/script/pending_script.h b/third_party/blink/renderer/core/script/pending_script.h index 31663d1..f9454932 100644 --- a/third_party/blink/renderer/core/script/pending_script.h +++ b/third_party/blink/renderer/core/script/pending_script.h
@@ -60,7 +60,7 @@ // ScriptLoader creates a PendingScript in ScriptLoader::PrepareScript(), and // a Script is created via PendingScript::GetSource() when it becomes ready. // When "script is ready" -// https://html.spec.whatwg.org/multipage/scripting.html#the-script-is-ready, +// https://html.spec.whatwg.org/C/#the-script-is-ready, // PendingScriptClient is notified. class CORE_EXPORT PendingScript : public GarbageCollectedFinalized<PendingScript>, @@ -91,7 +91,7 @@ // Returns nullptr when "script's script is null", i.e. an error occurred. virtual Script* GetSource(const KURL& document_url) const = 0; - // https://html.spec.whatwg.org/multipage/scripting.html#the-script-is-ready + // https://html.spec.whatwg.org/C/#the-script-is-ready virtual bool IsReady() const = 0; virtual bool IsExternal() const = 0; virtual bool WasCanceled() const = 0; @@ -101,7 +101,7 @@ // Used only for tracing, and can return a null URL. // TODO(hiroshige): It's preferable to return the base URL consistently - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-base-url + // https://html.spec.whatwg.org/C/#concept-script-base-url // but it requires further refactoring. virtual KURL UrlForTracing() const = 0; @@ -129,7 +129,7 @@ return created_during_document_write_; } - // https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block + // https://html.spec.whatwg.org/C/#execute-the-script-block // The single entry point of script execution. // PendingScript::Dispose() is called in ExecuteScriptBlock(). //
diff --git a/third_party/blink/renderer/core/script/script.h b/third_party/blink/renderer/core/script/script.h index 7ef29600..70e4aff 100644 --- a/third_party/blink/renderer/core/script/script.h +++ b/third_party/blink/renderer/core/script/script.h
@@ -17,7 +17,7 @@ class LocalFrame; class SecurityOrigin; -// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script +// https://html.spec.whatwg.org/C/#concept-script class CORE_EXPORT Script : public GarbageCollectedFinalized<Script> { public: virtual void Trace(blink::Visitor* visitor) {} @@ -26,9 +26,9 @@ virtual mojom::ScriptType GetScriptType() const = 0; - // https://html.spec.whatwg.org/multipage/webappapis.html#run-a-classic-script + // https://html.spec.whatwg.org/C/#run-a-classic-script // or - // https://html.spec.whatwg.org/multipage/webappapis.html#run-a-module-script, + // https://html.spec.whatwg.org/C/#run-a-module-script, // depending on the script type. virtual void RunScript(LocalFrame*, const SecurityOrigin*) const = 0; @@ -43,10 +43,10 @@ : fetch_options_(fetch_options), base_url_(base_url) {} private: - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-script-fetch-options + // https://html.spec.whatwg.org/C/#concept-script-script-fetch-options const ScriptFetchOptions fetch_options_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-base-url + // https://html.spec.whatwg.org/C/#concept-script-base-url const KURL base_url_; };
diff --git a/third_party/blink/renderer/core/script/script_loader.cc b/third_party/blink/renderer/core/script/script_loader.cc index 77c49c8..2bd15a1 100644 --- a/third_party/blink/renderer/core/script/script_loader.cc +++ b/third_party/blink/renderer/core/script/script_loader.cc
@@ -201,13 +201,13 @@ } // Corresponds to -// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#module-script-credentials-mode +// https://html.spec.whatwg.org/C/#module-script-credentials-mode // which is a translation of the CORS settings attribute in the context of // module scripts. This is used in: // - Step 17 of -// https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script +// https://html.spec.whatwg.org/C/#prepare-a-script // - Step 6 of obtaining a preloaded module script -// https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload. +// https://html.spec.whatwg.org/C/#link-type-modulepreload. network::mojom::FetchCredentialsMode ScriptLoader::ModuleScriptCredentialsMode( CrossOriginAttributeValue cross_origin) { switch (cross_origin) { @@ -749,7 +749,7 @@ return true; } -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script +// https://html.spec.whatwg.org/C/#fetch-a-classic-script void ScriptLoader::FetchClassicScript(const KURL& url, Document& element_document, const ScriptFetchOptions& options,
diff --git a/third_party/blink/renderer/core/script/script_loader.h b/third_party/blink/renderer/core/script/script_loader.h index 689d62b1..71607bb 100644 --- a/third_party/blink/renderer/core/script/script_loader.h +++ b/third_party/blink/renderer/core/script/script_loader.h
@@ -82,7 +82,7 @@ static network::mojom::FetchCredentialsMode ModuleScriptCredentialsMode( CrossOriginAttributeValue); - // https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script + // https://html.spec.whatwg.org/C/#prepare-a-script bool PrepareScript(const TextPosition& script_start_position = TextPosition::MinimumPosition(), LegacyTypeSupport = kDisallowLegacyTypeInTypeAttribute); @@ -120,16 +120,16 @@ bool IsScriptForEventSupported() const; // FetchClassicScript corresponds to Step 21.6 of - // https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script + // https://html.spec.whatwg.org/C/#prepare-a-script // and must NOT be called from outside of PendingScript(). // - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script + // https://html.spec.whatwg.org/C/#fetch-a-classic-script void FetchClassicScript(const KURL&, Document&, const ScriptFetchOptions&, CrossOriginAttributeValue, const WTF::TextEncoding&); - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree + // https://html.spec.whatwg.org/C/#fetch-a-module-script-tree void FetchModuleScriptTree(const KURL&, ResourceFetcher*, Modulator*, @@ -143,36 +143,36 @@ Member<ScriptElementBase> element_; - // https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model + // https://html.spec.whatwg.org/C/#script-processing-model // "A script element has several associated pieces of state.": // <spec - // href="https://html.spec.whatwg.org/multipage/scripting.html#already-started"> + // href="https://html.spec.whatwg.org/C/#already-started"> // ... Initially, script elements must have this flag unset ...</spec> bool already_started_ = false; // <spec - // href="https://html.spec.whatwg.org/multipage/scripting.html#parser-inserted"> + // href="https://html.spec.whatwg.org/C/#parser-inserted"> // ... Initially, script elements must have this flag unset. ...</spec> bool parser_inserted_ = false; // <spec - // href="https://html.spec.whatwg.org/multipage/scripting.html#non-blocking"> + // href="https://html.spec.whatwg.org/C/#non-blocking"> // ... Initially, script elements must have this flag set. ...</spec> bool non_blocking_ = true; // <spec - // href="https://html.spec.whatwg.org/multipage/scripting.html#ready-to-be-parser-executed"> + // href="https://html.spec.whatwg.org/C/#ready-to-be-parser-executed"> // ... Initially, script elements must have this flag unset ...</spec> bool ready_to_be_parser_executed_ = false; // <spec - // href="https://html.spec.whatwg.org/multipage/scripting.html#concept-script-type"> + // href="https://html.spec.whatwg.org/C/#concept-script-type"> // ... It is determined when the script is prepared, ...</spec> mojom::ScriptType script_type_ = mojom::ScriptType::kClassic; // <spec - // href="https://html.spec.whatwg.org/multipage/scripting.html#concept-script-external"> + // href="https://html.spec.whatwg.org/C/#concept-script-external"> // ... It is determined when the script is prepared, ...</spec> bool is_external_script_ = false;
diff --git a/third_party/blink/renderer/core/script/script_module_resolver_impl.h b/third_party/blink/renderer/core/script/script_module_resolver_impl.h index 6249cec0..e4fa735 100644 --- a/third_party/blink/renderer/core/script/script_module_resolver_impl.h +++ b/third_party/blink/renderer/core/script/script_module_resolver_impl.h
@@ -47,7 +47,7 @@ ModuleScript* GetHostDefined(const ScriptModule&) const final; // Implements "Runtime Semantics: HostResolveImportedModule" per HTML spec. - // https://html.spec.whatwg.org/multipage/webappapis.html#hostresolveimportedmodule(referencingscriptormodule,-specifier)) + // https://html.spec.whatwg.org/C/#hostresolveimportedmodule(referencingscriptormodule,-specifier)) ScriptModule Resolve(const String& specifier, const ScriptModule& referrer, ExceptionState&) final;
diff --git a/third_party/blink/renderer/core/script/script_scheduling_type.h b/third_party/blink/renderer/core/script/script_scheduling_type.h index 869e2857..928143e 100644 --- a/third_party/blink/renderer/core/script/script_scheduling_type.h +++ b/third_party/blink/renderer/core/script/script_scheduling_type.h
@@ -10,7 +10,7 @@ // Type of <script>'s scheduling. // // In the spec, this is determined which clause of Step 25 of -// https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script +// https://html.spec.whatwg.org/C/#prepare-a-script // is taken. // // The enum values are used in histograms and thus do not change existing
diff --git a/third_party/blink/renderer/core/script/xml_parser_script_runner.cc b/third_party/blink/renderer/core/script/xml_parser_script_runner.cc index 4b13772c..91340e90 100644 --- a/third_party/blink/renderer/core/script/xml_parser_script_runner.cc +++ b/third_party/blink/renderer/core/script/xml_parser_script_runner.cc
@@ -14,9 +14,9 @@ // Spec links: // <specdef label="Parsing" -// href="https://html.spec.whatwg.org/multipage/xhtml.html#parsing-xhtml-documents"> +// href="https://html.spec.whatwg.org/C/#parsing-xhtml-documents"> // <specdef label="Prepare" -// href="https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script"> +// href="https://html.spec.whatwg.org/C/#prepare-a-script"> XMLParserScriptRunner::XMLParserScriptRunner(XMLParserScriptRunnerHost* host) : host_(host) {}
diff --git a/third_party/blink/renderer/core/script/xml_parser_script_runner.h b/third_party/blink/renderer/core/script/xml_parser_script_runner.h index 69db30b..d682bd5 100644 --- a/third_party/blink/renderer/core/script/xml_parser_script_runner.h +++ b/third_party/blink/renderer/core/script/xml_parser_script_runner.h
@@ -17,7 +17,7 @@ // XMLParserScriptRunner implements the interaction between an XML parser // (XMLDocumentParser) and <script> elements and their loading/execution. // -// https://html.spec.whatwg.org/multipage/xhtml.html#parsing-xhtml-documents +// https://html.spec.whatwg.org/C/#parsing-xhtml-documents class XMLParserScriptRunner final : public GarbageCollectedFinalized<XMLParserScriptRunner>, public PendingScriptClient { @@ -42,7 +42,7 @@ // from PendingScriptClient void PendingScriptFinished(PendingScript*) override; - // https://html.spec.whatwg.org/multipage/scripting.html#pending-parsing-blocking-script + // https://html.spec.whatwg.org/C/#pending-parsing-blocking-script // TODO(crbug/717643): Support module scripts, and turn this into // TraceWrapperMember<>. Member<PendingScript> parser_blocking_script_; @@ -50,7 +50,7 @@ Member<XMLParserScriptRunnerHost> host_; // TODO(crbug/717643): Implement - // https://html.spec.whatwg.org/multipage/scripting.html#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing + // https://html.spec.whatwg.org/C/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing DISALLOW_COPY_AND_ASSIGN(XMLParserScriptRunner); };
diff --git a/third_party/blink/renderer/core/style/basic_shapes.h b/third_party/blink/renderer/core/style/basic_shapes.h index 8fceef9..986af2c 100644 --- a/third_party/blink/renderer/core/style/basic_shapes.h +++ b/third_party/blink/renderer/core/style/basic_shapes.h
@@ -84,7 +84,7 @@ enum Direction { kTopLeft, kBottomRight }; BasicShapeCenterCoordinate(Direction direction = kTopLeft, - const Length& length = Length(0, kFixed)) + const Length& length = Length::Fixed(0)) : direction_(direction), length_(length), computed_length_(direction == kTopLeft
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index aa7fe0c..44f00c3 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -1820,9 +1820,8 @@ // too, though this involves messily poking into CalcExpressionLength. if (lh.IsFixed()) { float multiplier = TextAutosizingMultiplier(); - return Length(TextAutosizer::ComputeAutosizedFontSize( - lh.Value(), multiplier, EffectiveZoom()), - kFixed); + return Length::Fixed(TextAutosizer::ComputeAutosizedFontSize( + lh.Value(), multiplier, EffectiveZoom())); } return lh;
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 90ddc39..5b846a1 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -1491,10 +1491,10 @@ !PaddingTop().IsZero() || !PaddingBottom().IsZero(); } void ResetPadding() { - SetPaddingTop(Length(kFixed)); - SetPaddingBottom(Length(kFixed)); - SetPaddingLeft(Length(kFixed)); - SetPaddingRight(Length(kFixed)); + SetPaddingTop(Length::Fixed()); + SetPaddingBottom(Length::Fixed()); + SetPaddingLeft(Length::Fixed()); + SetPaddingRight(Length::Fixed()); } void SetPadding(const LengthBox& b) { SetPaddingTop(b.top_); @@ -1786,7 +1786,7 @@ } void SetBorderRadius(const IntSize& s) { SetBorderRadius( - LengthSize(Length(s.Width(), kFixed), Length(s.Height(), kFixed))); + LengthSize(Length::Fixed(s.Width()), Length::Fixed(s.Height()))); } FloatRoundedRect GetRoundedBorderFor(
diff --git a/third_party/blink/renderer/core/style/fill_layer.h b/third_party/blink/renderer/core/style/fill_layer.h index da0b2ce..9502f6e 100644 --- a/third_party/blink/renderer/core/style/fill_layer.h +++ b/third_party/blink/renderer/core/style/fill_layer.h
@@ -283,10 +283,10 @@ return FillSize(InitialFillSizeType(type), InitialFillSizeLength(type)); } static Length InitialFillPositionX(EFillLayerType) { - return Length(0.0, kPercent); + return Length::Percent(0.0); } static Length InitialFillPositionY(EFillLayerType) { - return Length(0.0, kPercent); + return Length::Percent(0.0); } static StyleImage* InitialFillImage(EFillLayerType) { return nullptr; } static EMaskSourceType InitialFillMaskSourceType(EFillLayerType) {
diff --git a/third_party/blink/renderer/core/style/filter_operations_test.cc b/third_party/blink/renderer/core/style/filter_operations_test.cc index 076a1e3a4..6682791 100644 --- a/third_party/blink/renderer/core/style/filter_operations_test.cc +++ b/third_party/blink/renderer/core/style/filter_operations_test.cc
@@ -38,7 +38,7 @@ TEST(FilterOperationsTest, mapRectBlur) { FilterOperations ops; - ops.Operations().push_back(BlurFilterOperation::Create(Length(20.0, kFixed))); + ops.Operations().push_back(BlurFilterOperation::Create(Length::Fixed(20.0))); EXPECT_TRUE(ops.HasFilterThatMovesPixels()); EXPECT_EQ(IntRect(-57, -57, 124, 124), EnclosingIntRect(ops.MapRect(FloatRect(0, 0, 10, 10))));
diff --git a/third_party/blink/renderer/core/style/grid_track_size.h b/third_party/blink/renderer/core/style/grid_track_size.h index 6c4821e..76298bf7 100644 --- a/third_party/blink/renderer/core/style/grid_track_size.h +++ b/third_party/blink/renderer/core/style/grid_track_size.h
@@ -62,13 +62,15 @@ GridTrackSize(const GridLength& length, GridTrackSizeType track_size_type = kLengthTrackSizing) : type_(track_size_type), - min_track_breadth_( - track_size_type == kFitContentTrackSizing ? Length(kAuto) : length), - max_track_breadth_( - track_size_type == kFitContentTrackSizing ? Length(kAuto) : length), + min_track_breadth_(track_size_type == kFitContentTrackSizing + ? Length::Auto() + : length), + max_track_breadth_(track_size_type == kFitContentTrackSizing + ? Length::Auto() + : length), fit_content_track_breadth_(track_size_type == kFitContentTrackSizing ? length - : GridLength(Length(kFixed))) { + : GridLength(Length::Fixed())) { DCHECK(track_size_type == kLengthTrackSizing || track_size_type == kFitContentTrackSizing); DCHECK(track_size_type != kFitContentTrackSizing || length.IsLength()); @@ -80,7 +82,7 @@ : type_(kMinMaxTrackSizing), min_track_breadth_(min_track_breadth), max_track_breadth_(max_track_breadth), - fit_content_track_breadth_(GridLength(Length(kFixed))) { + fit_content_track_breadth_(GridLength(Length::Fixed())) { CacheMinMaxTrackBreadthTypes(); }
diff --git a/third_party/blink/renderer/core/style/nine_piece_image.cc b/third_party/blink/renderer/core/style/nine_piece_image.cc index c8915be..07c6317b 100644 --- a/third_party/blink/renderer/core/style/nine_piece_image.cc +++ b/third_party/blink/renderer/core/style/nine_piece_image.cc
@@ -59,15 +59,15 @@ horizontal_rule(kStretchImageRule), vertical_rule(kStretchImageRule), image(nullptr), - image_slices(Length(100, kPercent), - Length(100, kPercent), - Length(100, kPercent), - Length(100, kPercent)), + image_slices(Length::Percent(100), + Length::Percent(100), + Length::Percent(100), + Length::Percent(100)), border_slices(1.0, 1.0, 1.0, 1.0), - outset(Length(0, kFixed), - Length(0, kFixed), - Length(0, kFixed), - Length(0, kFixed)) {} + outset(Length::Fixed(0), + Length::Fixed(0), + Length::Fixed(0), + Length::Fixed(0)) {} bool NinePieceImageData::operator==(const NinePieceImageData& other) const { return DataEquivalent(image, other.image) &&
diff --git a/third_party/blink/renderer/core/style/nine_piece_image.h b/third_party/blink/renderer/core/style/nine_piece_image.h index 564b2bd..d2a26d3 100644 --- a/third_party/blink/renderer/core/style/nine_piece_image.h +++ b/third_party/blink/renderer/core/style/nine_piece_image.h
@@ -87,7 +87,7 @@ NinePieceImage image; image.data_.Access()->image_slices = LengthBox(0); image.data_.Access()->fill = true; - image.data_.Access()->border_slices = BorderImageLengthBox(Length(kAuto)); + image.data_.Access()->border_slices = BorderImageLengthBox(Length::Auto()); return image; }
diff --git a/third_party/blink/renderer/core/style/svg_computed_style.h b/third_party/blink/renderer/core/style/svg_computed_style.h index c0d4aac..7bb051e 100644 --- a/third_party/blink/renderer/core/style/svg_computed_style.h +++ b/third_party/blink/renderer/core/style/svg_computed_style.h
@@ -64,7 +64,7 @@ static EAlignmentBaseline InitialAlignmentBaseline() { return AB_AUTO; } static EDominantBaseline InitialDominantBaseline() { return DB_AUTO; } static EBaselineShift InitialBaselineShift() { return BS_LENGTH; } - static Length InitialBaselineShiftValue() { return Length(kFixed); } + static Length InitialBaselineShiftValue() { return Length::Fixed(); } static EVectorEffect InitialVectorEffect() { return VE_NONE; } static EBufferedRendering InitialBufferedRendering() { return BR_AUTO; } static LineCap InitialCapStyle() { return kButtCap; } @@ -83,10 +83,10 @@ static float InitialStrokeOpacity() { return 1; } static SVGPaint InitialStrokePaint() { return SVGPaint(); } static scoped_refptr<SVGDashArray> InitialStrokeDashArray(); - static Length InitialStrokeDashOffset() { return Length(kFixed); } + static Length InitialStrokeDashOffset() { return Length::Fixed(); } static float InitialStrokeMiterLimit() { return 4; } static UnzoomedLength InitialStrokeWidth() { - return UnzoomedLength(Length(1, kFixed)); + return UnzoomedLength(Length::Fixed(1)); } static float InitialStopOpacity() { return 1; } static Color InitialStopColor() { return Color(0, 0, 0); } @@ -100,13 +100,13 @@ static EMaskType InitialMaskType() { return MT_LUMINANCE; } static EPaintOrder InitialPaintOrder() { return kPaintOrderNormal; } static StylePath* InitialD() { return nullptr; } - static Length InitialCx() { return Length(kFixed); } - static Length InitialCy() { return Length(kFixed); } - static Length InitialX() { return Length(kFixed); } - static Length InitialY() { return Length(kFixed); } - static Length InitialR() { return Length(kFixed); } - static Length InitialRx() { return Length(kAuto); } - static Length InitialRy() { return Length(kAuto); } + static Length InitialCx() { return Length::Fixed(); } + static Length InitialCy() { return Length::Fixed(); } + static Length InitialX() { return Length::Fixed(); } + static Length InitialY() { return Length::Fixed(); } + static Length InitialR() { return Length::Fixed(); } + static Length InitialRx() { return Length::Auto(); } + static Length InitialRy() { return Length::Auto(); } // SVG CSS Property setters void SetAlignmentBaseline(EAlignmentBaseline val) {
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl index c84d70c1..764185c5 100644 --- a/third_party/blink/renderer/core/testing/internals.idl +++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -416,7 +416,7 @@ // element mechanism. [RaisesException] void addEmbedderCustomElementName(DOMString name); - // https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier + // https://html.spec.whatwg.org/C/#resolve-a-module-specifier // Throws TypeError on error. // Used for testing Import Maps https://github.com/domenic/import-maps [RaisesException] DOMString resolveModuleSpecifier(DOMString specifier, DOMString base_url, Document document);
diff --git a/third_party/blink/renderer/core/url/README.md b/third_party/blink/renderer/core/url/README.md index 440f7498..4e5733a 100644 --- a/third_party/blink/renderer/core/url/README.md +++ b/third_party/blink/renderer/core/url/README.md
@@ -6,9 +6,9 @@ - the object URL methods for [Blob][5], [Media Source Extensions][6] and [Media Capture and Streams][7] [1]: https://url.spec.whatwg.org/ -[2]: https://html.spec.whatwg.org/multipage/history.html#the-location-interface -[3]: https://html.spec.whatwg.org/multipage/workers.html#worker-locations -[4]: https://html.spec.whatwg.org/multipage/links.html#api-for-a-and-area-elements +[2]: https://html.spec.whatwg.org/C/#the-location-interface +[3]: https://html.spec.whatwg.org/C/#worker-locations +[4]: https://html.spec.whatwg.org/C/#api-for-a-and-area-elements [5]: https://w3c.github.io/FileAPI/#dfn-createObjectURL [6]: http://w3c.github.io/media-source/#dom-url-createobjecturl [7]: https://w3c.github.io/mediacapture-main/
diff --git a/third_party/blink/renderer/core/workers/README.md b/third_party/blink/renderer/core/workers/README.md index 067971989..f17260a 100644 --- a/third_party/blink/renderer/core/workers/README.md +++ b/third_party/blink/renderer/core/workers/README.md
@@ -1,4 +1,4 @@ -This directory contains the base implementation of all worker and worklet types. Also, this contains the implementation of the [Web Workers API](https://html.spec.whatwg.org/multipage/workers.html#workers) (Dedicated Worker and Shared Worker) and [Worklets API](https://drafts.css-houdini.org/worklets/). +This directory contains the base implementation of all worker and worklet types. Also, this contains the implementation of the [Web Workers API](https://html.spec.whatwg.org/C/#workers) (Dedicated Worker and Shared Worker) and [Worklets API](https://drafts.css-houdini.org/worklets/). # Worker / Worklet types
diff --git a/third_party/blink/renderer/core/workers/abstract_worker.h b/third_party/blink/renderer/core/workers/abstract_worker.h index 12316ad..174a4430 100644 --- a/third_party/blink/renderer/core/workers/abstract_worker.h +++ b/third_party/blink/renderer/core/workers/abstract_worker.h
@@ -46,7 +46,7 @@ class ExecutionContext; // Implementation of the AbstractWorker interface defined in the WebWorker HTML -// spec: https://html.spec.whatwg.org/multipage/workers.html#abstractworker +// spec: https://html.spec.whatwg.org/C/#abstractworker class CORE_EXPORT AbstractWorker : public EventTargetWithInlineData, public ContextLifecycleObserver { USING_GARBAGE_COLLECTED_MIXIN(AbstractWorker);
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker.cc b/third_party/blink/renderer/core/workers/dedicated_worker.cc index 7be18ed..be9ba2f 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker.cc
@@ -209,7 +209,7 @@ std::move(transferable_message)); } -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void DedicatedWorker::Start() { DCHECK(GetExecutionContext()->IsContextThread()); @@ -253,7 +253,7 @@ CreateGlobalScopeCreationParams( script_request_url_, OffMainThreadWorkerScriptFetchOption::kEnabled, network::mojom::ReferrerPolicy::kDefault), - options_, script_request_url_, outside_settings_object, stack_id, + options_, script_request_url_, *outside_settings_object, stack_id, String() /* source_code */); return; } @@ -408,7 +408,7 @@ CreateGlobalScopeCreationParams( script_response_url, OffMainThreadWorkerScriptFetchOption::kDisabled, referrer_policy), - options_, script_response_url, outside_settings_object, stack_id, + options_, script_response_url, *outside_settings_object, stack_id, classic_script_loader_->SourceText()); probe::scriptImported(GetExecutionContext(), classic_script_loader_->Identifier(),
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker.h b/third_party/blink/renderer/core/workers/dedicated_worker.h index e4336bd..90e9745 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker.h +++ b/third_party/blink/renderer/core/workers/dedicated_worker.h
@@ -36,7 +36,7 @@ class WorkerClients; // Implementation of the Worker interface defined in the WebWorker HTML spec: -// https://html.spec.whatwg.org/multipage/workers.html#worker +// https://html.spec.whatwg.org/C/#worker // // Confusingly, the Worker interface is for dedicated workers, so this class is // called DedicatedWorker. This lives on the thread that created the worker (the
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc index 198a8fb..0b5724d3 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc
@@ -65,10 +65,10 @@ return event_target_names::kDedicatedWorkerGlobalScope; } -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void DedicatedWorkerGlobalScope::ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode credentials_mode) { // Step 12: "Let destination be "sharedworker" if is shared is true, and // "worker" otherwise."
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h index c4b8cc1a..fc74b26 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h
@@ -64,7 +64,7 @@ // WorkerGlobalScope void ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode) override; const String name() const;
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc index 0663b31f..0f5e97f 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc
@@ -41,7 +41,7 @@ std::unique_ptr<GlobalScopeCreationParams> creation_params, const WorkerOptions* options, const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, const v8_inspector::V8StackTraceId& stack_id, const String& source_code) { DCHECK(IsParentContextThread()); @@ -179,7 +179,7 @@ // "Thus, error reports propagate up to the chain of dedicated workers up to // the original Document, even if some of the workers along this chain have // been terminated and garbage collected." - // https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2 + // https://html.spec.whatwg.org/C/#runtime-script-errors-2 ErrorEvent* event = ErrorEvent::Create(error_message, location->Clone(), nullptr); if (worker_object_->DispatchEvent(*event) != @@ -194,7 +194,7 @@ // The HTML spec requires to queue an error event using the DOM manipulation // task source. - // https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2 + // https://html.spec.whatwg.org/C/#runtime-script-errors-2 PostCrossThreadTask( *GetWorkerThread()->GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, CrossThreadBind(&DedicatedWorkerObjectProxy::ProcessUnhandledException,
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h index 1467031..89e215d 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h +++ b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.h
@@ -39,7 +39,7 @@ std::unique_ptr<GlobalScopeCreationParams>, const WorkerOptions*, const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, const v8_inspector::V8StackTraceId&, const String& source_code); void PostMessageToWorkerGlobalScope(BlinkTransferableMessage);
diff --git a/third_party/blink/renderer/core/workers/experimental/thread_pool_thread.cc b/third_party/blink/renderer/core/workers/experimental/thread_pool_thread.cc index b7c67ece..52e9b76 100644 --- a/third_party/blink/renderer/core/workers/experimental/thread_pool_thread.cc +++ b/third_party/blink/renderer/core/workers/experimental/thread_pool_thread.cc
@@ -38,7 +38,7 @@ // WorkerGlobalScope void ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode) override { // TODO(japhet): Consider whether modules should be supported. NOTREACHED();
diff --git a/third_party/blink/renderer/core/workers/global_scope_creation_params.h b/third_party/blink/renderer/core/workers/global_scope_creation_params.h index af7ed99..6fd98dc 100644 --- a/third_party/blink/renderer/core/workers/global_scope_creation_params.h +++ b/third_party/blink/renderer/core/workers/global_scope_creation_params.h
@@ -67,7 +67,7 @@ // The URL to be used as the worker global scope's URL. // According to the spec, this should be response URL of the top-level // worker script after the top-level worker script is loaded. - // https://html.spec.whatwg.org/multipage/workers.html#run-a-worker + // https://html.spec.whatwg.org/C/#run-a-worker // // However, this can't be set to response URL in case of module workers or // off-the-main-thread fetch, because at the time of GlobalScopeCreationParams
diff --git a/third_party/blink/renderer/core/workers/shared_worker_global_scope.cc b/third_party/blink/renderer/core/workers/shared_worker_global_scope.cc index 3dfd2d9..f95e37b 100644 --- a/third_party/blink/renderer/core/workers/shared_worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/shared_worker_global_scope.cc
@@ -55,10 +55,10 @@ return event_target_names::kSharedWorkerGlobalScope; } -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void SharedWorkerGlobalScope::ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode credentials_mode) { // Step 12: "Let destination be "sharedworker" if is shared is true, and // "worker" otherwise."
diff --git a/third_party/blink/renderer/core/workers/shared_worker_global_scope.h b/third_party/blink/renderer/core/workers/shared_worker_global_scope.h index 7b779529..e33ee828 100644 --- a/third_party/blink/renderer/core/workers/shared_worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/shared_worker_global_scope.h
@@ -60,7 +60,7 @@ // WorkerGlobalScope void ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode) override; // Setters/Getters for attributes in SharedWorkerGlobalScope.idl
diff --git a/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc b/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc index 150cbc7..3e7d6d9 100644 --- a/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc +++ b/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc
@@ -51,7 +51,7 @@ // spec: // "For shared workers, if the error is still not handled afterwards, the // error may be reported to a developer console." - // https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2 + // https://html.spec.whatwg.org/C/#runtime-script-errors-2 } void SharedWorkerReportingProxy::ReportConsoleMessage(MessageSource, @@ -66,7 +66,7 @@ DCHECK(!IsMainThread()); // TODO(nhiroki): Change the task type to kDOMManipulation here and elsewhere // in this file. See the HTML spec: - // https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model:dom-manipulation-task-source-2 + // https://html.spec.whatwg.org/C/#worker-processing-model:dom-manipulation-task-source-2 PostCrossThreadTask( *parent_execution_context_task_runners_->Get(TaskType::kInternalDefault), FROM_HERE,
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc index 6eeb1fca..238242b7 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc
@@ -81,7 +81,7 @@ void ThreadedWorkletMessagingProxy::FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode credentials_mode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks* pending_tasks) { DCHECK(IsMainThread()); @@ -90,7 +90,7 @@ CrossThreadBind(&ThreadedWorkletObjectProxy::FetchAndInvokeScript, CrossThreadUnretained(worklet_object_proxy_.get()), module_url_record, credentials_mode, - WTF::Passed(outside_settings_object->CopyData()), + WTF::Passed(outside_settings_object.CopyData()), std::move(outside_settings_task_runner), WrapCrossThreadPersistent(pending_tasks), CrossThreadUnretained(GetWorkerThread())));
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.h b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.h index 733b29f7..78a47cf8 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.h +++ b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.h
@@ -26,7 +26,7 @@ void FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks*) final; void WorkletObjectDestroyed() final;
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc b/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc index 3a70d19a..fd415cdc 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc
@@ -36,7 +36,7 @@ auto* global_scope = To<WorkletGlobalScope>(worker_thread->GlobalScope()); global_scope->FetchAndInvokeScript( module_url_record, credentials_mode, - MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + *MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( std::move(outside_settings_object)), std::move(outside_settings_task_runner), pending_tasks); }
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.cc b/third_party/blink/renderer/core/workers/worker_global_scope.cc index a9ba45b..78a4ad76 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -156,7 +156,7 @@ } // Implementation of the "importScripts()" algorithm: -// https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts +// https://html.spec.whatwg.org/C/#dom-workerglobalscope-importscripts void WorkerGlobalScope::importScriptsFromStrings( const Vector<String>& urls, ExceptionState& exception_state) { @@ -355,10 +355,10 @@ debugger->ExternalAsyncTaskFinished(stack_id); } -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void WorkerGlobalScope::ImportClassicScript( const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, const v8_inspector::V8StackTraceId& stack_id) { DCHECK(base::FeatureList::IsEnabled( features::kOffMainThreadDedicatedWorkerScriptFetch) || @@ -402,7 +402,7 @@ probe::didReceiveScriptResponse(this, classic_script_loader->Identifier()); } -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void WorkerGlobalScope::DidImportClassicScript( WorkerClassicScriptLoader* classic_script_loader, const v8_inspector::V8StackTraceId& stack_id) {
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.h b/third_party/blink/renderer/core/workers/worker_global_scope.h index d6deb4ae..4ef4088e 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_global_scope.h
@@ -150,12 +150,12 @@ const v8_inspector::V8StackTraceId& stack_id); void ImportClassicScript( const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, const v8_inspector::V8StackTraceId& stack_id); // Imports the top-level module script for |module_url_record|. virtual void ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode) = 0; void ReceiveMessage(BlinkTransferableMessage);
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.idl b/third_party/blink/renderer/core/workers/worker_global_scope.idl index 38cfe8c..ea15aa0 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.idl +++ b/third_party/blink/renderer/core/workers/worker_global_scope.idl
@@ -69,7 +69,7 @@ void queueMicrotask(VoidFunction callback); // AnimationFrameProvider mixin - // https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames + // https://html.spec.whatwg.org/C/#animation-frames [RuntimeEnabled=OffscreenCanvas, RaisesException] long requestAnimationFrame(FrameRequestCallback callback); [RuntimeEnabled=OffscreenCanvas] void cancelAnimationFrame(long handle);
diff --git a/third_party/blink/renderer/core/workers/worker_module_tree_client.cc b/third_party/blink/renderer/core/workers/worker_module_tree_client.cc index bbb7be3..1720640 100644 --- a/third_party/blink/renderer/core/workers/worker_module_tree_client.cc +++ b/third_party/blink/renderer/core/workers/worker_module_tree_client.cc
@@ -17,7 +17,7 @@ // A partial implementation of the "Processing model" algorithm in the HTML // WebWorker spec: -// https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model +// https://html.spec.whatwg.org/C/#worker-processing-model void WorkerModuleTreeClient::NotifyModuleTreeLoadFinished( ModuleScript* module_script) { auto* execution_context =
diff --git a/third_party/blink/renderer/core/workers/worker_options.idl b/third_party/blink/renderer/core/workers/worker_options.idl index 2388200..e0af379 100644 --- a/third_party/blink/renderer/core/workers/worker_options.idl +++ b/third_party/blink/renderer/core/workers/worker_options.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/workers.html#workeroptions +// https://html.spec.whatwg.org/C/#workeroptions dictionary WorkerOptions { WorkerType type = "classic"; RequestCredentials credentials = "same-origin";
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc index caa207bf..055824a5 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc
@@ -127,21 +127,20 @@ if (inside_settings_resource_fetcher_) return inside_settings_resource_fetcher_; inside_settings_resource_fetcher_ = CreateFetcherInternal( - MakeGarbageCollected<FetchClientSettingsObjectImpl>(*this)); + *MakeGarbageCollected<FetchClientSettingsObjectImpl>(*this)); return inside_settings_resource_fetcher_; } ResourceFetcher* WorkerOrWorkletGlobalScope::CreateFetcherInternal( - FetchClientSettingsObject* fetch_client_settings_object) { + const FetchClientSettingsObject& fetch_client_settings_object) { DCHECK(IsContextThread()); - DCHECK(fetch_client_settings_object); InitializeWebFetchContextIfNeeded(); ResourceFetcherProperties* properties = nullptr; FetchContext* context = nullptr; ResourceFetcher::LoaderFactory* loader_factory = nullptr; if (web_worker_fetch_context_) { properties = MakeGarbageCollected<WorkerResourceFetcherProperties>( - *this, *fetch_client_settings_object, web_worker_fetch_context_); + *this, fetch_client_settings_object, web_worker_fetch_context_); context = MakeGarbageCollected<WorkerFetchContext>( *this, web_worker_fetch_context_, subresource_filter_); loader_factory = MakeGarbageCollected<LoaderFactoryForWorker>( @@ -168,7 +167,7 @@ } ResourceFetcher* WorkerOrWorkletGlobalScope::CreateOutsideSettingsFetcher( - FetchClientSettingsObject* fetch_client_settings_object) { + const FetchClientSettingsObject& fetch_client_settings_object) { DCHECK(IsContextThread()); return CreateFetcherInternal(fetch_client_settings_object); } @@ -236,10 +235,10 @@ // Implementation of the "fetch a module worker script graph" algorithm in the // HTML spec: -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-worker-script-tree +// https://html.spec.whatwg.org/C/#fetch-a-module-worker-script-tree void WorkerOrWorkletGlobalScope::FetchModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* fetch_client_settings_object, + const FetchClientSettingsObjectSnapshot& fetch_client_settings_object, mojom::RequestContextType destination, network::mojom::FetchCredentialsMode credentials_mode, ModuleScriptCustomFetchType custom_fetch_type,
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h index ae3878af..bf91bba 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h
@@ -107,7 +107,8 @@ // ResourceFetcher, and have dependencies to WorkerOrWorkletGlobalScope. Plumb // more data to the outside ResourceFetcher to fix the behavior and reduce the // dependencies. - ResourceFetcher* CreateOutsideSettingsFetcher(FetchClientSettingsObject*); + ResourceFetcher* CreateOutsideSettingsFetcher( + const FetchClientSettingsObject&); WorkerClients* Clients() const { return worker_clients_.Get(); } @@ -127,13 +128,12 @@ const Vector<CSPHeaderAndType>& headers); virtual void BindContentSecurityPolicyToExecutionContext(); - void FetchModuleScript( - const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* fetch_client_settings_object, - mojom::RequestContextType destination, - network::mojom::FetchCredentialsMode, - ModuleScriptCustomFetchType, - ModuleTreeClient*); + void FetchModuleScript(const KURL& module_url_record, + const FetchClientSettingsObjectSnapshot&, + mojom::RequestContextType destination, + network::mojom::FetchCredentialsMode, + ModuleScriptCustomFetchType, + ModuleTreeClient*); void TasksWerePaused() override; void TasksWereUnpaused() override; @@ -142,7 +142,7 @@ private: void InitializeWebFetchContextIfNeeded(); - ResourceFetcher* CreateFetcherInternal(FetchClientSettingsObject*); + ResourceFetcher* CreateFetcherInternal(const FetchClientSettingsObject&); bool web_fetch_context_initialized_ = false;
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc index a8be3ea..b7d47b3 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc
@@ -168,27 +168,27 @@ void WorkerThread::ImportClassicScript( const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, const v8_inspector::V8StackTraceId& stack_id) { DCHECK_CALLED_ON_VALID_THREAD(parent_thread_checker_); PostCrossThreadTask( *GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, CrossThreadBind(&WorkerThread::ImportClassicScriptOnWorkerThread, CrossThreadUnretained(this), script_url, - WTF::Passed(outside_settings_object->CopyData()), + WTF::Passed(outside_settings_object.CopyData()), stack_id)); } void WorkerThread::ImportModuleScript( const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode credentials_mode) { DCHECK_CALLED_ON_VALID_THREAD(parent_thread_checker_); PostCrossThreadTask( *GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, CrossThreadBind(&WorkerThread::ImportModuleScriptOnWorkerThread, CrossThreadUnretained(this), script_url, - WTF::Passed(outside_settings_object->CopyData()), + WTF::Passed(outside_settings_object.CopyData()), credentials_mode)); } @@ -524,7 +524,7 @@ To<WorkerGlobalScope>(GlobalScope()) ->ImportClassicScript( script_url, - MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + *MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( std::move(outside_settings_object)), stack_id); } @@ -540,7 +540,7 @@ To<WorkerGlobalScope>(GlobalScope()) ->ImportModuleScript( script_url, - MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + *MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( std::move(outside_settings_object)), credentials_mode); }
diff --git a/third_party/blink/renderer/core/workers/worker_thread.h b/third_party/blink/renderer/core/workers/worker_thread.h index 8b1a8f8..a6b68aa 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.h +++ b/third_party/blink/renderer/core/workers/worker_thread.h
@@ -116,14 +116,14 @@ // Called on the main thread after Start(). void ImportClassicScript( const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, const v8_inspector::V8StackTraceId& stack_id); // Posts a task to import a top-level module script on the worker thread. // Called on the main thread after Start(). void ImportModuleScript( const KURL& script_url, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode); // Posts a task to the worker thread to close the global scope and terminate
diff --git a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h index 05ecd5f..821ae55 100644 --- a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h +++ b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h
@@ -59,7 +59,7 @@ // WorkerGlobalScope void ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode) override { NOTREACHED(); }
diff --git a/third_party/blink/renderer/core/workers/worklet.cc b/third_party/blink/renderer/core/workers/worklet.cc index 9f6ba6a..c7552b2 100644 --- a/third_party/blink/renderer/core/workers/worklet.cc +++ b/third_party/blink/renderer/core/workers/worklet.cc
@@ -166,7 +166,7 @@ // TODO(nhiroki): Queue a task instead of executing this here. for (const auto& proxy : proxies_) { proxy->FetchAndInvokeScript(module_url_record, credentials_mode, - outside_settings_object, + *outside_settings_object, outside_settings_task_runner, pending_tasks); } }
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worklet_global_scope.cc index 0256de0..3e30703 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.cc
@@ -190,7 +190,7 @@ void WorkletGlobalScope::FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode credentials_mode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks* pending_tasks) { DCHECK(IsContextThread());
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.h b/third_party/blink/renderer/core/workers/worklet_global_scope.h index 62b75e95..02a4aaf9 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.h
@@ -74,7 +74,7 @@ const base::UnguessableToken& GetAgentClusterID() const final { // Currently, worklet agents have no clearly defined owner. See - // https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism + // https://html.spec.whatwg.org/C/#integration-with-the-javascript-agent-cluster-formalism // // However, it is intended that a SharedArrayBuffer can be shared with a // worklet, e.g. the AudioWorklet. If this WorkletGlobalScope's creation @@ -98,7 +98,7 @@ void FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks*);
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope_proxy.h b/third_party/blink/renderer/core/workers/worklet_global_scope_proxy.h index f9a9a35..1074464 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope_proxy.h +++ b/third_party/blink/renderer/core/workers/worklet_global_scope_proxy.h
@@ -28,7 +28,7 @@ virtual void FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks*) = 0;
diff --git a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc index 6ebfa142..b3b9ad2 100644 --- a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc +++ b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
@@ -766,7 +766,7 @@ script_start_position_(TextPosition::BelowRangePosition()), parsing_fragment_(true) { // Step 2 of - // https://html.spec.whatwg.org/multipage/xhtml.html#xml-fragment-parsing-algorithm + // https://html.spec.whatwg.org/C/#xml-fragment-parsing-algorithm // The following code collects prefix-namespace mapping in scope on // |parent_element|. HeapVector<Member<Element>> elem_stack; @@ -1463,7 +1463,7 @@ const xmlChar*, const xmlChar* external_id, const xmlChar*) { - // https://html.spec.whatwg.org/multipage/xhtml.html#parsing-xhtml-documents:named-character-references + // https://html.spec.whatwg.org/C/#parsing-xhtml-documents:named-character-references String ext_id = ToString(external_id); if (ext_id == "-//W3C//DTD XHTML 1.0 Transitional//EN" || ext_id == "-//W3C//DTD XHTML 1.1//EN" ||
diff --git a/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeElement.js b/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeElement.js index 4ead19d4..c304d00d 100644 --- a/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeElement.js +++ b/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeElement.js
@@ -1325,7 +1325,7 @@ // `indexOfSpace - 1` as a URL and repeat step 1). // 2b) Else, collect the preceding characters as a URL. // 3) Collect the characters from `indexOfSpace` up to the next comma as the size descriptor and repeat step 1). - // https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute + // https://html.spec.whatwg.org/C/#parse-a-srcset-attribute const fragment = createDocumentFragment(); let i = 0; while (value.length) {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_layout_object.cc b/third_party/blink/renderer/modules/accessibility/ax_layout_object.cc index 3bad59ac..50244182 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_layout_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_layout_object.cc
@@ -1508,7 +1508,7 @@ // time controls, by returning their value converted to text, with the // exception of checkboxes and radio buttons (which would return "on"), and // buttons which will return their name. - // https://html.spec.whatwg.org/multipage/forms.html#dom-input-value + // https://html.spec.whatwg.org/C/#dom-input-value if (const auto* input = ToHTMLInputElementOrNull(GetNode())) { if (input->type() != input_type_names::kButton && input->type() != input_type_names::kCheckbox && @@ -2199,7 +2199,7 @@ // The style engine relies on, for example, the "lang" attribute of the // current node and its ancestors, and the document's "content-language" // header. See the Language of a Node Spec at - // https://html.spec.whatwg.org/multipage/dom.html#language + // https://html.spec.whatwg.org/C/#language if (!GetLayoutObject()) return AXNodeObject::Language();
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index 0ff9e44c..f648104 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc
@@ -1626,7 +1626,7 @@ // time controls, by returning their value converted to text, with the // exception of checkboxes and radio buttons (which would return "on"), and // buttons which will return their name. - // https://html.spec.whatwg.org/multipage/forms.html#dom-input-value + // https://html.spec.whatwg.org/C/#dom-input-value if (const auto* input = ToHTMLInputElementOrNull(node)) { if (input->type() != input_type_names::kButton && input->type() != input_type_names::kCheckbox &&
diff --git a/third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.idl b/third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.idl index 2aeb115f..83ca9a2 100644 --- a/third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.idl +++ b/third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/comms.html#broadcastchannel +// https://html.spec.whatwg.org/C/#broadcastchannel [ Constructor(DOMString name),
diff --git a/third_party/blink/renderer/modules/canvas/README.md b/third_party/blink/renderer/modules/canvas/README.md index 64546adb..e791d15 100644 --- a/third_party/blink/renderer/modules/canvas/README.md +++ b/third_party/blink/renderer/modules/canvas/README.md
@@ -50,10 +50,10 @@ ### Final classes -`CanvasRenderingContext2D` - 2D context for HTML Canvas element. [[spec](https://html.spec.whatwg.org/multipage/scripting.html#2dcontext)] +`CanvasRenderingContext2D` - 2D context for HTML Canvas element. [[spec](https://html.spec.whatwg.org/C/#2dcontext)] `OffscreenCanvasRenderingContext2D` - 2D context for OffscreenCanvas. -[[spec](https://html.spec.whatwg.org/multipage/scripting.html#the-offscreen-2d-rendering-context)] +[[spec](https://html.spec.whatwg.org/C/#the-offscreen-2d-rendering-context)] `WebGLRenderingContext` - WebGL context for both HTML and Offscreen canvas. [[spec](https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14)] @@ -62,7 +62,7 @@ [[spec](https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7)] `ImageBitmapRenderingContext` - The rendering context provided by `ImageBitmap`. -[[spec](https://html.spec.whatwg.org/multipage/scripting.html#the-imagebitmap-rendering-context)] +[[spec](https://html.spec.whatwg.org/C/#the-imagebitmap-rendering-context)] `PaintRenderingContext2D` - Rendering context for CSS Painting. [[spec](https://www.w3.org/TR/css-paint-api-1/)]
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.idl b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.idl index 2a7f93f..29bfbaf 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.idl +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/scripting.html#canvaspath +// https://html.spec.whatwg.org/C/#canvaspath [ NoInterfaceObject // Always used on target of 'implements'
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc index 547cfe7..5af8b48 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
@@ -455,7 +455,7 @@ if (font_description.VariantCaps() == FontDescription::kSmallCaps) serialized_font.Append("small-caps "); - serialized_font.AppendNumber(font_description.ComputedPixelSize()); + serialized_font.AppendNumber(font_description.ComputedSize()); serialized_font.Append("px"); const FontFamily& first_font_family = font_description.Family();
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl index b8f1ecd..840302c2 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d +// https://html.spec.whatwg.org/C/#canvasrenderingcontext2d // The spec specifies: // typedef (HTMLImageElement or
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/hit_region_options.idl b/third_party/blink/renderer/modules/canvas/canvas2d/hit_region_options.idl index 6146304..46c738e1 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/hit_region_options.idl +++ b/third_party/blink/renderer/modules/canvas/canvas2d/hit_region_options.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Spec: https://html.spec.whatwg.org/multipage/scripting.html#hitregionoptions +// Spec: https://html.spec.whatwg.org/C/#hitregionoptions dictionary HitRegionOptions { Path2D? path = null;
diff --git a/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.idl b/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.idl index ef721dd4..f90843824 100644 --- a/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.idl +++ b/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/scripting.html#the-imagebitmap-rendering-context +// https://html.spec.whatwg.org/C/#the-imagebitmap-rendering-context interface ImageBitmapRenderingContext { // back-reference to the canvas
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module.idl b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module.idl index 496e228..3e312d5 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module.idl +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/scripting.html#the-offscreencanvas-interface +// https://html.spec.whatwg.org/C/#the-offscreencanvas-interface typedef (OffscreenCanvasRenderingContext2D or WebGLRenderingContext or
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module_support_webgl2_compute.idl b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module_support_webgl2_compute.idl index cc953b8..d4ed9dd5 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module_support_webgl2_compute.idl +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module_support_webgl2_compute.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/scripting.html#the-offscreencanvas-interface +// https://html.spec.whatwg.org/C/#the-offscreencanvas-interface typedef (OffscreenCanvasRenderingContext2D or WebGLRenderingContext or
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl index b53ed13..416eb4cb 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/scripting.html#the-offscreen-2d-rendering-context +// https://html.spec.whatwg.org/C/#the-offscreen-2d-rendering-context [ Exposed=(Window,Worker),
diff --git a/third_party/blink/renderer/modules/credentialmanager/password_credential.cc b/third_party/blink/renderer/modules/credentialmanager/password_credential.cc index a06539b..73e7695 100644 --- a/third_party/blink/renderer/modules/credentialmanager/password_credential.cc +++ b/third_party/blink/renderer/modules/credentialmanager/password_credential.cc
@@ -49,7 +49,7 @@ for (ListedElement* submittable_element : form->ListedElements()) { // The "form data set" contains an entry for a |submittable_element| only if // it has a non-empty `name` attribute. - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set + // https://html.spec.whatwg.org/C/#constructing-the-form-data-set DCHECK(!submittable_element->GetName().IsEmpty()); FileOrUSVString value;
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc index 523e734..90f1fc1 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc
@@ -58,7 +58,7 @@ void PaintWorkletGlobalScopeProxy::FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode credentials_mode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks* pending_tasks) { DCHECK(IsMainThread());
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.h b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.h index cbf5a8dd..13b5844 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.h +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.h
@@ -37,7 +37,7 @@ void FetchAndInvokeScript( const KURL& module_url_record, network::mojom::FetchCredentialsMode, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, scoped_refptr<base::SingleThreadTaskRunner> outside_settings_task_runner, WorkletPendingTasks*) override; void WorkletObjectDestroyed() override;
diff --git a/third_party/blink/renderer/modules/eventsource/event_source.idl b/third_party/blink/renderer/modules/eventsource/event_source.idl index 4058f9589..900568a 100644 --- a/third_party/blink/renderer/modules/eventsource/event_source.idl +++ b/third_party/blink/renderer/modules/eventsource/event_source.idl
@@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface +// https://html.spec.whatwg.org/C/#the-eventsource-interface [ ActiveScriptWrappable,
diff --git a/third_party/blink/renderer/modules/eventsource/event_source_init.idl b/third_party/blink/renderer/modules/eventsource/event_source_init.idl index f4594e8..88733e77 100644 --- a/third_party/blink/renderer/modules/eventsource/event_source_init.idl +++ b/third_party/blink/renderer/modules/eventsource/event_source_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface +// https://html.spec.whatwg.org/C/#the-eventsource-interface dictionary EventSourceInit { boolean withCredentials = false;
diff --git a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc index 0f71a86..6009398 100644 --- a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc +++ b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc
@@ -495,7 +495,7 @@ network::mojom::FetchCredentialsMode credentials_mode = network::mojom::FetchCredentialsMode::kOmit; worker_thread_->ImportModuleScript(worker_start_data_.script_url, - outside_settings_object, + *outside_settings_object, credentials_mode); } }
diff --git a/third_party/blink/renderer/modules/indexeddb/docs/idb_data_path.md b/third_party/blink/renderer/modules/indexeddb/docs/idb_data_path.md index b19a7f5b..9cf85889 100644 --- a/third_party/blink/renderer/modules/indexeddb/docs/idb_data_path.md +++ b/third_party/blink/renderer/modules/indexeddb/docs/idb_data_path.md
@@ -39,7 +39,7 @@ Storing a JavaScript value in IndexedDB is specified at a high level in the [HTML Structured Data -Specification](https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects). +Specification](https://html.spec.whatwg.org/C/#serializable-objects). Blink's implementation of the specification is responsible for converting between [V8](https://developers.google.com/v8/) values and the byte sequences in IndexedDB's backing store. The implementation is in `SerializedScriptValue`
diff --git a/third_party/blink/renderer/modules/indexeddb/docs/idb_overview.md b/third_party/blink/renderer/modules/indexeddb/docs/idb_overview.md index c03e93f..de5f035 100644 --- a/third_party/blink/renderer/modules/indexeddb/docs/idb_overview.md +++ b/third_party/blink/renderer/modules/indexeddb/docs/idb_overview.md
@@ -39,7 +39,7 @@ an IDB value array to an index entry. IDB *values* are [a fairly large subset of JavaScript's supported -types](https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects). +types](https://html.spec.whatwg.org/C/#serializable-objects). There are no object store-level constraints on value types, so the values in a store can be pretty heterogeneous. By contrast, SQL tables have schemas which heavily constrain the rows.
diff --git a/third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.idl b/third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.idl index e36c9b8..d36a5f4b 100644 --- a/third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.idl +++ b/third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.idl
@@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/multipage/webappapis.html#custom-handlers +// https://html.spec.whatwg.org/C/#custom-handlers [ ImplementedAs=NavigatorContentUtils
diff --git a/third_party/blink/renderer/modules/plugins/navigator_plugins.idl b/third_party/blink/renderer/modules/plugins/navigator_plugins.idl index 767905e..8f7653c1 100644 --- a/third_party/blink/renderer/modules/plugins/navigator_plugins.idl +++ b/third_party/blink/renderer/modules/plugins/navigator_plugins.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorplugins +// https://html.spec.whatwg.org/C/#navigatorplugins [ ImplementedAs=NavigatorPlugins ] partial interface Navigator {
diff --git a/third_party/blink/renderer/modules/plugins/plugin.idl b/third_party/blink/renderer/modules/plugins/plugin.idl index 2a8136c..2a1be74d 100644 --- a/third_party/blink/renderer/modules/plugins/plugin.idl +++ b/third_party/blink/renderer/modules/plugins/plugin.idl
@@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/multipage/webappapis.html#plugins-2 +// https://html.spec.whatwg.org/C/#plugins-2 [ ImplementedAs=DOMPlugin,
diff --git a/third_party/blink/renderer/modules/plugins/plugin_array.idl b/third_party/blink/renderer/modules/plugins/plugin_array.idl index f7d7a43..9e123be 100644 --- a/third_party/blink/renderer/modules/plugins/plugin_array.idl +++ b/third_party/blink/renderer/modules/plugins/plugin_array.idl
@@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -// https://html.spec.whatwg.org/multipage/webappapis.html#plugins-2 +// https://html.spec.whatwg.org/C/#plugins-2 [ ImplementedAs=DOMPluginArray,
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_container.cc b/third_party/blink/renderer/modules/service_worker/service_worker_container.cc index b22acfc..f60082e 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_container.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_container.cc
@@ -520,7 +520,7 @@ if (!HasFiredDomContentLoaded(*document)) { // Wait for DOMContentLoaded. This corresponds to the specification steps // for "Parsing HTML documents": "The end" at - // https://html.spec.whatwg.org/multipage/parsing.html#the-end: + // https://html.spec.whatwg.org/C/#the-end: // // 1. Fire an event named DOMContentLoaded at the Document object, with // its bubbles attribute initialized to true.
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc index 92b8532..bf9e17b 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -138,7 +138,7 @@ void ServiceWorkerGlobalScope::ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode credentials_mode) { Modulator* modulator = Modulator::From(ScriptController()->GetScriptState());
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h index c41b1fd..b399e8b 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
@@ -82,7 +82,7 @@ // Implements WorkerGlobalScope. void ImportModuleScript( const KURL& module_url_record, - FetchClientSettingsObjectSnapshot* outside_settings_object, + const FetchClientSettingsObjectSnapshot& outside_settings_object, network::mojom::FetchCredentialsMode) override; void Dispose() override;
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.cc b/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.cc index bc9029d..7824b25 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.cc
@@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h" #include "third_party/blink/renderer/platform/loader/fetch/cached_metadata.h" +#include "third_party/blink/renderer/platform/loader/fetch/resource.h" namespace blink { @@ -69,4 +70,16 @@ return false; } +void ServiceWorkerScriptCachedMetadataHandler::OnMemoryDump( + WebProcessMemoryDump* pmd, + const String& dump_prefix) const { + if (!cached_metadata_) + return; + const String dump_name = dump_prefix + "/service_worker"; + auto* dump = pmd->CreateMemoryAllocatorDump(dump_name); + dump->AddScalar("size", "bytes", cached_metadata_->SerializedData().size()); + pmd->AddSuballocation(dump->Guid(), + String(WTF::Partitions::kAllocatedObjectPoolName)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h b/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h index 2eb8432..b7d47cfc 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h
@@ -41,6 +41,8 @@ uint32_t data_type_id) const override; String Encoding() const override; bool IsServedFromCacheStorage() const override; + void OnMemoryDump(WebProcessMemoryDump* pmd, + const String& dump_prefix) const override; private: Member<WorkerGlobalScope> worker_global_scope_;
diff --git a/third_party/blink/renderer/modules/srcobject/html_media_element_src_object.idl b/third_party/blink/renderer/modules/srcobject/html_media_element_src_object.idl index 501bf86..0481d3b3 100644 --- a/third_party/blink/renderer/modules/srcobject/html_media_element_src_object.idl +++ b/third_party/blink/renderer/modules/srcobject/html_media_element_src_object.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-srcobject +// https://html.spec.whatwg.org/C/#dom-media-srcobject // TODO(guidou): Add support for MediaSource and Blob, as defined in the spec. typedef MediaStream MediaProvider;
diff --git a/third_party/blink/renderer/modules/storage/storage.idl b/third_party/blink/renderer/modules/storage/storage.idl index 3a5e7f45..385a8d9 100644 --- a/third_party/blink/renderer/modules/storage/storage.idl +++ b/third_party/blink/renderer/modules/storage/storage.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-interface +// https://html.spec.whatwg.org/C/#the-storage-interface [ImplementedAs=StorageArea] interface Storage {
diff --git a/third_party/blink/renderer/modules/storage/storage_event.idl b/third_party/blink/renderer/modules/storage/storage_event.idl index e6cc151..0414d23 100644 --- a/third_party/blink/renderer/modules/storage/storage_event.idl +++ b/third_party/blink/renderer/modules/storage/storage_event.idl
@@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/webstorage.html#the-storageevent-interface +// https://html.spec.whatwg.org/C/#the-storageevent-interface [ Exposed=Window,
diff --git a/third_party/blink/renderer/modules/storage/storage_event_init.idl b/third_party/blink/renderer/modules/storage/storage_event_init.idl index 72de646..05a6a770e 100644 --- a/third_party/blink/renderer/modules/storage/storage_event_init.idl +++ b/third_party/blink/renderer/modules/storage/storage_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/webstorage.html#the-storageevent-interface +// https://html.spec.whatwg.org/C/#the-storageevent-interface dictionary StorageEventInit : EventInit { DOMString? key;
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.cc index 4aeea414..b87af68c 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.cc
@@ -4,8 +4,13 @@ #include "third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h" +#include <algorithm> +#include <memory> + #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" #include "third_party/blink/renderer/bindings/modules/v8/webgl_any.h" +#include "third_party/blink/renderer/modules/webgl/webgl_program.h" +#include "third_party/blink/renderer/modules/webgl/webgl_uniform_location.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -37,6 +42,231 @@ ContextGL()->DispatchCompute(numGroupsX, numGroupsY, numGroupsZ); } +ScriptValue WebGL2ComputeRenderingContextBase::getProgramInterfaceParameter( + ScriptState* script_state, + WebGLProgram* program, + GLenum program_interface, + GLenum pname) { + if (!ValidateWebGLProgramOrShader("getProgramInterfaceParameter", program)) + return ScriptValue::CreateNull(script_state); + + switch (pname) { + case GL_ACTIVE_RESOURCES: + case GL_MAX_NAME_LENGTH: + case GL_MAX_NUM_ACTIVE_VARIABLES: { + GLint value = 0; + ContextGL()->GetProgramInterfaceiv( + ObjectOrZero(program), program_interface, pname, &value); + return WebGLAny(script_state, value); + } + default: + SynthesizeGLError(GL_INVALID_ENUM, "getProgramInterfaceParameter", + "invalid parameter name"); + return ScriptValue::CreateNull(script_state); + } +} + +GLuint WebGL2ComputeRenderingContextBase::getProgramResourceIndex( + WebGLProgram* program, + GLenum program_interface, + const String& name) { + if (!ValidateWebGLProgramOrShader("getProgramResourceIndex", program)) + return 0; + + return ContextGL()->GetProgramResourceIndex( + ObjectOrZero(program), program_interface, name.Utf8().data()); +} + +String WebGL2ComputeRenderingContextBase::getProgramResourceName( + WebGLProgram* program, + GLenum program_interface, + GLuint index) { + if (!ValidateWebGLProgramOrShader("getProgramResourceName", program)) + return String(); + + GLint max_name_length = -1; + ContextGL()->GetProgramInterfaceiv(ObjectOrZero(program), program_interface, + GL_MAX_NAME_LENGTH, &max_name_length); + if (max_name_length <= 0) { + SynthesizeGLError(GL_INVALID_VALUE, "getProgramResourceName", + "invalid program interface"); + return String(); + } + auto name = std::make_unique<GLchar[]>(max_name_length); + + GLsizei length = 0; + ContextGL()->GetProgramResourceName(ObjectOrZero(program), program_interface, + index, max_name_length, &length, + name.get()); + if (length <= 0) + return String(); + return String(name.get(), static_cast<uint32_t>(length)); +} + +base::Optional<Vector<ScriptValue>> +WebGL2ComputeRenderingContextBase::getProgramResource( + ScriptState* script_state, + WebGLProgram* program, + GLenum program_interface, + GLuint index, + const Vector<GLenum>& props) { + if (!ValidateWebGLProgramOrShader("getProgramResource", program)) + return base::nullopt; + + Vector<GLenum> auxiliary_props; + Vector<GLint> auxiliary_params; + Vector<GLenum> extended_props; + Vector<GLint> extended_params; + for (GLenum prop : props) { + switch (prop) { + // Handle props with fixed-length return values. + case GL_ARRAY_SIZE: + case GL_ARRAY_STRIDE: + case GL_ATOMIC_COUNTER_BUFFER_INDEX: + case GL_BLOCK_INDEX: + case GL_BUFFER_BINDING: + case GL_BUFFER_DATA_SIZE: + case GL_IS_ROW_MAJOR: + case GL_LOCATION: + case GL_MATRIX_STRIDE: + case GL_NAME_LENGTH: + case GL_NUM_ACTIVE_VARIABLES: + case GL_OFFSET: + case GL_REFERENCED_BY_COMPUTE_SHADER: + case GL_REFERENCED_BY_FRAGMENT_SHADER: + case GL_REFERENCED_BY_VERTEX_SHADER: + case GL_TOP_LEVEL_ARRAY_SIZE: + case GL_TOP_LEVEL_ARRAY_STRIDE: + case GL_TYPE: + extended_props.push_back(prop); + extended_params.push_back(0); + break; + + // Handle props with variable-length return values. For these props, their + // lengths will be queried first by constructing |auxiliary_props| as the + // following, and |extended_params| will be adequately sized for the whole + // result after that. + case GL_ACTIVE_VARIABLES: + auxiliary_props.push_back(GL_NUM_ACTIVE_VARIABLES); + auxiliary_params.push_back(-1); + extended_props.push_back(GL_ACTIVE_VARIABLES); + break; + + default: + SynthesizeGLError(GL_INVALID_ENUM, "getProgramResource", + "invalid program resource property"); + return base::nullopt; + } + } + extended_props.PrependVector(auxiliary_props); + extended_params.PrependVector(auxiliary_params); + + if (auxiliary_props.size()) { + ContextGL()->GetProgramResourceiv(ObjectOrZero(program), program_interface, + index, auxiliary_props.size(), + auxiliary_props.data(), + auxiliary_params.size(), nullptr, + auxiliary_params.data()); + for (GLint n : auxiliary_params) { + extended_params.resize(extended_params.size() + std::max(n, 0)); + } + } + + GLsizei length = 0; + ContextGL()->GetProgramResourceiv(ObjectOrZero(program), program_interface, + index, extended_props.size(), + extended_props.data(), + extended_params.size(), &length, + extended_params.data()); + if (length <= 0) { + return base::nullopt; + } + for (wtf_size_t i = 0; i < auxiliary_params.size(); ++i) { + // The returned lengths really should not differ from the previous ones. + CHECK_EQ(extended_params[i], auxiliary_params[i]); + } + + // Interpret the returned values and construct the result array. The type of + // each array element is the natural type for the requested property. + Vector<ScriptValue> result; + wtf_size_t auxiliary_param_index = 0; + wtf_size_t extended_param_index = auxiliary_params.size(); + for (GLenum prop : props) { + switch (prop) { + case GL_IS_ROW_MAJOR: + case GL_REFERENCED_BY_COMPUTE_SHADER: + case GL_REFERENCED_BY_FRAGMENT_SHADER: + case GL_REFERENCED_BY_VERTEX_SHADER: { + bool value = extended_params[extended_param_index]; + result.push_back(WebGLAny(script_state, value)); + ++extended_param_index; + break; + } + case GL_ARRAY_STRIDE: + case GL_ATOMIC_COUNTER_BUFFER_INDEX: + case GL_BLOCK_INDEX: + case GL_MATRIX_STRIDE: + case GL_OFFSET: { + int value = extended_params[extended_param_index]; + result.push_back(WebGLAny(script_state, value)); + ++extended_param_index; + break; + } + case GL_LOCATION: { + int value = extended_params[extended_param_index]; + result.push_back( + WrapLocation(script_state, value, program, program_interface)); + ++extended_param_index; + break; + } + case GL_ARRAY_SIZE: + case GL_BUFFER_BINDING: + case GL_BUFFER_DATA_SIZE: + case GL_NAME_LENGTH: + case GL_NUM_ACTIVE_VARIABLES: + case GL_TOP_LEVEL_ARRAY_SIZE: + case GL_TOP_LEVEL_ARRAY_STRIDE: { + unsigned value = extended_params[extended_param_index]; + result.push_back(WebGLAny(script_state, value)); + ++extended_param_index; + break; + } + case GL_TYPE: { + GLenum value = extended_params[extended_param_index]; + result.push_back(WebGLAny(script_state, value)); + ++extended_param_index; + break; + } + case GL_ACTIVE_VARIABLES: { + DOMUint32Array* value = DOMUint32Array::Create( + reinterpret_cast<unsigned*>(&extended_params[extended_param_index]), + auxiliary_params[auxiliary_param_index]); + result.push_back(WebGLAny(script_state, value)); + extended_param_index += auxiliary_params[auxiliary_param_index]; + ++auxiliary_param_index; + break; + } + default: + NOTREACHED(); + } + } + + return result; +} + +ScriptValue WebGL2ComputeRenderingContextBase::getProgramResourceLocation( + ScriptState* script_state, + WebGLProgram* program, + GLenum program_interface, + const String& name) { + if (!ValidateWebGLProgramOrShader("getProgramResourceLocation", program)) + return WrapLocation(script_state, -1, program, program_interface); + + GLint location = ContextGL()->GetProgramResourceLocation( + ObjectOrZero(program), program_interface, name.Utf8().data()); + return WrapLocation(script_state, location, program, program_interface); +} + void WebGL2ComputeRenderingContextBase::bindImageTexture(GLuint unit, WebGLTexture* texture, GLint level, @@ -107,4 +337,28 @@ WebGL2RenderingContextBase::Trace(visitor); } +ScriptValue WebGL2ComputeRenderingContextBase::WrapLocation( + ScriptState* script_state, + GLint location, + WebGLProgram* program, + GLenum program_interface) { + switch (program_interface) { + case GL_PROGRAM_INPUT: + case GL_PROGRAM_OUTPUT: { + return WebGLAny(script_state, location); + } + case GL_UNIFORM: { + if (location == -1) + return ScriptValue::CreateNull(script_state); + DCHECK_GE(location, 0); + WebGLUniformLocation* uniform_location = + WebGLUniformLocation::Create(program, location); + return ScriptValue(script_state, ToV8(uniform_location, script_state)); + } + default: { + return WebGLAny(script_state, location); + } + } +} + } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h index 39fe21eb..1429b743 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h
@@ -11,6 +11,7 @@ namespace blink { +class WebGLProgram; class WebGLTexture; class WebGL2ComputeRenderingContextBase : public WebGL2RenderingContextBase { @@ -20,6 +21,28 @@ /* Launch one or more compute work groups */ void dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ); + /* Program interface query */ + ScriptValue getProgramInterfaceParameter(ScriptState*, + WebGLProgram*, + GLenum program_interface, + GLenum pname); + GLuint getProgramResourceIndex(WebGLProgram*, + GLenum program_interface, + const String& name); + String getProgramResourceName(WebGLProgram*, + GLenum program_interface, + GLuint index); + base::Optional<Vector<ScriptValue>> getProgramResource( + ScriptState*, + WebGLProgram*, + GLenum program_interface, + GLuint index, + const Vector<GLenum>& props); + ScriptValue getProgramResourceLocation(ScriptState*, + WebGLProgram*, + GLenum program_interface, + const String& name); + /* Bind a level of a texture to an image unit */ void bindImageTexture(GLuint unit, WebGLTexture* texture, @@ -45,6 +68,11 @@ std::unique_ptr<WebGraphicsContext3DProvider>, bool using_gpu_compositing, const CanvasContextCreationAttributesCore& requested_attributes); + + ScriptValue WrapLocation(ScriptState*, + GLint location, + WebGLProgram* program, + GLenum program_interface); }; DEFINE_TYPE_CASTS(WebGL2ComputeRenderingContextBase,
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.idl b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.idl index 4d3e73a..48dfa39 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.idl +++ b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.idl
@@ -7,8 +7,34 @@ ] interface WebGL2ComputeRenderingContextBase { // TODO(jiajia.qin@intel.com): add more enums and apis const GLenum COMPUTE_SHADER = 0x91B9; + const GLenum UNIFORM = 0x92E1; + const GLenum UNIFORM_BLOCK = 0x92E2; + const GLenum PROGRAM_INPUT = 0x92E3; + const GLenum PROGRAM_OUTPUT = 0x92E4; const GLenum BUFFER_VARIABLE = 0x92E5; const GLenum SHADER_STORAGE_BLOCK = 0x92E6; + const GLenum TRANSFORM_FEEDBACK_VARYING = 0x92F4; + const GLenum ACTIVE_RESOURCES = 0x92F5; + const GLenum MAX_NAME_LENGTH = 0x92F6; + const GLenum MAX_NUM_ACTIVE_VARIABLES = 0x92F7; + const GLenum NAME_LENGTH = 0x92F9; + const GLenum TYPE = 0x92FA; + const GLenum ARRAY_SIZE = 0x92FB; + const GLenum OFFSET = 0x92FC; + const GLenum BLOCK_INDEX = 0x92FD; + const GLenum ARRAY_STRIDE = 0x92FE; + const GLenum MATRIX_STRIDE = 0x92FF; + const GLenum IS_ROW_MAJOR = 0x9300; + const GLenum BUFFER_BINDING = 0x9302; + const GLenum BUFFER_DATA_SIZE = 0x9303; + const GLenum NUM_ACTIVE_VARIABLES = 0x9304; + const GLenum ACTIVE_VARIABLES = 0x9305; + const GLenum REFERENCED_BY_VERTEX_SHADER = 0x9306; + const GLenum REFERENCED_BY_FRAGMENT_SHADER = 0x930A; + const GLenum REFERENCED_BY_COMPUTE_SHADER = 0x930B; + const GLenum TOP_LEVEL_ARRAY_SIZE = 0x930C; + const GLenum TOP_LEVEL_ARRAY_STRIDE = 0x930D; + const GLenum LOCATION = 0x930E; const GLenum VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001; const GLenum ELEMENT_ARRAY_BARRIER_BIT = 0x00000002; const GLenum UNIFORM_BARRIER_BIT = 0x00000004; @@ -65,6 +91,14 @@ const GLenum UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB; void dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ); + + /* Program interface query */ + [CallWith=ScriptState] any getProgramInterfaceParameter(WebGLProgram program, GLenum programInterface, GLenum pname); + GLuint getProgramResourceIndex(WebGLProgram program, GLenum programInterface, DOMString name); + DOMString? getProgramResourceName(WebGLProgram program, GLenum programInterface, GLuint index); + [CallWith=ScriptState] sequence<any>? getProgramResource(WebGLProgram program, GLenum programInterface, GLuint index, sequence<GLenum> props); + [CallWith=ScriptState] any getProgramResourceLocation(WebGLProgram program, GLenum programInterface, DOMString name); + void bindImageTexture(GLuint unit, WebGLTexture ? texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); void memoryBarrier(GLbitfield barriers); void memoryBarrierByRegion(GLbitfield barriers);
diff --git a/third_party/blink/renderer/modules/websockets/close_event.idl b/third_party/blink/renderer/modules/websockets/close_event.idl index a9d727d..438a0b6 100644 --- a/third_party/blink/renderer/modules/websockets/close_event.idl +++ b/third_party/blink/renderer/modules/websockets/close_event.idl
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces +// https://html.spec.whatwg.org/C/#the-closeevent-interfaces [ Constructor(DOMString type, optional CloseEventInit eventInitDict),
diff --git a/third_party/blink/renderer/modules/websockets/close_event_init.idl b/third_party/blink/renderer/modules/websockets/close_event_init.idl index ff5c9e8..47b2ba37 100644 --- a/third_party/blink/renderer/modules/websockets/close_event_init.idl +++ b/third_party/blink/renderer/modules/websockets/close_event_init.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces +// https://html.spec.whatwg.org/C/#the-closeevent-interfaces dictionary CloseEventInit : EventInit { boolean wasClean;
diff --git a/third_party/blink/renderer/modules/websockets/websocket.idl b/third_party/blink/renderer/modules/websockets/websocket.idl index d979eb17..3c46ef6 100644 --- a/third_party/blink/renderer/modules/websockets/websocket.idl +++ b/third_party/blink/renderer/modules/websockets/websocket.idl
@@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface +// https://html.spec.whatwg.org/C/#the-websocket-interface enum BinaryType { "blob", "arraybuffer" };
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 2476278..88f4740 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -481,6 +481,8 @@ "bindings/v8_throw_exception.h", "bindings/v8_value_cache.cc", "bindings/v8_value_cache.h", + "bindings/v8_value_or_script_wrappable_adapter.cc", + "bindings/v8_value_or_script_wrappable_adapter.h", "bindings/wrapper_type_info.cc", "bindings/wrapper_type_info.h", "content_decryption_module_result.h",
diff --git a/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc b/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc index 2a15f39..e01115c 100644 --- a/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc +++ b/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc
@@ -40,7 +40,7 @@ CompositorTransformOperations out_ops; ops.Operations().push_back(TranslateTransformOperation::Create( - Length(2, kFixed), Length(0, kFixed), TransformOperation::kTranslateX)); + Length::Fixed(2), Length::Fixed(0), TransformOperation::kTranslateX)); ops.Operations().push_back(RotateTransformOperation::Create( 0.1, 0.2, 0.3, 200000.4, TransformOperation::kRotate3D)); ops.Operations().push_back(ScaleTransformOperation::Create(
diff --git a/third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.cc b/third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.cc new file mode 100644 index 0000000..0d5dcb0d3 --- /dev/null +++ b/third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.cc
@@ -0,0 +1,25 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h" + +#include "third_party/blink/renderer/platform/bindings/to_v8.h" + +namespace blink { +namespace bindings { + +v8::Local<v8::Value> V8ValueOrScriptWrappableAdapter::V8Value( + ScriptState* creation_context) const { + // Only one of two must be set. + DCHECK(!v8_value_.IsEmpty() || script_wrappable_); + DCHECK(!(!v8_value_.IsEmpty() && script_wrappable_)); + + if (!v8_value_.IsEmpty()) + return v8_value_; + + return ToV8(script_wrappable_, creation_context); +} + +} // namespace bindings +} // namespace blink
diff --git a/third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h b/third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h new file mode 100644 index 0000000..b2d53160 --- /dev/null +++ b/third_party/blink/renderer/platform/bindings/v8_value_or_script_wrappable_adapter.h
@@ -0,0 +1,61 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_VALUE_OR_SCRIPT_WRAPPABLE_ADAPTER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_VALUE_OR_SCRIPT_WRAPPABLE_ADAPTER_H_ + +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/heap/persistent.h" +#include "v8/include/v8.h" + +namespace blink { + +class ScriptState; +class ScriptWrappable; + +namespace bindings { + +// V8ValueOrScriptWrappableAdapter is an adapter to make bindings functions take +// either of v8::Local<v8::Value> or ScriptWrappable*. +// +// This class is only designed to be used as function argument types in bindings +// layer. Please refrain from abuse for other purpose and/or outside bindings. +class PLATFORM_EXPORT V8ValueOrScriptWrappableAdapter { + STACK_ALLOCATED(); + + public: + // Supports implicit conversions from v8::Value and ScriptWrappable type + // family so that the call sites do not need to recognize this helper class. + V8ValueOrScriptWrappableAdapter(std::nullptr_t) {} + V8ValueOrScriptWrappableAdapter(v8::Local<v8::Value> v8_value) + : v8_value_(v8_value) { + DCHECK(!v8_value_.IsEmpty()); + } + V8ValueOrScriptWrappableAdapter(ScriptWrappable* script_wrappable) + : script_wrappable_(script_wrappable) {} + template <typename T> + V8ValueOrScriptWrappableAdapter(Persistent<T> script_wrappable) + : script_wrappable_(script_wrappable) { + static_assert(std::is_base_of<ScriptWrappable, T>::value, + "script_wrappable must be a ScriptWrappable"); + } + + // Returns the specified v8::Value or the V8 wrapper object of the specified + // ScriptWrappable. In the latter case, the wrapper may be created in + // |creation_context|. + v8::Local<v8::Value> V8Value(ScriptState* creation_context) const; + + // Returns true when none of v8::Value nor ScriptWrappable is specified. + bool IsEmpty() const { return v8_value_.IsEmpty() && !script_wrappable_; } + + private: + v8::Local<v8::Value> v8_value_; + Member<ScriptWrappable> script_wrappable_; +}; + +} // namespace bindings + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_VALUE_OR_SCRIPT_WRAPPABLE_ADAPTER_H_
diff --git a/third_party/blink/renderer/platform/fonts/LocaleInFonts.md b/third_party/blink/renderer/platform/fonts/LocaleInFonts.md index 3696adff..0f5747c 100644 --- a/third_party/blink/renderer/platform/fonts/LocaleInFonts.md +++ b/third_party/blink/renderer/platform/fonts/LocaleInFonts.md
@@ -31,10 +31,10 @@ for the style system to work without special casing, while `FontDescription::locale()` is a pointer to `LayoutLocale`. -[lang attribute]: https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes +[lang attribute]: https://html.spec.whatwg.org/C/#the-lang-and-xml:lang-attributes [BCP 47]: https://tools.ietf.org/html/bcp47 -[language of a node]: https://html.spec.whatwg.org/multipage/dom.html#language -[content-language]: https://html.spec.whatwg.org/multipage/semantics.html#pragma-set-default-language +[language of a node]: https://html.spec.whatwg.org/C/#language +[content-language]: https://html.spec.whatwg.org/C/#pragma-set-default-language ## Generic Family
diff --git a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc index e2eebf0..51edd9d 100644 --- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc +++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
@@ -114,11 +114,12 @@ } } - sk_sp<SkTypeface> sk_variation_font( - FontManagerForSubType(font_sub_type) - ->makeFromStream( - base_typeface_->openStream(nullptr)->duplicate(), - SkFontArguments().setAxes(axes.data(), axes.size()))); + int index; + std::unique_ptr<SkStreamAsset> stream(base_typeface_->openStream(&index)); + sk_sp<SkTypeface> sk_variation_font(FontManagerForSubType(font_sub_type) + ->makeFromStream(std::move(stream), + SkFontArguments().setCollectionIndex(index) + .setAxes(axes.data(), axes.size()))); if (sk_variation_font) { return_typeface = sk_variation_font;
diff --git a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc index 12a4511..d42cbd0 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
@@ -356,13 +356,14 @@ // tables on Mac. See the implementation of SkTypeface_Mac::onOpenStream. #if !defined(OS_MACOSX) int ttc_index = 0; - SkStreamAsset* typeface_stream = typeface->openStream(&ttc_index); - if (typeface_stream && typeface_stream->getMemoryBase()) { + std::unique_ptr<SkStreamAsset> tf_stream(typeface->openStream(&ttc_index)); + if (tf_stream && tf_stream->getMemoryBase()) { + const void* tf_memory = tf_stream->getMemoryBase(); + size_t tf_size = tf_stream->getLength(); std::unique_ptr<hb_blob_t, void (*)(hb_blob_t*)> face_blob( - hb_blob_create( - reinterpret_cast<const char*>(typeface_stream->getMemoryBase()), - SafeCast<unsigned int>(typeface_stream->getLength()), - HB_MEMORY_MODE_READONLY, typeface_stream, DeleteTypefaceStream), + hb_blob_create(reinterpret_cast<const char*>(tf_memory), + SafeCast<unsigned int>(tf_size), HB_MEMORY_MODE_READONLY, + tf_stream.release(), DeleteTypefaceStream), hb_blob_destroy); face = hb_face_create(face_blob.get(), ttc_index); }
diff --git a/third_party/blink/renderer/platform/geometry/length.cc b/third_party/blink/renderer/platform/geometry/length.cc index da185538..daa3501f 100644 --- a/third_party/blink/renderer/platform/geometry/length.cc +++ b/third_party/blink/renderer/platform/geometry/length.cc
@@ -140,14 +140,14 @@ if (result.pixels && result.percent) return Length(CalculationValue::Create(result, kValueRangeAll)); if (result.percent) - return Length(result.percent, kPercent); - return Length(result.pixels, kFixed); + return Length::Percent(result.percent); + return Length::Fixed(result.pixels); } Length Length::Zoom(double factor) const { switch (GetType()) { case kFixed: - return Length(GetFloatValue() * factor, kFixed); + return Length::Fixed(GetFloatValue() * factor); case kCalculated: { PixelsAndPercent result = GetPixelsAndPercent(); result.pixels *= factor;
diff --git a/third_party/blink/renderer/platform/geometry/length.h b/third_party/blink/renderer/platform/geometry/length.h index c8d5b02..56c9073 100644 --- a/third_party/blink/renderer/platform/geometry/length.h +++ b/third_party/blink/renderer/platform/geometry/length.h
@@ -132,6 +132,25 @@ return *this; } + template <typename NUMBER_TYPE> + static Length Fixed(NUMBER_TYPE number) { + return Length(number, kFixed); + } + static Length Fixed() { return Length(kFixed); } + static Length Auto() { return Length(kAuto); } + static Length FillAvailable() { return Length(kFillAvailable); } + static Length MinContent() { return Length(kMinContent); } + static Length MaxContent() { return Length(kMaxContent); } + static Length ExtendToZoom() { return Length(kExtendToZoom); } + static Length DeviceWidth() { return Length(kDeviceWidth); } + static Length DeviceHeight() { return Length(kDeviceHeight); } + static Length MaxSizeNone() { return Length(kMaxSizeNone); } + static Length FitContent() { return Length(kFitContent); } + template <typename NUMBER_TYPE> + static Length Percent(NUMBER_TYPE number) { + return Length(number, kPercent); + } + // FIXME: Make this private (if possible) or at least rename it // (http://crbug.com/432707). inline float Value() const { @@ -192,7 +211,7 @@ is_float_ = true; } - void SetValue(float value) { *this = Length(value, kFixed); } + void SetValue(float value) { *this = Length::Fixed(value); } bool IsMaxSizeNone() const { return GetType() == kMaxSizeNone; } @@ -244,6 +263,9 @@ bool IsPercentOrCalc() const { return GetType() == kPercent || GetType() == kCalculated; } + bool IsExtendToZoom() const { return GetType() == kExtendToZoom; } + bool IsDeviceWidth() const { return GetType() == kDeviceWidth; } + bool IsDeviceHeight() const { return GetType() == kDeviceHeight; } Length Blend(const Length& from, double progress, ValueRange range) const { DCHECK(IsSpecified());
diff --git a/third_party/blink/renderer/platform/geometry/length_box.h b/third_party/blink/renderer/platform/geometry/length_box.h index f8008943..b526a0aa 100644 --- a/third_party/blink/renderer/platform/geometry/length_box.h +++ b/third_party/blink/renderer/platform/geometry/length_box.h
@@ -37,19 +37,19 @@ LengthBox(LengthType t) : left_(t), right_(t), top_(t), bottom_(t) {} LengthBox(int v) - : left_(Length(v, kFixed)), - right_(Length(v, kFixed)), - top_(Length(v, kFixed)), - bottom_(Length(v, kFixed)) {} + : left_(Length::Fixed(v)), + right_(Length::Fixed(v)), + top_(Length::Fixed(v)), + bottom_(Length::Fixed(v)) {} LengthBox(const Length& t, const Length& r, const Length& b, const Length& l) : left_(l), right_(r), top_(t), bottom_(b) {} LengthBox(int t, int r, int b, int l) - : left_(Length(l, kFixed)), - right_(Length(r, kFixed)), - top_(Length(t, kFixed)), - bottom_(Length(b, kFixed)) {} + : left_(Length::Fixed(l)), + right_(Length::Fixed(r)), + top_(Length::Fixed(t)), + bottom_(Length::Fixed(b)) {} const Length& Left() const { return left_; } const Length& Right() const { return right_; }
diff --git a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h index 7155983e..8155a31 100644 --- a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h +++ b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h
@@ -135,7 +135,7 @@ // Per spec, sigma is exactly half the blur radius: // https://www.w3.org/TR/css-backgrounds-3/#shadow-blur - // https://html.spec.whatwg.org/multipage/canvas.html#when-shadows-are-drawn + // https://html.spec.whatwg.org/C/#when-shadows-are-drawn return radius * 0.5f; }
diff --git a/third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler.h b/third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler.h index 80a609d0..aa0e6a6 100644 --- a/third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler.h +++ b/third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler.h
@@ -17,6 +17,7 @@ class CachedMetadata; class ResourceResponse; +class WebProcessMemoryDump; // A callback for sending the serialized data of cached metadata back to the // platform. @@ -67,6 +68,10 @@ virtual bool IsServedFromCacheStorage() const = 0; + // Dump cache size kept in memory. + virtual void OnMemoryDump(WebProcessMemoryDump* pmd, + const String& dump_prefix) const = 0; + protected: CachedMetadataHandler() = default; };
diff --git a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h index d963ba3f..f6a5b74 100644 --- a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h +++ b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h
@@ -21,13 +21,13 @@ // This is a partial interface of the "settings object" concept defined in the // HTML spec: -// https://html.spec.whatwg.org/multipage/webappapis.html#settings-object +// https://html.spec.whatwg.org/C/#settings-object // // This is also a partial interface of the "fetch client settings object" used // in module script fetch. Other part of the "fetch client settings object" is // currently implemented by ResourceFetcher and FetchContext, and this class is // used together with them. -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-worker-script-tree +// https://html.spec.whatwg.org/C/#fetch-a-module-worker-script-tree class PLATFORM_EXPORT FetchClientSettingsObject : public GarbageCollectedFinalized<FetchClientSettingsObject> { public: @@ -35,23 +35,23 @@ // "A URL used by APIs called by scripts that use this environment settings // object to parse URLs." - // https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url + // https://html.spec.whatwg.org/C/#api-base-url virtual const KURL& BaseURL() const = 0; // "An origin used in security checks." - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin + // https://html.spec.whatwg.org/C/#concept-settings-object-origin virtual const SecurityOrigin* GetSecurityOrigin() const = 0; // "The default referrer policy for fetches performed using this environment // settings object as a request client." - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-referrer-policy + // https://html.spec.whatwg.org/C/#concept-settings-object-referrer-policy virtual network::mojom::ReferrerPolicy GetReferrerPolicy() const = 0; // "referrerURL" used in the "Determine request's Referrer" algorithm: // https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer virtual const String GetOutgoingReferrer() const = 0; - // https://html.spec.whatwg.org/multipage/webappapis.html#https-state + // https://html.spec.whatwg.org/C/#https-state virtual HttpsState GetHttpsState() const = 0; // Used for classic top-level scripts and importScripts().
diff --git a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h index 3989e7c2..3e900b8b 100644 --- a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h +++ b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h
@@ -58,8 +58,8 @@ // instance of this class can be passed to another thread without cross-thread // synchronization. Don't keep this object persistently, instead create a new // instance per each "fetch a module script graph" algorithm: -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-worker-script-tree +// https://html.spec.whatwg.org/C/#fetch-a-module-script-tree +// https://html.spec.whatwg.org/C/#fetch-a-module-worker-script-tree // // This class should be used only for main worker (worklet) script loading. For // other resources, FetchClientSettingsObjectImpl should be used. See the class
diff --git a/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc b/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc index 86ada5dc..fe542bb 100644 --- a/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc +++ b/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc
@@ -441,7 +441,8 @@ } NOINLINE void RawResourceClientStateChecker::SetSerializedCachedMetadata() { - SECURITY_CHECK(state_ == kResponseReceived); + SECURITY_CHECK(state_ == kResponseReceived || + state_ == kDataReceivedAsBytesConsumer); } NOINLINE void RawResourceClientStateChecker::ResponseBodyReceived() {
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource.cc b/third_party/blink/renderer/platform/loader/fetch/resource.cc index 3187e23..1f33f1bb 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource.cc
@@ -917,6 +917,10 @@ overhead_dump->AddScalar("size", "bytes", OverheadSize()); memory_dump->AddSuballocation( overhead_dump->Guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); + + const String cache_name = dump_name + "/code_cache"; + if (cache_handler_) + cache_handler_->OnMemoryDump(memory_dump, cache_name); } String Resource::GetMemoryDumpName() const {
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h b/third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h index 07983d1..c20c349 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h
@@ -65,7 +65,7 @@ }; // Was the request generated from a "parser-inserted" element? -// https://html.spec.whatwg.org/multipage/scripting.html#parser-inserted +// https://html.spec.whatwg.org/C/#parser-inserted enum ParserDisposition : uint8_t { kParserInserted, kNotParserInserted }; enum CacheAwareLoadingEnabled : uint8_t {
diff --git a/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc b/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc index d160b14..040273e 100644 --- a/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc +++ b/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc
@@ -64,6 +64,18 @@ return sender_->IsServedFromCacheStorage(); } +void ScriptCachedMetadataHandler::OnMemoryDump( + WebProcessMemoryDump* pmd, + const String& dump_prefix) const { + if (!cached_metadata_) + return; + const String dump_name = dump_prefix + "/script"; + auto* dump = pmd->CreateMemoryAllocatorDump(dump_name); + dump->AddScalar("size", "bytes", cached_metadata_->SerializedData().size()); + pmd->AddSuballocation(dump->Guid(), + String(WTF::Partitions::kAllocatedObjectPoolName)); +} + void ScriptCachedMetadataHandler::SendToPlatform() { if (cached_metadata_) { const Vector<uint8_t>& serialized_data = cached_metadata_->SerializedData();
diff --git a/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h b/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h index 5fd43aa..db1e8d8 100644 --- a/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h +++ b/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h
@@ -48,6 +48,9 @@ bool IsServedFromCacheStorage() const override; + void OnMemoryDump(WebProcessMemoryDump* pmd, + const String& dump_prefix) const override; + // Sets the serialized metadata retrieved from the platform's cache. void SetSerializedCachedMetadata(const uint8_t*, size_t);
diff --git a/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.cc b/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.cc index 7391ff2..f5aebce 100644 --- a/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.cc +++ b/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.cc
@@ -9,7 +9,7 @@ namespace blink { -// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script +// https://html.spec.whatwg.org/C/#fetch-a-classic-script FetchParameters ScriptFetchOptions::CreateFetchParameters( const KURL& url, const SecurityOrigin* security_origin, @@ -36,7 +36,7 @@ // Step 3. Set up the classic script request given request and options. [spec // text] // - // https://html.spec.whatwg.org/multipage/webappapis.html#set-up-the-classic-script-request + // https://html.spec.whatwg.org/C/#set-up-the-classic-script-request // Set request's cryptographic nonce metadata to options's cryptographic // nonce, [spec text] params.SetContentSecurityPolicyNonce(Nonce());
diff --git a/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h b/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h index f541334..eb620cc 100644 --- a/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h +++ b/third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h
@@ -21,10 +21,10 @@ class SecurityOrigin; // ScriptFetchOptions corresponds to the spec concept "script fetch options". -// https://html.spec.whatwg.org/multipage/webappapis.html#script-fetch-options +// https://html.spec.whatwg.org/C/#script-fetch-options class PLATFORM_EXPORT ScriptFetchOptions final { public: - // https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options + // https://html.spec.whatwg.org/C/#default-classic-script-fetch-options // "The default classic script fetch options are a script fetch options whose // cryptographic nonce is the empty string, integrity metadata is the empty // string, parser metadata is "not-parser-inserted", and credentials mode @@ -70,7 +70,7 @@ } mojom::FetchImportanceMode Importance() const { return importance_; } - // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script + // https://html.spec.whatwg.org/C/#fetch-a-classic-script // Steps 1 and 3. FetchParameters CreateFetchParameters(const KURL&, const SecurityOrigin*, @@ -79,20 +79,20 @@ FetchParameters::DeferOption) const; private: - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-fetch-options-nonce + // https://html.spec.whatwg.org/C/#concept-script-fetch-options-nonce const String nonce_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-fetch-options-integrity + // https://html.spec.whatwg.org/C/#concept-script-fetch-options-integrity const IntegrityMetadataSet integrity_metadata_; const String integrity_attribute_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-fetch-options-parser + // https://html.spec.whatwg.org/C/#concept-script-fetch-options-parser const ParserDisposition parser_state_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-fetch-options-credentials + // https://html.spec.whatwg.org/C/#concept-script-fetch-options-credentials const network::mojom::FetchCredentialsMode credentials_mode_; - // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-fetch-options-referrer-policy + // https://html.spec.whatwg.org/C/#concept-script-fetch-options-referrer-policy const network::mojom::ReferrerPolicy referrer_policy_; // Priority Hints and a request's "importance" mode are currently
diff --git a/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.cc b/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.cc index 2be718f..7f41711 100644 --- a/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.cc +++ b/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.cc
@@ -58,6 +58,12 @@ return parent_->IsServedFromCacheStorage(); } + // No memory to report here because it is attributed to |parent_|. + void OnMemoryDump(WebProcessMemoryDump* pmd, + const String& dump_prefix) const override { + // No memory to report here because it is attributed to |parent_|. + } + private: Member<SourceKeyedCachedMetadataHandler> parent_; Key key_; @@ -102,6 +108,23 @@ return String(encoding_.GetName()); } +void SourceKeyedCachedMetadataHandler::OnMemoryDump( + WebProcessMemoryDump* pmd, + const String& dump_prefix) const { + if (cached_metadata_map_.IsEmpty()) + return; + + const String dump_name = dump_prefix + "/inline"; + uint64_t value = 0; + for (const auto& metadata : cached_metadata_map_.Values()) { + value += metadata->SerializedData().size(); + } + auto* dump = pmd->CreateMemoryAllocatorDump(dump_name); + dump->AddScalar("size", "bytes", value); + pmd->AddSuballocation(dump->Guid(), + String(WTF::Partitions::kAllocatedObjectPoolName)); +} + // Encoding of keyed map: // - marker: CachedMetadataHandler::kSourceKeyedMap (uint32_t) // - num_entries (int)
diff --git a/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.h b/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.h index 44df319..f731b4e 100644 --- a/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.h +++ b/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.h
@@ -32,11 +32,14 @@ // the given source code. SingleCachedMetadataHandler* HandlerForSource(const String& source); - void ClearCachedMetadata(CachedMetadataHandler::CacheType) override; + void ClearCachedMetadata( + CachedMetadataHandler::CacheType cache_type) override; String Encoding() const override; bool IsServedFromCacheStorage() const override { return sender_->IsServedFromCacheStorage(); } + void OnMemoryDump(WebProcessMemoryDump* pmd, + const String& dump_prefix) const override; void SetSerializedCachedMetadata(const uint8_t*, size_t);
diff --git a/third_party/blink/renderer/platform/loader/testing/mock_resource.h b/third_party/blink/renderer/platform/loader/testing/mock_resource.h index c54228b5..c5e1974 100644 --- a/third_party/blink/renderer/platform/loader/testing/mock_resource.h +++ b/third_party/blink/renderer/platform/loader/testing/mock_resource.h
@@ -27,6 +27,8 @@ String Encoding() const override { return "mock encoding"; } bool IsServedFromCacheStorage() const override { return false; } + void OnMemoryDump(WebProcessMemoryDump* pmd, + const String& dump_prefix) const override {} private: std::unique_ptr<CachedMetadataSender> send_callback_;
diff --git a/third_party/blink/renderer/platform/mac/theme_mac.mm b/third_party/blink/renderer/platform/mac/theme_mac.mm index da06b3a..bb48e46 100644 --- a/third_party/blink/renderer/platform/mac/theme_mac.mm +++ b/third_party/blink/renderer/platform/mac/theme_mac.mm
@@ -82,9 +82,9 @@ control_size.Height() * zoom_factor); LengthSize result = zoomed_size; if (zoomed_size.Width().IsIntrinsicOrAuto() && control_size.Width() > 0) - result.SetWidth(Length(control_size.Width(), kFixed)); + result.SetWidth(Length::Fixed(control_size.Width())); if (zoomed_size.Height().IsIntrinsicOrAuto() && control_size.Height() > 0) - result.SetHeight(Length(control_size.Height(), kFixed)); + result.SetHeight(Length::Fixed(control_size.Height())); return result; } @@ -436,13 +436,13 @@ switch (part) { case kSquareButtonPart: case kButtonPart: - return LengthSize(Length(0, kFixed), - Length(static_cast<int>(15 * zoom_factor), kFixed)); + return LengthSize(Length::Fixed(0), + Length::Fixed(static_cast<int>(15 * zoom_factor))); case kInnerSpinButtonPart: { IntSize base = StepperSizes()[NSMiniControlSize]; return LengthSize( - Length(static_cast<int>(base.Width() * zoom_factor), kFixed), - Length(static_cast<int>(base.Height() * zoom_factor), kFixed)); + Length::Fixed(static_cast<int>(base.Width() * zoom_factor)), + Length::Fixed(static_cast<int>(base.Height() * zoom_factor))); } default: return Theme::MinimumControlSize(part, font_description, zoom_factor);
diff --git a/third_party/blink/renderer/platform/network/form_data_encoder.cc b/third_party/blink/renderer/platform/network/form_data_encoder.cc index c5cca2a..cf29b47 100644 --- a/third_party/blink/renderer/platform/network/form_data_encoder.cc +++ b/third_party/blink/renderer/platform/network/form_data_encoder.cc
@@ -180,7 +180,7 @@ // // See also: // - // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data + // https://html.spec.whatwg.org/C/#multipart-form-data // https://www.chromestatus.com/features/5634575908732928 // https://crbug.com/661819 // https://encoding.spec.whatwg.org/#concept-encoding-process
diff --git a/third_party/blink/renderer/platform/network/http_parsers.cc b/third_party/blink/renderer/platform/network/http_parsers.cc index 9847f06..b064ed9 100644 --- a/third_party/blink/renderer/platform/network/http_parsers.cc +++ b/third_party/blink/renderer/platform/network/http_parsers.cc
@@ -146,7 +146,7 @@ return net::HttpContentDisposition(string, std::string()).is_attachment(); } -// https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh +// https://html.spec.whatwg.org/C/#attr-meta-http-equiv-refresh bool ParseHTTPRefresh(const String& refresh, WTF::CharacterMatchFunctionPtr matcher, double& delay,
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index b926ebf..6e21c23 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1319,6 +1319,10 @@ name: "StreamsNative", }, { + name: "TextFragmentIdentifiers", + status: "experimental", + }, + { name: "TextUnderlinePositionLeftRight", status: "stable", }, @@ -1381,6 +1385,10 @@ name: "UserActivationV2", }, { + name: "UserAgentClientHint", + status: "experimental" + }, + { name: "V8IdleTasks", }, {
diff --git a/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md b/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md index c46763c..3003f5a2 100644 --- a/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md +++ b/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md
@@ -84,7 +84,7 @@ returns an appropriate task runner based on the TaskType. All tasks mentioned in the spec should have task source explicitly defined -(e.g. see [generic task sources definition](https://html.spec.whatwg.org/multipage/webappapis.html#generic-task-sources) +(e.g. see [generic task sources definition](https://html.spec.whatwg.org/C/#generic-task-sources) in the spec). There are still some places where the task source is not mentioned explicitly — reach out to domenic@ and garykac@ for advice.
diff --git a/third_party/blink/renderer/platform/text/character.h b/third_party/blink/renderer/platform/text/character.h index f7d27b4..ef8b1fad 100644 --- a/third_party/blink/renderer/platform/text/character.h +++ b/third_party/blink/renderer/platform/text/character.h
@@ -100,7 +100,7 @@ static bool IsUprightInMixedVertical(UChar32 character); - // https://html.spec.whatwg.org/multipage/scripting.html#prod-potentialcustomelementname + // https://html.spec.whatwg.org/C/#prod-potentialcustomelementname static bool IsPotentialCustomElementName8BitChar(LChar ch) { return IsASCIILower(ch) || IsASCIIDigit(ch) || ch == '-' || ch == '.' || ch == '_' || ch == 0xb7 || (0xc0 <= ch && ch != 0xd7 && ch != 0xf7);
diff --git a/third_party/blink/renderer/platform/text/character_property_data.h b/third_party/blink/renderer/platform/text/character_property_data.h index 7d2cf90..0b40eb8 100644 --- a/third_party/blink/renderer/platform/text/character_property_data.h +++ b/third_party/blink/renderer/platform/text/character_property_data.h
@@ -211,7 +211,7 @@ 0x100000, 0x10FFFD, }; -// https://html.spec.whatwg.org/multipage/scripting.html#prod-potentialcustomelementname +// https://html.spec.whatwg.org/C/#prod-potentialcustomelementname static const UChar32 kIsPotentialCustomElementNameCharArray[] = { '-', '.', '_', 0xB7, };
diff --git a/third_party/blink/renderer/platform/text/text_direction.h b/third_party/blink/renderer/platform/text/text_direction.h index 3385465..a3f71b8 100644 --- a/third_party/blink/renderer/platform/text/text_direction.h +++ b/third_party/blink/renderer/platform/text/text_direction.h
@@ -36,7 +36,7 @@ // // Used for explicit directions such as in the HTML dir attribute or the CSS // 'direction' property. -// https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute +// https://html.spec.whatwg.org/C/#the-dir-attribute // https://drafts.csswg.org/css-writing-modes/#direction // // Also used for resolved directions by UAX#9 UNICODE BIDIRECTIONAL ALGORITHM.
diff --git a/third_party/blink/renderer/platform/theme.h b/third_party/blink/renderer/platform/theme.h index 9b017dc..8f64d95 100644 --- a/third_party/blink/renderer/platform/theme.h +++ b/third_party/blink/renderer/platform/theme.h
@@ -112,7 +112,7 @@ virtual LengthSize MinimumControlSize(ControlPart, const FontDescription&, float /*zoomFactor*/) const { - return LengthSize(Length(0, kFixed), Length(0, kFixed)); + return LengthSize(Length::Fixed(0), Length::Fixed(0)); } // Allows the theme to modify the existing padding/border.
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc index 95c6800..45ac39a 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc +++ b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc
@@ -77,10 +77,10 @@ TransformOperations from_ops; TransformOperations to_ops; from_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(-30, blink::kFixed), Length(20, blink::kFixed), 15, + Length::Fixed(-30), Length::Fixed(20), 15, TransformOperation::kTranslate3D)); to_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(10, blink::kFixed), Length(10, blink::kFixed), 200, + Length::Fixed(10), Length::Fixed(10), 200, TransformOperation::kTranslate3D)); FloatBox box(0, 0, 0, 10, 10, 10); FloatBox bounds; @@ -124,13 +124,13 @@ TransformOperations from_ops; TransformOperations to_ops; from_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(test_transforms[i][0][0], blink::kFixed), - Length(test_transforms[i][0][1], blink::kFixed), - test_transforms[i][0][2], TransformOperation::kTranslate3D)); + Length::Fixed(test_transforms[i][0][0]), + Length::Fixed(test_transforms[i][0][1]), test_transforms[i][0][2], + TransformOperation::kTranslate3D)); to_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(test_transforms[i][1][0], blink::kFixed), - Length(test_transforms[i][1][1], blink::kFixed), - test_transforms[i][1][2], TransformOperation::kTranslate3D)); + Length::Fixed(test_transforms[i][1][0]), + Length::Fixed(test_transforms[i][1][1]), test_transforms[i][1][2], + TransformOperation::kTranslate3D)); EmpiricallyTestBounds(from_ops, to_ops, progress[j][0], progress[j][1]); } } @@ -187,13 +187,13 @@ TransformOperations from_ops; TransformOperations to_ops; from_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(test_transforms[i][0][0], blink::kFixed), - Length(test_transforms[i][0][1], blink::kFixed), - test_transforms[i][0][2], TransformOperation::kTranslate3D)); + Length::Fixed(test_transforms[i][0][0]), + Length::Fixed(test_transforms[i][0][1]), test_transforms[i][0][2], + TransformOperation::kTranslate3D)); to_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(test_transforms[i][1][0], blink::kFixed), - Length(test_transforms[i][1][1], blink::kFixed), - test_transforms[i][1][2], TransformOperation::kTranslate3D)); + Length::Fixed(test_transforms[i][1][0]), + Length::Fixed(test_transforms[i][1][1]), test_transforms[i][1][2], + TransformOperation::kTranslate3D)); EmpiricallyTestBounds(from_ops, to_ops, progress[j][0], progress[j][1]); } } @@ -475,21 +475,21 @@ TransformOperations to_ops; from_ops.Operations().push_back( - TranslateTransformOperation::Create(Length(1, kFixed), Length(-5, kFixed), + TranslateTransformOperation::Create(Length::Fixed(1), Length::Fixed(-5), 1, TransformOperation::kTranslate3D)); from_ops.Operations().push_back( ScaleTransformOperation::Create(-1, 2, 3, TransformOperation::kScale3D)); from_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(2, kFixed), Length(4, kFixed), -1, + Length::Fixed(2), Length::Fixed(4), -1, TransformOperation::kTranslate3D)); - to_ops.Operations().push_back(TranslateTransformOperation::Create( - Length(13, kFixed), Length(-1, kFixed), 5, - TransformOperation::kTranslate3D)); + to_ops.Operations().push_back( + TranslateTransformOperation::Create(Length::Fixed(13), Length::Fixed(-1), + 5, TransformOperation::kTranslate3D)); to_ops.Operations().push_back( ScaleTransformOperation::Create(-3, -2, 5, TransformOperation::kScale3D)); to_ops.Operations().push_back( - TranslateTransformOperation::Create(Length(6, kFixed), Length(-2, kFixed), + TranslateTransformOperation::Create(Length::Fixed(6), Length::Fixed(-2), 3, TransformOperation::kTranslate3D)); FloatBox box(1, 2, 3, 4, 4, 4); @@ -520,9 +520,8 @@ FloatPoint3D original_point(2, 3, 4); TransformOperations ops; - ops.Operations().push_back( - TranslateTransformOperation::Create(Length(1, kFixed), Length(2, kFixed), - 3, TransformOperation::kTranslate3D)); + ops.Operations().push_back(TranslateTransformOperation::Create( + Length::Fixed(1), Length::Fixed(2), 3, TransformOperation::kTranslate3D)); ops.Operations().push_back(PerspectiveTransformOperation::Create(1234)); ops.Operations().push_back( Matrix3DTransformOperation::Create(TransformationMatrix(
diff --git a/third_party/blink/renderer/platform/transforms/translate_transform_operation.cc b/third_party/blink/renderer/platform/transforms/translate_transform_operation.cc index aaf95cd..e7280ef 100644 --- a/third_party/blink/renderer/platform/transforms/translate_transform_operation.cc +++ b/third_party/blink/renderer/platform/transforms/translate_transform_operation.cc
@@ -32,7 +32,7 @@ if (from && !from->CanBlendWith(*this)) return this; - const Length zero_length(0, kFixed); + const Length zero_length = Length::Fixed(0); if (blend_to_identity) { return TranslateTransformOperation::Create( zero_length.Blend(x_, progress, kValueRangeAll),
diff --git a/third_party/blink/renderer/platform/weborigin/security_origin.cc b/third_party/blink/renderer/platform/weborigin/security_origin.cc index 49a24418..d629c18ca 100644 --- a/third_party/blink/renderer/platform/weborigin/security_origin.cc +++ b/third_party/blink/renderer/platform/weborigin/security_origin.cc
@@ -320,7 +320,7 @@ } // document.domain handling, as per - // https://html.spec.whatwg.org/multipage/browsers.html#dom-document-domain: + // https://html.spec.whatwg.org/C/#dom-document-domain: // // 1) Neither document has set document.domain. In this case, we insist // that the scheme, host, and port of the URLs match.
diff --git a/third_party/blink/renderer/platform/weborigin/security_origin.h b/third_party/blink/renderer/platform/weborigin/security_origin.h index 648e2c4..94b20058 100644 --- a/third_party/blink/renderer/platform/weborigin/security_origin.h +++ b/third_party/blink/renderer/platform/weborigin/security_origin.h
@@ -55,7 +55,7 @@ // tuple, such as the tuple origin (https, chromium.org, null, null). However, // there are also opaque origins which do not have a corresponding tuple. // -// See also: https://html.spec.whatwg.org/multipage/origin.html#concept-origin +// See also: https://html.spec.whatwg.org/C/#concept-origin class PLATFORM_EXPORT SecurityOrigin : public RefCounted<SecurityOrigin> { WTF_MAKE_NONCOPYABLE(SecurityOrigin);
diff --git a/third_party/blink/renderer/platform/wtf/text/string_to_number.h b/third_party/blink/renderer/platform/wtf/text/string_to_number.h index a80984d5..ae9fded 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_to_number.h +++ b/third_party/blink/renderer/platform/wtf/text/string_to_number.h
@@ -16,7 +16,7 @@ kError, // For UInt functions, kOverflowMin never happens. Negative numbers are // treated as kError. This behavior matches to the HTML standard. - // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-non-negative-integers + // https://html.spec.whatwg.org/C/#rules-for-parsing-non-negative-integers kOverflowMin, kOverflowMax, };
diff --git a/third_party/blink/web_tests/MSANExpectations b/third_party/blink/web_tests/MSANExpectations index 8752f2b6..6f816506 100644 --- a/third_party/blink/web_tests/MSANExpectations +++ b/third_party/blink/web_tests/MSANExpectations
@@ -218,3 +218,8 @@ # Sheriff 2019-01-28 crbug.com/925600 [ Linux ] external/wpt/webrtc-quic/RTCQuicStream.https.html [ Pass Timeout ] + +# Sheriff 2019-02-13 +crbug.com/931660 [ Linux ] external/wpt/payment-handler/idlharness.https.any.sharedworker.html [ Pass Timeout ] +crbug.com/931660 [ Linux ] external/wpt/trusted-types/idlharness.window.html [ Pass Timeout ] +crbug.com/931660 [ Linux ] fast/history/replacestate-nocrash.html [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 1e11a5f3..1a7cce9 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -6106,3 +6106,6 @@ crbug.com/930934 [ Android ] paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html [ Failure ] crbug.com/930934 [ Android ] paint/selection/selection-drag-image-in-iframe.html [ Failure ] crbug.com/930934 [ Android ] virtual/gpu-rasterization/images/drag-image-descendant-painting-sibling.html [ Failure ] + +# Sheriff 2019-02-13 +crbug.com/931646 [ Win7 ] http/tests/preload/meta-viewport-link-headers-imagesrcset.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/embed.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/embed.tentative.https.sub.html index 1c69c02..6f0c439 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/embed.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/embed.tentative.https.sub.html
@@ -13,7 +13,7 @@ let e = document.createElement('embed'); e.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"embed", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"embed", "site":"same-origin", "user":"?F", "mode":"no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -32,7 +32,7 @@ let e = document.createElement('embed'); e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"embed", "site":"same-site", "user":"?F"}; + let expected = {"dest":"embed", "site":"same-site", "user":"?F", "mode":"no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -51,7 +51,7 @@ let e = document.createElement('embed'); e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"embed", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"embed", "site":"cross-site", "user":"?F", "mode":"no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected))
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/fetch.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/fetch.tentative.https.sub.html index f6460b4..dc4b977 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/fetch.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/fetch.tentative.https.sub.html
@@ -3,6 +3,7 @@ <script src=/resources/testharnessreport.js></script> <script src=/fetch/sec-metadata/resources/helper.js></script> <script> + // Site promise_test(t => { return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py") .then(r => r.json()) @@ -10,7 +11,8 @@ assert_header_equals(j, { "dest": "empty", "site": "same-origin", - "user":"?F" + "user": "?F", + "mode": "cors", }); }); }, "Same-origin fetch"); @@ -22,7 +24,8 @@ assert_header_equals(j, { "dest": "empty", "site": "same-site", - "user":"?F" + "user": "?F", + "mode": "cors", }); }); }, "Same-site fetch"); @@ -34,8 +37,49 @@ assert_header_equals(j, { "dest": "empty", "site": "cross-site", - "user":"?F" + "user": "?F", + "mode": "cors", }); }); }, "Cross-site fetch"); + + // Mode + promise_test(t => { + return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py", {mode: "same-origin"}) + .then(r => r.json()) + .then(j => { + assert_header_equals(j, { + "dest": "empty", + "site": "same-origin", + "user": "?F", + "mode": "same-origin", + }); + }); + }, "Same-origin mode"); + + promise_test(t => { + return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py", {mode: "cors"}) + .then(r => r.json()) + .then(j => { + assert_header_equals(j, { + "dest": "empty", + "site": "same-origin", + "user": "?F", + "mode": "cors", + }); + }); + }, "CORS mode"); + + promise_test(t => { + return fetch("https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-json.py", {mode: "no-cors"}) + .then(r => r.json()) + .then(j => { + assert_header_equals(j, { + "dest": "empty", + "site": "same-origin", + "user": "?F", + "mode": "no-cors", + }); + }); + }, "no-CORS mode"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/font.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/font.tentative.https.sub.html index d2bcf6928..9792f2dc 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/font.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/font.tentative.https.sub.html
@@ -46,7 +46,7 @@ promise_test(t => { return new Promise((resolve, reject) => { let key = "font-same-origin"; - let expected = {"dest":"font", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"font", "site":"same-origin", "user":"?F", "mode": "cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -58,7 +58,7 @@ promise_test(t => { return new Promise((resolve, reject) => { let key = "font-same-site"; - let expected = {"dest":"font", "site":"same-site", "user":"?F"}; + let expected = {"dest":"font", "site":"same-site", "user":"?F", "mode": "cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -70,7 +70,7 @@ promise_test(t => { return new Promise((resolve, reject) => { let key = "font-cross-site"; - let expected = {"dest":"font", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"font", "site":"cross-site", "user":"?F", "mode": "cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected))
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.https.sub.html index 6ee1430..73bd9074 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.https.sub.html
@@ -14,7 +14,8 @@ assert_header_equals(e.data, { "dest": "nested-document", "site": "same-origin", - "user":"?F" + "user": "?F", + "mode": "navigate" }); t.done(); })); @@ -32,7 +33,8 @@ assert_header_equals(e.data, { "dest": "nested-document", "site": "same-site", - "user": "?F" + "user": "?F", + "mode": "navigate" }); t.done(); })); @@ -50,7 +52,8 @@ assert_header_equals(e.data, { "dest": "nested-document", "site": "cross-site", - "user": "?F" + "user": "?F", + "mode": "navigate" }); t.done(); }));
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.sub.html index ce31a81..eab2d3f 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/iframe.tentative.sub.html
@@ -14,7 +14,8 @@ assert_header_equals(e.data, { "dest": "", "site": "", - "user": "" + "user": "", + "mode": "", }); t.done(); })); @@ -32,7 +33,8 @@ assert_header_equals(e.data, { "dest": "", "site": "", - "user": "" + "user": "", + "mode": "", }); t.done(); })); @@ -50,7 +52,8 @@ assert_header_equals(e.data, { "dest": "", "site": "", - "user": "" + "user": "", + "mode": "", }); t.done(); }));
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/img.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/img.tentative.https.sub.html index c5c3895..252b220 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/img.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/img.tentative.https.sub.html
@@ -21,7 +21,8 @@ assert_header_equals(got, { "dest": "image", "site": "same-origin", - "user": "?F" + "user": "?F", + "mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin` }); }), [], @@ -42,7 +43,8 @@ assert_header_equals(got, { "dest": "image", "site": "same-site", - "user": "?F" + "user": "?F", + "mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin` }); }), [], @@ -63,7 +65,8 @@ assert_header_equals(got, { "dest": "image", "site": "cross-site", - "user": "?F" + "user": "?F", + "mode": "cors", // Because `loadImageInWindow` tacks on `crossorigin` }); }), [],
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/object.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/object.tentative.https.sub.html index 0b98394..2a0e8de 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/object.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/object.tentative.https.sub.html
@@ -13,7 +13,7 @@ let e = document.createElement('object'); e.data = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"object", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"object", "site":"same-origin", "user":"?F", "mode":"no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -32,7 +32,7 @@ let e = document.createElement('object'); e.data = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"object", "site":"same-site", "user":"?F"}; + let expected = {"dest":"object", "site":"same-site", "user":"?F", "mode":"no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -51,7 +51,7 @@ let e = document.createElement('object'); e.data = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"object", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"object", "site":"cross-site", "user":"?F", "mode":"no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected))
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html index 56d88d9..f88cf14 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/cross-site-redirect.tentative.https.sub.html
@@ -12,7 +12,7 @@ let e = document.createElement('img'); e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"image", "site":"cross-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) @@ -38,7 +38,7 @@ let e = document.createElement('img'); e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"image", "site":"cross-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) @@ -64,7 +64,7 @@ let e = document.createElement('img'); e.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"image", "site":"cross-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text())
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html index f6d18f56..688c697 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-cross-site.tentative.https.sub.html
@@ -14,7 +14,7 @@ e.src = "https://{{host}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// same-origin "https://{{hosts[alt][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// cross-site "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key;// same-origin - let expected = {"dest":"image", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"image", "site":"cross-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html index 4756a79..bc79f78 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/multiple-redirect-same-site.tentative.https.sub.html
@@ -14,7 +14,7 @@ e.src = "https://{{host}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// same-origin "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=" +// same-site "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key;// same-origin - let expected = {"dest":"image", "site":"same-site", "user":"?F"}; + let expected = {"dest":"image", "site":"same-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html index 8558d6890..a532392 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-origin-redirect.tentative.https.sub.html
@@ -12,7 +12,7 @@ let e = document.createElement('img'); e.src = "/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"image", "site":"same-origin", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) @@ -39,7 +39,7 @@ let e = document.createElement('img'); e.src = "/xhr/resources/redirect.py?location=https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"same-site", "user":"?F"}; + let expected = {"dest":"image", "site":"same-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) @@ -66,7 +66,7 @@ let e = document.createElement('img'); e.src = "/xhr/resources/redirect.py?location=https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"image", "site":"cross-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html index 8e05b25..92749ae 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/redirect/same-site-redirect.tentative.https.sub.html
@@ -12,7 +12,7 @@ let e = document.createElement('img'); e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"same-site", "user":"?F"}; + let expected = {"dest":"image", "site":"same-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) @@ -39,7 +39,7 @@ let e = document.createElement('img'); e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"same-site", "user":"?F"}; + let expected = {"dest":"image", "site":"same-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) @@ -66,7 +66,7 @@ let e = document.createElement('img'); e.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/xhr/resources/redirect.py?location=https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; - let expected = {"dest":"image", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"image", "site":"cross-site", "user":"?F", "mode": "no-cors"}; e.onload = e => { fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/report.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/report.tentative.https.sub.html index 1cfa864..f1d8e06 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/report.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/report.tentative.https.sub.html
@@ -22,9 +22,9 @@ document.addEventListener("securitypolicyviolation", (e) => { counter++; if (counter == 3) { - generate_test({"dest":"report", "site":"same-origin", "user":"?F"}, "same-origin"); - generate_test({"dest":"report", "site":"same-site", "user":"?F"}, "same-site"); - generate_test({"dest":"report", "site":"cross-site", "user":"?F"}, "cross-site"); + generate_test({"dest":"report", "site":"same-origin", "user":"?F", "mode": "no-cors"}, "same-origin"); + generate_test({"dest":"report", "site":"same-site", "user":"?F", "mode": "no-cors"}, "same-site"); + generate_test({"dest":"report", "site":"cross-site", "user":"?F", "mode": "no-cors"}, "cross-site"); } }); }, "Initialization.");
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/resources/helper.js b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/resources/helper.js index 1a9ec154..4bee6899 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/resources/helper.js +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/resources/helper.js
@@ -4,8 +4,7 @@ value = JSON.parse(value); } assert_equals(value.dest, expected.dest, "dest"); - // Mode is commented out as no test cases have been filled out yet - // assert_equals(value.mode, expected.mode, "mode"); + assert_equals(value.mode, expected.mode, "mode"); assert_equals(value.site, expected.site, "site"); assert_equals(value.user, expected.user, "user"); }
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.https.sub.html index d76378f..a35e753 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.https.sub.html
@@ -12,7 +12,8 @@ assert_header_equals(header, { "dest": "script", "site": "same-origin", - "user":"?F" + "user": "?F", + "mode": "no-cors", }); }, "Same-origin script"); </script> @@ -26,7 +27,8 @@ assert_header_equals(header, { "dest": "script", "site": "same-site", - "user":"?F" + "user": "?F", + "mode": "no-cors", }); }, "Same-site script"); </script> @@ -40,7 +42,23 @@ assert_header_equals(header, { "dest": "script", "site": "cross-site", - "user":"?F" + "user": "?F", + "mode": "no-cors", }); }, "Cross-site script"); </script> + +<!-- Same-origin script, CORS mode --> +<script src="https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/echo-as-script.py" crossorigin="anonymous"></script> +<script> + test(t => { + t.add_cleanup(_ => { header = null; }); + + assert_header_equals(header, { + "dest": "script", + "site": "same-origin", + "user": "?F", + "mode": "cors", + }); + }, "Same-origin CORS script"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.sub.html index 482f4b9..3218a40 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/script.tentative.sub.html
@@ -12,7 +12,8 @@ assert_header_equals(header, { "dest": "", "site": "", - "user": "" + "user": "", + "mode": "", }); }, "Non-secure same-origin script => No headers"); </script> @@ -26,7 +27,8 @@ assert_header_equals(header, { "dest": "", "site": "", - "user": "" + "user": "", + "mode": "", }); }, "Non-secure same-site script => No headers"); </script> @@ -40,7 +42,8 @@ assert_header_equals(header, { "dest": "", "site": "", - "user": "" + "user": "", + "mode": "", }); }, "Non-secure cross-site script => No headers"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/serviceworker.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/serviceworker.tentative.https.sub.html index d0b86d2d..5b7ee77 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/serviceworker.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/serviceworker.tentative.https.sub.html
@@ -35,7 +35,7 @@ promise_test(t => { return new Promise((resolve, reject) => { let key = "serviceworker-same-origin"; - let expected = {"dest":"serviceworker", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"serviceworker", "site":"same-origin", "user":"?F", "mode": "same-origin"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected))
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/sharedworker.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/sharedworker.tentative.https.sub.html index 66f7d5b9..cfeadd8d 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/sharedworker.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/sharedworker.tentative.https.sub.html
@@ -26,7 +26,7 @@ promise_test(t => { return new Promise((resolve, reject) => { let key = "sharedworker-same-origin"; - let expected = {"dest":"sharedworker", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"sharedworker", "site":"same-origin", "user":"?F", "mode": "same-origin"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text())
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/style.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/style.tentative.https.sub.html index 9697db7..4ae1266 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/style.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/style.tentative.https.sub.html
@@ -14,7 +14,7 @@ e.rel = "stylesheet"; e.href = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"style", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"style", "site":"same-origin", "user":"?F", "mode": "no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -34,7 +34,7 @@ e.rel = "stylesheet"; e.href = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"style", "site":"same-site", "user":"?F"}; + let expected = {"dest":"style", "site":"same-site", "user":"?F", "mode": "no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -54,7 +54,7 @@ e.rel = "stylesheet"; e.href = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; e.onload = e => { - let expected = {"dest":"style", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"style", "site":"cross-site", "user":"?F", "mode": "no-cors"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -65,6 +65,27 @@ document.body.appendChild(e); }) }, "Cross-Site style"); + + promise_test(t => { + return new Promise((resolve, reject) => { + let key = "style-same-origin"; + + let e = document.createElement('link'); + e.rel = "stylesheet"; + e.href = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=" + key; + e.crossOrigin = "anonymous"; + e.onload = e => { + let expected = {"dest":"style", "site":"same-origin", "user":"?F", "mode": "cors"}; + fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) + .then(response => response.text()) + .then(text => assert_header_equals(text, expected)) + .then(_ => resolve()) + .catch(e => reject(e)); + }; + + document.body.appendChild(e); + }) + }, "Same-Origin, cors style"); </script> </html>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/track.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/track.tentative.https.sub.html index b9dfabf..89933f2 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/track.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/track.tentative.https.sub.html
@@ -29,7 +29,12 @@ let el = createTrack(); el.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-same-origin"; el.onload = t.step_func(_ => { - expected = {"dest":"track", "site":"same-origin", "user":"?F"}; + expected = { + "dest": "track", + "site": "same-origin", + "user": "?F", + "mode": "cors" // Because the `video` element has `crossorigin` + }; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-same-origin") .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -46,7 +51,12 @@ let el = createTrack(); el.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-same-site"; el.onload = t.step_func(_ => { - expected = {"dest":"track", "site":"same-site", "user":"?F"}; + expected = { + "dest": "track", + "site": "same-site", + "user": "?F", + "mode": "cors" // Because the `video` element has `crossorigin` + }; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-same-site") .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -65,7 +75,12 @@ let el = createTrack(); el.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-cross-site"; el.onload = t.step_func(_ => { - expected = {"dest":"track", "site":"cross-site", "user":"?F"}; + expected = { + "dest": "track", + "site": "cross-site", + "user": "?F", + "mode": "cors" // Because the `video` element has `crossorigin` + }; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-cross-site") .then(response => response.text()) .then(text => assert_header_equals(text, expected)) @@ -76,4 +91,30 @@ document.body.appendChild(video); }); }, "Cross-Site track"); + + promise_test(t => { + return new Promise((resolve, reject) => { + let video = createVideoElement(); + + // Unset `crossorigin` to change the CORS mode: + video.crossOrigin = undefined; + + let el = createTrack(); + el.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/record-header.py?file=track-same-origin"; + el.onload = t.step_func(_ => { + expected = { + "dest":"track", + "site":"same-origin", + "user":"?F", + "mode": "same-origin" + }; + fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=track-same-origin") + .then(response => response.text()) + .then(text => assert_header_equals(text, expected)) + .then(_ => resolve()); + }); + video.appendChild(el); + document.body.appendChild(video); + }); + }, "Same-Origin, CORS track"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/window-open.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/window-open.tentative.https.sub.html index 236268e..2957dad4 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/window-open.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/window-open.tentative.https.sub.html
@@ -17,7 +17,8 @@ assert_header_equals(e.data, { "dest": "document", "site": "same-origin", - "user":"?F" + "user": "?F", + "mode": "navigate", }); t.done(); })); @@ -33,7 +34,8 @@ assert_header_equals(e.data, { "dest": "document", "site": "same-site", - "user":"?F" + "user": "?F", + "mode": "navigate", }); t.done(); })); @@ -49,7 +51,8 @@ assert_header_equals(e.data, { "dest": "document", "site": "cross-site", - "user":"?F" + "user": "?F", + "mode": "navigate", }); t.done(); })); @@ -68,7 +71,8 @@ assert_header_equals(e.data, { "dest": "document", "site": "same-origin", - "user": "?T" + "user": "?T", + "mode": "navigate", }); t.done(); })); @@ -89,7 +93,8 @@ assert_header_equals(e.data, { "dest": "document", "site": "same-site", - "user": "?T" + "user": "?T", + "mode": "navigate", }); t.done(); })); @@ -110,7 +115,8 @@ assert_header_equals(e.data, { "dest": "document", "site": "cross-site", - "user": "?T" + "user": "?T", + "mode": "navigate", }); t.done(); }));
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/worker.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/worker.tentative.https.sub.html index fcffe91d..89be6f0b 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/worker.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/worker.tentative.https.sub.html
@@ -10,7 +10,7 @@ let key = "worker-same-origin"; let w = new Worker("/fetch/sec-metadata/resources/record-header.py?file=" + key); w.onmessage = e => { - let expected = {"dest":"worker", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"worker", "site":"same-origin", "user":"?F", "mode": "same-origin"}; fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key) .then(response => response.text()) .then(text => assert_header_equals(text, expected))
diff --git a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/xslt.tentative.https.sub.html b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/xslt.tentative.https.sub.html index 32349c9..eea2329 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/xslt.tentative.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/sec-metadata/xslt.tentative.https.sub.html
@@ -12,21 +12,21 @@ return; promise_test(t => { - let expected = {"dest":"xslt", "site":"same-origin", "user":"?F"}; + let expected = {"dest":"xslt", "site":"same-origin", "user":"?F", "mode": "same-origin"}; return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=xslt-same-origin") .then(response => response.text()) .then(text => assert_header_equals(text, expected)); }, "Same-Origin xslt"); promise_test(t => { - let expected = {"dest":"xslt", "site":"same-site", "user":"?F"}; + let expected = {"dest":"xslt", "site":"same-site", "user":"?F", "mode": "no-cors"}; return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=xslt-same-site") .then(response => response.text()) .then(text => assert_header_equals(text, expected)); }, "Same-site xslt"); promise_test(t => { - let expected = {"dest":"xslt", "site":"cross-site", "user":"?F"}; + let expected = {"dest":"xslt", "site":"cross-site", "user":"?F", "mode": "no-cors"}; return fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=xslt-cross-site") .then(response => response.text()) .then(text => assert_header_equals(text, expected));
diff --git a/third_party/blink/web_tests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.tentative.html b/third_party/blink/web_tests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.tentative.html new file mode 100644 index 0000000..dd4c53107 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.tentative.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + test(t => { + assert_false("getUserAgent" in navigator); + }, "navigator.getUserAgent() is not available in non-secure contexts."); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.tentative.https.html b/third_party/blink/web_tests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.tentative.https.html new file mode 100644 index 0000000..5f0dba6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.tentative.https.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/webrtc/dictionary-helper.js"></script> +<script> + test(t => { + assert_true("getUserAgent" in navigator); + }, "navigator.getUserAgent() is exposed."); + + promise_test(t => { + return navigator.getUserAgent() + .then(ua => { + // TODO(web-platform-tests/wpt#9106): Use `idlharness.js` once it supports dictionaries. + assert_string_field(ua, "brand"); + assert_string_field(ua, "version"); + assert_string_field(ua, "platform"); + assert_string_field(ua, "architecture"); + assert_string_field(ua, "model"); + }); + }, "navigator.getUserAgent() returns a UserAgentMetadata object."); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/builtin-import-scheme.tentative-expected.txt b/third_party/blink/web_tests/external/wpt/import-maps/builtin-import-scheme.tentative-expected.txt new file mode 100644 index 0000000..711c8d84 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/import-maps/builtin-import-scheme.tentative-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS import:std:blank: <script src type=module> +PASS import:std:blank: <script src type=text/javascript> +PASS import:std:blank: static import +PASS import:std:blank: dynamic import (from module) +PASS import:std:blank: dynamic import (from text/javascript) +FAIL import:@std/blank: <script src type=module> assert_unreached: Shouldn't load Reached unreachable code +PASS import:@std/blank: <script src type=text/javascript> +FAIL import:@std/blank: static import assert_unreached: Shouldn't load Reached unreachable code +FAIL import:@std/blank: dynamic import (from module) assert_unreached: dynamic import promise shouldn't be resolved Reached unreachable code +FAIL import:@std/blank: dynamic import (from text/javascript) assert_unreached: dynamic import promise shouldn't be resolved Reached unreachable code +PASS import:std:none: <script src type=module> +PASS import:std:none: <script src type=text/javascript> +PASS import:std:none: static import +PASS import:std:none: dynamic import (from module) +PASS import:std:none: dynamic import (from text/javascript) +PASS import:@std/none: <script src type=module> +PASS import:@std/none: <script src type=text/javascript> +PASS import:@std/none: static import +PASS import:@std/none: dynamic import (from module) +PASS import:@std/none: dynamic import (from text/javascript) +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative-expected.txt b/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative-expected.txt deleted file mode 100644 index 76932ca..0000000 --- a/third_party/blink/web_tests/external/wpt/import-maps/builtin.tentative-expected.txt +++ /dev/null
@@ -1,23 +0,0 @@ -This is a testharness.js-based test. -PASS std:blank: <script src type=module> -PASS std:blank: <script src type=text/javascript> -PASS std:blank: static import -PASS std:blank: dynamic import (from module) -PASS std:blank: dynamic import (from text/javascript) -PASS @std/blank: <script src type=module> -PASS @std/blank: <script src type=text/javascript> -FAIL @std/blank: static import assert_unreached: window's error event shouldn't be fired Reached unreachable code -FAIL @std/blank: dynamic import (from module) assert_unreached: dynamic import promise shouldn't be rejected Reached unreachable code -FAIL @std/blank: dynamic import (from text/javascript) assert_unreached: dynamic import promise shouldn't be rejected Reached unreachable code -PASS std:none: <script src type=module> -PASS std:none: <script src type=text/javascript> -FAIL std:none: static import assert_unreached: window's error event shouldn't be fired Reached unreachable code -PASS std:none: dynamic import (from module) -PASS std:none: dynamic import (from text/javascript) -PASS @std/none: <script src type=module> -PASS @std/none: <script src type=text/javascript> -FAIL @std/none: static import assert_unreached: window's error event shouldn't be fired Reached unreachable code -PASS @std/none: dynamic import (from module) -PASS @std/none: dynamic import (from text/javascript) -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-request-xhr.https-expected.txt b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-request-xhr.https-expected.txt index e676089e..76e0835 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-request-xhr.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/fetch-request-xhr.https-expected.txt
@@ -1,9 +1,9 @@ This is a testharness.js-based test. PASS initialize global state -FAIL event.request has the expected headers for same-origin GET. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for same-origin GET. lengths differ, expected 1 got 5" -FAIL event.request has the expected headers for same-origin POST. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for same-origin POST. lengths differ, expected 2 got 7" -FAIL event.request has the expected headers for cross-origin GET. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for cross-origin GET. lengths differ, expected 1 got 5" -FAIL event.request has the expected headers for cross-origin POST. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for cross-origin POST. lengths differ, expected 2 got 7" +FAIL event.request has the expected headers for same-origin GET. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for same-origin GET. lengths differ, expected 1 got 6" +FAIL event.request has the expected headers for same-origin POST. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for same-origin POST. lengths differ, expected 2 got 8" +FAIL event.request has the expected headers for cross-origin GET. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for cross-origin GET. lengths differ, expected 1 got 6" +FAIL event.request has the expected headers for cross-origin POST. promise_test: Unhandled rejection with value: object "Error: assert_array_equals: event.request has the expected headers for cross-origin POST. lengths differ, expected 2 got 8" PASS FetchEvent#request.body contains XHR request data (string) PASS FetchEvent#request.body contains XHR request data (blob) PASS FetchEvent#request.method is set to XHR method
diff --git a/third_party/blink/web_tests/fast/canvas/canvas-font-ex-units-crash.html b/third_party/blink/web_tests/fast/canvas/canvas-font-ex-units-crash.html index 014ebeb..41c7728 100644 --- a/third_party/blink/web_tests/fast/canvas/canvas-font-ex-units-crash.html +++ b/third_party/blink/web_tests/fast/canvas/canvas-font-ex-units-crash.html
@@ -4,14 +4,15 @@ <script> test(function(t) { ctx = document.createElement('canvas').getContext('2d'); - + ctx.font = "5ex sans-serif"; - - size = parseInt(ctx.font.substr(0, 2)); - family = ctx.font.substr(5); - + var words = ctx.font.split(' '); + + size = parseFloat(words[0]); + family = words[1]; + assert_approx_equals(size, 25, 10); assert_equals(family, 'sans-serif'); -}, "Test that setting a font with size in 'ex' units doesn't crash."); +}, "Test that setting a font with size in 'ex' units doesn't crash and keeps the expected size and family for the font."); </script> </body>
diff --git a/third_party/blink/web_tests/fast/canvas/font-size-precision.html b/third_party/blink/web_tests/fast/canvas/font-size-precision.html new file mode 100644 index 0000000..32bf7a9d --- /dev/null +++ b/third_party/blink/web_tests/fast/canvas/font-size-precision.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<style> +canvas { + font-family: sans-serif; + font-size: 100px; + zoom: 3; +} +</style> +<canvas width="100" height="100"></canvas> +<script> +test(function() { + var ctx = document.querySelector('canvas').getContext('2d'); + // Set same font as will be computed on the canvas element. + ctx.font = "10.5px monospace"; + assert_equals(ctx.font, "10.5px monospace"); + ctx.font2 = "10px monospace"; + assert_equals(ctx.font2, "10px monospace"); +}, "The precison of the font should remain the same."); +</script>
diff --git a/third_party/blink/web_tests/flag-specific/disable-site-isolation-trials/http/tests/inspector-protocol/network/raw-headers-for-websocket-expected.txt b/third_party/blink/web_tests/flag-specific/disable-site-isolation-trials/http/tests/inspector-protocol/network/raw-headers-for-websocket-expected.txt new file mode 100644 index 0000000..ea989e0 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/disable-site-isolation-trials/http/tests/inspector-protocol/network/raw-headers-for-websocket-expected.txt
@@ -0,0 +1,8 @@ +Tests that cross-domain WebSocket cookies are not reported. + +new WebSocket('ws://127.0.0.1:8000/inspector-protocol/network/resources/cookie.pl') +Set-Cookie: name=value + +new WebSocket('ws://devtools.oopif.test:8000/inspector-protocol/network/resources/cookie.pl') +Set-Cookie: name=value +
diff --git a/third_party/blink/web_tests/http/tests/fetch/chromium/keepalive-same-origin.html b/third_party/blink/web_tests/http/tests/fetch/chromium/keepalive-same-origin.html new file mode 100644 index 0000000..1bc8b13 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/fetch/chromium/keepalive-same-origin.html
@@ -0,0 +1,13 @@ +<!doctype html> +<html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +promise_test((t) => { + const mode = 'same-origin'; + const keepalive = true; + const headers = {'foo': 'bar'}; + return fetch('/', {mode, headers, keepalive}); + }, 'keepalive: non-simple request works with "same-origin" mode'); +</script> +</html>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/raw-headers-for-websocket-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/network/raw-headers-for-websocket-expected.txt new file mode 100644 index 0000000..de3af54d --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/raw-headers-for-websocket-expected.txt
@@ -0,0 +1,8 @@ +Tests that cross-domain WebSocket cookies are not reported. + +new WebSocket('ws://127.0.0.1:8000/inspector-protocol/network/resources/cookie.pl') +Set-Cookie: name=value + +new WebSocket('ws://devtools.oopif.test:8000/inspector-protocol/network/resources/cookie.pl') +Set-Cookie: undefined +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/raw-headers-for-websocket.js b/third_party/blink/web_tests/http/tests/inspector-protocol/network/raw-headers-for-websocket.js new file mode 100644 index 0000000..3924d477 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/raw-headers-for-websocket.js
@@ -0,0 +1,25 @@ +(async function(testRunner) { + var {page, session, dp} = await testRunner.startURL( + 'resources/cookie.pl', + `Tests that cross-domain WebSocket cookies are not reported.`); + + await dp.Network.enable(); + + await testURL('ws://127.0.0.1:8000/inspector-protocol/network/resources/cookie.pl'); + await testURL('ws://devtools.oopif.test:8000/inspector-protocol/network/resources/cookie.pl'); + testRunner.completeTest(); + + async function testURL(url) { + session.evaluate(` + // The WebSocket handshake will fail but it doesn't matter. + window.ws = new WebSocket('${url}');`); + const response = await dp.Network.onceWebSocketHandshakeResponseReceived(); + dump(url, response); + } + + function dump(url, response) { + response = response.params.response; + testRunner.log(`\nnew WebSocket('${url}')`); + testRunner.log(`Set-Cookie: ${response.headers['Set-Cookie']}`); + } +})
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt index e732a33..08f71d0b 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-get-expected.txt
@@ -15,6 +15,7 @@ HTTP_HOST = localhost:8080 HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-get.html HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-no-referrer-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-no-referrer-expected.txt index 6c0cd8f..6698f7fb 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-no-referrer-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-no-referrer-expected.txt
@@ -16,6 +16,7 @@ HTTP_HOST = localhost:8080 HTTP_ORIGIN = null HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt index 5af52438..28858cb3 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-targets-cross-site-frame-post-expected.txt
@@ -17,6 +17,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-post.html HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt b/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt index 626f824a..63da6cf 100644 --- a/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt
@@ -17,6 +17,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/form-with-enctype-targets-cross-site-frame.html HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = cross-site HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/post-basic-expected.txt b/third_party/blink/web_tests/http/tests/navigation/post-basic-expected.txt index dc92eef..b423b5b0 100644 --- a/third_party/blink/web_tests/http/tests/navigation/post-basic-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/post-basic-expected.txt
@@ -13,6 +13,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/post-frames-expected.txt b/third_party/blink/web_tests/http/tests/navigation/post-frames-expected.txt index c919993..02bee37 100644 --- a/third_party/blink/web_tests/http/tests/navigation/post-frames-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/post-frames-expected.txt
@@ -18,6 +18,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/post-frames-goback1-expected.txt b/third_party/blink/web_tests/http/tests/navigation/post-frames-goback1-expected.txt index f99ecb5..2fc2a5f2 100644 --- a/third_party/blink/web_tests/http/tests/navigation/post-frames-goback1-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/post-frames-goback1-expected.txt
@@ -17,6 +17,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/post-frames-goback1.html HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/post-goback1-expected.txt b/third_party/blink/web_tests/http/tests/navigation/post-goback1-expected.txt index 83b9334..19cd057 100644 --- a/third_party/blink/web_tests/http/tests/navigation/post-goback1-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/post-goback1-expected.txt
@@ -13,6 +13,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/navigation/rename-subframe-goback-expected.txt b/third_party/blink/web_tests/http/tests/navigation/rename-subframe-goback-expected.txt index 0a8d0eb..b857de6d 100644 --- a/third_party/blink/web_tests/http/tests/navigation/rename-subframe-goback-expected.txt +++ b/third_party/blink/web_tests/http/tests/navigation/rename-subframe-goback-expected.txt
@@ -21,6 +21,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html HTTP_SEC_FETCH_DEST = nested-document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/preload/warning/request-mode-expected.txt b/third_party/blink/web_tests/http/tests/preload/warning/request-mode-expected.txt index 478d8556..354f0bc 100644 --- a/third_party/blink/web_tests/http/tests/preload/warning/request-mode-expected.txt +++ b/third_party/blink/web_tests/http/tests/preload/warning/request-mode-expected.txt
@@ -1,4 +1,4 @@ -CONSOLE WARNING: line 9: A preload for 'http://127.0.0.1:8000/preload/warning/resources/hello.txt' is found, but is not used because the request mode does not match. Consider taking a look at crossorigin attribute. +CONSOLE WARNING: line 9: A preload for 'http://127.0.0.1:8000/preload/warning/resources/hello.txt' is found, but is not used because the request headers do not match. This is a testharness.js-based test. PASS Preload match fails because the request mode does not match (see the console log). Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-leak-path-on-redirect-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-leak-path-on-redirect-expected.txt index 0ae0768..ddca9e27 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-leak-path-on-redirect-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-leak-path-on-redirect-expected.txt
@@ -9,6 +9,7 @@ HTTP_HOST = 127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-leak-path-on-redirect.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-expected.txt index 0571bb8..8f5d29a 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-expected.txt
@@ -12,6 +12,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-src-allowed.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-with-redirect-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-with-redirect-expected.txt index 9c38108c..7c7cb1c 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-with-redirect-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-allowed-with-redirect-expected.txt
@@ -9,6 +9,7 @@ HTTP_HOST = 127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-src-allowed-with-redirect.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-expected.txt index da7b422..25c99c6 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-expected.txt
@@ -12,6 +12,7 @@ HTTP_ORIGIN = http://127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-src-default-ignored.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-with-redirect-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-with-redirect-expected.txt index 6fb12a9..c162057c 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-with-redirect-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-with-redirect-expected.txt
@@ -9,6 +9,7 @@ HTTP_HOST = 127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-src-default-ignored-with-redirect.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-expected.txt index 0da28d8f..20bbcf00 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-expected.txt
@@ -10,6 +10,7 @@ HTTP_HOST = 127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-src-get-allowed.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-with-redirect-expected.txt b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-with-redirect-expected.txt index 6d977ec..e854d82 100644 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-with-redirect-expected.txt +++ b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-with-redirect-expected.txt
@@ -9,6 +9,7 @@ HTTP_HOST = 127.0.0.1:8000 HTTP_REFERER = http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/form-action-src-get-allowed-with-redirect.html HTTP_SEC_FETCH_DEST = document +HTTP_SEC_FETCH_MODE = navigate HTTP_SEC_FETCH_SITE = same-origin HTTP_SEC_FETCH_USER = ?F HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/fetch-event-headers.html b/third_party/blink/web_tests/http/tests/serviceworker/fetch-event-headers.html index 4d92451f..f94a01a 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/fetch-event-headers.html +++ b/third_party/blink/web_tests/http/tests/serviceworker/fetch-event-headers.html
@@ -31,7 +31,7 @@ header_names.sort(); assert_array_equals( header_names, - ["accept", "sec-fetch-dest", "sec-fetch-site", "sec-fetch-user", "upgrade-insecure-requests", "user-agent"], + ["accept", "sec-fetch-dest", "sec-fetch-mode", "sec-fetch-site", "sec-fetch-user", "upgrade-insecure-requests", "user-agent"], 'event.request has the expected headers.'); return service_worker_unregister_and_done(t, scope);
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index bad61cf..7630189 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -1296,9 +1296,11 @@ attribute @@toStringTag attribute ACTIVE_ATOMIC_COUNTER_BUFFERS attribute ACTIVE_ATTRIBUTES + attribute ACTIVE_RESOURCES attribute ACTIVE_TEXTURE attribute ACTIVE_UNIFORMS attribute ACTIVE_UNIFORM_BLOCKS + attribute ACTIVE_VARIABLES attribute ALIASED_LINE_WIDTH_RANGE attribute ALIASED_POINT_SIZE_RANGE attribute ALPHA @@ -1309,6 +1311,8 @@ attribute ANY_SAMPLES_PASSED_CONSERVATIVE attribute ARRAY_BUFFER attribute ARRAY_BUFFER_BINDING + attribute ARRAY_SIZE + attribute ARRAY_STRIDE attribute ATOMIC_COUNTER_BARRIER_BIT attribute ATOMIC_COUNTER_BUFFER attribute ATOMIC_COUNTER_BUFFER_BINDING @@ -1326,12 +1330,15 @@ attribute BLEND_EQUATION_RGB attribute BLEND_SRC_ALPHA attribute BLEND_SRC_RGB + attribute BLOCK_INDEX attribute BLUE_BITS attribute BOOL attribute BOOL_VEC2 attribute BOOL_VEC3 attribute BOOL_VEC4 attribute BROWSER_DEFAULT_WEBGL + attribute BUFFER_BINDING + attribute BUFFER_DATA_SIZE attribute BUFFER_SIZE attribute BUFFER_UPDATE_BARRIER_BIT attribute BUFFER_USAGE @@ -1501,6 +1508,7 @@ attribute INVALID_OPERATION attribute INVALID_VALUE attribute INVERT + attribute IS_ROW_MAJOR attribute KEEP attribute LEQUAL attribute LESS @@ -1512,10 +1520,12 @@ attribute LINE_STRIP attribute LINE_WIDTH attribute LINK_STATUS + attribute LOCATION attribute LOW_FLOAT attribute LOW_INT attribute LUMINANCE attribute LUMINANCE_ALPHA + attribute MATRIX_STRIDE attribute MAX attribute MAX_3D_TEXTURE_SIZE attribute MAX_ARRAY_TEXTURE_LAYERS @@ -1553,6 +1563,8 @@ attribute MAX_FRAGMENT_UNIFORM_BLOCKS attribute MAX_FRAGMENT_UNIFORM_COMPONENTS attribute MAX_FRAGMENT_UNIFORM_VECTORS + attribute MAX_NAME_LENGTH + attribute MAX_NUM_ACTIVE_VARIABLES attribute MAX_PROGRAM_TEXEL_OFFSET attribute MAX_RENDERBUFFER_SIZE attribute MAX_SAMPLES @@ -1584,6 +1596,7 @@ attribute MIN attribute MIN_PROGRAM_TEXEL_OFFSET attribute MIRRORED_REPEAT + attribute NAME_LENGTH attribute NEAREST attribute NEAREST_MIPMAP_LINEAR attribute NEAREST_MIPMAP_NEAREST @@ -1592,7 +1605,9 @@ attribute NONE attribute NOTEQUAL attribute NO_ERROR + attribute NUM_ACTIVE_VARIABLES attribute OBJECT_TYPE + attribute OFFSET attribute ONE attribute ONE_MINUS_CONSTANT_ALPHA attribute ONE_MINUS_CONSTANT_COLOR @@ -1614,6 +1629,8 @@ attribute POLYGON_OFFSET_FACTOR attribute POLYGON_OFFSET_FILL attribute POLYGON_OFFSET_UNITS + attribute PROGRAM_INPUT + attribute PROGRAM_OUTPUT attribute QUERY_RESULT attribute QUERY_RESULT_AVAILABLE attribute R11F_G11F_B10F @@ -1636,6 +1653,9 @@ attribute RED attribute RED_BITS attribute RED_INTEGER + attribute REFERENCED_BY_COMPUTE_SHADER + attribute REFERENCED_BY_FRAGMENT_SHADER + attribute REFERENCED_BY_VERTEX_SHADER attribute RENDERBUFFER attribute RENDERBUFFER_ALPHA_SIZE attribute RENDERBUFFER_BINDING @@ -1827,6 +1847,8 @@ attribute TEXTURE_WRAP_T attribute TIMEOUT_EXPIRED attribute TIMEOUT_IGNORED + attribute TOP_LEVEL_ARRAY_SIZE + attribute TOP_LEVEL_ARRAY_STRIDE attribute TRANSFORM_FEEDBACK attribute TRANSFORM_FEEDBACK_ACTIVE attribute TRANSFORM_FEEDBACK_BARRIER_BIT @@ -1838,13 +1860,17 @@ attribute TRANSFORM_FEEDBACK_BUFFER_START attribute TRANSFORM_FEEDBACK_PAUSED attribute TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN + attribute TRANSFORM_FEEDBACK_VARYING attribute TRANSFORM_FEEDBACK_VARYINGS attribute TRIANGLES attribute TRIANGLE_FAN attribute TRIANGLE_STRIP attribute TRUE + attribute TYPE + attribute UNIFORM attribute UNIFORM_ARRAY_STRIDE attribute UNIFORM_BARRIER_BIT + attribute UNIFORM_BLOCK attribute UNIFORM_BLOCK_ACTIVE_UNIFORMS attribute UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES attribute UNIFORM_BLOCK_BINDING @@ -2023,7 +2049,12 @@ method getInternalformatParameter method getParameter method getProgramInfoLog + method getProgramInterfaceParameter method getProgramParameter + method getProgramResource + method getProgramResourceIndex + method getProgramResourceLocation + method getProgramResourceName method getQuery method getQueryParameter method getRenderbufferParameter
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 1bf0add..f445684 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -1343,9 +1343,11 @@ [Worker] attribute @@toStringTag [Worker] attribute ACTIVE_ATOMIC_COUNTER_BUFFERS [Worker] attribute ACTIVE_ATTRIBUTES +[Worker] attribute ACTIVE_RESOURCES [Worker] attribute ACTIVE_TEXTURE [Worker] attribute ACTIVE_UNIFORMS [Worker] attribute ACTIVE_UNIFORM_BLOCKS +[Worker] attribute ACTIVE_VARIABLES [Worker] attribute ALIASED_LINE_WIDTH_RANGE [Worker] attribute ALIASED_POINT_SIZE_RANGE [Worker] attribute ALPHA @@ -1356,6 +1358,8 @@ [Worker] attribute ANY_SAMPLES_PASSED_CONSERVATIVE [Worker] attribute ARRAY_BUFFER [Worker] attribute ARRAY_BUFFER_BINDING +[Worker] attribute ARRAY_SIZE +[Worker] attribute ARRAY_STRIDE [Worker] attribute ATOMIC_COUNTER_BARRIER_BIT [Worker] attribute ATOMIC_COUNTER_BUFFER [Worker] attribute ATOMIC_COUNTER_BUFFER_BINDING @@ -1373,12 +1377,15 @@ [Worker] attribute BLEND_EQUATION_RGB [Worker] attribute BLEND_SRC_ALPHA [Worker] attribute BLEND_SRC_RGB +[Worker] attribute BLOCK_INDEX [Worker] attribute BLUE_BITS [Worker] attribute BOOL [Worker] attribute BOOL_VEC2 [Worker] attribute BOOL_VEC3 [Worker] attribute BOOL_VEC4 [Worker] attribute BROWSER_DEFAULT_WEBGL +[Worker] attribute BUFFER_BINDING +[Worker] attribute BUFFER_DATA_SIZE [Worker] attribute BUFFER_SIZE [Worker] attribute BUFFER_UPDATE_BARRIER_BIT [Worker] attribute BUFFER_USAGE @@ -1548,6 +1555,7 @@ [Worker] attribute INVALID_OPERATION [Worker] attribute INVALID_VALUE [Worker] attribute INVERT +[Worker] attribute IS_ROW_MAJOR [Worker] attribute KEEP [Worker] attribute LEQUAL [Worker] attribute LESS @@ -1559,10 +1567,12 @@ [Worker] attribute LINE_STRIP [Worker] attribute LINE_WIDTH [Worker] attribute LINK_STATUS +[Worker] attribute LOCATION [Worker] attribute LOW_FLOAT [Worker] attribute LOW_INT [Worker] attribute LUMINANCE [Worker] attribute LUMINANCE_ALPHA +[Worker] attribute MATRIX_STRIDE [Worker] attribute MAX [Worker] attribute MAX_3D_TEXTURE_SIZE [Worker] attribute MAX_ARRAY_TEXTURE_LAYERS @@ -1600,6 +1610,8 @@ [Worker] attribute MAX_FRAGMENT_UNIFORM_BLOCKS [Worker] attribute MAX_FRAGMENT_UNIFORM_COMPONENTS [Worker] attribute MAX_FRAGMENT_UNIFORM_VECTORS +[Worker] attribute MAX_NAME_LENGTH +[Worker] attribute MAX_NUM_ACTIVE_VARIABLES [Worker] attribute MAX_PROGRAM_TEXEL_OFFSET [Worker] attribute MAX_RENDERBUFFER_SIZE [Worker] attribute MAX_SAMPLES @@ -1631,6 +1643,7 @@ [Worker] attribute MIN [Worker] attribute MIN_PROGRAM_TEXEL_OFFSET [Worker] attribute MIRRORED_REPEAT +[Worker] attribute NAME_LENGTH [Worker] attribute NEAREST [Worker] attribute NEAREST_MIPMAP_LINEAR [Worker] attribute NEAREST_MIPMAP_NEAREST @@ -1639,7 +1652,9 @@ [Worker] attribute NONE [Worker] attribute NOTEQUAL [Worker] attribute NO_ERROR +[Worker] attribute NUM_ACTIVE_VARIABLES [Worker] attribute OBJECT_TYPE +[Worker] attribute OFFSET [Worker] attribute ONE [Worker] attribute ONE_MINUS_CONSTANT_ALPHA [Worker] attribute ONE_MINUS_CONSTANT_COLOR @@ -1661,6 +1676,8 @@ [Worker] attribute POLYGON_OFFSET_FACTOR [Worker] attribute POLYGON_OFFSET_FILL [Worker] attribute POLYGON_OFFSET_UNITS +[Worker] attribute PROGRAM_INPUT +[Worker] attribute PROGRAM_OUTPUT [Worker] attribute QUERY_RESULT [Worker] attribute QUERY_RESULT_AVAILABLE [Worker] attribute R11F_G11F_B10F @@ -1683,6 +1700,9 @@ [Worker] attribute RED [Worker] attribute RED_BITS [Worker] attribute RED_INTEGER +[Worker] attribute REFERENCED_BY_COMPUTE_SHADER +[Worker] attribute REFERENCED_BY_FRAGMENT_SHADER +[Worker] attribute REFERENCED_BY_VERTEX_SHADER [Worker] attribute RENDERBUFFER [Worker] attribute RENDERBUFFER_ALPHA_SIZE [Worker] attribute RENDERBUFFER_BINDING @@ -1874,6 +1894,8 @@ [Worker] attribute TEXTURE_WRAP_T [Worker] attribute TIMEOUT_EXPIRED [Worker] attribute TIMEOUT_IGNORED +[Worker] attribute TOP_LEVEL_ARRAY_SIZE +[Worker] attribute TOP_LEVEL_ARRAY_STRIDE [Worker] attribute TRANSFORM_FEEDBACK [Worker] attribute TRANSFORM_FEEDBACK_ACTIVE [Worker] attribute TRANSFORM_FEEDBACK_BARRIER_BIT @@ -1885,13 +1907,17 @@ [Worker] attribute TRANSFORM_FEEDBACK_BUFFER_START [Worker] attribute TRANSFORM_FEEDBACK_PAUSED [Worker] attribute TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN +[Worker] attribute TRANSFORM_FEEDBACK_VARYING [Worker] attribute TRANSFORM_FEEDBACK_VARYINGS [Worker] attribute TRIANGLES [Worker] attribute TRIANGLE_FAN [Worker] attribute TRIANGLE_STRIP [Worker] attribute TRUE +[Worker] attribute TYPE +[Worker] attribute UNIFORM [Worker] attribute UNIFORM_ARRAY_STRIDE [Worker] attribute UNIFORM_BARRIER_BIT +[Worker] attribute UNIFORM_BLOCK [Worker] attribute UNIFORM_BLOCK_ACTIVE_UNIFORMS [Worker] attribute UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES [Worker] attribute UNIFORM_BLOCK_BINDING @@ -2070,7 +2096,12 @@ [Worker] method getInternalformatParameter [Worker] method getParameter [Worker] method getProgramInfoLog +[Worker] method getProgramInterfaceParameter [Worker] method getProgramParameter +[Worker] method getProgramResource +[Worker] method getProgramResourceIndex +[Worker] method getProgramResourceLocation +[Worker] method getProgramResourceName [Worker] method getQuery [Worker] method getQueryParameter [Worker] method getRenderbufferParameter
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index f250d18..85436ed 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -4828,6 +4828,7 @@ method getBattery method getGamepads method getInstalledRelatedApps + method getUserAgent method getUserMedia method getVRDisplays method getWakeLock @@ -8007,9 +8008,11 @@ attribute @@toStringTag attribute ACTIVE_ATOMIC_COUNTER_BUFFERS attribute ACTIVE_ATTRIBUTES + attribute ACTIVE_RESOURCES attribute ACTIVE_TEXTURE attribute ACTIVE_UNIFORMS attribute ACTIVE_UNIFORM_BLOCKS + attribute ACTIVE_VARIABLES attribute ALIASED_LINE_WIDTH_RANGE attribute ALIASED_POINT_SIZE_RANGE attribute ALPHA @@ -8020,6 +8023,8 @@ attribute ANY_SAMPLES_PASSED_CONSERVATIVE attribute ARRAY_BUFFER attribute ARRAY_BUFFER_BINDING + attribute ARRAY_SIZE + attribute ARRAY_STRIDE attribute ATOMIC_COUNTER_BARRIER_BIT attribute ATOMIC_COUNTER_BUFFER attribute ATOMIC_COUNTER_BUFFER_BINDING @@ -8037,12 +8042,15 @@ attribute BLEND_EQUATION_RGB attribute BLEND_SRC_ALPHA attribute BLEND_SRC_RGB + attribute BLOCK_INDEX attribute BLUE_BITS attribute BOOL attribute BOOL_VEC2 attribute BOOL_VEC3 attribute BOOL_VEC4 attribute BROWSER_DEFAULT_WEBGL + attribute BUFFER_BINDING + attribute BUFFER_DATA_SIZE attribute BUFFER_SIZE attribute BUFFER_UPDATE_BARRIER_BIT attribute BUFFER_USAGE @@ -8212,6 +8220,7 @@ attribute INVALID_OPERATION attribute INVALID_VALUE attribute INVERT + attribute IS_ROW_MAJOR attribute KEEP attribute LEQUAL attribute LESS @@ -8223,10 +8232,12 @@ attribute LINE_STRIP attribute LINE_WIDTH attribute LINK_STATUS + attribute LOCATION attribute LOW_FLOAT attribute LOW_INT attribute LUMINANCE attribute LUMINANCE_ALPHA + attribute MATRIX_STRIDE attribute MAX attribute MAX_3D_TEXTURE_SIZE attribute MAX_ARRAY_TEXTURE_LAYERS @@ -8264,6 +8275,8 @@ attribute MAX_FRAGMENT_UNIFORM_BLOCKS attribute MAX_FRAGMENT_UNIFORM_COMPONENTS attribute MAX_FRAGMENT_UNIFORM_VECTORS + attribute MAX_NAME_LENGTH + attribute MAX_NUM_ACTIVE_VARIABLES attribute MAX_PROGRAM_TEXEL_OFFSET attribute MAX_RENDERBUFFER_SIZE attribute MAX_SAMPLES @@ -8295,6 +8308,7 @@ attribute MIN attribute MIN_PROGRAM_TEXEL_OFFSET attribute MIRRORED_REPEAT + attribute NAME_LENGTH attribute NEAREST attribute NEAREST_MIPMAP_LINEAR attribute NEAREST_MIPMAP_NEAREST @@ -8303,7 +8317,9 @@ attribute NONE attribute NOTEQUAL attribute NO_ERROR + attribute NUM_ACTIVE_VARIABLES attribute OBJECT_TYPE + attribute OFFSET attribute ONE attribute ONE_MINUS_CONSTANT_ALPHA attribute ONE_MINUS_CONSTANT_COLOR @@ -8325,6 +8341,8 @@ attribute POLYGON_OFFSET_FACTOR attribute POLYGON_OFFSET_FILL attribute POLYGON_OFFSET_UNITS + attribute PROGRAM_INPUT + attribute PROGRAM_OUTPUT attribute QUERY_RESULT attribute QUERY_RESULT_AVAILABLE attribute R11F_G11F_B10F @@ -8347,6 +8365,9 @@ attribute RED attribute RED_BITS attribute RED_INTEGER + attribute REFERENCED_BY_COMPUTE_SHADER + attribute REFERENCED_BY_FRAGMENT_SHADER + attribute REFERENCED_BY_VERTEX_SHADER attribute RENDERBUFFER attribute RENDERBUFFER_ALPHA_SIZE attribute RENDERBUFFER_BINDING @@ -8538,6 +8559,8 @@ attribute TEXTURE_WRAP_T attribute TIMEOUT_EXPIRED attribute TIMEOUT_IGNORED + attribute TOP_LEVEL_ARRAY_SIZE + attribute TOP_LEVEL_ARRAY_STRIDE attribute TRANSFORM_FEEDBACK attribute TRANSFORM_FEEDBACK_ACTIVE attribute TRANSFORM_FEEDBACK_BARRIER_BIT @@ -8549,13 +8572,17 @@ attribute TRANSFORM_FEEDBACK_BUFFER_START attribute TRANSFORM_FEEDBACK_PAUSED attribute TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN + attribute TRANSFORM_FEEDBACK_VARYING attribute TRANSFORM_FEEDBACK_VARYINGS attribute TRIANGLES attribute TRIANGLE_FAN attribute TRIANGLE_STRIP attribute TRUE + attribute TYPE + attribute UNIFORM attribute UNIFORM_ARRAY_STRIDE attribute UNIFORM_BARRIER_BIT + attribute UNIFORM_BLOCK attribute UNIFORM_BLOCK_ACTIVE_UNIFORMS attribute UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES attribute UNIFORM_BLOCK_BINDING @@ -8734,7 +8761,12 @@ method getInternalformatParameter method getParameter method getProgramInfoLog + method getProgramInterfaceParameter method getProgramParameter + method getProgramResource + method getProgramResourceIndex + method getProgramResourceLocation + method getProgramResourceName method getQuery method getQueryParameter method getRenderbufferParameter
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt index be698df..51bdf801 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -1214,9 +1214,11 @@ [Worker] attribute @@toStringTag [Worker] attribute ACTIVE_ATOMIC_COUNTER_BUFFERS [Worker] attribute ACTIVE_ATTRIBUTES +[Worker] attribute ACTIVE_RESOURCES [Worker] attribute ACTIVE_TEXTURE [Worker] attribute ACTIVE_UNIFORMS [Worker] attribute ACTIVE_UNIFORM_BLOCKS +[Worker] attribute ACTIVE_VARIABLES [Worker] attribute ALIASED_LINE_WIDTH_RANGE [Worker] attribute ALIASED_POINT_SIZE_RANGE [Worker] attribute ALPHA @@ -1227,6 +1229,8 @@ [Worker] attribute ANY_SAMPLES_PASSED_CONSERVATIVE [Worker] attribute ARRAY_BUFFER [Worker] attribute ARRAY_BUFFER_BINDING +[Worker] attribute ARRAY_SIZE +[Worker] attribute ARRAY_STRIDE [Worker] attribute ATOMIC_COUNTER_BARRIER_BIT [Worker] attribute ATOMIC_COUNTER_BUFFER [Worker] attribute ATOMIC_COUNTER_BUFFER_BINDING @@ -1244,12 +1248,15 @@ [Worker] attribute BLEND_EQUATION_RGB [Worker] attribute BLEND_SRC_ALPHA [Worker] attribute BLEND_SRC_RGB +[Worker] attribute BLOCK_INDEX [Worker] attribute BLUE_BITS [Worker] attribute BOOL [Worker] attribute BOOL_VEC2 [Worker] attribute BOOL_VEC3 [Worker] attribute BOOL_VEC4 [Worker] attribute BROWSER_DEFAULT_WEBGL +[Worker] attribute BUFFER_BINDING +[Worker] attribute BUFFER_DATA_SIZE [Worker] attribute BUFFER_SIZE [Worker] attribute BUFFER_UPDATE_BARRIER_BIT [Worker] attribute BUFFER_USAGE @@ -1419,6 +1426,7 @@ [Worker] attribute INVALID_OPERATION [Worker] attribute INVALID_VALUE [Worker] attribute INVERT +[Worker] attribute IS_ROW_MAJOR [Worker] attribute KEEP [Worker] attribute LEQUAL [Worker] attribute LESS @@ -1430,10 +1438,12 @@ [Worker] attribute LINE_STRIP [Worker] attribute LINE_WIDTH [Worker] attribute LINK_STATUS +[Worker] attribute LOCATION [Worker] attribute LOW_FLOAT [Worker] attribute LOW_INT [Worker] attribute LUMINANCE [Worker] attribute LUMINANCE_ALPHA +[Worker] attribute MATRIX_STRIDE [Worker] attribute MAX [Worker] attribute MAX_3D_TEXTURE_SIZE [Worker] attribute MAX_ARRAY_TEXTURE_LAYERS @@ -1471,6 +1481,8 @@ [Worker] attribute MAX_FRAGMENT_UNIFORM_BLOCKS [Worker] attribute MAX_FRAGMENT_UNIFORM_COMPONENTS [Worker] attribute MAX_FRAGMENT_UNIFORM_VECTORS +[Worker] attribute MAX_NAME_LENGTH +[Worker] attribute MAX_NUM_ACTIVE_VARIABLES [Worker] attribute MAX_PROGRAM_TEXEL_OFFSET [Worker] attribute MAX_RENDERBUFFER_SIZE [Worker] attribute MAX_SAMPLES @@ -1502,6 +1514,7 @@ [Worker] attribute MIN [Worker] attribute MIN_PROGRAM_TEXEL_OFFSET [Worker] attribute MIRRORED_REPEAT +[Worker] attribute NAME_LENGTH [Worker] attribute NEAREST [Worker] attribute NEAREST_MIPMAP_LINEAR [Worker] attribute NEAREST_MIPMAP_NEAREST @@ -1510,7 +1523,9 @@ [Worker] attribute NONE [Worker] attribute NOTEQUAL [Worker] attribute NO_ERROR +[Worker] attribute NUM_ACTIVE_VARIABLES [Worker] attribute OBJECT_TYPE +[Worker] attribute OFFSET [Worker] attribute ONE [Worker] attribute ONE_MINUS_CONSTANT_ALPHA [Worker] attribute ONE_MINUS_CONSTANT_COLOR @@ -1532,6 +1547,8 @@ [Worker] attribute POLYGON_OFFSET_FACTOR [Worker] attribute POLYGON_OFFSET_FILL [Worker] attribute POLYGON_OFFSET_UNITS +[Worker] attribute PROGRAM_INPUT +[Worker] attribute PROGRAM_OUTPUT [Worker] attribute QUERY_RESULT [Worker] attribute QUERY_RESULT_AVAILABLE [Worker] attribute R11F_G11F_B10F @@ -1554,6 +1571,9 @@ [Worker] attribute RED [Worker] attribute RED_BITS [Worker] attribute RED_INTEGER +[Worker] attribute REFERENCED_BY_COMPUTE_SHADER +[Worker] attribute REFERENCED_BY_FRAGMENT_SHADER +[Worker] attribute REFERENCED_BY_VERTEX_SHADER [Worker] attribute RENDERBUFFER [Worker] attribute RENDERBUFFER_ALPHA_SIZE [Worker] attribute RENDERBUFFER_BINDING @@ -1745,6 +1765,8 @@ [Worker] attribute TEXTURE_WRAP_T [Worker] attribute TIMEOUT_EXPIRED [Worker] attribute TIMEOUT_IGNORED +[Worker] attribute TOP_LEVEL_ARRAY_SIZE +[Worker] attribute TOP_LEVEL_ARRAY_STRIDE [Worker] attribute TRANSFORM_FEEDBACK [Worker] attribute TRANSFORM_FEEDBACK_ACTIVE [Worker] attribute TRANSFORM_FEEDBACK_BARRIER_BIT @@ -1756,13 +1778,17 @@ [Worker] attribute TRANSFORM_FEEDBACK_BUFFER_START [Worker] attribute TRANSFORM_FEEDBACK_PAUSED [Worker] attribute TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN +[Worker] attribute TRANSFORM_FEEDBACK_VARYING [Worker] attribute TRANSFORM_FEEDBACK_VARYINGS [Worker] attribute TRIANGLES [Worker] attribute TRIANGLE_FAN [Worker] attribute TRIANGLE_STRIP [Worker] attribute TRUE +[Worker] attribute TYPE +[Worker] attribute UNIFORM [Worker] attribute UNIFORM_ARRAY_STRIDE [Worker] attribute UNIFORM_BARRIER_BIT +[Worker] attribute UNIFORM_BLOCK [Worker] attribute UNIFORM_BLOCK_ACTIVE_UNIFORMS [Worker] attribute UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES [Worker] attribute UNIFORM_BLOCK_BINDING @@ -1941,7 +1967,12 @@ [Worker] method getInternalformatParameter [Worker] method getParameter [Worker] method getProgramInfoLog +[Worker] method getProgramInterfaceParameter [Worker] method getProgramParameter +[Worker] method getProgramResource +[Worker] method getProgramResourceIndex +[Worker] method getProgramResourceLocation +[Worker] method getProgramResourceName [Worker] method getQuery [Worker] method getQueryParameter [Worker] method getRenderbufferParameter
diff --git a/third_party/closure_compiler/externs/arc_apps_private.js b/third_party/closure_compiler/externs/arc_apps_private.js new file mode 100644 index 0000000..e32f62b7 --- /dev/null +++ b/third_party/closure_compiler/externs/arc_apps_private.js
@@ -0,0 +1,46 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file was generated by: +// tools/json_schema_compiler/compiler.py. +// NOTE: The format of types has changed. 'FooType' is now +// 'chrome.arcAppsPrivate.FooType'. +// Please run the closure compiler before committing changes. +// See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md + +/** @fileoverview Externs generated from namespace: arcAppsPrivate */ + +/** + * @const + */ +chrome.arcAppsPrivate = {}; + +/** + * @typedef {{ + * packageName: string + * }} + */ +chrome.arcAppsPrivate.AppInfo; + +/** + * Returns info of the installed ARC apps that are launchable, including ready + * and non-ready apps. + * @param {function(!Array<!chrome.arcAppsPrivate.AppInfo>):void} callback + */ +chrome.arcAppsPrivate.getLaunchableApps = function(callback) {}; + +/** + * Launches the ARC app with its package name. The app is launched immediately + * if it's ready, otherwise it will be launched when it becomes ready. The + * callback is called as soon as the launch is scheduled. + * @param {string} packageName + * @param {function():void=} callback + */ +chrome.arcAppsPrivate.launchApp = function(packageName, callback) {}; + +/** + * Fires when a new app can be launched via $(ref:launchApp). + * @type {!ChromeEvent} + */ +chrome.arcAppsPrivate.onInstalled;
diff --git a/third_party/libaom/README.chromium b/third_party/libaom/README.chromium index 7eaa1e4..001acd97 100644 --- a/third_party/libaom/README.chromium +++ b/third_party/libaom/README.chromium
@@ -2,9 +2,9 @@ Short Name: libaom URL: https://aomedia.googlesource.com/aom/ Version: 0 -Date: Friday December 21 2018 +Date: Wednesday January 30 2019 Branch: master -Commit: 20a747b9ce5ec99ad2f78dd206a3fc1b8abf6850 +Commit: 625cded0550bb79efd10d98a9809a7ccd72a8f60 License: BSD License File: source/libaom/LICENSE Security Critical: yes
diff --git a/third_party/libaom/libaom_srcs.gni b/third_party/libaom/libaom_srcs.gni index 54848ed..69ad34a 100644 --- a/third_party/libaom/libaom_srcs.gni +++ b/third_party/libaom/libaom_srcs.gni
@@ -187,6 +187,7 @@ "//third_party/libaom/source/libaom/av1/encoder/x86/error_intrin_avx2.c", "//third_party/libaom/source/libaom/av1/encoder/x86/av1_fwd_txfm_avx2.h", "//third_party/libaom/source/libaom/av1/encoder/x86/av1_fwd_txfm2d_avx2.c", + "//third_party/libaom/source/libaom/av1/encoder/x86/highbd_fwd_txfm_avx2.c", "//third_party/libaom/source/libaom/av1/encoder/x86/wedge_utils_avx2.c", "//third_party/libaom/source/libaom/av1/encoder/x86/encodetxb_avx2.c", "//third_party/libaom/source/libaom/av1/encoder/x86/rdopt_avx2.c", @@ -262,6 +263,8 @@ "//third_party/libaom/source/libaom/av1/encoder/encodemb.h", "//third_party/libaom/source/libaom/av1/encoder/encodemv.c", "//third_party/libaom/source/libaom/av1/encoder/encodemv.h", + "//third_party/libaom/source/libaom/av1/encoder/encode_strategy.c", + "//third_party/libaom/source/libaom/av1/encoder/encode_strategy.h", "//third_party/libaom/source/libaom/av1/encoder/encoder.c", "//third_party/libaom/source/libaom/av1/encoder/encoder.h", "//third_party/libaom/source/libaom/av1/encoder/encodetxb.c", @@ -314,6 +317,8 @@ "//third_party/libaom/source/libaom/av1/encoder/temporal_filter.h", "//third_party/libaom/source/libaom/av1/encoder/tokenize.c", "//third_party/libaom/source/libaom/av1/encoder/tokenize.h", + "//third_party/libaom/source/libaom/av1/encoder/tpl_model.c", + "//third_party/libaom/source/libaom/av1/encoder/tpl_model.h", "//third_party/libaom/source/libaom/av1/encoder/wedge_utils.c", "//third_party/libaom/source/libaom/third_party/fastfeat/fast.c", "//third_party/libaom/source/libaom/third_party/fastfeat/fast.h", @@ -331,8 +336,8 @@ "//third_party/libaom/source/libaom/aom_dsp/x86/aom_high_subpixel_bilinear_sse2.asm", "//third_party/libaom/source/libaom/aom_dsp/x86/aom_subpixel_8t_sse2.asm", "//third_party/libaom/source/libaom/aom_dsp/x86/aom_subpixel_bilinear_sse2.asm", - "//third_party/libaom/source/libaom/aom_dsp/x86/highbd_intrapred_sse2.asm", - "//third_party/libaom/source/libaom/aom_dsp/x86/intrapred_sse2.asm", + "//third_party/libaom/source/libaom/aom_dsp/x86/highbd_intrapred_asm_sse2.asm", + "//third_party/libaom/source/libaom/aom_dsp/x86/intrapred_asm_sse2.asm", "//third_party/libaom/source/libaom/aom_dsp/x86/inv_wht_sse2.asm", ]
diff --git a/third_party/libaom/source/config/config/aom_version.h b/third_party/libaom/source/config/config/aom_version.h index ef1f078..9382587f 100644 --- a/third_party/libaom/source/config/config/aom_version.h +++ b/third_party/libaom/source/config/config/aom_version.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -12,8 +12,8 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_PATCH 0 -#define VERSION_EXTRA "1101-g20a747b9c" +#define VERSION_EXTRA "1276-g625cded05" #define VERSION_PACKED \ ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH)) -#define VERSION_STRING_NOSP "1.0.0-1101-g20a747b9c" -#define VERSION_STRING " 1.0.0-1101-g20a747b9c" +#define VERSION_STRING_NOSP "1.0.0-1276-g625cded05" +#define VERSION_STRING " 1.0.0-1276-g625cded05"
diff --git a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm index 9aadc24..fc05198f 100644 --- a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm
@@ -1,5 +1,5 @@ ; -; Copyright (c) 2018, Alliance for Open Media. All rights reserved +; Copyright (c) 2019, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -22,6 +22,7 @@ CONFIG_BITSTREAM_DEBUG equ 0 CONFIG_COEFFICIENT_RANGE_CHECKING equ 0 CONFIG_COLLECT_INTER_MODE_RD_STATS equ 1 +CONFIG_COLLECT_PARTITION_STATS equ 0 CONFIG_COLLECT_RD_STATS equ 0 CONFIG_DEBUG equ 0 CONFIG_DENOISE equ 1 @@ -29,7 +30,6 @@ CONFIG_DIST_8X8 equ 0 CONFIG_ENTROPY_STATS equ 0 CONFIG_FILEOPTIONS equ 1 -CONFIG_FIX_GF_LENGTH equ 1 CONFIG_FP_MB_STATS equ 0 CONFIG_GCC equ 1 CONFIG_GCOV equ 0 @@ -47,12 +47,12 @@ CONFIG_OS_SUPPORT equ 1 CONFIG_PIC equ 0 CONFIG_RD_DEBUG equ 0 -CONFIG_REDUCED_ENCODER_BORDER equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_SHARED equ 0 CONFIG_SHARP_SETTINGS equ 0 CONFIG_SIZE_LIMIT equ 1 CONFIG_SPATIAL_RESAMPLING equ 1 +CONFIG_SPEED_STATS equ 0 CONFIG_STATIC equ 1 CONFIG_WEBM_IO equ 1 DECODE_HEIGHT_LIMIT equ 16384
diff --git a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h index 64efc452..04f9ec9b 100644 --- a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h +++ b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/av1_rtcd.h b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/av1_rtcd.h index 096f55f..e1ddca6 100644 --- a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/av1_rtcd.h
@@ -312,6 +312,147 @@ const int subpel_y_q4, ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_neon( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d_copy)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_x)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_y)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -509,6 +650,65 @@ int bd); #define av1_highbd_convolve_y_sr av1_highbd_convolve_y_sr_c +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d av1_highbd_dist_wtd_convolve_2d_c + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d_copy \ + av1_highbd_dist_wtd_convolve_2d_copy_c + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_x av1_highbd_dist_wtd_convolve_x_c + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_y av1_highbd_dist_wtd_convolve_y_c + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -600,63 +800,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d av1_highbd_jnt_convolve_2d_c - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d_copy av1_highbd_jnt_convolve_2d_copy_c - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_x av1_highbd_jnt_convolve_x_c - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_y av1_highbd_jnt_convolve_y_c - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -838,146 +981,6 @@ int stride, const TxfmParam* txfm_param); -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d_copy)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_x)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_y)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_neon(int32_t* arr, int size, int bit); RTCD_EXTERN void (*av1_round_shift_array)(int32_t* arr, int size, int bit); @@ -1266,21 +1269,21 @@ av1_convolve_y_sr = av1_convolve_y_sr_c; if (flags & HAS_NEON) av1_convolve_y_sr = av1_convolve_y_sr_neon; + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_c; + if (flags & HAS_NEON) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_neon; + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_c; + if (flags & HAS_NEON) + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_neon; + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_c; + if (flags & HAS_NEON) + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_neon; + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_c; + if (flags & HAS_NEON) + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_neon; av1_inv_txfm_add = av1_inv_txfm_add_c; if (flags & HAS_NEON) av1_inv_txfm_add = av1_inv_txfm_add_neon; - av1_jnt_convolve_2d = av1_jnt_convolve_2d_c; - if (flags & HAS_NEON) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_neon; - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_c; - if (flags & HAS_NEON) - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_neon; - av1_jnt_convolve_x = av1_jnt_convolve_x_c; - if (flags & HAS_NEON) - av1_jnt_convolve_x = av1_jnt_convolve_x_neon; - av1_jnt_convolve_y = av1_jnt_convolve_y_c; - if (flags & HAS_NEON) - av1_jnt_convolve_y = av1_jnt_convolve_y_neon; av1_round_shift_array = av1_round_shift_array_c; if (flags & HAS_NEON) av1_round_shift_array = av1_round_shift_array_neon;
diff --git a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm index 48b16da..8542adc7 100644 --- a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm
@@ -1,5 +1,5 @@ ; -; Copyright (c) 2018, Alliance for Open Media. All rights reserved +; Copyright (c) 2019, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -22,6 +22,7 @@ CONFIG_BITSTREAM_DEBUG equ 0 CONFIG_COEFFICIENT_RANGE_CHECKING equ 0 CONFIG_COLLECT_INTER_MODE_RD_STATS equ 1 +CONFIG_COLLECT_PARTITION_STATS equ 0 CONFIG_COLLECT_RD_STATS equ 0 CONFIG_DEBUG equ 0 CONFIG_DENOISE equ 1 @@ -29,7 +30,6 @@ CONFIG_DIST_8X8 equ 0 CONFIG_ENTROPY_STATS equ 0 CONFIG_FILEOPTIONS equ 1 -CONFIG_FIX_GF_LENGTH equ 1 CONFIG_FP_MB_STATS equ 0 CONFIG_GCC equ 1 CONFIG_GCOV equ 0 @@ -47,12 +47,12 @@ CONFIG_OS_SUPPORT equ 1 CONFIG_PIC equ 0 CONFIG_RD_DEBUG equ 0 -CONFIG_REDUCED_ENCODER_BORDER equ 0 CONFIG_RUNTIME_CPU_DETECT equ 0 CONFIG_SHARED equ 0 CONFIG_SHARP_SETTINGS equ 0 CONFIG_SIZE_LIMIT equ 1 CONFIG_SPATIAL_RESAMPLING equ 1 +CONFIG_SPEED_STATS equ 0 CONFIG_STATIC equ 1 CONFIG_WEBM_IO equ 1 DECODE_HEIGHT_LIMIT equ 16384
diff --git a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h index eab20d4..b7ae810d 100644 --- a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h +++ b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 0 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/arm-neon/config/av1_rtcd.h b/third_party/libaom/source/config/linux/arm-neon/config/av1_rtcd.h index 3ae1e74..f66c096 100644 --- a/third_party/libaom/source/config/linux/arm-neon/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/arm-neon/config/av1_rtcd.h
@@ -251,6 +251,103 @@ ConvolveParams* conv_params); #define av1_convolve_y_sr av1_convolve_y_sr_neon +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d av1_dist_wtd_convolve_2d_neon + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_neon( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d_copy av1_dist_wtd_convolve_2d_copy_neon + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_x av1_dist_wtd_convolve_x_neon + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_y av1_dist_wtd_convolve_y_neon + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -448,6 +545,65 @@ int bd); #define av1_highbd_convolve_y_sr av1_highbd_convolve_y_sr_c +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d av1_highbd_dist_wtd_convolve_2d_c + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d_copy \ + av1_highbd_dist_wtd_convolve_2d_copy_c + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_x av1_highbd_dist_wtd_convolve_x_c + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_y av1_highbd_dist_wtd_convolve_y_c + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -539,63 +695,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d av1_highbd_jnt_convolve_2d_c - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d_copy av1_highbd_jnt_convolve_2d_copy_c - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_x av1_highbd_jnt_convolve_x_c - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_y av1_highbd_jnt_convolve_y_c - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -774,102 +873,6 @@ const TxfmParam* txfm_param); #define av1_inv_txfm_add av1_inv_txfm_add_neon -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d av1_jnt_convolve_2d_neon - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d_copy av1_jnt_convolve_2d_copy_neon - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_x av1_jnt_convolve_x_neon - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_y av1_jnt_convolve_y_neon - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_neon(int32_t* arr, int size, int bit); #define av1_round_shift_array av1_round_shift_array_neon
diff --git a/third_party/libaom/source/config/linux/arm/config/aom_config.asm b/third_party/libaom/source/config/linux/arm/config/aom_config.asm index 90f728e3..067da41 100644 --- a/third_party/libaom/source/config/linux/arm/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/arm/config/aom_config.asm
@@ -1,5 +1,5 @@ ; -; Copyright (c) 2018, Alliance for Open Media. All rights reserved +; Copyright (c) 2019, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -22,6 +22,7 @@ CONFIG_BITSTREAM_DEBUG equ 0 CONFIG_COEFFICIENT_RANGE_CHECKING equ 0 CONFIG_COLLECT_INTER_MODE_RD_STATS equ 1 +CONFIG_COLLECT_PARTITION_STATS equ 0 CONFIG_COLLECT_RD_STATS equ 0 CONFIG_DEBUG equ 0 CONFIG_DENOISE equ 1 @@ -29,7 +30,6 @@ CONFIG_DIST_8X8 equ 0 CONFIG_ENTROPY_STATS equ 0 CONFIG_FILEOPTIONS equ 1 -CONFIG_FIX_GF_LENGTH equ 1 CONFIG_FP_MB_STATS equ 0 CONFIG_GCC equ 1 CONFIG_GCOV equ 0 @@ -47,12 +47,12 @@ CONFIG_OS_SUPPORT equ 1 CONFIG_PIC equ 0 CONFIG_RD_DEBUG equ 0 -CONFIG_REDUCED_ENCODER_BORDER equ 0 CONFIG_RUNTIME_CPU_DETECT equ 0 CONFIG_SHARED equ 0 CONFIG_SHARP_SETTINGS equ 0 CONFIG_SIZE_LIMIT equ 1 CONFIG_SPATIAL_RESAMPLING equ 1 +CONFIG_SPEED_STATS equ 0 CONFIG_STATIC equ 1 CONFIG_WEBM_IO equ 1 DECODE_HEIGHT_LIMIT equ 16384
diff --git a/third_party/libaom/source/config/linux/arm/config/aom_config.h b/third_party/libaom/source/config/linux/arm/config/aom_config.h index 5fbc172..3d4c0a40 100644 --- a/third_party/libaom/source/config/linux/arm/config/aom_config.h +++ b/third_party/libaom/source/config/linux/arm/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 0 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/arm/config/av1_rtcd.h b/third_party/libaom/source/config/linux/arm/config/av1_rtcd.h index 6b685ca1..afce95f 100644 --- a/third_party/libaom/source/config/linux/arm/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/arm/config/av1_rtcd.h
@@ -186,6 +186,58 @@ ConvolveParams* conv_params); #define av1_convolve_y_sr av1_convolve_y_sr_c +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d av1_dist_wtd_convolve_2d_c + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d_copy av1_dist_wtd_convolve_2d_copy_c + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_x av1_dist_wtd_convolve_x_c + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_y av1_dist_wtd_convolve_y_c + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -383,6 +435,65 @@ int bd); #define av1_highbd_convolve_y_sr av1_highbd_convolve_y_sr_c +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d av1_highbd_dist_wtd_convolve_2d_c + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d_copy \ + av1_highbd_dist_wtd_convolve_2d_copy_c + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_x av1_highbd_dist_wtd_convolve_x_c + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_y av1_highbd_dist_wtd_convolve_y_c + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -474,63 +585,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d av1_highbd_jnt_convolve_2d_c - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d_copy av1_highbd_jnt_convolve_2d_copy_c - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_x av1_highbd_jnt_convolve_x_c - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_y av1_highbd_jnt_convolve_y_c - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -705,58 +759,6 @@ const TxfmParam* txfm_param); #define av1_inv_txfm_add av1_inv_txfm_add_c -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d av1_jnt_convolve_2d_c - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d_copy av1_jnt_convolve_2d_copy_c - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_x av1_jnt_convolve_x_c - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_y av1_jnt_convolve_y_c - void av1_round_shift_array_c(int32_t* arr, int size, int bit); #define av1_round_shift_array av1_round_shift_array_c
diff --git a/third_party/libaom/source/config/linux/arm64/config/aom_config.asm b/third_party/libaom/source/config/linux/arm64/config/aom_config.asm index 48b16da..8542adc7 100644 --- a/third_party/libaom/source/config/linux/arm64/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/arm64/config/aom_config.asm
@@ -1,5 +1,5 @@ ; -; Copyright (c) 2018, Alliance for Open Media. All rights reserved +; Copyright (c) 2019, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -22,6 +22,7 @@ CONFIG_BITSTREAM_DEBUG equ 0 CONFIG_COEFFICIENT_RANGE_CHECKING equ 0 CONFIG_COLLECT_INTER_MODE_RD_STATS equ 1 +CONFIG_COLLECT_PARTITION_STATS equ 0 CONFIG_COLLECT_RD_STATS equ 0 CONFIG_DEBUG equ 0 CONFIG_DENOISE equ 1 @@ -29,7 +30,6 @@ CONFIG_DIST_8X8 equ 0 CONFIG_ENTROPY_STATS equ 0 CONFIG_FILEOPTIONS equ 1 -CONFIG_FIX_GF_LENGTH equ 1 CONFIG_FP_MB_STATS equ 0 CONFIG_GCC equ 1 CONFIG_GCOV equ 0 @@ -47,12 +47,12 @@ CONFIG_OS_SUPPORT equ 1 CONFIG_PIC equ 0 CONFIG_RD_DEBUG equ 0 -CONFIG_REDUCED_ENCODER_BORDER equ 0 CONFIG_RUNTIME_CPU_DETECT equ 0 CONFIG_SHARED equ 0 CONFIG_SHARP_SETTINGS equ 0 CONFIG_SIZE_LIMIT equ 1 CONFIG_SPATIAL_RESAMPLING equ 1 +CONFIG_SPEED_STATS equ 0 CONFIG_STATIC equ 1 CONFIG_WEBM_IO equ 1 DECODE_HEIGHT_LIMIT equ 16384
diff --git a/third_party/libaom/source/config/linux/arm64/config/aom_config.h b/third_party/libaom/source/config/linux/arm64/config/aom_config.h index eab20d4..b7ae810d 100644 --- a/third_party/libaom/source/config/linux/arm64/config/aom_config.h +++ b/third_party/libaom/source/config/linux/arm64/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 0 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/arm64/config/av1_rtcd.h b/third_party/libaom/source/config/linux/arm64/config/av1_rtcd.h index 3ae1e74..f66c096 100644 --- a/third_party/libaom/source/config/linux/arm64/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/arm64/config/av1_rtcd.h
@@ -251,6 +251,103 @@ ConvolveParams* conv_params); #define av1_convolve_y_sr av1_convolve_y_sr_neon +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d av1_dist_wtd_convolve_2d_neon + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_neon( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d_copy av1_dist_wtd_convolve_2d_copy_neon + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_x av1_dist_wtd_convolve_x_neon + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_neon(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_y av1_dist_wtd_convolve_y_neon + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -448,6 +545,65 @@ int bd); #define av1_highbd_convolve_y_sr av1_highbd_convolve_y_sr_c +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d av1_highbd_dist_wtd_convolve_2d_c + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d_copy \ + av1_highbd_dist_wtd_convolve_2d_copy_c + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_x av1_highbd_dist_wtd_convolve_x_c + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_y av1_highbd_dist_wtd_convolve_y_c + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -539,63 +695,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d av1_highbd_jnt_convolve_2d_c - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d_copy av1_highbd_jnt_convolve_2d_copy_c - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_x av1_highbd_jnt_convolve_x_c - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_y av1_highbd_jnt_convolve_y_c - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -774,102 +873,6 @@ const TxfmParam* txfm_param); #define av1_inv_txfm_add av1_inv_txfm_add_neon -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d av1_jnt_convolve_2d_neon - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d_copy av1_jnt_convolve_2d_copy_neon - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_x av1_jnt_convolve_x_neon - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_neon(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_y av1_jnt_convolve_y_neon - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_neon(int32_t* arr, int size, int bit); #define av1_round_shift_array av1_round_shift_array_neon
diff --git a/third_party/libaom/source/config/linux/generic/config/aom_config.asm b/third_party/libaom/source/config/linux/generic/config/aom_config.asm index abe9d7b..b3fa59e 100644 --- a/third_party/libaom/source/config/linux/generic/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/generic/config/aom_config.asm
@@ -1,5 +1,5 @@ ; -; Copyright (c) 2018, Alliance for Open Media. All rights reserved +; Copyright (c) 2019, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -22,6 +22,7 @@ CONFIG_BITSTREAM_DEBUG equ 0 CONFIG_COEFFICIENT_RANGE_CHECKING equ 0 CONFIG_COLLECT_INTER_MODE_RD_STATS equ 1 +CONFIG_COLLECT_PARTITION_STATS equ 0 CONFIG_COLLECT_RD_STATS equ 0 CONFIG_DEBUG equ 0 CONFIG_DENOISE equ 1 @@ -29,7 +30,6 @@ CONFIG_DIST_8X8 equ 0 CONFIG_ENTROPY_STATS equ 0 CONFIG_FILEOPTIONS equ 1 -CONFIG_FIX_GF_LENGTH equ 1 CONFIG_FP_MB_STATS equ 0 CONFIG_GCC equ 1 CONFIG_GCOV equ 0 @@ -47,12 +47,12 @@ CONFIG_OS_SUPPORT equ 1 CONFIG_PIC equ 0 CONFIG_RD_DEBUG equ 0 -CONFIG_REDUCED_ENCODER_BORDER equ 0 CONFIG_RUNTIME_CPU_DETECT equ 1 CONFIG_SHARED equ 0 CONFIG_SHARP_SETTINGS equ 0 CONFIG_SIZE_LIMIT equ 1 CONFIG_SPATIAL_RESAMPLING equ 1 +CONFIG_SPEED_STATS equ 0 CONFIG_STATIC equ 1 CONFIG_WEBM_IO equ 1 DECODE_HEIGHT_LIMIT equ 16384
diff --git a/third_party/libaom/source/config/linux/generic/config/aom_config.h b/third_party/libaom/source/config/linux/generic/config/aom_config.h index eea3c8ba..dbc6750 100644 --- a/third_party/libaom/source/config/linux/generic/config/aom_config.h +++ b/third_party/libaom/source/config/linux/generic/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/generic/config/av1_rtcd.h b/third_party/libaom/source/config/linux/generic/config/av1_rtcd.h index e052171e..f3d7423 100644 --- a/third_party/libaom/source/config/linux/generic/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/generic/config/av1_rtcd.h
@@ -186,6 +186,58 @@ ConvolveParams* conv_params); #define av1_convolve_y_sr av1_convolve_y_sr_c +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d av1_dist_wtd_convolve_2d_c + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_2d_copy av1_dist_wtd_convolve_2d_copy_c + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_x av1_dist_wtd_convolve_x_c + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +#define av1_dist_wtd_convolve_y av1_dist_wtd_convolve_y_c + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -383,6 +435,65 @@ int bd); #define av1_highbd_convolve_y_sr av1_highbd_convolve_y_sr_c +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d av1_highbd_dist_wtd_convolve_2d_c + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_2d_copy \ + av1_highbd_dist_wtd_convolve_2d_copy_c + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_x av1_highbd_dist_wtd_convolve_x_c + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +#define av1_highbd_dist_wtd_convolve_y av1_highbd_dist_wtd_convolve_y_c + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -474,63 +585,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d av1_highbd_jnt_convolve_2d_c - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_2d_copy av1_highbd_jnt_convolve_2d_copy_c - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_x av1_highbd_jnt_convolve_x_c - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -#define av1_highbd_jnt_convolve_y av1_highbd_jnt_convolve_y_c - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -705,58 +759,6 @@ const TxfmParam* txfm_param); #define av1_inv_txfm_add av1_inv_txfm_add_c -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d av1_jnt_convolve_2d_c - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_2d_copy av1_jnt_convolve_2d_copy_c - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_x av1_jnt_convolve_x_c - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -#define av1_jnt_convolve_y av1_jnt_convolve_y_c - void av1_round_shift_array_c(int32_t* arr, int size, int bit); #define av1_round_shift_array av1_round_shift_array_c
diff --git a/third_party/libaom/source/config/linux/ia32/config/aom_config.asm b/third_party/libaom/source/config/linux/ia32/config/aom_config.asm index 35bae5e..4076e8c5 100644 --- a/third_party/libaom/source/config/linux/ia32/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/ia32/config/aom_config.asm
@@ -12,6 +12,7 @@ %define CONFIG_BITSTREAM_DEBUG 0 %define CONFIG_COEFFICIENT_RANGE_CHECKING 0 %define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +%define CONFIG_COLLECT_PARTITION_STATS 0 %define CONFIG_COLLECT_RD_STATS 0 %define CONFIG_DEBUG 0 %define CONFIG_DENOISE 1 @@ -19,7 +20,6 @@ %define CONFIG_DIST_8X8 0 %define CONFIG_ENTROPY_STATS 0 %define CONFIG_FILEOPTIONS 1 -%define CONFIG_FIX_GF_LENGTH 1 %define CONFIG_FP_MB_STATS 0 %define CONFIG_GCC 1 %define CONFIG_GCOV 0 @@ -37,12 +37,12 @@ %define CONFIG_OS_SUPPORT 1 %define CONFIG_PIC 0 %define CONFIG_RD_DEBUG 0 -%define CONFIG_REDUCED_ENCODER_BORDER 0 %define CONFIG_RUNTIME_CPU_DETECT 1 %define CONFIG_SHARED 0 %define CONFIG_SHARP_SETTINGS 0 %define CONFIG_SIZE_LIMIT 1 %define CONFIG_SPATIAL_RESAMPLING 1 +%define CONFIG_SPEED_STATS 0 %define CONFIG_STATIC 1 %define CONFIG_WEBM_IO 1 %define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/ia32/config/aom_config.h b/third_party/libaom/source/config/linux/ia32/config/aom_config.h index 5d5c1f7..9bf1f6fb 100644 --- a/third_party/libaom/source/config/linux/ia32/config/aom_config.h +++ b/third_party/libaom/source/config/linux/ia32/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/ia32/config/av1_rtcd.h b/third_party/libaom/source/config/linux/ia32/config/av1_rtcd.h index 2d23a44..53ec7317 100644 --- a/third_party/libaom/source/config/linux/ia32/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/ia32/config/av1_rtcd.h
@@ -469,6 +469,203 @@ const int subpel_y_q4, ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_ssse3(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_sse2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_avx2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d_copy)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_x)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_y)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -928,6 +1125,216 @@ ConvolveParams* conv_params, int bd); +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d_copy)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_x)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_y)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -970,28 +1377,7 @@ int dx, int dy, int bd); -void av1_highbd_dr_prediction_z2_avx2(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); -RTCD_EXTERN void (*av1_highbd_dr_prediction_z2)(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); +#define av1_highbd_dr_prediction_z2 av1_highbd_dr_prediction_z2_c void av1_highbd_dr_prediction_z3_c(uint16_t* dst, ptrdiff_t stride, @@ -1131,210 +1517,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_avx2( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d_copy)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_x)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_y)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -1611,201 +1793,6 @@ int stride, const TxfmParam* txfm_param); -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_ssse3(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d_copy)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_x)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_y)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_sse4_1(int32_t* arr, int size, int bit); RTCD_EXTERN void (*av1_round_shift_array)(int32_t* arr, int size, int bit); @@ -2229,6 +2216,20 @@ av1_convolve_y_sr = av1_convolve_y_sr_sse2; if (flags & HAS_AVX2) av1_convolve_y_sr = av1_convolve_y_sr_avx2; + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_sse2; + if (flags & HAS_SSSE3) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_ssse3; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_avx2; + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_avx2; + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_avx2; + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_avx2; av1_dr_prediction_z1 = av1_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_dr_prediction_z1 = av1_dr_prediction_z1_avx2; @@ -2271,12 +2272,31 @@ av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_ssse3; if (flags & HAS_AVX2) av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_avx2; + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_avx2; + av1_highbd_dist_wtd_convolve_2d_copy = av1_highbd_dist_wtd_convolve_2d_copy_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_avx2; + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_avx2; + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_avx2; av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_avx2; - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_c; - if (flags & HAS_AVX2) - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_avx2; av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_avx2; @@ -2303,26 +2323,6 @@ av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_c; if (flags & HAS_SSE4_1) av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_sse4_1; - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_avx2; - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_avx2; - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_avx2; - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_avx2; av1_highbd_warp_affine = av1_highbd_warp_affine_c; if (flags & HAS_SSE4_1) av1_highbd_warp_affine = av1_highbd_warp_affine_sse4_1; @@ -2344,20 +2344,6 @@ av1_inv_txfm_add = av1_inv_txfm_add_ssse3; if (flags & HAS_AVX2) av1_inv_txfm_add = av1_inv_txfm_add_avx2; - av1_jnt_convolve_2d = av1_jnt_convolve_2d_sse2; - if (flags & HAS_SSSE3) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_ssse3; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_avx2; - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_avx2; - av1_jnt_convolve_x = av1_jnt_convolve_x_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_x = av1_jnt_convolve_x_avx2; - av1_jnt_convolve_y = av1_jnt_convolve_y_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_y = av1_jnt_convolve_y_avx2; av1_round_shift_array = av1_round_shift_array_c; if (flags & HAS_SSE4_1) av1_round_shift_array = av1_round_shift_array_sse4_1;
diff --git a/third_party/libaom/source/config/linux/x64/config/aom_config.asm b/third_party/libaom/source/config/linux/x64/config/aom_config.asm index 2367d6a..6c42e0b9e 100644 --- a/third_party/libaom/source/config/linux/x64/config/aom_config.asm +++ b/third_party/libaom/source/config/linux/x64/config/aom_config.asm
@@ -12,6 +12,7 @@ %define CONFIG_BITSTREAM_DEBUG 0 %define CONFIG_COEFFICIENT_RANGE_CHECKING 0 %define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +%define CONFIG_COLLECT_PARTITION_STATS 0 %define CONFIG_COLLECT_RD_STATS 0 %define CONFIG_DEBUG 0 %define CONFIG_DENOISE 1 @@ -19,7 +20,6 @@ %define CONFIG_DIST_8X8 0 %define CONFIG_ENTROPY_STATS 0 %define CONFIG_FILEOPTIONS 1 -%define CONFIG_FIX_GF_LENGTH 1 %define CONFIG_FP_MB_STATS 0 %define CONFIG_GCC 1 %define CONFIG_GCOV 0 @@ -37,12 +37,12 @@ %define CONFIG_OS_SUPPORT 1 %define CONFIG_PIC 0 %define CONFIG_RD_DEBUG 0 -%define CONFIG_REDUCED_ENCODER_BORDER 0 %define CONFIG_RUNTIME_CPU_DETECT 1 %define CONFIG_SHARED 0 %define CONFIG_SHARP_SETTINGS 0 %define CONFIG_SIZE_LIMIT 1 %define CONFIG_SPATIAL_RESAMPLING 1 +%define CONFIG_SPEED_STATS 0 %define CONFIG_STATIC 1 %define CONFIG_WEBM_IO 1 %define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/x64/config/aom_config.h b/third_party/libaom/source/config/linux/x64/config/aom_config.h index 0774c770..7f157d8 100644 --- a/third_party/libaom/source/config/linux/x64/config/aom_config.h +++ b/third_party/libaom/source/config/linux/x64/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 1 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/linux/x64/config/av1_rtcd.h b/third_party/libaom/source/config/linux/x64/config/av1_rtcd.h index ea802a3..48954cd 100644 --- a/third_party/libaom/source/config/linux/x64/config/av1_rtcd.h +++ b/third_party/libaom/source/config/linux/x64/config/av1_rtcd.h
@@ -469,6 +469,203 @@ const int subpel_y_q4, ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_ssse3(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_sse2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_avx2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d_copy)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_x)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_y)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -961,6 +1158,216 @@ ConvolveParams* conv_params, int bd); +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d_copy)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_x)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_y)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -1003,28 +1410,7 @@ int dx, int dy, int bd); -void av1_highbd_dr_prediction_z2_avx2(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); -RTCD_EXTERN void (*av1_highbd_dr_prediction_z2)(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); +#define av1_highbd_dr_prediction_z2 av1_highbd_dr_prediction_z2_c void av1_highbd_dr_prediction_z3_c(uint16_t* dst, ptrdiff_t stride, @@ -1164,210 +1550,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_avx2( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d_copy)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_x)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_y)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -1644,201 +1826,6 @@ int stride, const TxfmParam* txfm_param); -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_ssse3(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d_copy)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_x)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_y)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_sse4_1(int32_t* arr, int size, int bit); RTCD_EXTERN void (*av1_round_shift_array)(int32_t* arr, int size, int bit); @@ -2262,6 +2249,20 @@ av1_convolve_y_sr = av1_convolve_y_sr_sse2; if (flags & HAS_AVX2) av1_convolve_y_sr = av1_convolve_y_sr_avx2; + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_sse2; + if (flags & HAS_SSSE3) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_ssse3; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_avx2; + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_avx2; + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_avx2; + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_avx2; av1_dr_prediction_z1 = av1_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_dr_prediction_z1 = av1_dr_prediction_z1_avx2; @@ -2304,12 +2305,31 @@ av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_ssse3; if (flags & HAS_AVX2) av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_avx2; + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_avx2; + av1_highbd_dist_wtd_convolve_2d_copy = av1_highbd_dist_wtd_convolve_2d_copy_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_avx2; + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_avx2; + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_avx2; av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_avx2; - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_c; - if (flags & HAS_AVX2) - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_avx2; av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_avx2; @@ -2336,26 +2356,6 @@ av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_c; if (flags & HAS_SSE4_1) av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_sse4_1; - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_avx2; - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_avx2; - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_avx2; - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_avx2; av1_highbd_warp_affine = av1_highbd_warp_affine_c; if (flags & HAS_SSE4_1) av1_highbd_warp_affine = av1_highbd_warp_affine_sse4_1; @@ -2377,20 +2377,6 @@ av1_inv_txfm_add = av1_inv_txfm_add_ssse3; if (flags & HAS_AVX2) av1_inv_txfm_add = av1_inv_txfm_add_avx2; - av1_jnt_convolve_2d = av1_jnt_convolve_2d_sse2; - if (flags & HAS_SSSE3) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_ssse3; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_avx2; - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_avx2; - av1_jnt_convolve_x = av1_jnt_convolve_x_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_x = av1_jnt_convolve_x_avx2; - av1_jnt_convolve_y = av1_jnt_convolve_y_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_y = av1_jnt_convolve_y_avx2; av1_round_shift_array = av1_round_shift_array_c; if (flags & HAS_SSE4_1) av1_round_shift_array = av1_round_shift_array_sse4_1;
diff --git a/third_party/libaom/source/config/win/ia32/config/aom_config.asm b/third_party/libaom/source/config/win/ia32/config/aom_config.asm index 4e3946b..762283c 100644 --- a/third_party/libaom/source/config/win/ia32/config/aom_config.asm +++ b/third_party/libaom/source/config/win/ia32/config/aom_config.asm
@@ -12,6 +12,7 @@ %define CONFIG_BITSTREAM_DEBUG 0 %define CONFIG_COEFFICIENT_RANGE_CHECKING 0 %define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +%define CONFIG_COLLECT_PARTITION_STATS 0 %define CONFIG_COLLECT_RD_STATS 0 %define CONFIG_DEBUG 0 %define CONFIG_DENOISE 1 @@ -19,7 +20,6 @@ %define CONFIG_DIST_8X8 0 %define CONFIG_ENTROPY_STATS 0 %define CONFIG_FILEOPTIONS 1 -%define CONFIG_FIX_GF_LENGTH 1 %define CONFIG_FP_MB_STATS 0 %define CONFIG_GCC 0 %define CONFIG_GCOV 0 @@ -37,12 +37,12 @@ %define CONFIG_OS_SUPPORT 1 %define CONFIG_PIC 0 %define CONFIG_RD_DEBUG 0 -%define CONFIG_REDUCED_ENCODER_BORDER 0 %define CONFIG_RUNTIME_CPU_DETECT 1 %define CONFIG_SHARED 0 %define CONFIG_SHARP_SETTINGS 0 %define CONFIG_SIZE_LIMIT 1 %define CONFIG_SPATIAL_RESAMPLING 1 +%define CONFIG_SPEED_STATS 0 %define CONFIG_STATIC 1 %define CONFIG_WEBM_IO 1 %define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/win/ia32/config/aom_config.h b/third_party/libaom/source/config/win/ia32/config/aom_config.h index 42238c6c..7f1e956 100644 --- a/third_party/libaom/source/config/win/ia32/config/aom_config.h +++ b/third_party/libaom/source/config/win/ia32/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 0 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/win/ia32/config/av1_rtcd.h b/third_party/libaom/source/config/win/ia32/config/av1_rtcd.h index 2d23a44..53ec7317 100644 --- a/third_party/libaom/source/config/win/ia32/config/av1_rtcd.h +++ b/third_party/libaom/source/config/win/ia32/config/av1_rtcd.h
@@ -469,6 +469,203 @@ const int subpel_y_q4, ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_ssse3(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_sse2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_avx2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d_copy)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_x)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_y)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -928,6 +1125,216 @@ ConvolveParams* conv_params, int bd); +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d_copy)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_x)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_y)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -970,28 +1377,7 @@ int dx, int dy, int bd); -void av1_highbd_dr_prediction_z2_avx2(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); -RTCD_EXTERN void (*av1_highbd_dr_prediction_z2)(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); +#define av1_highbd_dr_prediction_z2 av1_highbd_dr_prediction_z2_c void av1_highbd_dr_prediction_z3_c(uint16_t* dst, ptrdiff_t stride, @@ -1131,210 +1517,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_avx2( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d_copy)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_x)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_y)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -1611,201 +1793,6 @@ int stride, const TxfmParam* txfm_param); -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_ssse3(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d_copy)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_x)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_y)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_sse4_1(int32_t* arr, int size, int bit); RTCD_EXTERN void (*av1_round_shift_array)(int32_t* arr, int size, int bit); @@ -2229,6 +2216,20 @@ av1_convolve_y_sr = av1_convolve_y_sr_sse2; if (flags & HAS_AVX2) av1_convolve_y_sr = av1_convolve_y_sr_avx2; + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_sse2; + if (flags & HAS_SSSE3) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_ssse3; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_avx2; + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_avx2; + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_avx2; + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_avx2; av1_dr_prediction_z1 = av1_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_dr_prediction_z1 = av1_dr_prediction_z1_avx2; @@ -2271,12 +2272,31 @@ av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_ssse3; if (flags & HAS_AVX2) av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_avx2; + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_avx2; + av1_highbd_dist_wtd_convolve_2d_copy = av1_highbd_dist_wtd_convolve_2d_copy_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_avx2; + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_avx2; + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_avx2; av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_avx2; - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_c; - if (flags & HAS_AVX2) - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_avx2; av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_avx2; @@ -2303,26 +2323,6 @@ av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_c; if (flags & HAS_SSE4_1) av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_sse4_1; - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_avx2; - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_avx2; - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_avx2; - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_avx2; av1_highbd_warp_affine = av1_highbd_warp_affine_c; if (flags & HAS_SSE4_1) av1_highbd_warp_affine = av1_highbd_warp_affine_sse4_1; @@ -2344,20 +2344,6 @@ av1_inv_txfm_add = av1_inv_txfm_add_ssse3; if (flags & HAS_AVX2) av1_inv_txfm_add = av1_inv_txfm_add_avx2; - av1_jnt_convolve_2d = av1_jnt_convolve_2d_sse2; - if (flags & HAS_SSSE3) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_ssse3; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_avx2; - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_avx2; - av1_jnt_convolve_x = av1_jnt_convolve_x_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_x = av1_jnt_convolve_x_avx2; - av1_jnt_convolve_y = av1_jnt_convolve_y_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_y = av1_jnt_convolve_y_avx2; av1_round_shift_array = av1_round_shift_array_c; if (flags & HAS_SSE4_1) av1_round_shift_array = av1_round_shift_array_sse4_1;
diff --git a/third_party/libaom/source/config/win/x64/config/aom_config.asm b/third_party/libaom/source/config/win/x64/config/aom_config.asm index 7b2dd82..79b53935 100644 --- a/third_party/libaom/source/config/win/x64/config/aom_config.asm +++ b/third_party/libaom/source/config/win/x64/config/aom_config.asm
@@ -12,6 +12,7 @@ %define CONFIG_BITSTREAM_DEBUG 0 %define CONFIG_COEFFICIENT_RANGE_CHECKING 0 %define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +%define CONFIG_COLLECT_PARTITION_STATS 0 %define CONFIG_COLLECT_RD_STATS 0 %define CONFIG_DEBUG 0 %define CONFIG_DENOISE 1 @@ -19,7 +20,6 @@ %define CONFIG_DIST_8X8 0 %define CONFIG_ENTROPY_STATS 0 %define CONFIG_FILEOPTIONS 1 -%define CONFIG_FIX_GF_LENGTH 1 %define CONFIG_FP_MB_STATS 0 %define CONFIG_GCC 0 %define CONFIG_GCOV 0 @@ -37,12 +37,12 @@ %define CONFIG_OS_SUPPORT 1 %define CONFIG_PIC 0 %define CONFIG_RD_DEBUG 0 -%define CONFIG_REDUCED_ENCODER_BORDER 0 %define CONFIG_RUNTIME_CPU_DETECT 1 %define CONFIG_SHARED 0 %define CONFIG_SHARP_SETTINGS 0 %define CONFIG_SIZE_LIMIT 1 %define CONFIG_SPATIAL_RESAMPLING 1 +%define CONFIG_SPEED_STATS 0 %define CONFIG_STATIC 1 %define CONFIG_WEBM_IO 1 %define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/win/x64/config/aom_config.h b/third_party/libaom/source/config/win/x64/config/aom_config.h index d7c6509d..7d63cd20 100644 --- a/third_party/libaom/source/config/win/x64/config/aom_config.h +++ b/third_party/libaom/source/config/win/x64/config/aom_config.h
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Alliance for Open Media. All rights reserved + * Copyright (c) 2019, Alliance for Open Media. All rights reserved * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License @@ -24,6 +24,7 @@ #define CONFIG_BITSTREAM_DEBUG 0 #define CONFIG_COEFFICIENT_RANGE_CHECKING 0 #define CONFIG_COLLECT_INTER_MODE_RD_STATS 1 +#define CONFIG_COLLECT_PARTITION_STATS 0 #define CONFIG_COLLECT_RD_STATS 0 #define CONFIG_DEBUG 0 #define CONFIG_DENOISE 1 @@ -31,7 +32,6 @@ #define CONFIG_DIST_8X8 0 #define CONFIG_ENTROPY_STATS 0 #define CONFIG_FILEOPTIONS 1 -#define CONFIG_FIX_GF_LENGTH 1 #define CONFIG_FP_MB_STATS 0 #define CONFIG_GCC 0 #define CONFIG_GCOV 0 @@ -49,12 +49,12 @@ #define CONFIG_OS_SUPPORT 1 #define CONFIG_PIC 0 #define CONFIG_RD_DEBUG 0 -#define CONFIG_REDUCED_ENCODER_BORDER 0 #define CONFIG_RUNTIME_CPU_DETECT 1 #define CONFIG_SHARED 0 #define CONFIG_SHARP_SETTINGS 0 #define CONFIG_SIZE_LIMIT 1 #define CONFIG_SPATIAL_RESAMPLING 1 +#define CONFIG_SPEED_STATS 0 #define CONFIG_STATIC 1 #define CONFIG_WEBM_IO 1 #define DECODE_HEIGHT_LIMIT 16384
diff --git a/third_party/libaom/source/config/win/x64/config/av1_rtcd.h b/third_party/libaom/source/config/win/x64/config/av1_rtcd.h index ea802a3..48954cd 100644 --- a/third_party/libaom/source/config/win/x64/config/av1_rtcd.h +++ b/third_party/libaom/source/config/win/x64/config/av1_rtcd.h
@@ -469,6 +469,203 @@ const int subpel_y_q4, ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_ssse3(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_2d_copy_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_sse2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_2d_copy_avx2( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_2d_copy)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_x_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_x_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_x)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + +void av1_dist_wtd_convolve_y_c(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_sse2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +void av1_dist_wtd_convolve_y_avx2(const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); +RTCD_EXTERN void (*av1_dist_wtd_convolve_y)( + const uint8_t* src, + int src_stride, + uint8_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params); + void av1_dr_prediction_z1_c(uint8_t* dst, ptrdiff_t stride, int bw, @@ -961,6 +1158,216 @@ ConvolveParams* conv_params, int bd); +void av1_highbd_dist_wtd_convolve_2d_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_2d_copy_c( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_2d_copy_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_2d_copy)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_x_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_x_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_x)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + +void av1_highbd_dist_wtd_convolve_y_c(const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_sse4_1( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +void av1_highbd_dist_wtd_convolve_y_avx2( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); +RTCD_EXTERN void (*av1_highbd_dist_wtd_convolve_y)( + const uint16_t* src, + int src_stride, + uint16_t* dst, + int dst_stride, + int w, + int h, + const InterpFilterParams* filter_params_x, + const InterpFilterParams* filter_params_y, + const int subpel_x_q4, + const int subpel_y_q4, + ConvolveParams* conv_params, + int bd); + void av1_highbd_dr_prediction_z1_c(uint16_t* dst, ptrdiff_t stride, int bw, @@ -1003,28 +1410,7 @@ int dx, int dy, int bd); -void av1_highbd_dr_prediction_z2_avx2(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); -RTCD_EXTERN void (*av1_highbd_dr_prediction_z2)(uint16_t* dst, - ptrdiff_t stride, - int bw, - int bh, - const uint16_t* above, - const uint16_t* left, - int upsample_above, - int upsample_left, - int dx, - int dy, - int bd); +#define av1_highbd_dr_prediction_z2 av1_highbd_dr_prediction_z2_c void av1_highbd_dr_prediction_z3_c(uint16_t* dst, ptrdiff_t stride, @@ -1164,210 +1550,6 @@ int bd); #define av1_highbd_iwht4x4_1_add av1_highbd_iwht4x4_1_add_c -void av1_highbd_jnt_convolve_2d_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_2d_copy_c( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_sse4_1( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_2d_copy_avx2( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_2d_copy)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_x_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_x_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_x)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - -void av1_highbd_jnt_convolve_y_c(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_sse4_1(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -void av1_highbd_jnt_convolve_y_avx2(const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); -RTCD_EXTERN void (*av1_highbd_jnt_convolve_y)( - const uint16_t* src, - int src_stride, - uint16_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params, - int bd); - void av1_highbd_warp_affine_c(const int32_t* mat, const uint16_t* ref, int width, @@ -1644,201 +1826,6 @@ int stride, const TxfmParam* txfm_param); -void av1_jnt_convolve_2d_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_ssse3(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_2d_copy_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_2d_copy_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_2d_copy)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_x_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_x_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_x)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - -void av1_jnt_convolve_y_c(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_sse2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -void av1_jnt_convolve_y_avx2(const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); -RTCD_EXTERN void (*av1_jnt_convolve_y)( - const uint8_t* src, - int src_stride, - uint8_t* dst, - int dst_stride, - int w, - int h, - const InterpFilterParams* filter_params_x, - const InterpFilterParams* filter_params_y, - const int subpel_x_q4, - const int subpel_y_q4, - ConvolveParams* conv_params); - void av1_round_shift_array_c(int32_t* arr, int size, int bit); void av1_round_shift_array_sse4_1(int32_t* arr, int size, int bit); RTCD_EXTERN void (*av1_round_shift_array)(int32_t* arr, int size, int bit); @@ -2262,6 +2249,20 @@ av1_convolve_y_sr = av1_convolve_y_sr_sse2; if (flags & HAS_AVX2) av1_convolve_y_sr = av1_convolve_y_sr_avx2; + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_sse2; + if (flags & HAS_SSSE3) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_ssse3; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d = av1_dist_wtd_convolve_2d_avx2; + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_2d_copy = av1_dist_wtd_convolve_2d_copy_avx2; + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_x = av1_dist_wtd_convolve_x_avx2; + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_sse2; + if (flags & HAS_AVX2) + av1_dist_wtd_convolve_y = av1_dist_wtd_convolve_y_avx2; av1_dr_prediction_z1 = av1_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_dr_prediction_z1 = av1_dr_prediction_z1_avx2; @@ -2304,12 +2305,31 @@ av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_ssse3; if (flags & HAS_AVX2) av1_highbd_convolve_y_sr = av1_highbd_convolve_y_sr_avx2; + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d = av1_highbd_dist_wtd_convolve_2d_avx2; + av1_highbd_dist_wtd_convolve_2d_copy = av1_highbd_dist_wtd_convolve_2d_copy_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_2d_copy = + av1_highbd_dist_wtd_convolve_2d_copy_avx2; + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_x = av1_highbd_dist_wtd_convolve_x_avx2; + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_c; + if (flags & HAS_SSE4_1) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_sse4_1; + if (flags & HAS_AVX2) + av1_highbd_dist_wtd_convolve_y = av1_highbd_dist_wtd_convolve_y_avx2; av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z1 = av1_highbd_dr_prediction_z1_avx2; - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_c; - if (flags & HAS_AVX2) - av1_highbd_dr_prediction_z2 = av1_highbd_dr_prediction_z2_avx2; av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_c; if (flags & HAS_AVX2) av1_highbd_dr_prediction_z3 = av1_highbd_dr_prediction_z3_avx2; @@ -2336,26 +2356,6 @@ av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_c; if (flags & HAS_SSE4_1) av1_highbd_inv_txfm_add_8x8 = av1_highbd_inv_txfm_add_8x8_sse4_1; - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d = av1_highbd_jnt_convolve_2d_avx2; - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_2d_copy = av1_highbd_jnt_convolve_2d_copy_avx2; - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_x = av1_highbd_jnt_convolve_x_avx2; - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_c; - if (flags & HAS_SSE4_1) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_sse4_1; - if (flags & HAS_AVX2) - av1_highbd_jnt_convolve_y = av1_highbd_jnt_convolve_y_avx2; av1_highbd_warp_affine = av1_highbd_warp_affine_c; if (flags & HAS_SSE4_1) av1_highbd_warp_affine = av1_highbd_warp_affine_sse4_1; @@ -2377,20 +2377,6 @@ av1_inv_txfm_add = av1_inv_txfm_add_ssse3; if (flags & HAS_AVX2) av1_inv_txfm_add = av1_inv_txfm_add_avx2; - av1_jnt_convolve_2d = av1_jnt_convolve_2d_sse2; - if (flags & HAS_SSSE3) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_ssse3; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d = av1_jnt_convolve_2d_avx2; - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_2d_copy = av1_jnt_convolve_2d_copy_avx2; - av1_jnt_convolve_x = av1_jnt_convolve_x_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_x = av1_jnt_convolve_x_avx2; - av1_jnt_convolve_y = av1_jnt_convolve_y_sse2; - if (flags & HAS_AVX2) - av1_jnt_convolve_y = av1_jnt_convolve_y_avx2; av1_round_shift_array = av1_round_shift_array_c; if (flags & HAS_SSE4_1) av1_round_shift_array = av1_round_shift_array_sse4_1;
diff --git a/third_party/pffft/BUILD.gn b/third_party/pffft/BUILD.gn index ff7e965..0adde881 100644 --- a/third_party/pffft/BUILD.gn +++ b/third_party/pffft/BUILD.gn
@@ -85,9 +85,7 @@ # This target must be used only for testing and benchmark purposes. static_library("fftpack") { testonly = true - configs += [ - ":common_config", - ] + configs += [ ":common_config" ] sources = [ "src/fftpack.c", "src/fftpack.h",
diff --git a/third_party/pffft/README.chromium b/third_party/pffft/README.chromium index f3931a3..974ebcd4 100644 --- a/third_party/pffft/README.chromium +++ b/third_party/pffft/README.chromium
@@ -12,6 +12,29 @@ Description: PFFFT does 1D Fast Fourier Transforms, of single precision real and complex vectors. It tries do it fast, it tries to be correct, and it tries to be small. Computations do take advantage of SSE1 instructions on x86 cpus, Altivec on powerpc cpus, and NEON on ARM cpus. +Note about the structure of //third_party/pffft: +The imported third party code (with patches applied, see "Local Modifications") lives in //third_party/pffft/src/, whereas the fuzzer and unit test code lives in //third_party/pffft. + +Remarks on the C library and recommendations: +- The C API is unsafe: input and output arrays are passed as pointers without size +- When a scratch array is not provided (e.g., pffft_transform(/*work=*/nullptr)), VLA is used + * MSVC: stack or heap depending on size + * other compilers: always on the stack +- According to the PFFFT documentation, when SIMD is enabled, input, output and scratch arrays must be allocated as aligned memory (16-byte boundary on intel and PowerPC); + as long as the SIMD extension API requirements are met, one may use different options (and not only pffft_aligned_malloc) such as std::vector +- It is strongly recommended that a C++ wrapper is used to + (i) avoid pointer arguments (e.g., using absl::Span) + (ii) pre-allocate the scratch buffer for large FFT sizes + (iii) provide a function to check if an integer is a supported FFT size + Local Modifications: + +Local modifications live in //third_party/pffft/patches/. To apply them run: +$ for patch in third_party/pffft/patches/*; do patch -s -p1 < $patch; done + +In case of conflict, update those patches accordingly and save them back in //third_party/pffft/patches/. + * 01-rmv_printf.diff: remove printf and stop including stdio.h * 02-decl_validate_simd.diff: declare validate_pffft_simd() in pffft.h + * 03-malloca.diff: replace _alloca (deprecated) with _malloca (MSVC case only) + cleanup + * 04-fix_ptr_cast.diff: avoid MSVC warnings by fixing pointer cast
diff --git a/third_party/pffft/patches/03-malloca.diff b/third_party/pffft/patches/03-malloca.diff new file mode 100644 index 0000000..ba7c4cfc --- /dev/null +++ b/third_party/pffft/patches/03-malloca.diff
@@ -0,0 +1,82 @@ +diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c +index 776f564aa28c..643836626c0f 100644 +--- a/third_party/pffft/src/pffft.c ++++ b/third_party/pffft/src/pffft.c +@@ -59,7 +59,6 @@ + + #include "pffft.h" + #include <stdlib.h> +-// #include <stdio.h> + #include <math.h> + #include <assert.h> + +@@ -75,11 +74,14 @@ + # define NEVER_INLINE(return_type) return_type __attribute__ ((noinline)) + # define RESTRICT __restrict + # define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ varname__[size__]; ++# define VLA_ARRAY_ON_STACK_FREE(varname__) + #elif defined(COMPILER_MSVC) ++#include <malloc.h> + # define ALWAYS_INLINE(return_type) __forceinline return_type + # define NEVER_INLINE(return_type) __declspec(noinline) return_type + # define RESTRICT __restrict +-# define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ *varname__ = (type__*)_alloca(size__ * sizeof(type__)) ++# define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ *varname__ = (type__*)_malloca(size__ * sizeof(type__)) ++# define VLA_ARRAY_ON_STACK_FREE(varname__) _freea(varname__) + #endif + + +@@ -219,35 +221,24 @@ void validate_pffft_simd() { + memcpy(a3.f, f+12, 4*sizeof(float)); + + t = a0; u = a1; t.v = VZERO(); +- // printf("VZERO=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); + assertv4(t, 0, 0, 0, 0); + t.v = VADD(a1.v, a2.v); +- // printf("VADD(4:7,8:11)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); + assertv4(t, 12, 14, 16, 18); + t.v = VMUL(a1.v, a2.v); +- // printf("VMUL(4:7,8:11)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); + assertv4(t, 32, 45, 60, 77); + t.v = VMADD(a1.v, a2.v,a0.v); +- // printf("VMADD(4:7,8:11,0:3)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); + assertv4(t, 32, 46, 62, 80); + + INTERLEAVE2(a1.v,a2.v,t.v,u.v); +- // printf("INTERLEAVE2(4:7,8:11)=[%2g %2g %2g %2g] [%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3], u.f[0], u.f[1], u.f[2], u.f[3]); + assertv4(t, 4, 8, 5, 9); assertv4(u, 6, 10, 7, 11); + UNINTERLEAVE2(a1.v,a2.v,t.v,u.v); +- // printf("UNINTERLEAVE2(4:7,8:11)=[%2g %2g %2g %2g] [%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3], u.f[0], u.f[1], u.f[2], u.f[3]); + assertv4(t, 4, 6, 8, 10); assertv4(u, 5, 7, 9, 11); + + t.v=LD_PS1(f[15]); +- // printf("LD_PS1(15)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); + assertv4(t, 15, 15, 15, 15); + t.v = VSWAPHL(a1.v, a2.v); +- // printf("VSWAPHL(4:7,8:11)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); + assertv4(t, 8, 9, 6, 7); + VTRANSPOSE4(a0.v, a1.v, a2.v, a3.v); +- // printf("VTRANSPOSE4(0:3,4:7,8:11,12:15)=[%2g %2g %2g %2g] [%2g %2g %2g %2g] [%2g %2g %2g %2g] [%2g %2g %2g %2g]\n", +- // a0.f[0], a0.f[1], a0.f[2], a0.f[3], a1.f[0], a1.f[1], a1.f[2], a1.f[3], +- // a2.f[0], a2.f[1], a2.f[2], a2.f[3], a3.f[0], a3.f[1], a3.f[2], a3.f[3]); + assertv4(a0, 0, 4, 8, 12); assertv4(a1, 1, 5, 9, 13); assertv4(a2, 2, 6, 10, 14); assertv4(a3, 3, 7, 11, 15); + } + #endif //!PFFFT_SIMD_DISABLE +@@ -1674,6 +1665,8 @@ void pffft_transform_internal(PFFFT_Setup *setup, const float *finput, float *fo + ib = !ib; + } + assert(buff[ib] == voutput); ++ ++ VLA_ARRAY_ON_STACK_FREE(scratch_on_stack); + } + + void pffft_zconvolve_accumulate(PFFFT_Setup *s, const float *a, const float *b, float *ab, float scaling) { +@@ -1851,6 +1844,8 @@ void pffft_transform_internal_nosimd(PFFFT_Setup *setup, const float *input, flo + ib = !ib; + } + assert(buff[ib] == output); ++ ++ VLA_ARRAY_ON_STACK_FREE(scratch_on_stack); + } + + #define pffft_zconvolve_accumulate_nosimd pffft_zconvolve_accumulate
diff --git a/third_party/pffft/patches/04-fix_ptr_cast.diff b/third_party/pffft/patches/04-fix_ptr_cast.diff new file mode 100644 index 0000000..ae8ec0c9 --- /dev/null +++ b/third_party/pffft/patches/04-fix_ptr_cast.diff
@@ -0,0 +1,48 @@ +diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c +index 643836626c0f..3033e61b813e 100644 +--- a/third_party/pffft/src/pffft.c ++++ b/third_party/pffft/src/pffft.c +@@ -58,6 +58,7 @@ + */ + + #include "pffft.h" ++#include <stdint.h> + #include <stdlib.h> + #include <math.h> + #include <assert.h> +@@ -125,7 +126,7 @@ inline v4sf ld_ps1(const float *p) { v4sf v=vec_lde(0,p); return vec_splat(vec_p + x3 = vec_mergel(y1, y3); \ + } + # define VSWAPHL(a,b) vec_perm(a,b, (vector unsigned char)(16,17,18,19,20,21,22,23,8,9,10,11,12,13,14,15)) +-# define VALIGNED(ptr) ((((long)(ptr)) & 0xF) == 0) ++# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0xF) == 0) + + /* + SSE1 support macros +@@ -145,7 +146,7 @@ typedef __m128 v4sf; + # define UNINTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(2,0,2,0)); out2 = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(3,1,3,1)); out1 = tmp__; } + # define VTRANSPOSE4(x0,x1,x2,x3) _MM_TRANSPOSE4_PS(x0,x1,x2,x3) + # define VSWAPHL(a,b) _mm_shuffle_ps(b, a, _MM_SHUFFLE(3,2,1,0)) +-# define VALIGNED(ptr) ((((long)(ptr)) & 0xF) == 0) ++# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0xF) == 0) + + /* + ARM NEON support macros +@@ -172,7 +173,7 @@ typedef float32x4_t v4sf; + // marginally faster version + //# define VTRANSPOSE4(x0,x1,x2,x3) { asm("vtrn.32 %q0, %q1;\n vtrn.32 %q2,%q3\n vswp %f0,%e2\n vswp %f1,%e3" : "+w"(x0), "+w"(x1), "+w"(x2), "+w"(x3)::); } + # define VSWAPHL(a,b) vcombine_f32(vget_low_f32(b), vget_high_f32(a)) +-# define VALIGNED(ptr) ((((long)(ptr)) & 0x3) == 0) ++# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0x3) == 0) + #else + # if !defined(PFFFT_SIMD_DISABLE) + # warning "building with simd disabled !\n"; +@@ -190,7 +191,7 @@ typedef float v4sf; + # define VMADD(a,b,c) ((a)*(b)+(c)) + # define VSUB(a,b) ((a)-(b)) + # define LD_PS1(p) (p) +-# define VALIGNED(ptr) ((((long)(ptr)) & 0x3) == 0) ++# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0x3) == 0) + #endif + + // shortcuts for complex multiplcations
diff --git a/third_party/pffft/pffft_unittest.cc b/third_party/pffft/pffft_unittest.cc index 3f85c16..5597234 100644 --- a/third_party/pffft/pffft_unittest.cc +++ b/third_party/pffft/pffft_unittest.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> #include <cmath> +#include "testing/gtest/include/gtest/gtest-death-test.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/pffft/src/fftpack.h" #include "third_party/pffft/src/pffft.h" -#define MAX(x, y) ((x) > (y) ? (x) : (y)) - namespace pffft { namespace test { namespace { @@ -68,16 +68,16 @@ } for (k = 0; k < num_floats; ++k) { - ref_max = MAX(ref_max, fabs(ref[k])); + ref_max = std::max(ref_max, fabs(ref[k])); } // Pass 0: non canonical ordering of transform coefficients. if (pass == 0) { // Test forward transform, with different input / output. - pffft_transform(pffft_status, in, tmp, 0, PFFFT_FORWARD); + pffft_transform(pffft_status, in, tmp, nullptr, PFFFT_FORWARD); memcpy(tmp2, tmp, num_bytes); memcpy(tmp, in, num_bytes); - pffft_transform(pffft_status, tmp, tmp, 0, PFFFT_FORWARD); + pffft_transform(pffft_status, tmp, tmp, nullptr, PFFFT_FORWARD); for (k = 0; k < num_floats; ++k) { SCOPED_TRACE(k); EXPECT_EQ(tmp2[k], tmp[k]); @@ -93,10 +93,10 @@ pffft_zreorder(pffft_status, tmp, out, PFFFT_FORWARD); } else { // Pass 1: canonical ordering of transform coefficients. - pffft_transform_ordered(pffft_status, in, tmp, 0, PFFFT_FORWARD); + pffft_transform_ordered(pffft_status, in, tmp, nullptr, PFFFT_FORWARD); memcpy(tmp2, tmp, num_bytes); memcpy(tmp, in, num_bytes); - pffft_transform_ordered(pffft_status, tmp, tmp, 0, PFFFT_FORWARD); + pffft_transform_ordered(pffft_status, tmp, tmp, nullptr, PFFFT_FORWARD); for (k = 0; k < num_floats; ++k) { SCOPED_TRACE(k); EXPECT_EQ(tmp2[k], tmp[k]); @@ -111,16 +111,18 @@ } if (pass == 0) { - pffft_transform(pffft_status, tmp, out, 0, PFFFT_BACKWARD); + pffft_transform(pffft_status, tmp, out, nullptr, PFFFT_BACKWARD); } else { - pffft_transform_ordered(pffft_status, tmp, out, 0, PFFFT_BACKWARD); + pffft_transform_ordered(pffft_status, tmp, out, nullptr, + PFFFT_BACKWARD); } memcpy(tmp2, out, num_bytes); memcpy(out, tmp, num_bytes); if (pass == 0) { - pffft_transform(pffft_status, out, out, 0, PFFFT_BACKWARD); + pffft_transform(pffft_status, out, out, nullptr, PFFFT_BACKWARD); } else { - pffft_transform_ordered(pffft_status, out, out, 0, PFFFT_BACKWARD); + pffft_transform_ordered(pffft_status, out, out, nullptr, + PFFFT_BACKWARD); } for (k = 0; k < num_floats; ++k) { assert(tmp2[k] == out[k]);
diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c index 776f564a..3033e61 100644 --- a/third_party/pffft/src/pffft.c +++ b/third_party/pffft/src/pffft.c
@@ -58,8 +58,8 @@ */ #include "pffft.h" +#include <stdint.h> #include <stdlib.h> -// #include <stdio.h> #include <math.h> #include <assert.h> @@ -75,11 +75,14 @@ # define NEVER_INLINE(return_type) return_type __attribute__ ((noinline)) # define RESTRICT __restrict # define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ varname__[size__]; +# define VLA_ARRAY_ON_STACK_FREE(varname__) #elif defined(COMPILER_MSVC) +#include <malloc.h> # define ALWAYS_INLINE(return_type) __forceinline return_type # define NEVER_INLINE(return_type) __declspec(noinline) return_type # define RESTRICT __restrict -# define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ *varname__ = (type__*)_alloca(size__ * sizeof(type__)) +# define VLA_ARRAY_ON_STACK(type__, varname__, size__) type__ *varname__ = (type__*)_malloca(size__ * sizeof(type__)) +# define VLA_ARRAY_ON_STACK_FREE(varname__) _freea(varname__) #endif @@ -123,7 +126,7 @@ x3 = vec_mergel(y1, y3); \ } # define VSWAPHL(a,b) vec_perm(a,b, (vector unsigned char)(16,17,18,19,20,21,22,23,8,9,10,11,12,13,14,15)) -# define VALIGNED(ptr) ((((long)(ptr)) & 0xF) == 0) +# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0xF) == 0) /* SSE1 support macros @@ -143,7 +146,7 @@ # define UNINTERLEAVE2(in1, in2, out1, out2) { v4sf tmp__ = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(2,0,2,0)); out2 = _mm_shuffle_ps(in1, in2, _MM_SHUFFLE(3,1,3,1)); out1 = tmp__; } # define VTRANSPOSE4(x0,x1,x2,x3) _MM_TRANSPOSE4_PS(x0,x1,x2,x3) # define VSWAPHL(a,b) _mm_shuffle_ps(b, a, _MM_SHUFFLE(3,2,1,0)) -# define VALIGNED(ptr) ((((long)(ptr)) & 0xF) == 0) +# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0xF) == 0) /* ARM NEON support macros @@ -170,7 +173,7 @@ // marginally faster version //# define VTRANSPOSE4(x0,x1,x2,x3) { asm("vtrn.32 %q0, %q1;\n vtrn.32 %q2,%q3\n vswp %f0,%e2\n vswp %f1,%e3" : "+w"(x0), "+w"(x1), "+w"(x2), "+w"(x3)::); } # define VSWAPHL(a,b) vcombine_f32(vget_low_f32(b), vget_high_f32(a)) -# define VALIGNED(ptr) ((((long)(ptr)) & 0x3) == 0) +# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0x3) == 0) #else # if !defined(PFFFT_SIMD_DISABLE) # warning "building with simd disabled !\n"; @@ -188,7 +191,7 @@ # define VMADD(a,b,c) ((a)*(b)+(c)) # define VSUB(a,b) ((a)-(b)) # define LD_PS1(p) (p) -# define VALIGNED(ptr) ((((long)(ptr)) & 0x3) == 0) +# define VALIGNED(ptr) ((((uintptr_t)(ptr)) & 0x3) == 0) #endif // shortcuts for complex multiplcations @@ -219,35 +222,24 @@ memcpy(a3.f, f+12, 4*sizeof(float)); t = a0; u = a1; t.v = VZERO(); - // printf("VZERO=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); assertv4(t, 0, 0, 0, 0); t.v = VADD(a1.v, a2.v); - // printf("VADD(4:7,8:11)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); assertv4(t, 12, 14, 16, 18); t.v = VMUL(a1.v, a2.v); - // printf("VMUL(4:7,8:11)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); assertv4(t, 32, 45, 60, 77); t.v = VMADD(a1.v, a2.v,a0.v); - // printf("VMADD(4:7,8:11,0:3)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); assertv4(t, 32, 46, 62, 80); INTERLEAVE2(a1.v,a2.v,t.v,u.v); - // printf("INTERLEAVE2(4:7,8:11)=[%2g %2g %2g %2g] [%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3], u.f[0], u.f[1], u.f[2], u.f[3]); assertv4(t, 4, 8, 5, 9); assertv4(u, 6, 10, 7, 11); UNINTERLEAVE2(a1.v,a2.v,t.v,u.v); - // printf("UNINTERLEAVE2(4:7,8:11)=[%2g %2g %2g %2g] [%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3], u.f[0], u.f[1], u.f[2], u.f[3]); assertv4(t, 4, 6, 8, 10); assertv4(u, 5, 7, 9, 11); t.v=LD_PS1(f[15]); - // printf("LD_PS1(15)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); assertv4(t, 15, 15, 15, 15); t.v = VSWAPHL(a1.v, a2.v); - // printf("VSWAPHL(4:7,8:11)=[%2g %2g %2g %2g]\n", t.f[0], t.f[1], t.f[2], t.f[3]); assertv4(t, 8, 9, 6, 7); VTRANSPOSE4(a0.v, a1.v, a2.v, a3.v); - // printf("VTRANSPOSE4(0:3,4:7,8:11,12:15)=[%2g %2g %2g %2g] [%2g %2g %2g %2g] [%2g %2g %2g %2g] [%2g %2g %2g %2g]\n", - // a0.f[0], a0.f[1], a0.f[2], a0.f[3], a1.f[0], a1.f[1], a1.f[2], a1.f[3], - // a2.f[0], a2.f[1], a2.f[2], a2.f[3], a3.f[0], a3.f[1], a3.f[2], a3.f[3]); assertv4(a0, 0, 4, 8, 12); assertv4(a1, 1, 5, 9, 13); assertv4(a2, 2, 6, 10, 14); assertv4(a3, 3, 7, 11, 15); } #endif //!PFFFT_SIMD_DISABLE @@ -1674,6 +1666,8 @@ ib = !ib; } assert(buff[ib] == voutput); + + VLA_ARRAY_ON_STACK_FREE(scratch_on_stack); } void pffft_zconvolve_accumulate(PFFFT_Setup *s, const float *a, const float *b, float *ab, float scaling) { @@ -1851,6 +1845,8 @@ ib = !ib; } assert(buff[ib] == output); + + VLA_ARRAY_ON_STACK_FREE(scratch_on_stack); } #define pffft_zconvolve_accumulate_nosimd pffft_zconvolve_accumulate
diff --git a/third_party/protobuf/proto_library.gni b/third_party/protobuf/proto_library.gni index 95ad6200..b05c66c 100644 --- a/third_party/protobuf/proto_library.gni +++ b/third_party/protobuf/proto_library.gni
@@ -364,6 +364,7 @@ configs += [ "//build/config/sanitizers:not_fuzzed" ] public_configs = [ "//third_party/protobuf:using_proto" ] + public_deps = [] if (generate_cc || generate_with_plugin) { # Not necessary if all protos are located in the same directory. @@ -379,13 +380,9 @@ if (generate_cc) { if (defined(invoker.use_protobuf_full) && invoker.use_protobuf_full == true) { - public_deps = [ - "//third_party/protobuf:protobuf_full", - ] + public_deps += [ "//third_party/protobuf:protobuf_full" ] } else { - public_deps = [ - "//third_party/protobuf:protobuf_lite", - ] + public_deps += [ "//third_party/protobuf:protobuf_lite" ] } if (is_win) { @@ -400,9 +397,8 @@ } } - deps = [ - ":$action_name", - ] + public_deps += [ ":$action_name" ] + deps = [] # This will link any libraries in the deps (the use of invoker.deps in the # action won't link it).
diff --git a/third_party/zlib/contrib/bench/zlib_bench.cc b/third_party/zlib/contrib/bench/zlib_bench.cc index 452e42e6..5dcdef0 100644 --- a/third_party/zlib/contrib/bench/zlib_bench.cc +++ b/third_party/zlib/contrib/bench/zlib_bench.cc
@@ -48,9 +48,7 @@ }; Data read_file_data_or_exit(const char* name) { - std::ifstream file; - - file.open(name, std::ios::in | std::ios::binary); + std::ifstream file(name, std::ios::in | std::ios::binary); if (!file) { perror(name); exit(1); @@ -63,11 +61,8 @@ if (file && data.data) file.read(data.data.get(), data.size); - if (!file || !data.data) { - perror((std::string("error reading ") + name).c_str()); - exit(1); - } else if (!data.size) { - fprintf(stderr, "%s is empty\n", name); + if (!file || !data.data || !data.size) { + perror((std::string("failed: reading ") + name).c_str()); exit(1); } @@ -107,12 +102,13 @@ return 0; } +static int zlib_compression_level; + void zlib_compress( const zlib_wrapper type, const char* input, const size_t input_size, std::string* output, - const int compression_level, bool resize_output = false) { if (resize_output) @@ -122,7 +118,7 @@ z_stream stream; memset(&stream, 0, sizeof(stream)); - int result = deflateInit2(&stream, compression_level, Z_DEFLATED, + int result = deflateInit2(&stream, zlib_compression_level, Z_DEFLATED, zlib_stream_wrapper_type(type), MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (result != Z_OK) error_exit("deflateInit2 failed", result); @@ -182,8 +178,7 @@ exit(3); } -void zlib_file(const char* name, const zlib_wrapper type, - const int compression_level) { +void zlib_file(const char* name, const zlib_wrapper type) { /* * Read the file data. */ @@ -231,15 +226,13 @@ auto start = now(); for (int b = 0; b < blocks; ++b) for (int r = 0; r < repeats; ++r) - zlib_compress(type, input[b], input_length[b], &compressed[b], - compression_level); + zlib_compress(type, input[b], input_length[b], &compressed[b]); ctime[run] = std::chrono::duration<double>(now() - start).count(); // Compress again, resizing compressed, so we don't leave junk at the // end of the compressed string that could confuse zlib_uncompress(). for (int b = 0; b < blocks; ++b) - zlib_compress(type, input[b], input_length[b], &compressed[b], - compression_level, true); + zlib_compress(type, input[b], input_length[b], &compressed[b], true); for (int b = 0; b < blocks; ++b) output[b].resize(input_length[b]); @@ -279,59 +272,45 @@ deflate_rate_med, deflate_rate_max, inflate_rate_med, inflate_rate_max); } +static int argn = 1; + +char* get_option(int argc, char* argv[], const char* option) { + if (argn < argc) + return !strcmp(argv[argn], option) ? argv[argn++] : 0; + return 0; +} + +bool get_compression(int argc, char* argv[], int* value) { + if (argn < argc) + *value = atoi(argv[argn++]); + return *value >= 1 && *value <= 9; +} + +void usage_exit(const char* program) { + printf("usage: %s gzip|zlib|raw [--compression 1:9] files...\n", program); + exit(1); +} + int main(int argc, char* argv[]) { - zlib_wrapper type = kWrapperNONE; - int file_index = 3; - // DEFAULT is equivalent to level 6. Compression level ranges from 1 to 9, - // being 0 used for Z_NO_COMPRESSION. - int compression_level = Z_DEFAULT_COMPRESSION; + zlib_wrapper type; + if (get_option(argc, argv, "zlib")) + type = kWrapperZLIB; + else if (get_option(argc, argv, "gzip")) + type = kWrapperGZIP; + else if (get_option(argc, argv, "raw")) + type = kWrapperZRAW; + else + usage_exit(argv[0]); - auto help_msg_exit = [&argv] { - printf("usage: %s -wrapper gzip|zlib|raw -compression [0:9] files...\n", argv[0]); - exit(1); - }; + if (!get_option(argc, argv, "--compression")) + zlib_compression_level = Z_DEFAULT_COMPRESSION; + else if (!get_compression(argc, argv, &zlib_compression_level)) + usage_exit(argv[0]); - // If no arguments were passed, print usage and exit. - if (argc == 1) - help_msg_exit(); - - if (argc > 1) { - if (strcmp(argv[1], "-wrapper") || !(strcmp(argv[1], "-h")) || - !(strcmp(argv[1], "--help"))) - help_msg_exit(); - - // Got check the argument count before reading. - if (argc < 3) - help_msg_exit(); - - if (!strcmp(argv[2], "zlib")) - type = kWrapperZLIB; - else if (!strcmp(argv[2], "gzip")) - type = kWrapperGZIP; - else if (!strcmp(argv[2], "raw")) - type = kWrapperZRAW; - else - help_msg_exit(); - } - - if (argc >= 4) { - if (!strcmp(argv[3], "-compression")) { - int user_level = atoi(argv[4]); - if ((user_level <= 9) && (user_level >= 0)) { - compression_level = user_level; - file_index = 5; - } else - help_msg_exit(); - } - } - - if ((type != kWrapperNONE) && (argc > 2)) { - while (file_index < argc) { - // TODO: return a status (e.g. success | fail). - zlib_file(argv[file_index], type, compression_level); - ++file_index; - } - } + if (argn >= argc) + usage_exit(argv[0]); + while (argn < argc) + zlib_file(argv[argn++], type); return 0; }
diff --git a/tools/generate_stubs/rules.gni b/tools/generate_stubs/rules.gni index c4ea1f9..aa69a7a 100644 --- a/tools/generate_stubs/rules.gni +++ b/tools/generate_stubs/rules.gni
@@ -86,10 +86,10 @@ "public_deps", "visibility", ]) - if (!defined(deps)) { - deps = [] + if (!defined(public_deps)) { + public_deps = [] } - deps += [ ":${target_name}__stubs_gen" ] + public_deps += [ ":${target_name}__stubs_gen" ] sources = [ "${target_gen_dir}/${invoker.output_name}.cc", "${target_gen_dir}/${invoker.output_name}.h",
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 7df526a..f57d8ef 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -3204,6 +3204,15 @@ <int value="2" label="New profile created"/> </enum> +<enum name="AutofillProfileSyncChangeOrigin"> + <int value="0" label="Change in a local profile"/> + <int value="1" + label="Change in a converted local profile (that still equals to a + server profile)"/> + <int value="2" label="Resolving conflict in incremental remote update"/> + <int value="3" label="Upload / conflict resolution in initial sync"/> +</enum> + <enum name="AutofillQuality"> <int value="0" label="Submitted"/> <int value="1" label="Autofilled"/> @@ -30872,6 +30881,7 @@ <int value="-1729926412" label="enable-webusb-notifications"/> <int value="-1727530898" label="LookalikeUrlNavigationSuggestionsUI:enabled"/> <int value="-1725507605" label="enable-web-midi"/> + <int value="-1722208902" label="CCTModuleCustomRequestHeader:disabled"/> <int value="-1720653947" label="WebRtcHybridAgc:disabled"/> <int value="-1719833926" label="disable-answers-in-suggest"/> <int value="-1716654100" label="tab-capture-downscale-quality"/> @@ -32183,6 +32193,7 @@ <int value="550378029" label="reset-app-list-install-state"/> <int value="550387510" label="NTPAssetDownloadSuggestions:disabled"/> <int value="557200974" label="WebSocketHandshakeReuseConnection:disabled"/> + <int value="557915559" label="CCTModuleCustomRequestHeader:enabled"/> <int value="558873715" label="SiteDetails:disabled"/> <int value="562979188" label="DesktopIOSPromotion:enabled"/> <int value="564522013" label="Av1Decoder:disabled"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index bf4d988..87710aca 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -113116,6 +113116,9 @@ </histogram> <histogram name="Style.AuthorStyleSheet.ParseTime" units="microseconds"> + <obsolete> + Deprecated 2019-02, no longer used. + </obsolete> <owner>futhark@chromium.org</owner> <summary> Microseconds spent in StyleSheetContents::ParseAuthorStyleSheet. @@ -114124,6 +114127,26 @@ </summary> </histogram> +<histogram name="Sync.AutofillProfile.AddOrUpdateOrigin" + enum="AutofillProfileSyncChangeOrigin" expires_after="M75"> + <owner>jkrcal@chromium.org</owner> + <owner>treib@chromium.org</owner> + <summary> + Reported for autofill profile sync once per every locally committed entity + creation/update. It breaks down the origin of such a local change. + </summary> +</histogram> + +<histogram name="Sync.AutofillProfile.DeleteOrigin" + enum="AutofillProfileSyncChangeOrigin" expires_after="M73"> + <owner>jkrcal@chromium.org</owner> + <owner>treib@chromium.org</owner> + <summary> + Reported for autofill profile sync once per every locally committed entity + deletion. It breaks down the origin of such a local deletion. + </summary> +</histogram> + <histogram name="Sync.AutofillProfileAssociationTime" units="ms"> <obsolete> Replaced by Sync.AutofillProfilesAssociationTime.
diff --git a/tools/perf/record_wpr b/tools/perf/record_wpr index dfe3d4d..a288a8c 100755 --- a/tools/perf/record_wpr +++ b/tools/perf/record_wpr
@@ -2,20 +2,14 @@ # Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import os import sys - from chrome_telemetry_build import chromium_config from core import path_util path_util.AddTelemetryToPath() from telemetry import record_wpr -# This is required to resolve importing davclient in tools/perf/third_party/ -# when record_wpr try to dynamically discover benchmark classes. -import third_party # pylint: disable=unused-import - if __name__ == '__main__': config = chromium_config.ChromiumConfig(
diff --git a/tools/perf/third_party/__init__.py b/tools/perf/third_party/__init__.py deleted file mode 100644 index 50b23df..0000000 --- a/tools/perf/third_party/__init__.py +++ /dev/null
@@ -1,3 +0,0 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file.
diff --git a/tools/perf/third_party/davclient/README.chromium b/tools/perf/third_party/davclient/README.chromium deleted file mode 100644 index 47acf8d4a..0000000 --- a/tools/perf/third_party/davclient/README.chromium +++ /dev/null
@@ -1,17 +0,0 @@ -Name: Davclient -Short Name: davclient -URL: http://svn.osafoundation.org/tools/davclient/ -Version: 0.2.1 -Date: Undated, retrieved Dec 14, 2012 -Revision: r1008 -License: Apache 2.0 -License File: NOT_SHIPPED -Security Critical: no - -Description: -A simple Python WebDAV client. Used for the Telemetry bootstrap to easily -fetch files from SVN servers. - -Local Modifications: -None. However packaging and installation code from original repository have not -been copied.
diff --git a/tools/perf/third_party/davclient/__init__.py b/tools/perf/third_party/davclient/__init__.py deleted file mode 100644 index 50b23df..0000000 --- a/tools/perf/third_party/davclient/__init__.py +++ /dev/null
@@ -1,3 +0,0 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file.
diff --git a/tools/perf/third_party/davclient/davclient.py b/tools/perf/third_party/davclient/davclient.py deleted file mode 100644 index 2d9107aa..0000000 --- a/tools/perf/third_party/davclient/davclient.py +++ /dev/null
@@ -1,312 +0,0 @@ -# Copyright (c) 2006-2007 Open Source Applications Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import urlparse, httplib, copy, base64, StringIO -import urllib - -try: - from xml.etree import ElementTree -except: - from elementtree import ElementTree - -__all__ = ['DAVClient'] - -def object_to_etree(parent, obj, namespace=''): - """This function takes in a python object, traverses it, and adds it to an existing etree object""" - - if type(obj) is int or type(obj) is float or type(obj) is str: - # If object is a string, int, or float just add it - obj = str(obj) - if obj.startswith('{') is False: - ElementTree.SubElement(parent, '{%s}%s' % (namespace, obj)) - else: - ElementTree.SubElement(parent, obj) - - elif type(obj) is dict: - # If the object is a dictionary we'll need to parse it and send it back recusively - for key, value in obj.items(): - if key.startswith('{') is False: - key_etree = ElementTree.SubElement(parent, '{%s}%s' % (namespace, key)) - object_to_etree(key_etree, value, namespace=namespace) - else: - key_etree = ElementTree.SubElement(parent, key) - object_to_etree(key_etree, value, namespace=namespace) - - elif type(obj) is list: - # If the object is a list parse it and send it back recursively - for item in obj: - object_to_etree(parent, item, namespace=namespace) - - else: - # If it's none of previous types then raise - raise TypeError, '%s is an unsupported type' % type(obj) - - -class DAVClient(object): - - def __init__(self, url='http://localhost:8080'): - """Initialization""" - - self._url = urlparse.urlparse(url) - - self.headers = {'Host':self._url[1], - 'User-Agent': 'python.davclient.DAVClient/0.1'} - - - def _request(self, method, path='', body=None, headers=None): - """Internal request method""" - self.response = None - - if headers is None: - headers = copy.copy(self.headers) - else: - new_headers = copy.copy(self.headers) - new_headers.update(headers) - headers = new_headers - - if self._url.scheme == 'http': - self._connection = httplib.HTTPConnection(self._url[1]) - elif self._url.scheme == 'https': - self._connection = httplib.HTTPSConnection(self._url[1]) - else: - raise Exception, 'Unsupported scheme' - - self._connection.request(method, path, body, headers) - - self.response = self._connection.getresponse() - - self.response.body = self.response.read() - - # Try to parse and get an etree - try: - self._get_response_tree() - except: - pass - - - def _get_response_tree(self): - """Parse the response body into an elementree object""" - self.response.tree = ElementTree.fromstring(self.response.body) - return self.response.tree - - def set_basic_auth(self, username, password): - """Set basic authentication""" - auth = 'Basic %s' % base64.encodestring('%s:%s' % (username, password)).strip() - self._username = username - self._password = password - self.headers['Authorization'] = auth - - ## HTTP DAV methods ## - - def get(self, path, headers=None): - """Simple get request""" - self._request('GET', path, headers=headers) - return self.response.body - - def head(self, path, headers=None): - """Basic HEAD request""" - self._request('HEAD', path, headers=headers) - - def put(self, path, body=None, f=None, headers=None): - """Put resource with body""" - if f is not None: - body = f.read() - - self._request('PUT', path, body=body, headers=headers) - - def post(self, path, body=None, headers=None): - """POST resource with body""" - - self._request('POST', path, body=body, headers=headers) - - def mkcol(self, path, headers=None): - """Make DAV collection""" - self._request('MKCOL', path=path, headers=headers) - - make_collection = mkcol - - def delete(self, path, headers=None): - """Delete DAV resource""" - self._request('DELETE', path=path, headers=headers) - - def copy(self, source, destination, body=None, depth='infinity', overwrite=True, headers=None): - """Copy DAV resource""" - # Set all proper headers - if headers is None: - headers = {'Destination':destination} - else: - headers['Destination'] = self._url.geturl() + destination - if overwrite is False: - headers['Overwrite'] = 'F' - headers['Depth'] = depth - - self._request('COPY', source, body=body, headers=headers) - - - def copy_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): - """Copy DAV collection""" - body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' - - # Add proper headers - if headers is None: - headers = {} - headers['Content-Type'] = 'text/xml; charset="utf-8"' - - self.copy(source, destination, body=unicode(body, 'utf-8'), depth=depth, overwrite=overwrite, headers=headers) - - - def move(self, source, destination, body=None, depth='infinity', overwrite=True, headers=None): - """Move DAV resource""" - # Set all proper headers - if headers is None: - headers = {'Destination':destination} - else: - headers['Destination'] = self._url.geturl() + destination - if overwrite is False: - headers['Overwrite'] = 'F' - headers['Depth'] = depth - - self._request('MOVE', source, body=body, headers=headers) - - - def move_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): - """Move DAV collection and copy all properties""" - body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' - - # Add proper headers - if headers is None: - headers = {} - headers['Content-Type'] = 'text/xml; charset="utf-8"' - - self.move(source, destination, unicode(body, 'utf-8'), depth=depth, overwrite=overwrite, headers=headers) - - - def propfind(self, path, properties='allprop', namespace='DAV:', depth=None, headers=None): - """Property find. If properties arg is unspecified it defaults to 'allprop'""" - # Build propfind xml - root = ElementTree.Element('{DAV:}propfind') - if type(properties) is str: - ElementTree.SubElement(root, '{DAV:}%s' % properties) - else: - props = ElementTree.SubElement(root, '{DAV:}prop') - object_to_etree(props, properties, namespace=namespace) - tree = ElementTree.ElementTree(root) - - # Etree won't just return a normal string, so we have to do this - body = StringIO.StringIO() - tree.write(body) - body = body.getvalue() - - # Add proper headers - if headers is None: - headers = {} - if depth is not None: - headers['Depth'] = depth - headers['Content-Type'] = 'text/xml; charset="utf-8"' - - # Body encoding must be utf-8, 207 is proper response - self._request('PROPFIND', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) - - if self.response is not None and hasattr(self.response, 'tree') is True: - property_responses = {} - for response in self.response.tree._children: - property_href = response.find('{DAV:}href') - property_stat = response.find('{DAV:}propstat') - - def parse_props(props): - property_dict = {} - for prop in props: - if prop.tag.find('{DAV:}') is not -1: - name = prop.tag.split('}')[-1] - else: - name = prop.tag - if len(prop._children) is not 0: - property_dict[name] = parse_props(prop._children) - else: - property_dict[name] = prop.text - return property_dict - - if property_href is not None and property_stat is not None: - property_dict = parse_props(property_stat.find('{DAV:}prop')._children) - property_responses[property_href.text] = property_dict - return property_responses - - def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): - """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" - root = ElementTree.Element('{DAV:}propertyupdate') - - if set_props is not None: - prop_set = ElementTree.SubElement(root, '{DAV:}set') - object_to_etree(prop_set, set_props, namespace=namespace) - if remove_props is not None: - prop_remove = ElementTree.SubElement(root, '{DAV:}remove') - object_to_etree(prop_remove, remove_props, namespace=namespace) - - tree = ElementTree.ElementTree(root) - - # Add proper headers - if headers is None: - headers = {} - headers['Content-Type'] = 'text/xml; charset="utf-8"' - - self._request('PROPPATCH', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) - - - def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): - """Set a lock on a dav resource""" - root = ElementTree.Element('{DAV:}lockinfo') - object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') - tree = ElementTree.ElementTree(root) - - # Add proper headers - if headers is None: - headers = {} - if depth is not None: - headers['Depth'] = depth - headers['Content-Type'] = 'text/xml; charset="utf-8"' - headers['Timeout'] = 'Infinite, Second-4100000000' - - self._request('LOCK', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) - - locks = self.response.etree.finall('.//{DAV:}locktoken') - lock_list = [] - for lock in locks: - lock_list.append(lock.getchildren()[0].text.strip().strip('\n')) - return lock_list - - - def refresh_lock(self, path, token, headers=None): - """Refresh lock with token""" - - if headers is None: - headers = {} - headers['If'] = '(<%s>)' % token - headers['Timeout'] = 'Infinite, Second-4100000000' - - self._request('LOCK', path, body=None, headers=headers) - - - def unlock(self, path, token, headers=None): - """Unlock DAV resource with token""" - if headers is None: - headers = {} - headers['Lock-Tocken'] = '<%s>' % token - - self._request('UNLOCK', path, body=None, headers=headers) - - - - - -
diff --git a/ui/ozone/platform/wayland/wayland_buffer_manager.cc b/ui/ozone/platform/wayland/wayland_buffer_manager.cc index 213605e..862989e1 100644 --- a/ui/ozone/platform/wayland/wayland_buffer_manager.cc +++ b/ui/ozone/platform/wayland/wayland_buffer_manager.cc
@@ -407,13 +407,16 @@ buffer->swap_result = gfx::SwapResult::SWAP_ACK; buffer->wl_frame_callback.reset(); - // If presentation feedback is not supported, use fake feedback and - // trigger the callback. + // If presentation feedback is not supported, use a fake feedback if (!self->connection_->presentation()) { buffer->feedback = gfx::PresentationFeedback(base::TimeTicks::Now(), base::TimeDelta(), 0); - self->OnBufferSwapped(buffer); } + // If presentation feedback event either has already been fired or + // has not been set, trigger swap callback. + if (!buffer->wp_presentation_feedback) + self->OnBufferSwapped(buffer); + return; } } @@ -446,16 +449,20 @@ for (auto& item : self->buffers_) { Buffer* buffer = item.second.get(); if (buffer->wp_presentation_feedback.get() == wp_presentation_feedback) { - // Frame callback must come before a feedback is presented. - DCHECK(!buffer->wl_frame_callback); - buffer->feedback = gfx::PresentationFeedback( GetPresentationFeedbackTimeStamp(tv_sec_hi, tv_sec_lo, tv_nsec), base::TimeDelta::FromNanoseconds(refresh), GetPresentationKindFlags(flags)); - buffer->wp_presentation_feedback.reset(); - self->OnBufferSwapped(buffer); + + // Some compositors not always fire PresentationFeedback and Frame + // events in the same order (i.e, frame callbacks coming always before + // feedback presented/discaded ones). So, check FrameCallbackDone has + // already been called at this point, if yes, trigger the swap callback. + // otherwise it will be triggered in the upcoming frame callback. + if (!buffer->wl_frame_callback) + self->OnBufferSwapped(buffer); + return; } } @@ -474,11 +481,17 @@ Buffer* buffer = item.second.get(); if (buffer->wp_presentation_feedback.get() == wp_presentation_feedback) { // Frame callback must come before a feedback is presented. - DCHECK(!buffer->wl_frame_callback); buffer->feedback = gfx::PresentationFeedback::Failure(); - buffer->wp_presentation_feedback.reset(); - self->OnBufferSwapped(buffer); + + // Some compositors not always fire PresentationFeedback and Frame + // events in the same order (i.e, frame callbacks coming always before + // feedback presented/discaded ones). So, check FrameCallbackDone has + // already been called at this point, if yes, trigger the swap callback. + // Otherwise it will be triggered in the upcoming frame callback. + if (!buffer->wl_frame_callback) + self->OnBufferSwapped(buffer); + return; } }
diff --git a/ui/ozone/platform/wayland/wayland_window.cc b/ui/ozone/platform/wayland/wayland_window.cc index 32bf9bf..1e6b464 100644 --- a/ui/ozone/platform/wayland/wayland_window.cc +++ b/ui/ozone/platform/wayland/wayland_window.cc
@@ -189,7 +189,7 @@ } } -void WaylandWindow::CreateTooltipSubSurface() { +void WaylandWindow::CreateAndShowTooltipSubSurface() { // Since Aura does not not provide a reference parent window, needed by // Wayland, we get the current focused window to place and show the tooltips. parent_window_ = connection_->GetCurrentFocusedWindow(); @@ -203,11 +203,14 @@ return; } - wl_subcompositor* subcompositor = connection_->subcompositor(); - DCHECK(subcompositor); - tooltip_subsurface_.reset(wl_subcompositor_get_subsurface( - subcompositor, surface_.get(), parent_window_->surface())); + if (!tooltip_subsurface_) { + wl_subcompositor* subcompositor = connection_->subcompositor(); + DCHECK(subcompositor); + tooltip_subsurface_.reset(wl_subcompositor_get_subsurface( + subcompositor, surface_.get(), parent_window_->surface())); + } + DCHECK(tooltip_subsurface_); wl_subsurface_set_position(tooltip_subsurface_.get(), bounds_.x(), bounds_.y()); wl_subsurface_set_desync(tooltip_subsurface_.get()); @@ -256,11 +259,12 @@ if (xdg_surface_) return; + if (is_tooltip_) { - if (!tooltip_subsurface_) - CreateTooltipSubSurface(); + CreateAndShowTooltipSubSurface(); return; } + if (!xdg_popup_) { CreateXdgPopup(); connection_->ScheduleFlush(); @@ -272,14 +276,12 @@ parent_window_ = nullptr; wl_surface_attach(surface_.get(), NULL, 0, 0); wl_surface_commit(surface_.get()); - // Tooltip subsurface must be reset only after the buffer is detached. - // Otherwise, gnome shell, for example, can end up with a broken event - // pipe. - tooltip_subsurface_.reset(); return; } + if (child_window_) child_window_->Hide(); + if (xdg_popup_) { parent_window_->set_child_window(nullptr); xdg_popup_.reset(); @@ -671,8 +673,8 @@ const uint32_t entered_output_id = connection_->wayland_output_manager()->GetIdForOutput(output); DCHECK_NE(entered_output_id, 0u); - auto entered_output_id_it = entered_outputs_ids_.insert(entered_output_id); - DCHECK(entered_output_id_it.second); + auto result = entered_outputs_ids_.insert(entered_output_id); + DCHECK(result.first != entered_outputs_ids_.end()); } void WaylandWindow::RemoveEnteredOutputId(struct wl_output* output) {
diff --git a/ui/ozone/platform/wayland/wayland_window.h b/ui/ozone/platform/wayland/wayland_window.h index dc5fa34..1b6a5bd 100644 --- a/ui/ozone/platform/wayland/wayland_window.h +++ b/ui/ozone/platform/wayland/wayland_window.h
@@ -156,8 +156,9 @@ void CreateXdgPopup(); // Creates a surface window, which is visible as a main window. void CreateXdgSurface(); - // Creates a subsurface window, to host tooltip's content. - void CreateTooltipSubSurface(); + // Creates (if necessary) and show subsurface window, to host + // tooltip's content. + void CreateAndShowTooltipSubSurface(); // Gets a parent window for this window. WaylandWindow* GetParentWindow(gfx::AcceleratedWidget parent_widget);