diff --git a/DEPS b/DEPS index b777de93..db3c1160 100644 --- a/DEPS +++ b/DEPS
@@ -96,7 +96,7 @@ # 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': 'a2595f925596aca234d4ac4e35da689ef13cc27c', + 'skia_revision': '97c1108607584b6050a6880d6ce22846e4913a92', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -120,7 +120,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'df1298a228abb59eb167d0be43d46a50c0333497', + 'pdfium_revision': '27924e6c9d43f0eba57d14004853d5a8ba47de26', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -156,7 +156,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': '718dbe7d32442fbc27b7a150ec2573ab93abea55', + 'catapult_revision': '483449aa724f5374a883584d8bf06c0402fb855b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -498,7 +498,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '9520b5b98bd364e4d0090c92d05c0f8b1eb9cd02', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '7aaefdbb734f398eab1da8c47bc122626b803c81', 'condition': 'checkout_linux', }, @@ -523,7 +523,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '3806b7fbd0ea6704d2c35d1eb64a2a505e29ca53', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'afec759dca62d9239f75ec5643592331a6aa18a2', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -968,7 +968,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '7c0541da63f571512c49758cbc0767117997a270', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'd6f86e8fca212e0f1b9b390dd31ef7579b66cc3e', # commit position 21742 + Var('webrtc_git') + '/src.git' + '@' + 'a29b148557b0f04a5f4c5d0cfe7b005909c411d9', # commit position 21742 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/WATCHLISTS b/WATCHLISTS index 1cf49ac..a888203d 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1162,6 +1162,9 @@ 'netinfo': { 'filepath': '/netinfo/', }, + 'network_service': { + 'filepath': 'services/network/', + }, 'nfc': { 'filepath': '/nfc/', }, @@ -2191,6 +2194,7 @@ 'eroman@chromium.org'], 'net_spdy': ['bnc+watch@chromium.org'], 'netinfo': ['jkarlin+watch@chromium.org'], + 'network_service': ['network-service-reviews@chromium.org'], 'nfc': ['mattreynolds+watch@chromium.org'], 'notifications': ['awdf+watch@chromium.org', 'peter@chromium.org'], 'nqe': ['tbansal+watch-nqe@chromium.org'],
diff --git a/android_webview/java/src/org/chromium/android_webview/VariationsSeedLoader.java b/android_webview/java/src/org/chromium/android_webview/VariationsSeedLoader.java index adee16ce..f31e4a6 100644 --- a/android_webview/java/src/org/chromium/android_webview/VariationsSeedLoader.java +++ b/android_webview/java/src/org/chromium/android_webview/VariationsSeedLoader.java
@@ -80,7 +80,7 @@ // If false, then variations will be enabled if either the CMD flag or the AGSA experiment file // is present. If true, then variations will be enabled regardless of flag or experiment file. - private static boolean sVariationsAlwaysEnabled = false; + private static boolean sVariationsAlwaysEnabled = true; private static void recordLoadSeedResult(int result) { EnumeratedHistogramSample histogram = new EnumeratedHistogramSample(
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 78c8f02..bb48399 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1196,6 +1196,8 @@ "wm/workspace_controller.h", "ws/window_service_delegate_impl.cc", "ws/window_service_delegate_impl.h", + "ws/window_service_util.cc", + "ws/window_service_util.h", ] configs += [ "//build/config:precompiled_headers" ]
diff --git a/ash/DEPS b/ash/DEPS index 42fd749..f495803 100644 --- a/ash/DEPS +++ b/ash/DEPS
@@ -133,9 +133,6 @@ "+ash/host/ash_window_tree_host_mus_mirroring_unified.h", "+ash/host/ash_window_tree_host_mus_unified.h", ], - "touch_transformer_controller\.*": [ - "+ash/host" - ], "window_manager.cc": [ "+ash/host/ash_window_tree_host.h" ],
diff --git a/ash/accessibility/accessibility_controller.cc b/ash/accessibility/accessibility_controller.cc index f03e7f58..d543495 100644 --- a/ash/accessibility/accessibility_controller.cc +++ b/ash/accessibility/accessibility_controller.cc
@@ -26,6 +26,7 @@ #include "ash/system/power/backlights_forced_off_setter.h" #include "ash/system/power/scoped_backlights_forced_off.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" +#include "base/command_line.h" #include "base/strings/string16.h" #include "chromeos/audio/cras_audio_handler.h" #include "components/pref_registry/pref_registry_syncable.h" @@ -58,6 +59,7 @@ prefs::kAccessibilityAutoclickEnabled, prefs::kAccessibilityCaretHighlightEnabled, prefs::kAccessibilityCursorHighlightEnabled, + prefs::kAccessibilityDictationEnabled, prefs::kAccessibilityFocusHighlightEnabled, prefs::kAccessibilityHighContrastEnabled, prefs::kAccessibilityLargeCursorEnabled, @@ -232,6 +234,7 @@ false); registry->RegisterBooleanPref(prefs::kAccessibilityCursorHighlightEnabled, false); + registry->RegisterBooleanPref(prefs::kAccessibilityDictationEnabled, false); registry->RegisterBooleanPref(prefs::kAccessibilityFocusHighlightEnabled, false); registry->RegisterBooleanPref(prefs::kAccessibilityHighContrastEnabled, @@ -262,6 +265,7 @@ registry->RegisterForeignPref(prefs::kAccessibilityAutoclickDelayMs); registry->RegisterForeignPref(prefs::kAccessibilityCaretHighlightEnabled); registry->RegisterForeignPref(prefs::kAccessibilityCursorHighlightEnabled); + registry->RegisterForeignPref(prefs::kAccessibilityDictationEnabled); registry->RegisterForeignPref(prefs::kAccessibilityFocusHighlightEnabled); registry->RegisterForeignPref(prefs::kAccessibilityHighContrastEnabled); registry->RegisterForeignPref(prefs::kAccessibilityLargeCursorEnabled); @@ -324,6 +328,23 @@ return cursor_highlight_enabled_; } +void AccessibilityController::SetDictationEnabled(bool enabled) { + if (!active_user_prefs_) + return; + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kEnableExperimentalAccessibilityFeatures)) { + return; + } + + active_user_prefs_->SetBoolean(prefs::kAccessibilityDictationEnabled, + enabled); + active_user_prefs_->CommitPendingWrite(); +} + +bool AccessibilityController::IsDictationEnabled() const { + return dictation_enabled_; +} + void AccessibilityController::SetFocusHighlightEnabled(bool enabled) { if (!active_user_prefs_) return; @@ -474,6 +495,10 @@ } void AccessibilityController::ToggleDictation() { + // Do nothing if dictation is not enabled. + if (!IsDictationEnabled()) + return; + if (client_) { client_->ToggleDictation(base::BindOnce( [](AccessibilityController* self, bool is_active) { @@ -613,6 +638,10 @@ &AccessibilityController::UpdateCursorHighlightFromPref, base::Unretained(this))); pref_change_registrar_->Add( + prefs::kAccessibilityDictationEnabled, + base::BindRepeating(&AccessibilityController::UpdateDictationFromPref, + base::Unretained(this))); + pref_change_registrar_->Add( prefs::kAccessibilityFocusHighlightEnabled, base::BindRepeating( &AccessibilityController::UpdateFocusHighlightFromPref, @@ -740,6 +769,19 @@ UpdateAccessibilityHighlightingFromPrefs(); } +void AccessibilityController::UpdateDictationFromPref() { + DCHECK(active_user_prefs_); + const bool enabled = + active_user_prefs_->GetBoolean(prefs::kAccessibilityDictationEnabled); + + if (dictation_enabled_ == enabled) + return; + + dictation_enabled_ = enabled; + + NotifyAccessibilityStatusChanged(); +} + void AccessibilityController::UpdateFocusHighlightFromPref() { DCHECK(active_user_prefs_); bool enabled = active_user_prefs_->GetBoolean(
diff --git a/ash/accessibility/accessibility_controller.h b/ash/accessibility/accessibility_controller.h index 1a9edb7..37a66fb 100644 --- a/ash/accessibility/accessibility_controller.h +++ b/ash/accessibility/accessibility_controller.h
@@ -64,6 +64,9 @@ void SetCursorHighlightEnabled(bool enabled); bool IsCursorHighlightEnabled() const; + void SetDictationEnabled(bool enabled); + bool IsDictationEnabled() const; + void SetFocusHighlightEnabled(bool enabled); bool IsFocusHighlightEnabled() const; @@ -162,6 +165,7 @@ void UpdateAutoclickDelayFromPref(); void UpdateCaretHighlightFromPref(); void UpdateCursorHighlightFromPref(); + void UpdateDictationFromPref(); void UpdateFocusHighlightFromPref(); void UpdateHighContrastFromPref(); void UpdateLargeCursorFromPref(); @@ -190,6 +194,7 @@ base::TimeDelta autoclick_delay_; bool caret_highlight_enabled_ = false; bool cursor_highlight_enabled_ = false; + bool dictation_enabled_ = false; bool focus_highlight_enabled_ = false; bool high_contrast_enabled_ = false; bool large_cursor_enabled_ = false;
diff --git a/ash/accessibility/accessibility_controller_unittest.cc b/ash/accessibility/accessibility_controller_unittest.cc index e29d7955..f9f4af0 100644 --- a/ash/accessibility/accessibility_controller_unittest.cc +++ b/ash/accessibility/accessibility_controller_unittest.cc
@@ -81,6 +81,7 @@ prefs->FindPreference(prefs::kAccessibilityCaretHighlightEnabled)); EXPECT_TRUE( prefs->FindPreference(prefs::kAccessibilityCursorHighlightEnabled)); + EXPECT_TRUE(prefs->FindPreference(prefs::kAccessibilityDictationEnabled)); EXPECT_TRUE( prefs->FindPreference(prefs::kAccessibilityFocusHighlightEnabled)); EXPECT_TRUE(prefs->FindPreference(prefs::kAccessibilityHighContrastEnabled));
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 971b7451..56c0cfc4 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -377,6 +377,9 @@ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SELECT_TO_SPEAK" desc="The label used in the accessibility menu of the system tray to toggle on/off the select-to-speak feature."> Select-to-Speak </message> + <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_DICTATION" desc="The label used in the accessibility menu of the system tray to toggle on/off the speak to type feature."> + Dictation + </message> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE" desc="The label used in the accessibility menu of the system tray to toggle on/off high contrast feature."> High contrast mode </message> @@ -1230,6 +1233,9 @@ <message name="IDS_ASH_LOGIN_KEYBOARD_SELECTION_SELECT" desc="Label for keyboard selection dropdown"> Set your keyboard </message> + <message name="IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_MESSAGE" desc="Text shown in the user pod to remind user that fingerprint unlock is supported"> + Unlock with fingerprint + </message> <!-- Multi-profiles intro dialog --> <message name="IDS_ASH_MULTIPROFILES_INTRO_HEADLINE" desc="Describes which feature multi-profiles intro dialog presents.">
diff --git a/ash/assistant/ash_assistant_controller.cc b/ash/assistant/ash_assistant_controller.cc index 2fc222ed..61a36b5 100644 --- a/ash/assistant/ash_assistant_controller.cc +++ b/ash/assistant/ash_assistant_controller.cc
@@ -14,12 +14,6 @@ namespace ash { -namespace { - -constexpr base::TimeDelta kAutoDismissDelay = base::TimeDelta::FromSeconds(5); - -} // namespace - AshAssistantController::AshAssistantController() : assistant_controller_binding_(this), assistant_event_subscriber_binding_(this), @@ -108,7 +102,6 @@ } void AshAssistantController::StopInteraction() { - // TODO(dmblack): Instruct underlying service to stop listening. if (assistant_interaction_model_.interaction_state() != InteractionState::kInactive) { OnInteractionDismissed(); @@ -138,40 +131,45 @@ void AshAssistantController::OnHighlighterEnabledChanged(bool enabled) { // TODO(warx): add a reason enum to distinguish the case of deselecting the // tool and done with a stylus selection. - assistant_bubble_timer_.Stop(); assistant_interaction_model_.SetInputModality(InputModality::kStylus); assistant_interaction_model_.SetInteractionState( enabled ? InteractionState::kActive : InteractionState::kInactive); } void AshAssistantController::OnInteractionStarted() { - assistant_bubble_timer_.Stop(); assistant_interaction_model_.SetInteractionState(InteractionState::kActive); } void AshAssistantController::OnInteractionFinished( chromeos::assistant::mojom::AssistantInteractionResolution resolution) { - assistant_bubble_timer_.Start( - FROM_HERE, kAutoDismissDelay, this, - &AshAssistantController::OnInteractionDismissed); } void AshAssistantController::OnInteractionDismissed() { - assistant_bubble_timer_.Stop(); assistant_interaction_model_.SetInteractionState(InteractionState::kInactive); + + // When the user-facing interaction is dismissed, we instruct the service to + // terminate any listening, speaking, or query in flight. + DCHECK(assistant_); + assistant_->StopActiveInteraction(); } void AshAssistantController::OnDialogPlateContentsChanged( const std::string& text) { - assistant_bubble_timer_.Stop(); - if (text.empty()) { // Note: This does not open the mic. It only updates the input modality to // voice so that we will show the mic icon in the UI. assistant_interaction_model_.SetInputModality(InputModality::kVoice); } else { - // TODO(dmblack): Instruct the underlying service to stop any in flight - // voice interaction. + // If switching to keyboard modality from voice, we instruct the service to + // terminate any listening, speaking, or query in flight. + // TODO(dmblack): We probably want this same logic when switching to any + // modality from voice. Handle this instead in OnInputModalityChanged, but + // we will need to add a previous modality parameter to that API. + if (assistant_interaction_model_.input_modality() == + InputModality::kVoice) { + DCHECK(assistant_); + assistant_->StopActiveInteraction(); + } assistant_interaction_model_.SetInputModality(InputModality::kKeyboard); assistant_interaction_model_.SetMicState(MicState::kClosed); }
diff --git a/ash/assistant/ash_assistant_controller.h b/ash/assistant/ash_assistant_controller.h index e21df13..acf85cc8 100644 --- a/ash/assistant/ash_assistant_controller.h +++ b/ash/assistant/ash_assistant_controller.h
@@ -15,7 +15,6 @@ #include "ash/public/interfaces/ash_assistant_controller.mojom.h" #include "ash/public/interfaces/assistant_card_renderer.mojom.h" #include "base/macros.h" -#include "base/timer/timer.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom.h" #include "mojo/public/cpp/bindings/binding.h" @@ -121,7 +120,6 @@ mojom::AssistantCardRendererPtr assistant_card_renderer_; std::unique_ptr<AssistantBubble> assistant_bubble_; - base::OneShotTimer assistant_bubble_timer_; DISALLOW_COPY_AND_ASSIGN(AshAssistantController); };
diff --git a/ash/frame/custom_frame_header.cc b/ash/frame/custom_frame_header.cc index 216c342..d47f98f 100644 --- a/ash/frame/custom_frame_header.cc +++ b/ash/frame/custom_frame_header.cc
@@ -62,7 +62,7 @@ const gfx::ImageSkia& frame_image, const gfx::ImageSkia& frame_overlay_image, int alpha, - SkColor background_color, + SkColor opaque_background_color, const gfx::Rect& bounds, int corner_radius, int image_inset_x) { @@ -72,31 +72,51 @@ gfx::ScopedCanvas scoped_save(canvas); canvas->ClipPath(frame_path, antialias); - cc::PaintFlags flags; - flags.setBlendMode(SkBlendMode::kPlus); - flags.setAntiAlias(antialias); - + // When no images are used, just draw a color, with the animation |alpha| + // applied. if (frame_image.isNull() && frame_overlay_image.isNull()) { - flags.setColor(background_color); - canvas->DrawRect(bounds, flags); - } else if (frame_overlay_image.isNull()) { - flags.setAlpha(alpha); - canvas->TileImageInt(frame_image, image_inset_x, 0, 0, 0, bounds.width(), - bounds.height(), 1.0f, &flags); - } else { + canvas->DrawColor(SkColorSetA(opaque_background_color, alpha)); + return; + } + + // This handles the case where blending is required between one or more images + // and the background color. In this case we use a SaveLayerWithFlags() call + // to draw all 2-3 components into a single layer then apply the alpha to them + // together. + if (alpha < 0xFF || + (!frame_image.isNull() && !frame_overlay_image.isNull())) { + cc::PaintFlags flags; + // We use kPlus blending mode so that between the active and inactive + // background colors, the result is 255 alpha (i.e. opaque). + flags.setBlendMode(SkBlendMode::kPlus); flags.setAlpha(alpha); canvas->SaveLayerWithFlags(flags); - if (frame_image.isNull()) { - canvas->DrawColor(background_color); - } else { + // Images can be transparent and we expect the background color to be + // present behind them. Here the |alpha| will be applied to the background + // color by the SaveLayer call, so use |opaque_background_color|. + canvas->DrawColor(opaque_background_color); + if (!frame_image.isNull()) { canvas->TileImageInt(frame_image, image_inset_x, 0, 0, 0, bounds.width(), bounds.height()); } - canvas->DrawImageInt(frame_overlay_image, 0, 0); + if (!frame_overlay_image.isNull()) + canvas->DrawImageInt(frame_overlay_image, 0, 0); canvas->Restore(); + return; } + + // Images can be transparent and we expect the background color to be + // present behind them. + canvas->DrawColor(opaque_background_color); + + if (!frame_image.isNull()) { + canvas->TileImageInt(frame_image, image_inset_x, 0, 0, 0, bounds.width(), + bounds.height()); + } + if (!frame_overlay_image.isNull()) + canvas->DrawImageInt(frame_overlay_image, 0, 0); } } // namespace @@ -262,15 +282,16 @@ appearance_provider_->GetFrameHeaderImage(active); gfx::ImageSkia frame_overlay_image = appearance_provider_->GetFrameHeaderOverlayImage(active); - SkColor background_color = - SkColorSetA(appearance_provider_->GetFrameHeaderColor(active), alpha); + // We ensure that the background color is opaque. + SkColor opaque_background_color = + SkColorSetA(appearance_provider_->GetFrameHeaderColor(active), 0xFF); int corner_radius = 0; if (!GetWidget()->IsMaximized() && !GetWidget()->IsFullscreen()) corner_radius = FrameHeaderUtil::GetTopCornerRadiusWhenRestored(); PaintFrameImagesInRoundRect(canvas, frame_image, frame_overlay_image, alpha, - background_color, GetPaintedBounds(), + opaque_background_color, GetPaintedBounds(), corner_radius, FrameHeaderUtil::GetThemeBackgroundXInset()); }
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc index c32bca64..19b292ed 100644 --- a/ash/login/login_screen_controller.cc +++ b/ash/login/login_screen_controller.cc
@@ -382,6 +382,13 @@ } } +void LoginScreenController::SetFingerprintUnlockState( + const AccountId& account_id, + mojom::FingerprintUnlockState state) { + if (DataDispatcher()) + DataDispatcher()->SetFingerprintUnlockState(account_id, state); +} + void LoginScreenController::DoAuthenticateUser(const AccountId& account_id, const std::string& password, bool authenticated_by_pin,
diff --git a/ash/login/login_screen_controller.h b/ash/login/login_screen_controller.h index c35c6f3..529bf1095 100644 --- a/ash/login/login_screen_controller.h +++ b/ash/login/login_screen_controller.h
@@ -123,6 +123,8 @@ const AccountId& account_id, const std::string& locale, std::vector<mojom::InputMethodItemPtr> keyboard_layouts) override; + void SetFingerprintUnlockState(const AccountId& account_id, + mojom::FingerprintUnlockState state) override; // Flushes the mojo pipes - to be used in tests. void FlushForTesting();
diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index dcefdf3..aea92784 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc
@@ -392,8 +392,13 @@ } // Build user state list. - for (const mojom::LoginUserInfoPtr& user : users) - users_.push_back(UserState{user->basic_user_info->account_id}); + for (const mojom::LoginUserInfoPtr& user : users) { + UserState state(user->basic_user_info->account_id); + state.fingerprint_state = user->allow_fingerprint_unlock + ? mojom::FingerprintUnlockState::AVAILABLE + : mojom::FingerprintUnlockState::UNAVAILABLE; + users_.push_back(std::move(state)); + } auto box_layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); @@ -643,6 +648,23 @@ GetWidget()->GetFocusManager()->ClearFocus(); } +void LockContentsView::OnFingerprintUnlockStateChanged( + const AccountId& account_id, + mojom::FingerprintUnlockState state) { + UserState* user_state = FindStateForUser(account_id); + if (!user_state) + return; + + user_state->fingerprint_state = state; + LoginBigUserView* big_view = + TryToFindBigUser(account_id, true /*require_auth_active*/); + if (!big_view || !big_view->auth_user()) + return; + + big_view->auth_user()->SetFingerprintState(user_state->fingerprint_state); + LayoutAuth(big_view, nullptr /*opt_to_hide*/, true /*animate*/); +} + void LockContentsView::SetAvatarForUser(const AccountId& account_id, const mojom::UserAvatarPtr& avatar) { auto replace = [&](const ash::mojom::LoginUserInfoPtr& user) { @@ -1207,10 +1229,17 @@ GetKeyboardController(); const bool keyboard_visible = keyboard_controller ? keyboard_controller->keyboard_visible() : false; - if (state->show_pin && !keyboard_visible) + if (state->show_pin && !keyboard_visible && + state->fingerprint_state == + mojom::FingerprintUnlockState::UNAVAILABLE) { to_update_auth |= LoginAuthUserView::AUTH_PIN; + } if (state->enable_tap_auth) to_update_auth |= LoginAuthUserView::AUTH_TAP; + if (state->fingerprint_state != + mojom::FingerprintUnlockState::UNAVAILABLE) { + to_update_auth |= LoginAuthUserView::AUTH_FINGERPRINT; + } } opt_to_update->SetAuthMethods(to_update_auth); }
diff --git a/ash/login/ui/lock_contents_view.h b/ash/login/ui/lock_contents_view.h index e0748ac..55ccb3e 100644 --- a/ash/login/ui/lock_contents_view.h +++ b/ash/login/ui/lock_contents_view.h
@@ -140,6 +140,9 @@ const std::vector<mojom::InputMethodItemPtr>& keyboard_layouts) override; void OnDetachableBasePairingStatusChanged( DetachableBasePairingStatus pairing_status) override; + void OnFingerprintUnlockStateChanged( + const AccountId& account_id, + mojom::FingerprintUnlockState state) override; // SystemTrayFocusObserver: void OnFocusLeavingSystemTray(bool reverse) override; @@ -174,6 +177,7 @@ bool enable_tap_auth = false; bool force_online_sign_in = false; mojom::EasyUnlockIconOptionsPtr easy_unlock_state; + mojom::FingerprintUnlockState fingerprint_state; private: DISALLOW_COPY_AND_ASSIGN(UserState);
diff --git a/ash/login/ui/login_auth_user_view.cc b/ash/login/ui/login_auth_user_view.cc index 2fecd882..707fef7 100644 --- a/ash/login/ui/login_auth_user_view.cc +++ b/ash/login/ui/login_auth_user_view.cc
@@ -56,6 +56,17 @@ // The color of the online sign-in message text. constexpr SkColor kOnlineSignInMessageColor = SkColorSetRGB(0xE6, 0x7C, 0x73); +constexpr SkColor kFingerprintIconViewBorderColor = + SkColorSetARGB(0x57, 0xFF, 0xFF, 0xFF); +constexpr SkColor kFingerprintIconAndTextColor = + SkColorSetARGB(0x8A, 0xFF, 0xFF, 0xFF); +constexpr int kFingerprintIconViewBorderThickness = 1; +constexpr int kFingerprintIconViewSizeDp = 64; +constexpr int kFingerprintIconSizeDp = 32; +constexpr int kResetToDefaultIconColorDelayMs = 500; +constexpr int kFingerprintIconTopSpacing = 50; +constexpr int kSpacingBetweenFingerprintIconAndLabel = 20; + // Returns an observer that will hide |view| when it fires. The observer will // delete itself after firing. Make sure to call |observer->SetReady()| after // attaching it. @@ -74,8 +85,112 @@ view)); } +// A view which has a round border and a fingerprint icon at the center. +class FingerprintIconView : public views::View { + public: + FingerprintIconView() { + SetPreferredSize( + gfx::Size(kFingerprintIconViewSizeDp, kFingerprintIconViewSizeDp)); + icon_ = new views::ImageView; + icon_->SetVerticalAlignment(views::ImageView::CENTER); + icon_->SetPreferredSize( + gfx::Size(kFingerprintIconSizeDp, kFingerprintIconSizeDp)); + SetIconColor(kFingerprintIconAndTextColor); + AddChildView(icon_); + SetBorder(views::CreateRoundedRectBorder( + kFingerprintIconViewBorderThickness, kFingerprintIconViewSizeDp / 2, + kFingerprintIconViewBorderColor)); + } + + ~FingerprintIconView() override = default; + + // Set color of the icon. The color will be reset to + // kFingerprintIconAndTextColor after a short period if different. + void SetIconColor(SkColor color) { + if (color_ == color) + return; + color_ = color; + reset_icon_color_.Stop(); + icon_->SetImage(gfx::CreateVectorIcon(kLockScreenFingerprintIcon, + kFingerprintIconSizeDp, color)); + + if (color_ != kFingerprintIconAndTextColor) { + reset_icon_color_.Start( + FROM_HERE, + base::TimeDelta::FromMilliseconds(kResetToDefaultIconColorDelayMs), + base::BindRepeating(&FingerprintIconView::SetIconColor, + base::Unretained(this), + kFingerprintIconAndTextColor)); + } + } + + void Layout() override { + gfx::Rect icon_bounds = GetContentsBounds(); + icon_bounds.ClampToCenteredSize( + gfx::Size(kFingerprintIconSizeDp, kFingerprintIconSizeDp)); + icon_->SetBoundsRect(icon_bounds); + } + + private: + views::ImageView* icon_ = nullptr; + base::OneShotTimer reset_icon_color_; + SkColor color_; + + DISALLOW_COPY_AND_ASSIGN(FingerprintIconView); +}; + } // namespace +// Consists of fingerprint icon view and a label. +class LoginAuthUserView::FingerprintView : public views::View { + public: + FingerprintView() { + SetPaintToLayer(); + layer()->SetFillsBoundsOpaquely(false); + + icon_view_ = new FingerprintIconView(); + AddChildView(icon_view_); + label_ = new views::Label( + l10n_util::GetStringUTF16(IDS_ASH_LOGIN_FINGERPRINT_UNLOCK_MESSAGE)); + label_->SetSubpixelRenderingEnabled(false); + label_->SetAutoColorReadabilityEnabled(false); + label_->SetEnabledColor(kFingerprintIconAndTextColor); + AddChildView(label_); + } + + void SetIconColor(SkColor color) { icon_view_->SetIconColor(color); } + + void Layout() override { + gfx::Rect bounds = GetContentsBounds(); + icon_view_->SizeToPreferredSize(); + icon_view_->SetPosition( + gfx::Point((bounds.width() - icon_view_->width()) / 2, + bounds.y() + kFingerprintIconTopSpacing)); + label_->SizeToPreferredSize(); + label_->SetPosition( + gfx::Point(bounds.x(), icon_view_->bounds().bottom() + + kSpacingBetweenFingerprintIconAndLabel)); + } + + ~FingerprintView() override = default; + + gfx::Size CalculatePreferredSize() const override { + int preferred_height = label_->GetPreferredSize().height() + + icon_view_->GetPreferredSize().height() + + kFingerprintIconTopSpacing + + kSpacingBetweenFingerprintIconAndLabel; + int preferred_width = std::max(label_->GetPreferredSize().width(), + icon_view_->GetPreferredSize().width()); + return gfx::Size(preferred_width, preferred_height); + } + + private: + FingerprintIconView* icon_view_ = nullptr; + views::Label* label_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(FingerprintView); +}; + struct LoginAuthUserView::AnimationState { int non_pin_y_start_in_screen = 0; gfx::Point pin_start_in_screen; @@ -165,6 +280,8 @@ this, base::UTF8ToUTF16(user->basic_user_info->display_name)); DecorateOnlineSignInMessage(); + fingerprint_view_ = new FingerprintView(); + SetPaintToLayer(ui::LayerType::LAYER_NOT_DRAWN); // Build layout. @@ -176,10 +293,13 @@ login_layout_util::WrapViewForPreferredSize(user_view_); auto* wrapped_pin_view = login_layout_util::WrapViewForPreferredSize(pin_view_); + auto* wrapped_fingerprint_view = + login_layout_util::WrapViewForPreferredSize(fingerprint_view_); // Add views in tabbing order; they are rendered in a different order below. AddChildView(wrapped_password_view); AddChildView(wrapped_message_view); + AddChildView(wrapped_fingerprint_view); AddChildView(wrapped_pin_view); AddChildView(wrapped_user_view); @@ -206,6 +326,7 @@ add_view(wrapped_password_view); add_view(wrapped_message_view); add_padding(kDistanceBetweenPasswordFieldAndPinKeyboard); + add_view(wrapped_fingerprint_view); add_view(wrapped_pin_view); add_padding(kDistanceFromPinKeyboardToBigUserViewBottom); @@ -224,6 +345,7 @@ bool has_pin = HasAuthMethod(AUTH_PIN); bool has_tap = HasAuthMethod(AUTH_TAP); bool force_online_sign_in = HasAuthMethod(AUTH_ONLINE_SIGN_IN); + bool has_fingerprint = HasAuthMethod(AUTH_FINGERPRINT); online_sign_in_message_->SetVisible(force_online_sign_in); @@ -236,6 +358,7 @@ password_view_->RequestFocus(); pin_view_->SetVisible(has_pin); + fingerprint_view_->SetVisible(has_fingerprint); // Note: if both |has_tap| and |has_pin| are true, prefer tap placeholder. if (has_tap) { @@ -368,6 +491,20 @@ base::UTF8ToUTF16(user->basic_user_info->display_name)); } +void LoginAuthUserView::SetFingerprintState( + mojom::FingerprintUnlockState state) { + fingerprint_view_->SetVisible(state != + mojom::FingerprintUnlockState::UNAVAILABLE); + + SkColor color = kFingerprintIconAndTextColor; + if (state == mojom::FingerprintUnlockState::AUTH_SUCCESS) { + color = SK_ColorBLUE; + } else if (state == mojom::FingerprintUnlockState::AUTH_FAILED) { + color = SK_ColorRED; + } + fingerprint_view_->SetIconColor(color); +} + const mojom::LoginUserInfoPtr& LoginAuthUserView::current_user() const { return user_view_->current_user(); }
diff --git a/ash/login/ui/login_auth_user_view.h b/ash/login/ui/login_auth_user_view.h index e38348ca..5c218626 100644 --- a/ash/login/ui/login_auth_user_view.h +++ b/ash/login/ui/login_auth_user_view.h
@@ -82,6 +82,7 @@ AUTH_PIN = 1 << 1, // Display PIN keyboard. AUTH_TAP = 1 << 2, // Tap to unlock. AUTH_ONLINE_SIGN_IN = 1 << 3, // Force online sign-in. + AUTH_FINGERPRINT = 1 << 4, // Use fingerprint to unlock. }; LoginAuthUserView(const mojom::LoginUserInfoPtr& user, @@ -107,6 +108,8 @@ // Update the displayed name, icon, etc to that of |user|. void UpdateForUser(const mojom::LoginUserInfoPtr& user); + void SetFingerprintState(mojom::FingerprintUnlockState state); + const mojom::LoginUserInfoPtr& current_user() const; LoginPasswordView* password_view() { return password_view_; } @@ -121,6 +124,7 @@ private: struct AnimationState; + class FingerprintView; // Called when the user submits an auth method. Runs mojo call. void OnAuthSubmit(const base::string16& password); @@ -147,6 +151,7 @@ LoginPasswordView* password_view_ = nullptr; LoginPinView* pin_view_ = nullptr; views::LabelButton* online_sign_in_message_ = nullptr; + FingerprintView* fingerprint_view_ = nullptr; const OnAuthCallback on_auth_; const LoginUserView::OnTap on_tap_;
diff --git a/ash/login/ui/login_data_dispatcher.cc b/ash/login/ui/login_data_dispatcher.cc index 0a4e7efa..bc440cfd 100644 --- a/ash/login/ui/login_data_dispatcher.cc +++ b/ash/login/ui/login_data_dispatcher.cc
@@ -52,6 +52,10 @@ void LoginDataDispatcher::Observer::OnDetachableBasePairingStatusChanged( DetachableBasePairingStatus pairing_status) {} +void LoginDataDispatcher::Observer::OnFingerprintUnlockStateChanged( + const AccountId& account_id, + mojom::FingerprintUnlockState state) {} + LoginDataDispatcher::LoginDataDispatcher() = default; LoginDataDispatcher::~LoginDataDispatcher() = default; @@ -143,4 +147,11 @@ observer.OnDetachableBasePairingStatusChanged(pairing_status); } +void LoginDataDispatcher::SetFingerprintUnlockState( + const AccountId& account_id, + mojom::FingerprintUnlockState state) { + for (auto& observer : observers_) + observer.OnFingerprintUnlockStateChanged(account_id, state); +} + } // namespace ash
diff --git a/ash/login/ui/login_data_dispatcher.h b/ash/login/ui/login_data_dispatcher.h index b360775..1836980e 100644 --- a/ash/login/ui/login_data_dispatcher.h +++ b/ash/login/ui/login_data_dispatcher.h
@@ -96,6 +96,11 @@ // base is attached or detached. virtual void OnDetachableBasePairingStatusChanged( DetachableBasePairingStatus pairing_status); + + // Called when fingerprint unlock state changes for user with |account_id|. + virtual void OnFingerprintUnlockStateChanged( + const AccountId& account_id, + mojom::FingerprintUnlockState state); }; LoginDataDispatcher(); @@ -126,6 +131,8 @@ const std::vector<mojom::InputMethodItemPtr>& keyboard_layouts); void SetDetachableBasePairingStatus( DetachableBasePairingStatus pairing_status); + void SetFingerprintUnlockState(const AccountId& account_id, + mojom::FingerprintUnlockState state); private: base::ObserverList<Observer> observers_;
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index 11df2f3..0d05e11e 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -95,6 +95,7 @@ deps = [ "//chromeos:power_manager_proto", "//components/prefs", + "//services/ui/public/interfaces", "//skia/public/interfaces", "//ui/aura", "//ui/chromeos/strings", @@ -102,6 +103,7 @@ "//ui/events/devices", "//ui/views", "//ui/views/mus", + "//ui/wm", ] public_deps = [
diff --git a/ash/public/cpp/ash_pref_names.cc b/ash/public/cpp/ash_pref_names.cc index f20d3d41..cb7502d 100644 --- a/ash/public/cpp/ash_pref_names.cc +++ b/ash/public/cpp/ash_pref_names.cc
@@ -63,6 +63,8 @@ "settings.a11y.select_to_speak"; // A boolean pref which determines whether switch access is enabled. const char kAccessibilitySwitchAccessEnabled[] = "settings.a11y.switch_access"; +// A boolean pref which determines whether dictation is enabled. +const char kAccessibilityDictationEnabled[] = "settings.a11y.dictation"; // A boolean pref which determines whether the accessibility menu shows // regardless of the state of a11y features. const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu";
diff --git a/ash/public/cpp/ash_pref_names.h b/ash/public/cpp/ash_pref_names.h index f1e39d2..c316abf 100644 --- a/ash/public/cpp/ash_pref_names.h +++ b/ash/public/cpp/ash_pref_names.h
@@ -28,6 +28,7 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilityFocusHighlightEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilitySelectToSpeakEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessEnabled[]; +ASH_PUBLIC_EXPORT extern const char kAccessibilityDictationEnabled[]; ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[]; ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[];
diff --git a/ash/public/cpp/window_properties.cc b/ash/public/cpp/window_properties.cc index 56d79821..8461e724 100644 --- a/ash/public/cpp/window_properties.cc +++ b/ash/public/cpp/window_properties.cc
@@ -5,10 +5,16 @@ #include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/shelf_types.h" +#include "ash/public/cpp/window_pin_type.h" +#include "ash/public/cpp/window_state_type.h" #include "ash/public/interfaces/window_pin_type.mojom.h" +#include "ash/public/interfaces/window_properties.mojom.h" #include "ash/public/interfaces/window_state_type.mojom.h" +#include "services/ui/public/interfaces/window_manager.mojom.h" +#include "ui/aura/mus/property_converter.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/image/image_skia.h" +#include "ui/wm/core/shadow_types.h" DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, ash::mojom::WindowPinType) @@ -19,6 +25,57 @@ namespace ash { +void RegisterWindowProperties(aura::PropertyConverter* property_converter) { + property_converter->RegisterPrimitiveProperty( + kCanConsumeSystemKeysKey, mojom::kCanConsumeSystemKeys_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + property_converter->RegisterImageSkiaProperty( + kFrameImageActiveKey, mojom::kFrameImageActive_Property); + property_converter->RegisterPrimitiveProperty( + kHideShelfWhenFullscreenKey, mojom::kHideShelfWhenFullscreen_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + property_converter->RegisterPrimitiveProperty( + kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + property_converter->RegisterPrimitiveProperty( + kRenderTitleAreaProperty, + ui::mojom::WindowManager::kRenderParentTitleArea_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + // This property is already registered by MusClient in Chrome, but not in Ash. + if (!property_converter->IsTransportNameRegistered( + ui::mojom::WindowManager::kShadowElevation_Property)) { + property_converter->RegisterPrimitiveProperty( + ::wm::kShadowElevationKey, + ui::mojom::WindowManager::kShadowElevation_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + } + property_converter->RegisterPrimitiveProperty( + kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property, + base::BindRepeating(&IsValidShelfItemType)); + property_converter->RegisterPrimitiveProperty( + kWindowStateTypeKey, mojom::kWindowStateType_Property, + base::BindRepeating(&IsValidWindowStateType)); + property_converter->RegisterPrimitiveProperty( + kWindowPinTypeKey, mojom::kWindowPinType_Property, + base::BindRepeating(&IsValidWindowPinType)); + property_converter->RegisterPrimitiveProperty( + kWindowPositionManagedTypeKey, mojom::kWindowPositionManaged_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + property_converter->RegisterStringProperty( + kShelfIDKey, ui::mojom::WindowManager::kShelfID_Property); + property_converter->RegisterPrimitiveProperty( + kRestoreBoundsOverrideKey, mojom::kRestoreBoundsOverride_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); + property_converter->RegisterPrimitiveProperty( + kRestoreWindowStateTypeOverrideKey, + mojom::kRestoreWindowStateTypeOverride_Property, + base::BindRepeating(&IsValidWindowStateType)); + property_converter->RegisterPrimitiveProperty( + kWindowTitleShownKey, + ui::mojom::WindowManager::kWindowTitleShown_Property, + aura::PropertyConverter::CreateAcceptAnyValueCallback()); +} + DEFINE_UI_CLASS_PROPERTY_KEY(BackdropWindowMode, kBackdropWindowMode, BackdropWindowMode::kAuto); @@ -28,6 +85,7 @@ nullptr); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHideShelfWhenFullscreenKey, true); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kPanelAttachedKey, true); +DEFINE_UI_CLASS_PROPERTY_KEY(bool, kRenderTitleAreaProperty, false); DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(gfx::Rect, kRestoreBoundsOverrideKey, nullptr);
diff --git a/ash/public/cpp/window_properties.h b/ash/public/cpp/window_properties.h index dafb85f..4b92d32a 100644 --- a/ash/public/cpp/window_properties.h +++ b/ash/public/cpp/window_properties.h
@@ -13,6 +13,7 @@ #include "ui/base/class_property.h" namespace aura { +class PropertyConverter; template <typename T> using WindowProperty = ui::ClassProperty<T>; } @@ -35,6 +36,11 @@ kAuto, // The window manager decides if the window should have a backdrop. }; +// Registers Ash's properties with the given PropertyConverter. This allows Ash +// and other services (eg. Chrome) to exchange Ash window property values. +ASH_PUBLIC_EXPORT void RegisterWindowProperties( + aura::PropertyConverter* property_converter); + // Shell-specific window property keys for use by ash and its clients. // Alphabetical sort. @@ -61,6 +67,10 @@ ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const kPanelAttachedKey; +// Maps to ui::mojom::WindowManager::kRenderParentTitleArea_Property. +ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const + kRenderTitleAreaProperty; + // A property key which stores the bounds to restore a window to. These take // preference over the current bounds. This is used by e.g. the tablet mode // window manager.
diff --git a/ash/public/interfaces/login_screen.mojom b/ash/public/interfaces/login_screen.mojom index 0eb58f2..d2e5a0ad 100644 --- a/ash/public/interfaces/login_screen.mojom +++ b/ash/public/interfaces/login_screen.mojom
@@ -112,6 +112,10 @@ SetPublicSessionKeyboardLayouts(signin.mojom.AccountId account_id, string locale, array<InputMethodItem> keyboard_layouts); + + // Set the fingerprint unlock state for user with |account_id|. + SetFingerprintUnlockState(signin.mojom.AccountId account_id, + FingerprintUnlockState state); }; // Allows ash lock screen to control a client (e.g. Chrome browser). Requests
diff --git a/ash/public/interfaces/login_user_info.mojom b/ash/public/interfaces/login_user_info.mojom index 150897e9..6bee6bde 100644 --- a/ash/public/interfaces/login_user_info.mojom +++ b/ash/public/interfaces/login_user_info.mojom
@@ -38,6 +38,18 @@ SPINNER, }; +// Fingerprint unlock state in the views lock screen. +enum FingerprintUnlockState { + // Fingerprint unlock is not available. + UNAVAILABLE, + // Fingerprint unlock is available. + AVAILABLE, + // The unlock attempt is successful, the fingerprint is matched. + AUTH_SUCCESS, + // The unlock attempt is unsuccessful, the fingerprint is not recognized. + AUTH_FAILED, +}; + // Information about the custom icon in the user pod. struct EasyUnlockIconOptions { // Icon that should be displayed.
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index d110d52..24a1846 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -22,6 +22,7 @@ "lock_screen_backspace.icon", "lock_screen_caps_lock.icon", "lock_screen_dropdown.icon", + "lock_screen_fingerprint.icon", "login_screen_button_dropdown.icon", "login_screen_menu_dropdown.icon", "login_screen_enterprise.icon",
diff --git a/ash/resources/vector_icons/lock_screen_fingerprint.icon b/ash/resources/vector_icons/lock_screen_fingerprint.icon new file mode 100644 index 0000000..5fc5ed7 --- /dev/null +++ b/ash/resources/vector_icons/lock_screen_fingerprint.icon
@@ -0,0 +1,174 @@ +// 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. + +CANVAS_DIMENSIONS, 54, +MOVE_TO, 40.07f, 10.06f, +CUBIC_TO, 39.89f, 10.06f, 39.72f, 10.01f, 39.56f, 9.93f, +CUBIC_TO, 35.25f, 7.71f, 31.5f, 6.75f, 27.02f, 6.75f, +CUBIC_TO, 22.56f, 6.75f, 18.35f, 7.82f, 14.49f, 9.92f, +CUBIC_TO, 13.94f, 10.22f, 13.26f, 10.02f, 12.96f, 9.47f, +CUBIC_TO, 12.67f, 8.92f, 12.86f, 8.25f, 13.41f, 7.94f, +CUBIC_TO, 17.61f, 5.66f, 22.19f, 4.5f, 27.02f, 4.5f, +CUBIC_TO, 31.82f, 4.5f, 36, 5.56f, 40.59f, 7.93f, +CUBIC_TO, 41.14f, 8.21f, 41.36f, 8.9f, 41.07f, 9.45f, +CUBIC_TO, 40.87f, 9.83f, 40.48f, 10.06f, 40.07f, 10.06f, +LINE_TO, 40.07f, 10.06f, +CLOSE, +MOVE_TO, 7.88f, 21.87f, +CUBIC_TO, 7.65f, 21.87f, 7.43f, 21.8f, 7.22f, 21.67f, +CUBIC_TO, 6.72f, 21.31f, 6.59f, 20.61f, 6.95f, 20.1f, +CUBIC_TO, 9.18f, 16.95f, 12.03f, 14.48f, 15.4f, 12.74f, +CUBIC_TO, 22.48f, 9.08f, 31.52f, 9.07f, 38.61f, 12.71f, +CUBIC_TO, 41.97f, 14.45f, 44.81f, 16.9f, 47.05f, 20.02f, +CUBIC_TO, 47.41f, 20.53f, 47.3f, 21.23f, 46.79f, 21.59f, +CUBIC_TO, 46.28f, 21.95f, 45.57f, 21.84f, 45.21f, 21.33f, +CUBIC_TO, 43.19f, 18.5f, 40.62f, 16.27f, 37.59f, 14.72f, +CUBIC_TO, 31.13f, 11.4f, 22.88f, 11.41f, 16.44f, 14.74f, +CUBIC_TO, 13.39f, 16.31f, 10.81f, 18.55f, 8.8f, 21.41f, +CUBIC_TO, 8.57f, 21.71f, 8.22f, 21.87f, 7.88f, 21.87f, +LINE_TO, 7.88f, 21.87f, +CLOSE, +MOVE_TO, 21.95f, 49.02f, +CUBIC_TO, 21.66f, 49.02f, 21.38f, 48.9f, 21.15f, 48.68f, +CUBIC_TO, 19.2f, 46.71f, 18.15f, 45.46f, 16.63f, 42.75f, +CUBIC_TO, 15.08f, 39.98f, 14.25f, 36.6f, 14.25f, 32.97f, +CUBIC_TO, 14.25f, 26.29f, 19.97f, 20.85f, 27, 20.85f, +CUBIC_TO, 34.03f, 20.85f, 39.75f, 26.28f, 39.75f, 32.97f, +CUBIC_TO, 39.75f, 33.59f, 39.24f, 34.1f, 38.62f, 34.1f, +CUBIC_TO, 38, 34.1f, 37.5f, 33.59f, 37.5f, 32.97f, +CUBIC_TO, 37.5f, 27.53f, 32.79f, 23.1f, 27, 23.1f, +CUBIC_TO, 21.22f, 23.1f, 16.5f, 27.53f, 16.5f, 32.97f, +CUBIC_TO, 16.5f, 36.21f, 17.22f, 39.21f, 18.59f, 41.65f, +CUBIC_TO, 20.04f, 44.24f, 21, 45.35f, 22.74f, 47.09f, +CUBIC_TO, 23.18f, 47.53f, 23.18f, 48.25f, 22.73f, 48.68f, +CUBIC_TO, 22.52f, 48.92f, 22.23f, 49.02f, 21.95f, 49.02f, +LINE_TO, 21.95f, 49.02f, +CLOSE, +MOVE_TO, 38.07f, 44.85f, +CUBIC_TO, 35.39f, 44.85f, 33.04f, 44.18f, 31.1f, 42.86f, +CUBIC_TO, 27.75f, 40.59f, 25.75f, 36.9f, 25.75f, 32.99f, +CUBIC_TO, 25.75f, 32.37f, 26.26f, 31.86f, 26.88f, 31.86f, +CUBIC_TO, 27.5f, 31.86f, 28, 32.37f, 28, 32.99f, +CUBIC_TO, 28, 36.15f, 29.63f, 39.14f, 32.37f, 41, +CUBIC_TO, 33.95f, 42.08f, 35.82f, 42.6f, 38.07f, 42.6f, +CUBIC_TO, 38.61f, 42.6f, 39.52f, 42.55f, 40.42f, 42.39f, +CUBIC_TO, 41.03f, 42.28f, 41.61f, 42.69f, 41.73f, 43.3f, +CUBIC_TO, 41.84f, 43.91f, 41.42f, 44.49f, 40.82f, 44.61f, +CUBIC_TO, 39.5f, 44.84f, 38.39f, 44.85f, 38.07f, 44.85f, +LINE_TO, 38.07f, 44.85f, +CLOSE, +MOVE_TO, 33.54f, 49.5f, +CUBIC_TO, 33.44f, 49.5f, 33.33f, 49.49f, 33.24f, 49.46f, +CUBIC_TO, 29.66f, 48.48f, 27.32f, 47.15f, 24.89f, 44.73f, +CUBIC_TO, 21.75f, 41.6f, 20.01f, 37.43f, 20.01f, 32.99f, +CUBIC_TO, 20.01f, 29.33f, 23.12f, 26.36f, 26.94f, 26.36f, +CUBIC_TO, 30.77f, 26.36f, 33.87f, 29.33f, 33.87f, 32.99f, +CUBIC_TO, 33.87f, 35.39f, 35.98f, 37.36f, 38.55f, 37.36f, +CUBIC_TO, 41.13f, 37.36f, 43.23f, 35.4f, 43.23f, 32.99f, +CUBIC_TO, 43.23f, 24.5f, 35.92f, 17.61f, 26.93f, 17.61f, +CUBIC_TO, 20.53f, 17.61f, 14.69f, 21.16f, 12.06f, 26.67f, +CUBIC_TO, 11.18f, 28.5f, 10.74f, 30.62f, 10.74f, 32.99f, +CUBIC_TO, 10.74f, 34.74f, 10.9f, 37.51f, 12.24f, 41.1f, +CUBIC_TO, 12.45f, 41.68f, 12.16f, 42.32f, 11.58f, 42.55f, +CUBIC_TO, 10.99f, 42.76f, 10.35f, 42.47f, 10.13f, 41.88f, +CUBIC_TO, 9.02f, 38.92f, 8.48f, 36.02f, 8.48f, 32.99f, +CUBIC_TO, 8.48f, 30.29f, 9, 27.83f, 10.02f, 25.71f, +CUBIC_TO, 13.03f, 19.43f, 19.67f, 15.37f, 26.92f, 15.37f, +CUBIC_TO, 37.15f, 15.37f, 45.47f, 23.28f, 45.47f, 33, +CUBIC_TO, 45.47f, 36.65f, 42.36f, 39.62f, 38.54f, 39.62f, +CUBIC_TO, 34.73f, 39.62f, 31.61f, 36.65f, 31.61f, 33, +CUBIC_TO, 31.61f, 30.59f, 29.51f, 28.62f, 26.93f, 28.62f, +CUBIC_TO, 24.36f, 28.62f, 22.25f, 30.58f, 22.25f, 33, +CUBIC_TO, 22.25f, 36.83f, 23.75f, 40.44f, 26.46f, 43.14f, +CUBIC_TO, 28.59f, 45.26f, 30.66f, 46.43f, 33.83f, 47.3f, +CUBIC_TO, 34.42f, 47.46f, 34.78f, 48.08f, 34.62f, 48.68f, +CUBIC_TO, 34.48f, 49.17f, 34.03f, 49.5f, 33.54f, 49.5f, +LINE_TO, 33.54f, 49.5f, +CLOSE + +CANVAS_DIMENSIONS, 27, +MOVE_TO, 20.04f, 5.03f, +CUBIC_TO, 19.95f, 5.03f, 19.86f, 5.01f, 19.78f, 4.97f, +CUBIC_TO, 17.62f, 3.85f, 15.75f, 3.38f, 13.51f, 3.38f, +CUBIC_TO, 11.28f, 3.38f, 9.17f, 3.91f, 7.25f, 4.96f, +CUBIC_TO, 6.97f, 5.11f, 6.63f, 5.01f, 6.48f, 4.74f, +CUBIC_TO, 6.33f, 4.46f, 6.43f, 4.12f, 6.71f, 3.97f, +CUBIC_TO, 8.8f, 2.83f, 11.09f, 2.25f, 13.51f, 2.25f, +CUBIC_TO, 15.91f, 2.25f, 18, 2.78f, 20.3f, 3.97f, +CUBIC_TO, 20.57f, 4.11f, 20.68f, 4.45f, 20.54f, 4.72f, +CUBIC_TO, 20.44f, 4.92f, 20.24f, 5.03f, 20.04f, 5.03f, +LINE_TO, 20.04f, 5.03f, +CLOSE, +MOVE_TO, 3.94f, 10.94f, +CUBIC_TO, 3.83f, 10.94f, 3.71f, 10.9f, 3.61f, 10.83f, +CUBIC_TO, 3.36f, 10.65f, 3.3f, 10.31f, 3.48f, 10.05f, +CUBIC_TO, 4.59f, 8.48f, 6.01f, 7.24f, 7.7f, 6.37f, +CUBIC_TO, 11.24f, 4.54f, 15.76f, 4.53f, 19.31f, 6.36f, +CUBIC_TO, 20.99f, 7.22f, 22.4f, 8.45f, 23.52f, 10.01f, +CUBIC_TO, 23.7f, 10.27f, 23.65f, 10.61f, 23.39f, 10.79f, +CUBIC_TO, 23.14f, 10.97f, 22.79f, 10.92f, 22.61f, 10.67f, +CUBIC_TO, 21.59f, 9.25f, 20.31f, 8.13f, 18.79f, 7.36f, +CUBIC_TO, 15.56f, 5.7f, 11.44f, 5.7f, 8.22f, 7.37f, +CUBIC_TO, 6.69f, 8.16f, 5.41f, 9.28f, 4.4f, 10.7f, +CUBIC_TO, 4.29f, 10.86f, 4.11f, 10.94f, 3.94f, 10.94f, +LINE_TO, 3.94f, 10.94f, +CLOSE, +MOVE_TO, 10.97f, 24.51f, +CUBIC_TO, 10.83f, 24.51f, 10.69f, 24.45f, 10.58f, 24.34f, +CUBIC_TO, 9.6f, 23.36f, 9.07f, 22.73f, 8.31f, 21.38f, +CUBIC_TO, 7.54f, 19.99f, 7.13f, 18.3f, 7.13f, 16.49f, +CUBIC_TO, 7.13f, 13.15f, 9.98f, 10.42f, 13.5f, 10.42f, +CUBIC_TO, 17.02f, 10.42f, 19.87f, 13.14f, 19.87f, 16.49f, +CUBIC_TO, 19.87f, 16.8f, 19.62f, 17.05f, 19.31f, 17.05f, +CUBIC_TO, 19, 17.05f, 18.75f, 16.8f, 18.75f, 16.49f, +CUBIC_TO, 18.75f, 13.76f, 16.4f, 11.55f, 13.5f, 11.55f, +CUBIC_TO, 10.61f, 11.55f, 8.25f, 13.76f, 8.25f, 16.49f, +CUBIC_TO, 8.25f, 18.11f, 8.61f, 19.6f, 9.29f, 20.82f, +CUBIC_TO, 10.02f, 22.12f, 10.5f, 22.67f, 11.37f, 23.55f, +CUBIC_TO, 11.59f, 23.77f, 11.59f, 24.13f, 11.36f, 24.34f, +CUBIC_TO, 11.26f, 24.46f, 11.12f, 24.51f, 10.97f, 24.51f, +LINE_TO, 10.97f, 24.51f, +CLOSE, +MOVE_TO, 19.04f, 22.43f, +CUBIC_TO, 17.7f, 22.43f, 16.52f, 22.09f, 15.55f, 21.43f, +CUBIC_TO, 13.88f, 20.3f, 12.88f, 18.45f, 12.88f, 16.49f, +CUBIC_TO, 12.88f, 16.18f, 13.13f, 15.93f, 13.44f, 15.93f, +CUBIC_TO, 13.75f, 15.93f, 14, 16.18f, 14, 16.49f, +CUBIC_TO, 14, 18.07f, 14.82f, 19.57f, 16.18f, 20.5f, +CUBIC_TO, 16.98f, 21.04f, 17.91f, 21.3f, 19.04f, 21.3f, +CUBIC_TO, 19.31f, 21.3f, 19.76f, 21.27f, 20.21f, 21.2f, +CUBIC_TO, 20.51f, 21.14f, 20.81f, 21.35f, 20.86f, 21.65f, +CUBIC_TO, 20.92f, 21.95f, 20.71f, 22.25f, 20.41f, 22.3f, +CUBIC_TO, 19.75f, 22.42f, 19.19f, 22.43f, 19.04f, 22.43f, +LINE_TO, 19.04f, 22.43f, +CLOSE, +MOVE_TO, 16.77f, 24.75f, +CUBIC_TO, 16.72f, 24.75f, 16.67f, 24.74f, 16.62f, 24.73f, +CUBIC_TO, 14.83f, 24.24f, 13.66f, 23.57f, 12.44f, 22.37f, +CUBIC_TO, 10.87f, 20.8f, 10.01f, 18.71f, 10.01f, 16.49f, +CUBIC_TO, 10.01f, 14.66f, 11.56f, 13.18f, 13.47f, 13.18f, +CUBIC_TO, 15.38f, 13.18f, 16.94f, 14.66f, 16.94f, 16.49f, +CUBIC_TO, 16.94f, 17.7f, 17.99f, 18.68f, 19.28f, 18.68f, +CUBIC_TO, 20.57f, 18.68f, 21.62f, 17.7f, 21.62f, 16.49f, +CUBIC_TO, 21.62f, 12.25f, 17.96f, 8.8f, 13.47f, 8.8f, +CUBIC_TO, 10.27f, 8.8f, 7.35f, 10.58f, 6.03f, 13.34f, +CUBIC_TO, 5.59f, 14.25f, 5.37f, 15.31f, 5.37f, 16.49f, +CUBIC_TO, 5.37f, 17.37f, 5.45f, 18.75f, 6.12f, 20.55f, +CUBIC_TO, 6.23f, 20.84f, 6.08f, 21.16f, 5.79f, 21.27f, +CUBIC_TO, 5.5f, 21.38f, 5.18f, 21.23f, 5.06f, 20.94f, +CUBIC_TO, 4.51f, 19.46f, 4.24f, 18.01f, 4.24f, 16.49f, +CUBIC_TO, 4.24f, 15.14f, 4.5f, 13.92f, 5.01f, 12.85f, +CUBIC_TO, 6.51f, 9.71f, 9.83f, 7.68f, 13.46f, 7.68f, +CUBIC_TO, 18.57f, 7.68f, 22.74f, 11.64f, 22.74f, 16.5f, +CUBIC_TO, 22.74f, 18.33f, 21.18f, 19.81f, 19.27f, 19.81f, +CUBIC_TO, 17.36f, 19.81f, 15.81f, 18.33f, 15.81f, 16.5f, +CUBIC_TO, 15.81f, 15.29f, 14.75f, 14.31f, 13.47f, 14.31f, +CUBIC_TO, 12.18f, 14.31f, 11.13f, 15.29f, 11.13f, 16.5f, +CUBIC_TO, 11.13f, 18.42f, 11.87f, 20.22f, 13.23f, 21.57f, +CUBIC_TO, 14.29f, 22.63f, 15.33f, 23.21f, 16.91f, 23.65f, +CUBIC_TO, 17.21f, 23.73f, 17.39f, 24.04f, 17.31f, 24.34f, +CUBIC_TO, 17.24f, 24.59f, 17.02f, 24.75f, 16.77f, 24.75f, +LINE_TO, 16.77f, 24.75f, +CLOSE +
diff --git a/ash/shell/content/client/shell_content_browser_client.cc b/ash/shell/content/client/shell_content_browser_client.cc index 54efc63..fef2550 100644 --- a/ash/shell/content/client/shell_content_browser_client.cc +++ b/ash/shell/content/client/shell_content_browser_client.cc
@@ -9,11 +9,12 @@ #include "ash/ash_service.h" #include "ash/components/quick_launch/public/mojom/constants.mojom.h" #include "ash/content/content_gpu_support.h" +#include "ash/public/cpp/window_properties.h" #include "ash/public/interfaces/constants.mojom.h" #include "ash/shell.h" #include "ash/shell/content/client/shell_browser_main_parts.h" #include "ash/shell/grit/ash_shell_resources.h" -#include "ash/ws/window_service_delegate_impl.h" +#include "ash/ws/window_service_util.h" #include "base/base_switches.h" #include "base/bind.h" #include "base/command_line.h" @@ -27,7 +28,6 @@ #include "content/public/utility/content_utility_client.h" #include "services/ui/public/interfaces/constants.mojom.h" #include "services/ui/ws2/window_service.h" -#include "services/ui/ws2/window_service_delegate.h" #include "storage/browser/quota/quota_settings.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/resource_bundle.h" @@ -37,10 +37,9 @@ namespace shell { namespace { -std::unique_ptr<service_manager::Service> CreateWindowService() { - return std::make_unique<ui::ws2::WindowService>( - Shell::Get()->window_service_delegate(), - std::make_unique<ContentGpuSupport>()); +// A factory function used in creation of the WindowService. +std::unique_ptr<ui::ws2::GpuSupport> CreateContentGpuSupport() { + return std::make_unique<ContentGpuSupport>(); } } // namespace @@ -97,7 +96,8 @@ AshService::CreateEmbeddedServiceInfo())); service_manager::EmbeddedServiceInfo ws_service_info; - ws_service_info.factory = base::BindRepeating(&CreateWindowService); + ws_service_info.factory = base::BindRepeating( + &CreateWindowService, base::BindRepeating(&CreateContentGpuSupport)); ws_service_info.task_runner = base::ThreadTaskRunnerHandle::Get(); services->insert(std::make_pair(ui::mojom::kServiceName, ws_service_info)); }
diff --git a/ash/system/dictation/dictation_button_tray.cc b/ash/system/dictation/dictation_button_tray.cc index 8b44f0b..317b26f8 100644 --- a/ash/system/dictation/dictation_button_tray.cc +++ b/ash/system/dictation/dictation_button_tray.cc
@@ -59,6 +59,7 @@ } void DictationButtonTray::OnAccessibilityStatusChanged() { + UpdateVisibility(); CheckDictationStatusAndUpdateIcon(); } @@ -82,9 +83,8 @@ } void DictationButtonTray::UpdateVisibility() { - // TODO(zhelfins): Check dictation settings once they are configured. - // https://crbug.com/801398 - bool is_visible = true; + bool is_visible = + Shell::Get()->accessibility_controller()->IsDictationEnabled(); SetVisible(is_visible); }
diff --git a/ash/system/dictation/dictation_button_tray_unittest.cc b/ash/system/dictation/dictation_button_tray_unittest.cc index 398060aa..9f1b2589 100644 --- a/ash/system/dictation/dictation_button_tray_unittest.cc +++ b/ash/system/dictation/dictation_button_tray_unittest.cc
@@ -81,12 +81,14 @@ // Ensures that creation doesn't cause any crashes and adds the image icon. // Also checks that the tray is visible. TEST_F(DictationButtonTrayTest, BasicConstruction) { + Shell::Get()->accessibility_controller()->SetDictationEnabled(true); EXPECT_TRUE(GetImageView(GetTray())); EXPECT_TRUE(GetTray()->visible()); } // Test that clicking the button activates dictation. TEST_F(DictationButtonTrayTest, ButtonActivatesDictation) { + Shell::Get()->accessibility_controller()->SetDictationEnabled(true); AccessibilityController* controller = Shell::Get()->accessibility_controller(); TestAccessibilityControllerClient client; @@ -105,6 +107,7 @@ // Test that activating dictation causes the button to activate. TEST_F(DictationButtonTrayTest, ActivatingDictationActivatesButton) { + Shell::Get()->accessibility_controller()->SetDictationEnabled(true); Shell::Get()->OnDictationStarted(); EXPECT_TRUE(GetTray()->is_active()); @@ -115,6 +118,7 @@ // Tests that the tray only renders as active while dictation is listening. Any // termination of dictation clears the active state. TEST_F(DictationButtonTrayTest, ActiveStateOnlyDuringDictation) { + Shell::Get()->accessibility_controller()->SetDictationEnabled(true); AccessibilityController* controller = Shell::Get()->accessibility_controller(); TestAccessibilityControllerClient client;
diff --git a/ash/system/power/power_button_controller.cc b/ash/system/power/power_button_controller.cc index baede24..fbd0033 100644 --- a/ash/system/power/power_button_controller.cc +++ b/ash/system/power/power_button_controller.cc
@@ -90,13 +90,11 @@ constexpr base::TimeDelta PowerButtonController::kIgnorePowerButtonAfterResumeDelay; -constexpr const char* PowerButtonController::kPositionField; -constexpr const char* PowerButtonController::kXField; -constexpr const char* PowerButtonController::kYField; -constexpr const char* PowerButtonController::kLeftPosition; -constexpr const char* PowerButtonController::kRightPosition; -constexpr const char* PowerButtonController::kTopPosition; -constexpr const char* PowerButtonController::kBottomPosition; +constexpr const char* PowerButtonController::kEdgeField; +constexpr const char* PowerButtonController::kLeftEdge; +constexpr const char* PowerButtonController::kRightEdge; +constexpr const char* PowerButtonController::kTopEdge; +constexpr const char* PowerButtonController::kBottomEdge; // Maintain active state of the given |widget|. Sets |widget| to always render // as active if it's not already initially configured that way. Resets the @@ -558,42 +556,35 @@ return; } - std::string str_power_button_position; - if (!position_info->GetString(kPositionField, &str_power_button_position)) { - LOG(ERROR) << kPositionField << " field is always needed if " - << switches::kAshPowerButtonPosition << " is set"; + std::string edge, position; + if (!position_info->GetString(kEdgeField, &edge) || + !position_info->GetDouble(kPositionField, + &power_button_offset_percentage_)) { + LOG(ERROR) << "Both " << kEdgeField << " field and " << kPositionField + << " are always needed if " << switches::kAshPowerButtonPosition + << " is set"; return; } - if (str_power_button_position == kLeftPosition) { + if (edge == kLeftEdge) { power_button_position_ = PowerButtonPosition::LEFT; - } else if (str_power_button_position == kRightPosition) { + } else if (edge == kRightEdge) { power_button_position_ = PowerButtonPosition::RIGHT; - } else if (str_power_button_position == kTopPosition) { + } else if (edge == kTopEdge) { power_button_position_ = PowerButtonPosition::TOP; - } else if (str_power_button_position == kBottomPosition) { + } else if (edge == kBottomEdge) { power_button_position_ = PowerButtonPosition::BOTTOM; } else { - LOG(ERROR) << "Invalid " << kPositionField << " field in " + LOG(ERROR) << "Invalid " << kEdgeField << " field in " << switches::kAshPowerButtonPosition; return; } - if (power_button_position_ == PowerButtonPosition::LEFT || - power_button_position_ == PowerButtonPosition::RIGHT) { - if (!position_info->GetDouble(kYField, &power_button_offset_percentage_)) { - LOG(ERROR) << kYField << " not set in " - << switches::kAshPowerButtonPosition; - power_button_position_ = PowerButtonPosition::NONE; - return; - } - } else { - if (!position_info->GetDouble(kXField, &power_button_offset_percentage_)) { - LOG(ERROR) << kXField << " not set in " - << switches::kAshPowerButtonPosition; - power_button_position_ = PowerButtonPosition::NONE; - return; - } + if (power_button_offset_percentage_ < 0 || + power_button_offset_percentage_ > 1.0f) { + LOG(ERROR) << "Invalid " << kPositionField << " field in " + << switches::kAshPowerButtonPosition; + power_button_position_ = PowerButtonPosition::NONE; } }
diff --git a/ash/system/power/power_button_controller.h b/ash/system/power/power_button_controller.h index 9574605..0a190266 100644 --- a/ash/system/power/power_button_controller.h +++ b/ash/system/power/power_button_controller.h
@@ -78,15 +78,14 @@ // Value of switches::kAshPowerButtonPosition stored in JSON format. These // are the field names of the flag. + static constexpr const char* kEdgeField = "edge"; static constexpr const char* kPositionField = "position"; - static constexpr const char* kXField = "x"; - static constexpr const char* kYField = "y"; - // Value of |kPositionField|. - static constexpr const char* kLeftPosition = "left"; - static constexpr const char* kRightPosition = "right"; - static constexpr const char* kTopPosition = "top"; - static constexpr const char* kBottomPosition = "bottom"; + // Value of |kEdgeField|. + static constexpr const char* kLeftEdge = "left"; + static constexpr const char* kRightEdge = "right"; + static constexpr const char* kTopEdge = "top"; + static constexpr const char* kBottomEdge = "bottom"; explicit PowerButtonController( BacklightsForcedOffSetter* backlights_forced_off_setter);
diff --git a/ash/system/power/power_button_controller_unittest.cc b/ash/system/power/power_button_controller_unittest.cc index 1f27dd35..8776299 100644 --- a/ash/system/power/power_button_controller_unittest.cc +++ b/ash/system/power/power_button_controller_unittest.cc
@@ -1024,31 +1024,26 @@ base::DictionaryValue position_info; switch (power_button_position_) { case PowerButtonPosition::LEFT: - position_info.SetString(PowerButtonController::kPositionField, - PowerButtonController::kLeftPosition); + position_info.SetString(PowerButtonController::kEdgeField, + PowerButtonController::kLeftEdge); break; case PowerButtonPosition::RIGHT: - position_info.SetString(PowerButtonController::kPositionField, - PowerButtonController::kRightPosition); + position_info.SetString(PowerButtonController::kEdgeField, + PowerButtonController::kRightEdge); break; case PowerButtonPosition::TOP: - position_info.SetString(PowerButtonController::kPositionField, - PowerButtonController::kTopPosition); + position_info.SetString(PowerButtonController::kEdgeField, + PowerButtonController::kTopEdge); break; case PowerButtonPosition::BOTTOM: - position_info.SetString(PowerButtonController::kPositionField, - PowerButtonController::kBottomPosition); + position_info.SetString(PowerButtonController::kEdgeField, + PowerButtonController::kBottomEdge); break; default: return; } - if (IsLeftOrRightPosition()) { - position_info.SetDouble(PowerButtonController::kYField, - kPowerButtonPercentage); - } else { - position_info.SetDouble(PowerButtonController::kXField, - kPowerButtonPercentage); - } + position_info.SetDouble(PowerButtonController::kPositionField, + kPowerButtonPercentage); std::string json_position_info; base::JSONWriter::Write(position_info, &json_position_info);
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index d461396..8b395d7 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc
@@ -52,6 +52,7 @@ A11Y_STICKY_KEYS = 1 << 10, A11Y_SELECT_TO_SPEAK = 1 << 11, A11Y_DOCKED_MAGNIFIER = 1 << 12, + A11Y_DICTATION = 1 << 13, }; uint32_t GetAccessibilityState() { @@ -83,6 +84,8 @@ state |= A11Y_STICKY_KEYS; if (controller->IsSelectToSpeakEnabled()) state |= A11Y_SELECT_TO_SPEAK; + if (controller->IsDictationEnabled()) + state |= A11Y_DICTATION; if (features::IsDockedMagnifierEnabled() && Shell::Get()->docked_magnifier_controller()->GetEnabled()) { state |= A11Y_DOCKED_MAGNIFIER; @@ -148,6 +151,12 @@ TrayPopupUtils::UpdateCheckMarkVisibility(select_to_speak_view_, select_to_speak_enabled_); + if (dictation_view_) { + dictation_enabled_ = controller->IsDictationEnabled(); + TrayPopupUtils::UpdateCheckMarkVisibility(dictation_view_, + dictation_enabled_); + } + high_contrast_enabled_ = controller->IsHighContrastEnabled(); TrayPopupUtils::UpdateCheckMarkVisibility(high_contrast_view_, high_contrast_enabled_); @@ -219,6 +228,15 @@ IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SELECT_TO_SPEAK), select_to_speak_enabled_); + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kEnableExperimentalAccessibilityFeatures)) { + dictation_enabled_ = controller->IsDictationEnabled(); + dictation_view_ = AddScrollListCheckableItem( + kDictationOffIcon, // Need to get Chrome UI Review to comment on this + l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_DICTATION), + dictation_enabled_); + } + high_contrast_enabled_ = controller->IsHighContrastEnabled(); high_contrast_view_ = AddScrollListCheckableItem( kSystemMenuAccessibilityContrastIcon, @@ -317,6 +335,11 @@ ? UserMetricsAction("StatusArea_SelectToSpeakEnabled") : UserMetricsAction("StatusArea_SelectToSpeakDisabled")); controller->SetSelectToSpeakEnabled(new_state); + } else if (view == dictation_view_) { + bool new_state = !controller->IsDictationEnabled(); + RecordAction(new_state ? UserMetricsAction("StatusArea_DictationEnabled") + : UserMetricsAction("StatusArea_DictationDisabled")); + controller->SetDictationEnabled(new_state); } else if (view == high_contrast_view_) { bool new_state = !controller->IsHighContrastEnabled(); RecordAction(new_state
diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h index 7166ec5..4b75a35 100644 --- a/ash/system/tray_accessibility.h +++ b/ash/system/tray_accessibility.h
@@ -64,6 +64,7 @@ HoverHighlightView* spoken_feedback_view_ = nullptr; HoverHighlightView* select_to_speak_view_ = nullptr; + HoverHighlightView* dictation_view_ = nullptr; HoverHighlightView* high_contrast_view_ = nullptr; HoverHighlightView* screen_magnifier_view_ = nullptr; HoverHighlightView* docked_magnifier_view_ = nullptr; @@ -81,6 +82,7 @@ // These exist for tests. The canonical state is stored in prefs. bool spoken_feedback_enabled_ = false; bool select_to_speak_enabled_ = false; + bool dictation_enabled_ = false; bool high_contrast_enabled_ = false; bool screen_magnifier_enabled_ = false; bool docked_magnifier_enabled_ = false;
diff --git a/ash/window_manager.cc b/ash/window_manager.cc index debfda7..cb1eae7 100644 --- a/ash/window_manager.cc +++ b/ash/window_manager.cc
@@ -17,14 +17,9 @@ #include "ash/event_matcher_util.h" #include "ash/host/ash_window_tree_host.h" #include "ash/public/cpp/config.h" -#include "ash/public/cpp/shelf_types.h" -#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_state_type.h" #include "ash/public/interfaces/window_actions.mojom.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" -#include "ash/public/interfaces/window_properties.mojom.h" -#include "ash/public/interfaces/window_state_type.mojom.h" #include "ash/root_window_controller.h" #include "ash/root_window_settings.h" #include "ash/session/session_controller.h" @@ -63,7 +58,6 @@ #include "ui/events/mojo/event.mojom.h" #include "ui/views/mus/pointer_watcher_event_router.h" #include "ui/wm/core/capture_controller.h" -#include "ui/wm/core/shadow_types.h" #include "ui/wm/core/window_animations.h" #include "ui/wm/core/wm_state.h" #include "ui/wm/public/activation_client.h" @@ -88,52 +82,7 @@ show_primary_host_on_connect_(show_primary_host_on_connect), wm_state_(std::make_unique<::wm::WMState>()), property_converter_(std::make_unique<aura::PropertyConverter>()) { - property_converter_->RegisterPrimitiveProperty( - kCanConsumeSystemKeysKey, ash::mojom::kCanConsumeSystemKeys_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterPrimitiveProperty( - aura::client::kDrawAttentionKey, - ui::mojom::WindowManager::kDrawAttention_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterImageSkiaProperty( - kFrameImageActiveKey, ash::mojom::kFrameImageActive_Property); - property_converter_->RegisterPrimitiveProperty( - kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterPrimitiveProperty( - kRenderTitleAreaProperty, - ui::mojom::WindowManager::kRenderParentTitleArea_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterPrimitiveProperty( - kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property, - base::Bind(&IsValidShelfItemType)); - property_converter_->RegisterPrimitiveProperty( - ::wm::kShadowElevationKey, - ui::mojom::WindowManager::kShadowElevation_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterPrimitiveProperty( - kWindowStateTypeKey, mojom::kWindowStateType_Property, - base::Bind(&ash::IsValidWindowStateType)); - property_converter_->RegisterPrimitiveProperty( - kWindowPinTypeKey, ash::mojom::kWindowPinType_Property, - base::Bind(&ash::IsValidWindowPinType)); - property_converter_->RegisterPrimitiveProperty( - kWindowPositionManagedTypeKey, - ash::mojom::kWindowPositionManaged_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterStringProperty( - kShelfIDKey, ui::mojom::WindowManager::kShelfID_Property); - property_converter_->RegisterPrimitiveProperty( - kRestoreBoundsOverrideKey, ash::mojom::kRestoreBoundsOverride_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - property_converter_->RegisterPrimitiveProperty( - kRestoreWindowStateTypeOverrideKey, - ash::mojom::kRestoreWindowStateTypeOverride_Property, - base::BindRepeating(&ash::IsValidWindowStateType)); - property_converter_->RegisterPrimitiveProperty( - kWindowTitleShownKey, - ui::mojom::WindowManager::kWindowTitleShown_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); + RegisterWindowProperties(property_converter_.get()); } WindowManager::~WindowManager() {
diff --git a/ash/wm/property_util.h b/ash/wm/property_util.h index c1489dd..91884e3d 100644 --- a/ash/wm/property_util.h +++ b/ash/wm/property_util.h
@@ -31,16 +31,16 @@ } // namespace ui namespace ash { + namespace mojom { enum class WindowStyle; } // Functions for extracting properties that are used at a Window creation time. -// When an aura::Window is created at the request of a client an initial set of -// properties is supplied to allow the WindowManager (ash) to configure the -// newly created window. Not all of these properties need be persisted, some are -// used solely to configure the window. This file contains the functions used -// to extract these properties. +// Clients pass an initial set of properties when requesting a new aura::Window. +// Not all of these properties need be persisted, some are used solely to +// configure the window. The functions below extract those properties. + // Long lived properties are converted and stored as properties on the // associated aura::Window. See aura::PropertyConverter for this set of // properties.
diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc index 120860c..7cebfd2 100644 --- a/ash/wm/window_properties.cc +++ b/ash/wm/window_properties.cc
@@ -14,8 +14,6 @@ DEFINE_UI_CLASS_PROPERTY_KEY(bool, kLockedToRootKey, false); -DEFINE_UI_CLASS_PROPERTY_KEY(bool, kRenderTitleAreaProperty, false); - DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSnapChildrenToPixelBoundary, false); DEFINE_UI_CLASS_PROPERTY_KEY(WidgetCreationType,
diff --git a/ash/wm/window_properties.h b/ash/wm/window_properties.h index 4e07fef2..c20e6407 100644 --- a/ash/wm/window_properties.h +++ b/ash/wm/window_properties.h
@@ -43,10 +43,6 @@ // bounds outside of its root window is set. ASH_EXPORT extern const aura::WindowProperty<bool>* const kLockedToRootKey; -// Maps to ui::mojom::WindowManager::kRenderParentTitleArea_Property. -ASH_EXPORT extern const aura::WindowProperty<bool>* const - kRenderTitleAreaProperty; - // Containers with this property (true) are aligned with physical pixel // boundary. extern const aura::WindowProperty<bool>* const kSnapChildrenToPixelBoundary;
diff --git a/ash/ws/window_service_delegate_impl.cc b/ash/ws/window_service_delegate_impl.cc index e5b42701..f75d21b 100644 --- a/ash/ws/window_service_delegate_impl.cc +++ b/ash/ws/window_service_delegate_impl.cc
@@ -21,6 +21,7 @@ window->SetType(aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_NOT_DRAWN); ash::wm::GetDefaultParent(window.get(), gfx::Rect())->AddChild(window.get()); + // TODO(crbug.com/837695): Apply |properties|. return window; }
diff --git a/ash/ws/window_service_util.cc b/ash/ws/window_service_util.cc new file mode 100644 index 0000000..c7065e8 --- /dev/null +++ b/ash/ws/window_service_util.cc
@@ -0,0 +1,24 @@ +// 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 "ash/ws/window_service_util.h" + +#include "ash/public/cpp/window_properties.h" +#include "ash/shell.h" +#include "ash/ws/window_service_delegate_impl.h" +#include "services/ui/ws2/gpu_support.h" +#include "services/ui/ws2/window_service.h" + +namespace ash { + +std::unique_ptr<service_manager::Service> CreateWindowService( + const base::RepeatingCallback<std::unique_ptr<ui::ws2::GpuSupport>()>& + gpu_support_factory) { + auto window_service = std::make_unique<ui::ws2::WindowService>( + Shell::Get()->window_service_delegate(), gpu_support_factory.Run()); + RegisterWindowProperties(window_service->property_converter()); + return window_service; +} + +} // namespace ash
diff --git a/ash/ws/window_service_util.h b/ash/ws/window_service_util.h new file mode 100644 index 0000000..bd9bdc17 --- /dev/null +++ b/ash/ws/window_service_util.h
@@ -0,0 +1,35 @@ +// 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 ASH_WS_WINDOW_SERVICE_UTIL_H_ +#define ASH_WS_WINDOW_SERVICE_UTIL_H_ + +#include <memory> + +#include "ash/ash_export.h" +#include "base/callback.h" +#include "services/ui/ws2/window_service_delegate.h" + +namespace service_manager { +class Service; +} // namespace service_manager + +namespace ui { +namespace ws2 { +class GpuSupport; +} // namespace ws2 +} // namespace ui + +namespace ash { + +// A factory function to create WindowService with Ash-specific initialization. +// This and |gpu_support_factory| should only be run once, but factory functions +// for embedded mojo services use repeating callbacks. +ASH_EXPORT std::unique_ptr<service_manager::Service> CreateWindowService( + const base::RepeatingCallback<std::unique_ptr<ui::ws2::GpuSupport>()>& + gpu_support_factory); + +} // namespace ash + +#endif // ASH_WS_WINDOW_SERVICE_UTIL_H_
diff --git a/base/BUILD.gn b/base/BUILD.gn index ee3ed563..f56fd47 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1394,17 +1394,21 @@ "trace_event/heap_profiler_allocation_register_posix.cc", ] - public_deps += [ "//third_party/fuchsia-sdk:async" ] + # These only need to be public deps because of includes of their headers + # by public //base headers, which requires they be on the include path. + # TODO(https://crbug.com/841171): Move these back to |deps|. + public_deps += [ + "//third_party/fuchsia-sdk:async", + "//third_party/fuchsia-sdk:fdio", + "//third_party/fuchsia-sdk:launchpad", + ] + deps += [ "//third_party/fuchsia-sdk:async_default", - "//third_party/fuchsia-sdk:fdio", "//third_party/fuchsia-sdk:fidl", "//third_party/fuchsia-sdk:svc", "//third_party/fuchsia-sdk:zx", ] - - # TODO(fuchsia): Remove launchpad.h dependencies from process/launch.h - public_deps += [ "//third_party/fuchsia-sdk:launchpad" ] } else { sources += [ "message_loop/message_pump_libevent.cc",
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index 6192031..b34fb9f 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc
@@ -32,6 +32,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/synchronization/lock.h" +#include "base/sys_info.h" #include "base/values.h" #include "build/build_config.h" @@ -548,6 +549,34 @@ CHECK(unlogged_samples_->bucket_ranges()); CHECK(logged_samples_); CHECK(logged_samples_->bucket_ranges()); +#if !defined(OS_NACL) + if (0U == logged_samples_->id() && (flags() & kIsPersistent)) { + // ID should never be zero. If it is, then it's probably because the + // entire memory page was cleared. Check that this is true. + // TODO(bcwhite): Remove this. + // https://bugs.chromium.org/p/chromium/issues/detail?id=836875 + const size_t page_size = SysInfo::VMAllocationGranularity(); + const int* address = reinterpret_cast<const int*>( + reinterpret_cast<uintptr_t>(logged_samples_->meta()) & + ~(page_size - 1)); + // Check a couple places so there is evidence in a crash report as to + // where it was non-zero. + CHECK_EQ(0, address[0]); + CHECK_EQ(0, address[1]); + CHECK_EQ(0, address[2]); + CHECK_EQ(0, address[4]); + CHECK_EQ(0, address[8]); + CHECK_EQ(0, address[16]); + CHECK_EQ(0, address[32]); + CHECK_EQ(0, address[64]); + CHECK_EQ(0, address[128]); + CHECK_EQ(0, address[256]); + CHECK_EQ(0, address[512]); + // Now check every address. + for (size_t i = 0; i < page_size / sizeof(int); ++i) + CHECK_EQ(0, address[i]); + } +#endif CHECK_NE(0U, logged_samples_->id()); }
diff --git a/base/metrics/histogram_samples.h b/base/metrics/histogram_samples.h index 6908873c..059fd3c3b 100644 --- a/base/metrics/histogram_samples.h +++ b/base/metrics/histogram_samples.h
@@ -159,6 +159,11 @@ return subtle::NoBarrier_Load(&meta_->redundant_count); } + // Temporarily visible for crash debugging. Should be protected. + // TODO(bcwhite): Move this back where it belongs. + // https://bugs.chromium.org/p/chromium/issues/detail?id=836875 + Metadata* meta() { return meta_; } + protected: enum NegativeSampleReason { SAMPLES_HAVE_LOGGED_BUT_NOT_SAMPLE, @@ -196,8 +201,6 @@ return meta_->single_sample; } - Metadata* meta() { return meta_; } - private: // Depending on derived class meta values can come from local stoarge or // external storage in which case HistogramSamples class cannot take ownership
diff --git a/base/test/test_mock_time_task_runner.cc b/base/test/test_mock_time_task_runner.cc index 8a889c5..c74d14e0 100644 --- a/base/test/test_mock_time_task_runner.cc +++ b/base/test/test_mock_time_task_runner.cc
@@ -196,6 +196,10 @@ ForwardClocksUntilTickTime(original_now_ticks + delta); } +void TestMockTimeTaskRunner::AdvanceMockTickClock(TimeDelta delta) { + ForwardClocksUntilTickTime(NowTicks() + delta); +} + void TestMockTimeTaskRunner::RunUntilIdle() { DCHECK(thread_checker_.CalledOnValidThread()); ProcessAllTasksNoLaterThan(TimeDelta());
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h index a7654318..23dbb2f 100644 --- a/base/test/test_mock_time_task_runner.h +++ b/base/test/test_mock_time_task_runner.h
@@ -140,6 +140,9 @@ // non-negative. void FastForwardBy(TimeDelta delta); + // Fast-forwards virtual time by |delta| but not causing any task execution. + void AdvanceMockTickClock(TimeDelta delta); + // Fast-forwards virtual time just until all tasks are executed. void FastForwardUntilNoTasksRemain();
diff --git a/base/test/test_mock_time_task_runner_unittest.cc b/base/test/test_mock_time_task_runner_unittest.cc index e149f65..04be466 100644 --- a/base/test/test_mock_time_task_runner_unittest.cc +++ b/base/test/test_mock_time_task_runner_unittest.cc
@@ -247,4 +247,16 @@ EXPECT_EQ(start_time, task_runner->NowTicks()); } +TEST(TestMockTimeTaskRunnerTest, AdvanceMockTickClockDoesNotRunTasks) { + auto task_runner = MakeRefCounted<TestMockTimeTaskRunner>(); + TimeTicks start_time = task_runner->NowTicks(); + task_runner->PostTask(FROM_HERE, BindOnce([]() { ADD_FAILURE(); })); + task_runner->PostDelayedTask(FROM_HERE, BindOnce([]() { ADD_FAILURE(); }), + TimeDelta::FromSeconds(1)); + + task_runner->AdvanceMockTickClock(TimeDelta::FromSeconds(3)); + EXPECT_EQ(start_time + TimeDelta::FromSeconds(3), task_runner->NowTicks()); + EXPECT_EQ(2u, task_runner->GetPendingTaskCount()); +} + } // namespace base
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index e4e0775..d80eacb3 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -480,10 +480,6 @@ # disabling this (https://bugs.llvm.org/show_bug.cgi?id=18538#c13), # but for now it looks like our build might rely on it # (https://crbug.com/829795). - if (is_win) { - # TODO(hans): Expose the flag in clang-cl so we don't need -Xclang. - cflags += [ "-Xclang" ] - } cflags += [ "-fmerge-all-constants" ] } @@ -496,12 +492,6 @@ "-mllvm", "-Xclang", "-instcombine-lower-dbg-declare=0", - - # TODO(rnk): Remove this once it's the default. https://crbug.com/793819 - "-Xclang", - "-mllvm", - "-Xclang", - "-fast-isel-sink-local-values=1", ] } @@ -581,6 +571,8 @@ } if (is_mac) { + # The system libc++ on Mac doesn't have aligned allocation in C++17. + defines += [ "_LIBCPP_HAS_NO_ALIGNED_ALLOCATION" ] cflags_cc += [ "-stdlib=libc++" ] ldflags += [ "-stdlib=libc++" ] }
diff --git a/build/config/fuchsia/BUILD.gn b/build/config/fuchsia/BUILD.gn index ed96b2a..f91837f 100644 --- a/build/config/fuchsia/BUILD.gn +++ b/build/config/fuchsia/BUILD.gn
@@ -56,6 +56,10 @@ "-Wl,--as-needed", ] + # The fdio library is always linked (via |ldflags| above) but is not on the + # toolchain default lib_dirs, so add the path. https://crbug.com/731217 + configs = [ "//third_party/fuchsia-sdk:sdk_lib_dirs_config" ] + # TODO(crbug.com/821951): Clang enables SafeStack by default when targeting # Fuchsia, but it breaks some tests, notably in V8. cflags += [ "-fno-sanitize=safe-stack" ]
diff --git a/build/fuchsia/sdk.sha1 b/build/fuchsia/sdk.sha1 index ae1efc55..5411f6d 100644 --- a/build/fuchsia/sdk.sha1 +++ b/build/fuchsia/sdk.sha1
@@ -1 +1 @@ -230c2287820f4c75b2abdfb2166a2eb0a5cb7820 \ No newline at end of file +4538a17f3a0240b4fb27b809239f03c6d4184431 \ No newline at end of file
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py index d5999f7..1aade1d 100755 --- a/build/vs_toolchain.py +++ b/build/vs_toolchain.py
@@ -332,9 +332,11 @@ if is_optional: continue else: + # TODO(crbug.com/773476): remove version requirement. raise Exception('%s not found in "%s"\r\nYou must install the ' '"Debugging Tools for Windows" feature from the Windows' - ' 10 SDK.' % (debug_file, full_path)) + ' 10 SDK. You must use v10.0.15063.468. of the SDK' + % (debug_file, full_path)) target_path = os.path.join(target_dir, debug_file) _CopyRuntimeImpl(target_path, full_path)
diff --git a/cc/blink/BUILD.gn b/cc/blink/BUILD.gn index b5b3741..56fd5e6 100644 --- a/cc/blink/BUILD.gn +++ b/cc/blink/BUILD.gn
@@ -9,20 +9,14 @@ sources = [ "cc_blink_export.h", - "scrollbar_impl.cc", - "scrollbar_impl.h", "web_compositor_support_impl.cc", "web_compositor_support_impl.h", - "web_content_layer_impl.cc", - "web_content_layer_impl.h", "web_image_layer_impl.cc", "web_image_layer_impl.h", "web_layer_impl.cc", "web_layer_impl.h", "web_layer_impl_fixed_bounds.cc", "web_layer_impl_fixed_bounds.h", - "web_scrollbar_layer_impl.cc", - "web_scrollbar_layer_impl.h", ] defines = [ "CC_BLINK_IMPLEMENTATION" ]
diff --git a/cc/blink/scrollbar_impl.cc b/cc/blink/scrollbar_impl.cc deleted file mode 100644 index f92b4ac..0000000 --- a/cc/blink/scrollbar_impl.cc +++ /dev/null
@@ -1,137 +0,0 @@ -// Copyright 2014 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 "cc/blink/scrollbar_impl.h" - -#include "base/logging.h" -#include "third_party/blink/public/platform/web_scrollbar.h" -#include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h" - -using blink::WebScrollbar; - -namespace cc_blink { - -ScrollbarImpl::ScrollbarImpl( - std::unique_ptr<WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry) - : scrollbar_(std::move(scrollbar)), - painter_(painter), - geometry_(std::move(geometry)) {} - -ScrollbarImpl::~ScrollbarImpl() = default; - -cc::ScrollbarOrientation ScrollbarImpl::Orientation() const { - if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) - return cc::HORIZONTAL; - return cc::VERTICAL; -} - -bool ScrollbarImpl::IsLeftSideVerticalScrollbar() const { - return scrollbar_->IsLeftSideVerticalScrollbar(); -} - -bool ScrollbarImpl::HasThumb() const { - return geometry_->HasThumb(scrollbar_.get()); -} - -bool ScrollbarImpl::IsOverlay() const { - return scrollbar_->IsOverlay(); -} - -gfx::Point ScrollbarImpl::Location() const { - return scrollbar_->Location(); -} - -int ScrollbarImpl::ThumbThickness() const { - gfx::Rect thumb_rect = geometry_->ThumbRect(scrollbar_.get()); - if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) - return thumb_rect.height(); - return thumb_rect.width(); -} - -int ScrollbarImpl::ThumbLength() const { - gfx::Rect thumb_rect = geometry_->ThumbRect(scrollbar_.get()); - if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) - return thumb_rect.width(); - return thumb_rect.height(); -} - -gfx::Rect ScrollbarImpl::TrackRect() const { - return geometry_->TrackRect(scrollbar_.get()); -} - -float ScrollbarImpl::ThumbOpacity() const { - return painter_.ThumbOpacity(); -} - -bool ScrollbarImpl::NeedsPaintPart(cc::ScrollbarPart part) const { - if (part == cc::THUMB) - return painter_.ThumbNeedsRepaint(); - return painter_.TrackNeedsRepaint(); -} - -bool ScrollbarImpl::UsesNinePatchThumbResource() const { - return painter_.UsesNinePatchThumbResource(); -} - -gfx::Size ScrollbarImpl::NinePatchThumbCanvasSize() const { - return geometry_->NinePatchThumbCanvasSize(scrollbar_.get()); -} - -gfx::Rect ScrollbarImpl::NinePatchThumbAperture() const { - return geometry_->NinePatchThumbAperture(scrollbar_.get()); -} - -bool ScrollbarImpl::HasTickmarks() const { - return scrollbar_->HasTickmarks(); -} - -void ScrollbarImpl::PaintPart(cc::PaintCanvas* canvas, - cc::ScrollbarPart part, - const gfx::Rect& content_rect) { - if (part == cc::THUMB) { - painter_.PaintThumb(canvas, content_rect); - return; - } - - if (part == cc::TICKMARKS) { - painter_.PaintTickmarks(canvas, content_rect); - return; - } - - // The following is a simplification of ScrollbarThemeComposite::paint. - painter_.PaintScrollbarBackground(canvas, content_rect); - - if (geometry_->HasButtons(scrollbar_.get())) { - gfx::Rect back_button_start_paint_rect = - geometry_->BackButtonStartRect(scrollbar_.get()); - painter_.PaintBackButtonStart(canvas, back_button_start_paint_rect); - - gfx::Rect back_button_end_paint_rect = - geometry_->BackButtonEndRect(scrollbar_.get()); - painter_.PaintBackButtonEnd(canvas, back_button_end_paint_rect); - - gfx::Rect forward_button_start_paint_rect = - geometry_->ForwardButtonStartRect(scrollbar_.get()); - painter_.PaintForwardButtonStart(canvas, forward_button_start_paint_rect); - - gfx::Rect forward_button_end_paint_rect = - geometry_->ForwardButtonEndRect(scrollbar_.get()); - painter_.PaintForwardButtonEnd(canvas, forward_button_end_paint_rect); - } - - gfx::Rect track_paint_rect = geometry_->TrackRect(scrollbar_.get()); - painter_.PaintTrackBackground(canvas, track_paint_rect); - - bool thumb_present = geometry_->HasThumb(scrollbar_.get()); - if (thumb_present) { - painter_.PaintForwardTrackPart(canvas, track_paint_rect); - painter_.PaintBackTrackPart(canvas, track_paint_rect); - } - - painter_.PaintTickmarks(canvas, track_paint_rect); -} - -} // namespace cc_blink
diff --git a/cc/blink/scrollbar_impl.h b/cc/blink/scrollbar_impl.h deleted file mode 100644 index 40157360..0000000 --- a/cc/blink/scrollbar_impl.h +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2014 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 CC_BLINK_SCROLLBAR_IMPL_H_ -#define CC_BLINK_SCROLLBAR_IMPL_H_ - -#include <memory> - -#include "base/macros.h" -#include "cc/input/scrollbar.h" -#include "cc/paint/paint_canvas.h" -#include "third_party/blink/public/platform/web_scrollbar_theme_painter.h" - -namespace blink { -class WebScrollbar; -class WebScrollbarThemeGeometry; -} - -namespace cc_blink { - -class ScrollbarImpl : public cc::Scrollbar { - public: - ScrollbarImpl(std::unique_ptr<blink::WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry); - ~ScrollbarImpl() override; - - // cc::Scrollbar implementation. - cc::ScrollbarOrientation Orientation() const override; - bool IsLeftSideVerticalScrollbar() const override; - bool HasThumb() const override; - bool IsOverlay() const override; - gfx::Point Location() const override; - int ThumbThickness() const override; - int ThumbLength() const override; - gfx::Rect TrackRect() const override; - float ThumbOpacity() const override; - bool NeedsPaintPart(cc::ScrollbarPart part) const override; - bool HasTickmarks() const override; - void PaintPart(cc::PaintCanvas* canvas, - cc::ScrollbarPart part, - const gfx::Rect& content_rect) override; - - bool UsesNinePatchThumbResource() const override; - gfx::Size NinePatchThumbCanvasSize() const override; - gfx::Rect NinePatchThumbAperture() const override; - - private: - std::unique_ptr<blink::WebScrollbar> scrollbar_; - blink::WebScrollbarThemePainter painter_; - std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry_; - - DISALLOW_COPY_AND_ASSIGN(ScrollbarImpl); -}; - -} // namespace cc_blink - -#endif // CC_BLINK_SCROLLBAR_IMPL_H_
diff --git a/cc/blink/web_compositor_support_impl.cc b/cc/blink/web_compositor_support_impl.cc index aca0e695..cfc1ca1 100644 --- a/cc/blink/web_compositor_support_impl.cc +++ b/cc/blink/web_compositor_support_impl.cc
@@ -6,19 +6,12 @@ #include <utility> -#include "cc/blink/web_content_layer_impl.h" #include "cc/blink/web_image_layer_impl.h" #include "cc/blink/web_layer_impl.h" -#include "cc/blink/web_scrollbar_layer_impl.h" #include "cc/layers/layer.h" -using blink::WebContentLayer; using blink::WebImageLayer; using blink::WebLayer; -using blink::WebScrollbar; -using blink::WebScrollbarLayer; -using blink::WebScrollbarThemeGeometry; -using blink::WebScrollbarThemePainter; namespace cc_blink { @@ -26,54 +19,14 @@ WebCompositorSupportImpl::~WebCompositorSupportImpl() = default; -std::unique_ptr<WebLayer> WebCompositorSupportImpl::CreateLayer() { - return std::make_unique<WebLayerImpl>(); -} - std::unique_ptr<WebLayer> WebCompositorSupportImpl::CreateLayerFromCCLayer( cc::Layer* layer) { return std::make_unique<WebLayerImpl>(layer); } -std::unique_ptr<WebContentLayer> WebCompositorSupportImpl::CreateContentLayer( - cc::ContentLayerClient* client) { - return std::make_unique<WebContentLayerImpl>(client); -} - std::unique_ptr<blink::WebImageLayer> WebCompositorSupportImpl::CreateImageLayer() { return std::make_unique<WebImageLayerImpl>(); } -std::unique_ptr<WebScrollbarLayer> -WebCompositorSupportImpl::CreateScrollbarLayer( - std::unique_ptr<WebScrollbar> scrollbar, - WebScrollbarThemePainter painter, - std::unique_ptr<WebScrollbarThemeGeometry> geometry) { - return std::make_unique<WebScrollbarLayerImpl>(std::move(scrollbar), painter, - std::move(geometry), - /* is overlay */ false); -} - -std::unique_ptr<WebScrollbarLayer> -WebCompositorSupportImpl::CreateOverlayScrollbarLayer( - std::unique_ptr<WebScrollbar> scrollbar, - WebScrollbarThemePainter painter, - std::unique_ptr<WebScrollbarThemeGeometry> geometry) { - return std::make_unique<WebScrollbarLayerImpl>(std::move(scrollbar), painter, - std::move(geometry), - /* is overlay */ true); -} - -std::unique_ptr<WebScrollbarLayer> -WebCompositorSupportImpl::CreateSolidColorScrollbarLayer( - WebScrollbar::Orientation orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar) { - return std::make_unique<WebScrollbarLayerImpl>( - orientation, thumb_thickness, track_start, - is_left_side_vertical_scrollbar); -} - } // namespace cc_blink
diff --git a/cc/blink/web_compositor_support_impl.h b/cc/blink/web_compositor_support_impl.h index 518b4ea..c89d0f7 100644 --- a/cc/blink/web_compositor_support_impl.h +++ b/cc/blink/web_compositor_support_impl.h
@@ -11,10 +11,6 @@ #include "third_party/blink/public/platform/web_compositor_support.h" #include "third_party/blink/public/platform/web_layer.h" -namespace cc { -class ContentLayerClient; -} - namespace cc_blink { class CC_BLINK_EXPORT WebCompositorSupportImpl @@ -23,24 +19,8 @@ WebCompositorSupportImpl(); ~WebCompositorSupportImpl() override; - std::unique_ptr<blink::WebLayer> CreateLayer() override; std::unique_ptr<blink::WebLayer> CreateLayerFromCCLayer(cc::Layer*) override; - std::unique_ptr<blink::WebContentLayer> CreateContentLayer( - cc::ContentLayerClient* client) override; std::unique_ptr<blink::WebImageLayer> CreateImageLayer() override; - std::unique_ptr<blink::WebScrollbarLayer> CreateScrollbarLayer( - std::unique_ptr<blink::WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - std::unique_ptr<blink::WebScrollbarThemeGeometry>) override; - std::unique_ptr<blink::WebScrollbarLayer> CreateOverlayScrollbarLayer( - std::unique_ptr<blink::WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - std::unique_ptr<blink::WebScrollbarThemeGeometry>) override; - std::unique_ptr<blink::WebScrollbarLayer> CreateSolidColorScrollbarLayer( - blink::WebScrollbar::Orientation orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar) override; private: DISALLOW_COPY_AND_ASSIGN(WebCompositorSupportImpl);
diff --git a/cc/blink/web_content_layer_impl.cc b/cc/blink/web_content_layer_impl.cc deleted file mode 100644 index 44b2cb8..0000000 --- a/cc/blink/web_content_layer_impl.cc +++ /dev/null
@@ -1,64 +0,0 @@ -// Copyright 2014 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 "cc/blink/web_content_layer_impl.h" - -#include <stddef.h> - -#include "base/command_line.h" -#include "cc/base/switches.h" -#include "cc/layers/content_layer_client.h" -#include "cc/layers/picture_layer.h" -#include "third_party/blink/public/platform/web_float_point.h" -#include "third_party/blink/public/platform/web_float_rect.h" -#include "third_party/blink/public/platform/web_rect.h" -#include "third_party/blink/public/platform/web_size.h" -#include "third_party/skia/include/core/SkMatrix44.h" - -using cc::PictureLayer; - -namespace cc_blink { - -WebContentLayerImpl::WebContentLayerImpl(cc::ContentLayerClient* client) - : client_(client) { - layer_ = std::make_unique<WebLayerImpl>(PictureLayer::Create(this)); -} - -WebContentLayerImpl::~WebContentLayerImpl() { - static_cast<PictureLayer*>(layer_->layer())->ClearClient(); -} - -blink::WebLayer* WebContentLayerImpl::Layer() { - return layer_.get(); -} - -void WebContentLayerImpl::SetTransformedRasterizationAllowed(bool allowed) { - static_cast<PictureLayer*>(layer_->layer()) - ->SetTransformedRasterizationAllowed(allowed); -} - -bool WebContentLayerImpl::TransformedRasterizationAllowed() const { - return static_cast<PictureLayer*>(layer_->layer()) - ->transformed_rasterization_allowed(); -} - -gfx::Rect WebContentLayerImpl::PaintableRegion() { - return client_->PaintableRegion(); -} - -scoped_refptr<cc::DisplayItemList> -WebContentLayerImpl::PaintContentsToDisplayList( - PaintingControlSetting painting_control) { - return client_->PaintContentsToDisplayList(painting_control); -} - -bool WebContentLayerImpl::FillsBoundsCompletely() const { - return client_->FillsBoundsCompletely(); -} - -size_t WebContentLayerImpl::GetApproximateUnsharedMemoryUsage() const { - return client_->GetApproximateUnsharedMemoryUsage(); -} - -} // namespace cc_blink
diff --git a/cc/blink/web_content_layer_impl.h b/cc/blink/web_content_layer_impl.h deleted file mode 100644 index 9459da9..0000000 --- a/cc/blink/web_content_layer_impl.h +++ /dev/null
@@ -1,53 +0,0 @@ -// Copyright 2014 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 CC_BLINK_WEB_CONTENT_LAYER_IMPL_H_ -#define CC_BLINK_WEB_CONTENT_LAYER_IMPL_H_ - -#include <stddef.h> - -#include <memory> - -#include "base/macros.h" -#include "cc/blink/cc_blink_export.h" -#include "cc/blink/web_layer_impl.h" -#include "cc/layers/content_layer_client.h" -#include "third_party/blink/public/platform/web_content_layer.h" - -namespace cc { -class ContentLayerClient; -} - -namespace cc_blink { - -class WebContentLayerImpl : public blink::WebContentLayer, - public cc::ContentLayerClient { - public: - CC_BLINK_EXPORT explicit WebContentLayerImpl(cc::ContentLayerClient*); - - ~WebContentLayerImpl() override; - - // WebContentLayer implementation. - blink::WebLayer* Layer() override; - void SetTransformedRasterizationAllowed(bool) override; - bool TransformedRasterizationAllowed() const override; - - protected: - // ContentLayerClient implementation. - gfx::Rect PaintableRegion() override; - scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList( - PaintingControlSetting painting_control) override; - bool FillsBoundsCompletely() const override; - size_t GetApproximateUnsharedMemoryUsage() const override; - - std::unique_ptr<WebLayerImpl> layer_; - cc::ContentLayerClient* client_; - - private: - DISALLOW_COPY_AND_ASSIGN(WebContentLayerImpl); -}; - -} // namespace cc_blink - -#endif // CC_BLINK_WEB_CONTENT_LAYER_IMPL_H_
diff --git a/cc/blink/web_scrollbar_layer_impl.cc b/cc/blink/web_scrollbar_layer_impl.cc deleted file mode 100644 index f501002..0000000 --- a/cc/blink/web_scrollbar_layer_impl.cc +++ /dev/null
@@ -1,80 +0,0 @@ -// Copyright 2014 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 "cc/blink/web_scrollbar_layer_impl.h" - -#include <utility> - -#include "cc/blink/scrollbar_impl.h" -#include "cc/blink/web_layer_impl.h" -#include "cc/layers/layer.h" -#include "cc/layers/painted_overlay_scrollbar_layer.h" -#include "cc/layers/painted_scrollbar_layer.h" -#include "cc/layers/scrollbar_layer_interface.h" -#include "cc/layers/solid_color_scrollbar_layer.h" -#include "cc/trees/element_id.h" - -using cc::PaintedOverlayScrollbarLayer; -using cc::PaintedScrollbarLayer; -using cc::SolidColorScrollbarLayer; - -namespace { - -cc::ScrollbarOrientation ConvertOrientation( - blink::WebScrollbar::Orientation orientation) { - return orientation == blink::WebScrollbar::kHorizontal ? cc::HORIZONTAL - : cc::VERTICAL; -} - -} // namespace - -namespace cc_blink { - -WebScrollbarLayerImpl::WebScrollbarLayerImpl( - std::unique_ptr<blink::WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry, - bool is_overlay) - : layer_(is_overlay - ? new WebLayerImpl(PaintedOverlayScrollbarLayer::Create( - std::make_unique<ScrollbarImpl>(std::move(scrollbar), - painter, - std::move(geometry)), - cc::ElementId())) - : new WebLayerImpl(PaintedScrollbarLayer::Create( - std::make_unique<ScrollbarImpl>(std::move(scrollbar), - painter, - std::move(geometry)), - cc::ElementId()))) {} - -WebScrollbarLayerImpl::WebScrollbarLayerImpl( - blink::WebScrollbar::Orientation orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar) - : layer_(new WebLayerImpl( - SolidColorScrollbarLayer::Create(ConvertOrientation(orientation), - thumb_thickness, - track_start, - is_left_side_vertical_scrollbar, - cc::ElementId()))) {} - -WebScrollbarLayerImpl::~WebScrollbarLayerImpl() = default; - -blink::WebLayer* WebScrollbarLayerImpl::Layer() { - return layer_.get(); -} - -void WebScrollbarLayerImpl::SetScrollLayer(blink::WebLayer* layer) { - cc::Layer* scroll_layer = - layer ? static_cast<WebLayerImpl*>(layer)->layer() : nullptr; - layer_->layer()->ToScrollbarLayer()->SetScrollElementId( - scroll_layer ? scroll_layer->element_id() : cc::ElementId()); -} - -void WebScrollbarLayerImpl::SetElementId(const cc::ElementId& element_id) { - layer_->SetElementId(element_id); -} - -} // namespace cc_blink
diff --git a/cc/blink/web_scrollbar_layer_impl.h b/cc/blink/web_scrollbar_layer_impl.h deleted file mode 100644 index c80c31d..0000000 --- a/cc/blink/web_scrollbar_layer_impl.h +++ /dev/null
@@ -1,52 +0,0 @@ -// Copyright 2014 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 CC_BLINK_WEB_SCROLLBAR_LAYER_IMPL_H_ -#define CC_BLINK_WEB_SCROLLBAR_LAYER_IMPL_H_ - -#include <memory> - -#include "base/macros.h" -#include "cc/blink/cc_blink_export.h" -#include "third_party/blink/public/platform/web_scrollbar.h" -#include "third_party/blink/public/platform/web_scrollbar_layer.h" - -namespace blink { -class WebScrollbarThemeGeometry; -class WebScrollbarThemePainter; -} - -namespace cc_blink { - -class WebLayerImpl; - -class WebScrollbarLayerImpl : public blink::WebScrollbarLayer { - public: - CC_BLINK_EXPORT WebScrollbarLayerImpl( - std::unique_ptr<blink::WebScrollbar> scrollbar, - blink::WebScrollbarThemePainter painter, - std::unique_ptr<blink::WebScrollbarThemeGeometry> geometry, - bool is_overlay); - CC_BLINK_EXPORT WebScrollbarLayerImpl( - blink::WebScrollbar::Orientation orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar); - ~WebScrollbarLayerImpl() override; - - // blink::WebScrollbarLayer implementation. - blink::WebLayer* Layer() override; - void SetScrollLayer(blink::WebLayer* layer) override; - - void SetElementId(const cc::ElementId&) override; - - private: - std::unique_ptr<WebLayerImpl> layer_; - - DISALLOW_COPY_AND_ASSIGN(WebScrollbarLayerImpl); -}; - -} // namespace cc_blink - -#endif // CC_BLINK_WEB_SCROLLBAR_LAYER_IMPL_H_
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 1579df03..b75211ba 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc
@@ -685,6 +685,13 @@ main_thread_weak_ptr_, local_surface_id)); } +void LayerTreeTest::PostRequestNewLocalSurfaceIdToMainThread() { + main_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&LayerTreeTest::DispatchRequestNewLocalSurfaceId, + main_thread_weak_ptr_)); +} + void LayerTreeTest::PostSetDeferCommitsToMainThread(bool defer_commits) { main_task_runner_->PostTask( FROM_HERE, base::BindOnce(&LayerTreeTest::DispatchSetDeferCommits, @@ -874,6 +881,12 @@ layer_tree_host_->SetLocalSurfaceIdFromParent(local_surface_id); } +void LayerTreeTest::DispatchRequestNewLocalSurfaceId() { + DCHECK(main_task_runner_->BelongsToCurrentThread()); + if (layer_tree_host_) + layer_tree_host_->RequestNewLocalSurfaceId(); +} + void LayerTreeTest::DispatchSetDeferCommits(bool defer_commits) { DCHECK(main_task_runner_->BelongsToCurrentThread()); if (layer_tree_host_)
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 20094f1..cc80bea 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h
@@ -82,6 +82,7 @@ SingleKeyframeEffectAnimation* animation_to_receive_animation); void PostSetLocalSurfaceIdToMainThread( const viz::LocalSurfaceId& local_surface_id); + void PostRequestNewLocalSurfaceIdToMainThread(); void PostSetDeferCommitsToMainThread(bool defer_commits); void PostSetNeedsCommitToMainThread(); void PostSetNeedsUpdateLayersToMainThread(); @@ -180,6 +181,7 @@ SingleKeyframeEffectAnimation* animation_to_receive_animation, double animation_duration); void DispatchSetLocalSurfaceId(const viz::LocalSurfaceId& local_surface_id); + void DispatchRequestNewLocalSurfaceId(); void DispatchSetDeferCommits(bool defer_commits); void DispatchSetNeedsCommit(); void DispatchSetNeedsUpdateLayers();
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index e3d9d41..84d3094 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -1188,6 +1188,20 @@ SetNeedsCommit(); } +void LayerTreeHost::RequestNewLocalSurfaceId() { + DCHECK(local_surface_id_from_parent_.is_valid()); + if (new_local_surface_id_request_) + return; + new_local_surface_id_request_ = true; + SetNeedsCommit(); +} + +bool LayerTreeHost::TakeNewLocalSurfaceIdRequest() { + bool new_local_surface_id_request = new_local_surface_id_request_; + new_local_surface_id_request_ = false; + return new_local_surface_id_request; +} + void LayerTreeHost::RegisterLayer(Layer* layer) { DCHECK(!LayerById(layer->id())); DCHECK(!in_paint_layer_contents_); @@ -1373,6 +1387,9 @@ tree_impl->set_content_source_id(content_source_id_); + if (TakeNewLocalSurfaceIdRequest()) + tree_impl->RequestNewLocalSurfaceId(); + tree_impl->SetLocalSurfaceIdFromParent(local_surface_id_from_parent_); has_pushed_local_surface_id_from_parent_ = true;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index 7954f931..b626c650 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -344,6 +344,13 @@ return local_surface_id_from_parent_; } + // Requests the allocation of a new LocalSurfaceId on the compositor thread. + void RequestNewLocalSurfaceId(); + + // Returns the current state of the new LocalSurfaceId request and resets + // the state. + bool TakeNewLocalSurfaceIdRequest(); + void SetRasterColorSpace(const gfx::ColorSpace& raster_color_space); const gfx::ColorSpace& raster_color_space() const { return raster_color_space_; @@ -641,6 +648,7 @@ viz::LocalSurfaceId local_surface_id_from_parent_; // Used to detect surface invariant violations. bool has_pushed_local_surface_id_from_parent_ = false; + bool new_local_surface_id_request_ = false; bool defer_commits_ = false; SkColor background_color_ = SK_ColorWHITE;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 86208aee..8b5db67c 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -929,14 +929,13 @@ // If we have a new LocalSurfaceId, we must always submit a CompositorFrame // because the parent is blocking on us. - bool local_surface_id_from_parent_changed = + bool local_surface_id_changed = last_draw_local_surface_id_ != - active_tree->local_surface_id_from_parent(); + child_local_surface_id_allocator_.GetCurrentLocalSurfaceId(); return root_surface_has_visible_damage || active_tree_->property_trees()->effect_tree.HasCopyRequests() || - must_always_swap || hud_wants_to_draw_ || - local_surface_id_from_parent_changed; + must_always_swap || hud_wants_to_draw_ || local_surface_id_changed; } DrawResult LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) { @@ -1897,8 +1896,10 @@ metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * active_tree_->device_scale_factor(); metadata.viewport_size_in_pixels = device_viewport_size(); - if (active_tree()->local_surface_id_from_parent().is_valid()) - metadata.local_surface_id = active_tree()->local_surface_id_from_parent(); + const viz::LocalSurfaceId& local_surface_id = + child_local_surface_id_allocator_.GetCurrentLocalSurfaceId(); + if (local_surface_id.is_valid()) + metadata.local_surface_id = local_surface_id; active_tree_->GetViewportSelection(&metadata.selection); metadata.is_mobile_optimized = IsMobileOptimized(active_tree_.get()); @@ -2032,9 +2033,10 @@ CHECK(!settings_.single_thread_proxy_scheduler || active_tree()->local_surface_id_from_parent().is_valid()); layer_tree_frame_sink_->SetLocalSurfaceId( - active_tree()->local_surface_id_from_parent()); + child_local_surface_id_allocator_.GetCurrentLocalSurfaceId()); } - last_draw_local_surface_id_ = active_tree()->local_surface_id_from_parent(); + last_draw_local_surface_id_ = + child_local_surface_id_allocator_.GetCurrentLocalSurfaceId(); if (const char* client_name = GetClientNameForMetrics()) { size_t total_quad_count = 0; for (const auto& pass : compositor_frame.render_pass_list) @@ -2560,6 +2562,14 @@ // Activation can change the root scroll offset, so inform the synchronous // input handler. UpdateRootLayerStateForSynchronousInputHandler(); + + // Update the child's LocalSurfaceId. + if (active_tree()->local_surface_id_from_parent().is_valid()) { + child_local_surface_id_allocator_.UpdateFromParent( + active_tree()->local_surface_id_from_parent()); + if (active_tree()->TakeNewLocalSurfaceIdRequest()) + child_local_surface_id_allocator_.GenerateId(); + } } void LayerTreeHostImpl::ActivateStateForImages() {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 4aab626..5a962b0 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -46,6 +46,7 @@ #include "components/viz/common/frame_sinks/begin_frame_args.h" #include "components/viz/common/gpu/context_cache_controller.h" #include "components/viz/common/quads/render_pass.h" +#include "components/viz/common/surfaces/child_local_surface_id_allocator.h" #include "components/viz/common/surfaces/local_surface_id.h" #include "components/viz/common/surfaces/surface_id.h" #include "ui/gfx/geometry/rect.h" @@ -1055,6 +1056,7 @@ uint32_t last_presentation_token_ = 0u; viz::LocalSurfaceId last_draw_local_surface_id_; + viz::ChildLocalSurfaceIdAllocator child_local_surface_id_allocator_; const int default_color_space_id_; const gfx::ColorSpace default_color_space_;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index e35e5eb8..47204ff 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -8003,7 +8003,7 @@ } void BeginTest() override { - expected_local_surface_id_ = allocator_.GenerateId(); + expected_local_surface_id_ = allocator_.GetCurrentLocalSurfaceId(); PostSetLocalSurfaceIdToMainThread(expected_local_surface_id_); } @@ -8027,9 +8027,56 @@ viz::LocalSurfaceId expected_local_surface_id_; viz::ParentLocalSurfaceIdAllocator allocator_; }; - SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLocalSurfaceId); +// Makes sure that viz::LocalSurfaceId allocation requests propagate all the way +// to LayerTreeFrameSink. +class LayerTreeHostTestRequestNewLocalSurfaceId : public LayerTreeHostTest { + protected: + void InitializeSettings(LayerTreeSettings* settings) override { + settings->enable_surface_synchronization = true; + } + + void BeginTest() override { + expected_parent_local_surface_id_ = allocator_.GetCurrentLocalSurfaceId(); + PostSetLocalSurfaceIdToMainThread(expected_parent_local_surface_id_); + PostRequestNewLocalSurfaceIdToMainThread(); + } + + DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, + LayerTreeHostImpl::FrameData* frame_data, + DrawResult draw_result) override { + EXPECT_EQ(DRAW_SUCCESS, draw_result); + EXPECT_EQ(expected_parent_local_surface_id_, + host_impl->active_tree()->local_surface_id_from_parent()); + return draw_result; + } + + void DisplayReceivedLocalSurfaceIdOnThread( + const viz::LocalSurfaceId& local_surface_id) override { + viz::LocalSurfaceId child_local_surface_id( + expected_parent_local_surface_id_.parent_sequence_number(), + expected_parent_local_surface_id_.child_sequence_number() + 1, + expected_parent_local_surface_id_.embed_token()); + EXPECT_NE(expected_parent_local_surface_id_, local_surface_id); + EXPECT_EQ(child_local_surface_id, local_surface_id); + } + + // This gets called after DispllayReceivedLocalSurfaceIdOnThread. + void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { + // Verify that the request bit doesn't stick after we submit a frame. + EXPECT_FALSE( + host_impl->active_tree()->new_local_surface_id_request_for_testing()); + EndTest(); + } + + void AfterTest() override {} + + viz::LocalSurfaceId expected_parent_local_surface_id_; + viz::ParentLocalSurfaceIdAllocator allocator_; +}; +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestRequestNewLocalSurfaceId); + // The GPU image decode controller hands images off to Skia for rasterization. // When used with large images, the images in question could be deleted before // Skia was done with them, causing a crash. This test performs an end-to-end
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 642763b..ec5f819 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -469,6 +469,8 @@ target_tree->set_content_source_id(content_source_id()); + if (TakeNewLocalSurfaceIdRequest()) + target_tree->RequestNewLocalSurfaceId(); target_tree->SetLocalSurfaceIdFromParent(local_surface_id_from_parent()); target_tree->pending_page_scale_animation_ = @@ -965,11 +967,25 @@ void LayerTreeImpl::SetLocalSurfaceIdFromParent( const viz::LocalSurfaceId& local_surface_id_from_parent) { + // If surface synchronization is on then we expect that if the viewport size + // has changed then either the |local_surface_id_from_parent| or there is a + // pending impl-side request for new viz::LocalSurfaceId allocation. CHECK(!settings().enable_surface_synchronization || !viewport_size_invalid_ || - local_surface_id_from_parent_ != local_surface_id_from_parent); + local_surface_id_from_parent_ != local_surface_id_from_parent || + new_local_surface_id_request_); local_surface_id_from_parent_ = local_surface_id_from_parent; } +void LayerTreeImpl::RequestNewLocalSurfaceId() { + new_local_surface_id_request_ = true; +} + +bool LayerTreeImpl::TakeNewLocalSurfaceIdRequest() { + bool new_local_surface_id_request = new_local_surface_id_request_; + new_local_surface_id_request_ = false; + return new_local_surface_id_request; +} + void LayerTreeImpl::SetRasterColorSpace( int raster_color_space_id, const gfx::ColorSpace& raster_color_space) {
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index f2fac6a5..919e5a13 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h
@@ -303,6 +303,12 @@ return local_surface_id_from_parent_; } + void RequestNewLocalSurfaceId(); + bool TakeNewLocalSurfaceIdRequest(); + bool new_local_surface_id_request_for_testing() const { + return new_local_surface_id_request_; + } + void SetRasterColorSpace(int raster_color_space_id, const gfx::ColorSpace& raster_color_space); const gfx::ColorSpace& raster_color_space() const { @@ -606,6 +612,7 @@ uint32_t content_source_id_; viz::LocalSurfaceId local_surface_id_from_parent_; + bool new_local_surface_id_request_ = false; scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java index d36c1c3..a6ae2ed 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java
@@ -13,19 +13,32 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeActivity; +import org.chromium.chrome.browser.ChromeFeatureList; +import org.chromium.chrome.browser.autofill.keyboard_accessory.KeyboardAccessoryCoordinator; +import org.chromium.chrome.browser.autofill.keyboard_accessory.KeyboardAccessoryData; +import org.chromium.chrome.browser.autofill.keyboard_accessory.KeyboardAccessoryData.Action; import org.chromium.ui.DropdownPopupWindow; import org.chromium.ui.base.WindowAndroid; +import javax.annotation.Nullable; + /** * JNI call glue for password generation between native and Java objects. */ @JNINamespace("autofill") -public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickListener, - PopupWindow.OnDismissListener, PasswordGenerationAdapter.Delegate { +public class PasswordGenerationPopupBridge + implements AdapterView.OnItemClickListener, PopupWindow.OnDismissListener, + PasswordGenerationAdapter.Delegate, Action.Delegate { private final long mNativePasswordGenerationPopupViewAndroid; private final Context mContext; private final DropdownPopupWindow mPopup; private final View mAnchorView; + private final KeyboardAccessoryData.PropertyProvider<Action> mActionProvider = + new KeyboardAccessoryData.PropertyProvider<>(); + private @Nullable Action mKeyboardAccessoryAction; + private final @Nullable KeyboardAccessoryCoordinator mKeyboardAccessory; + /** * A convenience method for the constructor to be invoked from the native counterpart. * @param anchorView View anchored for popup. @@ -52,10 +65,17 @@ // mContext could've been garbage collected. if (mContext == null) { mPopup = null; + mKeyboardAccessory = null; // Prevent destroying the native counterpart when it's about to derefence its own // members in UpdateBoundsAndRedrawPopup(). - new Handler().post(() -> onDismiss()); + new Handler().post(this::onDismiss); } else { + if (mContext instanceof ChromeActivity) { + mKeyboardAccessory = ((ChromeActivity) mContext).getKeyboardAccessory(); + mKeyboardAccessory.registerActionListProvider(mActionProvider); + } else { + mKeyboardAccessory = null; + } mPopup = new DropdownPopupWindow(mContext, anchorView); mPopup.setOnItemClickListener(this); mPopup.setOnDismissListener(this); @@ -109,6 +129,13 @@ String suggestionTitle, String explanationText, int explanationTextLinkRangeStart, int explanationTextLinkRangeEnd) { if (mPopup != null) { + // If an action can be shown in the popup, provide the same in the accessory or sheet. + if (providesGenerationAction()) { + // TODO(ioanap): Move these lines to a new native call or even a separate bridge. + createGeneratePasswordAction(suggestionTitle, this); + mActionProvider.notifyObservers(new Action[] {mKeyboardAccessoryAction}); + // Don't return for now. We want to have both mechanisms in place initially. + } float anchorWidth = mAnchorView.getLayoutParams().width; assert anchorWidth > 0; PasswordGenerationAdapter adapter = new PasswordGenerationAdapter(mContext, this, @@ -138,4 +165,32 @@ private void hide() { if (mPopup != null) mPopup.dismiss(); } + + @Override + public void onActionTriggered(Action action) { + assert action == mKeyboardAccessoryAction; + nativePasswordSelected(mNativePasswordGenerationPopupViewAndroid); + // TODO(ioanap): Create and use this call instead to start the ModalDialog flow: + // nativePasswordGenerationRequested(mNativePasswordGenerationPopupViewAndroid); + } + + private boolean providesGenerationAction() { + return mKeyboardAccessory != null && ChromeFeatureList.isInitialized() + && ChromeFeatureList.isEnabled(ChromeFeatureList.PASSWORDS_KEYBOARD_ACCESSORY); + } + + private void createGeneratePasswordAction(String caption, Action.Delegate delegate) { + assert mKeyboardAccessoryAction == null : "Accessory Action should only be created once!"; + mKeyboardAccessoryAction = new Action() { + @Override + public String getCaption() { + return caption; + } + + @Override + public Delegate getDelegate() { + return delegate; + } + }; + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryCoordinator.java index 2f41d47..14deb00 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryCoordinator.java
@@ -71,11 +71,12 @@ } /** - * Allows any {@link KeyboardAccessoryData.ActionListProvider} to communicate with the + * Allows any {@link KeyboardAccessoryData.Provider} to communicate with the * {@link KeyboardAccessoryMediator} of this component. * @param provider The object providing action lists to observers in this component. */ - public void registerActionListProvider(KeyboardAccessoryData.ActionListProvider provider) { + public void registerActionListProvider( + KeyboardAccessoryData.Provider<KeyboardAccessoryData.Action> provider) { provider.addObserver(mMediator); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryData.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryData.java index bff27bf..71c0994e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryData.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryData.java
@@ -4,33 +4,39 @@ package org.chromium.chrome.browser.autofill.keyboard_accessory; +import java.util.ArrayList; +import java.util.List; + /** * Interfaces in this class are used to pass data into keyboard accessory component. */ public class KeyboardAccessoryData { /** - * A provider notifies all registered {@link ActionListObserver} if the list of actions + * A provider notifies all registered {@link Observer} if the list of actions * changes. + * TODO(fhorschig): Replace with android.databinding.ObservableField if available. + * @param <T> Either an {@link Action} or a {@link Tab} that this instance provides. */ - public interface ActionListProvider { + public interface Provider<T> { /** - * Every observer added by this need to be notified whenever the list of action changes + * Every observer added by this need to be notified whenever the list of items changes. * @param observer The observer to be notified. */ - void addObserver(ActionListObserver observer); + void addObserver(Observer<T> observer); } /** - * An observer receives notifications from an {@link ActionListProvider} it is subscribed to. + * An observer receives notifications from an {@link Provider} it is subscribed to. + * @param <T> Either an {@link Action} or a {@link Tab} that this instance observes. */ - public interface ActionListObserver { + public interface Observer<T> { /** - * A provider calls this function with a list of actions that should be available in the + * A provider calls this function with a list of items that should be available in the * keyboard accessory. * @param actions The actions to be displayed in the Accessory. It's a native array as the * provider is typically a bridge called via JNI which prefers native types. */ - void onActionsAvailable(Action[] actions); + void onItemsAvailable(T[] actions); } /** @@ -60,5 +66,29 @@ Delegate getDelegate(); } + /** + * A simple class that holds a list of {@link Observer}s which can be notified about new data by + * directly passing that data into {@link PropertyProvider#notifyObservers(T[])}. + * @param <T> Either {@link Action}s or {@link Tab}s provided by this class. + */ + public static class PropertyProvider<T> implements Provider<T> { + private final List<Observer<T>> mObservers = new ArrayList<>(); + + @Override + public void addObserver(Observer<T> observer) { + mObservers.add(observer); + } + + /** + * Passes the given items to all subscribed {@link Observer}s. + * @param items The array of items to be passed to the {@link Observer}s. + */ + public void notifyObservers(T[] items) { + for (Observer<T> observer : mObservers) { + observer.onItemsAvailable(items); + } + } + } + private KeyboardAccessoryData() {} }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryMediator.java index 88963f51..8c1f964 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryMediator.java
@@ -21,9 +21,9 @@ * callback to trigger when selecting them. */ class KeyboardAccessoryMediator - implements KeyboardAccessoryData.ActionListObserver, - WindowAndroid.KeyboardVisibilityListener, ListObservable.ListObserver, - PropertyObservable.PropertyObserver<KeyboardAccessoryModel.PropertyKey> { + implements WindowAndroid.KeyboardVisibilityListener, ListObservable.ListObserver, + PropertyObservable.PropertyObserver<KeyboardAccessoryModel.PropertyKey>, + KeyboardAccessoryData.Observer<KeyboardAccessoryData.Action> { private final KeyboardAccessoryModel mModel; private final WindowAndroid mWindowAndroid; @@ -48,7 +48,7 @@ } @Override - public void onActionsAvailable(KeyboardAccessoryData.Action[] actions) { + public void onItemsAvailable(KeyboardAccessoryData.Action[] actions) { mModel.setActions(actions); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java b/chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java index f97bbdc..af0e324 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java
@@ -13,6 +13,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.chrome.R; import org.chromium.chrome.browser.ShortcutHelper; +import org.chromium.chrome.browser.vr_shell.VrShellDelegate; import org.chromium.chrome.browser.webapps.AddToHomescreenDialog; import org.chromium.content_public.browser.WebContents; @@ -44,6 +45,8 @@ * @return true if add to home screen is supported, false otherwise. */ public static boolean isSupported() { + // TODO(mthiesse, https://crbug.com/840811): Support the app banner dialog in VR. + if (VrShellDelegate.isInVr()) return false; if (sIsSupported == null) { sIsSupported = ShortcutHelper.isAddToHomeIntentSupported(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java index a9e2ef5..573cc3f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.media.router.MediaSink; import org.chromium.chrome.browser.media.router.MediaSource; import org.chromium.chrome.browser.media.router.cast.BaseMediaRouteProvider; +import org.chromium.chrome.browser.media.router.cast.CastSession; import org.chromium.chrome.browser.media.router.cast.ChromeCastSessionManager; import org.chromium.chrome.browser.media.router.cast.CreateRouteRequest; @@ -26,6 +27,9 @@ public class RemotingMediaRouteProvider extends BaseMediaRouteProvider { private static final String TAG = "MediaRemoting"; + private int mPendingNativeRequestId; + private MediaRoute mPendingMediaRoute; + /** * @return Initialized {@link RemotingMediaRouteProvider} object. */ @@ -103,12 +107,42 @@ MediaSink sink = request.getSink(); MediaSource source = request.getSource(); - MediaRoute route = + // Calling mManager.onRouteCreated() too early causes some issues. If we call it here + // directly, getMediaController() might be called before onSessionStarted(), which causes + // the FlingingRenderer's creation to fail. Instead, save the route and request ID, and only + // signal the route as having been created when onSessionStarted() is called. + mPendingMediaRoute = new MediaRoute(sink.getId(), source.getSourceId(), request.getPresentationId()); - mRoutes.put(route.id, route); - mManager.onRouteCreated(route.id, route.sinkId, request.getNativeRequestId(), this, true); + mPendingNativeRequestId = request.getNativeRequestId(); } + private void clearPendingRoute() { + mPendingMediaRoute = null; + mPendingNativeRequestId = 0; + } + + @Override + public void onSessionStarted(CastSession session) { + super.onSessionStarted(session); + + // Continued from onSessionStarting() + mRoutes.put(mPendingMediaRoute.id, mPendingMediaRoute); + mManager.onRouteCreated(mPendingMediaRoute.id, mPendingMediaRoute.sinkId, + mPendingNativeRequestId, this, true); + + clearPendingRoute(); + } + + @Override + public void onSessionStartFailed() { + super.onSessionStartFailed(); + + mManager.onRouteRequestError( + "Failure to start RemotingCastSession", mPendingNativeRequestId); + + clearPendingRoute(); + }; + @Override @Nullable public MediaController getMediaController(String routeId) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java index fe8fa7b..5207ddae 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java
@@ -42,8 +42,11 @@ // The number of successful decodes, per batch. private int mSuccessfulDecodes = 0; - // The number of failed decodes, per batch. - private int mFailedDecodes = 0; + // The number of runtime failures during decoding, per batch. + private int mFailedDecodesRuntime = 0; + + // The number of out of memory failures during decoding, per batch. + private int mFailedDecodesMemory = 0; // A callback to use for testing to see if decoder is ready. static ServiceReadyCallback sReadyCallbackForTesting; @@ -181,13 +184,19 @@ params.mTimestamp = SystemClock.elapsedRealtime(); dispatchDecodeImageRequest(params.mFilePath, params.mSize); } else { - int totalRequests = mSuccessfulDecodes + mFailedDecodes; + int totalRequests = mSuccessfulDecodes + mFailedDecodesRuntime + mFailedDecodesMemory; if (totalRequests > 0) { - int successPercentage = 100 * mSuccessfulDecodes / totalRequests; + int runtimeFailures = 100 * mFailedDecodesRuntime / totalRequests; RecordHistogram.recordPercentageHistogram( - "Android.PhotoPicker.DecoderHostSuccess", successPercentage); + "Android.PhotoPicker.DecoderHostFailureRuntime", runtimeFailures); + + int memoryFailures = 100 * mFailedDecodesMemory / totalRequests; + RecordHistogram.recordPercentageHistogram( + "Android.PhotoPicker.DecoderHostFailureOutOfMemory", memoryFailures); + mSuccessfulDecodes = 0; - mFailedDecodes = 0; + mFailedDecodesRuntime = 0; + mFailedDecodesMemory = 0; } } } @@ -211,7 +220,9 @@ mSuccessfulDecodes++; closeRequest(filePath, bitmap, decodeTime); } catch (RuntimeException e) { - mFailedDecodes++; + mFailedDecodesRuntime++; + } catch (OutOfMemoryError e) { + mFailedDecodesMemory++; } } });
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/download/DownloadDirectoryAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/download/DownloadDirectoryAdapter.java index 3b04c52..cd6d344 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/download/DownloadDirectoryAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/download/DownloadDirectoryAdapter.java
@@ -12,6 +12,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import android.widget.ArrayAdapter; import android.widget.TextView; @@ -125,6 +126,12 @@ TextView titleText = (TextView) view.findViewById(R.id.text); titleText.setText(directoryOption.getName()); + // ModalDialogView may do a measure pass on the view hierarchy to limit the layout inside + // certain area, where LayoutParams cannot be null. + if (view.getLayoutParams() == null) { + view.setLayoutParams( + new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + } return view; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetController.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetController.java index a322a3b..42dde8c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetController.java
@@ -108,6 +108,12 @@ if (tab != tabModelSelector.getCurrentTab()) return; clearRequestsAndHide(); } + + @Override + public void onCrash(Tab tab, boolean sadTabShown) { + if (tab != tabModelSelector.getCurrentTab()) return; + clearRequestsAndHide(); + } }; final TabModelObserver tabSelectionObserver = new EmptyTabModelObserver() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillKeyboardAccessoryIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillKeyboardAccessoryIntegrationTest.java index 184a764..da0cf96b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillKeyboardAccessoryIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillKeyboardAccessoryIntegrationTest.java
@@ -127,7 +127,6 @@ @Test @MediumTest @Feature({"keyboard-accessory"}) - @DisabledTest(message = "crbug.com/838922") public void testTapInputFieldShowsKeyboardAccessory() throws ExecutionException, InterruptedException, TimeoutException { loadTestPage(false);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index ed84a968..f5bd3fa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -1443,6 +1443,7 @@ * Tests that a Tap gesture followed by scrolling clears the selection. */ @Test + @DisabledTest(message = "crbug.com/841017") @SmallTest @Feature({"ContextualSearch"}) public void testTapGestureFollowedByScrollClearsSelection()
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java index cc1c89b..c1d505b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java
@@ -15,6 +15,7 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.RetryOnFailure; @@ -182,6 +183,7 @@ @Test @SmallTest @Feature({"SearchEngines"}) + @DisabledTest(message = "crbug.com/841098") public void testSortandGetCustomSearchEngine() { final TemplateUrlService templateUrlService = waitForTemplateUrlServiceToLoad();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java index 07760e9..6f12051 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTransitionTest.java
@@ -375,8 +375,9 @@ */ @Test @MediumTest - @CommandLineFlags.Remove({"enable-webvr"}) - @CommandLineFlags.Add({"enable-features=WebXR"}) + @DisabledTest(message = "crbug.com/841103") + //@CommandLineFlags.Remove({"enable-webvr"}) + //@CommandLineFlags.Add({"enable-features=WebXR"}) public void testControlsVisibleAfterExitingVr_WebXr() throws InterruptedException { controlsVisibleAfterExitingVrImpl( XrTestFramework.getFileUrlForHtmlTestFile("generic_webxr_page"), mXrTestFramework); @@ -422,11 +423,11 @@ */ @Test @MediumTest - @CommandLineFlags.Remove({"enable-webvr"}) - @CommandLineFlags.Add({"enable-features=WebXR"}) + @DisabledTest(message = "crbug.com/840883") + //@CommandLineFlags.Remove({"enable-webvr"}) + //@CommandLineFlags.Add({"enable-features=WebXR"}) @VrActivityRestriction({VrActivityRestriction.SupportedActivity.ALL}) - public void testWindowRafStopsFiringWhilePresenting_WebXr() - throws InterruptedException { + public void testWindowRafStopsFiringWhilePresenting_WebXr() throws InterruptedException { windowRafStopsFiringWhilePresentingImpl( XrTestFramework.getFileUrlForHtmlTestFile( "webxr_test_window_raf_stops_firing_during_exclusive_session"),
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryControllerTest.java index 230d07a..23836cf 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/KeyboardAccessoryControllerTest.java
@@ -28,14 +28,12 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.autofill.AutofillKeyboardSuggestions; +import org.chromium.chrome.browser.autofill.keyboard_accessory.KeyboardAccessoryData.Action; +import org.chromium.chrome.browser.autofill.keyboard_accessory.KeyboardAccessoryData.PropertyProvider; import org.chromium.chrome.browser.modelutil.ListObservable; -import org.chromium.chrome.browser.modelutil.PropertyModelChangeProcessor; import org.chromium.chrome.browser.modelutil.PropertyObservable.PropertyObserver; import org.chromium.ui.base.WindowAndroid; -import java.util.ArrayList; -import java.util.List; - /** * Controller tests for the keyboard accessory component. */ @@ -54,27 +52,9 @@ private ViewStub mMockViewStub; @Mock private KeyboardAccessoryView mMockView; - @Mock - private PropertyModelChangeProcessor<KeyboardAccessoryModel, KeyboardAccessoryView, - KeyboardAccessoryModel.PropertyKey> mMockModelChangeProcessor; - - private class TestActionListProvider implements KeyboardAccessoryData.ActionListProvider { - private final List<KeyboardAccessoryData.ActionListObserver> mObservers = new ArrayList<>(); - - @Override - public void addObserver(KeyboardAccessoryData.ActionListObserver observer) { - mObservers.add(observer); - } - - public void sendActionsToReceivers(KeyboardAccessoryData.Action[] actions) { - for (KeyboardAccessoryData.ActionListObserver observer : mObservers) { - observer.onActionsAvailable(actions); - } - } - } private static class FakeTab implements KeyboardAccessoryData.Tab {} - private static class FakeAction implements KeyboardAccessoryData.Action { + private static class FakeAction implements Action { @Override public String getCaption() { return null; @@ -151,32 +131,32 @@ @SmallTest @Feature({"keyboard-accessory"}) public void testModelNotifiesAboutActionsChangedByProvider() { - final TestActionListProvider testProvider = new TestActionListProvider(); + final PropertyProvider<Action> testProvider = new PropertyProvider<>(); final FakeAction testAction = new FakeAction(); mModel.addActionListObserver(mMockActionListObserver); mCoordinator.registerActionListProvider(testProvider); // If the coordinator receives an initial actions, the model should report an insertion. - testProvider.sendActionsToReceivers(new KeyboardAccessoryData.Action[] {testAction}); + testProvider.notifyObservers(new Action[] {testAction}); verify(mMockActionListObserver).onItemRangeInserted(mModel.getActionList(), 0, 1); assertThat(mModel.getActionList().getItemCount(), is(1)); assertThat(mModel.getActionList().get(0), is(equalTo(testAction))); // If the coordinator receives a new set of actions, the model should report a change. - testProvider.sendActionsToReceivers(new KeyboardAccessoryData.Action[] {testAction}); + testProvider.notifyObservers(new Action[] {testAction}); verify(mMockActionListObserver) .onItemRangeChanged(mModel.getActionList(), 0, 1, mModel.getActionList()); assertThat(mModel.getActionList().getItemCount(), is(1)); assertThat(mModel.getActionList().get(0), is(equalTo(testAction))); // If the coordinator receives an empty set of actions, the model should report a deletion. - testProvider.sendActionsToReceivers(new KeyboardAccessoryData.Action[] {}); + testProvider.notifyObservers(new Action[] {}); verify(mMockActionListObserver).onItemRangeRemoved(mModel.getActionList(), 0, 1); assertThat(mModel.getActionList().getItemCount(), is(0)); // There should be no notification if no actions are reported repeatedly. - testProvider.sendActionsToReceivers(new KeyboardAccessoryData.Action[] {}); + testProvider.notifyObservers(new Action[] {}); verifyNoMoreInteractions(mMockActionListObserver); }
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index 9841f491..dde0c78d 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-68.0.3424.0_rc-r1.afdo.bz2 \ No newline at end of file +chromeos-chrome-amd64-68.0.3425.0_rc-r1.afdo.bz2 \ No newline at end of file
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 0fb76394..4999301 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -271,6 +271,9 @@ <message name="IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL" desc="Label for checkbox which enables an on-screen keyboard."> Enable on-screen keyboard </message> + <message name="IDS_SETTINGS_ACCESSIBILITY_DICTATION_LABEL" desc="Label for checkbox which enables the ability to speak into text fields"> + Enable dictation (speak to type) + </message> <message name="IDS_SETTINGS_MONO_AUDIO_LABEL" desc="Label for checkbox which enables mono audio output."> Play the same audio through all speakers (mono audio) </message> @@ -310,6 +313,9 @@ <message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_HEADING" desc="In the settings tab, the heading above settings related to the keyboard."> Keyboard </message> + <message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_AND_TEXT_INPUT_HEADING" desc="In the settings tab, the heading above settings related to the keyboard and other text input."> + Keyboard and text input + </message> <message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE" desc="In the settings tab, the title of a link to open keyboard settings."> Open keyboard device settings </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index f8e06f4..2b1fdb81d 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -3047,6 +3047,7 @@ "//chrome/app_shim", "//chrome/browser/apps/app_shim", "//chrome/browser/ui/cocoa/notifications:common", + "//services/video_capture/public/mojom:constants", "//third_party/crashpad/crashpad/client:client", "//third_party/google_toolbox_for_mac", "//third_party/mozilla",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index fc9672c..e4a01a5 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS
@@ -78,6 +78,7 @@ "+services/ui/common", "+services/ui/public", "+services/ui/service.h", + "+services/video_capture/public", "+services/viz/privileged", "+skia/ext", "+third_party/boringssl/src/include", @@ -214,7 +215,7 @@ # Once Ash runs out of process no longer needed. "+ash/content/content_gpu_support.h", "+ash/shell.h", - "+ash/ws/window_service_delegate_impl.h", + "+ash/ws/window_service_util.h", "+services/ui/ws2/window_service.h", # Needed for classic mode.
diff --git a/chrome/browser/ash_service_registry.cc b/chrome/browser/ash_service_registry.cc index e3b6462..01673578 100644 --- a/chrome/browser/ash_service_registry.cc +++ b/chrome/browser/ash_service_registry.cc
@@ -7,9 +7,11 @@ #include "ash/ash_service.h" #include "ash/components/quick_launch/public/mojom/constants.mojom.h" #include "ash/content/content_gpu_support.h" +#include "ash/public/cpp/window_properties.h" #include "ash/public/interfaces/constants.mojom.h" +#include "ash/public/interfaces/window_properties.mojom.h" #include "ash/shell.h" -#include "ash/ws/window_service_delegate_impl.h" +#include "ash/ws/window_service_util.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_task_runner_handle.h" @@ -65,10 +67,9 @@ } } -std::unique_ptr<service_manager::Service> CreateEmbeddedWindowService() { - return std::make_unique<ui::ws2::WindowService>( - ash::Shell::Get()->window_service_delegate(), - std::make_unique<ash::ContentGpuSupport>()); +// A factory function used in creation of the WindowService. +std::unique_ptr<ui::ws2::GpuSupport> CreateContentGpuSupport() { + return std::make_unique<ash::ContentGpuSupport>(); } } // namespace @@ -105,7 +106,8 @@ ash::AshService::CreateEmbeddedServiceInfo(); service_manager::EmbeddedServiceInfo ui_service_info; - ui_service_info.factory = base::BindRepeating(&CreateEmbeddedWindowService); + ui_service_info.factory = base::BindRepeating( + &ash::CreateWindowService, base::BindRepeating(&CreateContentGpuSupport)); ui_service_info.task_runner = base::ThreadTaskRunnerHandle::Get(); (*services)[ui::mojom::kServiceName] = ui_service_info; }
diff --git a/chrome/browser/autofill/android/phone_number_util_android.cc b/chrome/browser/autofill/android/phone_number_util_android.cc index 4dc0b41..79044d6 100644 --- a/chrome/browser/autofill/android/phone_number_util_android.cc +++ b/chrome/browser/autofill/android/phone_number_util_android.cc
@@ -16,19 +16,18 @@ using ::base::android::ConvertUTF8ToJavaString; using ::base::android::JavaParamRef; using ::base::android::ScopedJavaLocalRef; -using ::i18n::phonenumbers::PhoneNumber; -using ::i18n::phonenumbers::PhoneNumberUtil; // Formats the |phone_number| to the specified |format| for the given country // |country_code|. Returns the original number if the operation is not possible. std::string FormatPhoneNumberWithCountryCode( const std::string& phone_number, const std::string& country_code, - PhoneNumberUtil::PhoneNumberFormat format) { - PhoneNumber parsed_number; - PhoneNumberUtil* phone_number_util = PhoneNumberUtil::GetInstance(); + i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat format) { + i18n::phonenumbers::PhoneNumber parsed_number; + i18n::phonenumbers::PhoneNumberUtil* phone_number_util = + i18n::phonenumbers::PhoneNumberUtil::GetInstance(); if (phone_number_util->Parse(phone_number, country_code, &parsed_number) != - PhoneNumberUtil::NO_PARSING_ERROR) { + i18n::phonenumbers::PhoneNumberUtil::NO_PARSING_ERROR) { return phone_number; } @@ -40,8 +39,9 @@ // Formats the |phone_number| to the specified |format|. Use application locale // to determine country code. Returns the original number if the operation is // not possible. -std::string FormatPhoneNumber(const std::string& phone_number, - PhoneNumberUtil::PhoneNumberFormat format) { +std::string FormatPhoneNumber( + const std::string& phone_number, + i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat format) { return FormatPhoneNumberWithCountryCode( phone_number, autofill::AutofillCountry::CountryCodeForLocale( @@ -61,14 +61,15 @@ const JavaParamRef<jstring>& jphone_number, const JavaParamRef<jstring>& jcountry_code) { return ConvertUTF8ToJavaString( - env, - jcountry_code.is_null() - ? FormatPhoneNumber(ConvertJavaStringToUTF8(env, jphone_number), - PhoneNumberUtil::PhoneNumberFormat::INTERNATIONAL) - : FormatPhoneNumberWithCountryCode( - ConvertJavaStringToUTF8(env, jphone_number), - ConvertJavaStringToUTF8(env, jcountry_code), - PhoneNumberUtil::PhoneNumberFormat::INTERNATIONAL)); + env, jcountry_code.is_null() + ? FormatPhoneNumber(ConvertJavaStringToUTF8(env, jphone_number), + i18n::phonenumbers::PhoneNumberUtil:: + PhoneNumberFormat::INTERNATIONAL) + : FormatPhoneNumberWithCountryCode( + ConvertJavaStringToUTF8(env, jphone_number), + ConvertJavaStringToUTF8(env, jcountry_code), + i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat:: + INTERNATIONAL)); } // Formats the given number |jphone_number| to @@ -81,8 +82,9 @@ const base::android::JavaParamRef<jclass>& jcaller, const JavaParamRef<jstring>& jphone_number) { return ConvertUTF8ToJavaString( - env, FormatPhoneNumber(ConvertJavaStringToUTF8(env, jphone_number), - PhoneNumberUtil::PhoneNumberFormat::E164)); + env, FormatPhoneNumber( + ConvertJavaStringToUTF8(env, jphone_number), + i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::E164)); } // Checks whether the given number |jphone_number| is a possible number for a @@ -99,8 +101,8 @@ g_browser_process->GetApplicationLocale()) : ConvertJavaStringToUTF8(env, jcountry_code); - return PhoneNumberUtil::GetInstance()->IsPossibleNumberForString( - phone_number, country_code); + return i18n::phonenumbers::PhoneNumberUtil::GetInstance() + ->IsPossibleNumberForString(phone_number, country_code); } } // namespace autofill
diff --git a/chrome/browser/background_fetch/background_fetch_browsertest.cc b/chrome/browser/background_fetch/background_fetch_browsertest.cc index 71d801a..c33c2d6 100644 --- a/chrome/browser/background_fetch/background_fetch_browsertest.cc +++ b/chrome/browser/background_fetch/background_fetch_browsertest.cc
@@ -50,6 +50,13 @@ // Title of a Background Fetch started by StartSingleFileDownload(). const char kSingleFileDownloadTitle[] = "Single-file Background Fetch"; +// Size of the downloaded resource, used in BackgroundFetch tests. +const int kDownloadedResourceSizeInBytes = 82; + +// Incorrect downloadTotal, set in the JavaScript file loaded by this test, +// which is chrome/test/data/background_fetch/background_fetch.js +const int kIncorrectDownloadTotalBytes = 1000; + // Implementation of a download system logger that provides the ability to wait // for certain events to happen, notably added and progressing downloads. class WaitableDownloadLoggerObserver : public download::Logger::Observer { @@ -95,6 +102,7 @@ public: using ItemsAddedCallback = base::OnceCallback<void(const std::vector<OfflineItem>&)>; + using ItemDownloadedCallback = base::OnceCallback<void(const OfflineItem&)>; OfflineContentProviderObserver() = default; ~OfflineContentProviderObserver() final = default; @@ -103,6 +111,10 @@ items_added_callback_ = std::move(callback); } + void set_item_downloaded_callback(ItemDownloadedCallback callback) { + item_downloaded_callback_ = std::move(callback); + } + // OfflineContentProvider::Observer implementation: void OnItemsAdded( const OfflineContentProvider::OfflineItemList& items) override { @@ -111,10 +123,15 @@ } void OnItemRemoved(const ContentId& id) override {} - void OnItemUpdated(const OfflineItem& item) override {} + void OnItemUpdated(const OfflineItem& item) override { + if (item.state == offline_items_collection::OfflineItemState::COMPLETE && + item_downloaded_callback_) + std::move(item_downloaded_callback_).Run(item); + } private: ItemsAddedCallback items_added_callback_; + ItemDownloadedCallback item_downloaded_callback_; DISALLOW_COPY_AND_ASSIGN(OfflineContentProviderObserver); }; @@ -244,6 +261,15 @@ std::move(quit_closure).Run(); } + // Called when the an offline item has been downloaded. + void DidDownloadItem(base::OnceClosure quit_closure, + OfflineItem* out_item, + const OfflineItem& downloaded_item) { + DCHECK(out_item); + *out_item = downloaded_item; + std::move(quit_closure).Run(); + } + protected: download::DownloadService* download_service_{nullptr}; @@ -312,8 +338,9 @@ EXPECT_FALSE(offline_item.is_suggested); EXPECT_FALSE(offline_item.is_off_the_record); + // When downloadTotal isn't specified, we report progress by parts. EXPECT_EQ(offline_item.progress.value, 0); - EXPECT_EQ(offline_item.progress.max, 1); + EXPECT_EQ(offline_item.progress.max.value(), 1); EXPECT_EQ(offline_item.progress.unit, OfflineItemProgressUnit::PERCENTAGE); // Change-detector tests for values we might want to provide or change. @@ -337,21 +364,10 @@ const OfflineItem& offline_item = items[0]; // Verify that the appropriate data is being set. - EXPECT_EQ(offline_item.title, GetExpectedTitle(kSingleFileDownloadTitle)); - EXPECT_EQ(offline_item.filter, OfflineItemFilter::FILTER_OTHER); - EXPECT_TRUE(offline_item.is_transient); - EXPECT_FALSE(offline_item.is_suggested); - EXPECT_FALSE(offline_item.is_off_the_record); - EXPECT_EQ(offline_item.progress.value, 0); - EXPECT_EQ(offline_item.progress.max, 1); + EXPECT_EQ(offline_item.progress.max.value(), 1); EXPECT_EQ(offline_item.progress.unit, OfflineItemProgressUnit::PERCENTAGE); - // Change-detector tests for values we might want to provide or change. - EXPECT_TRUE(offline_item.description.empty()); - EXPECT_TRUE(offline_item.page_url.is_empty()); - EXPECT_FALSE(offline_item.is_resumable); - // Get visuals associated with the newly added offline item. std::unique_ptr<OfflineItemVisuals> out_visuals; GetVisualsForOfflineItemSync(offline_item.id, &out_visuals); @@ -364,4 +380,57 @@ #endif } +IN_PROC_BROWSER_TEST_F( + BackgroundFetchBrowserTest, + OfflineItemCollection_VerifyResourceDownloadedWhenDownloadTotalLargerThanActualSize) { + // Starts a Background Fetch for a single to-be-downloaded file and waits for + // the fetch to be registered with the offline items collection. + std::vector<OfflineItem> items; + ASSERT_NO_FATAL_FAILURE(RunScriptAndWaitForOfflineItems( + "StartSingleFileDownloadWithBiggerThanActualDownloadTotal()", &items)); + ASSERT_EQ(items.size(), 1u); + + OfflineItem offline_item = items[0]; + + // Verify that the appropriate data is being set when we start downloading. + EXPECT_EQ(offline_item.progress.value, 0); + EXPECT_EQ(offline_item.progress.max.value(), kIncorrectDownloadTotalBytes); + EXPECT_EQ(offline_item.progress.unit, OfflineItemProgressUnit::PERCENTAGE); + + // Wait for the download to be completed. + { + base::RunLoop run_loop; + offline_content_provider_observer_->set_item_downloaded_callback( + base::BindOnce(&BackgroundFetchBrowserTest::DidDownloadItem, + base::Unretained(this), run_loop.QuitClosure(), + &offline_item)); + run_loop.Run(); + } + + // Download total is incorrect; check that we're still reporting by size, + // but have set the max value of the progress bar to the actual download size. + EXPECT_EQ(offline_item.progress.max.value(), offline_item.progress.value); + EXPECT_EQ(offline_item.progress.max.value(), kDownloadedResourceSizeInBytes); +} + +IN_PROC_BROWSER_TEST_F( + BackgroundFetchBrowserTest, + OfflineItemCollection_VerifyResourceDownloadedWhenCorrectDownloadTotalSpecified) { + // Starts a Background Fetch for a single to-be-downloaded file and waits for + // the fetch to be registered with the offline items collection. + + std::vector<OfflineItem> items; + ASSERT_NO_FATAL_FAILURE(RunScriptAndWaitForOfflineItems( + "StartSingleFileDownloadWithCorrectDownloadTotal()", &items)); + ASSERT_EQ(items.size(), 1u); + + const OfflineItem& offline_item = items[0]; + + // Verify that the appropriate data is being set when downloadTotal is + // correctly set. + EXPECT_EQ(offline_item.progress.value, 0); + EXPECT_EQ(offline_item.progress.max.value(), kDownloadedResourceSizeInBytes); + EXPECT_EQ(offline_item.progress.unit, OfflineItemProgressUnit::PERCENTAGE); +} + } // namespace
diff --git a/chrome/browser/background_fetch/background_fetch_delegate_impl.cc b/chrome/browser/background_fetch/background_fetch_delegate_impl.cc index e58b071d..441c088 100644 --- a/chrome/browser/background_fetch/background_fetch_delegate_impl.cc +++ b/chrome/browser/background_fetch/background_fetch_delegate_impl.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/guid.h" +#include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" @@ -18,6 +19,7 @@ #include "components/download/public/background_service/download_service.h" #include "components/offline_items_collection/core/offline_content_aggregator.h" #include "components/offline_items_collection/core/offline_item.h" +#include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/browser_thread.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -46,39 +48,45 @@ BackgroundFetchDelegateImpl::JobDetails::JobDetails(JobDetails&&) = default; BackgroundFetchDelegateImpl::JobDetails::JobDetails( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts) - : title(title), - origin(origin), - icon(gfx::ImageSkia::CreateFrom1xBitmap(icon)), - completed_parts(completed_parts), - total_parts(total_parts), - cancelled(false), - offline_item(offline_items_collection::ContentId("background_fetch", - job_unique_id)) { + std::unique_ptr<content::BackgroundFetchDescription> fetch_description) + : cancelled(false), + offline_item(offline_items_collection::ContentId( + "background_fetch", + fetch_description->job_unique_id)), + fetch_description(std::move(fetch_description)) { UpdateOfflineItem(); } BackgroundFetchDelegateImpl::JobDetails::~JobDetails() = default; void BackgroundFetchDelegateImpl::JobDetails::UpdateOfflineItem() { - if (total_parts > 0) { - offline_item.progress.value = completed_parts; - offline_item.progress.max = total_parts; - offline_item.progress.unit = - offline_items_collection::OfflineItemProgressUnit::PERCENTAGE; + DCHECK_GT(fetch_description->total_parts, 0); + + if (ShouldReportProgressBySize()) { + offline_item.progress.value = fetch_description->completed_parts_size; + // If we have completed all downloads, update progress max to + // completed_parts_size in case total_parts_size was set too high. This + // avoid unnecessary jumping in the progress bar. + offline_item.progress.max = + (fetch_description->completed_parts == fetch_description->total_parts) + ? fetch_description->completed_parts_size + : fetch_description->total_parts_size; + } else { + offline_item.progress.value = fetch_description->completed_parts; + offline_item.progress.max = fetch_description->total_parts; } - if (title.empty()) { - offline_item.title = origin.Serialize(); + + offline_item.progress.unit = + offline_items_collection::OfflineItemProgressUnit::PERCENTAGE; + + if (fetch_description->title.empty()) { + offline_item.title = fetch_description->origin.Serialize(); } else { // TODO(crbug.com/774612): Make sure that the origin is displayed completely // in all cases so that long titles cannot obscure it. - offline_item.title = base::StringPrintf("%s (%s)", title.c_str(), - origin.Serialize().c_str()); + offline_item.title = + base::StringPrintf("%s (%s)", fetch_description->title.c_str(), + fetch_description->origin.Serialize().c_str()); } // TODO(delphick): Figure out what to put in offline_item.description. offline_item.is_transient = true; @@ -86,12 +94,28 @@ using OfflineItemState = offline_items_collection::OfflineItemState; if (cancelled) offline_item.state = OfflineItemState::CANCELLED; - else if (completed_parts == total_parts) + else if (fetch_description->completed_parts == fetch_description->total_parts) offline_item.state = OfflineItemState::COMPLETE; else offline_item.state = OfflineItemState::IN_PROGRESS; } +bool BackgroundFetchDelegateImpl::JobDetails::ShouldReportProgressBySize() { + if (!fetch_description->total_parts_size) { + // total_parts_size was not set. Cannot report by size. + return false; + } + + if (fetch_description->completed_parts < fetch_description->total_parts && + fetch_description->completed_parts_size > + fetch_description->total_parts_size) { + // total_parts_size was set too low. + return false; + } + + return true; +} + void BackgroundFetchDelegateImpl::GetIconDisplaySize( BackgroundFetchDelegate::GetIconDisplaySizeCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -109,24 +133,16 @@ } void BackgroundFetchDelegateImpl::CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) { + std::unique_ptr<content::BackgroundFetchDescription> fetch_description) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + std::string job_unique_id = fetch_description->job_unique_id; DCHECK(!job_details_map_.count(job_unique_id)); - auto emplace_result = job_details_map_.emplace( - job_unique_id, JobDetails(job_unique_id, title, origin, icon, - completed_parts, total_parts)); + job_unique_id, JobDetails(std::move(fetch_description))); const JobDetails& details = emplace_result.first->second; - - for (const auto& download_guid : current_guids) { + for (const auto& download_guid : details.fetch_description->current_guids) { DCHECK(!download_job_unique_id_map_.count(download_guid)); download_job_unique_id_map_.emplace(download_guid, job_unique_id); } @@ -220,6 +236,12 @@ const std::string& job_unique_id = download_job_unique_id_iter->second; + // This will update the progress bar. + DCHECK(job_details_map_.count(job_unique_id)); + JobDetails& job_details = job_details_map_.find(job_unique_id)->second; + job_details.fetch_description->completed_parts_size = bytes_downloaded; + UpdateOfflineItemAndUpdateObservers(&job_details); + if (client()) client()->OnDownloadUpdated(job_unique_id, download_guid, bytes_downloaded); } @@ -242,7 +264,7 @@ const std::string& job_unique_id = download_job_unique_id_iter->second; JobDetails& job_details = job_details_map_.find(job_unique_id)->second; - ++job_details.completed_parts; + ++job_details.fetch_description->completed_parts; UpdateOfflineItemAndUpdateObservers(&job_details); switch (reason) { @@ -295,7 +317,8 @@ const std::string& job_unique_id = download_job_unique_id_iter->second; JobDetails& job_details = job_details_map_.find(job_unique_id)->second; - ++job_details.completed_parts; + ++job_details.fetch_description->completed_parts; + job_details.fetch_description->completed_parts_size = size; UpdateOfflineItemAndUpdateObservers(&job_details); if (client()) { @@ -446,7 +469,8 @@ std::make_unique<offline_items_collection::OfflineItemVisuals>(); auto it = job_details_map_.find(id.id); if (it != job_details_map_.end()) { - visuals->icon = it->second.icon; + visuals->icon = + gfx::Image::CreateFrom1xBitmap(it->second.fetch_description->icon); } base::ThreadTaskRunnerHandle::Get()->PostTask(
diff --git a/chrome/browser/background_fetch/background_fetch_delegate_impl.h b/chrome/browser/background_fetch/background_fetch_delegate_impl.h index 66d0c81..53e620e9 100644 --- a/chrome/browser/background_fetch/background_fetch_delegate_impl.h +++ b/chrome/browser/background_fetch/background_fetch_delegate_impl.h
@@ -22,7 +22,6 @@ #include "url/origin.h" class Profile; -class SkBitmap; namespace download { class DownloadService; @@ -49,14 +48,8 @@ // BackgroundFetchDelegate implementation: void GetIconDisplaySize(GetIconDisplaySizeCallback callback) override; - void CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) override; + void CreateDownloadJob(std::unique_ptr<content::BackgroundFetchDescription> + fetch_description) override; void DownloadUrl(const std::string& job_unique_id, const std::string& guid, const std::string& method, @@ -99,21 +92,12 @@ private: struct JobDetails { JobDetails(JobDetails&&); - JobDetails(const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts); + explicit JobDetails( + std::unique_ptr<content::BackgroundFetchDescription> fetch_description); ~JobDetails(); void UpdateOfflineItem(); - std::string title; - const url::Origin origin; - gfx::Image icon; - int completed_parts; - const int total_parts; bool cancelled; // Set of DownloadService GUIDs that are currently downloading. They are @@ -122,8 +106,13 @@ base::flat_set<std::string> current_download_guids; offline_items_collection::OfflineItem offline_item; + std::unique_ptr<content::BackgroundFetchDescription> fetch_description; private: + // Whether we should report progress of the job in terms of size of + // downloads or in terms of the number of files being downloaded. + bool ShouldReportProgressBySize(); + DISALLOW_COPY_AND_ASSIGN(JobDetails); };
diff --git a/chrome/browser/browsing_data/browsing_data_history_observer_service.cc b/chrome/browser/browsing_data/browsing_data_history_observer_service.cc index 350f49c..8c237ea9 100644 --- a/chrome/browser/browsing_data/browsing_data_history_observer_service.cc +++ b/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
@@ -31,8 +31,7 @@ history::HistoryService* history_service, const history::DeletionInfo& deletion_info) { if (!deletion_info.is_from_expiration()) - browsing_data::RemoveNavigationEntries(profile_, deletion_info.time_range(), - deletion_info.deleted_rows()); + browsing_data::RemoveNavigationEntries(profile_, deletion_info); } // static
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc index a52d008..d5b9613 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
@@ -1090,6 +1090,11 @@ last_origin_filter_ = origin_filter; } + void RemoveAllBrowsingData() override { + ++remove_calls_; + last_origin_filter_ = base::RepeatingCallback<bool(const GURL&)>(); + } + int remove_calls() const { return remove_calls_; } const base::RepeatingCallback<bool(const GURL&)>& last_origin_filter() const { return last_origin_filter_;
diff --git a/chrome/browser/browsing_data/navigation_entry_remover.cc b/chrome/browser/browsing_data/navigation_entry_remover.cc index 4313726..0896c266 100644 --- a/chrome/browser/browsing_data/navigation_entry_remover.cc +++ b/chrome/browser/browsing_data/navigation_entry_remover.cc
@@ -33,28 +33,42 @@ namespace { -bool TimeRangeMatcher(base::Time begin, - base::Time end, - const content::NavigationEntry& entry) { - return begin <= entry.GetTimestamp() && - (entry.GetTimestamp() < end || end.is_null()); +bool ShouldDeleteUrl(base::Time begin, + base::Time end, + const base::Optional<std::set<GURL>>& restrict_urls, + const GURL& url, + base::Time time_stamp) { + return begin <= time_stamp && (time_stamp < end || end.is_null()) && + (!restrict_urls.has_value() || + restrict_urls->find(url) != restrict_urls->end()); } -bool TimeRangeMatcherForSession( +bool ShouldDeleteNavigationEntry( base::Time begin, base::Time end, - const sessions::SerializedNavigationEntry& entry) { - return begin <= entry.timestamp() && - (entry.timestamp() < end || end.is_null()); + const base::Optional<std::set<GURL>>& restrict_urls, + const content::NavigationEntry& entry) { + return ShouldDeleteUrl(begin, end, restrict_urls, entry.GetURL(), + entry.GetTimestamp()); } -bool UrlMatcher(const base::flat_set<GURL>& urls, - const content::NavigationEntry& entry) { +bool ShouldDeleteSerializedNavigationEntry( + base::Time begin, + base::Time end, + const base::Optional<std::set<GURL>>& restrict_urls, + const sessions::SerializedNavigationEntry& entry) { + return ShouldDeleteUrl(begin, end, restrict_urls, entry.virtual_url(), + entry.timestamp()); +} + +bool UrlMatcherForNavigationEntry(const base::flat_set<GURL>& urls, + const content::NavigationEntry& entry) { return urls.find(entry.GetURL()) != urls.end(); } -bool UrlMatcherForSession(const base::flat_set<GURL>& urls, - const sessions::SerializedNavigationEntry& entry) { +bool UrlMatcherForSerializedNavigationEntry( + const base::flat_set<GURL>& urls, + const sessions::SerializedNavigationEntry& entry) { return urls.find(entry.virtual_url()) != urls.end(); } @@ -76,21 +90,26 @@ controller->DeleteNavigationEntries(predicate); } -void DeleteTabNavigationEntries(Profile* profile, - const history::DeletionTimeRange& time_range, - const base::flat_set<GURL>& url_set) { - auto predicate = - time_range.IsValid() - ? base::BindRepeating(&TimeRangeMatcher, time_range.begin(), - time_range.end()) - : base::BindRepeating(&UrlMatcher, base::ConstRef(url_set)); +void DeleteTabNavigationEntries( + Profile* profile, + const history::DeletionTimeRange& time_range, + const base::Optional<std::set<GURL>>& restrict_urls, + const base::flat_set<GURL>& url_set) { + auto predicate = time_range.IsValid() + ? base::BindRepeating( + &ShouldDeleteNavigationEntry, time_range.begin(), + time_range.end(), base::ConstRef(restrict_urls)) + : base::BindRepeating(&UrlMatcherForNavigationEntry, + base::ConstRef(url_set)); #if defined(OS_ANDROID) auto session_predicate = time_range.IsValid() - ? base::BindRepeating(&TimeRangeMatcherForSession, time_range.begin(), - time_range.end()) - : base::BindRepeating(&UrlMatcherForSession, base::ConstRef(url_set)); + ? base::BindRepeating(&ShouldDeleteSerializedNavigationEntry, + time_range.begin(), time_range.end(), + base::ConstRef(restrict_urls)) + : base::BindRepeating(&UrlMatcherForSerializedNavigationEntry, + base::ConstRef(url_set)); for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { TabModel* tab_model = *it; @@ -155,9 +174,11 @@ DISALLOW_COPY_AND_ASSIGN(TabRestoreDeletionHelper); }; -void DeleteTabRestoreEntries(Profile* profile, - const history::DeletionTimeRange& time_range, - const base::flat_set<GURL>& url_set) { +void DeleteTabRestoreEntries( + Profile* profile, + const history::DeletionTimeRange& time_range, + const base::Optional<std::set<GURL>>& restrict_urls, + const base::flat_set<GURL>& url_set) { sessions::TabRestoreService* tab_service = TabRestoreServiceFactory::GetForProfile(profile); if (!tab_service) @@ -165,9 +186,11 @@ auto predicate = time_range.IsValid() - ? base::BindRepeating(&TimeRangeMatcherForSession, time_range.begin(), - time_range.end()) - : base::BindRepeating(&UrlMatcherForSession, url_set); + ? base::BindRepeating(&ShouldDeleteSerializedNavigationEntry, + time_range.begin(), time_range.end(), + restrict_urls) + : base::BindRepeating(&UrlMatcherForSerializedNavigationEntry, + url_set); if (tab_service->IsLoaded()) { PerformTabRestoreDeletion(tab_service, predicate); } else { @@ -190,20 +213,22 @@ namespace browsing_data { void RemoveNavigationEntries(Profile* profile, - const history::DeletionTimeRange& time_range, - const history::URLRows& deleted_rows) { + const history::DeletionInfo& deletion_info) { DCHECK(profile->GetProfileType() == Profile::ProfileType::REGULAR_PROFILE); + DCHECK(!deletion_info.is_from_expiration()); if (!base::FeatureList::IsEnabled( browsing_data::features::kRemoveNavigationHistory)) { return; } base::flat_set<GURL> url_set; - if (!time_range.IsValid()) - url_set = CreateUrlSet(deleted_rows); + if (!deletion_info.time_range().IsValid()) + url_set = CreateUrlSet(deletion_info.deleted_rows()); - DeleteTabNavigationEntries(profile, time_range, url_set); - DeleteTabRestoreEntries(profile, time_range, url_set); + DeleteTabNavigationEntries(profile, deletion_info.time_range(), + deletion_info.restrict_urls(), url_set); + DeleteTabRestoreEntries(profile, deletion_info.time_range(), + deletion_info.restrict_urls(), url_set); DeleteLastSessionFromSessionService(profile); }
diff --git a/chrome/browser/browsing_data/navigation_entry_remover.h b/chrome/browser/browsing_data/navigation_entry_remover.h index 6702af4..8e645e42 100644 --- a/chrome/browser/browsing_data/navigation_entry_remover.h +++ b/chrome/browser/browsing_data/navigation_entry_remover.h
@@ -15,12 +15,12 @@ // Remove navigation entries from the tabs of all browsers of |profile|. // Recent tabs will be cleaned up as well and the session will be rewritten. // The last session will be removed as it can't be cleaned up easily. -// If a valid time_range is supplied, all entries within this time range will be -// removed and |deleted_rows| is ignored. -// Otherwise entries matching |deleted_rows| will be deleted. +// If a valid |deletion_info.time_range()| is supplied, +// |deletion_info.restrict_urls()| (or all URLs if empty) within this time range +// will be removed and |deletion_info.deleted_rows()| is ignored. Otherwise +// entries matching |deletion_info.deleted_rows()| will be deleted. void RemoveNavigationEntries(Profile* profile, - const history::DeletionTimeRange& time_range, - const history::URLRows& deleted_rows); + const history::DeletionInfo& deletion_info); } // namespace browsing_data
diff --git a/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc b/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc index 1abad77..a11c7d7 100644 --- a/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc +++ b/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc
@@ -23,6 +23,8 @@ #include "content/public/test/test_navigation_observer.h" #include "url/gurl.h" +using history::DeletionInfo; + class NavigationEntryRemoverTest : public InProcessBrowserTest { protected: void SetUpOnMainThread() override { @@ -85,6 +87,14 @@ return urls; } + DeletionInfo CreateDeletionInfo(base::Time from, + base::Time to, + std::set<GURL> restrict_urls = {}) { + return DeletionInfo(history::DeletionTimeRange(from, to), false, {}, {}, + restrict_urls.empty() ? base::Optional<std::set<GURL>>() + : restrict_urls); + } + // Helper to compare vectors. The macro gets confused by EXPECT_EQ(v, {a,b}). void ExpectEntries(const std::vector<GURL>& expected, const std::vector<GURL>& actual) { @@ -146,38 +156,46 @@ IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteIndividual) { AddNavigations(browser(), {url_a_, url_b_, url_c_, url_d_}); browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_b_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_b_, base::Time())}, {})); ExpectEntries({about_blank_, url_a_, url_c_, url_d_}, GetEntries()); browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_c_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_c_, base::Time())}, {})); ExpectEntries({about_blank_, url_a_, url_d_}, GetEntries()); } IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteAfterNavigation) { AddNavigations(browser(), {url_a_, url_b_}); browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_b_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_b_, base::Time())}, {})); // The commited entry can't be removed. ExpectEntries({about_blank_, url_a_, url_b_}, GetEntries()); AddNavigations(browser(), {url_c_}); browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_b_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_b_, base::Time())}, {})); ExpectEntries({about_blank_, url_a_, url_c_}, GetEntries()); } IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteAll) { AddNavigations(browser(), {url_a_, url_b_, url_c_}); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::AllTime(), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + DeletionInfo::ForAllHistory()); ExpectEntries({url_c_}, GetEntries()); } +IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteRestricted) { + AddNavigations(browser(), {url_a_, url_b_, url_c_}); + browsing_data::RemoveNavigationEntries( + browser()->profile(), + CreateDeletionInfo(base::Time(), base::Time::Now(), {url_b_})); + ExpectEntries({about_blank_, url_a_, url_c_}, GetEntries()); +} + IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteRange) { base::Time t1 = base::Time::Now(); AddNavigations(browser(), {url_a_}); @@ -188,36 +206,54 @@ ASSERT_NE(t1, t2); ASSERT_NE(t2, t3); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange(t2, t3), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + CreateDeletionInfo(t2, t3)); ExpectEntries({about_blank_, url_a_, url_c_, url_d_}, GetEntries()); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange(base::Time(), t1), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + CreateDeletionInfo(base::Time(), t1)); ExpectEntries({url_a_, url_c_, url_d_}, GetEntries()); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange(t3, base::Time()), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + CreateDeletionInfo(t3, base::Time())); ExpectEntries({url_a_, url_d_}, GetEntries()); } +IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteRangeRestricted) { + base::Time t1 = base::Time::Now(); + AddNavigations(browser(), {url_a_}); + base::Time t2 = base::Time::Now(); + AddNavigations(browser(), {url_b_}); + base::Time t3 = base::Time::Now(); + AddNavigations(browser(), {url_c_, url_a_}); + ASSERT_NE(t1, t2); + ASSERT_NE(t2, t3); + + browsing_data::RemoveNavigationEntries(browser()->profile(), + CreateDeletionInfo(t1, t3, {url_b_})); + ExpectEntries({about_blank_, url_a_, url_c_, url_a_}, GetEntries()); + browsing_data::RemoveNavigationEntries( + browser()->profile(), CreateDeletionInfo(base::Time(), t2, {url_a_})); + ExpectEntries({about_blank_, url_c_, url_a_}, GetEntries()); +} + IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, DeleteAllAfterNavigation) { AddNavigations(browser(), {url_a_, url_b_, url_c_}); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::AllTime(), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + DeletionInfo::ForAllHistory()); ExpectEntries({url_c_}, GetEntries()); AddNavigations(browser(), {url_d_}); ExpectEntries({url_c_, url_d_}, GetEntries()); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::AllTime(), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + DeletionInfo::ForAllHistory()); ExpectEntries({url_d_}, GetEntries()); } IN_PROC_BROWSER_TEST_F(NavigationEntryRemoverTest, TwoTabsDeletion) { AddNavigations(browser(), {url_a_, url_b_}); AddTab(browser(), {url_c_, url_d_}); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::AllTime(), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + DeletionInfo::ForAllHistory()); ExpectEntries({url_b_, url_d_}, GetEntries()); } @@ -226,8 +262,8 @@ AddNavigations(browser(), {url_a_, url_b_}); AddBrowser(browser(), {url_c_, url_d_}); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::AllTime(), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + DeletionInfo::ForAllHistory()); ExpectEntries({url_b_, url_d_}, GetEntries()); } @@ -236,8 +272,8 @@ AddNavigations(browser(), {url_a_, url_b_, url_c_}); GoBack(browser()->tab_strip_model()->GetActiveWebContents()); - browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::AllTime(), {}); + browsing_data::RemoveNavigationEntries(browser()->profile(), + DeletionInfo::ForAllHistory()); ExpectEntries({url_b_}, GetEntries()); } @@ -254,8 +290,8 @@ EXPECT_EQ(2U, tab_service->entries().size()); browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_c_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_c_, base::Time())}, {})); content::RunAllTasksUntilIdle(); EXPECT_EQ(1U, tab_service->entries().size()); auto* tab = static_cast<sessions::TabRestoreService::Tab*>( @@ -264,8 +300,8 @@ EXPECT_TRUE(tab_service->IsLoaded()); browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_d_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_d_, base::Time())}, {})); EXPECT_EQ(0U, tab_service->entries().size()); } @@ -288,9 +324,10 @@ // Delete b and d. The last opened tab should be removed. browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_b_, base::Time()), - history::URLResult(url_d_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_b_, base::Time()), + history::URLResult(url_d_, base::Time())}, + {})); content::RunAllTasksUntilIdle(); EXPECT_EQ(1U, tab_service->entries().size()); ASSERT_EQ(sessions::TabRestoreService::WINDOW, @@ -307,8 +344,8 @@ // Delete a. The Window should be converted to a Tab. browsing_data::RemoveNavigationEntries( - browser()->profile(), history::DeletionTimeRange::Invalid(), - {history::URLResult(url_a_, base::Time())}); + browser()->profile(), + DeletionInfo::ForUrls({history::URLResult(url_a_, base::Time())}, {})); EXPECT_EQ(1U, tab_service->entries().size()); ASSERT_EQ(sessions::TabRestoreService::TAB, tab_service->entries().front()->type);
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 19ff654..216765243 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -276,6 +276,7 @@ #include "sandbox/win/src/sandbox_policy.h" #elif defined(OS_MACOSX) #include "chrome/browser/chrome_browser_main_mac.h" +#include "services/video_capture/public/mojom/constants.mojom.h" #elif defined(OS_CHROMEOS) #include "ash/public/interfaces/constants.mojom.h" #include "chrome/browser/ash_service_registry.h" @@ -1643,7 +1644,9 @@ bool ChromeContentBrowserClient::ShouldIsolateErrorPage(bool in_main_frame) { // TODO(nasko): Consider supporting error page isolation in subframes if // Site Isolation is enabled. - return in_main_frame; + // Note: It is temporarily disabled to investigate functional regression + // and process terminations. See https://crbug.com/838161. + return false; } bool ChromeContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) { @@ -2094,6 +2097,13 @@ command_line->AppendSwitchNative(sw.first, sw.second); } #endif // BUILDFLAG(ENABLE_MUS) + +#if defined(OS_MACOSX) + // On Mac, the video-capture service requires a CFRunLoop, provided by a UI + // message loop, to run AVFoundation code. See https://crbug.com/834581 + if (identity.name() == video_capture::mojom::kServiceName) + command_line->AppendSwitch(switches::kMessageLoopTypeUi); +#endif } std::string ChromeContentBrowserClient::GetApplicationLocale() {
diff --git a/chrome/browser/chrome_security_exploit_browsertest.cc b/chrome/browser/chrome_security_exploit_browsertest.cc index f2a13b3..c6c82fa 100644 --- a/chrome/browser/chrome_security_exploit_browsertest.cc +++ b/chrome/browser/chrome_security_exploit_browsertest.cc
@@ -19,6 +19,7 @@ #include "content/public/browser/notification_types.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/site_isolation_policy.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" @@ -205,8 +206,13 @@ // If the attack is unsuccessful, the navigation ends up in an error // page. - EXPECT_EQ(GURL(content::kUnreachableWebDataURL), - rfh->GetSiteInstance()->GetSiteURL()); + if (content::SiteIsolationPolicy::IsErrorPageIsolationEnabled( + !rfh->GetParent())) { + EXPECT_EQ(GURL(content::kUnreachableWebDataURL), + rfh->GetSiteInstance()->GetSiteURL()); + } else { + EXPECT_EQ(GURL(target_origin), rfh->GetSiteInstance()->GetSiteURL()); + } std::string body; std::string script = R"( var textContent = document.body.innerText.replace(/\n+/g, '\n');
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 9ace0bc..a841b14 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1571,6 +1571,8 @@ "smb_client/discovery/mdns_host_locator.h", "smb_client/discovery/network_scanner.cc", "smb_client/discovery/network_scanner.h", + "smb_client/smb_constants.cc", + "smb_client/smb_constants.h", "smb_client/smb_file_system.cc", "smb_client/smb_file_system.h", "smb_client/smb_file_system_id.cc", @@ -1583,6 +1585,8 @@ "smb_client/smb_service_factory.h", "smb_client/smb_task_queue.cc", "smb_client/smb_task_queue.h", + "smb_client/smb_url.cc", + "smb_client/smb_url.h", "smb_client/temp_file_manager.cc", "smb_client/temp_file_manager.h", "status/network_menu.cc", @@ -2100,6 +2104,7 @@ "smb_client/smb_file_system_id_test.cc", "smb_client/smb_service_unittest.cc", "smb_client/smb_task_queue_unittest.cc", + "smb_client/smb_url_unittest.cc", "smb_client/temp_file_manager_unittest.cc", "system/automatic_reboot_manager_unittest.cc", "system/device_disabling_manager_unittest.cc",
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc index a8a8cf5..56b54c61 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -309,6 +309,7 @@ prefs->GetBoolean(ash::prefs::kAccessibilityCaretHighlightEnabled) || prefs->GetBoolean(ash::prefs::kAccessibilityCursorHighlightEnabled) || prefs->GetBoolean(ash::prefs::kAccessibilityFocusHighlightEnabled) || + prefs->GetBoolean(ash::prefs::kAccessibilityDictationEnabled) || prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled)) { return true; }
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc index 6319e8da..4dbdf08 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc
@@ -72,8 +72,12 @@ // work that needs to be done. state_ = SELECTION_REQUESTED; } else if (!is_selecting) { - state_ = INACTIVE; + // If we were using search + mouse, continue to wait for the search key + // up event by not resetting the state to INACTIVE. + if (state_ != MOUSE_RELEASED) + state_ = INACTIVE; touch_id_ = ui::PointerDetails::kUnknownPointerId; + touch_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN; } } @@ -216,9 +220,11 @@ touch_id_ == ui::PointerDetails::kUnknownPointerId) { state_ = CAPTURING_TOUCH_ONLY; touch_id_ = event->pointer_details().id; + touch_type_ = event->pointer_details().pointer_type; } - if (touch_id_ != event->pointer_details().id) { + if (touch_id_ != event->pointer_details().id || + touch_type_ != event->pointer_details().pointer_type) { // If this was a different pointer, cancel the event and return early. // We only want to track one touch pointer at a time. CancelEvent(event); @@ -231,6 +237,7 @@ state_ == CAPTURING_TOUCH_ONLY) { state_ = INACTIVE; touch_id_ = ui::PointerDetails::kUnknownPointerId; + touch_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN; } // Create a mouse event to send to the extension, describing the touch.
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h index 08ae926..89922e4 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h
@@ -112,6 +112,8 @@ ui::PointerId touch_id_ = ui::PointerDetails::kUnknownPointerId; + ui::EventPointerType touch_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN; + SelectToSpeakEventDelegateForTesting* event_delegate_for_testing_ = nullptr; DISALLOW_COPY_AND_ASSIGN(SelectToSpeakEventHandler);
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_unittest.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_unittest.cc index 48d5f50..d981eac9 100644 --- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_unittest.cc +++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler_unittest.cc
@@ -436,6 +436,30 @@ EXPECT_FALSE(event_capturer_.last_key_event()); } +TEST_F(SelectToSpeakEventHandlerTest, + CancelSearchKeyUpAfterEarlyInactiveStateChange) { + generator_->PressKey(ui::VKEY_LWIN, ui::EF_COMMAND_DOWN); + gfx::Point click_location = gfx::Point(100, 12); + generator_->set_current_location(click_location); + generator_->PressLeftButton(); + EXPECT_FALSE(event_capturer_.last_mouse_event()); + EXPECT_TRUE(mouse_event_delegate_->CapturedMouseEvent(ui::ET_MOUSE_PRESSED)); + generator_->ReleaseLeftButton(); + EXPECT_FALSE(event_capturer_.last_mouse_event()); + EXPECT_TRUE(mouse_event_delegate_->CapturedMouseEvent(ui::ET_MOUSE_RELEASED)); + + // Set the state to inactive. + // This is realistic because Select-to-Speak will set the state to inactive + // after the hittest / search for the focused node callbacks, which may occur + // before the user actually releases the search key. + select_to_speak_event_handler_->SetSelectToSpeakStateSelecting(false); + + // The search key release should still be captured. + event_capturer_.Reset(); + generator_->ReleaseKey(ui::VKEY_LWIN, ui::EF_COMMAND_DOWN); + EXPECT_FALSE(event_capturer_.last_key_event()); +} + TEST_F(SelectToSpeakEventHandlerTest, SelectionRequestedWorksWithMouse) { gfx::Point click_location = gfx::Point(100, 12); generator_->set_current_location(click_location); @@ -576,6 +600,14 @@ EXPECT_FALSE( mouse_event_delegate_->CapturedMouseEvent(ui::ET_MOUSE_RELEASED)); + // A pointer type event will not be sent either, as we are tracking touch, + // even if the ID is the same. + generator_->EnterPenPointerMode(); + generator_->PressTouchId(1); + EXPECT_FALSE(event_capturer_.last_touch_event()); + EXPECT_FALSE(mouse_event_delegate_->CapturedMouseEvent(ui::ET_MOUSE_PRESSED)); + generator_->ExitPenPointerMode(); + // The first pointer is still tracked. generator_->MoveTouchId(drag_location, 1); EXPECT_EQ(drag_location, mouse_event_delegate_->last_mouse_event_location());
diff --git a/chrome/browser/chromeos/login/lock/views_screen_locker.cc b/chrome/browser/chromeos/login/lock/views_screen_locker.cc index 7c8e3a85..d3889c6 100644 --- a/chrome/browser/chromeos/login/lock/views_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/views_screen_locker.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "ash/public/interfaces/login_user_info.mojom.h" #include "base/bind.h" #include "base/i18n/time_formatting.h" #include "base/metrics/histogram_macros.h" @@ -39,6 +40,21 @@ namespace { constexpr char kLockDisplay[] = "lock"; + +ash::mojom::FingerprintUnlockState ConvertFromFingerprintState( + ScreenLocker::FingerprintState state) { + switch (state) { + case ScreenLocker::FingerprintState::kRemoved: + case ScreenLocker::FingerprintState::kHidden: + case ScreenLocker::FingerprintState::kDefault: + return ash::mojom::FingerprintUnlockState::UNAVAILABLE; + case ScreenLocker::FingerprintState::kSignin: + return ash::mojom::FingerprintUnlockState::AUTH_SUCCESS; + case ScreenLocker::FingerprintState::kFailed: + return ash::mojom::FingerprintUnlockState::AUTH_FAILED; + } +} + } // namespace ViewsScreenLocker::ViewsScreenLocker(ScreenLocker* screen_locker) @@ -150,7 +166,8 @@ void ViewsScreenLocker::SetFingerprintState( const AccountId& account_id, ScreenLocker::FingerprintState state) { - NOTIMPLEMENTED(); + LoginScreenClient::Get()->login_screen()->SetFingerprintUnlockState( + account_id, ConvertFromFingerprintState(state)); } content::WebContents* ViewsScreenLocker::GetWebContents() {
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index c849a15..f720aa1 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc
@@ -209,6 +209,9 @@ registry->RegisterBooleanPref( ash::prefs::kAccessibilityScreenMagnifierEnabled, false, user_prefs::PrefRegistrySyncable::SYNCABLE_PREF | PrefRegistry::PUBLIC); + registry->RegisterBooleanPref( + ash::prefs::kAccessibilityDictationEnabled, false, + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF | PrefRegistry::PUBLIC); registry->RegisterDoublePref(ash::prefs::kAccessibilityScreenMagnifierScale, std::numeric_limits<double>::min(), PrefRegistry::PUBLIC);
diff --git a/chrome/browser/chromeos/smb_client/smb_constants.cc b/chrome/browser/chromeos/smb_client/smb_constants.cc new file mode 100644 index 0000000..c97396ab --- /dev/null +++ b/chrome/browser/chromeos/smb_client/smb_constants.cc
@@ -0,0 +1,14 @@ +// 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 "chrome/browser/chromeos/smb_client/smb_constants.h" + +namespace chromeos { +namespace smb_client { + +const char kSmbScheme[] = "smb"; +const char kSmbSchemePrefix[] = "smb://"; + +} // namespace smb_client +} // namespace chromeos
diff --git a/chrome/browser/chromeos/smb_client/smb_constants.h b/chrome/browser/chromeos/smb_client/smb_constants.h new file mode 100644 index 0000000..5c2725d3 --- /dev/null +++ b/chrome/browser/chromeos/smb_client/smb_constants.h
@@ -0,0 +1,17 @@ +// 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 CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_CONSTANTS_H_ +#define CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_CONSTANTS_H_ + +namespace chromeos { +namespace smb_client { + +extern const char kSmbScheme[]; +extern const char kSmbSchemePrefix[]; + +} // namespace smb_client +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_CONSTANTS_H_
diff --git a/chrome/browser/chromeos/smb_client/smb_service.cc b/chrome/browser/chromeos/smb_client/smb_service.cc index fd2273c3..8153cd3 100644 --- a/chrome/browser/chromeos/smb_client/smb_service.cc +++ b/chrome/browser/chromeos/smb_client/smb_service.cc
@@ -8,11 +8,11 @@ #include "base/files/file_path.h" #include "base/task_scheduler/post_task.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/smb_client/smb_file_system.h" #include "chrome/browser/chromeos/smb_client/smb_file_system_id.h" #include "chrome/browser/chromeos/smb_client/smb_provider.h" #include "chrome/browser/chromeos/smb_client/smb_service_factory.h" -#include "chrome/browser/chromeos/smb_client/temp_file_manager.h" #include "chrome/common/chrome_features.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/smb_provider_client.h" @@ -25,9 +25,7 @@ SmbService::SmbService(Profile* profile) : provider_id_(ProviderId::CreateFromNativeId("smb")), profile_(profile) { if (base::FeatureList::IsEnabled(features::kNativeSmb)) { - GetProviderService()->RegisterProvider(std::make_unique<SmbProvider>( - base::BindRepeating(&SmbService::Unmount, base::Unretained(this)))); - RestoreMounts(); + StartSetup(); } } @@ -150,5 +148,42 @@ temp_file_manager_ = std::make_unique<TempFileManager>(); } +void SmbService::StartSetup() { + user_manager::User* user = + chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); + + if (!user) { + // An instance of SmbService is created on the lockscreen. When this + // instance is created, no setup will run. + return; + } + + if (user->IsActiveDirectoryUser()) { + auto account_id = user->GetAccountId(); + const std::string account_id_guid = account_id.GetObjGuid(); + + GetSmbProviderClient()->SetupKerberos( + account_id_guid, + base::BindOnce(&SmbService::OnSetupKerberosResponse, AsWeakPtr())); + return; + } + + CompleteSetup(); +} + +void SmbService::OnSetupKerberosResponse(bool success) { + if (!success) { + LOG(ERROR) << "SmbService: Kerberos setup failed."; + } + + CompleteSetup(); +} + +void SmbService::CompleteSetup() { + GetProviderService()->RegisterProvider(std::make_unique<SmbProvider>( + base::BindRepeating(&SmbService::Unmount, base::Unretained(this)))); + RestoreMounts(); +} + } // namespace smb_client } // namespace chromeos
diff --git a/chrome/browser/chromeos/smb_client/smb_service.h b/chrome/browser/chromeos/smb_client/smb_service.h index aa40a44..c995d931 100644 --- a/chrome/browser/chromeos/smb_client/smb_service.h +++ b/chrome/browser/chromeos/smb_client/smb_service.h
@@ -98,6 +98,15 @@ void OnRemountResponse(const std::string& file_system_id, smbprovider::ErrorType error); + // Sets up SmbService, including setting up Keberos if the user is ChromAD. + void StartSetup(); + + // Completes SmbService setup. Called by StartSetup(). + void CompleteSetup(); + + // Handles the response from attempting to setup Kerberos. + void OnSetupKerberosResponse(bool success); + const ProviderId provider_id_; Profile* profile_; std::unique_ptr<TempFileManager> temp_file_manager_;
diff --git a/chrome/browser/chromeos/smb_client/smb_service_factory.cc b/chrome/browser/chromeos/smb_client/smb_service_factory.cc index 93a492b..d0c0f4d 100644 --- a/chrome/browser/chromeos/smb_client/smb_service_factory.cc +++ b/chrome/browser/chromeos/smb_client/smb_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/smb_client/smb_service_factory.h" +#include "chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.h" #include "chrome/browser/chromeos/file_system_provider/service_factory.h" #include "chrome/browser/chromeos/smb_client/smb_service.h" #include "chrome/browser/profiles/incognito_helpers.h" @@ -31,6 +32,7 @@ "SmbService", BrowserContextDependencyManager::GetInstance()) { DependsOn(file_system_provider::ServiceFactory::GetInstance()); + DependsOn(AuthPolicyCredentialsManagerFactory::GetInstance()); } SmbServiceFactory::~SmbServiceFactory() {}
diff --git a/chrome/browser/chromeos/smb_client/smb_url.cc b/chrome/browser/chromeos/smb_client/smb_url.cc new file mode 100644 index 0000000..802bb855 --- /dev/null +++ b/chrome/browser/chromeos/smb_client/smb_url.cc
@@ -0,0 +1,77 @@ +// 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 "chrome/browser/chromeos/smb_client/smb_url.h" + +#include "base/strings/string_util.h" +#include "chrome/browser/chromeos/smb_client/smb_constants.h" + +namespace chromeos { +namespace smb_client { + +namespace { + +const char kDoubleBackslash[] = "\\\\"; + +// Returns true if |url| starts with "smb://" or "\\". +bool ShouldProcessUrl(const std::string& url) { + return base::StartsWith(url, kSmbSchemePrefix, + base::CompareCase::INSENSITIVE_ASCII) || + base::StartsWith(url, kDoubleBackslash, + base::CompareCase::INSENSITIVE_ASCII); +} + +// Adds "smb://" to the beginning of |url| if not present. +std::string AddSmbSchemeIfMissing(const std::string& url) { + DCHECK(ShouldProcessUrl(url)); + + if (base::StartsWith(url, kSmbSchemePrefix, + base::CompareCase::INSENSITIVE_ASCII)) { + return url; + } + + return std::string(kSmbSchemePrefix) + url; +} + +} // namespace + +SmbUrl::SmbUrl() = default; +SmbUrl::~SmbUrl() = default; + +bool SmbUrl::InitializeWithUrl(const std::string& url) { + // Only process |url| if it starts with "smb://" or "\\". + if (ShouldProcessUrl(url)) { + // Add "smb://" if |url| starts with "\\". + url_ = GURL(AddSmbSchemeIfMissing(url)); + } + + return IsValid(); +} + +std::string SmbUrl::GetHost() const { + DCHECK(IsValid()); + + return url_.host(); +} + +const std::string& SmbUrl::ToString() const { + DCHECK(IsValid()); + + return url_.spec(); +} + +std::string SmbUrl::ReplaceHost(const std::string& new_host) const { + DCHECK(IsValid()); + + GURL::Replacements replace_host; + replace_host.SetHostStr(new_host); + return url_.ReplaceComponents(replace_host).spec(); +} + +bool SmbUrl::IsValid() const { + return url_.is_valid(); +} + +} // namespace smb_client +} // namespace chromeos
diff --git a/chrome/browser/chromeos/smb_client/smb_url.h b/chrome/browser/chromeos/smb_client/smb_url.h new file mode 100644 index 0000000..a8a96a33 --- /dev/null +++ b/chrome/browser/chromeos/smb_client/smb_url.h
@@ -0,0 +1,53 @@ +// 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 CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_URL_H_ +#define CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_URL_H_ + +#include <string> + +#include "base/macros.h" +#include "url/gurl.h" + +namespace chromeos { +namespace smb_client { + +// Represents an SMB URL. +// This class stores a URL using GURL to a share and can contain either an +// resolved or unresolved host. The host can be replaced when the address is +// resolved by using ReplaceHost(). The passed URL must start with either +// "smb://" or "\\" when initializing with InitializeWithUrl. +class SmbUrl { + public: + // Initializes an empty and invalid SmbUrl. + SmbUrl(); + ~SmbUrl(); + + // Initializes SmbUrl and saves |url|. |url| must start with + // either "smb://" or "\\". Returns true if |url| is valid. + bool InitializeWithUrl(const std::string& url) WARN_UNUSED_RESULT; + + // Returns the host of the URL which can be resolved or unresolved. + std::string GetHost() const; + + // Returns the full URL. + const std::string& ToString() const; + + // Replaces the host to |new_host| and returns the full URL. Does not + // change the original URL. + std::string ReplaceHost(const std::string& new_host) const; + + // Returns true if the passed URL is valid and was properly parsed. + bool IsValid() const; + + private: + GURL url_; + + DISALLOW_COPY_AND_ASSIGN(SmbUrl); +}; + +} // namespace smb_client +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_URL_H_
diff --git a/chrome/browser/chromeos/smb_client/smb_url_unittest.cc b/chrome/browser/chromeos/smb_client/smb_url_unittest.cc new file mode 100644 index 0000000..e9655d41 --- /dev/null +++ b/chrome/browser/chromeos/smb_client/smb_url_unittest.cc
@@ -0,0 +1,218 @@ +// 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 "chrome/browser/chromeos/smb_client/smb_url.h" + +#include <string> + +#include "chrome/browser/chromeos/smb_client/smb_constants.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" +#include "url/url_util.h" + +namespace chromeos { +namespace smb_client { + +class SmbUrlTest : public testing::Test { + public: + SmbUrlTest() { + // Add the scheme to the "standard" list for url_util. This enables GURL to + // properly process the domain from the url. + url::AddStandardScheme(kSmbScheme, url::SCHEME_WITH_HOST); + } + + ~SmbUrlTest() override = default; + + private: + DISALLOW_COPY_AND_ASSIGN(SmbUrlTest); +}; + +TEST_F(SmbUrlTest, NotValidWhenInitialized) { + SmbUrl smb_url; + + EXPECT_FALSE(smb_url.IsValid()); +} + +TEST_F(SmbUrlTest, EmptyUrlIsInvalid) { + const std::string empty_url = ""; + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl(empty_url)); + + EXPECT_FALSE(smb_url.IsValid()); +} + +TEST_F(SmbUrlTest, InvalidUrls) { + { + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl("smb")); + } + { + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl("smb://")); + } + { + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl("\\")); + } + { + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl("\\\\")); + } + { + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl("smb:///")); + } +} + +TEST_F(SmbUrlTest, ValidUrls) { + { + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl("smb://x")); + + const std::string expected_url = "smb://x/"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "x"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl("smb:///x")); + + const std::string expected_url = "smb://x/"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "x"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl("smb://server/share/long/folder")); + + const std::string expected_url = "smb://server/share/long/folder"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE( + smb_url.InitializeWithUrl("smb://server/share/folder.with.dots")); + + const std::string expected_url = "smb://server/share/folder.with.dots"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE( + smb_url.InitializeWithUrl("smb://server\\share/mixed\\slashes")); + + const std::string expected_url = "smb://server/share/mixed/slashes"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl("\\\\server/share")); + + const std::string expected_url = "smb://server/share"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl("\\\\server\\share/mixed//slashes")); + + const std::string expected_url = "smb://server/share/mixed//slashes"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } + { + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl("smb://192.168.0.1/share")); + + const std::string expected_url = "smb://192.168.0.1/share"; + EXPECT_EQ(expected_url, smb_url.ToString()); + + const std::string expected_host = "192.168.0.1"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + } +} + +TEST_F(SmbUrlTest, NotValidIfStartsWithoutSchemeOrDoubleBackslash) { + const std::string url = "192.168.0.1/share"; + SmbUrl smb_url; + EXPECT_FALSE(smb_url.InitializeWithUrl(url)); + + EXPECT_FALSE(smb_url.IsValid()); +} + +TEST_F(SmbUrlTest, StartsWithBackslashRemovesBackslashAndAddsScheme) { + const std::string url = "\\\\192.168.0.1\\share"; + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl(url)); + + const std::string expected_url = "smb://192.168.0.1/share"; + EXPECT_TRUE(smb_url.IsValid()); + EXPECT_EQ(expected_url, smb_url.ToString()); +} + +TEST_F(SmbUrlTest, GetHostWithIp) { + const std::string url = "smb://192.168.0.1/share"; + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl(url)); + + const std::string expected_host = "192.168.0.1"; + EXPECT_EQ(expected_host, smb_url.GetHost()); +} + +TEST_F(SmbUrlTest, GetHostWithDomain) { + const std::string url = "smb://server/share"; + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl(url)); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); +} + +TEST_F(SmbUrlTest, HostBecomesLowerCase) { + const std::string url = "smb://SERVER/share"; + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl(url)); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + + const std::string expected_url = "smb://server/share"; + EXPECT_EQ(expected_url, smb_url.ToString()); +} + +TEST_F(SmbUrlTest, ReplacesHost) { + const std::string url = "smb://server/share"; + const std::string new_host = "192.168.0.1"; + SmbUrl smb_url; + EXPECT_TRUE(smb_url.InitializeWithUrl(url)); + + const std::string expected_host = "server"; + EXPECT_EQ(expected_host, smb_url.GetHost()); + + const std::string expected_url = "smb://192.168.0.1/share"; + EXPECT_EQ(expected_url, smb_url.ReplaceHost(new_host)); + + // GetHost returns the original host. + EXPECT_EQ(expected_host, smb_url.GetHost()); +} + +} // namespace smb_client +} // namespace chromeos
diff --git a/chrome/browser/devtools/device/port_forwarding_controller.cc b/chrome/browser/devtools/device/port_forwarding_controller.cc index 3f98b31..601373da4 100644 --- a/chrome/browser/devtools/device/port_forwarding_controller.cc +++ b/chrome/browser/devtools/device/port_forwarding_controller.cc
@@ -50,9 +50,9 @@ const char kMethodParam[] = "method"; const char kParamsParam[] = "params"; -const char kBindMethod[] = "bind"; -const char kUnbindMethod[] = "unbind"; -const char kAcceptedEvent[] = "accepted"; +const char kBindMethod[] = "Tethering.bind"; +const char kUnbindMethod[] = "Tethering.unbind"; +const char kAcceptedEvent[] = "Tethering.accepted"; const char kPortParam[] = "port"; const char kConnectionIdParam[] = "connectionId";
diff --git a/chrome/browser/devtools/global_confirm_info_bar.cc b/chrome/browser/devtools/global_confirm_info_bar.cc index ef435c0..d283a99 100644 --- a/chrome/browser/devtools/global_confirm_info_bar.cc +++ b/chrome/browser/devtools/global_confirm_info_bar.cc
@@ -28,6 +28,7 @@ // ConfirmInfoBarDelegate overrides infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; base::string16 GetMessageText() const override; + gfx::ElideBehavior GetMessageElideBehavior() const override; int GetButtons() const override; base::string16 GetButtonLabel(InfoBarButton button) const override; bool Accept() override; @@ -63,6 +64,13 @@ : base::string16(); } +gfx::ElideBehavior +GlobalConfirmInfoBar::DelegateProxy::GetMessageElideBehavior() const { + return global_info_bar_ + ? global_info_bar_->delegate_->GetMessageElideBehavior() + : ConfirmInfoBarDelegate::GetMessageElideBehavior(); +} + int GlobalConfirmInfoBar::DelegateProxy::GetButtons() const { return global_info_bar_ ? global_info_bar_->delegate_->GetButtons() : 0;
diff --git a/chrome/browser/engagement/site_engagement_service.cc b/chrome/browser/engagement/site_engagement_service.cc index e3808ce..888d82aa 100644 --- a/chrome/browser/engagement/site_engagement_service.cc +++ b/chrome/browser/engagement/site_engagement_service.cc
@@ -579,14 +579,8 @@ for (const history::URLRow& row : deletion_info.deleted_rows()) origins.insert(row.url().GetOrigin()); - history::HistoryService* hs = HistoryServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); - hs->GetCountsAndLastVisitForOrigins( - std::set<GURL>(origins.begin(), origins.end()), - base::Bind( - &SiteEngagementService::GetCountsAndLastVisitForOriginsComplete, - weak_factory_.GetWeakPtr(), hs, origins, - deletion_info.is_from_expiration())); + UpdateEngagementScores(origins, deletion_info.is_from_expiration(), + deletion_info.deleted_urls_origin_map()); } SiteEngagementScore SiteEngagementService::CreateEngagementScore( @@ -627,8 +621,7 @@ return total_origins; } -void SiteEngagementService::GetCountsAndLastVisitForOriginsComplete( - history::HistoryService* history_service, +void SiteEngagementService::UpdateEngagementScores( const std::multiset<GURL>& deleted_origins, bool expired, const history::OriginCountAndLastVisitMap& remaining_origins) {
diff --git a/chrome/browser/engagement/site_engagement_service.h b/chrome/browser/engagement/site_engagement_service.h index b4f1aa2b..6c1ad8d7 100644 --- a/chrome/browser/engagement/site_engagement_service.h +++ b/chrome/browser/engagement/site_engagement_service.h
@@ -305,10 +305,8 @@ int OriginsWithMaxEngagement( const std::vector<mojom::SiteEngagementDetails>& details) const; - // Callback for the history service when it is asked for a map of origins to - // how many URLs corresponding to that origin remain in history. - void GetCountsAndLastVisitForOriginsComplete( - history::HistoryService* history_service, + // Update site engagement scores after a history deletion. + void UpdateEngagementScores( const std::multiset<GURL>& deleted_url_origins, bool expired, const history::OriginCountAndLastVisitMap& remaining_origin_counts);
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 9c15fa49..a0cfb89 100644 --- a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc +++ b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc
@@ -17,6 +17,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" +#include "build/build_config.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" #include "content/public/common/content_switches.h" @@ -337,9 +338,10 @@ // use the API to send it out. At the same time, this test launches an // in-process Cast receiver, listening on a localhost UDP socket, to receive the // content and check whether it matches expectations. -#if defined(NDEBUG) +#if defined(NDEBUG) && !defined(OS_MACOSX) #define MAYBE_EndToEnd EndToEnd #else +// Flaky on Mac: https://crbug.com/841387 #define MAYBE_EndToEnd DISABLED_EndToEnd // crbug.com/396413 #endif IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, MAYBE_EndToEnd) {
diff --git a/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar.cc b/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar.cc index 41b8582..fdc19ab8 100644 --- a/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar.cc +++ b/chrome/browser/extensions/api/debugger/extension_dev_tools_infobar.cc
@@ -30,6 +30,8 @@ bool ShouldExpire(const NavigationDetails& details) const override; void InfoBarDismissed() override; base::string16 GetMessageText() const override; + gfx::ElideBehavior GetMessageElideBehavior() const override; + int GetButtons() const override; bool Cancel() override; @@ -69,6 +71,14 @@ return l10n_util::GetStringFUTF16(IDS_DEV_TOOLS_INFOBAR_LABEL, client_name_); } +gfx::ElideBehavior ExtensionDevToolsInfoBarDelegate::GetMessageElideBehavior() + const { + // The important part of the message text above is at the end: + // "... is debugging the browser". If the extension name is very long, + // we'd rather truncate it instead. See https://crbug.com/823194. + return gfx::ELIDE_HEAD; +} + int ExtensionDevToolsInfoBarDelegate::GetButtons() const { return BUTTON_CANCEL; }
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index d147c47..dcd3433 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -284,6 +284,8 @@ settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_whitelist)[ash::prefs::kShouldAlwaysShowAccessibilityMenu] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_whitelist)[ash::prefs::kAccessibilityDictationEnabled] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_whitelist)[ash::prefs::kAccessibilityFocusHighlightEnabled] = settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_whitelist)[ash::prefs::kAccessibilityHighContrastEnabled] =
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 85e045c..471f3850 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -939,14 +939,25 @@ ASSERT_TRUE(extension) << message_; EXPECT_TRUE(listener.WaitUntilSatisfied()); - EXPECT_EQ(0, GetWebRequestCountFromBackgroundPage(extension, profile())); + auto get_clients_google_request_count = [this, extension]() { + return GetCountFromBackgroundPage(extension, profile(), + "window.clientsGoogleWebRequestCount"); + }; + auto get_yahoo_request_count = [this, extension]() { + return GetCountFromBackgroundPage(extension, profile(), + "window.yahooWebRequestCount"); + }; + + EXPECT_EQ(0, get_clients_google_request_count()); + EXPECT_EQ(0, get_yahoo_request_count()); GURL main_frame_url = embedded_test_server()->GetURL("www.example.com", "/simple.html"); NavigateParams params(browser(), main_frame_url, ui::PAGE_TRANSITION_TYPED); ui_test_utils::NavigateToURL(¶ms); - EXPECT_EQ(0, GetWebRequestCountFromBackgroundPage(extension, profile())); + EXPECT_EQ(0, get_clients_google_request_count()); + EXPECT_EQ(0, get_yahoo_request_count()); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -966,33 +977,42 @@ // Requests always fail due to cross origin nature. EXPECT_FALSE(success); - EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile())); + EXPECT_EQ(1, get_clients_google_request_count()); + EXPECT_EQ(0, get_yahoo_request_count()); - // Now perform a request to client1.google.com from the browser process. This - // should *not* be visible to the WebRequest API. + auto make_browser_request = [this](const GURL& url) { + auto request = std::make_unique<network::ResourceRequest>(); + request->url = url; - auto request = std::make_unique<network::ResourceRequest>(); - request->url = - embedded_test_server()->GetURL("clients1.google.com", "/simple.html"); + auto* url_loader_factory = + content::BrowserContext::GetDefaultStoragePartition(profile()) + ->GetURLLoaderFactoryForBrowserProcess() + .get(); + content::SimpleURLLoaderTestHelper loader_helper; + auto loader = network::SimpleURLLoader::Create( + std::move(request), TRAFFIC_ANNOTATION_FOR_TESTS); + loader->DownloadToStringOfUnboundedSizeUntilCrashAndDie( + url_loader_factory, loader_helper.GetCallback()); - auto* url_loader_factory = - content::BrowserContext::GetDefaultStoragePartition(profile()) - ->GetURLLoaderFactoryForBrowserProcess() - .get(); - content::SimpleURLLoaderTestHelper loader_helper; - auto loader = network::SimpleURLLoader::Create(std::move(request), - TRAFFIC_ANNOTATION_FOR_TESTS); - loader->DownloadToStringOfUnboundedSizeUntilCrashAndDie( - url_loader_factory, loader_helper.GetCallback()); + // Wait for the response to complete. + loader_helper.WaitForCallback(); + EXPECT_TRUE(loader_helper.response_body()); + EXPECT_EQ(200, loader->ResponseInfo()->headers->response_code()); + }; - // Wait for the response to complete. - loader_helper.WaitForCallback(); - EXPECT_TRUE(loader_helper.response_body()); - EXPECT_EQ(200, loader->ResponseInfo()->headers->response_code()); + // Now perform a request to "client1.google.com" from the browser process. + // This should *not* be visible to the WebRequest API. We should still have + // only seen the single render-initiated request from the first half of the + // test. + make_browser_request( + embedded_test_server()->GetURL("clients1.google.com", "/simple.html")); + EXPECT_EQ(1, get_clients_google_request_count()); - // We should still have only seen the single render-initiated request from the - // first half of the test. - EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile())); + // Sanity check that other requests made by the browser can still be + // intercepted by the extension. + make_browser_request( + embedded_test_server()->GetURL("yahoo.com", "/simple.html")); + EXPECT_EQ(1, get_yahoo_request_count()); } // Verify that requests for PAC scripts are protected properly.
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index 8c89851..9ab3b5a 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -625,9 +625,10 @@ std::string ExtensionBrowserTest::ExecuteScriptInBackgroundPage( const std::string& extension_id, - const std::string& script) { - return browsertest_util::ExecuteScriptInBackgroundPage(profile(), - extension_id, script); + const std::string& script, + browsertest_util::ScriptUserActivation script_user_activation) { + return browsertest_util::ExecuteScriptInBackgroundPage( + profile(), extension_id, script, script_user_activation); } bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait(
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 26791a4..e784e9d 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h
@@ -19,6 +19,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/web_contents.h" +#include "extensions/browser/browsertest_util.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_protocols.h" #include "extensions/browser/extension_system.h" @@ -309,8 +310,12 @@ // Returns // browsertest_util::ExecuteScriptInBackgroundPage(profile(), // extension_id, script). - std::string ExecuteScriptInBackgroundPage(const std::string& extension_id, - const std::string& script); + std::string ExecuteScriptInBackgroundPage( + const std::string& extension_id, + const std::string& script, + extensions::browsertest_util::ScriptUserActivation + script_user_activation = + extensions::browsertest_util::ScriptUserActivation::kActivate); // Returns // browsertest_util::ExecuteScriptInBackgroundPageNoWait(
diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc index 9cf823e..bf84a25 100644 --- a/chrome/browser/extensions/extension_messages_apitest.cc +++ b/chrome/browser/extensions/extension_messages_apitest.cc
@@ -25,6 +25,7 @@ #include "build/build_config.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/messaging/incognito_connectability.h" +#include "chrome/browser/extensions/browsertest_util.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/infobars/infobar_service.h" @@ -1241,14 +1242,21 @@ const Extension* sender = LoadExtension(sender_dir.UnpackedPath()); ASSERT_TRUE(sender); - EXPECT_EQ("false", - ExecuteScriptInBackgroundPage(sender->id(), - base::StringPrintf( - "chrome.test.runWithoutUserGesture(function() {\n" - " chrome.runtime.sendMessage('%s', {}, function(response) {\n" - " window.domAutomationController.send('' + response.result);\n" - " });\n" - "});", receiver->id().c_str()))); + EXPECT_EQ( + "false", + ExecuteScriptInBackgroundPage( + sender->id(), + base::StringPrintf( + "if (chrome.test.isProcessingUserGesture()) {\n" + " domAutomationController.send(" + " 'Error: unexpected user gesture');\n" + "} else {\n" + " chrome.runtime.sendMessage('%s', {}, function(response) {\n" + " domAutomationController.send('' + response.result);\n" + " });\n" + "}", + receiver->id().c_str()), + extensions::browsertest_util::ScriptUserActivation::kDontActivate)); EXPECT_EQ("true", ExecuteScriptInBackgroundPage(sender->id(),
diff --git a/chrome/browser/media/media_engagement_service.cc b/chrome/browser/media/media_engagement_service.cc index c41b9f9c..4b7c7c75 100644 --- a/chrome/browser/media/media_engagement_service.cc +++ b/chrome/browser/media/media_engagement_service.cc
@@ -218,10 +218,7 @@ } // Check if any origins no longer have any visits. - history_service->GetCountsAndLastVisitForOrigins( - origins, - base::BindRepeating(&MediaEngagementService::RemoveOriginsWithNoVisits, - base::Unretained(this), origins)); + RemoveOriginsWithNoVisits(origins, deletion_info.deleted_urls_origin_map()); return; }
diff --git a/chrome/browser/media/media_engagement_service_unittest.cc b/chrome/browser/media/media_engagement_service_unittest.cc index 3b2e1d37..0bb43766 100644 --- a/chrome/browser/media/media_engagement_service_unittest.cc +++ b/chrome/browser/media/media_engagement_service_unittest.cc
@@ -714,10 +714,11 @@ history::HistoryService* history = HistoryServiceFactory::GetForProfile( profile(), ServiceAccessType::IMPLICIT_ACCESS); + service()->OnURLsDeleted( - history, - history::DeletionInfo(history::DeletionTimeRange::Invalid(), true, - history::URLRows(), std::set<GURL>())); + history, history::DeletionInfo(history::DeletionTimeRange::Invalid(), + true, history::URLRows(), + std::set<GURL>(), base::nullopt)); // Same as above, nothing should have changed. ExpectScores(origin1, 7.0 / 11.0,
diff --git a/chrome/browser/resource_coordinator/lifecycle_state.h b/chrome/browser/resource_coordinator/lifecycle_state.h index 59dfdae..f2f2a85 100644 --- a/chrome/browser/resource_coordinator/lifecycle_state.h +++ b/chrome/browser/resource_coordinator/lifecycle_state.h
@@ -10,8 +10,12 @@ enum class LifecycleState { // The LifecycleUnit is alive and active. ACTIVE, + // The LifecycleUnit is pending a freeze. + PENDING_FREEZE, // The LifecycleUnit is frozen. FROZEN, + // The LifecycleUnit is pending a discard. + PENDING_DISCARD, // The LifecycleUnit is discarded, and is consuming no system resources. DISCARDED, };
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc b/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc index 446ee89..4069e3d 100644 --- a/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc +++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc
@@ -24,22 +24,6 @@ namespace resource_coordinator { -namespace { - -// Translates a mojom::LifecycleState to resource_coordinator::LifecycleState. -LifecycleState GetLifecycleStateFromMojoState(mojom::LifecycleState state) { - switch (state) { - case mojom::LifecycleState::kDiscarded: - return LifecycleState::DISCARDED; - case mojom::LifecycleState::kFrozen: - return LifecycleState::FROZEN; - case mojom::LifecycleState::kRunning: - return LifecycleState::ACTIVE; - } -} - -} // namespace - TabLifecycleUnitSource::TabLifecycleUnit::TabLifecycleUnit( base::ObserverList<TabLifecycleObserver>* observers, content::WebContents* web_contents, @@ -73,14 +57,26 @@ return; last_focused_time_ = focused ? base::TimeTicks::Max() : NowTicks(); - if (focused && GetState() == LifecycleState::DISCARDED) { + if (focused && (GetState() == LifecycleState::DISCARDED || + GetState() == LifecycleState::PENDING_DISCARD)) { + bool was_discarded = GetState() == LifecycleState::DISCARDED; SetState(LifecycleState::ACTIVE); - // See comment in Discard() for an explanation of why "needs reload" is - // false when a tab is discarded. - // TODO(fdoray): Remove NavigationControllerImpl::needs_reload_ once session - // restore is handled by LifecycleManager. - GetWebContents()->GetController().SetNeedsReload(); - GetWebContents()->GetController().LoadIfNecessary(); + + // If the tab was fully discarded, the tab needs to be reloaded. + if (was_discarded) { + // See comment in Discard() for an explanation of why "needs reload" is + // false when a tab is discarded. + // TODO(fdoray): Remove NavigationControllerImpl::needs_reload_ once + // session restore is handled by LifecycleManager. + GetWebContents()->GetController().SetNeedsReload(); + GetWebContents()->GetController().LoadIfNecessary(); + } + + // Stop |freeze_timeout_timer_| to avoid completing the discard, as the tab + // was focused. + if (freeze_timeout_timer_) + freeze_timeout_timer_->Stop(); + OnDiscardedStateChange(); } } @@ -96,7 +92,48 @@ void TabLifecycleUnitSource::TabLifecycleUnit::UpdateLifecycleState( mojom::LifecycleState state) { DCHECK_NE(mojom::LifecycleState::kDiscarded, state); - SetState(GetLifecycleStateFromMojoState(state)); + if (state == mojom::LifecycleState::kFrozen) { + if (GetState() == LifecycleState::PENDING_DISCARD) { + freeze_timeout_timer_->Stop(); + FinishDiscard(discard_reason_); + } else { + SetState(LifecycleState::FROZEN); + } + } else if (state == mojom::LifecycleState::kRunning) { + SetState(LifecycleState::ACTIVE); + } else { + NOTREACHED(); + } +} + +void TabLifecycleUnitSource::TabLifecycleUnit::RequestFreezeForDiscard( + DiscardReason reason) { + // Ensure this isn't happening on an urgent discard. + DCHECK_NE(reason, DiscardReason::kUrgent); + + // Ensure the tab is not already pending a discard. + DCHECK_NE(GetState(), LifecycleState::PENDING_DISCARD); + + SetState(LifecycleState::PENDING_DISCARD); + + // External observers should now view this tab as discarded, hiding the + // pending discard implementation detail. + // TODO(fdoray) This should be done as part of SetState() instead of manually + // after each SetState() that might change IsDiscarded(). We would have less + // chances of breaking things in a future change. + OnDiscardedStateChange(); + + if (!freeze_timeout_timer_) { + freeze_timeout_timer_ = + std::make_unique<base::OneShotTimer>(GetTickClock()); + } + + freeze_timeout_timer_->Start( + FROM_HERE, kProactiveDiscardFreezeTimeout, + base::BindRepeating(&TabLifecycleUnit::FinishDiscard, + base::Unretained(this), reason)); + + Freeze(); } TabLifecycleUnitExternal* @@ -134,6 +171,12 @@ if (GetState() == LifecycleState::DISCARDED) return false; + // If currently in PENDING_DISCARD, the tab IsDiscarded() to external + // observers. To maintain this, don't set it to PENDING_FREEZE, but keep the + // tab in the PENDING_DISCARD state. + if (GetState() != LifecycleState::PENDING_DISCARD) + SetState(LifecycleState::PENDING_FREEZE); + GetWebContents()->FreezePage(); return true; } @@ -225,9 +268,44 @@ bool TabLifecycleUnitSource::TabLifecycleUnit::Discard( DiscardReason discard_reason) { - if (!tab_strip_model_ || GetState() == LifecycleState::DISCARDED) + // Can't discard a tab when it isn't in a tabstrip. + if (!tab_strip_model_) return false; + // Can't discard a tab if it is already discarded. + if (GetState() == LifecycleState::DISCARDED) + return false; + + // If a non-urgent discard is requested when the state is PENDING_DISCARD, + // returns false to indicate that it is incorrect to request a non-urgent + // discard again. + if (GetState() == LifecycleState::PENDING_DISCARD && + discard_reason != DiscardReason::kUrgent) { + return false; + } + + discard_reason_ = discard_reason; + + // If the tab is not going through an urgent discard, it should be frozen + // first. Freeze the tab and set a timer to callback to FinishDiscard() incase + // the freeze callback takes too long. + if (discard_reason != DiscardReason::kUrgent && + GetState() != LifecycleState::FROZEN) { + RequestFreezeForDiscard(discard_reason); + + // Returning true because even though the discard did not happen yet, the + // tab is in PENDING_DISCARD state and will be discarded either when the + // freeze callback occurs, or the kProactiveDiscardFreezeTimeout timeout is + // reached. + return true; + } + + FinishDiscard(discard_reason); + return true; +} + +void TabLifecycleUnitSource::TabLifecycleUnit::FinishDiscard( + DiscardReason discard_reason) { UMA_HISTOGRAM_BOOLEAN( "TabManager.Discarding.DiscardedTabHasBeforeUnloadHandler", GetWebContents()->NeedToFireBeforeUnload()); @@ -295,11 +373,11 @@ // RenderFrameProxyHosts. old_contents_deleter.reset(); + LifecycleState previous_state = GetState(); SetState(LifecycleState::DISCARDED); + if (previous_state != LifecycleState::PENDING_DISCARD) + OnDiscardedStateChange(); ++discard_count_; - OnDiscardedStateChange(); - - return true; } content::WebContents* TabLifecycleUnitSource::TabLifecycleUnit::GetWebContents() @@ -351,11 +429,21 @@ } bool TabLifecycleUnitSource::TabLifecycleUnit::IsDiscarded() const { - return GetState() == LifecycleState::DISCARDED; + // External code does not need to know about the intermediary PENDING_DISCARD + // state. To external callers, the tab is discarded while in the + // PENDING_DISCARD state. + LifecycleState current_state = GetState(); + return current_state == LifecycleState::PENDING_DISCARD || + current_state == LifecycleState::DISCARDED; } bool TabLifecycleUnitSource::TabLifecycleUnit::IsFrozen() const { - return GetState() == LifecycleState::FROZEN; + // External code does not need to know about the intermediary PENDING_FREEZE + // state. To external callers, the tab is frozen while in the PENDING_FREEZE + // state. + LifecycleState current_state = GetState(); + return current_state == LifecycleState::PENDING_FREEZE || + current_state == LifecycleState::FROZEN; } int TabLifecycleUnitSource::TabLifecycleUnit::GetDiscardCount() const {
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit.h b/chrome/browser/resource_coordinator/tab_lifecycle_unit.h index d7bacf7..13dac0e 100644 --- a/chrome/browser/resource_coordinator/tab_lifecycle_unit.h +++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit.h
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "base/observer_list.h" #include "base/time/time.h" +#include "base/timer/timer.h" #include "chrome/browser/resource_coordinator/lifecycle_unit_base.h" #include "chrome/browser/resource_coordinator/tab_lifecycle_unit_external.h" #include "chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h" @@ -30,6 +31,11 @@ static constexpr base::TimeDelta kTabAudioProtectionTime = base::TimeDelta::FromMinutes(1); +// Timeout after which a tab is proactively discarded if the freeze callback +// hasn't been received. +static constexpr base::TimeDelta kProactiveDiscardFreezeTimeout = + base::TimeDelta::FromMilliseconds(500); + // Represents a tab. class TabLifecycleUnitSource::TabLifecycleUnit : public LifecycleUnitBase, @@ -66,6 +72,10 @@ // "recently audible" state of the tab changes. void SetRecentlyAudible(bool recently_audible); + // Updates the tab's lifecycle state when changed outside the tab lifecycle + // unit. + void UpdateLifecycleState(mojom::LifecycleState state); + // LifecycleUnit: TabLifecycleUnitExternal* AsTabLifecycleUnitExternal() override; base::string16 GetTitle() const override; @@ -90,17 +100,29 @@ int GetDiscardCount() const override; protected: + friend class TabManagerTest; + // TabLifecycleUnitSource needs to update the state when a external lifecycle // state change is observed. friend class TabLifecycleUnitSource; - // Updates the tab's lifecycle state when changed outside the tab lifecycle - // unit. - void UpdateLifecycleState(mojom::LifecycleState state); private: - // Invoked when the state goes from DISCARDED to non-DISCARDED and vice-versa. + // For non-urgent discarding, sends a request for freezing to occur prior to + // discarding the tab. + void RequestFreezeForDiscard(DiscardReason reason); + + // Invoked when the state goes from DISCARDED or PENDING_DISCARD to any + // non-DISCARDED state and vice-versa. void OnDiscardedStateChange(); + // Finishes a tab discard. For an urgent discard, this is invoked by + // Discard(). For a proactive or external discard, where the tab is frozen + // prior to being discarded, this is called by UpdateLifecycleState() once the + // callback has been received, or by |freeze_timeout_timer_| if the + // kProactiveDiscardFreezeTimeout timeout has passed without receiving the + // callback. + void FinishDiscard(DiscardReason discard_reason); + // Returns the RenderProcessHost associated with this tab. content::RenderProcessHost* GetRenderProcessHost() const; @@ -130,6 +152,13 @@ // When this is false, CanDiscard() always returns false. bool auto_discardable_ = true; + // Maintains the most recent DiscardReason that was pased into Discard(). + DiscardReason discard_reason_; + + // Timer that ensures that this tab does not wait forever for the callback + // when it is being frozen. + std::unique_ptr<base::OneShotTimer> freeze_timeout_timer_; + // TimeTicks::Max() if the tab is currently "recently audible", null // TimeTicks() if the tab was never "recently audible", last time at which the // tab was "recently audible" otherwise.
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h index 09c2305..50fcfdb 100644 --- a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h +++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h
@@ -54,7 +54,20 @@ private: friend class TabLifecycleUnitTest; - + friend class TabManagerTest; + FRIEND_TEST_ALL_PREFIXES(TabLifecycleUnitSourceTest, + TabProactiveDiscardedByFrozenCallback); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerWasDiscarded); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, + TabManagerWasDiscardedCrossSiteSubFrame); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, + ProactiveFastShutdownSingleTabProcess); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, + ProactiveFastShutdownSharedTabProcess); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, + ProactiveFastShutdownWithUnloadHandler); + FRIEND_TEST_ALL_PREFIXES(TabManagerTest, + ProactiveFastShutdownWithBeforeunloadHandler); class TabLifecycleUnit; // Returns the TabLifecycleUnit instance associated with |web_contents|, or
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source_unittest.cc b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source_unittest.cc index 692bb89..58cc385 100644 --- a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source_unittest.cc +++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source_unittest.cc
@@ -7,7 +7,9 @@ #include <memory> #include "base/macros.h" +#include "base/message_loop/message_loop_current.h" #include "base/test/simple_test_tick_clock.h" +#include "base/test/test_mock_time_task_runner.h" #include "build/build_config.h" #include "chrome/browser/resource_coordinator/lifecycle_unit_observer.h" #include "chrome/browser/resource_coordinator/lifecycle_unit_source_observer.h" @@ -85,10 +87,21 @@ base::TimeTicks::Max(); } +#define EXPECT_FOR_ALL_DISCARD_REASONS(lifecycle_unit, method, value) \ + do { \ + EXPECT_EQ(value, lifecycle_unit->method(DiscardReason::kExternal)); \ + EXPECT_EQ(value, lifecycle_unit->method(DiscardReason::kProactive)); \ + EXPECT_EQ(value, lifecycle_unit->method(DiscardReason::kUrgent)); \ + } while (false) + class TabLifecycleUnitSourceTest : public ChromeRenderViewHostTestHarness { protected: TabLifecycleUnitSourceTest() - : scoped_set_tick_clock_for_testing_(&test_clock_) { + : scoped_context_( + std::make_unique<base::TestMockTimeTaskRunner::ScopedContext>( + task_runner_)), + scoped_set_tick_clock_for_testing_(task_runner_->GetMockTickClock()) { + base::MessageLoopCurrent::Get()->SetTaskRunner(task_runner_); } void SetUp() override { @@ -106,6 +119,9 @@ void TearDown() override { tab_strip_model_->CloseAllTabs(); tab_strip_model_.reset(); + + task_runner_->RunUntilIdle(); + scoped_context_.reset(); ChromeRenderViewHostTestHarness::TearDown(); } @@ -120,8 +136,8 @@ source_->SetFocusedTabStripModelForTesting(tab_strip_model_.get()); // Add a foreground tab to the tab strip. - test_clock_.Advance(kShortDelay); - auto time_before_first_tab = test_clock_.NowTicks(); + task_runner_->FastForwardBy(kShortDelay); + auto time_before_first_tab = NowTicks(); EXPECT_CALL(source_observer_, OnLifecycleUnitCreated(testing::_)) .WillOnce(testing::Invoke([&](LifecycleUnit* lifecycle_unit) { *first_lifecycle_unit = lifecycle_unit; @@ -141,8 +157,8 @@ EXPECT_TRUE(source_->GetTabLifecycleUnitExternal(raw_first_web_contents)); // Add another foreground tab to the focused tab strip. - test_clock_.Advance(kShortDelay); - auto time_before_second_tab = test_clock_.NowTicks(); + task_runner_->FastForwardBy(kShortDelay); + auto time_before_second_tab = NowTicks(); EXPECT_CALL(source_observer_, OnLifecycleUnitCreated(testing::_)) .WillOnce(testing::Invoke([&](LifecycleUnit* lifecycle_unit) { *second_lifecycle_unit = lifecycle_unit; @@ -181,7 +197,7 @@ second_lifecycle_unit->GetSortKey().last_focused_time; // Add a background tab to the focused tab strip. - test_clock_.Advance(kShortDelay); + task_runner_->FastForwardBy(kShortDelay); LifecycleUnit* third_lifecycle_unit = nullptr; EXPECT_CALL(source_observer_, OnLifecycleUnitCreated(testing::_)) .WillOnce(testing::Invoke([&](LifecycleUnit* lifecycle_unit) { @@ -228,11 +244,206 @@ tab_strip_model->CloseAllTabs(); } + void TransitionFromPendingDiscardToDiscardedIfNeeded( + DiscardReason reason, + LifecycleUnit* lifecycle_unit) { + if (reason == DiscardReason::kExternal || + reason == DiscardReason::kProactive) { + EXPECT_EQ(LifecycleState::PENDING_DISCARD, lifecycle_unit->GetState()); + task_runner_->FastForwardBy(kProactiveDiscardFreezeTimeout); + } + EXPECT_EQ(LifecycleState::DISCARDED, lifecycle_unit->GetState()); + } + + void DetachWebContentsTest(DiscardReason reason) { + LifecycleUnit* first_lifecycle_unit = nullptr; + LifecycleUnit* second_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &first_lifecycle_unit, + &second_lifecycle_unit); + + // Detach the non-active tab. Verify that it can no longer be discarded. + EXPECT_FOR_ALL_DISCARD_REASONS(first_lifecycle_unit, CanDiscard, true); + std::unique_ptr<content::WebContents> owned_contents = + tab_strip_model_->DetachWebContentsAt(0); + EXPECT_FOR_ALL_DISCARD_REASONS(first_lifecycle_unit, CanDiscard, false); + + // Create a second tab strip. + NoUnloadListenerTabStripModelDelegate other_tab_strip_model_delegate; + TabStripModel other_tab_strip_model(&other_tab_strip_model_delegate, + profile()); + other_tab_strip_model.AddObserver(source_); + + // Insert the tab into the second tab strip without focusing it. Verify that + // it can be discarded. + other_tab_strip_model.AppendWebContents(std::move(owned_contents), false); + EXPECT_FOR_ALL_DISCARD_REASONS(first_lifecycle_unit, CanDiscard, true); + + EXPECT_EQ(LifecycleState::ACTIVE, first_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + first_lifecycle_unit->Discard(reason); + + testing::Mock::VerifyAndClear(&tab_observer_); + TransitionFromPendingDiscardToDiscardedIfNeeded(reason, + first_lifecycle_unit); + + // Expect a notification when the tab is closed. + CloseTabsAndExpectNotifications(&other_tab_strip_model, + {first_lifecycle_unit}); + } + + void DiscardTest(DiscardReason reason) { + const base::TimeTicks kDummyLastActiveTime = + base::TimeTicks() + kShortDelay; + + LifecycleUnit* background_lifecycle_unit = nullptr; + LifecycleUnit* foreground_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, + &foreground_lifecycle_unit); + content::WebContents* initial_web_contents = + tab_strip_model_->GetWebContentsAt(0); + initial_web_contents->SetLastActiveTime(kDummyLastActiveTime); + + // Discard the tab. + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + background_lifecycle_unit->Discard(reason); + testing::Mock::VerifyAndClear(&tab_observer_); + + // Expect the tab to be discarded and the last active time to be preserved. + TransitionFromPendingDiscardToDiscardedIfNeeded(reason, + background_lifecycle_unit); + + EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); + EXPECT_FALSE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + EXPECT_EQ(kDummyLastActiveTime, + tab_strip_model_->GetWebContentsAt(0)->GetLastActiveTime()); + + source_->SetFocusedTabStripModelForTesting(nullptr); + } + + void DiscardAndActivateTest(DiscardReason reason) { + LifecycleUnit* background_lifecycle_unit = nullptr; + LifecycleUnit* foreground_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, + &foreground_lifecycle_unit); + content::WebContents* initial_web_contents = + tab_strip_model_->GetWebContentsAt(0); + + // Discard the tab. + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + background_lifecycle_unit->Discard(reason); + testing::Mock::VerifyAndClear(&tab_observer_); + + TransitionFromPendingDiscardToDiscardedIfNeeded(reason, + background_lifecycle_unit); + + EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); + EXPECT_FALSE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + + // Focus the tab. Expect the state to be ACTIVE. + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); + tab_strip_model_->ActivateTabAt(0, true); + testing::Mock::VerifyAndClear(&tab_observer_); + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_TRUE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + } + + void DiscardAndExplicitlyReloadTest(DiscardReason reason) { + LifecycleUnit* background_lifecycle_unit = nullptr; + LifecycleUnit* foreground_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, + &foreground_lifecycle_unit); + content::WebContents* initial_web_contents = + tab_strip_model_->GetWebContentsAt(0); + + // Discard the tab. + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + background_lifecycle_unit->Discard(reason); + testing::Mock::VerifyAndClear(&tab_observer_); + + TransitionFromPendingDiscardToDiscardedIfNeeded(reason, + background_lifecycle_unit); + + EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); + EXPECT_FALSE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + + // Explicitly reload the tab. Expect the state to be ACTIVE. + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); + tab_strip_model_->GetWebContentsAt(0)->GetController().Reload( + content::ReloadType::NORMAL, false); + testing::Mock::VerifyAndClear(&tab_observer_); + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_TRUE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + } + + void CanOnlyDiscardOnceTest(DiscardReason reason) { + LifecycleUnit* background_lifecycle_unit = nullptr; + LifecycleUnit* foreground_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, + &foreground_lifecycle_unit); + content::WebContents* initial_web_contents = + tab_strip_model_->GetWebContentsAt(0); + + // It should be possible to discard the background tab. + EXPECT_FOR_ALL_DISCARD_REASONS(background_lifecycle_unit, CanDiscard, true); + + // Discard the tab. + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + background_lifecycle_unit->Discard(reason); + + testing::Mock::VerifyAndClear(&tab_observer_); + + TransitionFromPendingDiscardToDiscardedIfNeeded(reason, + background_lifecycle_unit); + + EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); + EXPECT_FALSE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + + // Explicitly reload the tab. Expect the state to be LOADED. + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); + tab_strip_model_->GetWebContentsAt(0)->GetController().Reload( + content::ReloadType::NORMAL, false); + testing::Mock::VerifyAndClear(&tab_observer_); + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_TRUE(tab_strip_model_->GetWebContentsAt(0) + ->GetController() + .GetPendingEntry()); + + // It shouldn't be possible to discard the background tab again, except for + // an urgent discard on ChromeOS. + EXPECT_FALSE( + background_lifecycle_unit->CanDiscard(DiscardReason::kExternal)); + EXPECT_FALSE( + background_lifecycle_unit->CanDiscard(DiscardReason::kProactive)); +#if defined(OS_CHROMEOS) + EXPECT_TRUE(background_lifecycle_unit->CanDiscard(DiscardReason::kUrgent)); +#else + EXPECT_FALSE(background_lifecycle_unit->CanDiscard(DiscardReason::kUrgent)); +#endif + } + TabLifecycleUnitSource* source_ = nullptr; testing::StrictMock<MockLifecycleUnitSourceObserver> source_observer_; testing::StrictMock<MockTabLifecycleObserver> tab_observer_; std::unique_ptr<TabStripModel> tab_strip_model_; - base::SimpleTestTickClock test_clock_; + scoped_refptr<base::TestMockTimeTaskRunner> task_runner_ = + base::MakeRefCounted<base::TestMockTimeTaskRunner>(); + std::unique_ptr<base::TestMockTimeTaskRunner::ScopedContext> scoped_context_; private: std::unique_ptr<content::WebContents> CreateAndNavigateWebContents() { @@ -250,13 +461,6 @@ DISALLOW_COPY_AND_ASSIGN(TabLifecycleUnitSourceTest); }; -#define EXPECT_FOR_ALL_DISCARD_REASONS(lifecycle_unit, method, value) \ - do { \ - EXPECT_EQ(value, lifecycle_unit->method(DiscardReason::kExternal)); \ - EXPECT_EQ(value, lifecycle_unit->method(DiscardReason::kProactive)); \ - EXPECT_EQ(value, lifecycle_unit->method(DiscardReason::kUrgent)); \ - } while (false) - } // namespace TEST_F(TabLifecycleUnitSourceTest, AppendTabsToFocusedTabStrip) { @@ -274,8 +478,8 @@ &second_lifecycle_unit); // Activate the first tab. - test_clock_.Advance(kShortDelay); - auto time_before_activate = test_clock_.NowTicks(); + task_runner_->FastForwardBy(kShortDelay); + auto time_before_activate = NowTicks(); tab_strip_model_->ActivateTabAt(0, true); EXPECT_TRUE(IsFocused(first_lifecycle_unit)); EXPECT_EQ(time_before_activate, @@ -293,7 +497,7 @@ &second_lifecycle_unit); // Close the second tab. The first tab should be focused. - test_clock_.Advance(kShortDelay); + task_runner_->FastForwardBy(kShortDelay); testing::StrictMock<MockLifecycleUnitObserver> second_observer; second_lifecycle_unit->AddObserver(&second_observer); EXPECT_CALL(second_observer, OnLifecycleUnitDestroyed(second_lifecycle_unit)); @@ -336,38 +540,16 @@ tab_strip_model_.get(), {first_lifecycle_unit, second_lifecycle_unit}); } -TEST_F(TabLifecycleUnitSourceTest, DetachWebContents) { - LifecycleUnit* first_lifecycle_unit = nullptr; - LifecycleUnit* second_lifecycle_unit = nullptr; - CreateTwoTabs(true /* focus_tab_strip */, &first_lifecycle_unit, - &second_lifecycle_unit); +TEST_F(TabLifecycleUnitSourceTest, DetachWebContents_Urgent) { + DetachWebContentsTest(DiscardReason::kUrgent); +} - // Detach the non-active tab. Verify that it can no longer be discarded. - EXPECT_FOR_ALL_DISCARD_REASONS(first_lifecycle_unit, CanDiscard, true); - std::unique_ptr<content::WebContents> owned_contents = - tab_strip_model_->DetachWebContentsAt(0); - EXPECT_FOR_ALL_DISCARD_REASONS(first_lifecycle_unit, CanDiscard, false); +TEST_F(TabLifecycleUnitSourceTest, DetachWebContents_Proactive) { + DetachWebContentsTest(DiscardReason::kProactive); +} - // Create a second tab strip. - NoUnloadListenerTabStripModelDelegate other_tab_strip_model_delegate; - TabStripModel other_tab_strip_model(&other_tab_strip_model_delegate, - profile()); - other_tab_strip_model.AddObserver(source_); - - // Insert the tab into the second tab strip without focusing it. Verify that - // it can be discarded. - other_tab_strip_model.AppendWebContents(std::move(owned_contents), false); - EXPECT_FOR_ALL_DISCARD_REASONS(first_lifecycle_unit, CanDiscard, true); - - EXPECT_EQ(LifecycleState::ACTIVE, first_lifecycle_unit->GetState()); - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); - first_lifecycle_unit->Discard(DiscardReason::kProactive); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::DISCARDED, first_lifecycle_unit->GetState()); - - // Expect a notification when the tab is closed. - CloseTabsAndExpectNotifications(&other_tab_strip_model, - {first_lifecycle_unit}); +TEST_F(TabLifecycleUnitSourceTest, DetachWebContents_External) { + DetachWebContentsTest(DiscardReason::kExternal); } // Regression test for https://crbug.com/818454. Previously, TabLifecycleUnits @@ -397,129 +579,52 @@ // collaboration from the TabLifecycleUnitSource is required to replace the // WebContents in the TabLifecycleUnit. -TEST_F(TabLifecycleUnitSourceTest, Discard) { - const base::TimeTicks kDummyLastActiveTime = base::TimeTicks() + kShortDelay; - - LifecycleUnit* background_lifecycle_unit = nullptr; - LifecycleUnit* foreground_lifecycle_unit = nullptr; - CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, - &foreground_lifecycle_unit); - content::WebContents* initial_web_contents = - tab_strip_model_->GetWebContentsAt(0); - initial_web_contents->SetLastActiveTime(kDummyLastActiveTime); - - // Discard the tab. - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); - background_lifecycle_unit->Discard(DiscardReason::kProactive); - testing::Mock::VerifyAndClear(&tab_observer_); - - // Expect the tab to be discarded and the last active time to be preserved. - EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); - EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); - EXPECT_FALSE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); - EXPECT_EQ(kDummyLastActiveTime, - tab_strip_model_->GetWebContentsAt(0)->GetLastActiveTime()); - - source_->SetFocusedTabStripModelForTesting(nullptr); +TEST_F(TabLifecycleUnitSourceTest, Discard_Proactive) { + DiscardTest(DiscardReason::kProactive); } -TEST_F(TabLifecycleUnitSourceTest, DiscardAndActivate) { - LifecycleUnit* background_lifecycle_unit = nullptr; - LifecycleUnit* foreground_lifecycle_unit = nullptr; - CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, - &foreground_lifecycle_unit); - content::WebContents* initial_web_contents = - tab_strip_model_->GetWebContentsAt(0); - - // Discard the tab. - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); - background_lifecycle_unit->Discard(DiscardReason::kProactive); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); - EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); - EXPECT_FALSE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); - - // Focus the tab. Expect the state to be LOADED. - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); - tab_strip_model_->ActivateTabAt(0, true); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_TRUE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); +TEST_F(TabLifecycleUnitSourceTest, Discard_Urgent) { + DiscardTest(DiscardReason::kUrgent); } -TEST_F(TabLifecycleUnitSourceTest, DiscardAndExplicitlyReload) { - LifecycleUnit* background_lifecycle_unit = nullptr; - LifecycleUnit* foreground_lifecycle_unit = nullptr; - CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, - &foreground_lifecycle_unit); - content::WebContents* initial_web_contents = - tab_strip_model_->GetWebContentsAt(0); - - // Discard the tab. - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); - background_lifecycle_unit->Discard(DiscardReason::kProactive); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); - EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); - EXPECT_FALSE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); - - // Explicitly reload the tab. Expect the state to be LOADED. - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); - tab_strip_model_->GetWebContentsAt(0)->GetController().Reload( - content::ReloadType::NORMAL, false); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_TRUE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); +TEST_F(TabLifecycleUnitSourceTest, Discard_External) { + DiscardTest(DiscardReason::kExternal); } -TEST_F(TabLifecycleUnitSourceTest, CanOnlyDiscardOnce) { - LifecycleUnit* background_lifecycle_unit = nullptr; - LifecycleUnit* foreground_lifecycle_unit = nullptr; - CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, - &foreground_lifecycle_unit); - content::WebContents* initial_web_contents = - tab_strip_model_->GetWebContentsAt(0); +TEST_F(TabLifecycleUnitSourceTest, DiscardAndActivate_Urgent) { + DiscardAndActivateTest(DiscardReason::kUrgent); +} - // It should be possible to discard the background tab. - EXPECT_FOR_ALL_DISCARD_REASONS(background_lifecycle_unit, CanDiscard, true); +TEST_F(TabLifecycleUnitSourceTest, DiscardAndActivate_Proactive) { + DiscardAndActivateTest(DiscardReason::kProactive); +} - // Discard the tab. - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); - background_lifecycle_unit->Discard(DiscardReason::kProactive); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); - EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); - EXPECT_FALSE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); +TEST_F(TabLifecycleUnitSourceTest, DiscardAndActivate_External) { + DiscardAndActivateTest(DiscardReason::kExternal); +} - // Explicitly reload the tab. Expect the state to be LOADED. - EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); - tab_strip_model_->GetWebContentsAt(0)->GetController().Reload( - content::ReloadType::NORMAL, false); - testing::Mock::VerifyAndClear(&tab_observer_); - EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); - EXPECT_TRUE( - tab_strip_model_->GetWebContentsAt(0)->GetController().GetPendingEntry()); +TEST_F(TabLifecycleUnitSourceTest, DiscardAndExplicitlyReload_Urgent) { + DiscardAndExplicitlyReloadTest(DiscardReason::kUrgent); +} - // It shouldn't be possible to discard the background tab again, except for an - // urgent discard on ChromeOS. - EXPECT_FALSE(background_lifecycle_unit->CanDiscard(DiscardReason::kExternal)); - EXPECT_FALSE( - background_lifecycle_unit->CanDiscard(DiscardReason::kProactive)); -#if defined(OS_CHROMEOS) - EXPECT_TRUE(background_lifecycle_unit->CanDiscard(DiscardReason::kUrgent)); -#else - EXPECT_FALSE(background_lifecycle_unit->CanDiscard(DiscardReason::kUrgent)); -#endif +TEST_F(TabLifecycleUnitSourceTest, DiscardAndExplicitlyReload_Proactive) { + DiscardAndExplicitlyReloadTest(DiscardReason::kProactive); +} + +TEST_F(TabLifecycleUnitSourceTest, DiscardAndExplicitlyReload_External) { + DiscardAndExplicitlyReloadTest(DiscardReason::kExternal); +} + +TEST_F(TabLifecycleUnitSourceTest, CanOnlyDiscardOnce_Urgent) { + CanOnlyDiscardOnceTest(DiscardReason::kUrgent); +} + +TEST_F(TabLifecycleUnitSourceTest, CanOnlyDiscardOnce_Proactive) { + CanOnlyDiscardOnceTest(DiscardReason::kProactive); +} + +TEST_F(TabLifecycleUnitSourceTest, CanOnlyDiscardOnce_External) { + CanOnlyDiscardOnceTest(DiscardReason::kExternal); } TEST_F(TabLifecycleUnitSourceTest, CannotFreezeADiscardedTab) { @@ -529,15 +634,16 @@ &foreground_lifecycle_unit); content::WebContents* initial_web_contents = tab_strip_model_->GetWebContentsAt(0); - test_clock_.Advance(kShortDelay); + task_runner_->FastForwardBy(kShortDelay); // It should be possible to discard the background tab. EXPECT_FOR_ALL_DISCARD_REASONS(background_lifecycle_unit, CanDiscard, true); - // Discard the tab. + // Discard the tab. Use DiscardReason::kUrgent to force the discard. EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); - background_lifecycle_unit->Discard(DiscardReason::kProactive); + background_lifecycle_unit->Discard(DiscardReason::kUrgent); + testing::Mock::VerifyAndClear(&tab_observer_); EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); @@ -559,4 +665,50 @@ EXPECT_TRUE(background_lifecycle_unit->Freeze()); } +TEST_F(TabLifecycleUnitSourceTest, TabProactiveDiscardedByFrozenCallback) { + LifecycleUnit* background_lifecycle_unit = nullptr; + LifecycleUnit* foreground_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, + &foreground_lifecycle_unit); + + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + + background_lifecycle_unit->Discard(DiscardReason::kProactive); + EXPECT_EQ(LifecycleState::PENDING_DISCARD, + background_lifecycle_unit->GetState()); + + reinterpret_cast<TabLifecycleUnitSource::TabLifecycleUnit*>( + background_lifecycle_unit) + ->UpdateLifecycleState(mojom::LifecycleState::kFrozen); + EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); + tab_strip_model_->GetWebContentsAt(0)->GetController().Reload( + content::ReloadType::NORMAL, false); + testing::Mock::VerifyAndClear(&tab_observer_); +} + +TEST_F(TabLifecycleUnitSourceTest, TabProactiveDiscardedByFrozenTimeout) { + LifecycleUnit* background_lifecycle_unit = nullptr; + LifecycleUnit* foreground_lifecycle_unit = nullptr; + CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, + &foreground_lifecycle_unit); + + EXPECT_EQ(LifecycleState::ACTIVE, background_lifecycle_unit->GetState()); + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); + + background_lifecycle_unit->Discard(DiscardReason::kProactive); + EXPECT_EQ(LifecycleState::PENDING_DISCARD, + background_lifecycle_unit->GetState()); + task_runner_->FastForwardBy(kProactiveDiscardFreezeTimeout); + + EXPECT_EQ(LifecycleState::DISCARDED, background_lifecycle_unit->GetState()); + + EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, false)); + tab_strip_model_->GetWebContentsAt(0)->GetController().Reload( + content::ReloadType::NORMAL, false); + testing::Mock::VerifyAndClear(&tab_observer_); +} + } // namespace resource_coordinator
diff --git a/chrome/browser/resource_coordinator/tab_manager.cc b/chrome/browser/resource_coordinator/tab_manager.cc index dbce2c3..67c20765 100644 --- a/chrome/browser/resource_coordinator/tab_manager.cc +++ b/chrome/browser/resource_coordinator/tab_manager.cc
@@ -119,8 +119,11 @@ int GetNumLoadedLifecycleUnits(LifecycleUnitSet lifecycle_unit_set) { int num_loaded_lifecycle_units = 0; for (auto* lifecycle_unit : lifecycle_unit_set) { - if (lifecycle_unit->GetState() != LifecycleState::DISCARDED) + LifecycleState state = lifecycle_unit->GetState(); + if (state != LifecycleState::DISCARDED && + state != LifecycleState::PENDING_DISCARD) { num_loaded_lifecycle_units++; + } } return num_loaded_lifecycle_units; } @@ -1029,9 +1032,15 @@ void TabManager::OnLifecycleUnitStateChanged(LifecycleUnit* lifecycle_unit, LifecycleState last_state) { - if (lifecycle_unit->GetState() == LifecycleState::DISCARDED) + LifecycleState state = lifecycle_unit->GetState(); + bool was_discarded = (last_state == LifecycleState::PENDING_DISCARD || + last_state == LifecycleState::DISCARDED); + bool is_discarded = (state == LifecycleState::PENDING_DISCARD || + state == LifecycleState::DISCARDED); + + if (is_discarded && !was_discarded) num_loaded_lifecycle_units_--; - else if (last_state == LifecycleState::DISCARDED) + else if (was_discarded && !is_discarded) num_loaded_lifecycle_units_++; DCHECK_EQ(num_loaded_lifecycle_units_, @@ -1047,8 +1056,10 @@ } void TabManager::OnLifecycleUnitDestroyed(LifecycleUnit* lifecycle_unit) { - if (lifecycle_unit->GetState() != LifecycleState::DISCARDED) + if (lifecycle_unit->GetState() != LifecycleState::DISCARDED && + lifecycle_unit->GetState() != LifecycleState::PENDING_DISCARD) { num_loaded_lifecycle_units_--; + } lifecycle_units_.erase(lifecycle_unit); DCHECK_EQ(num_loaded_lifecycle_units_,
diff --git a/chrome/browser/resource_coordinator/tab_manager_browsertest.cc b/chrome/browser/resource_coordinator/tab_manager_browsertest.cc index bee2070c..4ff0c8c 100644 --- a/chrome/browser/resource_coordinator/tab_manager_browsertest.cc +++ b/chrome/browser/resource_coordinator/tab_manager_browsertest.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" +#include "chrome/browser/resource_coordinator/tab_lifecycle_unit.h" #include "chrome/browser/resource_coordinator/tab_lifecycle_unit_external.h" #include "chrome/browser/resource_coordinator/tab_manager.h" #include "chrome/browser/resource_coordinator/tab_manager_web_contents_data.h" @@ -52,6 +53,19 @@ constexpr char kBlinkPageLifecycleFeature[] = "PageLifecycle"; constexpr base::TimeDelta kShortDelay = base::TimeDelta::FromSeconds(1); +bool ObserveNavEntryCommitted(const GURL& expected_url, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + return content::Details<content::LoadCommittedDetails>(details) + ->entry->GetURL() == expected_url; +} + +bool IsTabDiscarded(content::WebContents* web_contents) { + return TabLifecycleUnitExternal::FromWebContents(web_contents)->IsDiscarded(); +} + +} // namespace + class TabManagerTest : public InProcessBrowserTest { public: TabManagerTest() : scoped_set_tick_clock_for_testing_(&test_clock_) { @@ -93,23 +107,19 @@ ASSERT_EQ(2, browser()->tab_strip_model()->count()); } + // Gets the TabLifecycleUnit from |contents| and sends the signal that + // indicates that the page is frozen. In production, this is sent by the + // renderer process. This is done to finish a proactive tab discard. + void SimulateFreezeSignal(content::WebContents* contents) { + static_cast<TabLifecycleUnitSource::TabLifecycleUnit*>( + TabLifecycleUnitExternal::FromWebContents(contents)) + ->UpdateLifecycleState(mojom::LifecycleState::kFrozen); + } + base::SimpleTestTickClock test_clock_; ScopedSetTickClockForTesting scoped_set_tick_clock_for_testing_; }; -bool ObserveNavEntryCommitted(const GURL& expected_url, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - return content::Details<content::LoadCommittedDetails>(details) - ->entry->GetURL() == expected_url; -} - -bool IsTabDiscarded(content::WebContents* web_contents) { - return TabLifecycleUnitExternal::FromWebContents(web_contents)->IsDiscarded(); -} - -} // namespace - IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) { using content::WindowedNotificationObserver; TabManager* tab_manager = g_browser_process->GetTabManager(); @@ -174,14 +184,14 @@ // Discard a tab. It should kill the first tab, since it was the oldest // and was not selected. - EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kUrgent)); EXPECT_EQ(3, tsm->count()); EXPECT_TRUE(IsTabDiscarded(tsm->GetWebContentsAt(0))); EXPECT_FALSE(IsTabDiscarded(tsm->GetWebContentsAt(1))); EXPECT_FALSE(IsTabDiscarded(tsm->GetWebContentsAt(2))); // Run discard again, make sure it kills the second tab. - EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kUrgent)); EXPECT_EQ(3, tsm->count()); EXPECT_TRUE(IsTabDiscarded(tsm->GetWebContentsAt(0))); EXPECT_TRUE(IsTabDiscarded(tsm->GetWebContentsAt(1))); @@ -189,7 +199,7 @@ // Kill the third tab. It should not kill the last tab, since it is active // tab. - EXPECT_FALSE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + EXPECT_FALSE(tab_manager->DiscardTabImpl(DiscardReason::kUrgent)); EXPECT_TRUE(IsTabDiscarded(tsm->GetWebContentsAt(0))); EXPECT_TRUE(IsTabDiscarded(tsm->GetWebContentsAt(1))); EXPECT_FALSE(IsTabDiscarded(tsm->GetWebContentsAt(2))); @@ -199,7 +209,7 @@ EXPECT_EQ(1, tsm->active_index()); EXPECT_FALSE(IsTabDiscarded(tsm->GetWebContentsAt(1))); - tab_manager->DiscardTabImpl(DiscardReason::kProactive); + tab_manager->DiscardTabImpl(DiscardReason::kUrgent); EXPECT_TRUE(IsTabDiscarded(tsm->GetWebContentsAt(2))); // Force creation of the FindBarController. @@ -589,6 +599,8 @@ content::NotificationService::AllSources()); base::HistogramTester tester; EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + SimulateFreezeSignal(browser()->tab_strip_model()->GetWebContentsAt(1)); + tester.ExpectUniqueSample( "TabManager.Discarding.DiscardedTabCouldFastShutdown", true, 1); observer.Wait(); @@ -625,6 +637,8 @@ // will be made. base::HistogramTester tester; EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + SimulateFreezeSignal(browser()->tab_strip_model()->GetWebContentsAt(1)); + tester.ExpectUniqueSample( "TabManager.Discarding.DiscardedTabCouldFastShutdown", false, 1); } @@ -664,6 +678,8 @@ // one of them is current, and the other has an unload handler. No unsafe // attempts will be made. EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + SimulateFreezeSignal(browser()->tab_strip_model()->GetWebContentsAt(1)); + tester.ExpectUniqueSample( "TabManager.Discarding.DiscardedTabCouldFastShutdown", false, 1); } @@ -712,6 +728,8 @@ // attempts will be made. base::HistogramTester tester; EXPECT_TRUE(tab_manager->DiscardTabImpl(DiscardReason::kProactive)); + SimulateFreezeSignal(browser()->tab_strip_model()->GetWebContentsAt(1)); + tester.ExpectUniqueSample( "TabManager.Discarding.DiscardedTabCouldFastShutdown", false, 1); } @@ -839,6 +857,7 @@ TabLifecycleUnitExternal::FromWebContents( browser()->tab_strip_model()->GetActiveWebContents()) ->DiscardTab(); + SimulateFreezeSignal(browser()->tab_strip_model()->GetActiveWebContents()); // Here we simulate re-focussing the tab causing reload with navigation, // the navigation will reload the tab. @@ -895,6 +914,7 @@ // Discard the tab. This simulates a tab discard. TabLifecycleUnitExternal::FromWebContents(contents)->DiscardTab(); + SimulateFreezeSignal(contents); // Here we simulate re-focussing the tab causing reload with navigation, // the navigation will reload the tab.
diff --git a/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc b/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc index 8cb738f7..e364a35 100644 --- a/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc +++ b/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc
@@ -381,6 +381,7 @@ << " for focused tab " << pid; std::map<int, int> dict; dict[pid] = chrome::kLowestRendererOomScore; + DCHECK(GetDebugDaemonClient()); GetDebugDaemonClient()->SetOomScoreAdj(dict, base::Bind(&OnSetOomScoreAdj)); }
diff --git a/chrome/browser/resource_coordinator/tab_manager_unittest.cc b/chrome/browser/resource_coordinator/tab_manager_unittest.cc index 8a89957..e8da2835 100644 --- a/chrome/browser/resource_coordinator/tab_manager_unittest.cc +++ b/chrome/browser/resource_coordinator/tab_manager_unittest.cc
@@ -478,7 +478,7 @@ tab_strip2->GetWebContentsAt(1)->WasHidden(); for (int i = 0; i < 4; ++i) - tab_manager_->DiscardTab(DiscardReason::kProactive); + tab_manager_->DiscardTab(DiscardReason::kUrgent); // Active tab in a visible window should not be discarded. EXPECT_FALSE(IsTabDiscarded(tab_strip1->GetWebContentsAt(0)));
diff --git a/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html b/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html index b55a80e0e..a0c7399 100644 --- a/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html +++ b/chrome/browser/resources/settings/a11y_page/manage_a11y_page.html
@@ -142,7 +142,12 @@ </paper-icon-button-light> </div> - <h2>$i18n{keyboardHeading}</h2> + <template is="dom-if" if="[[!showExperimentalFeatures_]]"> + <h2>$i18n{keyboardHeading}</h2> + </template> + <template is="dom-if" if="[[showExperimentalFeatures_]]"> + <h2>$i18n{keyboardAndTextInputHeading}</h2> + </template> <settings-toggle-button class="first" pref="{{prefs.settings.a11y.sticky_keys_enabled}}" label="$i18n{stickyKeysLabel}"> @@ -151,6 +156,12 @@ pref="{{prefs.settings.a11y.virtual_keyboard}}" label="$i18n{onScreenKeyboardLabel}"> </settings-toggle-button> + <template is="dom-if" if="[[showExperimentalFeatures_]]"> + <settings-toggle-button class="continuation" + pref="{{prefs.settings.a11y.dictation}}" + label="$i18n{dictationLabel}"> + </settings-toggle-button> + </template> <settings-toggle-button class="continuation" pref="{{prefs.settings.a11y.focus_highlight}}" label="$i18n{focusHighlightLabel}">
diff --git a/chrome/browser/resources/settings/settings_shared_css.html b/chrome/browser/resources/settings/settings_shared_css.html index 3117c29..7f5e06f 100644 --- a/chrome/browser/resources/settings/settings_shared_css.html +++ b/chrome/browser/resources/settings/settings_shared_css.html
@@ -1,6 +1,5 @@ <link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/paper_input_style_css.html"> -<link rel="import" href="chrome://resources/cr_elements/paper_toggle_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/search_highlight_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> @@ -11,7 +10,7 @@ <!-- Common styles for Material Design settings. --> <dom-module id="settings-shared"> <template> - <style include="settings-icons paper-button-style paper-input-style paper-toggle-style cr-shared-style search-highlight-style"> + <style include="settings-icons paper-button-style paper-input-style cr-shared-style search-highlight-style"> /* Prevent action-links from being selected to avoid accidental * selection when trying to click it. */ a[is=action-link] {
diff --git a/chrome/browser/ssl/bad_clock_blocking_page.cc b/chrome/browser/ssl/bad_clock_blocking_page.cc index 5014905..0c6fe9e 100644 --- a/chrome/browser/ssl/bad_clock_blocking_page.cc +++ b/chrome/browser/ssl/bad_clock_blocking_page.cc
@@ -79,6 +79,7 @@ std::make_unique<SSLErrorControllerClient>( web_contents, ssl_info, + cert_error, request_url, CreateBadClockMetricsHelper(web_contents, request_url))), callback_(callback),
diff --git a/chrome/browser/ssl/captive_portal_blocking_page.cc b/chrome/browser/ssl/captive_portal_blocking_page.cc index 4ba79fe..542d0a1 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page.cc
@@ -72,6 +72,7 @@ const GURL& login_url, std::unique_ptr<SSLCertReporter> ssl_cert_reporter, const net::SSLInfo& ssl_info, + int cert_error, const base::Callback<void(content::CertificateRequestResultType)>& callback) : SSLBlockingPageBase( web_contents, @@ -84,6 +85,7 @@ std::make_unique<SSLErrorControllerClient>( web_contents, ssl_info, + cert_error, request_url, CreateCaptivePortalMetricsHelper(web_contents, request_url))), login_url_(login_url), @@ -205,6 +207,8 @@ load_time_data->SetString("closeDetails", base::string16()); load_time_data->SetString("explanationParagraph", base::string16()); load_time_data->SetString("finalParagraph", base::string16()); + load_time_data->SetString("recurrentErrorParagraph", base::string16()); + load_time_data->SetBoolean("show_recurrent_error_paragraph", false); if (cert_report_helper()) cert_report_helper()->PopulateExtendedReportingOption(load_time_data);
diff --git a/chrome/browser/ssl/captive_portal_blocking_page.h b/chrome/browser/ssl/captive_portal_blocking_page.h index 20336c5..d262bf3 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.h +++ b/chrome/browser/ssl/captive_portal_blocking_page.h
@@ -45,6 +45,7 @@ const GURL& login_url, std::unique_ptr<SSLCertReporter> ssl_cert_reporter, const net::SSLInfo& ssl_info, + int cert_error, const base::Callback<void(content::CertificateRequestResultType)>& callback); ~CaptivePortalBlockingPage() override;
diff --git a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc index 5be6b40..e86b493e 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc
@@ -81,6 +81,7 @@ login_url, std::move(ssl_cert_reporter), ssl_info, + net::ERR_CERT_COMMON_NAME_INVALID, callback), is_wifi_(is_wifi), wifi_ssid_(wifi_ssid) {}
diff --git a/chrome/browser/ssl/common_name_mismatch_handler.cc b/chrome/browser/ssl/common_name_mismatch_handler.cc index 7566fbd..d5d6c84 100644 --- a/chrome/browser/ssl/common_name_mismatch_handler.cc +++ b/chrome/browser/ssl/common_name_mismatch_handler.cc
@@ -12,12 +12,17 @@ #include "net/http/http_response_headers.h" #include "net/http/http_util.h" #include "net/traffic_annotation/network_traffic_annotation.h" -#include "net/url_request/url_request_status.h" +#include "net/url_request/redirect_info.h" +#include "services/network/public/cpp/resource_request.h" +#include "services/network/public/cpp/resource_response.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/simple_url_loader.h" CommonNameMismatchHandler::CommonNameMismatchHandler( const GURL& request_url, - const scoped_refptr<net::URLRequestContextGetter>& request_context) - : request_url_(request_url), request_context_(request_context) {} + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) + : request_url_(request_url), + url_loader_factory_(std::move(url_loader_factory)) {} CommonNameMismatchHandler::~CommonNameMismatchHandler() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -38,6 +43,7 @@ DCHECK(!IsCheckingSuggestedUrl()); DCHECK(check_url_callback_.is_null()); + check_url_ = url; check_url_callback_ = callback; // Create traffic annotation tag. @@ -68,19 +74,29 @@ "Not implemented." })"); - url_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::HEAD, this, - traffic_annotation); - url_fetcher_->SetAutomaticallyRetryOn5xx(false); - url_fetcher_->SetRequestContext(request_context_.get()); - + auto resource_request = std::make_unique<network::ResourceRequest>(); // Can't safely use net::LOAD_DISABLE_CERT_REVOCATION_CHECKING here, // since then the connection may be reused without checking the cert. - url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | - net::LOAD_DO_NOT_SEND_COOKIES | - net::LOAD_DO_NOT_SEND_AUTH_DATA); + resource_request->url = check_url_; + resource_request->method = "HEAD"; + resource_request->load_flags = net::LOAD_DO_NOT_SAVE_COOKIES | + net::LOAD_DO_NOT_SEND_COOKIES | + net::LOAD_DO_NOT_SEND_AUTH_DATA; + + simple_url_loader_ = network::SimpleURLLoader::Create( + std::move(resource_request), traffic_annotation); // Don't follow redirects to prevent leaking URL data to HTTP sites. - url_fetcher_->SetStopOnRedirect(true); - url_fetcher_->Start(); + simple_url_loader_->SetOnRedirectCallback( + base::BindRepeating(&CommonNameMismatchHandler::OnSimpleLoaderRedirect, + base::Unretained(this))); + simple_url_loader_->SetOnResponseStartedCallback( + base::BindOnce(&CommonNameMismatchHandler::OnSimpleLoaderResponseStarted, + base::Unretained(this))); + simple_url_loader_->DownloadToString( + url_loader_factory_.get(), + base::BindOnce(&CommonNameMismatchHandler::OnSimpleLoaderComplete, + base::Unretained(this)), + 1 /*max_body_size*/); } // static @@ -103,36 +119,45 @@ } void CommonNameMismatchHandler::Cancel() { - url_fetcher_.reset(); + simple_url_loader_.reset(); check_url_callback_.Reset(); } -void CommonNameMismatchHandler::OnURLFetchComplete( - const net::URLFetcher* source) { +void CommonNameMismatchHandler::OnSimpleLoaderRedirect( + const net::RedirectInfo& redirect_info, + const network::ResourceResponseHead& response_head) { + OnSimpleLoaderResponseStarted(redirect_info.new_url, response_head); +} + +void CommonNameMismatchHandler::OnSimpleLoaderResponseStarted( + const GURL& final_url, + const network::ResourceResponseHead& response_head) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(IsCheckingSuggestedUrl()); - DCHECK_EQ(url_fetcher_.get(), source); DCHECK(!check_url_callback_.is_null()); - DCHECK(!url_fetcher_.get()->GetStatus().is_io_pending()); SuggestedUrlCheckResult result = SUGGESTED_URL_NOT_AVAILABLE; - // Save a copy of |suggested_url| so it can be used after |url_fetcher_| - // is destroyed. - const GURL suggested_url = url_fetcher_->GetOriginalURL(); - const GURL landing_url = url_fetcher_->GetURL(); - // Make sure the |landing_url| is a HTTPS page and returns a proper response - // code. - if (url_fetcher_.get()->GetResponseCode() == 200 && - landing_url.SchemeIsCryptographic() && - landing_url.host() != request_url_.host()) { - DCHECK_EQ(landing_url.host(), suggested_url.host()); + // Make sure the URL is a HTTPS page and returns a proper response code. + int response_code = -1; + if (response_head.headers) { + response_code = response_head.headers->response_code(); + } + if (response_code == 200 && final_url.SchemeIsCryptographic() && + final_url.host() != request_url_.host()) { + DCHECK_EQ(final_url.host(), final_url.host()); result = SUGGESTED_URL_AVAILABLE; } - url_fetcher_.reset(); - base::ResetAndReturn(&check_url_callback_).Run(result, suggested_url); + simple_url_loader_.reset(); + base::ResetAndReturn(&check_url_callback_).Run(result, check_url_); +} + +void CommonNameMismatchHandler::OnSimpleLoaderComplete( + std::unique_ptr<std::string> response_body) { + OnSimpleLoaderResponseStarted(simple_url_loader_->GetFinalURL(), + *simple_url_loader_->ResponseInfo()); } bool CommonNameMismatchHandler::IsCheckingSuggestedUrl() const { - return !!url_fetcher_; + return !!simple_url_loader_; }
diff --git a/chrome/browser/ssl/common_name_mismatch_handler.h b/chrome/browser/ssl/common_name_mismatch_handler.h index d79f57ee..c417fd8 100644 --- a/chrome/browser/ssl/common_name_mismatch_handler.h +++ b/chrome/browser/ssl/common_name_mismatch_handler.h
@@ -10,21 +10,25 @@ #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/memory/scoped_refptr.h" #include "base/sequence_checker.h" #include "base/time/time.h" -#include "net/url_request/url_fetcher.h" -#include "net/url_request/url_fetcher_delegate.h" -#include "net/url_request/url_request_context_getter.h" #include "url/gurl.h" namespace net { -class URLFetcher; -} +struct RedirectInfo; +} // namespace net + +namespace network { +struct ResourceResponseHead; +class SharedURLLoaderFactory; +class SimpleURLLoader; +} // namespace network // This class handles errors due to common name mismatches // (|ERR_CERT_COMMON_NAME_INVALID|) and helps remediate them by suggesting // alternative URLs that may be what the user intended to load. -class CommonNameMismatchHandler : public net::URLFetcherDelegate { +class CommonNameMismatchHandler { public: enum SuggestedUrlCheckResult { // The request succeeds with good response code i.e. URL exists and its @@ -46,8 +50,8 @@ CommonNameMismatchHandler( const GURL& request_url, - const scoped_refptr<net::URLRequestContextGetter>& request_context); - ~CommonNameMismatchHandler() override; + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); + ~CommonNameMismatchHandler(); // Performs a network request to suggested URL. After completion, runs the // |callback|. @@ -73,17 +77,23 @@ void Cancel(); private: - // net::URLFetcherDelegate: - void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnSimpleLoaderRedirect( + const net::RedirectInfo& redirect_info, + const network::ResourceResponseHead& response_head); + void OnSimpleLoaderResponseStarted( + const GURL& final_url, + const network::ResourceResponseHead& response_head); + void OnSimpleLoaderComplete(std::unique_ptr<std::string> response_body); // Returns true if the check is currently running. bool IsCheckingSuggestedUrl() const; static TestingState testing_state_; const GURL request_url_; - scoped_refptr<net::URLRequestContextGetter> request_context_; + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; + GURL check_url_; CheckUrlCallback check_url_callback_; - std::unique_ptr<net::URLFetcher> url_fetcher_; + std::unique_ptr<network::SimpleURLLoader> simple_url_loader_; SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/ssl/mitm_software_blocking_page.cc b/chrome/browser/ssl/mitm_software_blocking_page.cc index 6a12332..b349df68 100644 --- a/chrome/browser/ssl/mitm_software_blocking_page.cc +++ b/chrome/browser/ssl/mitm_software_blocking_page.cc
@@ -79,6 +79,7 @@ std::make_unique<SSLErrorControllerClient>( web_contents, ssl_info, + cert_error, request_url, CreateMitmSoftwareMetricsHelper(web_contents, request_url))), callback_(callback),
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index ceb82253..1a8016d 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -147,6 +147,7 @@ std::make_unique<SSLErrorControllerClient>( web_contents, ssl_info, + cert_error, request_url, std::move(metrics_helper))), callback_(callback),
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index eb15ad97..d341da90 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -409,6 +409,30 @@ } } +void ExpectInterstitialElementHidden(content::WebContents* tab, + const std::string& element_id, + bool expect_hidden) { + if (!AreCommittedInterstitialsEnabled()) { + ASSERT_TRUE(tab->GetInterstitialPage()); + } + content::RenderFrameHost* frame = + AreCommittedInterstitialsEnabled() + ? tab->GetMainFrame() + : tab->GetInterstitialPage()->GetMainFrame(); + // Send CMD_TEXT_FOUND to indicate that the 'hidden' class is found, and + // CMD_TEXT_NOT_FOUND if not. + std::string command = base::StringPrintf( + "window.domAutomationController.send($('%s').classList.contains('hidden')" + " ? %d : %d);", + element_id.c_str(), security_interstitials::CMD_TEXT_FOUND, + security_interstitials::CMD_TEXT_NOT_FOUND); + int result = 0; + EXPECT_TRUE(content::ExecuteScriptAndExtractInt(frame, command, &result)); + EXPECT_EQ(expect_hidden ? security_interstitials::CMD_TEXT_FOUND + : security_interstitials::CMD_TEXT_NOT_FOUND, + result); +} + void ExpectInterstitialHeading(content::WebContents* tab, const std::string& expected_heading) { if (!AreCommittedInterstitialsEnabled()) { @@ -7488,6 +7512,60 @@ } } +class RecurrentInterstitialBrowserTest + : public CertVerifierBrowserTest, + public testing::WithParamInterface<bool> { + public: + RecurrentInterstitialBrowserTest() : CertVerifierBrowserTest() {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + CertVerifierBrowserTest::SetUpCommandLine(command_line); + if (GetParam()) { + command_line->AppendSwitch(switches::kCommittedInterstitials); + } + feature_list_.InitAndEnableFeatureWithParameters( + kRecurrentInterstitialFeature, {{"threshold", "2"}}); + } + + void SetUpOnMainThread() override { + CertVerifierBrowserTest::SetUpOnMainThread(); + host_resolver()->AddRule("*", "127.0.0.1"); + } + + void TearDownOnMainThread() override { + content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, + base::BindOnce(&CleanUpOnIOThread)); + CertVerifierBrowserTest::TearDownOnMainThread(); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +INSTANTIATE_TEST_CASE_P(, + RecurrentInterstitialBrowserTest, + ::testing::Values(false, true)); + +// Tests that a message is added to the interstitial when an error code recurs +// multiple times. +IN_PROC_BROWSER_TEST_P(RecurrentInterstitialBrowserTest, + RecurrentInterstitial) { + net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); + ASSERT_TRUE(https_server.Start()); + mock_cert_verifier()->set_default_result( + net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED); + ui_test_utils::NavigateToURL(browser(), https_server.GetURL("/")); + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); + WaitForInterstitial(tab); + ExpectInterstitialElementHidden(tab, "recurrent-error-message", + true /* expect_hidden */); + + ui_test_utils::NavigateToURL(browser(), https_server.GetURL("/")); + WaitForInterstitial(tab); + ExpectInterstitialElementHidden(tab, "recurrent-error-message", + false /* expect_hidden */); +} + // TODO(jcampan): more tests to do below. // Visit a page over https that contains a frame with a redirect.
diff --git a/chrome/browser/ssl/ssl_error_controller_client.cc b/chrome/browser/ssl/ssl_error_controller_client.cc index 401e999..3ac0936 100644 --- a/chrome/browser/ssl/ssl_error_controller_client.cc +++ b/chrome/browser/ssl/ssl_error_controller_client.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/interstitials/chrome_metrics_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" +#include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -133,6 +134,7 @@ SSLErrorControllerClient::SSLErrorControllerClient( content::WebContents* web_contents, const net::SSLInfo& ssl_info, + int cert_error, const GURL& request_url, std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper) : SecurityInterstitialControllerClient( @@ -143,7 +145,8 @@ g_browser_process->GetApplicationLocale(), GURL(chrome::kChromeUINewTabURL)), ssl_info_(ssl_info), - request_url_(request_url) {} + request_url_(request_url), + cert_error_(cert_error) {} SSLErrorControllerClient::~SSLErrorControllerClient() {} @@ -204,3 +207,10 @@ base::BindOnce(&LaunchDateAndTimeSettingsImpl)); #endif } + +bool SSLErrorControllerClient::HasSeenRecurrentError() { + ChromeSSLHostStateDelegate* state = + ChromeSSLHostStateDelegateFactory::GetForProfile( + Profile::FromBrowserContext(web_contents_->GetBrowserContext())); + return state->HasSeenRecurrentErrors(cert_error_); +}
diff --git a/chrome/browser/ssl/ssl_error_controller_client.h b/chrome/browser/ssl/ssl_error_controller_client.h index 258ff9be..18f9aff 100644 --- a/chrome/browser/ssl/ssl_error_controller_client.h +++ b/chrome/browser/ssl/ssl_error_controller_client.h
@@ -20,6 +20,7 @@ SSLErrorControllerClient( content::WebContents* web_contents, const net::SSLInfo& ssl_info, + int cert_error, const GURL& request_url, std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); ~SSLErrorControllerClient() override; @@ -29,10 +30,12 @@ void Proceed() override; bool CanLaunchDateAndTimeSettings() override; void LaunchDateAndTimeSettings() override; + bool HasSeenRecurrentError() override; private: const net::SSLInfo ssl_info_; const GURL request_url_; + const int cert_error_; DISALLOW_COPY_AND_ASSIGN(SSLErrorControllerClient); };
diff --git a/chrome/browser/ssl/ssl_error_handler.cc b/chrome/browser/ssl/ssl_error_handler.cc index 8f5e2f2..ccd7346 100644 --- a/chrome/browser/ssl/ssl_error_handler.cc +++ b/chrome/browser/ssl/ssl_error_handler.cc
@@ -36,13 +36,16 @@ #include "components/security_interstitials/core/ssl_error_ui.h" #include "components/ssl_errors/error_classification.h" #include "components/ssl_errors/error_info.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/render_frame_host.h" +#include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "net/base/net_errors.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h" #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) @@ -508,10 +511,11 @@ void SSLErrorHandlerDelegateImpl::CheckSuggestedUrl( const GURL& suggested_url, const CommonNameMismatchHandler::CheckUrlCallback& callback) { - scoped_refptr<net::URLRequestContextGetter> request_context( - profile_->GetRequestContext()); + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory( + content::BrowserContext::GetDefaultStoragePartition(profile_) + ->GetURLLoaderFactoryForBrowserProcess()); common_name_mismatch_handler_.reset( - new CommonNameMismatchHandler(request_url_, request_context)); + new CommonNameMismatchHandler(request_url_, url_loader_factory)); common_name_mismatch_handler_->CheckSuggestedUrl(suggested_url, callback); } @@ -532,7 +536,7 @@ // Show captive portal blocking page. The interstitial owns the blocking page. OnBlockingPageReady(new CaptivePortalBlockingPage( web_contents_, request_url_, landing_url, std::move(ssl_cert_reporter_), - ssl_info_, decision_callback_)); + ssl_info_, cert_error_, decision_callback_)); } void SSLErrorHandlerDelegateImpl::ShowMITMSoftwareInterstitial(
diff --git a/chrome/browser/sync/sessions/browser_list_router_helper_unittest.cc b/chrome/browser/sync/sessions/browser_list_router_helper_unittest.cc index a292de5..9e88556a 100644 --- a/chrome/browser/sync/sessions/browser_list_router_helper_unittest.cc +++ b/chrome/browser/sync/sessions/browser_list_router_helper_unittest.cc
@@ -8,8 +8,12 @@ #include <vector> #include "base/stl_util.h" +#include "base/test/simple_test_tick_clock.h" +#include "base/test/test_mock_time_task_runner.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/resource_coordinator/tab_lifecycle_unit.h" #include "chrome/browser/resource_coordinator/tab_manager.h" +#include "chrome/browser/resource_coordinator/time.h" #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router.h" #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.h" #include "chrome/browser/ui/browser_list.h" @@ -42,8 +46,6 @@ class BrowserListRouterHelperTest : public BrowserWithTestWindowTest { protected: - ~BrowserListRouterHelperTest() override {} - MockLocalSessionEventHandler handler_1; MockLocalSessionEventHandler handler_2; }; @@ -137,8 +139,24 @@ handler_1.seen_urls()->clear(); handler_1.seen_ids()->clear(); - g_browser_process->GetTabManager()->DiscardTabByExtension( - browser()->tab_strip_model()->GetWebContentsAt(0)); + { + auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); + base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner); + resource_coordinator::ScopedSetTickClockForTesting scoped_set_tick_clock( + task_runner->GetMockTickClock()); + + g_browser_process->GetTabManager()->DiscardTabByExtension( + browser()->tab_strip_model()->GetWebContentsAt(0)); + + // After a tab goes through a non-urgent discard, such as by an extension, + // it is frozen prior to being fully discarded. + // kProactiveDiscardFreezeTimeout is the duration before the tab finishes + // discarding after beginning a discard. Fast forward + // kProactiveDiscardFreezeTimeout amount of time to ensure the discard is + // complete. + task_runner->FastForwardBy( + resource_coordinator::kProactiveDiscardFreezeTimeout); + } // We're typically notified twice while discarding tabs. Once for the // destruction of the old web contents, and once for the new. This test case
diff --git a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc index c8b6ad8..755757f 100644 --- a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
@@ -6,6 +6,7 @@ #include "base/macros.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/test/integration/bookmarks_helper.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" @@ -14,9 +15,11 @@ #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/url_and_title.h" #include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/test/fake_server/bookmark_entity_builder.h" #include "components/sync/test/fake_server/entity_builder_factory.h" #include "components/sync/test/fake_server/fake_server_verifier.h" +#include "testing/gtest/include/gtest/gtest.h" #include "ui/base/layout.h" using bookmarks::BookmarkModel; @@ -45,6 +48,22 @@ // SyncTest and using it in all single client tests. const int kSingleProfileIndex = 0; +// Class that enables or disables USS based on test parameter. Must be the first +// base class of the test fixture. +class UssSwitchToggler : public testing::WithParamInterface<bool> { + public: + UssSwitchToggler() { + if (GetParam()) { + override_features_.InitAndEnableFeature(switches::kSyncUSSBookmarks); + } else { + override_features_.InitAndDisableFeature(switches::kSyncUSSBookmarks); + } + } + + private: + base::test::ScopedFeatureList override_features_; +}; + class SingleClientBookmarksSyncTest : public SyncTest { public: SingleClientBookmarksSyncTest() : SyncTest(SINGLE_CLIENT) {} @@ -76,6 +95,19 @@ } } +// TODO(crbug.com/516866): Merge the two fixtures into one when all tests are +// passing for USS. +class SingleClientBookmarksSyncTestIncludingUssTests + : public UssSwitchToggler, + public SingleClientBookmarksSyncTest { + public: + SingleClientBookmarksSyncTestIncludingUssTests(){}; + ~SingleClientBookmarksSyncTestIncludingUssTests() override {} + + private: + DISALLOW_COPY_AND_ASSIGN(SingleClientBookmarksSyncTestIncludingUssTests); +}; + IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; @@ -360,7 +392,8 @@ ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); } -IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, DownloadBookmark) { +IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTestIncludingUssTests, + DownloadBookmark) { std::string title = "Patrick Star"; fake_server::EntityBuilderFactory entity_builder_factory; fake_server::BookmarkEntityBuilder bookmark_builder = @@ -463,3 +496,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; } + +INSTANTIATE_TEST_CASE_P(USS, + SingleClientBookmarksSyncTestIncludingUssTests, + ::testing::Values(false, true));
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index e7da097d..234552a 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2702,7 +2702,8 @@ } if (use_ozone) { sources += [ - "views/frame/browser_desktop_window_tree_host_ozone.cc", + "views/frame/browser_desktop_window_tree_host_platform.cc", + "views/frame/browser_desktop_window_tree_host_platform.h", "views/frame/native_browser_frame_factory_ozone.cc", ] } else { @@ -3937,6 +3938,8 @@ if (toolkit_views) { deps += [ "//ui/views:test_support" ] sources += [ + "../../test/views/scoped_macviews_browser_mode.cc", + "../../test/views/scoped_macviews_browser_mode.h", "extensions/browser_action_test_util.h", "views/payments/test_chrome_payment_request_delegate.cc", "views/payments/test_chrome_payment_request_delegate.h",
diff --git a/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc index cc47bbf..6be99d48 100644 --- a/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc +++ b/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc
@@ -9,14 +9,9 @@ #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/mus_property_mirror_ash.h" #include "ash/public/cpp/shelf_model.h" -#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/cpp/window_state_type.h" #include "ash/public/interfaces/constants.mojom.h" #include "ash/public/interfaces/process_creation_time_recorder.mojom.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" -#include "ash/public/interfaces/window_properties.mojom.h" -#include "ash/public/interfaces/window_state_type.mojom.h" #include "ash/shell.h" #include "base/command_line.h" #include "chrome/browser/browser_process.h" @@ -137,56 +132,12 @@ if (chromeos::GetAshConfig() == ash::Config::MASH) { // ash::Shell will not be created because ash is running out-of-process. ash::Shell::SetIsBrowserProcessWithMash(); - // Register ash-specific window properties with Chrome's property converter. - // This propagates ash properties set on chrome windows to ash, via mojo. DCHECK(views::MusClient::Exists()); views::MusClient* mus_client = views::MusClient::Get(); aura::WindowTreeClientDelegate* delegate = mus_client; - aura::PropertyConverter* converter = delegate->GetPropertyConverter(); - - converter->RegisterPrimitiveProperty( - ash::kCanConsumeSystemKeysKey, - ash::mojom::kCanConsumeSystemKeys_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - converter->RegisterImageSkiaProperty( - ash::kFrameImageActiveKey, ash::mojom::kFrameImageActive_Property); - converter->RegisterPrimitiveProperty( - ash::kHideShelfWhenFullscreenKey, - ash::mojom::kHideShelfWhenFullscreen_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - converter->RegisterPrimitiveProperty( - ash::kPanelAttachedKey, - ui::mojom::WindowManager::kPanelAttached_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - converter->RegisterPrimitiveProperty( - ash::kShelfItemTypeKey, - ui::mojom::WindowManager::kShelfItemType_Property, - base::Bind(&ash::IsValidShelfItemType)); - converter->RegisterPrimitiveProperty( - ash::kWindowStateTypeKey, ash::mojom::kWindowStateType_Property, - base::Bind(&ash::IsValidWindowStateType)); - converter->RegisterPrimitiveProperty( - ash::kWindowPinTypeKey, ash::mojom::kWindowPinType_Property, - base::Bind(&ash::IsValidWindowPinType)); - converter->RegisterPrimitiveProperty( - ash::kWindowPositionManagedTypeKey, - ash::mojom::kWindowPositionManaged_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - converter->RegisterStringProperty( - ash::kShelfIDKey, ui::mojom::WindowManager::kShelfID_Property); - converter->RegisterPrimitiveProperty( - ash::kRestoreBoundsOverrideKey, - ash::mojom::kRestoreBoundsOverride_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - converter->RegisterPrimitiveProperty( - ash::kRestoreWindowStateTypeOverrideKey, - ash::mojom::kRestoreWindowStateTypeOverride_Property, - base::BindRepeating(&ash::IsValidWindowStateType)); - converter->RegisterPrimitiveProperty( - ash::kWindowTitleShownKey, - ui::mojom::WindowManager::kWindowTitleShown_Property, - aura::PropertyConverter::CreateAcceptAnyValueCallback()); - + // Register ash-specific window properties with Chrome's property converter. + // Values of registered properties will be transported between the services. + ash::RegisterWindowProperties(delegate->GetPropertyConverter()); mus_client->SetMusPropertyMirror( std::make_unique<ash::MusPropertyMirrorAsh>()); }
diff --git a/chrome/browser/ui/cocoa/test/cocoa_test_helper.h b/chrome/browser/ui/cocoa/test/cocoa_test_helper.h index 95371bc..4b1e564 100644 --- a/chrome/browser/ui/cocoa/test/cocoa_test_helper.h +++ b/chrome/browser/ui/cocoa/test/cocoa_test_helper.h
@@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> +#include "chrome/test/views/scoped_macviews_browser_mode.h" #import "ui/base/test/cocoa_helper.h" // A test class that all tests that depend on AppKit should inherit from. @@ -25,6 +26,9 @@ static void BootstrapCocoa(); CocoaTest(); + + private: + test::ScopedMacViewsBrowserMode cocoa_mode_{false}; }; #endif // CHROME_BROWSER_UI_COCOA_TEST_COCOA_TEST_HELPER_H_
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 3a472ef..16fad34 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -678,7 +678,16 @@ } // See http://crbug.com/431575. -IN_PROC_BROWSER_TEST_F(OmniboxViewTest, ClearUserTextAfterBackgroundCommit) { +// Flaky on Mac (crbug.com/841195). +#if defined(OS_MACOSX) +#define MAYBE_ClearUserTextAfterBackgroundCommit \ + DISABLED_ClearUserTextAfterBackgroundCommit +#else +#define MAYBE_ClearUserTextAfterBackgroundCommit \ + ClearUserTextAfterBackgroundCommit +#endif +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, + MAYBE_ClearUserTextAfterBackgroundCommit) { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc index 1cf0fdd..afb884bb 100644 --- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc +++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
@@ -96,10 +96,8 @@ } void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { -#if defined(USE_AURA) && !defined(OS_CHROMEOS) && !defined(USE_OZONE) - // The screen may have already been set in test initialization. - if (!display::Screen::GetScreen()) - display::Screen::SetScreenInstance(views::CreateDesktopScreen()); +#if defined(USE_AURA) + views::InstallDesktopScreenIfNecessary(); #endif // TODO(pkasting): Try to move ViewsDelegate creation here as well;
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_ozone.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_ozone.cc deleted file mode 100644 index 20ed0fb..0000000 --- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_ozone.cc +++ /dev/null
@@ -1,20 +0,0 @@ -// Copyright 2016 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 "base/logging.h" -#include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host.h" - -//////////////////////////////////////////////////////////////////////////////// -// BrowserDesktopWindowTreeHost, public: - -// static -BrowserDesktopWindowTreeHost* -BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( - views::internal::NativeWidgetDelegate* native_widget_delegate, - views::DesktopNativeWidgetAura* desktop_native_widget_aura, - BrowserView* browser_view, - BrowserFrame* browser_frame) { - NOTREACHED(); - return nullptr; -}
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.cc new file mode 100644 index 0000000..e85daa19 --- /dev/null +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.cc
@@ -0,0 +1,46 @@ +// 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 "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.h" + +//////////////////////////////////////////////////////////////////////////////// +//// BrowserDesktopWindowTreeHostPlatform, public: + +BrowserDesktopWindowTreeHostPlatform::BrowserDesktopWindowTreeHostPlatform( + views::internal::NativeWidgetDelegate* native_widget_delegate, + views::DesktopNativeWidgetAura* desktop_native_widget_aura, + BrowserView* browser_view, + BrowserFrame* browser_frame) + : DesktopWindowTreeHostPlatform(native_widget_delegate, + desktop_native_widget_aura) {} + +BrowserDesktopWindowTreeHostPlatform::~BrowserDesktopWindowTreeHostPlatform() {} + +views::DesktopWindowTreeHost* +BrowserDesktopWindowTreeHostPlatform::AsDesktopWindowTreeHost() { + return this; +} + +int BrowserDesktopWindowTreeHostPlatform::GetMinimizeButtonOffset() const { + return 0; +} + +bool BrowserDesktopWindowTreeHostPlatform::UsesNativeSystemMenu() const { + return false; +} + +//////////////////////////////////////////////////////////////////////////////// +// BrowserDesktopWindowTreeHost, public: + +// static +BrowserDesktopWindowTreeHost* +BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( + views::internal::NativeWidgetDelegate* native_widget_delegate, + views::DesktopNativeWidgetAura* desktop_native_widget_aura, + BrowserView* browser_view, + BrowserFrame* browser_frame) { + return new BrowserDesktopWindowTreeHostPlatform(native_widget_delegate, + desktop_native_widget_aura, + browser_view, browser_frame); +}
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.h b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.h new file mode 100644 index 0000000..455d642 --- /dev/null +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.h
@@ -0,0 +1,42 @@ +// 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 CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_DESKTOP_WINDOW_TREE_HOST_PLATFORM_H_ +#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_DESKTOP_WINDOW_TREE_HOST_PLATFORM_H_ + +#include "base/macros.h" +#include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host.h" +#include "ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h" + +class BrowserFrame; +class BrowserView; + +namespace views { +class DesktopNativeWidgetAura; +} + +// Platform independent frame implementation. Utilizes +// DesktopWindowTreeHostPlatform, which uses PlatformWindow with different +// backends like ozone and others. +class BrowserDesktopWindowTreeHostPlatform + : public BrowserDesktopWindowTreeHost, + public views::DesktopWindowTreeHostPlatform { + public: + BrowserDesktopWindowTreeHostPlatform( + views::internal::NativeWidgetDelegate* native_widget_delegate, + views::DesktopNativeWidgetAura* desktop_native_widget_aura, + BrowserView* browser_view, + BrowserFrame* browser_frame); + ~BrowserDesktopWindowTreeHostPlatform() override; + + private: + // Overridden from BrowserDesktopWindowTreeHost: + views::DesktopWindowTreeHost* AsDesktopWindowTreeHost() override; + int GetMinimizeButtonOffset() const override; + bool UsesNativeSystemMenu() const override; + + DISALLOW_COPY_AND_ASSIGN(BrowserDesktopWindowTreeHostPlatform); +}; + +#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_DESKTOP_WINDOW_TREE_HOST_PLATFORM_H_
diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_ozone.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_ozone.cc index e1ab238f..9595d56 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory_ozone.cc +++ b/chrome/browser/ui/views/frame/native_browser_frame_factory_ozone.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" #include "chrome/browser/ui/views/frame/browser_frame_mus.h" +#include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" #include "ui/aura/env.h" NativeBrowserFrame* NativeBrowserFrameFactory::Create( @@ -12,7 +13,5 @@ BrowserView* browser_view) { if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) return new BrowserFrameMus(browser_frame, browser_view); - - NOTREACHED() << "For Ozone builds, only mash launch is supported for now."; - return nullptr; + return new DesktopBrowserFrameAura(browser_frame, browser_view); }
diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc index 1247f60..883e78da 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.cc +++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc
@@ -39,6 +39,7 @@ : InfoBarView(std::move(delegate)) { auto* delegate_ptr = GetDelegate(); label_ = CreateLabel(delegate_ptr->GetMessageText()); + label_->SetElideBehavior(delegate_ptr->GetMessageElideBehavior()); AddChildView(label_); const auto buttons = delegate_ptr->GetButtons();
diff --git a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc index 3ae09a4..1108151 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/ui/views/omnibox/omnibox_match_cell_view.h" +#include <algorithm> + #include "base/macros.h" #include "base/metrics/field_trial_params.h" #include "chrome/browser/ui/layout_constants.h" @@ -150,7 +152,6 @@ // OmniboxMatchCellView: OmniboxMatchCellView::OmniboxMatchCellView(OmniboxResultView* result_view, - const gfx::FontList& font_list, int text_height) : is_old_style_answer_(false), is_rich_suggestion_(false), @@ -158,9 +159,9 @@ text_height_(text_height) { AddChildView(icon_view_ = new OmniboxImageView()); AddChildView(image_view_ = new OmniboxImageView()); - AddChildView(content_view_ = new OmniboxTextView(result_view, font_list)); - AddChildView(description_view_ = new OmniboxTextView(result_view, font_list)); - AddChildView(separator_view_ = new OmniboxTextView(result_view, font_list)); + AddChildView(content_view_ = new OmniboxTextView(result_view)); + AddChildView(description_view_ = new OmniboxTextView(result_view)); + AddChildView(separator_view_ = new OmniboxTextView(result_view)); const base::string16& separator = l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); @@ -172,10 +173,8 @@ gfx::Size OmniboxMatchCellView::CalculatePreferredSize() const { int height = text_height_ + GetVerticalInsets(text_height_, is_old_style_answer_).height(); - if (is_rich_suggestion_) { - height += text_height_; - } else if (is_old_style_answer_) { - height += GetOldStyleAnswerHeight(); + if (is_rich_suggestion_ || is_old_style_answer_) { + height += GetDescriptionHeight(); } return gfx::Size(0, height); } @@ -184,7 +183,7 @@ return false; } -int OmniboxMatchCellView::GetOldStyleAnswerHeight() const { +int OmniboxMatchCellView::GetDescriptionHeight() const { int icon_width = icon_view_->width(); int answer_icon_size = image_view_->visible() ? image_view_->height() + kAnswerIconToTextPadding @@ -243,8 +242,7 @@ } void OmniboxMatchCellView::LayoutOldStyleAnswer() { - const int start_x = GetIconAlignmentOffset() + HorizontalPadding(); - int x = start_x; + int x = GetIconAlignmentOffset() + HorizontalPadding(); int y = GetVerticalInsets(text_height_, /*is_old_style_answer=*/true).top(); icon_view_->SetSize(icon_view_->CalculatePreferredSize()); icon_view_->SetPosition( @@ -256,8 +254,7 @@ // The description may be multi-line. Using the view height results in // an image that's too large, so we use the line height here instead. int image_edge_length = description_view_->GetLineHeight(); - image_view_->SetBounds(start_x + icon_view_->width() + HorizontalPadding(), - y + (kVerticalPadding / 2), image_edge_length, + image_view_->SetBounds(x, y + (kVerticalPadding / 2), image_edge_length, image_edge_length); image_view_->SetImageSize(gfx::Size(image_edge_length, image_edge_length)); x += image_view_->width() + kAnswerIconToTextPadding; @@ -278,7 +275,11 @@ x += kRichImageSize + HorizontalPadding(); content_view_->SetBounds(x, y, width() - x, text_height_); y += text_height_; - description_view_->SetBounds(x, y, width() - x, text_height_); + int description_width = width() - x; + description_view_->SetBounds( + x, y, description_width, + description_view_->GetHeightForWidth(description_width) + + kVerticalPadding); } void OmniboxMatchCellView::LayoutSplit() {
diff --git a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.h b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.h index f826c66..f8cbeef7 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.h +++ b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.h
@@ -7,10 +7,6 @@ #include "ui/views/view.h" -namespace gfx { -class FontList; -} - namespace views { class ImageView; } @@ -22,7 +18,6 @@ class OmniboxMatchCellView : public views::View { public: explicit OmniboxMatchCellView(OmniboxResultView* result_view, - const gfx::FontList& font_list, int text_height); ~OmniboxMatchCellView() override; @@ -45,7 +40,7 @@ const char* GetClassName() const override; // Returns the height of the the description section of answer suggestions. - int GetOldStyleAnswerHeight() const; + int GetDescriptionHeight() const; void LayoutOldStyleAnswer(); void LayoutRichSuggestion();
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index 56514ec..03fd742 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -97,9 +97,8 @@ CHECK_GE(model_index, 0); AddChildView(suggestion_view_ = - new OmniboxMatchCellView(this, font_list, GetTextHeight())); - AddChildView(keyword_view_ = - new OmniboxMatchCellView(this, font_list, GetTextHeight())); + new OmniboxMatchCellView(this, GetTextHeight())); + AddChildView(keyword_view_ = new OmniboxMatchCellView(this, GetTextHeight())); keyword_view_->icon()->EnableCanvasFlippingForRTLUI(true); keyword_view_->icon()->SetImage(gfx::CreateVectorIcon(
diff --git a/chrome/browser/ui/views/omnibox/omnibox_text_view.cc b/chrome/browser/ui/views/omnibox/omnibox_text_view.cc index 2bb77858..d243db0 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_text_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_text_view.cc
@@ -126,13 +126,8 @@ } // namespace -OmniboxTextView::OmniboxTextView(OmniboxResultView* result_view, - const gfx::FontList& font_list) - : result_view_(result_view), - font_height_(std::max( - font_list.GetHeight(), - font_list.DeriveWithWeight(gfx::Font::Weight::BOLD).GetHeight())), - wrap_text_lines_(false) {} +OmniboxTextView::OmniboxTextView(OmniboxResultView* result_view) + : result_view_(result_view), font_height_(0), wrap_text_lines_(false) {} OmniboxTextView::~OmniboxTextView() {} @@ -155,7 +150,7 @@ return 0; // If text wrapping is not called for we can simply return the font height. if (!wrap_text_lines_) { - return font_height_; + return GetLineHeight(); } render_text_->SetDisplayRect(gfx::Rect(width, 0)); gfx::Size string_size = render_text_->GetStringSize(); @@ -227,11 +222,13 @@ const ACMatchClassifications& classifications) { render_text_.reset(); render_text_ = CreateClassifiedRenderText(text, classifications); + UpdateLineHeight(); } void OmniboxTextView::SetText(const base::string16& text) { render_text_.reset(); render_text_ = CreateRenderText(text); + UpdateLineHeight(); } void OmniboxTextView::SetText(const SuggestionAnswer::ImageLine& line) { @@ -242,7 +239,7 @@ // sizes or use multiple RenderTexts. render_text_.reset(); render_text_ = CreateText(line, GetFontForType(line.text_fields()[0].type())); - font_height_ = render_text_->font_list().GetHeight(); + UpdateLineHeight(); } std::unique_ptr<gfx::RenderText> OmniboxTextView::CreateText( @@ -334,3 +331,10 @@ int OmniboxTextView::GetLineHeight() const { return font_height_; } + +void OmniboxTextView::UpdateLineHeight() { + font_height_ = std::max(render_text_->font_list().GetHeight(), + render_text_->font_list() + .DeriveWithWeight(gfx::Font::Weight::BOLD) + .GetHeight()); +}
diff --git a/chrome/browser/ui/views/omnibox/omnibox_text_view.h b/chrome/browser/ui/views/omnibox/omnibox_text_view.h index 855321c2..ee16eb19 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_text_view.h +++ b/chrome/browser/ui/views/omnibox/omnibox_text_view.h
@@ -26,8 +26,7 @@ // as selection) and more specific features (such as suggestion answer styling). class OmniboxTextView : public views::View { public: - explicit OmniboxTextView(OmniboxResultView* result_view, - const gfx::FontList& font_list); + explicit OmniboxTextView(OmniboxResultView* result_view); ~OmniboxTextView() override; // views::View. @@ -82,6 +81,8 @@ int text_type, bool is_bold) const; + void UpdateLineHeight(); + // To get color values. OmniboxResultView* result_view_;
diff --git a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc index f206b4b8..3c9239dbe 100644 --- a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc
@@ -194,8 +194,9 @@ std::unique_ptr<views::View> PaymentHandlerWebFlowViewController::CreateHeaderContentView() { - const GURL origin = - web_contents() ? web_contents()->GetVisibleURL().GetOrigin() : GURL(); + const GURL origin = web_contents() + ? web_contents()->GetVisibleURL().GetOrigin() + : target_.GetOrigin(); std::unique_ptr<views::Background> background = GetHeaderBackground(); return std::make_unique<ReadOnlyOriginView>( GetSheetTitle(), origin, @@ -224,6 +225,11 @@ } } +void PaymentHandlerWebFlowViewController::DidStartNavigation( + content::NavigationHandle* navigation_handle) { + UpdateHeaderView(); +} + void PaymentHandlerWebFlowViewController::DidFinishNavigation( content::NavigationHandle* navigation_handle) { if (!OriginSecurityChecker::IsOriginSecure(navigation_handle->GetURL()) ||
diff --git a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h index d228eba..83568ef 100644 --- a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h +++ b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.h
@@ -48,6 +48,8 @@ void ButtonPressed(views::Button* sender, const ui::Event& event) override; // content::WebContentsObserver: + void DidStartNavigation( + content::NavigationHandle* navigation_handle) override; void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; void TitleWasSet(content::NavigationEntry* entry) override;
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index 572f66c..5fbf984c 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -114,6 +114,7 @@ login_url, nullptr, ssl_info, + net::ERR_CERT_COMMON_NAME_INVALID, callback), is_wifi_(is_wifi), wifi_ssid_(wifi_ssid) {}
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 61523da..e04d21cc 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
@@ -195,6 +195,7 @@ {"delayBeforeClickShort", IDS_SETTINGS_DELAY_BEFORE_CLICK_SHORT}, {"delayBeforeClickLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_LONG}, {"delayBeforeClickVeryLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_VERY_LONG}, + {"dictationLabel", IDS_SETTINGS_ACCESSIBILITY_DICTATION_LABEL}, {"onScreenKeyboardLabel", IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL}, {"monoAudioLabel", IDS_SETTINGS_MONO_AUDIO_LABEL}, {"a11yExplanation", IDS_SETTINGS_ACCESSIBILITY_EXPLANATION}, @@ -224,6 +225,8 @@ {"appearanceSettingsDescription", IDS_SETTINGS_ACCESSIBILITY_APPEARANCE_SETTINGS_DESCRIPTION}, {"keyboardHeading", IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_HEADING}, + {"keyboardAndTextInputHeading", + IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_AND_TEXT_INPUT_HEADING}, {"keyboardSettingsTitle", IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE}, {"keyboardSettingsDescription",
diff --git a/chrome/browser/vr/BUILD.gn b/chrome/browser/vr/BUILD.gn index 72e907b..f94f1d4 100644 --- a/chrome/browser/vr/BUILD.gn +++ b/chrome/browser/vr/BUILD.gn
@@ -77,6 +77,8 @@ "elements/paged_grid_layout.h", "elements/paged_scroll_view.cc", "elements/paged_scroll_view.h", + "elements/platform_ui_element.cc", + "elements/platform_ui_element.h", "elements/rect.cc", "elements/rect.h", "elements/render_text_wrapper.cc",
diff --git a/chrome/browser/vr/elements/content_element.cc b/chrome/browser/vr/elements/content_element.cc index b938ba9..1dcd1d4 100644 --- a/chrome/browser/vr/elements/content_element.cc +++ b/chrome/browser/vr/elements/content_element.cc
@@ -4,8 +4,9 @@ #include "chrome/browser/vr/elements/content_element.h" +#include "chrome/browser/vr/content_input_delegate.h" #include "chrome/browser/vr/model/text_input_info.h" -#include "chrome/browser/vr/ui_element_renderer.h" +#include "chrome/browser/vr/text_input_delegate.h" #include "chrome/browser/vr/ui_scene_constants.h" #include "chrome/browser/vr/vr_gl_util.h" #include "third_party/blink/public/platform/web_gesture_event.h" @@ -38,35 +39,35 @@ ContentElement::ContentElement( ContentInputDelegate* delegate, ContentElement::ScreenBoundsChangedCallback bounds_changed_callback) - : delegate_(delegate), bounds_changed_callback_(bounds_changed_callback) { - DCHECK(delegate); - set_scrollable(true); -} + : PlatformUiElement(delegate), + bounds_changed_callback_(bounds_changed_callback) {} ContentElement::~ContentElement() = default; void ContentElement::Render(UiElementRenderer* renderer, const CameraModel& model) const { gfx::RectF copy_rect(0, 0, 1, 1); - int overlay_texture_id = overlay_texture_non_empty_ ? overlay_texture_id_ : 0; - int texture_id = texture_id_; - bool blend = true; if (uses_quad_layer_) { - texture_id = 0; - overlay_texture_id = 0; - blend = false; + renderer->DrawTexturedQuad(0, 0, texture_location(), + model.view_proj_matrix * world_space_transform(), + copy_rect, computed_opacity(), size(), + corner_radius(), false); + return; } - if (uses_quad_layer_ || texture_id_ || overlay_texture_id) { + + unsigned int overlay_texture_id = + overlay_texture_non_empty_ ? overlay_texture_id_ : 0; + if (texture_id() || overlay_texture_id) { renderer->DrawTexturedQuad( - texture_id, overlay_texture_id, texture_location_, + texture_id(), overlay_texture_id, texture_location(), model.view_proj_matrix * world_space_transform(), copy_rect, - computed_opacity(), size(), corner_radius(), blend); + computed_opacity(), size(), corner_radius(), true); } } void ContentElement::OnFocusChanged(bool focused) { - if (delegate_) - delegate_->OnFocusChanged(focused); + if (delegate()) + delegate()->OnFocusChanged(focused); focused_ = focused; if (event_handlers_.focus_change) @@ -74,73 +75,13 @@ } void ContentElement::OnInputEdited(const EditedText& info) { - delegate_->OnWebInputEdited(info, false); + if (delegate()) + delegate()->OnWebInputEdited(info, false); } void ContentElement::OnInputCommitted(const EditedText& info) { - delegate_->OnWebInputEdited(info, true); -} - -void ContentElement::OnHoverEnter(const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentEnter(position); -} - -void ContentElement::OnHoverLeave() { - if (delegate_) - delegate_->OnContentLeave(); -} - -void ContentElement::OnMove(const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentMove(position); -} - -void ContentElement::OnButtonDown(const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentDown(position); -} - -void ContentElement::OnButtonUp(const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentUp(position); -} - -void ContentElement::OnFlingCancel( - std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentFlingCancel(std::move(gesture), position); -} - -void ContentElement::OnScrollBegin( - std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentScrollBegin(std::move(gesture), position); -} - -void ContentElement::OnScrollUpdate( - std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentScrollUpdate(std::move(gesture), position); -} - -void ContentElement::OnScrollEnd( - std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) { - if (delegate_) - delegate_->OnContentScrollEnd(std::move(gesture), position); -} - -void ContentElement::SetTextureId(unsigned int texture_id) { - texture_id_ = texture_id; -} - -void ContentElement::SetTextureLocation( - UiElementRenderer::TextureLocation location) { - texture_location_ = location; + if (delegate()) + delegate()->OnWebInputEdited(info, true); } void ContentElement::SetOverlayTextureId(unsigned int texture_id) { @@ -244,10 +185,6 @@ return false; } -void ContentElement::SetDelegate(ContentInputDelegate* delegate) { - delegate_ = delegate; -} - void ContentElement::SetUsesQuadLayer(bool uses_quad_layer) { uses_quad_layer_ = uses_quad_layer; }
diff --git a/chrome/browser/vr/elements/content_element.h b/chrome/browser/vr/elements/content_element.h index 93e8277..27b27b5 100644 --- a/chrome/browser/vr/elements/content_element.h +++ b/chrome/browser/vr/elements/content_element.h
@@ -6,36 +6,30 @@ #define CHROME_BROWSER_VR_ELEMENTS_CONTENT_ELEMENT_H_ #include "base/macros.h" -#include "chrome/browser/vr/content_input_delegate.h" -#include "chrome/browser/vr/elements/ui_element.h" -#include "chrome/browser/vr/text_input_delegate.h" +#include "chrome/browser/vr/elements/platform_ui_element.h" #include "chrome/browser/vr/ui_element_renderer.h" namespace vr { -class ContentElement : public UiElement { +class ContentInputDelegate; +class TextInputDelegate; + +// This element hosts the texture of a web page and surfaces all frames of the +// web page to VR. It also dispatches events to the page it hosts. +// It may also surface frames of overlays on a web page which usually displayed +// by Chrome (such as infobar after download a file). +// If quad layer is set, it stops surface frames of web page but instead draws +// transparent in UI. So the web page in quad layer can be later composited to +// the UI. +class ContentElement : public PlatformUiElement { public: - typedef typename base::Callback<void(const gfx::SizeF&)> + typedef typename base::RepeatingCallback<void(const gfx::SizeF&)> ScreenBoundsChangedCallback; ContentElement(ContentInputDelegate* delegate, ScreenBoundsChangedCallback); ~ContentElement() override; - void OnHoverEnter(const gfx::PointF& position) override; - void OnHoverLeave() override; - void OnMove(const gfx::PointF& position) override; - void OnButtonDown(const gfx::PointF& position) override; - void OnButtonUp(const gfx::PointF& position) override; - void OnFlingCancel(std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) override; - void OnScrollBegin(std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) override; - void OnScrollUpdate(std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) override; - void OnScrollEnd(std::unique_ptr<blink::WebGestureEvent> gesture, - const gfx::PointF& position) override; bool OnBeginFrame(const gfx::Transform& head_pose) override; - void Render(UiElementRenderer* renderer, const CameraModel& model) const final; void OnFocusChanged(bool focused) override; @@ -45,24 +39,17 @@ void RequestUnfocus() override; void UpdateInput(const EditedText& info) override; - void SetTextureId(unsigned int texture_id); - void SetTextureLocation(UiElementRenderer::TextureLocation location); void SetOverlayTextureId(unsigned int texture_id); void SetOverlayTextureLocation(UiElementRenderer::TextureLocation location); void SetOverlayTextureEmpty(bool empty); bool GetOverlayTextureEmpty(); void SetProjectionMatrix(const gfx::Transform& matrix); void SetTextInputDelegate(TextInputDelegate* text_input_delegate); - void SetDelegate(ContentInputDelegate* delegate); void SetUsesQuadLayer(bool uses_quad_layer); private: - ContentInputDelegate* delegate_ = nullptr; TextInputDelegate* text_input_delegate_ = nullptr; ScreenBoundsChangedCallback bounds_changed_callback_; - unsigned int texture_id_ = 0; - UiElementRenderer::TextureLocation texture_location_ = - UiElementRenderer::kTextureLocationExternal; unsigned int overlay_texture_id_ = 0; bool overlay_texture_non_empty_ = false; UiElementRenderer::TextureLocation overlay_texture_location_ =
diff --git a/chrome/browser/vr/elements/platform_ui_element.cc b/chrome/browser/vr/elements/platform_ui_element.cc new file mode 100644 index 0000000..bc07dcaa --- /dev/null +++ b/chrome/browser/vr/elements/platform_ui_element.cc
@@ -0,0 +1,98 @@ +// 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 "chrome/browser/vr/elements/content_element.h" + +#include "chrome/browser/vr/content_input_delegate.h" +#include "third_party/blink/public/platform/web_gesture_event.h" +#include "ui/gfx/geometry/rect_f.h" + +namespace vr { + +PlatformUiElement::PlatformUiElement(ContentInputDelegate* delegate) + : delegate_(delegate) { + DCHECK(delegate); + set_scrollable(true); +} + +PlatformUiElement::~PlatformUiElement() = default; + +void PlatformUiElement::Render(UiElementRenderer* renderer, + const CameraModel& model) const { + if (texture_id_) { + gfx::RectF copy_rect(0, 0, 1, 1); + renderer->DrawTexturedQuad(texture_id_, 0, texture_location_, + model.view_proj_matrix * world_space_transform(), + copy_rect, computed_opacity(), size(), + corner_radius(), true); + } +} + +void PlatformUiElement::OnHoverEnter(const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentEnter(position); +} + +void PlatformUiElement::OnHoverLeave() { + if (delegate_) + delegate_->OnContentLeave(); +} + +void PlatformUiElement::OnMove(const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentMove(position); +} + +void PlatformUiElement::OnButtonDown(const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentDown(position); +} + +void PlatformUiElement::OnButtonUp(const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentUp(position); +} + +void PlatformUiElement::OnFlingCancel( + std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentFlingCancel(std::move(gesture), position); +} + +void PlatformUiElement::OnScrollBegin( + std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentScrollBegin(std::move(gesture), position); +} + +void PlatformUiElement::OnScrollUpdate( + std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentScrollUpdate(std::move(gesture), position); +} + +void PlatformUiElement::OnScrollEnd( + std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) { + if (delegate_) + delegate_->OnContentScrollEnd(std::move(gesture), position); +} + +void PlatformUiElement::SetTextureId(unsigned int texture_id) { + texture_id_ = texture_id; +} + +void PlatformUiElement::SetTextureLocation( + UiElementRenderer::TextureLocation location) { + texture_location_ = location; +} + +void PlatformUiElement::SetDelegate(ContentInputDelegate* delegate) { + delegate_ = delegate; +} + +} // namespace vr
diff --git a/chrome/browser/vr/elements/platform_ui_element.h b/chrome/browser/vr/elements/platform_ui_element.h new file mode 100644 index 0000000..74664461 --- /dev/null +++ b/chrome/browser/vr/elements/platform_ui_element.h
@@ -0,0 +1,65 @@ +// 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 CHROME_BROWSER_VR_ELEMENTS_PLATFORM_UI_ELEMENT_H_ +#define CHROME_BROWSER_VR_ELEMENTS_PLATFORM_UI_ELEMENT_H_ + +#include "base/macros.h" +#include "chrome/browser/vr/elements/ui_element.h" +#include "chrome/browser/vr/ui_element_renderer.h" + +namespace vr { + +class ContentInputDelegate; + +// This element hosts the texture of a platform UI and surfaces all frames of +// the UI to VR. For example, on Android, any views UI can be drawn to a texture +// and then displayed by this element in VR. +// It also dispatches events to the platform UI. +class PlatformUiElement : public UiElement { + public: + explicit PlatformUiElement(ContentInputDelegate* delegate); + ~PlatformUiElement() override; + + void OnHoverEnter(const gfx::PointF& position) override; + void OnHoverLeave() override; + void OnMove(const gfx::PointF& position) override; + void OnButtonDown(const gfx::PointF& position) override; + void OnButtonUp(const gfx::PointF& position) override; + void OnFlingCancel(std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) override; + void OnScrollBegin(std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) override; + void OnScrollUpdate(std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) override; + void OnScrollEnd(std::unique_ptr<blink::WebGestureEvent> gesture, + const gfx::PointF& position) override; + + void Render(UiElementRenderer* renderer, + const CameraModel& model) const override; + + void SetTextureId(unsigned int texture_id); + void SetTextureLocation(UiElementRenderer::TextureLocation location); + + void SetDelegate(ContentInputDelegate* delegate); + + protected: + ContentInputDelegate* delegate() const { return delegate_; } + unsigned int texture_id() const { return texture_id_; } + UiElementRenderer::TextureLocation texture_location() const { + return texture_location_; + } + + private: + ContentInputDelegate* delegate_ = nullptr; + unsigned int texture_id_ = 0; + UiElementRenderer::TextureLocation texture_location_ = + UiElementRenderer::kTextureLocationExternal; + + DISALLOW_COPY_AND_ASSIGN(PlatformUiElement); +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_ELEMENTS_PLATFORM_UI_ELEMENT_H_
diff --git a/chrome/browser/vr/ui_scene_creator.cc b/chrome/browser/vr/ui_scene_creator.cc index f780a83..232c2e76 100644 --- a/chrome/browser/vr/ui_scene_creator.cc +++ b/chrome/browser/vr/ui_scene_creator.cc
@@ -38,6 +38,7 @@ #include "chrome/browser/vr/elements/oval.h" #include "chrome/browser/vr/elements/paged_grid_layout.h" #include "chrome/browser/vr/elements/paged_scroll_view.h" +#include "chrome/browser/vr/elements/platform_ui_element.h" #include "chrome/browser/vr/elements/rect.h" #include "chrome/browser/vr/elements/repositioner.h" #include "chrome/browser/vr/elements/resizer.h" @@ -706,11 +707,10 @@ UiBrowserInterface* browser, ContentInputDelegate* content_input_delegate, UiElementName name, - UiElementName content_name, + UiElementName element_name, float distance) { - auto hosted_ui = - Create<ContentElement>(content_name, kPhaseForeground, - content_input_delegate, base::DoNothing()); + auto hosted_ui = Create<PlatformUiElement>(element_name, kPhaseForeground, + content_input_delegate); hosted_ui->SetSize(kContentWidth * kHostedUiWidthRatio, kContentHeight * kHostedUiHeightRatio); // The hosted UI doesn't steal focus so that clikcing on an autofill @@ -722,16 +722,16 @@ hosted_ui->SetTranslate(0, 0, kHostedUiShadowOffset); hosted_ui->AddBinding(VR_BIND_FUNC( ContentInputDelegatePtr, Model, model, model->hosted_platform_ui.delegate, - ContentElement, hosted_ui.get(), SetDelegate)); + PlatformUiElement, hosted_ui.get(), SetDelegate)); hosted_ui->AddBinding(VR_BIND_FUNC( unsigned int, Model, model, model->hosted_platform_ui.texture_id, - ContentElement, hosted_ui.get(), SetTextureId)); + PlatformUiElement, hosted_ui.get(), SetTextureId)); hosted_ui->AddBinding(std::make_unique<Binding<bool>>( VR_BIND_LAMBDA( [](Model* m) { return m->hosted_platform_ui.hosted_ui_enabled; }, base::Unretained(model)), VR_BIND_LAMBDA( - [](ContentElement* dialog, const bool& enabled) { + [](PlatformUiElement* dialog, const bool& enabled) { dialog->set_requires_layout(enabled); dialog->set_hit_testable(enabled); }, @@ -750,7 +750,8 @@ }, base::Unretained(model)), base::BindRepeating( - [](ContentElement* dialog, const std::pair<bool, gfx::SizeF>& value) { + [](PlatformUiElement* dialog, + const std::pair<bool, gfx::SizeF>& value) { if (!value.first && value.second.width() > 0) { float ratio = static_cast<float>(value.second.height()) / value.second.width();
diff --git a/chrome/notification_helper/notification_activator.cc b/chrome/notification_helper/notification_activator.cc index 746681b..19d6f1c 100644 --- a/chrome/notification_helper/notification_activator.cc +++ b/chrome/notification_helper/notification_activator.cc
@@ -77,8 +77,7 @@ SHELLEXECUTEINFO info; memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); - info.fMask = - SEE_MASK_NOASYNC | SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_NOCLOSEPROCESS; + info.fMask = SEE_MASK_NOASYNC | SEE_MASK_FLAG_LOG_USAGE; info.lpFile = chrome_exe_path.value().c_str(); info.lpParameters = params.c_str(); info.nShow = SW_SHOWNORMAL; @@ -89,18 +88,6 @@ return HRESULT_FROM_WIN32(error_code); } - if (info.hProcess != NULL) { - DWORD pid = ::GetProcessId(info.hProcess); - if (!::AllowSetForegroundWindow(pid)) { - DWORD error_code = ::GetLastError(); - Trace(L"Unable to forward activation privilege; error: 0x%08X\n", - error_code); - return HRESULT_FROM_WIN32(error_code); - } - - CloseHandle(info.hProcess); - } - return S_OK; }
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 5bea1ed..24c485d 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -258,8 +258,6 @@ "views/chrome_test_views_delegate.h", "views/chrome_views_test_base.cc", "views/chrome_views_test_base.h", - "views/scoped_macviews_browser_mode.cc", - "views/scoped_macviews_browser_mode.h", ] if (is_mac) { sources +=
diff --git a/chrome/test/data/background_fetch/background_fetch.js b/chrome/test/data/background_fetch/background_fetch.js index 22b150a..36f5156c 100644 --- a/chrome/test/data/background_fetch/background_fetch.js +++ b/chrome/test/data/background_fetch/background_fetch.js
@@ -4,6 +4,14 @@ // Background Fetch Id to use when its value is not significant. const kBackgroundFetchId = 'bg-fetch-id'; +const kBackgroundFetchResource = [ '/background_fetch/types_of_cheese.txt' ]; +const kIcon = [ + { + src: '/notifications/icon.png', + sizes: '100x100', + type: 'image/png' + } +]; function RegisterServiceWorker() { navigator.serviceWorker.register('sw.js').then(() => { @@ -15,18 +23,46 @@ function StartSingleFileDownload() { navigator.serviceWorker.ready.then(swRegistration => { const options = { - icons: [ - { - src: '/notifications/icon.png', - sizes: '100x100', - type: 'image/png' - } - ], + icons: kIcon, title: 'Single-file Background Fetch' }; return swRegistration.backgroundFetch.fetch( - kBackgroundFetchId, [ '/notifications/icon.png' ], options); + kBackgroundFetchId, kBackgroundFetchResource, options); + }).then(bgFetchRegistration => { + sendResultToTest('ok'); + }).catch(sendErrorToTest); +} + +// Starts a Background Fetch request for a single to-be-downloaded file, with +// downloadTotal greater than the actual size. +function StartSingleFileDownloadWithBiggerThanActualDownloadTotal() { + navigator.serviceWorker.ready.then(swRegistration => { + const options = { + icons: kIcon, + title: 'Single-file Background Fetch with incorrect downloadTotal', + downloadTotal: 1000 + }; + + return swRegistration.backgroundFetch.fetch( + kBackgroundFetchId, kBackgroundFetchResource, options); + }).then(bgFetchRegistration => { + sendResultToTest('ok'); + }).catch(sendErrorToTest); +} + +// Starts a Background Fetch request for a single to-be-downloaded file, with +// downloadTotal equal to the actual size (in bytes). +function StartSingleFileDownloadWithCorrectDownloadTotal() { + navigator.serviceWorker.ready.then(swRegistration => { + const options = { + icons: kIcon, + title: 'Single-file Background Fetch with accurate downloadTotal', + downloadTotal: 82 + }; + + return swRegistration.backgroundFetch.fetch( + kBackgroundFetchId, kBackgroundFetchResource, options); }).then(bgFetchRegistration => { sendResultToTest('ok'); }).catch(sendErrorToTest);
diff --git a/chrome/test/data/background_fetch/types_of_cheese.txt b/chrome/test/data/background_fetch/types_of_cheese.txt new file mode 100644 index 0000000..6059cc6 --- /dev/null +++ b/chrome/test/data/background_fetch/types_of_cheese.txt
@@ -0,0 +1,7 @@ +mozzarella +cheddar +brie +goat's cheese +cream cheese +blue cheese +non-dairy "cheese"
diff --git a/chrome/test/data/extensions/api_test/webrequest_clients_google_com/background.js b/chrome/test/data/extensions/api_test/webrequest_clients_google_com/background.js index bafc3fd0..36427dc0 100644 --- a/chrome/test/data/extensions/api_test/webrequest_clients_google_com/background.js +++ b/chrome/test/data/extensions/api_test/webrequest_clients_google_com/background.js
@@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -window.webRequestCount = 0; +window.clientsGoogleWebRequestCount = 0; +window.yahooWebRequestCount = 0; chrome.webRequest.onBeforeRequest.addListener(function(details) { - ++window.webRequestCount; -}, {urls: ['http://clients1.google.com/']}); + if (details.url.includes('http://clients1.google.com/')) + ++window.clientsGoogleWebRequestCount; + if (details.url.includes('http://yahoo.com')) + ++window.yahooWebRequestCount; +}, {urls: ['<all_urls>']}); chrome.test.sendMessage('ready');
diff --git a/chrome/test/media_router/BUILD.gn b/chrome/test/media_router/BUILD.gn index 493fea6..1997a98 100644 --- a/chrome/test/media_router/BUILD.gn +++ b/chrome/test/media_router/BUILD.gn
@@ -36,7 +36,9 @@ ":browser_test_resources", "//chrome/browser/resources/media_router/extension:media_router", ] - data = [ "$root_gen_dir/chrome/browser/resources/media_router/extension/" ] + data = [ + "$root_gen_dir/chrome/browser/resources/media_router/extension/", + ] } copy("browser_test_resources") { @@ -50,6 +52,7 @@ "resources/fail_reconnect_session.json", "resources/local_media_sink.json", "resources/local_media_sink_route_fail.json", + "resources/no_presentation_receiver.html", "resources/no_provider.json", "resources/no_sinks.json", "resources/no_supported_sinks.json",
diff --git a/chrome/test/media_router/media_router_one_ua_integration_browsertest.cc b/chrome/test/media_router/media_router_one_ua_integration_browsertest.cc index f2c534c1..270e01a 100644 --- a/chrome/test/media_router/media_router_one_ua_integration_browsertest.cc +++ b/chrome/test/media_router/media_router_one_ua_integration_browsertest.cc
@@ -37,8 +37,7 @@ } GURL GetTestPageUrl(const base::FilePath& full_path) override { - GURL url = embedded_test_server()->GetURL("/basic_test.html"); - return GURL(url.spec() + "?__oneUA__=true"); + return embedded_test_server()->GetURL("/basic_test.html?__oneUA__=true"); } }; @@ -80,11 +79,11 @@ } class MediaRouterIntegrationOneUANoReceiverBrowserTest - : public MediaRouterIntegrationBrowserTest { + : public MediaRouterIntegrationOneUABrowserTest { public: GURL GetTestPageUrl(const base::FilePath& full_path) override { - GURL url = MediaRouterIntegrationBrowserTest::GetTestPageUrl(full_path); - return GURL(url.spec() + "?__oneUANoReceiver__=true"); + return embedded_test_server()->GetURL( + "/basic_test.html?__oneUANoReceiver__=true"); } };
diff --git a/chrome/test/media_router/resources/common.js b/chrome/test/media_router/resources/common.js index 1381be4..cf503b0 100644 --- a/chrome/test/media_router/resources/common.js +++ b/chrome/test/media_router/resources/common.js
@@ -19,7 +19,7 @@ } else if (params.get('__oneUA__') == 'true') { presentationUrl = "presentation_receiver.html"; } else if (params.get('__oneUANoReceiver__') == 'true') { - presentationUrl = "https://www.google.com"; + presentationUrl = "no_presentation_receiver.html"; } else { presentationUrl = "test://test"; }
diff --git a/chrome/test/media_router/resources/no_presentation_receiver.html b/chrome/test/media_router/resources/no_presentation_receiver.html new file mode 100644 index 0000000..5488aff --- /dev/null +++ b/chrome/test/media_router/resources/no_presentation_receiver.html
@@ -0,0 +1,9 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>Media Router Integration Test - Receiver Page (No navigator.presentation.receiver)</title> + <!-- This page is intentionally left empty to test receiver pages that do not use the Presentation Receiver API. --> + </head> + <body> + </body> +</html>
diff --git a/chromecast/graphics/cast_system_gesture_event_handler.cc b/chromecast/graphics/cast_system_gesture_event_handler.cc index 2513a47..44a01a1 100644 --- a/chromecast/graphics/cast_system_gesture_event_handler.cc +++ b/chromecast/graphics/cast_system_gesture_event_handler.cc
@@ -100,12 +100,9 @@ return; } - // All touch or gesture events inside the margins have to be consumed, or we - // risk a state issue later when the touch ends (b/78461207) - event->StopPropagation(); - // Detect the beginning of a system gesture swipe. if (event->type() == ui::ET_TOUCH_PRESSED) { + event->StopPropagation(); current_swipe_ = side_swipe_origin; for (auto* side_swipe_handler : swipe_gesture_handlers_) { // Let the subscriber know about the gesture begin.
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index eebb5a0..f45b917 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -10655.0.0 \ No newline at end of file +10660.0.0 \ No newline at end of file
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.cc b/chromeos/services/assistant/assistant_manager_service_impl.cc index a601a55..b35938eb 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/assistant_manager_service_impl.cc
@@ -127,6 +127,14 @@ }); } +void AssistantManagerServiceImpl::StartVoiceInteraction() { + assistant_manager_->StartAssistantInteraction(); +} + +void AssistantManagerServiceImpl::StopActiveInteraction() { + assistant_manager_->StopAssistantInteraction(); +} + void AssistantManagerServiceImpl::SendTextQuery(const std::string& query) { assistant_manager_internal_->SendTextQuery(query); }
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.h b/chromeos/services/assistant/assistant_manager_service_impl.h index 2df822c8..d6fe5a9 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.h +++ b/chromeos/services/assistant/assistant_manager_service_impl.h
@@ -59,6 +59,8 @@ UpdateSettingsUiResponseCallback callback) override; // mojom::Assistant overrides: + void StartVoiceInteraction() override; + void StopActiveInteraction() override; void SendTextQuery(const std::string& query) override; void AddAssistantEventSubscriber( mojom::AssistantEventSubscriberPtr subscriber) override;
diff --git a/chromeos/services/assistant/fake_assistant_manager_service_impl.cc b/chromeos/services/assistant/fake_assistant_manager_service_impl.cc index 0444e9d..17f9dd35e 100644 --- a/chromeos/services/assistant/fake_assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/fake_assistant_manager_service_impl.cc
@@ -42,6 +42,10 @@ const std::string& update, UpdateSettingsUiResponseCallback callback) {} +void FakeAssistantManagerServiceImpl::StartVoiceInteraction() {} + +void FakeAssistantManagerServiceImpl::StopActiveInteraction() {} + void FakeAssistantManagerServiceImpl::SendTextQuery(const std::string& query) {} void FakeAssistantManagerServiceImpl::AddAssistantEventSubscriber(
diff --git a/chromeos/services/assistant/fake_assistant_manager_service_impl.h b/chromeos/services/assistant/fake_assistant_manager_service_impl.h index 4e7b8f3..bd6eba5 100644 --- a/chromeos/services/assistant/fake_assistant_manager_service_impl.h +++ b/chromeos/services/assistant/fake_assistant_manager_service_impl.h
@@ -37,6 +37,8 @@ UpdateSettingsUiResponseCallback callback) override; // mojom::AssistantEvent overrides: + void StartVoiceInteraction() override; + void StopActiveInteraction() override; void SendTextQuery(const std::string& query) override; void AddAssistantEventSubscriber( mojom::AssistantEventSubscriberPtr subscriber) override;
diff --git a/chromeos/services/assistant/public/mojom/assistant.mojom b/chromeos/services/assistant/public/mojom/assistant.mojom index 822cb1d..7ce1b623 100644 --- a/chromeos/services/assistant/public/mojom/assistant.mojom +++ b/chromeos/services/assistant/public/mojom/assistant.mojom
@@ -9,6 +9,13 @@ // Interface to communicate with assistant backend. interface Assistant { + // Starts a new Assistant voice interaction. + StartVoiceInteraction(); + + // Stops the active Assistant interaction. If there is no active interaction, + // this method is a no-op. + StopActiveInteraction(); + // Send text query to assistant. Result will be returned through registered // |AssistantEventSubscriber|. SendTextQuery(string query);
diff --git a/chromeos/services/secure_channel/BUILD.gn b/chromeos/services/secure_channel/BUILD.gn index 94e2b1c..a2578b8 100644 --- a/chromeos/services/secure_channel/BUILD.gn +++ b/chromeos/services/secure_channel/BUILD.gn
@@ -7,6 +7,7 @@ static_library("secure_channel") { sources = [ "pending_connection_request.h", + "pending_connection_request_base.h", "pending_connection_request_delegate.cc", "pending_connection_request_delegate.h", ] @@ -24,6 +25,8 @@ sources = [ "fake_connection_delegate.cc", "fake_connection_delegate.h", + "fake_pending_connection_request.cc", + "fake_pending_connection_request.h", "fake_pending_connection_request_delegate.cc", "fake_pending_connection_request_delegate.h", ] @@ -39,7 +42,7 @@ testonly = true sources = [ - "pending_connection_request_unittest.cc", + "pending_connection_request_base_unittest.cc", ] deps = [
diff --git a/chromeos/services/secure_channel/fake_pending_connection_request.cc b/chromeos/services/secure_channel/fake_pending_connection_request.cc new file mode 100644 index 0000000..5e5a9bc --- /dev/null +++ b/chromeos/services/secure_channel/fake_pending_connection_request.cc
@@ -0,0 +1,24 @@ +// 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 "chromeos/services/secure_channel/fake_pending_connection_request.h" + +namespace chromeos { + +namespace secure_channel { + +FakePendingConnectionRequest::FakePendingConnectionRequest( + PendingConnectionRequestDelegate* delegate) + : PendingConnectionRequest<std::string>(delegate) {} + +FakePendingConnectionRequest::~FakePendingConnectionRequest() = default; + +void FakePendingConnectionRequest::HandleConnectionFailure( + std::string failure_detail) { + handled_failure_details_.push_back(failure_detail); +} + +} // namespace secure_channel + +} // namespace chromeos
diff --git a/chromeos/services/secure_channel/fake_pending_connection_request.h b/chromeos/services/secure_channel/fake_pending_connection_request.h new file mode 100644 index 0000000..dd27ee03 --- /dev/null +++ b/chromeos/services/secure_channel/fake_pending_connection_request.h
@@ -0,0 +1,49 @@ +// 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 CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_PENDING_CONNECTION_REQUEST_H_ +#define CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_PENDING_CONNECTION_REQUEST_H_ + +#include <string> +#include <vector> + +#include "base/macros.h" +#include "chromeos/services/secure_channel/pending_connection_request.h" + +namespace chromeos { + +namespace secure_channel { + +class PendingConnectionRequestDelegate; + +// Fake PendingConnectionRequest implementation, whose FailureDetailType is +// std::string. +class FakePendingConnectionRequest + : public PendingConnectionRequest<std::string> { + public: + FakePendingConnectionRequest(PendingConnectionRequestDelegate* delegate); + ~FakePendingConnectionRequest() override; + + const std::vector<std::string>& handled_failure_details() const { + return handled_failure_details_; + } + + // Make NotifyRequestFinishedWithoutConnection() public for testing. + using PendingConnectionRequest< + std::string>::NotifyRequestFinishedWithoutConnection; + + private: + // PendingConnectionRequest<std::string>: + void HandleConnectionFailure(std::string failure_detail) override; + + std::vector<std::string> handled_failure_details_; + + DISALLOW_COPY_AND_ASSIGN(FakePendingConnectionRequest); +}; + +} // namespace secure_channel + +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_PENDING_CONNECTION_REQUEST_H_
diff --git a/chromeos/services/secure_channel/pending_connection_request.h b/chromeos/services/secure_channel/pending_connection_request.h index 9fdd3e64..8b4c740 100644 --- a/chromeos/services/secure_channel/pending_connection_request.h +++ b/chromeos/services/secure_channel/pending_connection_request.h
@@ -7,25 +7,16 @@ #include "base/guid.h" #include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "chromeos/components/proximity_auth/logging/logging.h" #include "chromeos/services/secure_channel/pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace chromeos { namespace secure_channel { // Encapsulates metadata for a pending request for a connection to a remote -// device. Every PendingConnectionRequest starts out active (i.e., there exists -// an ongoing attempt to create a connection). The client of this class can -// cancel an active attempt by disconnecting the ConnectionDelegatePtr passed -// PendingConnectionRequest's constructor; likewise, a PendingConnectionRequest -// can become inactive due to connection failures. -// -// PendingConnectionRequest is templatized so that each derived class can -// specify its own error-handling for connection failures; for instance, some -// derived classes may choose to continue an ongoing connection attempt +// device. PendingConnectionRequest is templatized so that each derived class +// can specify its own error-handling for connection failures; for instance, +// some derived classes may choose to continue an ongoing connection attempt // indefinitely, while others may choose to handle connection failures by giving // up on the request entirely. template <typename FailureDetailType> @@ -37,8 +28,6 @@ // trying to connect after some number of failures. virtual void HandleConnectionFailure(FailureDetailType failure_detail) = 0; - bool is_active() { return is_active_; } - // Note: Request ID is guaranteed to be unique among all requests. const std::string& GetRequestId() { static const std::string kRequestId = base::GenerateGUID(); @@ -46,60 +35,18 @@ } protected: - PendingConnectionRequest(const std::string& feature, - const std::string& readable_request_type_for_logging, - PendingConnectionRequestDelegate* delegate, - mojom::ConnectionDelegatePtr connection_delegate_ptr) - : feature_(feature), - readable_request_type_for_logging_(readable_request_type_for_logging), - delegate_(delegate), - connection_delegate_ptr_(std::move(connection_delegate_ptr)), - weak_ptr_factory_(this) { - DCHECK(!feature_.empty()); + PendingConnectionRequest(PendingConnectionRequestDelegate* delegate) + : delegate_(delegate) { DCHECK(delegate_); - DCHECK(connection_delegate_ptr_); - - // If the client disconnects its delegate, the client is signaling that the - // connection request has been canceled. - connection_delegate_ptr_.set_connection_error_handler( - base::BindOnce(&PendingConnectionRequest:: - SetInactiveAndNotifyRequestFinishedWithoutConnection, - weak_ptr_factory_.GetWeakPtr(), - PendingConnectionRequestDelegate:: - FailedConnectionReason::kRequestCanceledByClient)); } - // Derived classes should invoke this function if they would like to give up - // on the request due to connection failures. - void StopRequestDueToConnectionFailures() { - SetInactiveAndNotifyRequestFinishedWithoutConnection( - PendingConnectionRequestDelegate::FailedConnectionReason:: - kRequestFailed); - } - - private: - void SetInactiveAndNotifyRequestFinishedWithoutConnection( + void NotifyRequestFinishedWithoutConnection( PendingConnectionRequestDelegate::FailedConnectionReason reason) { - // If the request is already inactive, there is nothing else to do. - if (!is_active_) - return; - - PA_LOG(INFO) << "Request finished without connection; notifying delegate. " - << "Feature: \"" << feature_ << "\"" - << ", Reason: " << reason << ", Request type: \"" - << readable_request_type_for_logging_ << "\""; - - is_active_ = false; delegate_->OnRequestFinishedWithoutConnection(GetRequestId(), reason); } - const std::string feature_; - const std::string readable_request_type_for_logging_; + private: PendingConnectionRequestDelegate* delegate_; - mojom::ConnectionDelegatePtr connection_delegate_ptr_; - - bool is_active_ = true; - base::WeakPtrFactory<PendingConnectionRequest> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(PendingConnectionRequest); };
diff --git a/chromeos/services/secure_channel/pending_connection_request_base.h b/chromeos/services/secure_channel/pending_connection_request_base.h new file mode 100644 index 0000000..3e3d855 --- /dev/null +++ b/chromeos/services/secure_channel/pending_connection_request_base.h
@@ -0,0 +1,91 @@ +// 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 CHROMEOS_SERVICES_SECURE_CHANNEL_PENDING_CONNECTION_REQUEST_BASE_H_ +#define CHROMEOS_SERVICES_SECURE_CHANNEL_PENDING_CONNECTION_REQUEST_BASE_H_ + +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "chromeos/components/proximity_auth/logging/logging.h" +#include "chromeos/services/secure_channel/pending_connection_request.h" +#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" + +namespace chromeos { + +namespace secure_channel { + +// Encapsulates metadata for a pending request for a connection to a remote +// device. Every PendingConnectionRequestBase starts out active (i.e., there +// exists an ongoing attempt to create a connection). The client of this class +// can cancel an active attempt by disconnecting the ConnectionDelegatePtr +// passed PendingConnectionRequestBase's constructor; likewise, a +// PendingConnectionRequestBase can become inactive due to connection failures. +// +// Each connection type should implement its own pending request class deriving +// from PendingConnectionRequestBase. +template <typename FailureDetailType> +class PendingConnectionRequestBase + : public PendingConnectionRequest<FailureDetailType> { + public: + ~PendingConnectionRequestBase() override = default; + + protected: + PendingConnectionRequestBase( + const std::string& feature, + const std::string& readable_request_type_for_logging, + PendingConnectionRequestDelegate* delegate, + mojom::ConnectionDelegatePtr connection_delegate_ptr) + : PendingConnectionRequest<FailureDetailType>(delegate), + feature_(feature), + readable_request_type_for_logging_(readable_request_type_for_logging), + connection_delegate_ptr_(std::move(connection_delegate_ptr)), + weak_ptr_factory_(this) { + DCHECK(!feature_.empty()); + DCHECK(connection_delegate_ptr_); + + // If the client disconnects its delegate, the client is signaling that the + // connection request has been canceled. + connection_delegate_ptr_.set_connection_error_handler(base::BindOnce( + &PendingConnectionRequestBase::OnFinishedWithoutConnection, + weak_ptr_factory_.GetWeakPtr(), + PendingConnectionRequestDelegate::FailedConnectionReason:: + kRequestCanceledByClient)); + } + + // Derived classes should invoke this function if they would like to give up + // on the request due to connection failures. + void StopRequestDueToConnectionFailures() { + OnFinishedWithoutConnection(PendingConnectionRequestDelegate:: + FailedConnectionReason::kRequestFailed); + } + + private: + // Make NotifyRequestFinishedWithoutConnection() inaccessible to derived + // types, which should use StopRequestDueToConnectionFailures() instead. + using PendingConnectionRequest< + FailureDetailType>::NotifyRequestFinishedWithoutConnection; + + void OnFinishedWithoutConnection( + PendingConnectionRequestDelegate::FailedConnectionReason reason) { + PA_LOG(INFO) << "Request finished without connection; notifying delegate. " + << "Feature: \"" << feature_ << "\"" + << ", Reason: " << reason << ", Request type: \"" + << readable_request_type_for_logging_ << "\""; + NotifyRequestFinishedWithoutConnection(reason); + } + + const std::string feature_; + const std::string readable_request_type_for_logging_; + mojom::ConnectionDelegatePtr connection_delegate_ptr_; + + base::WeakPtrFactory<PendingConnectionRequestBase> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(PendingConnectionRequestBase); +}; + +} // namespace secure_channel + +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PENDING_CONNECTION_REQUEST_BASE_H_
diff --git a/chromeos/services/secure_channel/pending_connection_request_unittest.cc b/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc similarity index 83% rename from chromeos/services/secure_channel/pending_connection_request_unittest.cc rename to chromeos/services/secure_channel/pending_connection_request_base_unittest.cc index 1535074..8dbe29b9 100644 --- a/chromeos/services/secure_channel/pending_connection_request_unittest.cc +++ b/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/pending_connection_request.h" +#include "chromeos/services/secure_channel/pending_connection_request_base.h" #include <memory> @@ -26,23 +26,23 @@ kReasonWhichDoesNotCauseRequestToBecomeInactive }; -// Since PendingConnectionRequest is templatized, a concrete implementation is -// needed for its test. +// Since PendingConnectionRequestBase is templatized, a concrete implementation +// is needed for its test. class TestPendingConnectionRequest - : public PendingConnectionRequest<TestFailureDetail> { + : public PendingConnectionRequestBase<TestFailureDetail> { public: TestPendingConnectionRequest( const std::string& feature, mojom::ConnectionDelegatePtr connection_delegate_ptr, PendingConnectionRequestDelegate* delegate) - : PendingConnectionRequest<TestFailureDetail>( + : PendingConnectionRequestBase<TestFailureDetail>( feature, kTestReadableRequestTypeForLogging, delegate, std::move(connection_delegate_ptr)) {} ~TestPendingConnectionRequest() override = default; - // PendingConnectionRequest<TestFailureDetail>: + // PendingConnectionRequestBase<TestFailureDetail>: void HandleConnectionFailure(TestFailureDetail failure_detail) override { switch (failure_detail) { case TestFailureDetail::kReasonWhichCausesRequestToBecomeInactive: @@ -57,10 +57,10 @@ } // namespace -class SecureChannelPendingConnectionRequestTest : public testing::Test { +class SecureChannelPendingConnectionRequestBaseTest : public testing::Test { protected: - SecureChannelPendingConnectionRequestTest() = default; - ~SecureChannelPendingConnectionRequestTest() override = default; + SecureChannelPendingConnectionRequestBaseTest() = default; + ~SecureChannelPendingConnectionRequestBaseTest() override = default; void SetUp() override { fake_connection_delegate_ = std::make_unique<FakeConnectionDelegate>(); @@ -102,35 +102,32 @@ std::unique_ptr<TestPendingConnectionRequest> test_pending_connection_request_; - DISALLOW_COPY_AND_ASSIGN(SecureChannelPendingConnectionRequestTest); + DISALLOW_COPY_AND_ASSIGN(SecureChannelPendingConnectionRequestBaseTest); }; -TEST_F(SecureChannelPendingConnectionRequestTest, +TEST_F(SecureChannelPendingConnectionRequestBaseTest, HandleConnectionFailureWhichCausesRequestToBecomeInactive) { test_pending_connection_request()->HandleConnectionFailure( TestFailureDetail::kReasonWhichCausesRequestToBecomeInactive); - EXPECT_FALSE(test_pending_connection_request()->is_active()); EXPECT_EQ( PendingConnectionRequestDelegate::FailedConnectionReason::kRequestFailed, *GetFailedConnectionReason()); } -TEST_F(SecureChannelPendingConnectionRequestTest, +TEST_F(SecureChannelPendingConnectionRequestBaseTest, HandleConnectionFailureWhichDoesNotCauseRequestToBecomeInactive) { // Repeat 5 connection failures, none of which should cause the request to // become inactive. for (int i = 0; i < 5; ++i) { test_pending_connection_request()->HandleConnectionFailure( TestFailureDetail::kReasonWhichDoesNotCauseRequestToBecomeInactive); - EXPECT_TRUE(test_pending_connection_request()->is_active()); EXPECT_FALSE(GetFailedConnectionReason()); } } -TEST_F(SecureChannelPendingConnectionRequestTest, +TEST_F(SecureChannelPendingConnectionRequestBaseTest, ConnectionDelegateInvalidated) { DisconnectConnectionDelegatePtr(); - EXPECT_FALSE(test_pending_connection_request()->is_active()); EXPECT_EQ(PendingConnectionRequestDelegate::FailedConnectionReason:: kRequestCanceledByClient, *GetFailedConnectionReason());
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn index 3e87940..4f5f985 100644 --- a/components/cronet/android/BUILD.gn +++ b/components/cronet/android/BUILD.gn
@@ -940,7 +940,8 @@ "*/multidex/*.class", "*/process_launcher/*.class", "*/SysUtils.class", - "*/CachedMetrics.class", + "*/CachedMetrics*.class", + "org/chromium/base/memory/MemoryPressureMonitor*.class", ] args = [
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc index 1706aa7..004072c 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc
@@ -555,12 +555,11 @@ if (!config.has_proxy_config()) return false; + // An empty proxy config is OK, and allows the server to effectively turn off + // DataSaver if needed. See http://crbug.com/840978. std::vector<DataReductionProxyServer> proxies = GetProxiesForHTTP(config.proxy_config()); - if (proxies.empty()) - return false; - request_options_->SetSecureSession(config.session_key()); config_values_->UpdateValues(proxies); config_->OnNewClientConfigFetched();
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc index e0834e1..becb0e4 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_unittest.cc
@@ -229,6 +229,13 @@ half_reporting_fraction_encoded_config_ = EncodeConfig(half_reporting_fraction_config); + ClientConfig no_proxies_config; + no_proxies_config.set_session_key(kSuccessSessionKey); + no_proxies_config.mutable_refresh_duration()->set_seconds( + kConfigRefreshDurationSeconds); + no_proxies_config.mutable_refresh_duration()->set_nanos(0); + no_proxies_config_ = EncodeConfig(no_proxies_config); + success_reads_[0] = net::MockRead("HTTP/1.1 200 OK\r\n\r\n"); success_reads_[1] = net::MockRead(net::ASYNC, config_.c_str(), config_.length()); @@ -447,6 +454,7 @@ const std::string& half_reporting_fraction_encoded_config() const { return half_reporting_fraction_encoded_config_; } + const std::string& no_proxies_config() const { return no_proxies_config_; } const std::string& loaded_config() const { return loaded_config_; } @@ -490,6 +498,9 @@ // A configuration where the pingback reporting fraction is set to 0.5f. std::string half_reporting_fraction_encoded_config_; + // A configuration where no proxies are configured. + std::string no_proxies_config_; + // Mock socket data. std::vector<std::unique_ptr<net::SocketDataProvider>> socket_data_providers_; @@ -1359,6 +1370,16 @@ EXPECT_EQ(0.5f, pingback_reporting_fraction()); } +TEST_F(DataReductionProxyConfigServiceClientTest, EmptyConfigDisablesDRP) { + Init(true); + SetDataReductionProxyEnabled(true, true); + EXPECT_EQ(std::vector<net::ProxyServer>(), GetConfiguredProxiesForHttp()); + + config_client()->ApplySerializedConfig(no_proxies_config()); + EXPECT_EQ(std::vector<net::ProxyServer>(), GetConfiguredProxiesForHttp()); + EXPECT_TRUE(configurator()->GetProxyConfig().proxy_rules().empty()); +} + #if defined(OS_ANDROID) // Verifies the correctness of fetching config when Chromium is in background // and foreground.
diff --git a/components/download/internal/common/download_file_impl.cc b/components/download/internal/common/download_file_impl.cc index eefdd2ce..05d8f7c5 100644 --- a/components/download/internal/common/download_file_impl.cc +++ b/components/download/internal/common/download_file_impl.cc
@@ -229,7 +229,7 @@ CancelRequest(offset); return; } - + DCHECK(source_streams_.find(offset) == source_streams_.end()); source_streams_[offset] = std::make_unique<SourceStream>(offset, length, std::move(stream)); OnSourceStreamAdded(source_streams_[offset].get());
diff --git a/components/download/internal/common/download_file_unittest.cc b/components/download/internal/common/download_file_unittest.cc index 3fb6077..f0f2204 100644 --- a/components/download/internal/common/download_file_unittest.cc +++ b/components/download/internal/common/download_file_unittest.cc
@@ -1042,8 +1042,8 @@ .RetiresOnSaturation(); download_file_->AddInputStream( - std::unique_ptr<MockInputStream>(additional_streams_[0]), 0, - DownloadSaveInfo::kLengthFullContent); + std::unique_ptr<MockInputStream>(additional_streams_[0]), + strlen(kTestData1), DownloadSaveInfo::kLengthFullContent); // The stream should get terminated and reset the callback. EXPECT_TRUE(sink_callback_.is_null());
diff --git a/components/download/internal/common/download_item_impl.cc b/components/download/internal/common/download_item_impl.cc index 1574628..cd9f9b1 100644 --- a/components/download/internal/common/download_item_impl.cc +++ b/components/download/internal/common/download_item_impl.cc
@@ -1479,9 +1479,8 @@ if (state_ == RESUMING_INTERNAL) UpdateValidatorsOnResumption(new_create_info); - // If the download is not parallel download during resumption, clear the - // |received_slices_|. - if (!job_->IsParallelizable() && !received_slices_.empty()) { + // If the download is not parallel, clear the |received_slices_|. + if (!received_slices_.empty() && !job_->IsParallelizable()) { destination_info_.received_bytes = GetMaxContiguousDataBlockSizeFromBeginning(received_slices_); received_slices_.clear();
diff --git a/components/download/internal/common/download_job_factory.cc b/components/download/internal/common/download_job_factory.cc index 4071ba6b..c9cffbeb 100644 --- a/components/download/internal/common/download_job_factory.cc +++ b/components/download/internal/common/download_job_factory.cc
@@ -44,10 +44,12 @@ net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1; bool http_get_method = create_info.method == "GET" && create_info.url().SchemeIsHTTPOrHTTPS(); - + bool partial_response_success = + download_item->GetReceivedSlices().empty() || create_info.offset != 0; bool is_parallelizable = has_strong_validator && create_info.accept_range && has_content_length && satisfy_min_file_size && - satisfy_connection_type && http_get_method; + satisfy_connection_type && http_get_method && + partial_response_success; if (!IsParallelDownloadEnabled()) return is_parallelizable;
diff --git a/components/download/internal/common/download_worker.cc b/components/download/internal/common/download_worker.cc index 49cdc605..b6f3aa5 100644 --- a/components/download/internal/common/download_worker.cc +++ b/components/download/internal/common/download_worker.cc
@@ -137,7 +137,8 @@ Pause(); } - delegate_->OnInputStreamReady(this, std::move(input_stream)); + delegate_->OnInputStreamReady(this, std::move(input_stream), + std::move(create_info)); } void DownloadWorker::OnUrlDownloadStopped(UrlDownloadHandler* downloader) {
diff --git a/components/download/internal/common/download_worker.h b/components/download/internal/common/download_worker.h index 2c411a3e..8c71260 100644 --- a/components/download/internal/common/download_worker.h +++ b/components/download/internal/common/download_worker.h
@@ -31,7 +31,8 @@ // destination file. virtual void OnInputStreamReady( DownloadWorker* worker, - std::unique_ptr<InputStream> input_stream) = 0; + std::unique_ptr<InputStream> input_stream, + std::unique_ptr<DownloadCreateInfo> download_create_info) = 0; }; DownloadWorker(DownloadWorker::Delegate* delegate,
diff --git a/components/download/internal/common/parallel_download_job.cc b/components/download/internal/common/parallel_download_job.cc index b0eae34..e72f9af 100644 --- a/components/download/internal/common/parallel_download_job.cc +++ b/components/download/internal/common/parallel_download_job.cc
@@ -123,9 +123,14 @@ void ParallelDownloadJob::OnInputStreamReady( DownloadWorker* worker, - std::unique_ptr<InputStream> input_stream) { - bool success = DownloadJob::AddInputStream( - std::move(input_stream), worker->offset(), worker->length()); + std::unique_ptr<InputStream> input_stream, + std::unique_ptr<DownloadCreateInfo> download_create_info) { + // If server returns a wrong range, abort the parallel request. + bool success = download_create_info->offset == worker->offset(); + if (success) { + success = DownloadJob::AddInputStream(std::move(input_stream), + worker->offset(), worker->length()); + } RecordParallelDownloadAddStreamSuccess(success); // Destroy the request if the sink is gone.
diff --git a/components/download/internal/common/parallel_download_job.h b/components/download/internal/common/parallel_download_job.h index 2a1de8f..a6803e2 100644 --- a/components/download/internal/common/parallel_download_job.h +++ b/components/download/internal/common/parallel_download_job.h
@@ -68,8 +68,10 @@ friend class ParallelDownloadJobTest; // DownloadWorker::Delegate implementation. - void OnInputStreamReady(DownloadWorker* worker, - std::unique_ptr<InputStream> input_stream) override; + void OnInputStreamReady( + DownloadWorker* worker, + std::unique_ptr<InputStream> input_stream, + std::unique_ptr<DownloadCreateInfo> download_create_info) override; // Build parallel requests after a delay, to effectively measure the single // stream bandwidth.
diff --git a/components/download/internal/common/parallel_download_job_unittest.cc b/components/download/internal/common/parallel_download_job_unittest.cc index ff5e9bc..61761c4 100644 --- a/components/download/internal/common/parallel_download_job_unittest.cc +++ b/components/download/internal/common/parallel_download_job_unittest.cc
@@ -94,8 +94,10 @@ return min_remaining_time_; } - void OnInputStreamReady(DownloadWorker* worker, - std::unique_ptr<InputStream> input_stream) override { + void OnInputStreamReady( + DownloadWorker* worker, + std::unique_ptr<InputStream> input_stream, + std::unique_ptr<DownloadCreateInfo> download_create_info) override { CountOnInputStreamReady(); }
diff --git a/components/drive/chromeos/resource_metadata.cc b/components/drive/chromeos/resource_metadata.cc index 0549fca0..e73edf2 100644 --- a/components/drive/chromeos/resource_metadata.cc +++ b/components/drive/chromeos/resource_metadata.cc
@@ -103,6 +103,10 @@ if (error != FILE_ERROR_OK) return error; + error = storage_->SetStartPageToken(std::string()); + if (error != FILE_ERROR_OK) + return error; + // Remove all root entries. std::unique_ptr<Iterator> it = GetIterator(); for (; !it->IsAtEnd(); it->Advance()) { @@ -245,6 +249,20 @@ return storage_->SetLargestChangestamp(value); } +FileError ResourceMetadata::GetStartPageToken(std::string* out_value) { + DCHECK(blocking_task_runner_->RunsTasksInCurrentSequence()); + return storage_->GetStartPageToken(out_value); +} + +FileError ResourceMetadata::SetStartPageToken(const std::string& value) { + DCHECK(blocking_task_runner_->RunsTasksInCurrentSequence()); + + if (!EnoughDiskSpaceIsAvailableForDBOperation(storage_->directory_path())) + return FILE_ERROR_NO_LOCAL_SPACE; + + return storage_->SetStartPageToken(value); +} + FileError ResourceMetadata::AddEntry(const ResourceEntry& entry, std::string* out_id) { DCHECK(blocking_task_runner_->RunsTasksInCurrentSequence());
diff --git a/components/drive/chromeos/resource_metadata.h b/components/drive/chromeos/resource_metadata.h index e25e572f..03bc001 100644 --- a/components/drive/chromeos/resource_metadata.h +++ b/components/drive/chromeos/resource_metadata.h
@@ -62,6 +62,12 @@ // Sets the largest changestamp. FileError SetLargestChangestamp(int64_t value); + // Returns the start page token for the users default corpus. + FileError GetStartPageToken(std::string* out_value); + + // Sets the start page token for the users default corpus. + FileError SetStartPageToken(const std::string& value); + // Adds |entry| to the metadata tree based on its parent_local_id. FileError AddEntry(const ResourceEntry& entry, std::string* out_id);
diff --git a/components/drive/drive.proto b/components/drive/drive.proto index e12f9b2b..a997cfb8 100644 --- a/components/drive/drive.proto +++ b/components/drive/drive.proto
@@ -79,7 +79,12 @@ // changestamp of ResourceMetadata, if this directory was // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch" // feature. + // TODO(slangley): Deprecate and remove changestamp. optional int64 changestamp = 1; + + // The start page token of this directory. This value may not match the + // start_page_token of ResourceMetadata if the directory was "fast-fetched". + optional string start_page_token = 2; } // Represents metadata of a resource (file or directory) on Drive. @@ -162,11 +167,16 @@ // incompatible change is made to the DB format. kDBVersion in // drive_resource_metadata_storage.h defines the current version. optional int32 version = 1; + + // TODO(slangley): Deprecate and remove changestamp. optional int64 largest_changestamp = 2; // The argument with ID 3 (starred_property_initialized) had been used, but // got deleted. reserved 3; + + // The start_page_token for the users default corpus changelist. + optional string start_page_token = 4; } // Message to store information of an existing cache file.
diff --git a/components/drive/file_system_core_util.cc b/components/drive/file_system_core_util.cc index 2151241..1ab0c661 100644 --- a/components/drive/file_system_core_util.cc +++ b/components/drive/file_system_core_util.cc
@@ -114,6 +114,11 @@ return unescaped; } +std::string ConvertChangestampToStartPageToken(int64_t changestamp) { + DCHECK_LE(0, changestamp); + return base::NumberToString(changestamp + 1); +} + std::string NormalizeFileName(const std::string& input) { DCHECK(base::IsStringUTF8(input));
diff --git a/components/drive/file_system_core_util.h b/components/drive/file_system_core_util.h index a008e036..63541027 100644 --- a/components/drive/file_system_core_util.h +++ b/components/drive/file_system_core_util.h
@@ -53,6 +53,9 @@ // This is the inverse of EscapeCacheFileName. std::string UnescapeCacheFileName(const std::string& filename); +// Converts a numerical changestamp value to a start page token. +std::string ConvertChangestampToStartPageToken(int64_t changestamp); + // Converts the given string to a form suitable as a file name. Specifically, // - Normalizes in Unicode Normalization Form C. // - Replaces slashes '/' with '_'.
diff --git a/components/drive/resource_metadata_storage.cc b/components/drive/resource_metadata_storage.cc index 91c44d6..8807c51 100644 --- a/components/drive/resource_metadata_storage.cc +++ b/components/drive/resource_metadata_storage.cc
@@ -23,6 +23,7 @@ #include "base/threading/thread_restrictions.h" #include "components/drive/drive.pb.h" #include "components/drive/drive_api_util.h" +#include "components/drive/file_system_core_util.h" #include "third_party/leveldatabase/env_chromium.h" #include "third_party/leveldatabase/src/include/leveldb/db.h" #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" @@ -438,6 +439,60 @@ return resource_map->Write(leveldb::WriteOptions(), &batch).ok(); } +bool UpgradeOldDBVersion15(leveldb::DB* resource_map) { + leveldb::ReadOptions read_options; + read_options.verify_checksums = true; + leveldb::WriteBatch batch; + + std::unique_ptr<leveldb::Iterator> it( + resource_map->NewIterator(read_options)); + + it->SeekToFirst(); + ResourceMetadataHeader header; + + if (!it->Valid() || it->key() != GetHeaderDBKey()) { + DLOG(ERROR) << "Header not detected."; + return false; + } + + if (!header.ParseFromArray(it->value().data(), it->value().size())) { + DLOG(ERROR) << "Could not parse header."; + return false; + } + + header.set_version(ResourceMetadataStorage::kDBVersion); + header.set_start_page_token(drive::util::ConvertChangestampToStartPageToken( + header.largest_changestamp())); + std::string serialized_header; + header.SerializeToString(&serialized_header); + batch.Put(GetHeaderDBKey(), serialized_header); + + for (it->Next(); it->Valid(); it->Next()) { + if (IsIdEntryKey(it->key())) + continue; + + ResourceEntry entry; + if (!entry.ParseFromArray(it->value().data(), it->value().size())) + return false; + + if (entry.has_directory_specific_info()) { + int64_t changestamp = entry.directory_specific_info().changestamp(); + entry.mutable_directory_specific_info()->set_start_page_token( + drive::util::ConvertChangestampToStartPageToken(changestamp)); + + std::string serialized_entry; + if (!entry.SerializeToString(&serialized_entry)) { + DLOG(ERROR) << "Failed to serialize the entry"; + return false; + } + + batch.Put(entry.local_id(), serialized_entry); + } + } + + return resource_map->Write(leveldb::WriteOptions(), &batch).ok(); +} + } // namespace ResourceMetadataStorage::Iterator::Iterator( @@ -554,9 +609,11 @@ return UpgradeOldDBVersion13(resource_map.get()); case 14: return UpgradeOldDBVersion14(resource_map.get()); + case 15: + return UpgradeOldDBVersion15(resource_map.get()); case kDBVersion: static_assert( - kDBVersion == 15, + kDBVersion == 16, "database version and this function must be updated together"); return true; default: @@ -767,6 +824,33 @@ return FILE_ERROR_OK; } +FileError ResourceMetadataStorage::GetStartPageToken( + std::string* start_page_token) { + base::AssertBlockingAllowed(); + ResourceMetadataHeader header; + FileError error = GetHeader(&header); + if (error != FILE_ERROR_OK) { + DLOG(ERROR) << "Failed to get the header."; + return error; + } + *start_page_token = header.start_page_token(); + return FILE_ERROR_OK; +} + +FileError ResourceMetadataStorage::SetStartPageToken( + const std::string& start_page_token) { + base::AssertBlockingAllowed(); + + ResourceMetadataHeader header; + FileError error = GetHeader(&header); + if (error != FILE_ERROR_OK) { + DLOG(ERROR) << "Failed to get the header."; + return error; + } + header.set_start_page_token(start_page_token); + return PutHeader(header); +} + FileError ResourceMetadataStorage::PutEntry(const ResourceEntry& entry) { base::AssertBlockingAllowed();
diff --git a/components/drive/resource_metadata_storage.h b/components/drive/resource_metadata_storage.h index dbd2175..d4b022c 100644 --- a/components/drive/resource_metadata_storage.h +++ b/components/drive/resource_metadata_storage.h
@@ -40,7 +40,7 @@ public: // This should be incremented when incompatibility change is made to DB // format. - static const int kDBVersion = 15; + static constexpr int kDBVersion = 16; // Object to iterate over entries stored in this storage. class Iterator { @@ -109,6 +109,10 @@ // Gets the largest changestamp. FileError GetLargestChangestamp(int64_t* largest_changestamp); + FileError GetStartPageToken(std::string* out_value); + + FileError SetStartPageToken(const std::string& value); + // Puts the entry to this storage. FileError PutEntry(const ResourceEntry& entry);
diff --git a/components/drive/resource_metadata_storage_unittest.cc b/components/drive/resource_metadata_storage_unittest.cc index 8e1e7ac..d32667a 100644 --- a/components/drive/resource_metadata_storage_unittest.cc +++ b/components/drive/resource_metadata_storage_unittest.cc
@@ -657,5 +657,47 @@ EXPECT_TRUE(CheckValidity()); } +TEST_F(ResourceMetadataStorageTest, UpgradeDB15to16) { + constexpr int64_t kLargestChangestamp = 54321; + constexpr char kStartPageToken[] = "54322"; + constexpr int64_t kDirectoryChangestamp = 12345; + constexpr char kDirectoryStartpageToken[] = "12346"; + + // Construct a v15 DB + SetDBVersion(15); + EXPECT_EQ(FILE_ERROR_OK, + storage_->SetLargestChangestamp(kLargestChangestamp)); + + // Add a directory with a changestamp + ResourceEntry entry; + entry.set_local_id("local_id_1"); + entry.set_base_name("resource_id_1"); + entry.mutable_directory_specific_info()->set_changestamp( + kDirectoryChangestamp); + EXPECT_EQ(FILE_ERROR_OK, storage_->PutEntry(entry)); + + // Upgrade and reopen + storage_.reset(); + EXPECT_TRUE(UpgradeOldDB()); + storage_.reset(new ResourceMetadataStorage( + temp_dir_.GetPath(), base::ThreadTaskRunnerHandle::Get().get())); + ASSERT_TRUE(storage_->Initialize()); + + int64_t largest_changestamp = 0; + EXPECT_EQ(FILE_ERROR_OK, + storage_->GetLargestChangestamp(&largest_changestamp)); + EXPECT_EQ(kLargestChangestamp, largest_changestamp); + + std::string start_page_token; + EXPECT_EQ(FILE_ERROR_OK, storage_->GetStartPageToken(&start_page_token)); + EXPECT_EQ(kStartPageToken, start_page_token); + + EXPECT_EQ(FILE_ERROR_OK, storage_->GetEntry("local_id_1", &entry)); + EXPECT_EQ(kDirectoryChangestamp, + entry.directory_specific_info().changestamp()); + EXPECT_EQ(kDirectoryStartpageToken, + entry.directory_specific_info().start_page_token()); +} + } // namespace internal } // namespace drive
diff --git a/components/drive/resource_metadata_unittest.cc b/components/drive/resource_metadata_unittest.cc index 04f0276..d931e543 100644 --- a/components/drive/resource_metadata_unittest.cc +++ b/components/drive/resource_metadata_unittest.cc
@@ -27,9 +27,8 @@ namespace internal { namespace { -// The changestamp of the resource metadata used in -// ResourceMetadataTest. -const int64_t kTestChangestamp = 100; +// The start page token of the resource metadata used in ResourceMetadataTest. +constexpr char kTestStartPageToken[] = "a token"; // Returns the sorted base names from |entries|. std::vector<std::string> GetSortedBaseNames( @@ -52,7 +51,8 @@ entry.set_resource_id(resource_id); entry.set_parent_local_id(parent_local_id); entry.mutable_file_info()->set_is_directory(true); - entry.mutable_directory_specific_info()->set_changestamp(kTestChangestamp); + entry.mutable_directory_specific_info()->set_start_page_token( + kTestStartPageToken); return entry; } @@ -131,7 +131,7 @@ CreateFileEntry("file10", local_id_dir3), &local_id)); ASSERT_EQ(FILE_ERROR_OK, - resource_metadata->SetLargestChangestamp(kTestChangestamp)); + resource_metadata->SetStartPageToken(kTestStartPageToken)); } } // namespace @@ -181,6 +181,16 @@ EXPECT_EQ(kChangestamp, changestamp); } +TEST_F(ResourceMetadataTest, StartPageToken) { + constexpr char kStartPageToken[] = "a different token"; + EXPECT_EQ(FILE_ERROR_OK, + resource_metadata_->SetStartPageToken(kStartPageToken)); + std::string start_page_token; + EXPECT_EQ(FILE_ERROR_OK, + resource_metadata_->GetStartPageToken(&start_page_token)); + EXPECT_EQ(kStartPageToken, start_page_token); +} + TEST_F(ResourceMetadataTest, GetResourceEntryByPath) { // Confirm that an existing file is found. ResourceEntry entry; @@ -200,7 +210,7 @@ EXPECT_EQ(FILE_ERROR_NOT_FOUND, resource_metadata_->GetResourceEntryByPath( base::FilePath::FromUTF8Unsafe("non_existing"), &entry)); - // Confirm that an entry is not found with a wrong root. + // Confirm that an entry is not found with a wrong root. EXPECT_EQ(FILE_ERROR_NOT_FOUND, resource_metadata_->GetResourceEntryByPath( base::FilePath::FromUTF8Unsafe("non_existing/root"), &entry)); } @@ -675,10 +685,10 @@ EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->Reset()); // change stamp should be reset. - int64_t changestamp = 0; + std::string start_page_token; EXPECT_EQ(FILE_ERROR_OK, - resource_metadata_->GetLargestChangestamp(&changestamp)); - EXPECT_EQ(0, changestamp); + resource_metadata_->GetStartPageToken(&start_page_token)); + EXPECT_TRUE(start_page_token.empty()); // root should continue to exist. ResourceEntry entry;
diff --git a/components/history/core/browser/expire_history_backend.cc b/components/history/core/browser/expire_history_backend.cc index 26daa15..e3d88fe 100644 --- a/components/history/core/browser/expire_history_backend.cc +++ b/components/history/core/browser/expire_history_backend.cc
@@ -218,7 +218,7 @@ DeleteFaviconsIfPossible(&effects); BroadcastNotifications(&effects, DELETION_USER_INITIATED, - DeletionTimeRange::Invalid()); + DeletionTimeRange::Invalid(), base::nullopt); } void ExpireHistoryBackend::ExpireHistoryBetween( @@ -244,10 +244,8 @@ visits.push_back(*visit); } } - DeletionTimeRange time_range = restrict_urls.empty() - ? DeletionTimeRange(begin_time, end_time) - : DeletionTimeRange::Invalid(); - ExpireVisitsInternal(visits, time_range); + DeletionTimeRange time_range(begin_time, end_time); + ExpireVisitsInternal(visits, time_range, restrict_urls); } void ExpireHistoryBackend::ExpireHistoryForTimes( @@ -270,12 +268,13 @@ } void ExpireHistoryBackend::ExpireVisits(const VisitVector& visits) { - ExpireVisitsInternal(visits, DeletionTimeRange::Invalid()); + ExpireVisitsInternal(visits, DeletionTimeRange::Invalid(), {}); } void ExpireHistoryBackend::ExpireVisitsInternal( const VisitVector& visits, - const DeletionTimeRange& time_range) { + const DeletionTimeRange& time_range, + const std::set<GURL>& restrict_urls) { if (visits.empty()) return; @@ -292,7 +291,9 @@ // and we don't want to leave any evidence. ExpireURLsForVisits(visits_and_redirects, &effects); DeleteFaviconsIfPossible(&effects); - BroadcastNotifications(&effects, DELETION_USER_INITIATED, time_range); + BroadcastNotifications( + &effects, DELETION_USER_INITIATED, time_range, + restrict_urls.empty() ? base::Optional<std::set<GURL>>() : restrict_urls); // Pick up any bits possibly left over. ParanoidExpireHistory(); @@ -377,14 +378,15 @@ void ExpireHistoryBackend::BroadcastNotifications( DeleteEffects* effects, DeletionType type, - const DeletionTimeRange& time_range) { + const DeletionTimeRange& time_range, + base::Optional<std::set<GURL>> restrict_urls) { if (!effects->modified_urls.empty()) { notifier_->NotifyURLsModified(effects->modified_urls); } if (!effects->deleted_urls.empty() || time_range.IsValid()) { notifier_->NotifyURLsDeleted(DeletionInfo( time_range, type == DELETION_EXPIRED, std::move(effects->deleted_urls), - std::move(effects->deleted_favicons))); + std::move(effects->deleted_favicons), std::move(restrict_urls))); } } @@ -611,7 +613,7 @@ } BroadcastNotifications(&effects, DELETION_EXPIRED, - DeletionTimeRange::Invalid()); + DeletionTimeRange::Invalid(), base::nullopt); } bool ExpireHistoryBackend::ExpireSomeOldHistory( @@ -634,10 +636,9 @@ DeleteVisitRelatedInfo(deleted_visits, &deleted_effects); ExpireURLsForVisits(deleted_visits, &deleted_effects); DeleteFaviconsIfPossible(&deleted_effects); - DeletionTimeRange time_range = - more_to_expire ? DeletionTimeRange::Invalid() - : DeletionTimeRange(base::Time(), end_time); - BroadcastNotifications(&deleted_effects, DELETION_EXPIRED, time_range); + + BroadcastNotifications(&deleted_effects, DELETION_EXPIRED, + DeletionTimeRange::Invalid(), base::nullopt); return more_to_expire; }
diff --git a/components/history/core/browser/expire_history_backend.h b/components/history/core/browser/expire_history_backend.h index 7b4b1e6..2890f42 100644 --- a/components/history/core/browser/expire_history_backend.h +++ b/components/history/core/browser/expire_history_backend.h
@@ -202,7 +202,8 @@ void ExpireURLsForVisits(const VisitVector& visits, DeleteEffects* effects); void ExpireVisitsInternal(const VisitVector& visits, - const DeletionTimeRange& time_range); + const DeletionTimeRange& time_range, + const std::set<GURL>& restrict_urls); // Deletes the favicons listed in |effects->affected_favicons| if they are // unsued. Fails silently (we don't care about favicons so much, so don't want @@ -223,7 +224,8 @@ // Broadcasts URL modified and deleted notifications. void BroadcastNotifications(DeleteEffects* effects, DeletionType type, - const DeletionTimeRange& time_range); + const DeletionTimeRange& time_range, + base::Optional<std::set<GURL>> restrict_urls); // Schedules a call to DoExpireIteration. void ScheduleExpire();
diff --git a/components/history/core/browser/expire_history_backend_unittest.cc b/components/history/core/browser/expire_history_backend_unittest.cc index 6d49a0d9..aa1229e6 100644 --- a/components/history/core/browser/expire_history_backend_unittest.cc +++ b/components/history/core/browser/expire_history_backend_unittest.cc
@@ -105,9 +105,10 @@ // |expired|, or manually deleted. void EnsureURLInfoGone(const URLRow& row, bool expired); - const DeletionInfo& GetLastDeletionInfo() { - EXPECT_FALSE(urls_deleted_notifications_.empty()); - return urls_deleted_notifications_.back(); + const DeletionInfo* GetLastDeletionInfo() { + if (urls_deleted_notifications_.empty()) + return nullptr; + return &urls_deleted_notifications_.back(); } // Returns whether HistoryBackendNotifier::NotifyURLsModified was @@ -618,8 +619,8 @@ // This should delete the last two visits. std::set<GURL> restrict_urls; expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], base::Time()); - EXPECT_EQ(GetLastDeletionInfo().time_range().begin(), visit_times[2]); - EXPECT_EQ(GetLastDeletionInfo().time_range().end(), base::Time()); + EXPECT_EQ(GetLastDeletionInfo()->time_range().begin(), visit_times[2]); + EXPECT_EQ(GetLastDeletionInfo()->time_range().end(), base::Time()); // Verify that the middle URL had its last visit deleted only. visits.clear(); @@ -809,7 +810,7 @@ times.push_back(visit_times[3]); times.push_back(visit_times[2]); expirer_.ExpireHistoryForTimes(times); - EXPECT_FALSE(GetLastDeletionInfo().time_range().IsValid()); + EXPECT_FALSE(GetLastDeletionInfo()->time_range().IsValid()); // Verify that the middle URL had its last visit deleted only. visits.clear(); @@ -858,9 +859,12 @@ ASSERT_EQ(1U, visits.size()); // This should delete the last two visits. - std::set<GURL> restrict_urls; - restrict_urls.insert(url_row1.url()); + std::set<GURL> restrict_urls = {url_row1.url()}; expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], base::Time()); + EXPECT_EQ(GetLastDeletionInfo()->time_range().begin(), visit_times[2]); + EXPECT_EQ(GetLastDeletionInfo()->time_range().end(), base::Time()); + EXPECT_EQ(GetLastDeletionInfo()->deleted_rows().size(), 0U); + EXPECT_EQ(GetLastDeletionInfo()->restrict_urls()->size(), 1U); // Verify that the middle URL had its last visit deleted only. visits.clear(); @@ -1027,19 +1031,19 @@ // Deleting a time range with no URLs should return false (nothing found). EXPECT_FALSE(expirer_.ExpireSomeOldHistory( visit_times[0] - base::TimeDelta::FromDays(100), reader, 1)); - EXPECT_EQ(GetLastDeletionInfo().time_range().begin(), base::Time()); - EXPECT_EQ(GetLastDeletionInfo().time_range().end(), - visit_times[0] - base::TimeDelta::FromDays(100)); + EXPECT_EQ(nullptr, GetLastDeletionInfo()); // Deleting a time range with not up the the max results should also return // false (there will only be one visit deleted in this range). EXPECT_FALSE(expirer_.ExpireSomeOldHistory(visit_times[0], reader, 2)); - EXPECT_EQ(GetLastDeletionInfo().time_range().begin(), base::Time()); - EXPECT_EQ(GetLastDeletionInfo().time_range().end(), visit_times[0]); + EXPECT_EQ(1U, GetLastDeletionInfo()->deleted_rows().size()); + EXPECT_FALSE(GetLastDeletionInfo()->time_range().IsValid()); + ClearLastNotifications(); // Deleting a time range with the max number of results should return true // (max deleted). EXPECT_TRUE(expirer_.ExpireSomeOldHistory(visit_times[2], reader, 1)); + EXPECT_EQ(nullptr, GetLastDeletionInfo()); } TEST_F(ExpireHistoryTest, ExpiringVisitsReader) {
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index aa6829e..79f1cb0 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc
@@ -413,6 +413,8 @@ const std::set<GURL>& origins) const { if (!db_) return OriginCountAndLastVisitMap(); + if (origins.empty()) + return OriginCountAndLastVisitMap(); URLDatabase::URLEnumerator it; if (!db_->InitURLEnumeratorForEverything(&it)) @@ -2636,11 +2638,17 @@ } void HistoryBackend::NotifyURLsDeleted(DeletionInfo deletion_info) { - URLRows copied_rows(deletion_info.deleted_rows()); + std::set<GURL> origins; + for (const history::URLRow& row : deletion_info.deleted_rows()) + origins.insert(row.url().GetOrigin()); + + deletion_info.set_deleted_urls_origin_map( + GetCountsAndLastVisitForOrigins(origins)); + for (HistoryBackendObserver& observer : observers_) { - observer.OnURLsDeleted(this, deletion_info.IsAllHistory(), - deletion_info.is_from_expiration(), copied_rows, - deletion_info.favicon_urls()); + observer.OnURLsDeleted( + this, deletion_info.IsAllHistory(), deletion_info.is_from_expiration(), + deletion_info.deleted_rows(), deletion_info.favicon_urls()); } if (delegate_)
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc index 4d5d4f7..b9c1deba 100644 --- a/components/history/core/browser/history_service.cc +++ b/components/history/core/browser/history_service.cc
@@ -340,7 +340,7 @@ callback); } -void HistoryService::GetCountsAndLastVisitForOrigins( +void HistoryService::GetCountsAndLastVisitForOriginsForTesting( const std::set<GURL>& origins, const GetCountsAndLastVisitForOriginsCallback& callback) const { DCHECK(backend_task_runner_) << "History service being called after cleanup";
diff --git a/components/history/core/browser/history_service.h b/components/history/core/browser/history_service.h index b95421e..dec21d5 100644 --- a/components/history/core/browser/history_service.h +++ b/components/history/core/browser/history_service.h
@@ -161,7 +161,7 @@ // Gets the counts and most recent visit date of URLs that belong to |origins| // in the history database. - void GetCountsAndLastVisitForOrigins( + void GetCountsAndLastVisitForOriginsForTesting( const std::set<GURL>& origins, const GetCountsAndLastVisitForOriginsCallback& callback) const;
diff --git a/components/history/core/browser/history_types.cc b/components/history/core/browser/history_types.cc index 3f26859..c221656c 100644 --- a/components/history/core/browser/history_types.cc +++ b/components/history/core/browser/history_types.cc
@@ -374,26 +374,34 @@ // static DeletionInfo DeletionInfo::ForAllHistory() { - return DeletionInfo(DeletionTimeRange::AllTime(), false, {}, {}); + return DeletionInfo(DeletionTimeRange::AllTime(), false, {}, {}, + base::nullopt); } // static DeletionInfo DeletionInfo::ForUrls(URLRows deleted_rows, std::set<GURL> favicon_urls) { return DeletionInfo(DeletionTimeRange::Invalid(), false, - std::move(deleted_rows), std::move(favicon_urls)); + std::move(deleted_rows), std::move(favicon_urls), + base::nullopt); } DeletionInfo::DeletionInfo(const DeletionTimeRange& time_range, bool is_from_expiration, URLRows deleted_rows, - std::set<GURL> favicon_urls) + std::set<GURL> favicon_urls, + base::Optional<std::set<GURL>> restrict_urls) : time_range_(time_range), is_from_expiration_(is_from_expiration), deleted_rows_(std::move(deleted_rows)), - favicon_urls_(std::move(favicon_urls)) { - DCHECK(!time_range.IsAllTime() || deleted_rows.empty()); -} + favicon_urls_(std::move(favicon_urls)), + restrict_urls_(std::move(restrict_urls)) { + // If time_range is all time or invalid, restrict_urls should be empty. + DCHECK(!time_range_.IsAllTime() || !restrict_urls_.has_value()); + DCHECK(time_range_.IsValid() || !restrict_urls_.has_value()); + // If restrict_urls_ is defined, it should be non-empty. + DCHECK(!restrict_urls_.has_value() || !restrict_urls_->empty()); +}; DeletionInfo::~DeletionInfo() = default;
diff --git a/components/history/core/browser/history_types.h b/components/history/core/browser/history_types.h index 22e35b5..df4341ed 100644 --- a/components/history/core/browser/history_types.h +++ b/components/history/core/browser/history_types.h
@@ -17,6 +17,7 @@ #include "base/containers/stack_container.h" #include "base/macros.h" #include "base/memory/ref_counted_memory.h" +#include "base/optional.h" #include "base/strings/string16.h" #include "base/time/time.h" #include "components/favicon_base/favicon_types.h" @@ -641,7 +642,9 @@ DeletionInfo(const DeletionTimeRange& time_range, bool is_from_expiration, URLRows deleted_rows, - std::set<GURL> favicon_urls); + std::set<GURL> favicon_urls, + base::Optional<std::set<GURL>> restrict_urls); + ~DeletionInfo(); // Move-only because of potentially large containers. DeletionInfo(DeletionInfo&& other) noexcept; @@ -651,10 +654,15 @@ // and |favicon_urls()| are undefined. bool IsAllHistory() const { return time_range_.IsAllTime(); } - // If time_range.IsValid() is true, all URLs between time_range.begin() - // and time_range.end() have been removed. + // If time_range.IsValid() is true, |restrict_urls| (or all URLs if empty) + // between time_range.begin() and time_range.end() have been removed. const DeletionTimeRange& time_range() const { return time_range_; } + // Restricts deletions within |time_range()|. + const base::Optional<std::set<GURL>>& restrict_urls() const { + return restrict_urls_; + } + // Returns true, if the URL deletion is due to expiration. bool is_from_expiration() const { return is_from_expiration_; } @@ -666,11 +674,27 @@ // Undefined if |IsAllHistory()| returns true. const std::set<GURL>& favicon_urls() const { return favicon_urls_; } + // Returns a map from origins with deleted urls to a count of remaining URLs + // and the last visited time. + const OriginCountAndLastVisitMap& deleted_urls_origin_map() const { + // The map should only be accessed after it has been populated. + DCHECK(deleted_rows_.empty() || !deleted_urls_origin_map_.empty()); + return deleted_urls_origin_map_; + } + + // Populates deleted_urls_origin_map. + void set_deleted_urls_origin_map(OriginCountAndLastVisitMap origin_map) { + DCHECK(deleted_urls_origin_map_.empty()); + deleted_urls_origin_map_ = std::move(origin_map); + } + private: DeletionTimeRange time_range_; bool is_from_expiration_; URLRows deleted_rows_; std::set<GURL> favicon_urls_; + base::Optional<std::set<GURL>> restrict_urls_; + OriginCountAndLastVisitMap deleted_urls_origin_map_; DISALLOW_COPY_AND_ASSIGN(DeletionInfo); };
diff --git a/components/infobars/core/confirm_infobar_delegate.cc b/components/infobars/core/confirm_infobar_delegate.cc index 16b93e6..d33f23e6 100644 --- a/components/infobars/core/confirm_infobar_delegate.cc +++ b/components/infobars/core/confirm_infobar_delegate.cc
@@ -19,6 +19,10 @@ return CONFIRM_INFOBAR; } +gfx::ElideBehavior ConfirmInfoBarDelegate::GetMessageElideBehavior() const { + return gfx::ELIDE_TAIL; +} + int ConfirmInfoBarDelegate::GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; }
diff --git a/components/infobars/core/confirm_infobar_delegate.h b/components/infobars/core/confirm_infobar_delegate.h index f76d7c1..8d0a89a2 100644 --- a/components/infobars/core/confirm_infobar_delegate.h +++ b/components/infobars/core/confirm_infobar_delegate.h
@@ -9,6 +9,7 @@ #include "base/strings/string16.h" #include "components/infobars/core/infobar_delegate.h" #include "components/infobars/core/infobar_manager.h" +#include "ui/gfx/text_constants.h" #include "url/gurl.h" namespace infobars { @@ -33,6 +34,10 @@ // Returns the message string to be displayed for the InfoBar. virtual base::string16 GetMessageText() const = 0; + // Returns the elide behavior for the message string. + // Not supported on Android. + virtual gfx::ElideBehavior GetMessageElideBehavior() const; + // Returns the buttons to be shown for this InfoBar. virtual int GetButtons() const;
diff --git a/components/policy/proto/device_management_backend.proto b/components/policy/proto/device_management_backend.proto index 05e3a6a..606a33f 100644 --- a/components/policy/proto/device_management_backend.proto +++ b/components/policy/proto/device_management_backend.proto
@@ -872,7 +872,8 @@ // The number of safe browsing warning pages the user has clicked through // since the last report was successfully uploaded. optional uint64 safe_browsing_warnings_click_through = 8; - // The name of the loaded profile. Empty when in incognito mode + // The name of the loaded profile, which was entered by the user when creating + // the profile. Empty when in incognito mode. optional string name = 9; } @@ -1153,33 +1154,55 @@ // go through enterprise enrollment. Unlike the other requests, this request is // not authenticated. message DeviceAutoEnrollmentRequest { - // SHA-256 hash of the device's serial number, mod |modulus|. - // Should always be present. + // Device identifier hash, mod |modulus|. + // The type of the device identifier hash depends on |enrollment_check_type|. + // If |modulus| is 1, |remainder| should be 0. + // |remainder| should always be present. optional int64 remainder = 1; - // Modulus of the hash used by the client. Should always be present. This - // is the number of buckets the client thinks the server has. For now, - // it is a power of 2, but due to the strict constraint on how many serial - // numbers a bucket can contain, it may become non power of 2. If that - // happens, client-side needs to change its assumption. + // Modulus of the hash used by the client. For now, it is a power of 2, but + // due to the strict constraint on how many serial numbers a bucket can + // contain, it may become non power of 2. If that happens, client-side needs + // to change its assumption. + // |modulus| should always be present, but setting |modulus| to 1 means that + // no bits of the client's hash are uploaded. |remainder| should be 0 in this + // case. optional int64 modulus = 2; + + enum EnrollmentCheckType { + // Unspecified. + ENROLLMENT_CHECK_TYPE_UNSPECIFIED = 0; + // Forced Re-Enrollment check with full SHA-256 hashes of the + // server-backed state key. + ENROLLMENT_CHECK_TYPE_FRE = 1; + // Forced Enrollment check with SHA-256 hashes of (brand code + “_” + serial + // number), truncated to first 8 bytes each. + ENROLLMENT_CHECK_TYPE_FORCED_ENROLLMENT = 2; + }; + + // Specifies the type of auto enrollment check that is being made. + // This also defines the format of the device identifier hash used in this + // exchange. + optional EnrollmentCheckType enrollment_check_type = 3 + [default = ENROLLMENT_CHECK_TYPE_FRE]; } // Response from server to auto-enrollment detection request. message DeviceAutoEnrollmentResponse { // If this field is present, the other fields are ignored and the client - // should send a new DeviceAutoEnrollmentRequest with a new |remainder| - // computed using this new |modulus|. If this field is empty, the client's - // request was accepted. + // should send a new DeviceAutoEnrollmentRequest with a |remainder| + // computed using this new |expected_modulus|. If this field is empty, the + // client's request was accepted. // DMServer guarantees that if the modulus sent by client in // DeviceAutoEnrollmentRequest matches server's expectation, this field // is unset. optional int64 expected_modulus = 1; - // List of hashes in the client's hash bucket. If the client's hash matches - // any in this list, the client device should do enterprise enrollment. - // If it matches none, enrollment should be optional. - // Each entry has exactly 256 bits (32 bytes). + // List of hashes. If the client's hash matches any in this list, the + // client device should do enterprise enrollment. If it matches none, + // enrollment should be optional. + // The format of each entry depends on the |enrollment_check_type| that was + // set in the DeviceAutoEnrollmentRequest. repeated bytes hash = 2; } @@ -1239,6 +1262,36 @@ optional DisabledState disabled_state = 3; } +// Request from device to server to retrieve the enrollment mode and domain for +// this device. The client will use this request when the +// DeviceAutoEnrollmentRequest exchange with |enrollment_check_type| set to +// |ENROLLMENT_CHECK_TYPE_FORCED_ENROLLMENT| indicated that it should be +// enrolled. This request is not authenticated. +message DeviceInitialEnrollmentStateRequest { + // The serial number of the device. + optional string serial_number = 1; + + // The 4-character brand code of the device. + optional string brand_code = 2; +} + +// Response from server DeviceInitialEnrollmentStateRequest. +message DeviceInitialEnrollmentStateResponse { + // Initial action to take after OOBE. + enum InitialEnrollmentMode { + // No initial enrollment restoration. + INITIAL_ENROLLMENT_MODE_NONE = 0; + // Enterprise enrollment is enforced and cannot be skipped. + INITIAL_ENROLLMENT_MODE_ENROLLMENT_ENFORCED = 1; + }; + // The server-indicated initial enrollment mode. + optional InitialEnrollmentMode initial_enrollment_mode = 1 + [default = INITIAL_ENROLLMENT_MODE_NONE]; + + // The domain the device should be enrolled into. + optional string management_domain = 2; +} + // Sent by the client to the server to pair the Host device with the Controller // device. The HTTP request contains an end-user OAuth token and only succeeds // if both Host and Controller devices belong to the end-user domain. @@ -1751,6 +1804,7 @@ // * active_directory_user_signin // * register_browser // * policy_validation_report +// * device_initial_enrollment_state // * devicetype: MUST BE "1" for Android, "2" for Chrome OS or "3" for Chrome // browser. // * apptype: MUST BE Android or Chrome. @@ -1770,10 +1824,10 @@ // policy_validation_report and chrome_desktop_report requests // Authorization: GoogleDMToken token=<dm token from register> // -// * The Authorization header isn't used for enterprise_check or for -// certificate_based_register requests, nor for register requests -// using OAuth. In the latter case, the OAuth token is passed in the -// "oauth" parameter. +// * The Authorization header isn't used for enterprise_check, +// device_initial_enrollment_state or certificate_based_register requests, +// nor for register requests using OAuth. In the latter case, the OAuth +// token is passed in the "oauth" parameter. // // DeviceManagementRequest should only contain one request which matches the // HTTP query parameter - request, as listed below. Other requests within the @@ -1803,6 +1857,7 @@ // register_browser: register_browser_request // app_install_report: app_install_report_request // policy_validation_report: policy_validation_report_request +// device_initial_enrollment_state: device_initial_enrollment_state_request // message DeviceManagementRequest { reserved 24; // unused previous version of chrome_desktop_report_request. @@ -1888,6 +1943,10 @@ // Result of validating fetched policy on the client. optional PolicyValidationReportRequest policy_validation_report_request = 27; + + // Query for initial enrollment details. + optional DeviceInitialEnrollmentStateRequest + device_initial_enrollment_state_request = 28; } // Response from server to device. @@ -2020,4 +2079,8 @@ // Response to a policy validation report. optional PolicyValidationReportResponse policy_validation_report_response = 26; + + // Response to initial enrollment details query. + optional DeviceInitialEnrollmentStateResponse + device_initial_enrollment_state_response = 27; }
diff --git a/components/resources/default_100_percent/autofill/cc-generic.png b/components/resources/default_100_percent/autofill/cc-generic.png index 43d77c2..68ceaf6 100644 --- a/components/resources/default_100_percent/autofill/cc-generic.png +++ b/components/resources/default_100_percent/autofill/cc-generic.png Binary files differ
diff --git a/components/resources/default_200_percent/autofill/cc-generic.png b/components/resources/default_200_percent/autofill/cc-generic.png index 559aa286..5eab89e 100644 --- a/components/resources/default_200_percent/autofill/cc-generic.png +++ b/components/resources/default_200_percent/autofill/cc-generic.png Binary files differ
diff --git a/components/resources/default_300_percent/autofill/cc-generic.png b/components/resources/default_300_percent/autofill/cc-generic.png index 5827ec26..8861bbc0 100644 --- a/components/resources/default_300_percent/autofill/cc-generic.png +++ b/components/resources/default_300_percent/autofill/cc-generic.png Binary files differ
diff --git a/components/security_interstitials/core/browser/resources/interstitial_large.html b/components/security_interstitials/core/browser/resources/interstitial_large.html index 9aa89d25..b6dafc6 100644 --- a/components/security_interstitials/core/browser/resources/interstitial_large.html +++ b/components/security_interstitials/core/browser/resources/interstitial_large.html
@@ -32,6 +32,9 @@ <div id="error-debugging-info" class="hidden"></div> </div> </div> + <div id="recurrent-error-message"> + <p>$i18nRaw{recurrentErrorParagraph}</p> + </div> <div id="extended-reporting-opt-in" class="hidden"> <label> <div class="checkboxes">
diff --git a/components/security_interstitials/core/browser/resources/interstitial_large.js b/components/security_interstitials/core/browser/resources/interstitial_large.js index 7e4e981b..30a716ac 100644 --- a/components/security_interstitials/core/browser/resources/interstitial_large.js +++ b/components/security_interstitials/core/browser/resources/interstitial_large.js
@@ -69,6 +69,8 @@ var captivePortal = interstitialType == 'CAPTIVE_PORTAL'; var badClock = ssl && loadTimeData.getBoolean('bad_clock'); var hidePrimaryButton = loadTimeData.getBoolean('hide_primary_button'); + var showRecurrentErrorParagraph = loadTimeData.getBoolean( + 'show_recurrent_error_paragraph'); if (ssl) { $('body').classList.add(badClock ? 'bad-clock' : 'ssl'); @@ -126,6 +128,10 @@ $('proceed-link').classList.add('small-link'); } + if (!ssl || !showRecurrentErrorParagraph) { + $('recurrent-error-message').classList.add(HIDDEN_CLASS); + } + if ($('diagnostic-link')) { $('diagnostic-link').addEventListener('click', function(event) { sendCommand(SecurityInterstitialCommandId.CMD_OPEN_DIAGNOSTIC);
diff --git a/components/security_interstitials/core/common_string_util.cc b/components/security_interstitials/core/common_string_util.cc index 6c36f648..bf218065 100644 --- a/components/security_interstitials/core/common_string_util.cc +++ b/components/security_interstitials/core/common_string_util.cc
@@ -31,6 +31,10 @@ "openDetails", l10n_util::GetStringUTF16(IDS_SSL_OPEN_DETAILS_BUTTON)); load_time_data->SetString( "closeDetails", l10n_util::GetStringUTF16(IDS_SSL_CLOSE_DETAILS_BUTTON)); + // Not used by most interstitials; can be overridden by individual + // interstitials as needed. + load_time_data->SetString("recurrentErrorParagraph", ""); + load_time_data->SetBoolean("show_recurrent_error_paragraph", false); } void PopulateSSLDebuggingStrings(const net::SSLInfo ssl_info,
diff --git a/components/security_interstitials/core/controller_client.cc b/components/security_interstitials/core/controller_client.cc index 09fa690c..e416177 100644 --- a/components/security_interstitials/core/controller_client.cc +++ b/components/security_interstitials/core/controller_client.cc
@@ -68,6 +68,10 @@ } } +bool ControllerClient::HasSeenRecurrentError() { + return false; +} + GURL ControllerClient::GetBaseHelpCenterUrl() const { return help_center_url_; }
diff --git a/components/security_interstitials/core/controller_client.h b/components/security_interstitials/core/controller_client.h index 25fdd9c1..603bd59 100644 --- a/components/security_interstitials/core/controller_client.h +++ b/components/security_interstitials/core/controller_client.h
@@ -100,6 +100,10 @@ virtual const std::string& GetApplicationLocale() const = 0; + // Returns true if the error page should display a message to account for the + // fact that the user has seen the same error multiple times. + virtual bool HasSeenRecurrentError(); + GURL GetBaseHelpCenterUrl() const; void SetBaseHelpCenterUrlForTesting(const GURL& test_url);
diff --git a/components/security_interstitials/core/safe_browsing_loud_error_ui.cc b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc index 4e40f5c5..06f0b5c 100644 --- a/components/security_interstitials/core/safe_browsing_loud_error_ui.cc +++ b/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
@@ -105,6 +105,10 @@ break; } + // Not used by this interstitial. + load_time_data->SetString("recurrentErrorParagraph", base::string16()); + load_time_data->SetBoolean("show_recurrent_error_paragraph", false); + PopulateExtendedReportingOption(load_time_data); }
diff --git a/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc b/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc index 5953562..65ad7085 100644 --- a/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc +++ b/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc
@@ -81,6 +81,10 @@ } else { NOTREACHED(); } + + // Not used by this interstitial. + load_time_data->SetString("recurrentErrorParagraph", base::string16()); + load_time_data->SetBoolean("show_recurrent_error_paragraph", false); } void SafeBrowsingQuietErrorUI::SetGiantWebViewForTesting(
diff --git a/components/security_interstitials/core/ssl_error_ui.cc b/components/security_interstitials/core/ssl_error_ui.cc index 3f9165c9..46f13c0 100644 --- a/components/security_interstitials/core/ssl_error_ui.cc +++ b/components/security_interstitials/core/ssl_error_ui.cc
@@ -81,6 +81,11 @@ l10n_util::GetStringFUTF16( IDS_SSL_V2_PRIMARY_PARAGRAPH, common_string_util::GetFormattedHostName(request_url_))); + load_time_data->SetString( + "recurrentErrorParagraph", + l10n_util::GetStringUTF16(IDS_SSL_V2_RECURRENT_ERROR_PARAGRAPH)); + load_time_data->SetBoolean("show_recurrent_error_paragraph", + controller_->HasSeenRecurrentError()); if (soft_override_enabled_) PopulateOverridableStrings(load_time_data);
diff --git a/components/security_interstitials/core/superfish_error_ui.cc b/components/security_interstitials/core/superfish_error_ui.cc index 912f36ac..1389bcc 100644 --- a/components/security_interstitials/core/superfish_error_ui.cc +++ b/components/security_interstitials/core/superfish_error_ui.cc
@@ -59,6 +59,8 @@ load_time_data->SetString("finalParagraph", std::string()); load_time_data->SetString("openDetails", base::string16()); load_time_data->SetString("closeDetails", base::string16()); + load_time_data->SetString("recurrentErrorParagraph", base::string16()); + load_time_data->SetBoolean("show_recurrent_error_paragraph", false); } void SuperfishErrorUI::HandleCommand(SecurityInterstitialCommand command) {
diff --git a/components/security_interstitials_strings.grdp b/components/security_interstitials_strings.grdp index 1dca2b26..7cd2c26 100644 --- a/components/security_interstitials_strings.grdp +++ b/components/security_interstitials_strings.grdp
@@ -115,6 +115,9 @@ <message name="IDS_SSL_V2_PRIMARY_PARAGRAPH" desc="The primary explanatory paragraph for the SSL interstitial."> Attackers might be trying to steal your information from <ph name="BEGIN_BOLD"><strong></ph><ph name="SITE">$1<ex>google.com</ex></ph><ph name="END_BOLD"></strong></ph> (for example, passwords, messages, or credit cards). <ph name="BEGIN_LEARN_MORE_LINK"><a href="#" id="learn-more-link"></ph>Learn more<ph name="END_LEARN_MORE_LINK"></a></ph> </message> + <message name="IDS_SSL_V2_RECURRENT_ERROR_PARAGRAPH" desc="A paragraph for an SSL interstitial that the user has seen multiple times in a browsing session."> + Warnings may be common while websites update their security. This should improve soon. + </message> <!-- SSL error page: Superfish-specific --> <if expr="_google_chrome">
diff --git a/components/services/filesystem/util.cc b/components/services/filesystem/util.cc index 475dd25..7ed11a2 100644 --- a/components/services/filesystem/util.cc +++ b/components/services/filesystem/util.cc
@@ -98,10 +98,10 @@ if (!base::IsStringUTF8(raw_path)) return base::File::Error::FILE_ERROR_INVALID_OPERATION; -#if defined(OS_POSIX) - base::FilePath::StringType path = raw_path; -#elif defined(OS_WIN) +#if defined(OS_WIN) base::FilePath::StringType path = base::UTF8ToUTF16(raw_path); +#elif defined(OS_POSIX) || defined(OS_FUCHSIA) + base::FilePath::StringType path = raw_path; #endif // TODO(erg): This isn't really what we want. FilePath::AppendRelativePath()
diff --git a/components/subresource_filter/FILTER_LIST_GENERATION.md b/components/subresource_filter/FILTER_LIST_GENERATION.md new file mode 100644 index 0000000..95aff54 --- /dev/null +++ b/components/subresource_filter/FILTER_LIST_GENERATION.md
@@ -0,0 +1,91 @@ +# Generating a Smaller Filter List +Filter lists can be quite large to store in memory, which is problematic on +memory constrained devices. The following steps demonstrate how to generate a +smaller filter list by filtering out the least-frequently-used rules on the top +N websites (according to Alexa rankings). + +## 1. Gather the URL requests from the landing pages of the top N sites +This data is made available by the [HttpArchive](https://httparchive.org/) +project and is queryable via [BigQuery](https://bigquery.cloud.google.com/). A +short introduction to querying HttpArchive data is available +[here](https://www.igvita.com/2013/06/20/http-archive-bigquery-web-performance-answers/). +Because the output of our query is typically quite large, it's necessary to +have a Google Compute Engine account with a storage bucket created to write +the resulting table to. + +The query to run is: +```sql +SELECT + pages.url AS origin, + requests.url AS request_url, + requests.type AS request_type +FROM + [httparchive:summary_requests.$ARCHIVE_DATE_AND_TYPE] AS requests +INNER JOIN ( + SELECT + pageid, + url + FROM + [httparchive:summary_pages.$ARCHIVE_DATE_AND_TYPE] + WHERE + rank IS NOT NULL + AND rank <= $MAX_RANK) AS pages +ON + requests.pageid = pages.pageid; +``` + +You'll need to replace `$ARCHIVE_DATE_AND_TYPE` with the table you're +interested, such as `2018.04_15_mobile`. Replace `$MAX_RANK` with the highest +ranked Alexa page you want to process (e.g., `100000`). + +In the above query, the URLs from the top 100,000 sites are output. Change +100,000 to whichever value you wish. Since the output is too large to display +on the page, the results will need to be written to a table in your Google +Cloud Project. To do this, press the 'show options' button below your query, and press the +'select table' button to create a table to write to in your project. You'll +also want to check the 'allow large results' checkbox. + +Now run the query. The results should be available in the table you specified +in your project. Find the table on the BigQuery page and export it in JSON +format to a bucket that you create in your Google Cloud Storage. Since files +in buckets are restricted to 1GB, you'll have to shard the file over many +files. Select gzip compression and use `<your_bucket>/site_urls.*.json.gz` as +your destination. + +Once exported, you can download the files from your bucket and extract them +into a single file for processing: + +```sh +ls site_urls.*.gz | xargs gunzip -c > site_urls +``` + +## 2. Acquire a filter list in the indexed format +Chromium's tools are designed to work with a binary indexed version of filter +lists. You can use the `subresource_indexing_tool` to convert a text based +filter list to an indexed file. + +An example using [EasyList](https://easylist.to/easylist/easylist.txt) follows: + +```sh +1. ninja -C out/Release/ subresource_filter_tools +2. wget https://easylist.to/easylist/easylist.txt +3. out/Release/ruleset_converter --input_format=filter-list --output_format=unindexed-ruleset --input_files=easylist.txt --output_file=easylist_unindexed +4. out/Release/subresource_indexing_tool easylist_unindexed easylist_indexed +``` + +## 3. Generate the smaller filter list +```sh +1. ninja -C out/Release subresource_filter_tools +2. out/Release/subresource_filter_tool --ruleset=easylist_indexed match_rules --input_file=site_urls --min_matches=1 > smaller_list.txt +``` + +With `min_matches=1`, the rule will be included if it's used at least once while testing each URL from site_urls. + +## 4. Turn the smaller list into a form usable by Chromium tools +The smaller filterlist has been generated. If you'd like to convert it to Chromium's binary indexed format, proceed with the following steps: + +```sh +1. ninja -C out/Release/ subresource_filter_tools +2. out/Release/ruleset_converter --input_format=filter-list --output_format=unindexed-ruleset --input_files=smaller_list.txt --output_file=smaller_list_unindexed +3. out/Release/subresource_indexing_tool smaller_list_unindexed smaller_list_indexed +```
diff --git a/components/sync/protocol/bookmark_specifics.proto b/components/sync/protocol/bookmark_specifics.proto index 8ce46e7d..48f6faa6 100644 --- a/components/sync/protocol/bookmark_specifics.proto +++ b/components/sync/protocol/bookmark_specifics.proto
@@ -24,8 +24,8 @@ optional string url = 1; optional bytes favicon = 2; optional string title = 3; - // Corresponds to BookmarkNode::date_added() and is the internal value from - // base::Time. + // Corresponds to BookmarkNode::date_added() represented as microseconds since + // the Windows epoch. optional int64 creation_time_us = 4; optional string icon_url = 5; repeated MetaInfo meta_info = 6;
diff --git a/components/sync_bookmarks/BUILD.gn b/components/sync_bookmarks/BUILD.gn index 09110f9..eecc87f7 100644 --- a/components/sync_bookmarks/BUILD.gn +++ b/components/sync_bookmarks/BUILD.gn
@@ -16,6 +16,8 @@ "bookmark_model_type_controller.h", "bookmark_model_type_processor.cc", "bookmark_model_type_processor.h", + "synced_bookmark_tracker.cc", + "synced_bookmark_tracker.h", ] deps = [ @@ -36,6 +38,7 @@ "bookmark_data_type_controller_unittest.cc", "bookmark_model_type_controller_unittest.cc", "bookmark_model_type_processor_unittest.cc", + "synced_bookmark_tracker_unittest.cc", ] deps = [
diff --git a/components/sync_bookmarks/bookmark_model_type_controller.cc b/components/sync_bookmarks/bookmark_model_type_controller.cc index ccc49f8..678334e 100644 --- a/components/sync_bookmarks/bookmark_model_type_controller.cc +++ b/components/sync_bookmarks/bookmark_model_type_controller.cc
@@ -68,12 +68,15 @@ base::Callback<void(bool)> set_downloaded, syncer::ModelTypeConfigurer* configurer) { DCHECK(CalledOnValidThread()); + if (activated_) + return; DCHECK(configurer); std::unique_ptr<syncer::ActivationContext> activation_context = PrepareActivationContext(); set_downloaded.Run(activation_context->model_type_state.initial_sync_done()); configurer->ActivateNonBlockingDataType(type(), std::move(activation_context)); + activated_ = true; } void BookmarkModelTypeController::StartAssociating( @@ -92,13 +95,17 @@ void BookmarkModelTypeController::ActivateDataType( syncer::ModelTypeConfigurer* configurer) { DCHECK(CalledOnValidThread()); - NOTIMPLEMENTED(); + DCHECK(configurer); + DCHECK_EQ(RUNNING, state_); } void BookmarkModelTypeController::DeactivateDataType( syncer::ModelTypeConfigurer* configurer) { DCHECK(CalledOnValidThread()); - NOTIMPLEMENTED(); + if (activated_) { + configurer->DeactivateNonBlockingDataType(type()); + activated_ = false; + } } void BookmarkModelTypeController::Stop() { @@ -158,7 +165,8 @@ directory->InitialSyncEndedForType(type())); // TODO(pavely): Populate model_type_state.type_context. - model_type_processor_ = std::make_unique<BookmarkModelTypeProcessor>(); + model_type_processor_ = + std::make_unique<BookmarkModelTypeProcessor>(sync_client_); activation_context->type_processor = std::make_unique<syncer::ModelTypeProcessorProxy>( model_type_processor_->GetWeakPtr(),
diff --git a/components/sync_bookmarks/bookmark_model_type_controller.h b/components/sync_bookmarks/bookmark_model_type_controller.h index daf3b1a..42451be 100644 --- a/components/sync_bookmarks/bookmark_model_type_controller.h +++ b/components/sync_bookmarks/bookmark_model_type_controller.h
@@ -61,6 +61,12 @@ // BookmarkModel/HistoryService. std::unique_ptr<BookmarkModelTypeProcessor> model_type_processor_; + // This is a hack to prevent reconfigurations from crashing, because USS + // activation is not idempotent. RegisterWithBackend only needs to actually do + // something the first time after the type is enabled. + // TODO(crbug.com/647505): Remove this once the DTM handles things better. + bool activated_ = false; + DISALLOW_COPY_AND_ASSIGN(BookmarkModelTypeController); };
diff --git a/components/sync_bookmarks/bookmark_model_type_processor.cc b/components/sync_bookmarks/bookmark_model_type_processor.cc index ccac311..0c6969e3 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor.cc
@@ -7,13 +7,128 @@ #include <utility> #include "base/callback.h" +#include "base/strings/utf_string_conversions.h" +#include "components/bookmarks/browser/bookmark_model.h" #include "components/sync/base/model_type.h" +#include "components/sync/driver/sync_client.h" #include "components/sync/engine/commit_queue.h" +#include "components/undo/bookmark_undo_utils.h" namespace sync_bookmarks { -BookmarkModelTypeProcessor::BookmarkModelTypeProcessor() - : weak_ptr_factory_(this) {} +namespace { + +// The sync protocol identifies top-level entities by means of well-known tags, +// (aka server defined tags) which should not be confused with titles or client +// tags that aren't supported by bookmarks (at the time of writing). Each tag +// corresponds to a singleton instance of a particular top-level node in a +// user's share; the tags are consistent across users. The tags allow us to +// locate the specific folders whose contents we care about synchronizing, +// without having to do a lookup by name or path. The tags should not be made +// user-visible. For example, the tag "bookmark_bar" represents the permanent +// node for bookmarks bar in Chrome. The tag "other_bookmarks" represents the +// permanent folder Other Bookmarks in Chrome. +// +// It is the responsibility of something upstream (at time of writing, the sync +// server) to create these tagged nodes when initializing sync for the first +// time for a user. Thus, once the backend finishes initializing, the +// ProfileSyncService can rely on the presence of tagged nodes. +const char kBookmarkBarTag[] = "bookmark_bar"; +const char kMobileBookmarksTag[] = "synced_bookmarks"; +const char kOtherBookmarksTag[] = "other_bookmarks"; + +// Id is created by concatenating the specifics field number and the server tag +// similar to LookbackServerEntity::CreateId() that uses +// GetSpecificsFieldNumberFromModelType() to compute the field number. +static const char kBookmarksRootId[] = "32904_google_chrome_bookmarks"; + +// |sync_entity| must contain a bookmark specifics. +// Metainfo entries must have unique keys. +bookmarks::BookmarkNode::MetaInfoMap GetBookmarkMetaInfo( + const syncer::EntityData& sync_entity) { + const sync_pb::BookmarkSpecifics& specifics = + sync_entity.specifics.bookmark(); + bookmarks::BookmarkNode::MetaInfoMap meta_info_map; + for (const sync_pb::MetaInfo& meta_info : specifics.meta_info()) { + meta_info_map[meta_info.key()] = meta_info.value(); + } + DCHECK_EQ(static_cast<size_t>(specifics.meta_info_size()), + meta_info_map.size()); + return meta_info_map; +} + +// Creates a bookmark node under the given parent node from the given sync node. +// Returns the newly created node. |sync_entity| must contain a bookmark +// specifics with Metainfo entries having unique keys. +const bookmarks::BookmarkNode* CreateBookmarkNode( + const syncer::EntityData& sync_entity, + const bookmarks::BookmarkNode* parent, + bookmarks::BookmarkModel* model, + syncer::SyncClient* sync_client, + int index) { + DCHECK(parent); + DCHECK(model); + DCHECK(sync_client); + + const sync_pb::BookmarkSpecifics& specifics = + sync_entity.specifics.bookmark(); + bookmarks::BookmarkNode::MetaInfoMap metainfo = + GetBookmarkMetaInfo(sync_entity); + if (sync_entity.is_folder) { + return model->AddFolderWithMetaInfo( + parent, index, base::UTF8ToUTF16(specifics.title()), &metainfo); + } + // 'creation_time_us' was added in M24. Assume a time of 0 means now. + const int64_t create_time_us = specifics.creation_time_us(); + base::Time create_time = + (create_time_us == 0) + ? base::Time::Now() + : base::Time::FromDeltaSinceWindowsEpoch( + // Use FromDeltaSinceWindowsEpoch because create_time_us has + // always used the Windows epoch. + base::TimeDelta::FromMicroseconds(create_time_us)); + return model->AddURLWithCreationTimeAndMetaInfo( + parent, index, base::UTF8ToUTF16(specifics.title()), + GURL(specifics.url()), create_time, &metainfo); + // TODO(crbug.com/516866): Add the favicon related code. +} + +class ScopedRemoteUpdateBookmarks { + public: + // |bookmark_model| must not be null and must outlive this object. + explicit ScopedRemoteUpdateBookmarks(syncer::SyncClient* const sync_client) + : sync_client_(sync_client), + suspend_undo_(sync_client->GetBookmarkUndoServiceIfExists()) { + // Notify UI intensive observers of BookmarkModel that we are about to make + // potentially significant changes to it, so the updates may be batched. For + // example, on Mac, the bookmarks bar displays animations when bookmark + // items are added or deleted. + sync_client_->GetBookmarkModel()->BeginExtensiveChanges(); + } + + ~ScopedRemoteUpdateBookmarks() { + // Notify UI intensive observers of BookmarkModel that all updates have been + // applied, and that they may now be consumed. This prevents issues like the + // one described in https://crbug.com/281562, where old and new items on the + // bookmarks bar would overlap. + sync_client_->GetBookmarkModel()->EndExtensiveChanges(); + } + + private: + syncer::SyncClient* const sync_client_; + + // Changes made to the bookmark model due to sync should not be undoable. + ScopedSuspendBookmarkUndo suspend_undo_; + + DISALLOW_COPY_AND_ASSIGN(ScopedRemoteUpdateBookmarks); +}; +} // namespace + +BookmarkModelTypeProcessor::BookmarkModelTypeProcessor( + syncer::SyncClient* sync_client) + : sync_client_(sync_client), + bookmark_model_(sync_client->GetBookmarkModel()), + weak_ptr_factory_(this) {} BookmarkModelTypeProcessor::~BookmarkModelTypeProcessor() = default; @@ -49,7 +164,133 @@ const sync_pb::ModelTypeState& model_type_state, const syncer::UpdateResponseDataList& updates) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - NOTIMPLEMENTED(); + + ScopedRemoteUpdateBookmarks update_bookmarks(sync_client_); + + for (const syncer::UpdateResponseData* update : ReorderUpdates(updates)) { + const syncer::EntityData& update_data = update->entity.value(); + // TODO(crbug.com/516866): Check |update_data| for sanity. + // 1. Has bookmark specifics. + // 2. All meta info entries in the specifics have unique keys. + const SyncedBookmarkTracker::Entity* entity_tracker = + bookmark_tracker_.GetEntityForSyncId(update_data.id); + if (update_data.is_deleted()) { + // TODO(crbug.com/516866): Handle Delete. + continue; + } + if (!entity_tracker) { + ProcessRemoteCreate(update_data); + continue; + } + // Ignore changes to the permanent nodes (e.g. bookmarks bar). We only care + // about their children. + if (bookmark_model_->is_permanent_node(entity_tracker->bookmark_node())) { + continue; + } + if (entity_tracker->IsUnsynced()) { + // TODO(crbug.com/516866): Handle conflict resolution. + continue; + } + if (!entity_tracker->MatchesData(update_data)) { + // TODO(crbug.com/516866): Handle update + continue; + } + } +} + +// static +std::vector<const syncer::UpdateResponseData*> +BookmarkModelTypeProcessor::ReorderUpdatesForTest( + const syncer::UpdateResponseDataList& updates) { + return ReorderUpdates(updates); +} + +// static +std::vector<const syncer::UpdateResponseData*> +BookmarkModelTypeProcessor::ReorderUpdates( + const syncer::UpdateResponseDataList& updates) { + // TODO(crbug.com/516866): This is a very simple (hacky) reordering algorithm + // that assumes no folders exist except the top level permanent ones. This + // should be fixed before enabling USS for bookmarks. + std::vector<const syncer::UpdateResponseData*> ordered_updates; + for (const syncer::UpdateResponseData& update : updates) { + if (update.entity.value().parent_id == "0") { + continue; + } + if (update.entity.value().parent_id == kBookmarksRootId) { + ordered_updates.push_back(&update); + } + } + for (const syncer::UpdateResponseData& update : updates) { + if (update.entity.value().parent_id != "0" && + update.entity.value().parent_id != kBookmarksRootId) { + ordered_updates.push_back(&update); + } + } + return ordered_updates; +} + +void BookmarkModelTypeProcessor::ProcessRemoteCreate( + const syncer::EntityData& update_data) { + // Because the Synced Bookmarks node can be created server side, it's possible + // it'll arrive at the client as an update. In that case it won't have been + // associated at startup, the GetChromeNodeFromSyncId call above will return + // null, and we won't detect it as a permanent node, resulting in us trying to + // create it here (which will fail). Therefore, we add special logic here just + // to detect the Synced Bookmarks folder. + if (update_data.parent_id == kBookmarksRootId) { + // Associate permanent folders. + AssociatePermanentFolder(update_data); + return; + } + + const bookmarks::BookmarkNode* parent_node = GetParentNode(update_data); + if (!parent_node) { + // If we cannot find the parent, we can do nothing. + DLOG(ERROR) << "Could not find parent of node being added." + << " Node title: " << update_data.specifics.bookmark().title() + << ", parent id = " << update_data.parent_id; + return; + } + const bookmarks::BookmarkNode* bookmark_node = + CreateBookmarkNode(update_data, parent_node, bookmark_model_, + sync_client_, parent_node->child_count()); + if (!bookmark_node) { + // We ignore bookmarks we can't add. + DLOG(ERROR) << "Failed to create bookmark node with title " + << update_data.specifics.bookmark().title() << " and url " + << update_data.specifics.bookmark().url(); + return; + } + bookmark_tracker_.Associate(update_data.id, bookmark_node); +} + +const bookmarks::BookmarkNode* BookmarkModelTypeProcessor::GetParentNode( + const syncer::EntityData& update_data) const { + const SyncedBookmarkTracker::Entity* parent_entity = + bookmark_tracker_.GetEntityForSyncId(update_data.parent_id); + if (!parent_entity) { + return nullptr; + } + return parent_entity->bookmark_node(); +} + +void BookmarkModelTypeProcessor::AssociatePermanentFolder( + const syncer::EntityData& update_data) { + DCHECK_EQ(update_data.parent_id, kBookmarksRootId); + + const bookmarks::BookmarkNode* permanent_node = nullptr; + if (update_data.server_defined_unique_tag == kBookmarkBarTag) { + permanent_node = bookmark_model_->bookmark_bar_node(); + } else if (update_data.server_defined_unique_tag == kOtherBookmarksTag) { + permanent_node = bookmark_model_->other_node(); + } else if (update_data.server_defined_unique_tag == kMobileBookmarksTag) { + permanent_node = bookmark_model_->mobile_node(); + } + + if (permanent_node != nullptr) { + bookmark_tracker_.Associate(update_data.id, permanent_node); + } } base::WeakPtr<syncer::ModelTypeProcessor>
diff --git a/components/sync_bookmarks/bookmark_model_type_processor.h b/components/sync_bookmarks/bookmark_model_type_processor.h index 3a32a958..dc9c7ae 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor.h +++ b/components/sync_bookmarks/bookmark_model_type_processor.h
@@ -6,17 +6,28 @@ #define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_TYPE_PROCESSOR_H_ #include <memory> +#include <vector> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "components/sync/engine/model_type_processor.h" +#include "components/sync_bookmarks/synced_bookmark_tracker.h" + +namespace syncer { +class SyncClient; +} + +namespace bookmarks { +class BookmarkModel; +} namespace sync_bookmarks { class BookmarkModelTypeProcessor : public syncer::ModelTypeProcessor { public: - BookmarkModelTypeProcessor(); + // |sync_client| must not be nullptr and must outlive this object. + explicit BookmarkModelTypeProcessor(syncer::SyncClient* sync_client); ~BookmarkModelTypeProcessor() override; // ModelTypeProcessor implementation. @@ -30,13 +41,54 @@ void OnUpdateReceived(const sync_pb::ModelTypeState& type_state, const syncer::UpdateResponseDataList& updates) override; + // Public for testing. + static std::vector<const syncer::UpdateResponseData*> ReorderUpdatesForTest( + const syncer::UpdateResponseDataList& updates); + base::WeakPtr<syncer::ModelTypeProcessor> GetWeakPtr(); private: SEQUENCE_CHECKER(sequence_checker_); + // Reorder incoming updates such that parent creation is before child creation + // and child deletion is before parent deletion. The returned pointers point + // to the elements in the original |updates|. + static std::vector<const syncer::UpdateResponseData*> ReorderUpdates( + const syncer::UpdateResponseDataList& updates); + + // Given a remote update entity, it returns the parent bookmark node of the + // corresponding node. It returns null if the parent node cannot be found. + const bookmarks::BookmarkNode* GetParentNode( + const syncer::EntityData& update_data) const; + + // Processor a remote creation of a bookmark node. + // 1. For permanent folders, they are only registered in |bookmark_tracker_|. + // 2. If the nodes parent cannot be found, the remote creation update is + // ignored. + // 3. Otherwise, a new node is created in the local bookmark model and + // registered in |bookmark_tracker_|. + void ProcessRemoteCreate(const syncer::EntityData& update_data); + + // Associates the permanent bookmark folders with the corresponding server + // side ids and registers the association in |bookmark_tracker_|. + // |update_data| must contain server_defined_unique_tag that is used to + // determine the corresponding permanent node. All permanent nodes are assumed + // to be directly children nodes of |kBookmarksRootId|. This method is used in + // the initial sync cycle only. + void AssociatePermanentFolder(const syncer::EntityData& update_data); + + syncer::SyncClient* const sync_client_; + + // The bookmark model we are processing local changes from and forwarding + // remote changes to. + bookmarks::BookmarkModel* const bookmark_model_; + std::unique_ptr<syncer::CommitQueue> worker_; + // Keep the mapping between server ids and bookmarks nodes. It also caches the + // metadata upon a local change until the commit configration is received. + SyncedBookmarkTracker bookmark_tracker_; + base::WeakPtrFactory<BookmarkModelTypeProcessor> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(BookmarkModelTypeProcessor);
diff --git a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc index b3d40e3..571598dd 100644 --- a/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_type_processor_unittest.cc
@@ -4,16 +4,141 @@ #include "components/sync_bookmarks/bookmark_model_type_processor.h" +#include <string> + +#include "base/strings/utf_string_conversions.h" +#include "components/bookmarks/browser/bookmark_model.h" +#include "components/bookmarks/test/test_bookmark_client.h" +#include "components/sync/driver/fake_sync_client.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using base::ASCIIToUTF16; +using testing::Eq; +using testing::NotNull; + namespace sync_bookmarks { namespace { -class BookmarkModelTypeProcessorTest : public testing::Test {}; +// The parent tag for children of the root entity. Entities with this parent are +// referred to as top level enities. +const char kRootParentTag[] = "0"; +const char kBookmarkBarTag[] = "bookmark_bar"; +const char kBookmarksRootId[] = "32904_google_chrome_bookmarks"; -TEST_F(BookmarkModelTypeProcessorTest, CreateInstance) { - BookmarkModelTypeProcessor processor; +syncer::UpdateResponseData CreateUpdateData(const std::string& id, + const std::string& title, + const std::string& url, + const std::string& parent_id, + const std::string& server_tag) { + syncer::EntityData data; + data.id = id; + data.parent_id = parent_id; + data.server_defined_unique_tag = server_tag; + + sync_pb::BookmarkSpecifics* bookmark_specifics = + data.specifics.mutable_bookmark(); + bookmark_specifics->set_title(title); + bookmark_specifics->set_url(url); + + syncer::UpdateResponseData response_data; + response_data.entity = data.PassToPtr(); + // Similar to what's done in the loopback_server. + response_data.response_version = 0; + return response_data; +} + +syncer::UpdateResponseData CreateBookmarkRootUpdateData() { + return CreateUpdateData(syncer::ModelTypeToRootTag(syncer::BOOKMARKS), + std::string(), std::string(), kRootParentTag, + syncer::ModelTypeToRootTag(syncer::BOOKMARKS)); +} + +class TestSyncClient : public syncer::FakeSyncClient { + public: + explicit TestSyncClient(bookmarks::BookmarkModel* bookmark_model) + : bookmark_model_(bookmark_model) {} + + bookmarks::BookmarkModel* GetBookmarkModel() override { + return bookmark_model_; + } + + private: + bookmarks::BookmarkModel* bookmark_model_; +}; + +class BookmarkModelTypeProcessorTest : public testing::Test { + public: + BookmarkModelTypeProcessorTest() + : bookmark_model_(bookmarks::TestBookmarkClient::CreateModel()), + sync_client_(bookmark_model_.get()) {} + + TestSyncClient* sync_client() { return &sync_client_; } + bookmarks::BookmarkModel* bookmark_model() { return bookmark_model_.get(); } + + private: + std::unique_ptr<bookmarks::BookmarkModel> bookmark_model_; + TestSyncClient sync_client_; +}; + +TEST_F(BookmarkModelTypeProcessorTest, ReorderUpdatesShouldIgnoreRootNodes) { + syncer::UpdateResponseDataList updates; + updates.push_back(CreateBookmarkRootUpdateData()); + std::vector<const syncer::UpdateResponseData*> ordered_updates = + BookmarkModelTypeProcessor::ReorderUpdatesForTest(updates); + // Root node update should be filtered out. + EXPECT_THAT(ordered_updates.size(), Eq(0U)); +} + +// TODO(crbug.com/516866): This should change to cover the general case of +// testing parents before children for non-deletions. +TEST_F(BookmarkModelTypeProcessorTest, + ReorderUpdatesShouldPlacePermanentNodesFirstForNonDeletions) { + std::string node1_id = "node1"; + std::string node2_id = "node2"; + syncer::UpdateResponseDataList updates; + updates.push_back(CreateUpdateData(node1_id, std::string(), std::string(), + node2_id, std::string())); + updates.push_back(CreateUpdateData(node2_id, std::string(), std::string(), + kBookmarksRootId, kBookmarkBarTag)); + std::vector<const syncer::UpdateResponseData*> ordered_updates = + BookmarkModelTypeProcessor::ReorderUpdatesForTest(updates); + + // No update should be dropped. + ASSERT_THAT(ordered_updates.size(), Eq(2U)); + + // Updates should be ordered such that parent node update comes first. + EXPECT_THAT(ordered_updates[0]->entity.value().id, Eq(node2_id)); + EXPECT_THAT(ordered_updates[1]->entity.value().id, Eq(node1_id)); +} + +TEST_F(BookmarkModelTypeProcessorTest, ShouldUpdateModelAfterRemoteCreation) { + BookmarkModelTypeProcessor processor(sync_client()); + + syncer::UpdateResponseDataList updates; + // Add update for the permanent folder "Bookmarks bar" + updates.push_back(CreateUpdateData("bookmark_bar", std::string(), + std::string(), kBookmarksRootId, + kBookmarkBarTag)); + + // Add update for another node under the bookmarks bar. + std::string kNodeId = "node_id"; + std::string kTitle = "title"; + std::string kUrl = "http://www.url.com"; + updates.push_back(CreateUpdateData(kNodeId, kTitle, kUrl, kBookmarkBarTag, + /*server_tag=*/std::string())); + + const bookmarks::BookmarkNode* bookmarkbar = + bookmark_model()->bookmark_bar_node(); + EXPECT_TRUE(bookmarkbar->empty()); + + const sync_pb::ModelTypeState model_type_state; + processor.OnUpdateReceived(model_type_state, updates); + + ASSERT_THAT(bookmarkbar->GetChild(0), NotNull()); + EXPECT_THAT(bookmarkbar->GetChild(0)->GetTitle(), Eq(ASCIIToUTF16(kTitle))); + EXPECT_THAT(bookmarkbar->GetChild(0)->url(), Eq(GURL(kUrl))); } } // namespace
diff --git a/components/sync_bookmarks/synced_bookmark_tracker.cc b/components/sync_bookmarks/synced_bookmark_tracker.cc new file mode 100644 index 0000000..864d17f --- /dev/null +++ b/components/sync_bookmarks/synced_bookmark_tracker.cc
@@ -0,0 +1,47 @@ +// 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/sync_bookmarks/synced_bookmark_tracker.h" + +#include <utility> + +#include "components/sync/model/entity_data.h" + +namespace sync_bookmarks { + +SyncedBookmarkTracker::Entity::Entity( + const bookmarks::BookmarkNode* bookmark_node) + : bookmark_node_(bookmark_node) { + DCHECK(bookmark_node); +} + +SyncedBookmarkTracker::Entity::~Entity() = default; + +bool SyncedBookmarkTracker::Entity::MatchesData( + const syncer::EntityData& data) const { + // TODO(crbug.com/516866): Implement properly. + return false; +} + +bool SyncedBookmarkTracker::Entity::IsUnsynced() const { + // TODO(crbug.com/516866): Implement properly. + return false; +} + +SyncedBookmarkTracker::SyncedBookmarkTracker() = default; +SyncedBookmarkTracker::~SyncedBookmarkTracker() = default; + +const SyncedBookmarkTracker::Entity* SyncedBookmarkTracker::GetEntityForSyncId( + const std::string& sync_id) const { + auto it = sync_id_to_entities_map_.find(sync_id); + return it != sync_id_to_entities_map_.end() ? it->second.get() : nullptr; +} + +void SyncedBookmarkTracker::Associate( + const std::string& sync_id, + const bookmarks::BookmarkNode* bookmark_node) { + sync_id_to_entities_map_[sync_id] = std::make_unique<Entity>(bookmark_node); +} + +} // namespace sync_bookmarks
diff --git a/components/sync_bookmarks/synced_bookmark_tracker.h b/components/sync_bookmarks/synced_bookmark_tracker.h new file mode 100644 index 0000000..4953357 --- /dev/null +++ b/components/sync_bookmarks/synced_bookmark_tracker.h
@@ -0,0 +1,78 @@ +// 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_SYNC_BOOKMARKS_SYNCED_BOOKMARK_TRACKER_H_ +#define COMPONENTS_SYNC_BOOKMARKS_SYNCED_BOOKMARK_TRACKER_H_ + +#include <map> +#include <memory> +#include <string> + +#include "base/macros.h" +#include "components/sync/protocol/entity_metadata.pb.h" + +namespace bookmarks { +class BookmarkNode; +} + +namespace syncer { +struct EntityData; +} + +namespace sync_bookmarks { + +// This class is responsible for keeping the mapping between bookmarks node in +// the local model and the server-side corresponding sync entities. It manages +// the metadata for its entity and caches entity data upon a local change until +// commit confirmation is received. +class SyncedBookmarkTracker { + public: + class Entity { + public: + // |bookmark_node| must not be null and must outlive this object. + explicit Entity(const bookmarks::BookmarkNode* bookmark_node); + ~Entity(); + + // Returns true if this data is out of sync with the server. + // A commit may or may not be in progress at this time. + bool IsUnsynced() const; + + // Check whether |data| matches the stored specifics hash. + bool MatchesData(const syncer::EntityData& data) const; + + // It never returns null. + const bookmarks::BookmarkNode* bookmark_node() const { + return bookmark_node_; + } + + private: + const bookmarks::BookmarkNode* const bookmark_node_; + + DISALLOW_COPY_AND_ASSIGN(Entity); + }; + + SyncedBookmarkTracker(); + ~SyncedBookmarkTracker(); + + // Returns null if not entity is found. + const Entity* GetEntityForSyncId(const std::string& sync_id) const; + + // Associates a server id with the corresponding local bookmark node in + // |sync_id_to_entities_map_|. + void Associate(const std::string& sync_id, + const bookmarks::BookmarkNode* bookmark_node); + + private: + // A map of sync server ids to sync entities. This should contain entries and + // metadata for almost everything. However, since local data are loaded only + // when needed (e.g. before a commit cycle), the entities may not always + // contain model type data/specifics. + std::map<std::string, std::unique_ptr<Entity>> sync_id_to_entities_map_; + + DISALLOW_COPY_AND_ASSIGN(SyncedBookmarkTracker); +}; + +} // namespace sync_bookmarks + +#endif // COMPONENTS_SYNC_BOOKMARKS_SYNCED_BOOKMARK_TRACKER_H_
diff --git a/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc b/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc new file mode 100644 index 0000000..dfd8362 --- /dev/null +++ b/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc
@@ -0,0 +1,34 @@ +// 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/sync_bookmarks/synced_bookmark_tracker.h" + +#include "components/bookmarks/browser/bookmark_node.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::Eq; +using testing::IsNull; +using testing::NotNull; + +namespace sync_bookmarks { + +namespace { + +TEST(SyncedBookmarkTrackerTest, ShouldGetAssociatedNodes) { + SyncedBookmarkTracker tracker; + const std::string kSyncId = "SYNC_ID"; + const int64_t kId = 1; + bookmarks::BookmarkNode node(kId, GURL()); + tracker.Associate(kSyncId, &node); + const SyncedBookmarkTracker::Entity* entity = + tracker.GetEntityForSyncId(kSyncId); + ASSERT_THAT(entity, NotNull()); + EXPECT_THAT(entity->bookmark_node(), Eq(&node)); + EXPECT_THAT(tracker.GetEntityForSyncId("unknown id"), IsNull()); +} + +} // namespace + +} // namespace sync_bookmarks
diff --git a/components/sync_sessions/session_store.cc b/components/sync_sessions/session_store.cc index c1d1c38..f08a600 100644 --- a/components/sync_sessions/session_store.cc +++ b/components/sync_sessions/session_store.cc
@@ -573,11 +573,9 @@ base::BindRepeating( [](syncer::MutableDataBatch* batch, const std::string& session_name, sync_pb::SessionSpecifics* specifics) { + DCHECK(AreValidSpecifics(*specifics)); // Local variable used to avoid assuming argument evaluation order. - // We also avoid GetStorageKey() because specifics might not be - // valid according to AreValidSpecifics(). - const std::string storage_key = EncodeStorageKey( - specifics->session_tag(), specifics->tab_node_id()); + const std::string storage_key = GetStorageKey(*specifics); batch->Put(storage_key, MoveToEntityData(session_name, specifics)); }, batch.get())); @@ -591,11 +589,9 @@ base::BindRepeating( [](syncer::MutableDataBatch* batch, const std::string& session_name, sync_pb::SessionSpecifics* specifics) { + DCHECK(AreValidSpecifics(*specifics)); // Local variable used to avoid assuming argument evaluation order. - // We also avoid GetStorageKey() because specifics might not be - // valid according to AreValidSpecifics(). - const std::string storage_key = EncodeStorageKey( - specifics->session_tag(), specifics->tab_node_id()); + const std::string storage_key = GetStorageKey(*specifics); batch->Put(storage_key, MoveToEntityData(session_name, specifics)); }, batch.get()));
diff --git a/components/sync_sessions/session_store_unittest.cc b/components/sync_sessions/session_store_unittest.cc index a13cbf5..fa0f7984 100644 --- a/components/sync_sessions/session_store_unittest.cc +++ b/components/sync_sessions/session_store_unittest.cc
@@ -575,11 +575,11 @@ /*urls=*/_))))); } -TEST_F(SessionStoreTest, ShouldReturnForeignOrphanTabs) { +TEST_F(SessionStoreTest, ShouldIgnoreForeignOrphanTabs) { const std::string kForeignSessionTag = "SomeForeignTag"; const int kWindowId = 5; const int kTabId = 7; - // Both tab nodes point to the same tab ID. + // Both tab nodes point to the same tab ID, so the second one should prevail. const int kTabNodeId1 = 2; const int kTabNodeId2 = 3; @@ -587,8 +587,6 @@ SessionStore::GetHeaderStorageKey(kLocalSessionTag); const std::string foreign_header_storage_key = SessionStore::GetHeaderStorageKey(kForeignSessionTag); - const std::string foreign_tab_storage_key1 = - SessionStore::GetTabStorageKey(kForeignSessionTag, kTabNodeId1); const std::string foreign_tab_storage_key2 = SessionStore::GetTabStorageKey(kForeignSessionTag, kTabNodeId2); @@ -610,6 +608,7 @@ tab2.mutable_tab()->set_tab_id(kTabId); ASSERT_TRUE(SessionStore::AreValidSpecifics(tab2)); + // Store the two foreign tabs, in order. std::unique_ptr<SessionStore::WriteBatch> batch = session_store()->CreateWriteBatch(/*error_handler=*/base::DoNothing()); ASSERT_THAT(batch, NotNull()); @@ -617,6 +616,8 @@ batch->PutAndUpdateTracker(tab2, base::Time::Now()); SessionStore::WriteBatch::Commit(std::move(batch)); + // The first foreign tab should have been overwritten by the second one, + // because they shared a tab ID. EXPECT_THAT(BatchToEntityDataMap(session_store()->GetAllSessionData()), UnorderedElementsAre( Pair(local_header_storage_key, _), @@ -624,11 +625,6 @@ EntityDataHasSpecifics(MatchesHeader(kForeignSessionTag, /*window_ids=*/{}, /*tab_ids=*/{}))), - Pair(foreign_tab_storage_key1, - EntityDataHasSpecifics( - MatchesTab(kForeignSessionTag, /*window_id=*/0, - /*tab_id=*/-1, kTabNodeId1, - /*urls=*/_))), Pair(foreign_tab_storage_key2, EntityDataHasSpecifics(MatchesTab( kForeignSessionTag, kWindowId, kTabId, kTabNodeId2,
diff --git a/components/sync_sessions/synced_session_tracker.cc b/components/sync_sessions/synced_session_tracker.cc index 9645beb1..72dc898 100644 --- a/components/sync_sessions/synced_session_tracker.cc +++ b/components/sync_sessions/synced_session_tracker.cc
@@ -646,8 +646,8 @@ // for their tabs. if (!IsValidSessionHeader(specifics.header())) { - LOG(WARNING) << "Ignoring session node with invalid header " - << "and tag " << session_tag << "."; + DLOG(WARNING) << "Ignoring session node with invalid header " + << "and tag " << session_tag << "."; return; } @@ -667,6 +667,13 @@ } else if (specifics.has_tab()) { const sync_pb::SessionTab& tab_s = specifics.tab(); SessionID tab_id = SessionID::FromSerializedValue(tab_s.tab_id()); + if (!tab_id.is_valid()) { + DLOG(WARNING) << "Ignoring session tab with invalid tab ID for session " + << "tag " << session_tag << " and node ID " + << specifics.tab_node_id() << "."; + return; + } + DVLOG(1) << "Populating " << session_tag << "'s tab id " << tab_id << " from node " << specifics.tab_node_id(); @@ -769,6 +776,16 @@ // Tab entities. const SessionID tab_id = tracker.LookupTabIdFromTabNodeId(session_tag, tab_node_id); + if (!tab_id.is_valid()) { + // This can be the case for tabs that were unmapped because we received + // a new foreign tab with the same tab ID (the last one wins), so we + // don't remember the tab ID for the original |tab_node_id|. Instead of + // returning partially populated SessionSpecifics (without tab ID), we + // simply drop them, because older clients don't handle well such + // invalid specifics. + continue; + } + const sessions::SessionTab* tab = tracker.LookupSessionTab(session_tag, tab_id); if (tab) { @@ -781,12 +798,11 @@ continue; } - // Create entities for unmapped tabs nodes (possibly not even associated - // to a tab ID). + // Create entities for unmapped tabs nodes. sync_pb::SessionSpecifics tab_pb; tab_pb.set_tab_node_id(tab_node_id); tab_pb.set_session_tag(session_tag); - tab_pb.mutable_tab()->set_tab_id(tab_id.id()); // Might be invalid. + tab_pb.mutable_tab()->set_tab_id(tab_id.id()); output_cb.Run(session->session_name, &tab_pb); } }
diff --git a/components/sync_sessions/synced_session_tracker_unittest.cc b/components/sync_sessions/synced_session_tracker_unittest.cc index a7e81d6a..1ff164d1 100644 --- a/components/sync_sessions/synced_session_tracker_unittest.cc +++ b/components/sync_sessions/synced_session_tracker_unittest.cc
@@ -888,6 +888,19 @@ MatchesSyncedSession(kTag, /*window_id_to_tabs=*/{})); } +// Verifies that an invalid tab (with invalid ID) is discarded. +TEST_F(SyncedSessionTrackerTest, UpdateTrackerWithInvalidTab) { + const int kInvalidTabId = -1; + sync_pb::SessionSpecifics tab; + tab.set_session_tag(kTag); + tab.mutable_tab()->set_tab_id(kInvalidTabId); + UpdateTrackerWithSpecifics(tab, base::Time::Now(), GetTracker()); + + EXPECT_THAT(GetTracker()->LookupSessionTab( + kTag, SessionID::FromSerializedValue(kInvalidTabId)), + IsNull()); +} + TEST_F(SyncedSessionTrackerTest, UpdateTrackerWithTab) { sync_pb::SessionSpecifics tab; tab.set_session_tag(kTag); @@ -1005,10 +1018,6 @@ callback, Run(kSessionName, Pointee(MatchesTab(kTag, Ne(kWindow1.id()), kTab3.id(), kTabNode3, /*urls=*/_)))); - EXPECT_CALL( - callback, - Run(kSessionName, Pointee(MatchesTab(kTag, /*window_id=*/0, /*tab_id=*/-1, - kTabNode4, /*urls=*/_)))); SerializeTrackerToSpecifics(*GetTracker(), callback.Get()); EXPECT_TRUE(testing::Mock::VerifyAndClearExpectations(&callback));
diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc index 19c8a78..36511cf5 100644 --- a/components/url_formatter/url_fixer.cc +++ b/components/url_formatter/url_fixer.cc
@@ -22,7 +22,7 @@ #include "url/url_file.h" #include "url/url_util.h" -#if defined(OS_POSIX) +#if defined(OS_POSIX) || defined(OS_FUCHSIA) #include "base/path_service.h" #endif @@ -101,8 +101,10 @@ #if defined(OS_WIN) base::TrimWhitespace(text.value(), base::TRIM_ALL, output); replace(output->begin(), output->end(), '/', '\\'); -#else +#elif defined(OS_POSIX) || defined(OS_FUCHSIA) TrimWhitespaceUTF8(text.value(), base::TRIM_ALL, output); +#else +#error Unsupported platform #endif } @@ -122,7 +124,7 @@ return true; } -#if defined(OS_POSIX) +#if defined(OS_POSIX) || defined(OS_FUCHSIA) // Given a path that starts with ~, return a path that starts with an // expanded-out /user/foobar directory. std::string FixupHomedir(const std::string& text) { @@ -176,7 +178,7 @@ // Fixup Windows-style drive letters, where "C:" gets rewritten to "C|". if (filename.length() > 1 && filename[1] == '|') filename[1] = ':'; -#elif defined(OS_POSIX) +#elif defined(OS_POSIX) || defined(OS_FUCHSIA) base::FilePath input_path(text); PrepareStringForFileOps(input_path, &filename); if (filename.length() > 0 && filename[0] == '~') @@ -407,7 +409,7 @@ if (url::DoesBeginWindowsDriveSpec(trimmed.data(), 0, trimmed_length) || url::DoesBeginUNCPath(trimmed.data(), 0, trimmed_length, true)) return url::kFileScheme; -#elif defined(OS_POSIX) +#elif defined(OS_POSIX) || defined(OS_FUCHSIA) if (base::FilePath::IsSeparator(trimmed.data()[0]) || trimmed.data()[0] == '~') return url::kFileScheme; @@ -623,7 +625,7 @@ base::WideToUTF8(trimmed), net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS | net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS)); -#elif defined(OS_POSIX) +#elif defined(OS_POSIX) || defined(OS_FUCHSIA) std::string unescaped = net::UnescapeURLComponent( trimmed, net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS | @@ -650,7 +652,7 @@ // Fall back on regular fixup for this input. #if defined(OS_WIN) std::string text_utf8 = base::WideToUTF8(text.value()); -#elif defined(OS_POSIX) +#elif defined(OS_POSIX) || defined(OS_FUCHSIA) std::string text_utf8 = text.value(); #endif return FixupURL(text_utf8, std::string());
diff --git a/components/viz/common/surfaces/child_local_surface_id_allocator.cc b/components/viz/common/surfaces/child_local_surface_id_allocator.cc index e773ae92..470b0d44 100644 --- a/components/viz/common/surfaces/child_local_surface_id_allocator.cc +++ b/components/viz/common/surfaces/child_local_surface_id_allocator.cc
@@ -17,10 +17,19 @@ const LocalSurfaceId& ChildLocalSurfaceIdAllocator::UpdateFromParent( const LocalSurfaceId& parent_allocated_local_surface_id) { - if (parent_allocated_local_surface_id.parent_sequence_number() > + // TODO(fsamuel): How a parent allocated LocalSurfaceId is incorporated into + // a ChildLocalSurfaceIdAllocator has been loosened. The parent should not + // be touching the child_sequence_number but currently there are cases where + // there are two ChildLocalSurfaceIdAllocators operating on a LocalSurfaceId. + // When that case is eliminated, we can avoid updating the child sequence + // number here. + if (parent_allocated_local_surface_id.parent_sequence_number() >= current_local_surface_id_.parent_sequence_number()) { current_local_surface_id_.parent_sequence_number_ = parent_allocated_local_surface_id.parent_sequence_number_; + current_local_surface_id_.child_sequence_number_ = + std::max(current_local_surface_id_.child_sequence_number_, + parent_allocated_local_surface_id.child_sequence_number_); current_local_surface_id_.embed_token_ = parent_allocated_local_surface_id.embed_token_; }
diff --git a/components/viz/common/surfaces/child_local_surface_id_allocator_unittest.cc b/components/viz/common/surfaces/child_local_surface_id_allocator_unittest.cc index abddd5d..a8648cdb 100644 --- a/components/viz/common/surfaces/child_local_surface_id_allocator_unittest.cc +++ b/components/viz/common/surfaces/child_local_surface_id_allocator_unittest.cc
@@ -99,7 +99,10 @@ parent_updated_child_allocator.GetCurrentLocalSurfaceId(); EXPECT_EQ(postupdate_local_surface_id.parent_sequence_number(), parent_allocated_local_surface_id.parent_sequence_number()); - EXPECT_NE(postupdate_local_surface_id.child_sequence_number(), + // TODO(fsamuel): We shouldn't update the child sequence number but in order + // to allow a transition from LocalSurfaceId allocation on the main thread to + // the compositor, we will briefly support this. + EXPECT_EQ(postupdate_local_surface_id.child_sequence_number(), parent_allocated_local_surface_id.child_sequence_number()); EXPECT_EQ(postupdate_local_surface_id.embed_token(), parent_allocated_local_surface_id.embed_token());
diff --git a/components/viz/test/data/background_filter_blur_outsets.png b/components/viz/test/data/background_filter_blur_outsets.png index 49ad98c..979f8e0 100644 --- a/components/viz/test/data/background_filter_blur_outsets.png +++ b/components/viz/test/data/background_filter_blur_outsets.png Binary files differ
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 17e450a..c646068 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -955,6 +955,7 @@ "interface_provider_filtering.h", "isolated_origin_util.cc", "isolated_origin_util.h", + "keyboard_lock/keyboard_lock_metrics.h", "keyboard_lock/keyboard_lock_service_impl.cc", "keyboard_lock/keyboard_lock_service_impl.h", "leveldb_wrapper_impl.cc", @@ -989,8 +990,8 @@ "loader/navigation_url_loader.h", "loader/navigation_url_loader_delegate.h", "loader/navigation_url_loader_factory.h", - "loader/navigation_url_loader_network_service.cc", - "loader/navigation_url_loader_network_service.h", + "loader/navigation_url_loader_impl.cc", + "loader/navigation_url_loader_impl.h", "loader/null_resource_controller.cc", "loader/null_resource_controller.h", "loader/prefetch_url_loader.cc", @@ -1242,6 +1243,10 @@ "renderer_host/frame_token_message_queue.h", "renderer_host/input/fling_controller.cc", "renderer_host/input/fling_controller.h", + "renderer_host/input/fling_scheduler.cc", + "renderer_host/input/fling_scheduler.h", + "renderer_host/input/fling_scheduler_mac.h", + "renderer_host/input/fling_scheduler_mac.mm", "renderer_host/input/gesture_event_queue.cc", "renderer_host/input/gesture_event_queue.h", "renderer_host/input/input_device_change_observer.cc",
diff --git a/content/browser/appcache/appcache_request_handler.h b/content/browser/appcache/appcache_request_handler.h index c9ed56ef..cea6169 100644 --- a/content/browser/appcache/appcache_request_handler.h +++ b/content/browser/appcache/appcache_request_handler.h
@@ -70,7 +70,7 @@ // NetworkService loading // NavigationLoaderInterceptor overrides - main resource loading. - // These methods are used by the NavigationURLLoaderNetworkService. + // These methods are used by the NavigationURLLoaderImpl. // Internally they use same methods used by the network library based impl, // MaybeLoadResource and MaybeLoadFallbackForResponse. // Eventually one of the Deliver*Response() methods is called and the
diff --git a/content/browser/background_fetch/background_fetch_delegate_proxy.cc b/content/browser/background_fetch/background_fetch_delegate_proxy.cc index cec58a9b..9531d29 100644 --- a/content/browser/background_fetch/background_fetch_delegate_proxy.cc +++ b/content/browser/background_fetch/background_fetch_delegate_proxy.cc
@@ -9,6 +9,7 @@ #include "components/download/public/common/download_item.h" #include "components/download/public/common/download_url_parameters.h" #include "content/browser/background_fetch/background_fetch_job_controller.h" +#include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/download_manager.h" #include "ui/gfx/geometry/size.h" @@ -63,19 +64,12 @@ } } - void CreateDownloadJob(const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) { + void CreateDownloadJob( + std::unique_ptr<BackgroundFetchDescription> fetch_description) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (delegate_) { - delegate_->CreateDownloadJob(job_unique_id, title, origin, icon, - completed_parts, total_parts, current_guids); - } + if (delegate_) + delegate_->CreateDownloadJob(std::move(fetch_description)); } void StartRequest(const std::string& job_unique_id, @@ -261,24 +255,17 @@ } void BackgroundFetchDelegateProxy::CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, base::WeakPtr<Controller> controller, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) { + std::unique_ptr<BackgroundFetchDescription> fetch_description) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - DCHECK(!job_details_map_.count(job_unique_id)); - job_details_map_.emplace(job_unique_id, JobDetails(controller)); + DCHECK(!job_details_map_.count(fetch_description->job_unique_id)); + job_details_map_.emplace(fetch_description->job_unique_id, + JobDetails(controller)); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::BindOnce(&Core::CreateDownloadJob, ui_core_ptr_, job_unique_id, - title, origin, icon, completed_parts, total_parts, - current_guids)); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::BindOnce(&Core::CreateDownloadJob, ui_core_ptr_, + std::move(fetch_description))); } void BackgroundFetchDelegateProxy::StartRequest(
diff --git a/content/browser/background_fetch/background_fetch_delegate_proxy.h b/content/browser/background_fetch/background_fetch_delegate_proxy.h index 3b905d36..08e6125 100644 --- a/content/browser/background_fetch/background_fetch_delegate_proxy.h +++ b/content/browser/background_fetch/background_fetch_delegate_proxy.h
@@ -16,11 +16,10 @@ #include "base/memory/weak_ptr.h" #include "content/browser/background_fetch/background_fetch_request_info.h" #include "content/public/browser/background_fetch_delegate.h" +#include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/browser_thread.h" -class SkBitmap; - namespace content { // Proxy class for passing messages between BackgroundFetchJobControllers on the @@ -59,22 +58,19 @@ void GetIconDisplaySize( BackgroundFetchDelegate::GetIconDisplaySizeCallback callback); - // Creates a new download grouping identified by |job_unique_id|. Further - // downloads started by StartRequest will also use this |job_unique_id| so - // that a notification can be updated with the current status. If the download - // was already started in a previous browser session, then |current_guids| - // should contain the GUIDs of in progress downloads, while completed - // downloads are recorded in |completed_parts|. - // Should only be called from the Controller (on the IO - // thread). - void CreateDownloadJob(const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - base::WeakPtr<Controller> controller, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids); + // Creates a new download grouping described by |fetch_description|. Further + // downloads started by StartRequest will also use + // |fetch_description.job_unique_id| so that a notification can be updated + // with the current status. If the download was already started in a previous + // browser session, then |fetch_description.current_guids| should contain the + // GUIDs of in progress downloads, while completed downloads are recorded in + // |fetch_description.completed_parts|. The size of the completed parts is + // recorded in |fetch_description.completed_parts_size| and total download + // size is stored in |fetch_description.total_parts_size|. Should only be + // called from the Controller (on the IO thread). + void CreateDownloadJob( + base::WeakPtr<Controller> controller, + std::unique_ptr<BackgroundFetchDescription> fetch_description); // Requests that the download manager start fetching |request|. // Should only be called from the Controller (on the IO
diff --git a/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc b/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc index 9091e65d..5937394 100644 --- a/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc +++ b/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc
@@ -11,6 +11,7 @@ #include "base/run_loop.h" #include "content/browser/background_fetch/background_fetch_test_base.h" #include "content/public/browser/background_fetch_delegate.h" +#include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,13 +34,7 @@ std::move(callback).Run(gfx::Size(kIconDisplaySize, kIconDisplaySize)); } void CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) override {} + std::unique_ptr<BackgroundFetchDescription> fetch_description) override {} void DownloadUrl(const std::string& job_unique_id, const std::string& guid, const std::string& method, @@ -154,9 +149,13 @@ EXPECT_FALSE(controller.request_started_); EXPECT_FALSE(controller.request_completed_); - delegate_proxy_.CreateDownloadJob( + auto fetch_description = std::make_unique<BackgroundFetchDescription>( kExampleUniqueId, "Job 1", url::Origin(), SkBitmap(), - controller.weak_ptr_factory_.GetWeakPtr(), 0, 1, {}); + 0 /* completed_parts */, 1 /* total_parts */, + 0 /* completed_parts_size */, 0 /* total_parts_size */, + std::vector<std::string>()); + delegate_proxy_.CreateDownloadJob(controller.weak_ptr_factory_.GetWeakPtr(), + std::move(fetch_description)); delegate_proxy_.StartRequest(kExampleUniqueId, url::Origin(), request); base::RunLoop().RunUntilIdle(); @@ -174,9 +173,13 @@ EXPECT_FALSE(controller.request_completed_); delegate_.set_complete_downloads(false); - delegate_proxy_.CreateDownloadJob( + auto fetch_description = std::make_unique<BackgroundFetchDescription>( kExampleUniqueId, "Job 1", url::Origin(), SkBitmap(), - controller.weak_ptr_factory_.GetWeakPtr(), 0, 1, {}); + 0 /* completed_parts */, 1 /* total_parts */, + 0 /* completed_parts_size */, 0 /* total_parts_size */, + std::vector<std::string>()); + delegate_proxy_.CreateDownloadJob(controller.weak_ptr_factory_.GetWeakPtr(), + std::move(fetch_description)); delegate_proxy_.StartRequest(kExampleUniqueId, url::Origin(), request); base::RunLoop().RunUntilIdle(); @@ -198,13 +201,21 @@ EXPECT_FALSE(controller2.request_started_); EXPECT_FALSE(controller2.request_completed_); - delegate_proxy_.CreateDownloadJob( + auto fetch_description1 = std::make_unique<BackgroundFetchDescription>( kExampleUniqueId, "Job 1", url::Origin(), SkBitmap(), - controller.weak_ptr_factory_.GetWeakPtr(), 0, 1, {}); + 0 /* completed_parts */, 1 /* total_parts */, + 0 /* completed_parts_size */, 0 /* total_parts_size */, + std::vector<std::string>()); + delegate_proxy_.CreateDownloadJob(controller.weak_ptr_factory_.GetWeakPtr(), + std::move(fetch_description1)); - delegate_proxy_.CreateDownloadJob( + auto fetch_description2 = std::make_unique<BackgroundFetchDescription>( kExampleUniqueId2, "Job 2", url::Origin(), SkBitmap(), - controller2.weak_ptr_factory_.GetWeakPtr(), 0, 1, {}); + 0 /* completed_parts */, 1 /* total_parts */, + 0 /* completed_parts_size */, 0 /* total_parts_size */, + std::vector<std::string>()); + delegate_proxy_.CreateDownloadJob(controller2.weak_ptr_factory_.GetWeakPtr(), + std::move(fetch_description2)); delegate_proxy_.StartRequest(kExampleUniqueId, url::Origin(), request); delegate_proxy_.StartRequest(kExampleUniqueId2, url::Origin(), request2);
diff --git a/content/browser/background_fetch/background_fetch_job_controller.cc b/content/browser/background_fetch/background_fetch_job_controller.cc index 83f1fa6..c87cc00 100644 --- a/content/browser/background_fetch/background_fetch_job_controller.cc +++ b/content/browser/background_fetch/background_fetch_job_controller.cc
@@ -45,10 +45,17 @@ completed_downloads_ = completed_downloads; total_downloads_ = total_downloads; - delegate_proxy_->CreateDownloadJob(registration_id().unique_id(), - options_.title, registration_id().origin(), - icon_, GetWeakPtr(), completed_downloads, - total_downloads, outstanding_guids); + // TODO(nator): Update this when we support uploads. + int total_downloads_size = options_.download_total; + + auto fetch_description = std::make_unique<BackgroundFetchDescription>( + registration_id().unique_id(), options_.title, registration_id().origin(), + icon_, completed_downloads, total_downloads, + complete_requests_downloaded_bytes_cache_, total_downloads_size, + outstanding_guids); + + delegate_proxy_->CreateDownloadJob(GetWeakPtr(), + std::move(fetch_description)); } BackgroundFetchJobController::~BackgroundFetchJobController() {
diff --git a/content/browser/background_fetch/mock_background_fetch_delegate.cc b/content/browser/background_fetch/mock_background_fetch_delegate.cc index ffe514bd..753d955a 100644 --- a/content/browser/background_fetch/mock_background_fetch_delegate.cc +++ b/content/browser/background_fetch/mock_background_fetch_delegate.cc
@@ -8,6 +8,7 @@ #include "base/files/file_util.h" #include "base/threading/thread_task_runner_handle.h" #include "content/browser/background_fetch/mock_background_fetch_delegate.h" +#include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/browser_thread.h" #include "net/http/http_response_headers.h" @@ -59,13 +60,7 @@ GetIconDisplaySizeCallback callback) {} void MockBackgroundFetchDelegate::CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) {} + std::unique_ptr<BackgroundFetchDescription> fetch_description) {} void MockBackgroundFetchDelegate::DownloadUrl( const std::string& job_unique_id,
diff --git a/content/browser/background_fetch/mock_background_fetch_delegate.h b/content/browser/background_fetch/mock_background_fetch_delegate.h index fe63a87..bc685f9 100644 --- a/content/browser/background_fetch/mock_background_fetch_delegate.h +++ b/content/browser/background_fetch/mock_background_fetch_delegate.h
@@ -66,13 +66,7 @@ void GetIconDisplaySize( BackgroundFetchDelegate::GetIconDisplaySizeCallback callback) override; void CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) override; + std::unique_ptr<BackgroundFetchDescription> fetch_description) override; void DownloadUrl(const std::string& job_unique_id, const std::string& guid, const std::string& method,
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index 65963b2..58fa019 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc
@@ -1608,6 +1608,22 @@ status.encoded_data_length); } +void NetworkHandler::OnSignedExchangeReceived( + base::Optional<const base::UnguessableToken> devtools_navigation_token, + const GURL& outer_request_url, + const network::ResourceResponseHead& outer_response) { + if (!enabled_) + return; + std::unique_ptr<Network::SignedExchangeInfo> signed_exchange_info = + Network::SignedExchangeInfo::Create() + .SetOuterResponse(BuildResponse(outer_request_url, outer_response)) + .Build(); + + frontend_->SignedExchangeReceived( + devtools_navigation_token ? devtools_navigation_token->ToString() : "", + std::move(signed_exchange_info)); +} + DispatchResponse NetworkHandler::SetRequestInterception( std::unique_ptr<protocol::Array<protocol::Network::RequestPattern>> patterns) {
diff --git a/content/browser/devtools/protocol/network_handler.h b/content/browser/devtools/protocol/network_handler.h index a2f0a5c..ab98085 100644 --- a/content/browser/devtools/protocol/network_handler.h +++ b/content/browser/devtools/protocol/network_handler.h
@@ -157,6 +157,11 @@ const char* resource_type, const network::URLLoaderCompletionStatus& completion_status); + void OnSignedExchangeReceived( + base::Optional<const base::UnguessableToken> devtools_navigation_token, + const GURL& outer_request_url, + const network::ResourceResponseHead& outer_response); + bool enabled() const { return enabled_; } Network::Frontend* frontend() const { return frontend_.get(); }
diff --git a/content/browser/devtools/protocol_config.json b/content/browser/devtools/protocol_config.json index 273d05a..90c595d0 100644 --- a/content/browser/devtools/protocol_config.json +++ b/content/browser/devtools/protocol_config.json
@@ -42,7 +42,7 @@ { "domain": "Network", "include": ["enable", "disable", "clearBrowserCache", "clearBrowserCookies", "getCookies", "getAllCookies", "deleteCookies", "setCookie", "setCookies", "setUserAgentOverride", "setExtraHTTPHeaders", "canEmulateNetworkConditions", "emulateNetworkConditions", "setBypassServiceWorker", "setRequestInterception", "continueInterceptedRequest", "getResponseBodyForInterception", "setCacheDisabled", "takeResponseBodyForInterceptionAsStream"], - "include_events": ["requestWillBeSent", "responseReceived", "loadingFinished", "loadingFailed", "requestIntercepted"], + "include_events": ["requestWillBeSent", "responseReceived", "loadingFinished", "loadingFailed", "requestIntercepted", "signedExchangeReceived"], "async": ["clearBrowserCookies", "clearBrowserCache", "getCookies", "getAllCookies", "deleteCookies", "setCookie", "setCookies", "continueInterceptedRequest", "getResponseBodyForInterception", "takeResponseBodyForInterceptionAsStream"] }, {
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index 52325be..2cc2920 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -224,6 +224,17 @@ } // static +void RenderFrameDevToolsAgentHost::OnSignedExchangeReceived( + FrameTreeNode* frame_tree_node, + base::Optional<const base::UnguessableToken> devtools_navigation_token, + const GURL& outer_request_url, + const network::ResourceResponseHead& outer_response) { + DispatchToAgents( + frame_tree_node, &protocol::NetworkHandler::OnSignedExchangeReceived, + devtools_navigation_token, outer_request_url, outer_response); +} + +// static std::vector<std::unique_ptr<NavigationThrottle>> RenderFrameDevToolsAgentHost::CreateNavigationThrottles( NavigationHandleImpl* navigation_handle) {
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.h b/content/browser/devtools/render_frame_devtools_agent_host.h index 448d71a..72c50b8 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.h +++ b/content/browser/devtools/render_frame_devtools_agent_host.h
@@ -12,6 +12,7 @@ #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/macros.h" +#include "base/optional.h" #include "build/build_config.h" #include "content/browser/devtools/devtools_agent_host_impl.h" #include "content/common/content_export.h" @@ -26,6 +27,10 @@ #include "ui/android/view_android.h" #endif // OS_ANDROID +namespace base { +class UnguessableToken; +} + namespace network { struct ResourceResponse; } @@ -84,6 +89,12 @@ static void OnNavigationRequestFailed(const NavigationRequest& nav_request, int error_code); + static void OnSignedExchangeReceived( + FrameTreeNode* frame_tree_node, + base::Optional<const base::UnguessableToken> devtools_navigation_token, + const GURL& outer_request_url, + const network::ResourceResponseHead& outer_response); + static std::vector<std::unique_ptr<NavigationThrottle>> CreateNavigationThrottles(NavigationHandleImpl* navigation_handle); static bool IsNetworkHandlerEnabled(FrameTreeNode* frame_tree_node);
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index ea9d41b..ef44adb 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc
@@ -974,7 +974,8 @@ void RunResumptionTest( const download::DownloadItem::ReceivedSlices& received_slices, int64_t total_length, - size_t expected_request_count) { + size_t expected_request_count, + bool support_partial_response) { EXPECT_TRUE( base::FeatureList::IsEnabled(download::features::kParallelDownloading)); GURL url = TestDownloadHttpResponse::GetNextURLForDownload(); @@ -983,6 +984,7 @@ parameters.etag = "ABC"; parameters.size = total_length; parameters.last_modified = std::string(); + parameters.support_partial_response = support_partial_response; // Needed to specify HTTP connection type to create parallel download. parameters.connection_type = net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1; TestDownloadHttpResponse::StartServing(parameters, server_url); @@ -999,12 +1001,17 @@ // Resume the parallel download with sparse file and received slices data. download->Resume(); WaitForCompletion(download); - test_response_handler()->WaitUntilCompletion(expected_request_count); + // TODO(qinmin): count the failed partial responses in DownloadJob when + // support_partial_response is false. EmbeddedTestServer doesn't know + // whether completing or canceling the response will come first. + if (support_partial_response) { + test_response_handler()->WaitUntilCompletion(expected_request_count); - // Verify number of requests sent to the server. - const TestDownloadResponseHandler::CompletedRequests& completed_requests = - test_response_handler()->completed_requests(); - EXPECT_EQ(expected_request_count, completed_requests.size()); + // Verify number of requests sent to the server. + const TestDownloadResponseHandler::CompletedRequests& completed_requests = + test_response_handler()->completed_requests(); + EXPECT_EQ(expected_request_count, completed_requests.size()); + } // Verify download content on disk. ReadAndVerifyFileContents(parameters.pattern_generator_seed, @@ -1026,22 +1033,29 @@ parameters.connection_type = net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1; TestRequestPauseHandler request_pause_handler; parameters.on_pause_handler = request_pause_handler.GetOnPauseHandler(); + // Send some data for the first request and pause it so download won't + // complete before other parallel requests are created. parameters.pause_offset = DownloadRequestCore::kDownloadByteStreamSize; TestDownloadHttpResponse::StartServing(parameters, server_url); download::DownloadItem* download = StartDownloadAndReturnItem(shell(), server_url); - // Send some data for the first request and pause it so download won't - // complete before other parallel requests are created. - test_response_handler()->WaitUntilCompletion(2u); + // TODO(qinmin): wait for the failed partial responses in DownloadJob. + // Waiting for the completed test server requests is unsafe. This is because + // completing or canceling the response first all depends on the internal + // write buffer size. + if (parameters.support_partial_response) + test_response_handler()->WaitUntilCompletion(2u); // Now resume the first request. request_pause_handler.Resume(); WaitForCompletion(download); - test_response_handler()->WaitUntilCompletion(3u); - const TestDownloadResponseHandler::CompletedRequests& completed_requests = - test_response_handler()->completed_requests(); - EXPECT_EQ(kTestRequestCount, static_cast<int>(completed_requests.size())); + if (parameters.support_partial_response) { + test_response_handler()->WaitUntilCompletion(3u); + const TestDownloadResponseHandler::CompletedRequests& completed_requests = + test_response_handler()->completed_requests(); + EXPECT_EQ(3u, completed_requests.size()); + } ReadAndVerifyFileContents(parameters.pattern_generator_seed, parameters.size, download->GetTargetFilePath()); } @@ -3182,6 +3196,17 @@ RunCompletionTest(parameters); } +// The server will send Accept-Ranges header without partial response. +IN_PROC_BROWSER_TEST_F(ParallelDownloadTest, NoPartialResponse) { + TestDownloadHttpResponse::Parameters parameters; + parameters.etag = "ABC"; + parameters.size = 5097152; + parameters.support_byte_ranges = true; + parameters.support_partial_response = false; + + RunCompletionTest(parameters); +} + // Verify parallel download resumption. IN_PROC_BROWSER_TEST_F(ParallelDownloadTest, Resumption) { // Create the received slices data, the last request is not finished and the @@ -3192,7 +3217,8 @@ download::DownloadItem::ReceivedSlice(2000000, 1000, false /* finished */)}; - RunResumptionTest(received_slices, 3000000, kTestRequestCount); + RunResumptionTest(received_slices, 3000000, kTestRequestCount, + true /* support_partial_response */); } // Verifies that if the last slice is finished, parallel download resumption @@ -3207,7 +3233,8 @@ // The server shouldn't receive an additional request, since the last slice // is marked as finished. - RunResumptionTest(received_slices, 3000000, kTestRequestCount - 1); + RunResumptionTest(received_slices, 3000000, kTestRequestCount - 1, + true /* support_partial_response */); } // Verifies that if the last slice is finished, but the database record is not @@ -3223,7 +3250,23 @@ // Client will send an out of range request where server will send back HTTP // range not satisfied, and download can complete. - RunResumptionTest(received_slices, 3000000, kTestRequestCount); + RunResumptionTest(received_slices, 3000000, kTestRequestCount, + true /* support_partial_response */); +} + +// Verify that if server doesn't support partial response, resuming a parallel +// download should complete the download. +IN_PROC_BROWSER_TEST_F(ParallelDownloadTest, ResumptionNoPartialResponse) { + // Create the received slices data, the last request is not finished and the + // server will send more data to finish the last slice. + std::vector<download::DownloadItem::ReceivedSlice> received_slices = { + download::DownloadItem::ReceivedSlice(0, 1000), + download::DownloadItem::ReceivedSlice(1000000, 1000), + download::DownloadItem::ReceivedSlice(2000000, 1000, + false /* finished */)}; + + RunResumptionTest(received_slices, 3000000, kTestRequestCount, + false /* support_partial_response */); } // Test to verify that the browser-side enforcement of X-Frame-Options does
diff --git a/content/browser/frame_host/navigation_handle_impl_browsertest.cc b/content/browser/frame_host/navigation_handle_impl_browsertest.cc index 61d4412e..d2773b5 100644 --- a/content/browser/frame_host/navigation_handle_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
@@ -13,6 +13,7 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_throttle.h" +#include "content/public/browser/site_isolation_policy.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/bindings_policy.h" @@ -1690,13 +1691,18 @@ navigation_observer.Wait(); EXPECT_TRUE(observer.has_committed()); EXPECT_TRUE(observer.is_error()); - EXPECT_NE(site_instance, - shell()->web_contents()->GetMainFrame()->GetSiteInstance()); - EXPECT_EQ(kUnreachableWebDataURL, shell() - ->web_contents() - ->GetMainFrame() - ->GetSiteInstance() - ->GetSiteURL()); + if (SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) { + EXPECT_NE(site_instance, + shell()->web_contents()->GetMainFrame()->GetSiteInstance()); + EXPECT_EQ(kUnreachableWebDataURL, shell() + ->web_contents() + ->GetMainFrame() + ->GetSiteInstance() + ->GetSiteURL()); + } else { + EXPECT_EQ(site_instance, + shell()->web_contents()->GetMainFrame()->GetSiteInstance()); + } } { @@ -1711,13 +1717,21 @@ navigation_observer.Wait(); EXPECT_TRUE(observer.has_committed()); EXPECT_TRUE(observer.is_error()); - EXPECT_EQ(kUnreachableWebDataURL, shell() - ->web_contents() - ->GetMainFrame() - ->GetSiteInstance() - ->GetSiteURL()); - EXPECT_EQ(process_id, - shell()->web_contents()->GetMainFrame()->GetProcess()->GetID()); + if (SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) { + EXPECT_EQ(kUnreachableWebDataURL, shell() + ->web_contents() + ->GetMainFrame() + ->GetSiteInstance() + ->GetSiteURL()); + EXPECT_EQ(process_id, + shell()->web_contents()->GetMainFrame()->GetProcess()->GetID()); + } else if (AreAllSitesIsolatedForTesting()) { + EXPECT_NE(site_instance, + shell()->web_contents()->GetMainFrame()->GetSiteInstance()); + } else { + EXPECT_EQ(site_instance, + shell()->web_contents()->GetMainFrame()->GetSiteInstance()); + } } installer.reset(); @@ -1754,11 +1768,13 @@ EXPECT_TRUE(observer.is_error()); EXPECT_NE(site_instance, shell()->web_contents()->GetMainFrame()->GetSiteInstance()); - EXPECT_EQ(kUnreachableWebDataURL, shell() - ->web_contents() - ->GetMainFrame() - ->GetSiteInstance() - ->GetSiteURL()); + if (SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) { + EXPECT_EQ(kUnreachableWebDataURL, shell() + ->web_contents() + ->GetMainFrame() + ->GetSiteInstance() + ->GetSiteURL()); + } } installer.reset(); @@ -1828,11 +1844,13 @@ EXPECT_TRUE(observer.is_error()); EXPECT_NE(site_instance, shell()->web_contents()->GetMainFrame()->GetSiteInstance()); - EXPECT_EQ(kUnreachableWebDataURL, shell() - ->web_contents() - ->GetMainFrame() - ->GetSiteInstance() - ->GetSiteURL()); + if (SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) { + EXPECT_EQ(kUnreachableWebDataURL, shell() + ->web_contents() + ->GetMainFrame() + ->GetSiteInstance() + ->GetSiteURL()); + } } }
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 1cf85fe..83fe90f 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -39,6 +39,7 @@ #include "content/public/browser/navigation_data.h" #include "content/public/browser/navigation_ui_data.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/site_isolation_policy.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/appcache_info.h" #include "content/public/common/browser_side_navigation_policy.h" @@ -1040,7 +1041,8 @@ } RenderFrameHostImpl* render_frame_host = nullptr; - if (frame_tree_node_->IsMainFrame()) { + if (SiteIsolationPolicy::IsErrorPageIsolationEnabled( + frame_tree_node_->IsMainFrame())) { // Main frame error pages must be isolated from the source or destination // process. // @@ -1260,7 +1262,8 @@ navigating_frame_host->GetVisibilityState() == blink::mojom::PageVisibilityState::kPrerender, blob_url_loader_factory_ ? blob_url_loader_factory_->Clone() - : nullptr), + : nullptr, + devtools_navigation_token()), std::move(navigation_ui_data), navigation_handle_->service_worker_handle(), navigation_handle_->appcache_handle(), this);
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h index 4c5785b..263ec5b7 100644 --- a/content/browser/frame_host/navigation_request.h +++ b/content/browser/frame_host/navigation_request.h
@@ -391,7 +391,7 @@ base::Optional<SubresourceLoaderParams> subresource_loader_params_; // See comment on accessor. - base::UnguessableToken devtools_navigation_token_; + const base::UnguessableToken devtools_navigation_token_; base::Optional<std::vector<mojom::TransferrableURLLoaderPtr>> subresource_overrides_;
diff --git a/content/browser/frame_host/navigation_request_info.cc b/content/browser/frame_host/navigation_request_info.cc index b6381c1..51d8563d 100644 --- a/content/browser/frame_host/navigation_request_info.cc +++ b/content/browser/frame_host/navigation_request_info.cc
@@ -19,7 +19,8 @@ bool report_raw_headers, bool is_prerendering, std::unique_ptr<network::SharedURLLoaderFactoryInfo> - blob_url_loader_factory) + blob_url_loader_factory, + const base::UnguessableToken& devtools_navigation_token) : common_params(common_params), begin_params(std::move(begin_params)), site_for_cookies(site_for_cookies), @@ -30,7 +31,8 @@ is_for_guests_only(is_for_guests_only), report_raw_headers(report_raw_headers), is_prerendering(is_prerendering), - blob_url_loader_factory(std::move(blob_url_loader_factory)) {} + blob_url_loader_factory(std::move(blob_url_loader_factory)), + devtools_navigation_token(devtools_navigation_token) {} NavigationRequestInfo::NavigationRequestInfo(const NavigationRequestInfo& other) : common_params(other.common_params), @@ -42,7 +44,8 @@ frame_tree_node_id(other.frame_tree_node_id), is_for_guests_only(other.is_for_guests_only), report_raw_headers(other.report_raw_headers), - is_prerendering(other.is_prerendering) {} + is_prerendering(other.is_prerendering), + devtools_navigation_token(other.devtools_navigation_token) {} NavigationRequestInfo::~NavigationRequestInfo() {}
diff --git a/content/browser/frame_host/navigation_request_info.h b/content/browser/frame_host/navigation_request_info.h index 47dbca1..304502f0 100644 --- a/content/browser/frame_host/navigation_request_info.h +++ b/content/browser/frame_host/navigation_request_info.h
@@ -8,6 +8,7 @@ #include <string> #include "base/memory/ref_counted.h" +#include "base/unguessable_token.h" #include "content/common/content_export.h" #include "content/common/navigation_params.h" #include "content/common/navigation_params.mojom.h" @@ -22,18 +23,20 @@ // ResourceDispatcherHost. It is initialized on the UI thread, and then passed // to the IO thread by a NavigationRequest object. struct CONTENT_EXPORT NavigationRequestInfo { - NavigationRequestInfo(const CommonNavigationParams& common_params, - mojom::BeginNavigationParamsPtr begin_params, - const GURL& site_for_cookies, - bool is_main_frame, - bool parent_is_main_frame, - bool are_ancestors_secure, - int frame_tree_node_id, - bool is_for_guests_only, - bool report_raw_headers, - bool is_prerendering, - std::unique_ptr<network::SharedURLLoaderFactoryInfo> - blob_url_loader_factory); + NavigationRequestInfo( + const CommonNavigationParams& common_params, + mojom::BeginNavigationParamsPtr begin_params, + const GURL& site_for_cookies, + bool is_main_frame, + bool parent_is_main_frame, + bool are_ancestors_secure, + int frame_tree_node_id, + bool is_for_guests_only, + bool report_raw_headers, + bool is_prerendering, + std::unique_ptr<network::SharedURLLoaderFactoryInfo> + blob_url_loader_factory, + const base::UnguessableToken& devtools_navigation_token); NavigationRequestInfo(const NavigationRequestInfo& other); ~NavigationRequestInfo(); @@ -61,6 +64,8 @@ // URLLoaderFactory to facilitate loading blob URLs. std::unique_ptr<network::SharedURLLoaderFactoryInfo> blob_url_loader_factory; + + const base::UnguessableToken devtools_navigation_token; }; } // namespace content
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index 73b66a5..7f6e271 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1124,7 +1124,7 @@ // If error page navigations should be isolated, ensure a dedicated // SiteInstance is used for them. - if (is_failure && GetContentClient()->browser()->ShouldIsolateErrorPage( + if (is_failure && SiteIsolationPolicy::IsErrorPageIsolationEnabled( frame_tree_node_->IsMainFrame())) { // Keep the error page in the same BrowsingInstance, such that in the case // of transient network errors, a subsequent successful load of the same @@ -1929,7 +1929,9 @@ // go cross-process. Main frame navigations resulting in an error are also // expected to change process. Check it first. bool can_renderer_initiate_transfer = - request.state() == NavigationRequest::FAILED || + (request.state() == NavigationRequest::FAILED && + SiteIsolationPolicy::IsErrorPageIsolationEnabled( + true /* in_main_frame */)) || (render_frame_host_->IsRenderFrameLive() && IsURLHandledByNetworkStack(request.common_params().url) && IsRendererTransferNeededForNavigation(render_frame_host_.get(),
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc index 421be9d..3768c25 100644 --- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -34,6 +34,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/resource_dispatcher_host.h" +#include "content/public/browser/site_isolation_policy.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_ui_message_handler.h" @@ -4004,6 +4005,10 @@ // page, properly commit the error page in its own dedicated process. IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, ErrorPageNavigationInMainFrame) { + // This test is only valid if error page isolation is enabled. + if (!SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) + return; + StartEmbeddedServer(); GURL url(embedded_test_server()->GetURL("/title1.html")); GURL error_url(embedded_test_server()->GetURL("/empty.html")); @@ -4108,6 +4113,10 @@ // the one for the destination site. IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, ErrorPageNavigationInNewWindow) { + // This test is only valid if error page isolation is enabled. + if (!SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) + return; + StartEmbeddedServer(); GURL error_url(embedded_test_server()->GetURL("/empty.html")); std::unique_ptr<URLLoaderInterceptor> url_interceptor = @@ -4137,6 +4146,10 @@ // their SiteInstances are not related. IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, ErrorPageNavigationInUnrelatedWindows) { + // This test is only valid if error page isolation is enabled. + if (!SiteIsolationPolicy::IsErrorPageIsolationEnabled(true)) + return; + StartEmbeddedServer(); GURL error_url(embedded_test_server()->GetURL("/empty.html")); std::unique_ptr<URLLoaderInterceptor> url_interceptor =
diff --git a/content/browser/keyboard_lock/keyboard_lock_metrics.h b/content/browser/keyboard_lock/keyboard_lock_metrics.h new file mode 100644 index 0000000..9761b19 --- /dev/null +++ b/content/browser/keyboard_lock/keyboard_lock_metrics.h
@@ -0,0 +1,26 @@ +// 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 CONTENT_BROWSER_KEYBOARD_LOCK_KEYBOARD_LOCK_METRICS_H_ +#define CONTENT_BROWSER_KEYBOARD_LOCK_KEYBOARD_LOCK_METRICS_H_ + +namespace content { + +// These values must stay in sync with tools/metrics/histograms.xml. +// Enum values should never be renumbered or reused as they are stored and can +// be used for multi-release queries. Insert any new values before |kCount| and +// increment the count. +enum class KeyboardLockMethods { + kRequestAllKeys = 0, + kRequestSomeKeys = 1, + kCancelLock = 2, + kCount = 3 +}; + +constexpr char kKeyboardLockMethodCalledHistogramName[] = + "Blink.KeyboardLock.MethodCalled"; + +} // namespace content + +#endif // CONTENT_BROWSER_KEYBOARD_LOCK_KEYBOARD_LOCK_METRICS_H_
diff --git a/content/browser/keyboard_lock/keyboard_lock_service_impl.cc b/content/browser/keyboard_lock/keyboard_lock_service_impl.cc index b4a7091..fcf1c88 100644 --- a/content/browser/keyboard_lock/keyboard_lock_service_impl.cc +++ b/content/browser/keyboard_lock/keyboard_lock_service_impl.cc
@@ -14,6 +14,7 @@ #include "base/metrics/histogram_macros.h" #include "base/optional.h" #include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/keyboard_lock/keyboard_lock_metrics.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_widget_host.h" @@ -28,19 +29,8 @@ namespace { -// These values must stay in sync with tools/metrics/histograms.xml. -// Enum values should never be renumbered or reused as they are stored and can -// be used for multi-release queries. Insert any new values before |kCount| and -// increment the count. -enum class KeyboardLockMethods { - kRequestAllKeys = 0, - kRequestSomeKeys = 1, - kCancelLock = 2, - kCount = 3 -}; - void LogKeyboardLockMethodCalled(KeyboardLockMethods method) { - UMA_HISTOGRAM_ENUMERATION("Blink.KeyboardLock.MethodCalled", method, + UMA_HISTOGRAM_ENUMERATION(kKeyboardLockMethodCalledHistogramName, method, KeyboardLockMethods::kCount); }
diff --git a/content/browser/keyboard_lock_browsertest.cc b/content/browser/keyboard_lock_browsertest.cc index b066a057..b619fad 100644 --- a/content/browser/keyboard_lock_browsertest.cc +++ b/content/browser/keyboard_lock_browsertest.cc
@@ -4,11 +4,15 @@ #include "content/browser/keyboard_lock_browsertest.h" -#include <vector> +#include <string> #include "base/macros.h" +#include "base/metrics/histogram_base.h" +#include "base/test/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "build/build_config.h" +#include "components/network_session_configurator/common/network_switches.h" +#include "content/browser/keyboard_lock/keyboard_lock_metrics.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/common/content_features.h" @@ -18,8 +22,13 @@ #include "content/public/test/test_utils.h" #include "content/shell/browser/shell.h" #include "content/test/content_browser_test_utils_internal.h" +#include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "third_party/blink/public/web/web_fullscreen_options.h" +#include "ui/events/keycodes/dom/dom_code.h" +#include "ui/events/keycodes/dom/keycode_converter.h" +#include "ui/events/keycodes/keyboard_code_conversion.h" +#include "ui/events/keycodes/keyboard_codes.h" #include "ui/gfx/native_widget_types.h" #ifdef USE_AURA @@ -31,7 +40,31 @@ namespace { -constexpr char kFullscreenFrameName[] = "/fullscreen_frame.html"; +constexpr char kFullscreenFramePath[] = "/fullscreen_frame.html"; + +constexpr char kHelloFramePath[] = "/hello.html"; + +constexpr char kInputFieldFramePath[] = "/page_with_input_field.html"; + +// Set up a DOM structure which contains three inner iframes for testing: +// - Same domain iframe w/ fullscreen attribute. +// - Cross domain iframe. +// - Cross domain iframe w/ fullscreen attribute. +constexpr char kCrossSiteFramePath[] = + "/cross_site_iframe_factory.html" + "?a(a{allowfullscreen}(),b(),c{allowfullscreen}())"; + +constexpr char kCrossSiteTopLevelDomain[] = "a.com"; + +constexpr char kChildIframeName_0[] = "child-0"; + +constexpr char kChildIframeName_1[] = "child-1"; + +constexpr char kChildIframeName_2[] = "child-2"; + +constexpr char kCrossSiteChildDomain1[] = "b.com"; + +constexpr char kCrossSiteChildDomain2[] = "c.com"; constexpr char kKeyboardLockMethodExistanceCheck[] = "window.domAutomationController.send(" @@ -65,6 +98,27 @@ constexpr char kKeyboardUnlockMethodCall[] = "navigator.keyboard.unlock()"; +constexpr char kFocusInputFieldScript[] = + "function onInput(e) {" + " domAutomationController.send(getInputFieldText());" + "}" + "inputField = document.getElementById('text-field');" + "inputField.addEventListener('input', onInput, false);"; + +void SimulateKeyPress(WebContents* web_contents, + const std::string& code_string, + const std::string& expected_result) { + DOMMessageQueue msg_queue; + std::string reply; + ui::DomKey dom_key = ui::KeycodeConverter::KeyStringToDomKey(code_string); + ui::DomCode dom_code = ui::KeycodeConverter::CodeStringToDomCode(code_string); + SimulateKeyPress(web_contents, dom_key, dom_code, + ui::DomCodeToUsLayoutKeyboardCode(dom_code), false, false, + false, false); + ASSERT_TRUE(msg_queue.WaitForMessage(&reply)); + ASSERT_EQ("\"" + expected_result + "\"", reply); +} + #if defined(USE_AURA) bool g_window_has_focus = false; @@ -178,11 +232,11 @@ // Helper methods for common tasks. bool KeyboardLockApiExists(); - void NavigateToTestURL(); + void NavigateToTestURL(const GURL& gurl); void RequestKeyboardLock(const base::Location& from_here, bool lock_all_keys = true); void CancelKeyboardLock(const base::Location& from_here); - void EnterFullscreen(const base::Location& from_here); + void EnterFullscreen(const base::Location& from_here, const GURL& gurl); void ExitFullscreen(const base::Location& from_here); void FocusContent(const base::Location& from_here); void BlurContent(const base::Location& from_here); @@ -195,13 +249,22 @@ net::EmbeddedTestServer* https_test_server() { return &https_test_server_; } GURL https_fullscreen_frame() { - return https_test_server()->GetURL(kFullscreenFrameName); + return https_test_server()->GetURL(kFullscreenFramePath); + } + + GURL https_cross_site_frame() { + return https_test_server()->GetURL(kCrossSiteTopLevelDomain, + kCrossSiteFramePath); } base::test::ScopedFeatureList* feature_list() { return &scoped_feature_list_; } + WebContentsDelegate* web_contents_delegate() { + return &web_contents_delegate_; + } + private: base::test::ScopedFeatureList scoped_feature_list_; net::EmbeddedTestServer https_test_server_; @@ -223,7 +286,10 @@ void KeyboardLockBrowserTest::SetUpCommandLine( base::CommandLine* command_line) { - IsolateAllSitesForTesting(command_line); + // Ignore cert errors so that the sign-in URL can be loaded from a site other + // than localhost (the EmbeddedTestServer serves a certificate that is valid + // for localhost). + command_line->AppendSwitch(switches::kIgnoreCertificateErrors); } void KeyboardLockBrowserTest::SetUpOnMainThread() { @@ -232,6 +298,8 @@ // KeyboardLock requires a secure context (HTTPS). https_test_server()->AddDefaultHandlers( base::FilePath(FILE_PATH_LITERAL("content/test/data"))); + host_resolver()->AddRule("*", "127.0.0.1"); + SetupCrossSiteRedirector(https_test_server()); ASSERT_TRUE(https_test_server()->Start()); } @@ -246,8 +314,8 @@ return api_exists; } -void KeyboardLockBrowserTest::NavigateToTestURL() { - ASSERT_TRUE(NavigateToURL(shell(), https_fullscreen_frame())); +void KeyboardLockBrowserTest::NavigateToTestURL(const GURL& gurl) { + ASSERT_TRUE(NavigateToURL(shell(), gurl)); ASSERT_TRUE(KeyboardLockApiExists()); @@ -260,9 +328,9 @@ const base::Location& from_here, bool lock_all_keys /*=true*/) { bool result; - // keyboardLock() is an async call which requires a promise handling dance. + // keyboard.lock() is an async call which requires a promise handling dance. ASSERT_TRUE(ExecuteScriptAndExtractBool( - web_contents(), + web_contents()->GetMainFrame(), lock_all_keys ? kKeyboardLockMethodCallWithAllKeys : kKeyboardLockMethodCallWithSomeKeys, &result)) @@ -278,8 +346,9 @@ void KeyboardLockBrowserTest::CancelKeyboardLock( const base::Location& from_here) { - // keyboardUnlock() is a synchronous call. - ASSERT_TRUE(ExecuteScript(web_contents(), kKeyboardUnlockMethodCall)); + // keyboard.unlock() is a synchronous call. + ASSERT_TRUE( + ExecuteScript(web_contents()->GetMainFrame(), kKeyboardUnlockMethodCall)); ASSERT_EQ(nullptr, web_contents()->GetKeyboardLockWidget()) << "Location: " << from_here.ToString(); @@ -287,9 +356,9 @@ VerifyKeyboardLockState(from_here); } -void KeyboardLockBrowserTest::EnterFullscreen(const base::Location& from_here) { - web_contents()->EnterFullscreenMode(https_fullscreen_frame(), - blink::WebFullscreenOptions()); +void KeyboardLockBrowserTest::EnterFullscreen(const base::Location& from_here, + const GURL& gurl) { + web_contents()->EnterFullscreenMode(gurl, blink::WebFullscreenOptions()); ASSERT_TRUE(web_contents()->IsFullscreenForCurrentTab()) << "Location: " << from_here.ToString(); @@ -364,39 +433,62 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, SingleLockCall) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); + base::HistogramTester uma; RequestKeyboardLock(FROM_HERE); // Don't explicitly call CancelKeyboardLock(). + + uma.ExpectTotalCount(kKeyboardLockMethodCalledHistogramName, 1); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kRequestAllKeys), + 1); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, SingleLockCallForSomeKeys) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); + base::HistogramTester uma; RequestKeyboardLock(FROM_HERE, /*lock_all_keys=*/false); // Don't explicitly call CancelKeyboardLock(). + + uma.ExpectTotalCount(kKeyboardLockMethodCalledHistogramName, 1); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kRequestSomeKeys), + 1); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, SingleLockWithCancelCall) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); + base::HistogramTester uma; RequestKeyboardLock(FROM_HERE); CancelKeyboardLock(FROM_HERE); + + uma.ExpectTotalCount(kKeyboardLockMethodCalledHistogramName, 2); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kRequestAllKeys), + 1); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kCancelLock), 1); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockCalledBeforeFullscreen) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); RequestKeyboardLock(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockCalledAfterFullscreen) { - NavigateToTestURL(); - EnterFullscreen(FROM_HERE); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); + EnterFullscreen(FROM_HERE, url_for_test); RequestKeyboardLock(FROM_HERE); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockAndCancelCyclingNoActivation) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); + base::HistogramTester uma; RequestKeyboardLock(FROM_HERE); CancelKeyboardLock(FROM_HERE); RequestKeyboardLock(FROM_HERE, /*lock_all_keys=*/false); @@ -405,13 +497,24 @@ CancelKeyboardLock(FROM_HERE); RequestKeyboardLock(FROM_HERE); CancelKeyboardLock(FROM_HERE); + + uma.ExpectTotalCount(kKeyboardLockMethodCalledHistogramName, 8); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kRequestAllKeys), + 3); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kRequestSomeKeys), + 1); + uma.ExpectBucketCount(kKeyboardLockMethodCalledHistogramName, + static_cast<int>(KeyboardLockMethods::kCancelLock), 4); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockAndCancelCyclingInFullscreen) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); RequestKeyboardLock(FROM_HERE); CancelKeyboardLock(FROM_HERE); @@ -426,31 +529,33 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, CancelInFullscreen) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); RequestKeyboardLock(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); CancelKeyboardLock(FROM_HERE); ExitFullscreen(FROM_HERE); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, EnterAndExitFullscreenCycling) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); RequestKeyboardLock(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); ExitFullscreen(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); ExitFullscreen(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); ExitFullscreen(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); ExitFullscreen(FROM_HERE); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, GainAndLoseFocusInWindowMode) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); RequestKeyboardLock(FROM_HERE); @@ -461,26 +566,28 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, EnterFullscreenWithoutFocus) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); RequestKeyboardLock(FROM_HERE); BlurContent(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); ExitFullscreen(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); FocusContent(FROM_HERE); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, GainAndLoseFocusCyclingInFullscreen) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); RequestKeyboardLock(FROM_HERE); BlurContent(FROM_HERE); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); FocusContent(FROM_HERE); BlurContent(FROM_HERE); @@ -495,13 +602,13 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, CancelWithoutLock) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); CancelKeyboardLock(FROM_HERE); CancelKeyboardLock(FROM_HERE); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, MultipleLockCalls) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); RequestKeyboardLock(FROM_HERE); RequestKeyboardLock(FROM_HERE); @@ -509,7 +616,7 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, MultipleCancelCalls) { - NavigateToTestURL(); + NavigateToTestURL(https_fullscreen_frame()); RequestKeyboardLock(FROM_HERE); @@ -519,7 +626,8 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockCallWithAllInvalidKeys) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); bool result; ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -527,13 +635,14 @@ ASSERT_TRUE(result); // If no valid Keys are passed in, then KeyboardLock will not be requested. - ASSERT_EQ(nullptr, web_contents()->GetKeyboardLockWidget()); + ASSERT_FALSE(web_contents()->GetKeyboardLockWidget()); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockCallWithSomeInvalidKeys) { - NavigateToTestURL(); + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); bool result; ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -541,9 +650,9 @@ ASSERT_TRUE(result); // If some valid Keys are passed in, then KeyboardLock will be requested. - ASSERT_NE(nullptr, web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); - EnterFullscreen(FROM_HERE); + EnterFullscreen(FROM_HERE, url_for_test); } IN_PROC_BROWSER_TEST_F(KeyboardLockDisabledBrowserTest, @@ -553,51 +662,289 @@ } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, - KeyboardLockNotAllowedForIFrame) { - // TODO(joedow): IMPLEMENT. + KeyboardLockNotAllowedForSameOriginIFrame) { + NavigateToTestURL(https_cross_site_frame()); + + // The first child has the same origin as the top-level domain. + RenderFrameHost* child_frame = ChildFrameAt(web_contents()->GetMainFrame(), + /*child_index=*/0); + ASSERT_TRUE(child_frame); + + bool api_exists = false; + ASSERT_TRUE(ExecuteScriptAndExtractBool( + child_frame, kKeyboardLockMethodExistanceCheck, &api_exists)); + ASSERT_TRUE(api_exists); + + bool result = false; + ASSERT_TRUE(ExecuteScriptAndExtractBool( + child_frame, kKeyboardLockMethodCallWithAllKeys, &result)); + ASSERT_FALSE(result); + + ASSERT_FALSE(web_contents()->GetKeyboardLockWidget()); +} + +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, + KeyboardLockNotAllowedForCrossOriginIFrame) { + NavigateToTestURL(https_cross_site_frame()); + + // The second child has a different origin as the top-level domain. + RenderFrameHost* child_frame = ChildFrameAt(web_contents()->GetMainFrame(), + /*child_index=*/1); + ASSERT_TRUE(child_frame); + + bool api_exists = false; + ASSERT_TRUE(ExecuteScriptAndExtractBool( + child_frame, kKeyboardLockMethodExistanceCheck, &api_exists)); + ASSERT_TRUE(api_exists); + + bool result = false; + ASSERT_TRUE(ExecuteScriptAndExtractBool( + child_frame, kKeyboardLockMethodCallWithAllKeys, &result)); + ASSERT_FALSE(result); + + ASSERT_FALSE(web_contents()->GetKeyboardLockWidget()); +} + +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, + KeyboardUnlockedWhenNavigatingToSameUrl) { + GURL url_for_test = https_fullscreen_frame(); + NavigateToTestURL(url_for_test); + EnterFullscreen(FROM_HERE, url_for_test); + RequestKeyboardLock(FROM_HERE); + + // Navigate to the same URL which will reset the keyboard lock state. + NavigateToTestURL(url_for_test); + ASSERT_FALSE(web_contents()->GetKeyboardLockWidget()); + + // Entering fullscreen on the new page should not engage keyboard lock. + EnterFullscreen(FROM_HERE, url_for_test); + ASSERT_FALSE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, KeyboardUnlockedWhenNavigatingAway) { - // TODO(joedow): IMPLEMENT. + GURL first_url_for_test = https_fullscreen_frame(); + NavigateToTestURL(first_url_for_test); + EnterFullscreen(FROM_HERE, first_url_for_test); + RequestKeyboardLock(FROM_HERE); + + // Navigate to a new URL which will reset the keyboard lock state. + GURL second_url_for_test = https_cross_site_frame(); + NavigateToTestURL(second_url_for_test); + ASSERT_FALSE(web_contents()->GetKeyboardLockWidget()); + + // Entering fullscreen on the new page should not engage keyboard lock. + EnterFullscreen(FROM_HERE, second_url_for_test); + ASSERT_FALSE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, - CrossOriginIFrameDoesNotReceiveInput) { - // TODO(joedow): Added per code review feedback. - // Steps: Main frame initiates keyboard lock and goes fullscreen. Is input - // delivered to cross-origin iFrame? + KeyboardRemainsLockedWhenIframeNavigates) { + NavigateToTestURL(https_cross_site_frame()); + EnterFullscreen(FROM_HERE, https_cross_site_frame()); + RequestKeyboardLock(FROM_HERE); + + ASSERT_TRUE(NavigateIframeToURL( + web_contents(), kChildIframeName_0, + https_test_server()->GetURL(kCrossSiteTopLevelDomain, kHelloFramePath))); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + ASSERT_TRUE(NavigateIframeToURL( + web_contents(), kChildIframeName_1, + https_test_server()->GetURL(kCrossSiteChildDomain1, kHelloFramePath))); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + ASSERT_TRUE(NavigateIframeToURL( + web_contents(), kChildIframeName_2, + https_test_server()->GetURL(kCrossSiteChildDomain2, kHelloFramePath))); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + ASSERT_TRUE( + NavigateIframeToURL(web_contents(), kChildIframeName_0, + https_test_server()->GetURL(kCrossSiteChildDomain2, + kInputFieldFramePath))); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + ASSERT_TRUE( + NavigateIframeToURL(web_contents(), kChildIframeName_1, + https_test_server()->GetURL(kCrossSiteTopLevelDomain, + kInputFieldFramePath))); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + ASSERT_TRUE( + NavigateIframeToURL(web_contents(), kChildIframeName_2, + https_test_server()->GetURL(kCrossSiteChildDomain1, + kInputFieldFramePath))); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, - CrossOriginIFrameRequestsFullscreen) { - // TODO(joedow): Added per code review feedback. - // Steps: Main frame requests keyboard lock, cross-origin iFrame goes - // fullscreen. Should KeyboardLock be triggered in that case (presumably no). + CrossOriginIFrameReceivesInputWhenFocused) { + NavigateToTestURL(https_cross_site_frame()); + EnterFullscreen(FROM_HERE, https_cross_site_frame()); + RequestKeyboardLock(FROM_HERE); + + GURL iframe_url = + https_test_server()->GetURL(kCrossSiteChildDomain1, kInputFieldFramePath); + ASSERT_TRUE( + NavigateIframeToURL(web_contents(), kChildIframeName_1, iframe_url)); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + RenderFrameHost* main_frame = web_contents()->GetMainFrame(); + RenderFrameHost* child = ChildFrameAt(main_frame, 1); + ASSERT_TRUE(child); + + ASSERT_EQ(main_frame, web_contents()->GetFocusedFrame()); + + std::string result; + ASSERT_TRUE(ExecuteScript(child, kFocusInputFieldScript)); + ASSERT_TRUE(ExecuteScriptAndExtractString( + child, "window.focus(); focusInputField();", &result)); + ASSERT_EQ("input-focus", result); + ASSERT_EQ(child, web_contents()->GetFocusedFrame()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + SimulateKeyPress(web_contents(), "KeyB", "B"); + SimulateKeyPress(web_contents(), "KeyL", "BL"); + SimulateKeyPress(web_contents(), "KeyA", "BLA"); + SimulateKeyPress(web_contents(), "KeyR", "BLAR"); + SimulateKeyPress(web_contents(), "KeyG", "BLARG"); + SimulateKeyPress(web_contents(), "KeyH", "BLARGH"); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, - LockRequestWhileIFrameIsFullscreen) { - // TODO(joedow): Added per code review feedback. - // Steps: 1. Load a page with a cross-site iframe: call main frame "A" and the - // subframe "B" - // 2. B goes fullscreen. - // 3. A initiates keyboard lock. + LockRequestBeforeCrossOriginIFrameIsFullscreen) { + // If the main frame trusts the child frame by granting it the allowfullscreen + // permission, then we will allow keyboard lock to be activated when the child + // frame activates fullscreen. + NavigateToTestURL(https_cross_site_frame()); + RequestKeyboardLock(FROM_HERE); + ASSERT_TRUE(web_contents()->GetKeyboardLockWidget()); + ASSERT_FALSE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); + + RenderFrameHost* main_frame = web_contents()->GetMainFrame(); + RenderFrameHost* child = ChildFrameAt(main_frame, 2); + ASSERT_TRUE(child); + + // The third child is cross-domain and has the allowfullscreen attribute set. + ASSERT_TRUE( + NavigateIframeToURL(web_contents(), kChildIframeName_2, + https_test_server()->GetURL(kCrossSiteChildDomain2, + kFullscreenFramePath))); + ASSERT_TRUE(ExecuteScript(child, "activateFullscreen()")); + + ASSERT_EQ(main_frame->GetView()->GetRenderWidgetHost(), + web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); +} + +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, + LockRequestWhileCrossOriginIFrameIsFullscreen) { + // If the main frame trusts the child frame by granting it the allowfullscreen + // permission, then we will allow keyboard lock to be activated when the child + // frame activates fullscreen. + NavigateToTestURL(https_cross_site_frame()); + + RenderFrameHost* main_frame = web_contents()->GetMainFrame(); + RenderFrameHost* child = ChildFrameAt(main_frame, 2); + ASSERT_TRUE(child); + + // The third child is cross-domain and has the allowfullscreen attribute set. + ASSERT_TRUE( + NavigateIframeToURL(web_contents(), kChildIframeName_2, + https_test_server()->GetURL(kCrossSiteChildDomain2, + kFullscreenFramePath))); + ASSERT_TRUE(ExecuteScript(child, "activateFullscreen()")); + + RequestKeyboardLock(FROM_HERE); + + ASSERT_EQ(main_frame->GetView()->GetRenderWidgetHost(), + web_contents()->GetKeyboardLockWidget()); + ASSERT_TRUE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); } IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, LockRequestFailsFromInnerWebContents) { - // TODO(joedow): Added per code review feedback. - // Steps: Try requesting KeyboardLock from with an inner WebContents context. - // See: CreateAndAttachInnerContents() helper method in - // https://cs.chromium.org/chromium/src/content/public/test/test_utils.h + NavigateToTestURL(https_cross_site_frame()); + + // The first child is a same-origin iframe. + RenderFrameHost* main_frame = web_contents()->GetMainFrame(); + RenderFrameHost* child = ChildFrameAt(main_frame, 0); + ASSERT_TRUE(child); + + WebContents* inner_contents = CreateAndAttachInnerContents(child); + inner_contents->SetDelegate(web_contents_delegate()); + + ASSERT_TRUE( + NavigateToURLFromRenderer(inner_contents, https_fullscreen_frame())); + + bool api_exists = false; + ASSERT_TRUE(ExecuteScriptAndExtractBool( + inner_contents, kKeyboardLockMethodExistanceCheck, &api_exists)); + ASSERT_TRUE(api_exists); + + bool result = false; + ASSERT_TRUE(ExecuteScriptAndExtractBool( + inner_contents, kKeyboardLockMethodCallWithAllKeys, &result)); + // TODO(joedow): Update KeyboardLockServiceImpl to return an error if the lock + // request is not registered. For this test, the end result is correct (no + // lock registered) but it would be good to return an error so the caller + // knows the registration failed. + ASSERT_TRUE(result); + + // Verify neither inner nor outer WebContents have a pending lock request. + WebContentsImpl* inner_contents_impl = + static_cast<WebContentsImpl*>(inner_contents); + ASSERT_FALSE(inner_contents_impl->GetKeyboardLockWidget()); + ASSERT_FALSE( + inner_contents_impl->GetRenderWidgetHostView()->IsKeyboardLocked()); + ASSERT_FALSE(web_contents()->GetKeyboardLockWidget()); + ASSERT_FALSE(web_contents()->GetRenderWidgetHostView()->IsKeyboardLocked()); } -IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, HistogramTest) { +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, + SubsequentLockCallSupersedesPreviousCall) { // TODO(joedow): Added per code review feedback. - // Steps: Call the API methods and verify the histogram data is accurate using - // base::HistogramTester. Alternatively, this could be integrated with the - // test fixture as well. window_open_apitest.cc (line 317()) is an example. + // Steps: 1. Request all keys, verify keys are locked + // 2. Request subset of keys, verify the subset of keys are locked, but + // non-requested keys are no longer locked + // 3. Request all keys again, verify keys are now locked +} + +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, + BrowserShortcutsHandledCorrectly) { + // TODO(joedow): Added per code review feedback. + // Steps: 1. Request keyboard lock for all keys + // 2. Simulate browser shortcut (Ctrl+T) + // 3. Verify new tab is not created + // 4. Unlock keyboard + // 5. Simulate browser shortcut (Ctrl+T) + // 6. Verify new tab was created +} + +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, + InnerContentsFullscreenBehavior) { + // TODO(joedow): Added per code review feedback. Need to define the behavior + // for KeyboardLock when an attached InnerWebContents goes fullscreen. + // Steps: 1. Request keyboard lock for all keys + // 2. InnerWebContents request fullscreen + // 3. Verify KeyboardLock behavior (should match iframe behavior) +} + +IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, InnerContentsInputBehavior) { + // TODO(joedow): Added per code review feedback. Need to define the behavior + // for KeyboardLock when an attached InnerWebContents goes fullscreen. + // Steps: 1. Request keyboard lock for all keys + // 2. Main frame goes fullscreen + // 3. Inner web contents is focused + // 4. Verify input behavior (should match iframe behavior) } } // namespace content
diff --git a/content/browser/loader/navigation_url_loader.cc b/content/browser/loader/navigation_url_loader.cc index 4cc7012c..c3709f8f 100644 --- a/content/browser/loader/navigation_url_loader.cc +++ b/content/browser/loader/navigation_url_loader.cc
@@ -10,7 +10,7 @@ #include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/browser/loader/navigation_url_loader_factory.h" -#include "content/browser/loader/navigation_url_loader_network_service.h" +#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/public/browser/navigation_ui_data.h" #include "content/public/common/browser_side_navigation_policy.h" #include "services/network/public/cpp/features.h" @@ -32,7 +32,7 @@ resource_context, storage_partition, std::move(request_info), std::move(navigation_ui_data), service_worker_handle, delegate); } - return std::make_unique<NavigationURLLoaderNetworkService>( + return std::make_unique<NavigationURLLoaderImpl>( resource_context, storage_partition, std::move(request_info), std::move(navigation_ui_data), service_worker_handle, appcache_handle, delegate, std::vector<std::unique_ptr<NavigationLoaderInterceptor>>());
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_impl.cc similarity index 96% rename from content/browser/loader/navigation_url_loader_network_service.cc rename to content/browser/loader/navigation_url_loader_impl.cc index 3cc782fc..87a1b0f 100644 --- a/content/browser/loader/navigation_url_loader_network_service.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/navigation_url_loader_network_service.h" +#include "content/browser/loader/navigation_url_loader_impl.h" #include <memory> @@ -76,8 +76,7 @@ namespace { // Only used on the IO thread. -base::LazyInstance< - NavigationURLLoaderNetworkService::BeginNavigationInterceptor>::Leaky +base::LazyInstance<NavigationURLLoaderImpl::BeginNavigationInterceptor>::Leaky g_interceptor = LAZY_INSTANCE_INITIALIZER; // Returns true if interception by NavigationLoaderInterceptors is enabled. @@ -251,7 +250,8 @@ previous_request_info.is_for_guests_only, previous_request_info.report_raw_headers, previous_request_info.is_prerendering, - nullptr /* blob_url_loader_factory */); + nullptr /* blob_url_loader_factory */, + previous_request_info.devtools_navigation_token); } // Called for requests that we don't have a URLLoaderFactory for. @@ -271,7 +271,7 @@ // on each until the request is successfully handled. The same sequence // may be performed multiple times when redirects happen. // TODO(michaeln): Expose this class and add more unittests. -class NavigationURLLoaderNetworkService::URLLoaderRequestController +class NavigationURLLoaderImpl::URLLoaderRequestController : public network::mojom::URLLoaderClient { public: URLLoaderRequestController( @@ -284,7 +284,7 @@ network::mojom::URLLoaderFactoryRequest proxied_factory_request, network::mojom::URLLoaderFactoryPtrInfo proxied_factory_info, std::set<std::string> known_schemes, - const base::WeakPtr<NavigationURLLoaderNetworkService>& owner) + const base::WeakPtr<NavigationURLLoaderImpl>& owner) : interceptors_(std::move(initial_interceptors)), resource_request_(std::move(resource_request)), resource_context_(resource_context), @@ -354,8 +354,11 @@ // header is verified and parsed, that's where the getter is used. interceptors_.push_back(std::make_unique<WebPackageRequestHandler>( url::Origin::Create(request_info->common_params.url), + request_info->common_params.url, GetURLLoaderOptions(request_info->is_main_frame), request_info->frame_tree_node_id, + request_info->devtools_navigation_token, + request_info->report_raw_headers, base::MakeRefCounted< SignedExchangeURLLoaderFactoryForNonNetworkService>( resource_context_, url_request_context_getter), @@ -390,8 +393,8 @@ // create a URLLoader. When it doesn't, do not send OnRequestStarted(). BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&NavigationURLLoaderNetworkService::OnRequestStarted, - owner_, base::TimeTicks::Now())); + base::BindOnce(&NavigationURLLoaderImpl::OnRequestStarted, owner_, + base::TimeTicks::Now())); } // TODO(arthursonzogni): See if this could eventually be unified with Start(). @@ -543,8 +546,11 @@ // header is verified and parsed, that's where the getter is used. interceptors_.push_back(std::make_unique<WebPackageRequestHandler>( url::Origin::Create(request_info->common_params.url), + request_info->common_params.url, GetURLLoaderOptions(request_info->is_main_frame), request_info->frame_tree_node_id, + request_info->devtools_navigation_token, + request_info->report_raw_headers, default_url_loader_factory_getter_->GetNetworkFactory(), base::BindRepeating( &URLLoaderRequestController::CreateURLLoaderThrottles, @@ -685,7 +691,7 @@ if (!non_network_factory.is_bound()) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&NavigationURLLoaderNetworkService :: + base::BindOnce(&NavigationURLLoaderImpl :: BindNonNetworkURLLoaderFactoryRequest, owner_, frame_tree_node_id_, resource_request_->url, @@ -925,8 +931,8 @@ // response. https://crbug.com/416050 BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&NavigationURLLoaderNetworkService::OnReceiveResponse, - owner_, response->DeepCopy(), + base::BindOnce(&NavigationURLLoaderImpl::OnReceiveResponse, owner_, + response->DeepCopy(), std::move(url_loader_client_endpoints), std::move(cloned_navigation_data), global_request_id_, is_download, is_stream, std::move(downloaded_file))); @@ -957,8 +963,8 @@ // response. https://crbug.com/416050 BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&NavigationURLLoaderNetworkService::OnReceiveRedirect, - owner_, redirect_info, response->DeepCopy())); + base::BindOnce(&NavigationURLLoaderImpl::OnReceiveRedirect, owner_, + redirect_info, response->DeepCopy())); } void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override {} @@ -995,8 +1001,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::BindOnce(&NavigationURLLoaderNetworkService::OnComplete, owner_, - status)); + base::BindOnce(&NavigationURLLoaderImpl::OnComplete, owner_, status)); } // Returns true if an interceptor wants to handle the response, i.e. return a @@ -1081,7 +1086,7 @@ base::Optional<SubresourceLoaderParams> subresource_loader_params_; // This is referenced only on the UI thread. - base::WeakPtr<NavigationURLLoaderNetworkService> owner_; + base::WeakPtr<NavigationURLLoaderImpl> owner_; // Set to true if the default URLLoader (network service) was used for the // current navigation. @@ -1141,7 +1146,7 @@ // TODO(https://crbug.com/790734): pass |navigation_ui_data| along with the // request so that it could be modified. -NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService( +NavigationURLLoaderImpl::NavigationURLLoaderImpl( ResourceContext* resource_context, StoragePartition* storage_partition, std::unique_ptr<NavigationRequestInfo> request_info, @@ -1270,21 +1275,21 @@ ServiceManagerConnection::GetForProcess()->GetConnector()->Clone())); } -NavigationURLLoaderNetworkService::~NavigationURLLoaderNetworkService() { +NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, request_controller_.release()); } -void NavigationURLLoaderNetworkService::FollowRedirect() { +void NavigationURLLoaderImpl::FollowRedirect() { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&URLLoaderRequestController::FollowRedirect, base::Unretained(request_controller_.get()))); } -void NavigationURLLoaderNetworkService::ProceedWithResponse() {} +void NavigationURLLoaderImpl::ProceedWithResponse() {} -void NavigationURLLoaderNetworkService::OnReceiveResponse( +void NavigationURLLoaderImpl::OnReceiveResponse( scoped_refptr<network::ResourceResponse> response, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, std::unique_ptr<NavigationData> navigation_data, @@ -1293,8 +1298,7 @@ bool is_stream, network::mojom::DownloadedTempFilePtr downloaded_file) { TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, - "&NavigationURLLoaderNetworkService", this, "success", - true); + "&NavigationURLLoaderImpl", this, "success", true); // TODO(scottmg): This needs to do more of what // NavigationResourceHandler::OnResponseStarted() does. @@ -1306,27 +1310,26 @@ request_controller_->TakeSubresourceLoaderParams()); } -void NavigationURLLoaderNetworkService::OnReceiveRedirect( +void NavigationURLLoaderImpl::OnReceiveRedirect( const net::RedirectInfo& redirect_info, scoped_refptr<network::ResourceResponse> response) { DCHECK_CURRENTLY_ON(BrowserThread::UI); delegate_->OnRequestRedirected(redirect_info, std::move(response)); } -void NavigationURLLoaderNetworkService::OnComplete( +void NavigationURLLoaderImpl::OnComplete( const network::URLLoaderCompletionStatus& status) { if (status.error_code == net::OK) return; TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, - "&NavigationURLLoaderNetworkService", this, "success", - false); + "&NavigationURLLoaderImpl", this, "success", false); delegate_->OnRequestFailed(status.exists_in_cache, status.error_code, status.ssl_info); } -void NavigationURLLoaderNetworkService::SetBeginNavigationInterceptorForTesting( +void NavigationURLLoaderImpl::SetBeginNavigationInterceptorForTesting( const BeginNavigationInterceptor& interceptor) { DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::IO) || BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -1334,13 +1337,12 @@ g_interceptor.Get() = interceptor; } -void NavigationURLLoaderNetworkService::OnRequestStarted( - base::TimeTicks timestamp) { +void NavigationURLLoaderImpl::OnRequestStarted(base::TimeTicks timestamp) { DCHECK_CURRENTLY_ON(BrowserThread::UI); delegate_->OnRequestStarted(timestamp); } -void NavigationURLLoaderNetworkService::BindNonNetworkURLLoaderFactoryRequest( +void NavigationURLLoaderImpl::BindNonNetworkURLLoaderFactoryRequest( int frame_tree_node_id, const GURL& url, network::mojom::URLLoaderFactoryRequest factory) {
diff --git a/content/browser/loader/navigation_url_loader_network_service.h b/content/browser/loader/navigation_url_loader_impl.h similarity index 84% rename from content/browser/loader/navigation_url_loader_network_service.h rename to content/browser/loader/navigation_url_loader_impl.h index 17133f5f..67c1d5b 100644 --- a/content/browser/loader/navigation_url_loader_network_service.h +++ b/content/browser/loader/navigation_url_loader_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ -#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ +#ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_ +#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -27,14 +27,11 @@ class NavigationLoaderInterceptor; struct GlobalRequestID; -// This is an implementation of NavigationURLLoader used when -// --enable-features=NetworkService is used. -class CONTENT_EXPORT NavigationURLLoaderNetworkService - : public NavigationURLLoader { +class CONTENT_EXPORT NavigationURLLoaderImpl : public NavigationURLLoader { public: // The caller is responsible for ensuring that |delegate| outlives the loader. // Note |initial_interceptors| is there for test purposes only. - NavigationURLLoaderNetworkService( + NavigationURLLoaderImpl( ResourceContext* resource_context, StoragePartition* storage_partition, std::unique_ptr<NavigationRequestInfo> request_info, @@ -44,7 +41,7 @@ NavigationURLLoaderDelegate* delegate, std::vector<std::unique_ptr<NavigationLoaderInterceptor>> initial_interceptors); - ~NavigationURLLoaderNetworkService() override; + ~NavigationURLLoaderImpl() override; // NavigationURLLoader implementation: void FollowRedirect() override; @@ -99,11 +96,11 @@ ContentBrowserClient::NonNetworkURLLoaderFactoryMap non_network_url_loader_factories_; - base::WeakPtrFactory<NavigationURLLoaderNetworkService> weak_factory_; + base::WeakPtrFactory<NavigationURLLoaderImpl> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderNetworkService); + DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImpl); }; } // namespace content -#endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ +#endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_
diff --git a/content/browser/loader/navigation_url_loader_network_service_unittest.cc b/content/browser/loader/navigation_url_loader_impl_unittest.cc similarity index 94% rename from content/browser/loader/navigation_url_loader_network_service_unittest.cc rename to content/browser/loader/navigation_url_loader_impl_unittest.cc index 424e6c1..8b1dcc5 100644 --- a/content/browser/loader/navigation_url_loader_network_service_unittest.cc +++ b/content/browser/loader/navigation_url_loader_impl_unittest.cc
@@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/navigation_url_loader_network_service.h" +#include "content/browser/loader/navigation_url_loader_impl.h" #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" +#include "base/unguessable_token.h" #include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/browser/loader/navigation_url_loader.h" @@ -110,9 +111,9 @@ } // namespace -class NavigationURLLoaderNetworkServiceTest : public testing::Test { +class NavigationURLLoaderImplTest : public testing::Test { public: - NavigationURLLoaderNetworkServiceTest() + NavigationURLLoaderImplTest() : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) { feature_list_.InitAndEnableFeature(network::features::kNetworkService); @@ -135,7 +136,7 @@ #endif } - ~NavigationURLLoaderNetworkServiceTest() override { + ~NavigationURLLoaderImplTest() override { ServiceManagerConnection::DestroyForProcess(); } @@ -167,13 +168,14 @@ false /* parent_is_main_frame */, false /* are_ancestors_secure */, -1 /* frame_tree_node_id */, false /* is_for_guests_only */, false /* report_raw_headers */, false /* is_prerenering */, - nullptr /* blob_url_loader_factory */)); + nullptr /* blob_url_loader_factory */, + base::UnguessableToken::Create() /* devtools_navigation_token */)); std::vector<std::unique_ptr<NavigationLoaderInterceptor>> interceptors; most_recent_resource_request_ = base::nullopt; interceptors.push_back(std::make_unique<TestNavigationLoaderInterceptor>( &most_recent_resource_request_)); - return std::make_unique<NavigationURLLoaderNetworkService>( + return std::make_unique<NavigationURLLoaderImpl>( browser_context_->GetResourceContext(), BrowserContext::GetDefaultStoragePartition(browser_context_.get()), std::move(request_info), nullptr /* navigation_ui_data */, @@ -255,7 +257,7 @@ base::Optional<network::ResourceRequest> most_recent_resource_request_; }; -TEST_F(NavigationURLLoaderNetworkServiceTest, RequestPriority) { +TEST_F(NavigationURLLoaderImplTest, RequestPriority) { ASSERT_TRUE(http_test_server_.Start()); const GURL url = http_test_server_.GetURL("/redirect301-to-echo"); @@ -265,7 +267,7 @@ NavigateAndReturnRequestPriority(url, false /* is_main_frame */)); } -TEST_F(NavigationURLLoaderNetworkServiceTest, Redirect301Tests) { +TEST_F(NavigationURLLoaderImplTest, Redirect301Tests) { ASSERT_TRUE(http_test_server_.Start()); const GURL url = http_test_server_.GetURL("/redirect301-to-echo"); @@ -279,7 +281,7 @@ true); } -TEST_F(NavigationURLLoaderNetworkServiceTest, Redirect302Tests) { +TEST_F(NavigationURLLoaderImplTest, Redirect302Tests) { ASSERT_TRUE(http_test_server_.Start()); const GURL url = http_test_server_.GetURL("/redirect302-to-echo"); @@ -293,7 +295,7 @@ true); } -TEST_F(NavigationURLLoaderNetworkServiceTest, Redirect303Tests) { +TEST_F(NavigationURLLoaderImplTest, Redirect303Tests) { ASSERT_TRUE(http_test_server_.Start()); const GURL url = http_test_server_.GetURL("/redirect303-to-echo"); @@ -307,7 +309,7 @@ true); } -TEST_F(NavigationURLLoaderNetworkServiceTest, Redirect307Tests) { +TEST_F(NavigationURLLoaderImplTest, Redirect307Tests) { ASSERT_TRUE(http_test_server_.Start()); const GURL url = http_test_server_.GetURL("/redirect307-to-echo"); @@ -321,7 +323,7 @@ true); } -TEST_F(NavigationURLLoaderNetworkServiceTest, Redirect308Tests) { +TEST_F(NavigationURLLoaderImplTest, Redirect308Tests) { ASSERT_TRUE(http_test_server_.Start()); const GURL url = http_test_server_.GetURL("/redirect308-to-echo");
diff --git a/content/browser/loader/navigation_url_loader_unittest.cc b/content/browser/loader/navigation_url_loader_unittest.cc index 3f03259e..ea806d8 100644 --- a/content/browser/loader/navigation_url_loader_unittest.cc +++ b/content/browser/loader/navigation_url_loader_unittest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" +#include "base/unguessable_token.h" #include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/navigation_url_loader.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" @@ -94,7 +95,7 @@ std::unique_ptr<NavigationRequestInfo> request_info( new NavigationRequestInfo(common_params, std::move(begin_params), url, true, false, false, -1, false, false, false, - nullptr)); + nullptr, base::UnguessableToken::Create())); return NavigationURLLoader::Create( browser_context_->GetResourceContext(), BrowserContext::GetDefaultStoragePartition(browser_context_.get()),
diff --git a/content/browser/loader/prefetch_url_loader.cc b/content/browser/loader/prefetch_url_loader.cc index 4f050ef..cd7120f 100644 --- a/content/browser/loader/prefetch_url_loader.cc +++ b/content/browser/loader/prefetch_url_loader.cc
@@ -26,6 +26,8 @@ ResourceContext* resource_context, scoped_refptr<net::URLRequestContextGetter> request_context_getter) : frame_tree_node_id_getter_(frame_tree_node_id_getter), + url_(resource_request.url), + report_raw_headers_(resource_request.report_raw_headers), network_loader_factory_(std::move(network_loader_factory)), client_binding_(this), forwarding_client_(std::move(client)), @@ -85,10 +87,10 @@ // Note that after this point this doesn't directly get upcalls from the // network. (Until |this| calls the handler's FollowRedirect.) web_package_prefetch_handler_ = std::make_unique<WebPackagePrefetchHandler>( - frame_tree_node_id_getter_, response, std::move(loader_), - client_binding_.Unbind(), network_loader_factory_, request_initiator_, - url_loader_throttles_getter_, resource_context_, - request_context_getter_, this); + frame_tree_node_id_getter_, report_raw_headers_, response, + std::move(loader_), client_binding_.Unbind(), network_loader_factory_, + request_initiator_, url_, url_loader_throttles_getter_, + resource_context_, request_context_getter_, this); return; } forwarding_client_->OnReceiveResponse(response, std::move(downloaded_file));
diff --git a/content/browser/loader/prefetch_url_loader.h b/content/browser/loader/prefetch_url_loader.h index 3d5f779..a5bce8e5 100644 --- a/content/browser/loader/prefetch_url_loader.h +++ b/content/browser/loader/prefetch_url_loader.h
@@ -91,6 +91,8 @@ void OnNetworkConnectionError(); const base::RepeatingCallback<int(void)> frame_tree_node_id_getter_; + const GURL url_; + const bool report_raw_headers_; scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_;
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index 8ed2a5c4..e576ad75 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -21,6 +21,7 @@ #include "base/task_scheduler/task_traits.h" #include "base/test/scoped_feature_list.h" #include "base/threading/thread_task_runner_handle.h" +#include "base/unguessable_token.h" #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/download/download_manager_impl.h" #include "content/browser/download/download_resource_handler.h" @@ -817,7 +818,7 @@ std::unique_ptr<NavigationRequestInfo> request_info( new NavigationRequestInfo(common_params, std::move(begin_params), url, true, false, false, -1, false, false, false, - nullptr)); + nullptr, base::UnguessableToken::Create())); std::unique_ptr<NavigationURLLoader> test_loader = NavigationURLLoader::Create( browser_context_->GetResourceContext(),
diff --git a/content/browser/locks/lock_manager.cc b/content/browser/locks/lock_manager.cc index 8e0c5f1..a7768d0 100644 --- a/content/browser/locks/lock_manager.cc +++ b/content/browser/locks/lock_manager.cc
@@ -206,9 +206,6 @@ } void ProcessRequests(LockManager* lock_manager, const url::Origin& origin) { - if (requested_.empty()) - return; - shared_.clear(); exclusive_.clear(); for (const auto& id_lock_pair : held_) {
diff --git a/content/browser/media/encrypted_media_browsertest.cc b/content/browser/media/encrypted_media_browsertest.cc index 2efdb59..7096e1e 100644 --- a/content/browser/media/encrypted_media_browsertest.cc +++ b/content/browser/media/encrypted_media_browsertest.cc
@@ -317,8 +317,10 @@ } IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBCS) { + std::string expected_result = + BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME) ? media::kEnded : media::kError; TestMp4EncryptionPlayback("bear-640x360-v_frag-cbcs.mp4", kMp4Avc1VideoOnly, - media::kError); + expected_result); } #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h index f823af11..58492d8d 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.h +++ b/content/browser/renderer_host/browser_compositor_view_mac.h
@@ -129,7 +129,7 @@ } // Returns nullptr if no compositor is attached. - ui::Compositor* CompositorForTesting() const; + ui::Compositor* Compositor() const; void DidNavigate();
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm index a03b35db..6c377879 100644 --- a/content/browser/renderer_host/browser_compositor_view_mac.mm +++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -522,7 +522,7 @@ client_->OnFrameTokenChanged(frame_token); } -ui::Compositor* BrowserCompositorMac::CompositorForTesting() const { +ui::Compositor* BrowserCompositorMac::Compositor() const { if (recyclable_compositor_) return recyclable_compositor_->compositor(); return nullptr;
diff --git a/content/browser/renderer_host/embedded_frame_sink_impl.cc b/content/browser/renderer_host/embedded_frame_sink_impl.cc index cc35105..0d7a158 100644 --- a/content/browser/renderer_host/embedded_frame_sink_impl.cc +++ b/content/browser/renderer_host/embedded_frame_sink_impl.cc
@@ -41,18 +41,17 @@ void EmbeddedFrameSinkImpl::CreateCompositorFrameSink( viz::mojom::CompositorFrameSinkClientPtr client, viz::mojom::CompositorFrameSinkRequest request) { - if (has_created_compositor_frame_sink_) { - DLOG(ERROR) << "CreateCompositorFrameSink() called more than once."; - return; - } - - // The request to create an embedded frame sink and the lifetime of the parent - // are controlled by different IPC channels. It's possible the parent - // FrameSinkId has been invalidated by the time this request has arrived. In - // that case, drop the request since there is no embedder. - if (!host_frame_sink_manager_->RegisterFrameSinkHierarchy( - parent_frame_sink_id_, frame_sink_id_)) { - return; + // We might recreate the CompositorFrameSink on context loss or GPU crash. + // Only register frame sink hierarchy the first time. + if (!has_created_compositor_frame_sink_) { + // The request to create an embedded frame sink and the lifetime of the + // parent are controlled by different IPC channels. It's possible the parent + // FrameSinkId has been invalidated by the time this request has arrived. In + // that case, drop the request since there is no embedder. + if (!host_frame_sink_manager_->RegisterFrameSinkHierarchy( + parent_frame_sink_id_, frame_sink_id_)) { + return; + } } host_frame_sink_manager_->CreateCompositorFrameSink(
diff --git a/content/browser/renderer_host/input/fling_browsertest.cc b/content/browser/renderer_host/input/fling_browsertest.cc index 2497163d..401de60b 100644 --- a/content/browser/renderer_host/input/fling_browsertest.cc +++ b/content/browser/renderer_host/input/fling_browsertest.cc
@@ -85,6 +85,70 @@ DISALLOW_COPY_AND_ASSIGN(BrowserSideFlingBrowserTest); }; +IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, TouchscreenFling) { + LoadURL(kBrowserFlingDataURL); + + // Send a GSB to start scrolling sequence. + blink::WebGestureEvent gesture_scroll_begin( + blink::WebGestureEvent::kGestureScrollBegin, + blink::WebInputEvent::kNoModifiers, ui::EventTimeForNow()); + gesture_scroll_begin.SetSourceDevice(blink::kWebGestureDeviceTouchscreen); + gesture_scroll_begin.data.scroll_begin.delta_hint_units = + blink::WebGestureEvent::ScrollUnits::kPrecisePixels; + gesture_scroll_begin.data.scroll_begin.delta_x_hint = 0.f; + gesture_scroll_begin.data.scroll_begin.delta_y_hint = -5.f; + GetWidgetHost()->ForwardGestureEvent(gesture_scroll_begin); + + // Send a GFS and wait for the page to scroll making sure that fling progress + // has started. + blink::WebGestureEvent gesture_fling_start( + blink::WebGestureEvent::kGestureFlingStart, + blink::WebInputEvent::kNoModifiers, ui::EventTimeForNow()); + gesture_fling_start.SetSourceDevice(blink::kWebGestureDeviceTouchscreen); + gesture_fling_start.data.fling_start.velocity_x = 0.f; + gesture_fling_start.data.fling_start.velocity_y = -2000.f; + GetWidgetHost()->ForwardGestureEvent(gesture_fling_start); + RenderFrameSubmissionObserver observer( + GetWidgetHost()->render_frame_metadata_provider()); + gfx::Vector2dF default_scroll_offset; + while (observer.LastRenderFrameMetadata() + .root_scroll_offset.value_or(default_scroll_offset) + .y() <= 0) { + observer.WaitForMetadataChange(); + } +} + +IN_PROC_BROWSER_TEST_F(BrowserSideFlingBrowserTest, TouchpadFling) { + LoadURL(kBrowserFlingDataURL); + + // Send a wheel event to start scrolling sequence. + auto input_msg_watcher = std::make_unique<InputMsgWatcher>( + GetWidgetHost(), blink::WebInputEvent::kMouseWheel); + blink::WebMouseWheelEvent wheel_event = + SyntheticWebMouseWheelEventBuilder::Build(10, 10, 0, -53, 0, true); + wheel_event.phase = blink::WebMouseWheelEvent::kPhaseBegan; + GetWidgetHost()->ForwardWheelEvent(wheel_event); + input_msg_watcher->WaitForAck(); + + // Send a GFS and wait for the page to scroll more than 60 pixels making sure + // that fling progress has started. + blink::WebGestureEvent gesture_fling_start( + blink::WebGestureEvent::kGestureFlingStart, + blink::WebInputEvent::kNoModifiers, ui::EventTimeForNow()); + gesture_fling_start.SetSourceDevice(blink::kWebGestureDeviceTouchpad); + gesture_fling_start.data.fling_start.velocity_x = 0.f; + gesture_fling_start.data.fling_start.velocity_y = -2000.f; + GetWidgetHost()->ForwardGestureEvent(gesture_fling_start); + RenderFrameSubmissionObserver observer( + GetWidgetHost()->render_frame_metadata_provider()); + gfx::Vector2dF default_scroll_offset; + while (observer.LastRenderFrameMetadata() + .root_scroll_offset.value_or(default_scroll_offset) + .y() <= 60) { + observer.WaitForMetadataChange(); + } +} + // TODO(sahel): This test is flaking on OS_CHROMEOS https://crbug.com/838769 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) #define MAYBE_AutoscrollFling DISABLED_AutoscrollFling
diff --git a/content/browser/renderer_host/input/fling_controller.cc b/content/browser/renderer_host/input/fling_controller.cc index 5f88cce..af07b91 100644 --- a/content/browser/renderer_host/input/fling_controller.cc +++ b/content/browser/renderer_host/input/fling_controller.cc
@@ -6,6 +6,7 @@ #include "content/browser/renderer_host/input/gesture_event_queue.h" #include "content/public/common/content_features.h" +#include "ui/compositor/compositor.h" #include "ui/events/base_event_utils.h" #include "ui/events/blink/fling_booster.h" #include "ui/events/gestures/blink/web_gesture_curve_impl.h" @@ -28,10 +29,12 @@ FlingController::FlingController( GestureEventQueue* gesture_event_queue, - FlingControllerClient* fling_client, + FlingControllerEventSenderClient* event_sender_client, + FlingControllerSchedulerClient* scheduler_client, const Config& config) : gesture_event_queue_(gesture_event_queue), - client_(fling_client), + event_sender_client_(event_sender_client), + scheduler_client_(scheduler_client), touchpad_tap_suppression_controller_( config.touchpad_tap_suppression_config), touchscreen_tap_suppression_controller_( @@ -40,12 +43,17 @@ send_wheel_events_nonblocking_( base::FeatureList::IsEnabled( features::kTouchpadAndWheelScrollLatching) && - base::FeatureList::IsEnabled(features::kAsyncWheelEvents)) { + base::FeatureList::IsEnabled(features::kAsyncWheelEvents)), + weak_ptr_factory_(this) { DCHECK(gesture_event_queue); - DCHECK(fling_client); + DCHECK(event_sender_client); + DCHECK(scheduler_client); } -FlingController::~FlingController() {} +FlingController::~FlingController() { + if (compositor_) + compositor_->RemoveAnimationObserver(this); +} bool FlingController::ShouldForwardForGFCFiltering( const GestureEventWithLatencyInfo& gesture_event) const { @@ -161,7 +169,7 @@ } void FlingController::ScheduleFlingProgress() { - client_->SetNeedsBeginFrameForFlingProgress(); + scheduler_client_->ScheduleFlingProgress(weak_ptr_factory_.GetWeakPtr()); } void FlingController::ProcessGestureFlingCancel( @@ -172,16 +180,16 @@ CancelCurrentFling(); } -gfx::Vector2dF FlingController::ProgressFling(base::TimeTicks current_time) { +void FlingController::ProgressFling(base::TimeTicks current_time) { if (!fling_curve_) - return gfx::Vector2dF(); + return; DCHECK(fling_booster_); fling_booster_->set_last_fling_animation_time( (current_time - base::TimeTicks()).InSecondsF()); if (fling_booster_->MustCancelDeferredFling()) { CancelCurrentFling(); - return gfx::Vector2dF(); + return; } if (!has_fling_animation_started_) { @@ -193,7 +201,7 @@ kMaxMicrosecondsFromFlingTimestampToFirstProgress) { current_fling_parameters_.start_time = current_time; ScheduleFlingProgress(); - return current_fling_parameters_.velocity; + return; } } @@ -209,14 +217,13 @@ // As long as the fling curve is active, the fling progress must get // scheduled even when the last delta to scroll was zero. ScheduleFlingProgress(); - return current_fling_parameters_.velocity; + return; } if (current_fling_parameters_.source_device != blink::kWebGestureDeviceSyntheticAutoscroll) { CancelCurrentFling(); } - return gfx::Vector2dF(); } void FlingController::StopFling() { @@ -250,7 +257,7 @@ : WebInputEvent::kBlocking; } - client_->SendGeneratedWheelEvent(synthetic_wheel); + event_sender_client_->SendGeneratedWheelEvent(synthetic_wheel); } void FlingController::GenerateAndSendGestureScrollEvents( @@ -276,7 +283,7 @@ synthetic_gesture.event.data.scroll_end.inertial_phase = WebGestureEvent::kMomentumPhase; } - client_->SendGeneratedGestureScrollEvents(synthetic_gesture); + event_sender_client_->SendGeneratedGestureScrollEvents(synthetic_gesture); } void FlingController::GenerateAndSendFlingProgressEvents( @@ -367,12 +374,13 @@ latency_source_event_type = ui::SourceEventType::WHEEL; } - client_->SendGeneratedGestureScrollEvents(GestureEventWithLatencyInfo( - scroll_begin_event, ui::LatencyInfo(latency_source_event_type))); + event_sender_client_->SendGeneratedGestureScrollEvents( + GestureEventWithLatencyInfo( + scroll_begin_event, ui::LatencyInfo(latency_source_event_type))); } if (had_active_fling) - client_->DidStopFlingingOnBrowser(); + scheduler_client_->DidStopFlingingOnBrowser(weak_ptr_factory_.GetWeakPtr()); } bool FlingController::UpdateCurrentFlingState( @@ -410,6 +418,30 @@ blink::kWebGestureDeviceTouchscreen; } +gfx::Vector2dF FlingController::CurrentFlingVelocity() const { + return current_fling_parameters_.velocity; +} + +void FlingController::OnAnimationStep(base::TimeTicks timestamp) { + ProgressFling(timestamp); +} + +void FlingController::OnCompositingShuttingDown(ui::Compositor* compositor) { + compositor->RemoveAnimationObserver(this); + compositor_ = nullptr; +} + +void FlingController::SetCompositor(ui::Compositor* compositor) { + if (compositor) { + DCHECK(!compositor_); + compositor->AddAnimationObserver(this); + } else { + DCHECK(compositor_); + compositor_->RemoveAnimationObserver(this); + } + compositor_ = compositor; +} + TouchpadTapSuppressionController* FlingController::GetTouchpadTapSuppressionController() { return &touchpad_tap_suppression_controller_;
diff --git a/content/browser/renderer_host/input/fling_controller.h b/content/browser/renderer_host/input/fling_controller.h index 4a0afe5..98bdc2c 100644 --- a/content/browser/renderer_host/input/fling_controller.h +++ b/content/browser/renderer_host/input/fling_controller.h
@@ -8,12 +8,14 @@ #include "content/browser/renderer_host/input/touchpad_tap_suppression_controller.h" #include "content/browser/renderer_host/input/touchscreen_tap_suppression_controller.h" #include "content/public/common/input_event_ack_state.h" +#include "ui/compositor/compositor_animation_observer.h" namespace blink { class WebGestureCurve; } namespace ui { +class Compositor; class FlingBooster; } @@ -21,24 +23,34 @@ class GestureEventQueue; +class FlingController; + // Interface with which the FlingController can forward generated fling progress // events. -class CONTENT_EXPORT FlingControllerClient { +class CONTENT_EXPORT FlingControllerEventSenderClient { public: - virtual ~FlingControllerClient() {} + virtual ~FlingControllerEventSenderClient() {} virtual void SendGeneratedWheelEvent( const MouseWheelEventWithLatencyInfo& wheel_event) = 0; virtual void SendGeneratedGestureScrollEvents( const GestureEventWithLatencyInfo& gesture_event) = 0; - - virtual void SetNeedsBeginFrameForFlingProgress() = 0; - - virtual void DidStopFlingingOnBrowser() = 0; }; -class CONTENT_EXPORT FlingController { +// Interface with which the fling progress gets scheduled. +class CONTENT_EXPORT FlingControllerSchedulerClient { + public: + virtual ~FlingControllerSchedulerClient() {} + + virtual void ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) = 0; + + virtual void DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) = 0; +}; + +class CONTENT_EXPORT FlingController : public ui::CompositorAnimationObserver { public: struct CONTENT_EXPORT Config { Config(); @@ -62,14 +74,14 @@ }; FlingController(GestureEventQueue* gesture_event_queue, - FlingControllerClient* fling_client, + FlingControllerEventSenderClient* event_sender_client, + FlingControllerSchedulerClient* scheduler_client, const Config& config); - ~FlingController(); + ~FlingController() override; - // Used to progress an active fling on every begin frame and return the - // current fling velocity. - gfx::Vector2dF ProgressFling(base::TimeTicks current_time); + // Used to progress an active fling on every begin frame. + void ProgressFling(base::TimeTicks current_time); // Used to halt an active fling progress whenever needed. void StopFling(); @@ -87,13 +99,23 @@ bool fling_in_progress() const { return fling_in_progress_; } + ui::Compositor* compositor() const { return compositor_; } + bool FlingCancellationIsDeferred() const; bool TouchscreenFlingInProgress() const; + gfx::Vector2dF CurrentFlingVelocity() const; + // Returns the |TouchpadTapSuppressionController| instance. TouchpadTapSuppressionController* GetTouchpadTapSuppressionController(); + // ui::CompositorAnimationObserver + void OnAnimationStep(base::TimeTicks timestamp) override; + void OnCompositingShuttingDown(ui::Compositor* compositor) override; + + void SetCompositor(ui::Compositor* compositor); + protected: std::unique_ptr<ui::FlingBooster> fling_booster_; @@ -140,7 +162,9 @@ GestureEventQueue* gesture_event_queue_; - FlingControllerClient* client_; + FlingControllerEventSenderClient* event_sender_client_; + + FlingControllerSchedulerClient* scheduler_client_; // An object tracking the state of touchpad on the delivery of mouse events to // the renderer to filter mouse immediately after a touchpad fling canceling @@ -166,6 +190,10 @@ bool send_wheel_events_nonblocking_; + ui::Compositor* compositor_ = nullptr; + + base::WeakPtrFactory<FlingController> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(FlingController); };
diff --git a/content/browser/renderer_host/input/fling_controller_unittest.cc b/content/browser/renderer_host/input/fling_controller_unittest.cc index de211239..e9878e2 100644 --- a/content/browser/renderer_host/input/fling_controller_unittest.cc +++ b/content/browser/renderer_host/input/fling_controller_unittest.cc
@@ -22,10 +22,13 @@ class FakeFlingController : public FlingController { public: FakeFlingController(GestureEventQueue* gesture_event_queue, - FlingControllerClient* fling_client, + + FlingControllerEventSenderClient* event_sender_client, + FlingControllerSchedulerClient* scheduler_client, const Config& config) : FlingController(gesture_event_queue, - fling_client, + event_sender_client, + scheduler_client, config) {} bool FlingBoosted() const { return fling_booster_->fling_boosted(); } @@ -33,7 +36,8 @@ class FlingControllerTest : public testing::Test, public GestureEventQueueClient, - public FlingControllerClient { + public FlingControllerEventSenderClient, + public FlingControllerSchedulerClient { public: // testing::Test FlingControllerTest() @@ -43,12 +47,12 @@ ~FlingControllerTest() override {} void SetUp() override { - queue_ = std::make_unique<GestureEventQueue>(this, this, + queue_ = std::make_unique<GestureEventQueue>(this, this, this, GestureEventQueue::Config()); FlingController::Config config; config.touchscreen_tap_suppression_config.enabled = true; fling_controller_ = - std::make_unique<FakeFlingController>(queue_.get(), this, config); + std::make_unique<FakeFlingController>(queue_.get(), this, this, config); feature_list_.InitFromCommandLine( features::kTouchpadAndWheelScrollLatching.name, ""); } @@ -60,7 +64,7 @@ InputEventAckSource ack_source, InputEventAckState ack_result) override {} - // FlingControllerClient + // FlingControllerEventSenderClient void SendGeneratedWheelEvent( const MouseWheelEventWithLatencyInfo& wheel_event) override { last_sent_wheel_ = wheel_event.event; @@ -69,11 +73,15 @@ const GestureEventWithLatencyInfo& gesture_event) override { last_sent_gesture_ = gesture_event.event; } - void SetNeedsBeginFrameForFlingProgress() override { + + // FlingControllerSchedulerClient + void ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) override { DCHECK(!scheduled_next_fling_progress_); scheduled_next_fling_progress_ = true; } - void DidStopFlingingOnBrowser() override { + void DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) override { notified_client_after_fling_stop_ = true; }
diff --git a/content/browser/renderer_host/input/fling_scheduler.cc b/content/browser/renderer_host/input/fling_scheduler.cc new file mode 100644 index 0000000..62a46fe0 --- /dev/null +++ b/content/browser/renderer_host/input/fling_scheduler.cc
@@ -0,0 +1,80 @@ +// 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 "content/browser/renderer_host/input/fling_scheduler.h" + +#include "build/build_config.h" +#include "content/browser/renderer_host/render_widget_host_impl.h" +#include "ui/compositor/compositor.h" + +#if defined(USE_AURA) +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" +#endif + +namespace content { + +FlingScheduler::FlingScheduler(RenderWidgetHostImpl* host) : host_(host) { + DCHECK(host); +} +FlingScheduler::~FlingScheduler() = default; + +void FlingScheduler::ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) { + DCHECK(fling_controller); + fling_controller_ = fling_controller; + ui::Compositor* compositor = GetCompositor(); + + if (compositor) { + // |fling_controller->SetCompositor(compositor)| adds the fling_controller + // as an animation observer to this compositor when fling_controller has + // called |ScheduleFlingProgress| for the first time. + if (!is_observer_added_) { + fling_controller->SetCompositor(compositor); + is_observer_added_ = true; + } + } else { // No compositor is available. + host_->SetNeedsBeginFrameForFlingProgress(); + } +} +void FlingScheduler::DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) { + DCHECK(fling_controller); + if (GetCompositor()) { + // |fling_controller->SetCompositor(nullptr)| removes the fling_controller + // as an animation observer from its current compositor when flinging has + // stopped. + fling_controller->SetCompositor(nullptr); + is_observer_added_ = false; + } + fling_controller_ = nullptr; + host_->DidStopFlinging(); +} + +void FlingScheduler::ProgressFlingOnBeginFrameIfneeded( + base::TimeTicks current_time) { + // No fling is active. + if (!fling_controller_) + return; + + // FlingProgress will be called within FlingController::OnAnimationStep. + if (is_observer_added_) + return; + + fling_controller_->ProgressFling(current_time); +} + +ui::Compositor* FlingScheduler::GetCompositor() { +#if defined(USE_AURA) + if (host_->GetView() && host_->GetView()->GetNativeView() && + host_->GetView()->GetNativeView()->GetHost() && + host_->GetView()->GetNativeView()->GetHost()->compositor()) { + return host_->GetView()->GetNativeView()->GetHost()->compositor(); + } +#endif + + return nullptr; +} + +} // namespace content
diff --git a/content/browser/renderer_host/input/fling_scheduler.h b/content/browser/renderer_host/input/fling_scheduler.h new file mode 100644 index 0000000..071d506 --- /dev/null +++ b/content/browser/renderer_host/input/fling_scheduler.h
@@ -0,0 +1,43 @@ +// 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_H_ +#define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_H_ + +#include "content/browser/renderer_host/input/fling_controller.h" + +namespace ui { +class Compositor; +} + +namespace content { + +class RenderWidgetHostImpl; + +class CONTENT_EXPORT FlingScheduler : public FlingControllerSchedulerClient { + public: + FlingScheduler(RenderWidgetHostImpl* host); + ~FlingScheduler() override; + + // FlingControllerSchedulerClient + void ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) override; + void DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) override; + + void ProgressFlingOnBeginFrameIfneeded(base::TimeTicks current_time); + + protected: + virtual ui::Compositor* GetCompositor(); + RenderWidgetHostImpl* host_; + base::WeakPtr<FlingController> fling_controller_; + + private: + bool is_observer_added_ = false; + + DISALLOW_COPY_AND_ASSIGN(FlingScheduler); +}; +} // namespace content + +#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_H_
diff --git a/content/browser/renderer_host/input/fling_scheduler_mac.h b/content/browser/renderer_host/input/fling_scheduler_mac.h new file mode 100644 index 0000000..21c180c --- /dev/null +++ b/content/browser/renderer_host/input/fling_scheduler_mac.h
@@ -0,0 +1,27 @@ +// 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_MAC_H_ +#define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_MAC_H_ + +#include "content/browser/renderer_host/input/fling_scheduler.h" + +namespace content { + +class RenderWidgetHostImpl; + +class CONTENT_EXPORT FlingSchedulerMac : public FlingScheduler { + public: + FlingSchedulerMac(RenderWidgetHostImpl* host); + ~FlingSchedulerMac() override; + + private: + ui::Compositor* GetCompositor() override; + + DISALLOW_COPY_AND_ASSIGN(FlingSchedulerMac); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_SCHEDULER_MAC_H_
diff --git a/content/browser/renderer_host/input/fling_scheduler_mac.mm b/content/browser/renderer_host/input/fling_scheduler_mac.mm new file mode 100644 index 0000000..f2ac740b --- /dev/null +++ b/content/browser/renderer_host/input/fling_scheduler_mac.mm
@@ -0,0 +1,36 @@ +// 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 "content/browser/renderer_host/input/fling_scheduler_mac.h" + +#include "content/browser/renderer_host/render_widget_host_impl.h" +#include "content/browser/renderer_host/render_widget_host_view_mac.h" +#include "ui/compositor/compositor.h" + +namespace content { + +FlingSchedulerMac::FlingSchedulerMac(RenderWidgetHostImpl* host) + : FlingScheduler(host) {} +FlingSchedulerMac::~FlingSchedulerMac() = default; + +ui::Compositor* FlingSchedulerMac::GetCompositor() { + if (!host_->GetView()) + return nullptr; + + // RWHV_child_frame doesn't have DelegatedFrameHost with ui::Compositor. + if (host_->GetView()->IsRenderWidgetHostViewChildFrame()) + return nullptr; + + // TODO(sahel): Uncomment this once Viz is ready on Mac. + // https://crbug.com/833985 + /* RenderWidgetHostViewMac* view = + static_cast<RenderWidgetHostViewMac*>(host_->GetView()); + if (view->BrowserCompositor()) + return view->BrowserCompositor()->Compositor(); + } */ + + return nullptr; +} + +} // namespace content
diff --git a/content/browser/renderer_host/input/fling_scheduler_unittest.cc b/content/browser/renderer_host/input/fling_scheduler_unittest.cc new file mode 100644 index 0000000..b8dcb5e --- /dev/null +++ b/content/browser/renderer_host/input/fling_scheduler_unittest.cc
@@ -0,0 +1,159 @@ +// 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 "content/browser/renderer_host/input/fling_scheduler.h" + +#include "content/public/test/mock_render_process_host.h" +#include "content/public/test/test_browser_context.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "content/test/mock_render_widget_host_delegate.h" +#include "content/test/test_render_view_host.h" +#include "content/test/test_render_widget_host.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +class FakeFlingScheduler : public FlingScheduler { + public: + FakeFlingScheduler(RenderWidgetHostImpl* host) : FlingScheduler(host) {} + + void ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) override { + FlingScheduler::ScheduleFlingProgress(fling_controller); + fling_in_progress_ = true; + } + + void DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) override { + FlingScheduler::DidStopFlingingOnBrowser(fling_controller); + fling_in_progress_ = false; + } + + bool fling_in_progress() const { return fling_in_progress_; } + + ui::Compositor* compositor() { return GetCompositor(); } + + base::WeakPtr<FlingController> fling_controller() const { + return fling_controller_; + } + + private: + bool fling_in_progress_ = false; + + DISALLOW_COPY_AND_ASSIGN(FakeFlingScheduler); +}; + +class FlingSchedulerTest : public testing::Test, + public GestureEventQueueClient, + public FlingControllerEventSenderClient { + public: + FlingSchedulerTest() {} + void SetUp() override { + view_ = CreateView(); + widget_host_->SetView(view_); + + fling_scheduler_ = std::make_unique<FakeFlingScheduler>(widget_host_); + queue_ = std::make_unique<GestureEventQueue>( + this, this, fling_scheduler_.get(), GestureEventQueue::Config()); + fling_controller_ = std::make_unique<FlingController>( + queue_.get(), this, fling_scheduler_.get(), FlingController::Config()); + } + + void TearDown() override { + view_->Destroy(); + widget_host_->ShutdownAndDestroyWidget(true); + browser_context_.reset(); + + base::RunLoop().RunUntilIdle(); + } + + TestRenderWidgetHostView* CreateView() { + browser_context_ = std::make_unique<TestBrowserContext>(); + process_host_ = new MockRenderProcessHost(browser_context_.get()); + process_host_->Init(); + int32_t routing_id = process_host_->GetNextRoutingID(); + delegate_ = std::make_unique<MockRenderWidgetHostDelegate>(); + widget_host_ = TestRenderWidgetHost::Create(delegate_.get(), process_host_, + routing_id, false) + .release(); + delegate_->set_widget_host(widget_host_); + return new TestRenderWidgetHostView(widget_host_); + } + + void SimulateFlingStart(const gfx::Vector2dF& velocity) { + blink::WebGestureEvent fling_start(blink::WebInputEvent::kGestureFlingStart, + 0, base::TimeTicks::Now(), + blink::kWebGestureDeviceTouchscreen); + fling_start.data.fling_start.velocity_x = velocity.x(); + fling_start.data.fling_start.velocity_y = velocity.y(); + GestureEventWithLatencyInfo fling_start_with_latency(fling_start); + if (!fling_controller_->FilterGestureEvent(fling_start_with_latency)) + fling_controller_->ProcessGestureFlingStart(fling_start_with_latency); + } + + void SimulateFlingCancel() { + blink::WebGestureEvent fling_cancel( + blink::WebInputEvent::kGestureFlingCancel, 0, base::TimeTicks::Now(), + blink::kWebGestureDeviceTouchscreen); + fling_cancel.data.fling_cancel.prevent_boosting = true; + GestureEventWithLatencyInfo fling_cancel_with_latency(fling_cancel); + if (!fling_controller_->FilterGestureEvent(fling_cancel_with_latency)) + fling_controller_->ProcessGestureFlingCancel(fling_cancel_with_latency); + } + + // GestureEventQueueClient + void SendGestureEventImmediately( + const GestureEventWithLatencyInfo& event) override {} + void OnGestureEventAck(const GestureEventWithLatencyInfo& event, + InputEventAckSource ack_source, + InputEventAckState ack_result) override {} + + // FlingControllerEventSenderClient + void SendGeneratedWheelEvent( + const MouseWheelEventWithLatencyInfo& wheel_event) override {} + void SendGeneratedGestureScrollEvents( + const GestureEventWithLatencyInfo& gesture_event) override {} + + std::unique_ptr<FlingController> fling_controller_; + std::unique_ptr<FakeFlingScheduler> fling_scheduler_; + + private: + TestBrowserThreadBundle thread_bundle_; + std::unique_ptr<GestureEventQueue> queue_; + std::unique_ptr<TestBrowserContext> browser_context_; + RenderWidgetHostImpl* widget_host_; + MockRenderProcessHost* process_host_; + TestRenderWidgetHostView* view_; + std::unique_ptr<MockRenderWidgetHostDelegate> delegate_; + + DISALLOW_COPY_AND_ASSIGN(FlingSchedulerTest); +}; + +TEST_F(FlingSchedulerTest, ScheduleNextFlingProgress) { + base::TimeTicks progress_time = base::TimeTicks::Now(); + SimulateFlingStart(gfx::Vector2dF(1000, 0)); + EXPECT_TRUE(fling_scheduler_->fling_in_progress()); + EXPECT_EQ(fling_controller_.get(), + fling_scheduler_->fling_controller().get()); + EXPECT_EQ(fling_scheduler_->compositor(), fling_controller_->compositor()); + + progress_time += base::TimeDelta::FromMilliseconds(17); + fling_controller_->ProgressFling(progress_time); + EXPECT_TRUE(fling_scheduler_->fling_in_progress()); +} + +TEST_F(FlingSchedulerTest, FlingCancelled) { + SimulateFlingStart(gfx::Vector2dF(1000, 0)); + EXPECT_TRUE(fling_scheduler_->fling_in_progress()); + EXPECT_EQ(fling_controller_.get(), + fling_scheduler_->fling_controller().get()); + EXPECT_EQ(fling_scheduler_->compositor(), fling_controller_->compositor()); + + SimulateFlingCancel(); + EXPECT_FALSE(fling_scheduler_->fling_in_progress()); + EXPECT_EQ(nullptr, fling_scheduler_->fling_controller()); + EXPECT_EQ(nullptr, fling_controller_->compositor()); +} + +} // namespace content \ No newline at end of file
diff --git a/content/browser/renderer_host/input/gesture_event_queue.cc b/content/browser/renderer_host/input/gesture_event_queue.cc index 900eb52f..10cdaaf1 100644 --- a/content/browser/renderer_host/input/gesture_event_queue.cc +++ b/content/browser/renderer_host/input/gesture_event_queue.cc
@@ -26,7 +26,8 @@ GestureEventQueue::GestureEventQueue( GestureEventQueueClient* client, - FlingControllerClient* fling_client, + FlingControllerEventSenderClient* fling_event_sender_client, + FlingControllerSchedulerClient* fling_scheduler_client, const Config& config) : client_(client), fling_in_progress_(false), @@ -36,10 +37,12 @@ base::FeatureList::IsEnabled(features::kVsyncAlignedInputEvents)), debounce_interval_(config.debounce_interval), fling_controller_(this, - fling_client, + fling_event_sender_client, + fling_scheduler_client, config.fling_config) { DCHECK(client); - DCHECK(fling_client); + DCHECK(fling_event_sender_client); + DCHECK(fling_scheduler_client); } GestureEventQueue::~GestureEventQueue() { } @@ -74,10 +77,6 @@ return true; } -gfx::Vector2dF GestureEventQueue::ProgressFling(base::TimeTicks current_time) { - return fling_controller_.ProgressFling(current_time); -} - void GestureEventQueue::StopFling() { fling_in_progress_ = false; fling_controller_.StopFling(); @@ -90,6 +89,9 @@ bool GestureEventQueue::TouchscreenFlingInProgress() const { return fling_controller_.TouchscreenFlingInProgress(); } +gfx::Vector2dF GestureEventQueue::CurrentFlingVelocity() const { + return fling_controller_.CurrentFlingVelocity(); +} bool GestureEventQueue::ShouldDiscardFlingCancelEvent( const GestureEventWithLatencyInfo& gesture_event) const {
diff --git a/content/browser/renderer_host/input/gesture_event_queue.h b/content/browser/renderer_host/input/gesture_event_queue.h index b014137..db490fd 100644 --- a/content/browser/renderer_host/input/gesture_event_queue.h +++ b/content/browser/renderer_host/input/gesture_event_queue.h
@@ -72,7 +72,8 @@ // Both |client| and |touchpad_client| must outlive the GestureEventQueue. GestureEventQueue(GestureEventQueueClient* client, - FlingControllerClient* fling_client, + FlingControllerEventSenderClient* fling_event_sender_client, + FlingControllerSchedulerClient* fling_scheduler_client, const Config& config); ~GestureEventQueue(); @@ -108,10 +109,6 @@ bool ShouldDiscardFlingCancelEvent( const GestureEventWithLatencyInfo& gesture_event) const; - // Calls |fling_controller_.ProgressFling| to advance an active fling on every - // begin frame and returns the current fling velocity if a fling is active. - gfx::Vector2dF ProgressFling(base::TimeTicks current_time); - // Calls |fling_controller_.StopFling| to halt an active fling if such exists. void StopFling(); @@ -119,6 +116,8 @@ bool TouchscreenFlingInProgress() const; + gfx::Vector2dF CurrentFlingVelocity() const; + void set_debounce_interval_time_ms_for_testing(int interval_ms) { debounce_interval_ = base::TimeDelta::FromMilliseconds(interval_ms); }
diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc index c9e1978..95906bdea 100644 --- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
@@ -36,7 +36,8 @@ class GestureEventQueueTest : public testing::Test, public GestureEventQueueClient, - public FlingControllerClient { + public FlingControllerEventSenderClient, + public FlingControllerSchedulerClient { public: GestureEventQueueTest() : GestureEventQueueTest(false) {} @@ -55,7 +56,7 @@ // testing::Test void SetUp() override { - queue_.reset(new GestureEventQueue(this, this, DefaultConfig())); + queue_.reset(new GestureEventQueue(this, this, this, DefaultConfig())); } void TearDown() override { @@ -71,7 +72,7 @@ gesture_config.fling_config.touchscreen_tap_suppression_config .max_cancel_to_down_time = base::TimeDelta::FromMilliseconds(max_cancel_to_down_time_ms); - queue_.reset(new GestureEventQueue(this, this, gesture_config)); + queue_.reset(new GestureEventQueue(this, this, this, gesture_config)); } // GestureEventQueueClient @@ -96,13 +97,17 @@ } } - // FlingControllerClient + // FlingControllerEventSenderClient void SendGeneratedWheelEvent( const MouseWheelEventWithLatencyInfo& wheel_event) override {} void SendGeneratedGestureScrollEvents( const GestureEventWithLatencyInfo& gesture_event) override {} - void SetNeedsBeginFrameForFlingProgress() override {} - void DidStopFlingingOnBrowser() override {} + + // FlingControllerSchedulerClient + void ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) override {} + void DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) override {} protected: static GestureEventQueue::Config DefaultConfig() {
diff --git a/content/browser/renderer_host/input/input_router.h b/content/browser/renderer_host/input/input_router.h index dbced13..7b6c6f8 100644 --- a/content/browser/renderer_host/input/input_router.h +++ b/content/browser/renderer_host/input/input_router.h
@@ -70,9 +70,6 @@ virtual void BindHost(mojom::WidgetInputHandlerHostRequest request, bool frame_handler) = 0; - // Used to progress an active fling on every begin frame. - virtual void ProgressFling(base::TimeTicks current_time) = 0; - // Used to stop an active fling if such exists. virtual void StopFling() = 0;
diff --git a/content/browser/renderer_host/input/input_router_client.h b/content/browser/renderer_host/input/input_router_client.h index 7d776d1..15bac83 100644 --- a/content/browser/renderer_host/input/input_router_client.h +++ b/content/browser/renderer_host/input/input_router_client.h
@@ -70,10 +70,6 @@ virtual void ForwardWheelEventWithLatencyInfo( const blink::WebMouseWheelEvent& wheel_event, const ui::LatencyInfo& latency_info) = 0; - - // Called when the input router needs a begin frame to advance an active - // fling. - virtual void SetNeedsBeginFrameForFlingProgress() = 0; }; } // namespace content
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc index 980d082..42f95801 100644 --- a/content/browser/renderer_host/input/input_router_impl.cc +++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -68,9 +68,11 @@ } // namespace -InputRouterImpl::InputRouterImpl(InputRouterImplClient* client, - InputDispositionHandler* disposition_handler, - const Config& config) +InputRouterImpl::InputRouterImpl( + InputRouterImplClient* client, + InputDispositionHandler* disposition_handler, + FlingControllerSchedulerClient* fling_scheduler_client, + const Config& config) : client_(client), disposition_handler_(disposition_handler), frame_tree_node_id_(-1), @@ -80,7 +82,10 @@ features::kTouchpadAndWheelScrollLatching)), wheel_event_queue_(this, wheel_scroll_latching_enabled_), touch_event_queue_(this, config.touch_config), - gesture_event_queue_(this, this, config.gesture_config), + gesture_event_queue_(this, + this, + fling_scheduler_client, + config.gesture_config), device_scale_factor_(1.f), host_binding_(this), frame_host_binding_(this), @@ -89,6 +94,7 @@ DCHECK(client); DCHECK(disposition_handler); + DCHECK(fling_scheduler_client); UpdateTouchAckTimeoutEnabled(); } @@ -209,10 +215,6 @@ } } -void InputRouterImpl::ProgressFling(base::TimeTicks current_time) { - current_fling_velocity_ = gesture_event_queue_.ProgressFling(current_time); -} - void InputRouterImpl::StopFling() { gesture_event_queue_.StopFling(); } @@ -221,11 +223,6 @@ return gesture_event_queue_.FlingCancellationIsDeferred(); } -void InputRouterImpl::DidStopFlingingOnBrowser() { - current_fling_velocity_ = gfx::Vector2dF(); - client_->DidStopFlinging(); -} - void InputRouterImpl::CancelTouchTimeout() { touch_event_queue_.SetAckTimeoutEnabled(false); } @@ -243,7 +240,8 @@ void InputRouterImpl::DidOverscroll(const ui::DidOverscrollParams& params) { // Touchpad and Touchscreen flings are handled on the browser side. ui::DidOverscrollParams fling_updated_params = params; - fling_updated_params.current_fling_velocity = current_fling_velocity_; + fling_updated_params.current_fling_velocity = + gesture_event_queue_.CurrentFlingVelocity(); client_->DidOverscroll(fling_updated_params); } @@ -390,10 +388,6 @@ gesture_event.latency); } -void InputRouterImpl::SetNeedsBeginFrameForFlingProgress() { - client_->SetNeedsBeginFrameForFlingProgress(); -} - void InputRouterImpl::SendMouseWheelEventImmediately( const MouseWheelEventWithLatencyInfo& wheel_event) { mojom::WidgetInputHandler::DispatchEventCallback callback = base::BindOnce(
diff --git a/content/browser/renderer_host/input/input_router_impl.h b/content/browser/renderer_host/input/input_router_impl.h index 3367e32..3e09ea83 100644 --- a/content/browser/renderer_host/input/input_router_impl.h +++ b/content/browser/renderer_host/input/input_router_impl.h
@@ -15,6 +15,7 @@ #include "base/macros.h" #include "base/time/time.h" #include "cc/input/touch_action.h" +#include "content/browser/renderer_host/input/fling_scheduler.h" #include "content/browser/renderer_host/input/gesture_event_queue.h" #include "content/browser/renderer_host/input/input_router.h" #include "content/browser/renderer_host/input/input_router_client.h" @@ -49,16 +50,16 @@ }; // A default implementation for browser input event routing. -class CONTENT_EXPORT InputRouterImpl - : public InputRouter, - public GestureEventQueueClient, - public FlingControllerClient, - public MouseWheelEventQueueClient, - public PassthroughTouchEventQueueClient, - public mojom::WidgetInputHandlerHost { +class CONTENT_EXPORT InputRouterImpl : public InputRouter, + public GestureEventQueueClient, + public FlingControllerEventSenderClient, + public MouseWheelEventQueueClient, + public PassthroughTouchEventQueueClient, + public mojom::WidgetInputHandlerHost { public: InputRouterImpl(InputRouterImplClient* client, InputDispositionHandler* disposition_handler, + FlingControllerSchedulerClient* fling_scheduler_client, const Config& config); ~InputRouterImpl() override; @@ -79,10 +80,8 @@ cc::TouchAction AllowedTouchAction() override; void BindHost(mojom::WidgetInputHandlerHostRequest request, bool frame_handler) override; - void ProgressFling(base::TimeTicks current_time) override; void StopFling() override; bool FlingCancellationIsDeferred() override; - void DidStopFlingingOnBrowser() override; // InputHandlerHost impl void CancelTouchTimeout() override; @@ -125,12 +124,11 @@ InputEventAckSource ack_source, InputEventAckState ack_result) override; - // FlingControllerClient + // FlingControllerEventSenderClient void SendGeneratedWheelEvent( const MouseWheelEventWithLatencyInfo& wheel_event) override; void SendGeneratedGestureScrollEvents( const GestureEventWithLatencyInfo& gesture_event) override; - void SetNeedsBeginFrameForFlingProgress() override; // MouseWheelEventQueueClient void SendMouseWheelEventImmediately( @@ -217,8 +215,6 @@ float device_scale_factor_; - gfx::Vector2dF current_fling_velocity_; - // Last touch position relative to screen. Used to compute movementX/Y. base::flat_map<int, gfx::Point> global_touch_position_;
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc index 511c513..d09c2d0 100644 --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -147,10 +147,6 @@ input_router_client_.DidStartScrollingViewport(); } - void SetNeedsBeginFrameForFlingProgress() override { - input_router_client_.SetNeedsBeginFrameForFlingProgress(); - } - void ForwardWheelEventWithLatencyInfo( const blink::WebMouseWheelEvent& wheel_event, const ui::LatencyInfo& latency_info) override { @@ -245,8 +241,9 @@ command_line->AppendSwitch(switches::kValidateInputEventStream); client_.reset(new MockInputRouterImplClient()); disposition_handler_.reset(new MockInputDispositionHandler()); - input_router_.reset(new InputRouterImpl( - client_.get(), disposition_handler_.get(), config_)); + input_router_.reset( + new InputRouterImpl(client_.get(), disposition_handler_.get(), + &client_->input_router_client_, config_)); client_->set_input_router(input_router()); disposition_handler_->set_input_router(input_router()); @@ -2351,48 +2348,4 @@ EXPECT_EQ(40, filter_event->data.two_finger_tap.first_finger_height); } -// Thie test is flaky on Fuchsia. crbug.com/807803 -#if defined(OS_FUCHSIA) -#define MAYBE_GestureFlingStart DISABLED_GestureFlingStart -#else -#define MAYBE_GestureFlingStart GestureFlingStart -#endif -TEST_F(InputRouterImplScaleGestureEventTest, MAYBE_GestureFlingStart) { - // Simulate a GSB since touchscreen flings must happen inside scroll. - SimulateGestureEvent(SyntheticWebGestureEventBuilder::BuildScrollBegin( - 10.f, 20.f, blink::kWebGestureDeviceTouchscreen)); - FlushGestureEvent(WebInputEvent::kGestureScrollBegin); - - const gfx::PointF orig(10, 20), scaled(20, 40); - WebGestureEvent event = - BuildGestureEvent(WebInputEvent::kGestureFlingStart, orig); - event.SetSourceDevice(blink::kWebGestureDeviceTouchscreen); - event.data.fling_start.velocity_x = 30; - event.data.fling_start.velocity_y = 40; - SimulateGestureEvent(event); - // Fling events don't get sent to the renderer. - UpdateDispatchedMessages(); - ASSERT_EQ(0u, dispatched_messages_.size()); - - // Progress the fling and check the first GestureScrollUpdate generated by - // fling progress, note that |at(0)| is TouchScrollStarted. - base::TimeTicks progress_time = - base::TimeTicks::Now() + base::TimeDelta::FromMilliseconds(17); - input_router_->ProgressFling(progress_time); - UpdateDispatchedMessages(); - ASSERT_EQ(2u, dispatched_messages_.size()); - const WebGestureEvent* sent_event = static_cast<const WebGestureEvent*>( - dispatched_messages_[1]->ToEvent()->Event()->web_event.get()); - TestLocationInSentEvent(sent_event, orig, scaled); - float sent_delta_x = sent_event->data.scroll_update.delta_x; - float sent_delta_y = sent_event->data.scroll_update.delta_y; - EXPECT_LT(0, sent_delta_x); - EXPECT_LT(0, sent_delta_y); - - const WebGestureEvent* filter_event = - GetFilterWebInputEvent<WebGestureEvent>(); - TestLocationInFilterEvent(filter_event, orig); - EXPECT_FLOAT_EQ(sent_delta_x, 2 * filter_event->data.scroll_update.delta_x); - EXPECT_FLOAT_EQ(sent_delta_y, 2 * filter_event->data.scroll_update.delta_y); -} } // namespace content
diff --git a/content/browser/renderer_host/input/mock_input_router_client.cc b/content/browser/renderer_host/input/mock_input_router_client.cc index c9716092..151d929 100644 --- a/content/browser/renderer_host/input/mock_input_router_client.cc +++ b/content/browser/renderer_host/input/mock_input_router_client.cc
@@ -65,8 +65,6 @@ void MockInputRouterClient::DidStartScrollingViewport() {} -void MockInputRouterClient::SetNeedsBeginFrameForFlingProgress() {} - void MockInputRouterClient::ForwardGestureEventWithLatencyInfo( const blink::WebGestureEvent& gesture_event, const ui::LatencyInfo& latency_info) {
diff --git a/content/browser/renderer_host/input/mock_input_router_client.h b/content/browser/renderer_host/input/mock_input_router_client.h index 057c571..81df67b 100644 --- a/content/browser/renderer_host/input/mock_input_router_client.h +++ b/content/browser/renderer_host/input/mock_input_router_client.h
@@ -9,6 +9,7 @@ #include <memory> +#include "content/browser/renderer_host/input/fling_controller.h" #include "content/browser/renderer_host/input/input_router_client.h" #include "content/common/input/input_event.h" #include "ui/events/blink/did_overscroll_params.h" @@ -17,7 +18,8 @@ class InputRouter; -class MockInputRouterClient : public InputRouterClient { +class MockInputRouterClient : public InputRouterClient, + public FlingControllerSchedulerClient { public: MockInputRouterClient(); ~MockInputRouterClient() override; @@ -33,7 +35,6 @@ void OnSetWhiteListedTouchAction(cc::TouchAction touch_action) override; void DidStopFlinging() override; void DidStartScrollingViewport() override; - void SetNeedsBeginFrameForFlingProgress() override; void ForwardWheelEventWithLatencyInfo( const blink::WebMouseWheelEvent& wheel_event, const ui::LatencyInfo& latency_info) override; @@ -66,6 +67,12 @@ return last_filter_event_->web_event.get(); } + // FlingControllerSchedulerClient + void ScheduleFlingProgress( + base::WeakPtr<FlingController> fling_controller) override {} + void DidStopFlingingOnBrowser( + base::WeakPtr<FlingController> fling_controller) override {} + private: InputRouter* input_router_; int in_flight_event_count_;
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc index 12ead42..b927661 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc
@@ -129,9 +129,13 @@ ssl_config, GURL("https://" + dest_host_port_pair.ToString()), false /*use_tls*/); - int status = socket_->Connect( - base::Bind(&P2PSocketHostTcpBase::OnConnected, - base::Unretained(this))); + if (IsPseudoTlsClientSocket(type_)) { + socket_ = + std::make_unique<jingle_glue::FakeSSLClientSocket>(std::move(socket_)); + } + + int status = socket_->Connect(base::BindOnce( + &P2PSocketHostTcpBase::OnConnected, base::Unretained(this))); if (status != net::ERR_IO_PENDING) { // We defer execution of ProcessConnectDone instead of calling it // directly here as the caller may not expect an error/close to @@ -169,17 +173,6 @@ if (IsTlsClientSocket(type_)) { state_ = STATE_TLS_CONNECTING; StartTls(); - } else if (IsPseudoTlsClientSocket(type_)) { - std::unique_ptr<net::StreamSocket> transport_socket = std::move(socket_); - socket_.reset( - new jingle_glue::FakeSSLClientSocket(std::move(transport_socket))); - state_ = STATE_TLS_CONNECTING; - int status = socket_->Connect( - base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, - base::Unretained(this))); - if (status != net::ERR_IO_PENDING) { - ProcessTlsSslConnectDone(status); - } } else { // If we are not doing TLS, we are ready to send data now. // In case of TLS, SignalConnect will be sent only after TLS handshake is
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc index 6853bbffe..40cdbca3 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc
@@ -11,9 +11,14 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/sys_byteorder.h" +#include "base/test/scoped_task_environment.h" #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" +#include "jingle/glue/fake_ssl_client_socket.h" +#include "net/socket/socket_test_util.h" #include "net/socket/stream_socket.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "net/url_request/url_request_test_util.h" +#include "services/network/proxy_resolving_client_socket_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -466,4 +471,52 @@ EXPECT_EQ(expected_data, sent_data_); } +// When pseudo-tls is used (e.g. for P2P_SOCKET_SSLTCP_CLIENT), +// network::ProxyResolvingClientSocket::Connect() won't be called twice. +// Regression test for crbug.com/840797. +TEST(P2PSocketHostTcpWithPseudoTlsTest, Basic) { + base::test::ScopedTaskEnvironment scoped_task_environment( + base::test::ScopedTaskEnvironment::MainThreadType::IO); + MockIPCSender sender; + EXPECT_CALL( + sender, + Send(MatchMessage(static_cast<uint32_t>(P2PMsg_OnSocketCreated::ID)))) + .WillOnce(DoAll(DeleteArg<0>(), Return(true))); + + net::TestURLRequestContext context(true); + net::MockClientSocketFactory mock_socket_factory; + context.set_client_socket_factory(&mock_socket_factory); + context.Init(); + network::ProxyResolvingClientSocketFactory factory(&mock_socket_factory, + &context); + + base::StringPiece ssl_client_hello = + jingle_glue::FakeSSLClientSocket::GetSslClientHello(); + base::StringPiece ssl_server_hello = + jingle_glue::FakeSSLClientSocket::GetSslServerHello(); + net::MockRead reads[] = { + net::MockRead(net::ASYNC, ssl_server_hello.data(), + ssl_server_hello.size()), + net::MockRead(net::SYNCHRONOUS, net::ERR_IO_PENDING)}; + net::MockWrite writes[] = {net::MockWrite( + net::SYNCHRONOUS, ssl_client_hello.data(), ssl_client_hello.size())}; + net::StaticSocketDataProvider data_provider(reads, writes); + net::IPEndPoint server_addr(net::IPAddress::IPv4Localhost(), 1234); + data_provider.set_connect_data( + net::MockConnect(net::SYNCHRONOUS, net::OK, server_addr)); + mock_socket_factory.AddSocketDataProvider(&data_provider); + + P2PSocketHostTcp host(&sender, 0 /*socket_id*/, P2P_SOCKET_SSLTCP_CLIENT, + nullptr, &factory); + P2PHostAndIPEndPoint dest; + dest.ip_address = server_addr; + bool success = host.Init(net::IPEndPoint(net::IPAddress::IPv4Localhost(), 0), + 0, 0, dest); + EXPECT_TRUE(success); + + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(data_provider.AllReadDataConsumed()); + EXPECT_TRUE(data_provider.AllWriteDataConsumed()); +} + } // namespace content
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 6178907b..0e1f58c 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -49,6 +49,7 @@ #include "content/browser/renderer_host/dip_util.h" #include "content/browser/renderer_host/display_util.h" #include "content/browser/renderer_host/frame_token_message_queue.h" +#include "content/browser/renderer_host/input/fling_scheduler.h" #include "content/browser/renderer_host/input/input_router_config_helper.h" #include "content/browser/renderer_host/input/input_router_impl.h" #include "content/browser/renderer_host/input/synthetic_gesture.h" @@ -118,6 +119,7 @@ #endif #if defined(OS_MACOSX) +#include "content/browser/renderer_host/input/fling_scheduler_mac.h" #include "content/public/common/service_manager_connection.h" #include "services/device/public/mojom/constants.mojom.h" #include "services/device/public/mojom/wake_lock_provider.mojom.h" @@ -379,6 +381,12 @@ frame_sink_id_(base::checked_cast<uint32_t>(process_->GetID()), base::checked_cast<uint32_t>(routing_id_)), weak_factory_(this) { +#if defined(OS_MACOSX) + auto fling_scheduler = std::make_unique<FlingSchedulerMac>(this); + fling_scheduler_ = std::move(fling_scheduler); +#else + fling_scheduler_ = std::make_unique<FlingScheduler>(this); +#endif CHECK(delegate_); CHECK_NE(MSG_ROUTING_NONE, routing_id_); DCHECK(base::TaskScheduler::GetInstance()) @@ -2960,8 +2968,8 @@ associated_widget_input_handler_ = nullptr; widget_input_handler_ = nullptr; - input_router_.reset( - new InputRouterImpl(this, this, GetInputRouterConfigForPlatform())); + input_router_.reset(new InputRouterImpl(this, this, fling_scheduler_.get(), + GetInputRouterConfigForPlatform())); // input_router_ recreated, need to update the force_enable_zoom_ state. input_router_->SetForceEnableZoom(force_enable_zoom_); @@ -3003,10 +3011,9 @@ } } -void RenderWidgetHostImpl::ProgressFling(TimeTicks current_time) { +void RenderWidgetHostImpl::ProgressFlingIfNeeded(TimeTicks current_time) { browser_fling_needs_begin_frame_ = false; - if (input_router_) - input_router_->ProgressFling(current_time); + fling_scheduler_->ProgressFlingOnBeginFrameIfneeded(current_time); } void RenderWidgetHostImpl::DidReceiveFirstFrameAfterNavigation() {
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index a33abc3f..d88424f 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -99,6 +99,7 @@ namespace content { class BrowserAccessibilityManager; +class FlingScheduler; class InputRouter; class MockRenderWidgetHost; class RenderWidgetHostOwnerDelegate; @@ -672,9 +673,10 @@ void OnMessageDispatchError(const IPC::Message& message) override; void OnProcessSwapMessage(const IPC::Message& message) override; - void ProgressFling(base::TimeTicks current_time); + void ProgressFlingIfNeeded(base::TimeTicks current_time); void StopFling(); bool FlingCancellationIsDeferred() const; + void SetNeedsBeginFrameForFlingProgress(); void DidReceiveFirstFrameAfterNavigation(); @@ -701,6 +703,8 @@ // Indicates whether keyboard lock is active. bool IsKeyboardLocked() const; + void DidStopFlinging() override; + void GetContentRenderingTimeoutFrom(RenderWidgetHostImpl* other); protected: @@ -844,11 +848,9 @@ void DecrementInFlightEventCount(InputEventAckSource ack_source) override; void OnHasTouchEventHandlers(bool has_handlers) override; void DidOverscroll(const ui::DidOverscrollParams& params) override; - void DidStopFlinging() override; void DidStartScrollingViewport() override; void OnSetWhiteListedTouchAction( cc::TouchAction white_listed_touch_action) override {} - void SetNeedsBeginFrameForFlingProgress() override; // Dispatch input events with latency information void DispatchInputEventWithLatencyInfo(const blink::WebInputEvent& event, @@ -1165,6 +1167,8 @@ const viz::FrameSinkId frame_sink_id_; + std::unique_ptr<FlingScheduler> fling_scheduler_; + bool did_receive_first_frame_after_navigation_ = true; base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index b817f2f..3a22167 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -131,7 +131,6 @@ void SetForceEnableZoom(bool enabled) override {} void BindHost(mojom::WidgetInputHandlerHostRequest request, bool frame_handler) override {} - void ProgressFling(base::TimeTicks time) override {} void StopFling() override {} bool FlingCancellationIsDeferred() override { return false; } @@ -209,7 +208,8 @@ } void DisableGestureDebounce() { - input_router_.reset(new InputRouterImpl(this, this, InputRouter::Config())); + input_router_.reset(new InputRouterImpl(this, this, fling_scheduler_.get(), + InputRouter::Config())); } void ExpectForceEnableZoom(bool enable) { @@ -285,13 +285,15 @@ std::move(widget), false), new_content_rendering_timeout_fired_(false), - widget_impl_(std::move(widget_impl)) { + widget_impl_(std::move(widget_impl)), + fling_scheduler_(std::make_unique<FlingScheduler>(this)) { acked_touch_event_type_ = blink::WebInputEvent::kUndefined; frame_token_message_queue_.reset(new TestFrameTokenMessageQueue(this)); } std::unique_ptr<MockWidgetImpl> widget_impl_; + std::unique_ptr<FlingScheduler> fling_scheduler_; DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHost); };
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 2cec58a..aab7582e 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -2086,12 +2086,12 @@ bool webview_fling = sync_compositor_ && is_currently_scrolling_viewport_; if (!webview_fling) { - host_->ProgressFling(args.frame_time); + host_->ProgressFlingIfNeeded(args.frame_time); } else if (sync_compositor_->on_compute_scroll_called()) { // On Android webview progress the fling only when |OnComputeScroll| is // called since in some cases Apps override |OnComputeScroll| to cancel // fling animation. - host_->ProgressFling(args.frame_time); + host_->ProgressFlingIfNeeded(args.frame_time); } // Update |last_begin_frame_args_| before handling
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 6a0753f..a4c0b126 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -581,7 +581,7 @@ } void RenderWidgetHostViewAura::OnBeginFrame(base::TimeTicks frame_time) { - host()->ProgressFling(frame_time); + host()->ProgressFlingIfNeeded(frame_time); UpdateNeedsBeginFramesInternal(); }
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 67f8a47b..51a6eae 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -4488,7 +4488,7 @@ base::TimeTicks::Now() + base::TimeDelta::FromMilliseconds(17); // Overscroll mode will get reset at the end of the fling progress. while (overscroll_mode() != OVERSCROLL_NONE) { - widget_host_->ProgressFling(progress_time); + widget_host_->ProgressFlingIfNeeded(progress_time); progress_time += base::TimeDelta::FromMilliseconds(17); } EXPECT_EQ(OverscrollSource::NONE, overscroll_source()); @@ -4674,7 +4674,7 @@ // progress. base::TimeTicks progress_time = base::TimeTicks::Now() + base::TimeDelta::FromMilliseconds(17); - widget_host_->ProgressFling(progress_time); + widget_host_->ProgressFlingIfNeeded(progress_time); EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); } } @@ -5951,7 +5951,7 @@ base::TimeTicks::Now() + base::TimeDelta::FromMilliseconds(17); // Overscroll delta will get reset at the end of the fling progress. while (overscroll_delta_y() != 0.f) { - widget_host_->ProgressFling(progress_time); + widget_host_->ProgressFlingIfNeeded(progress_time); progress_time += base::TimeDelta::FromMilliseconds(17); } }
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc index 4563b7f..4133ead 100644 --- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc +++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
@@ -912,7 +912,7 @@ void RenderWidgetHostViewChildFrame::OnBeginFrame( const viz::BeginFrameArgs& args) { - host_->ProgressFling(args.frame_time); + host_->ProgressFlingIfNeeded(args.frame_time); if (renderer_compositor_frame_sink_) renderer_compositor_frame_sink_->OnBeginFrame(args); }
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index 5e9d6b5..ac120df 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -273,7 +273,7 @@ // Delegated frame management and compositor interface. std::unique_ptr<BrowserCompositorMac> browser_compositor_; - BrowserCompositorMac* BrowserCompositorForTesting() const { + BrowserCompositorMac* BrowserCompositor() const { return browser_compositor_.get(); }
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index e0e8561e..ed76614 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -77,7 +77,7 @@ base::TimeTicks frame_time) { // ProgressFling must get called for middle click autoscroll fling on Mac. if (host()) - host()->ProgressFling(frame_time); + host()->ProgressFlingIfNeeded(frame_time); UpdateNeedsBeginFramesInternal(); }
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index b932090..fa5387bb9 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -1934,13 +1934,12 @@ } TEST_F(RenderWidgetHostViewMacTest, ClearCompositorFrame) { - BrowserCompositorMac* browser_compositor = - rwhv_mac_->BrowserCompositorForTesting(); - EXPECT_NE(browser_compositor->CompositorForTesting(), nullptr); - EXPECT_TRUE(browser_compositor->CompositorForTesting()->IsLocked()); + BrowserCompositorMac* browser_compositor = rwhv_mac_->BrowserCompositor(); + EXPECT_NE(browser_compositor->Compositor(), nullptr); + EXPECT_TRUE(browser_compositor->Compositor()->IsLocked()); rwhv_mac_->ClearCompositorFrame(); - EXPECT_NE(browser_compositor->CompositorForTesting(), nullptr); - EXPECT_FALSE(browser_compositor->CompositorForTesting()->IsLocked()); + EXPECT_NE(browser_compositor->Compositor(), nullptr); + EXPECT_FALSE(browser_compositor->Compositor()->IsLocked()); } // This test verifies that in AutoResize mode a child-allocated @@ -1974,8 +1973,7 @@ host_->DidUpdateVisualProperties(gfx::Size(75, 75), local_surface_id2); // Cause a conflicting viz::LocalSurfaceId allocation - BrowserCompositorMac* browser_compositor = - rwhv_mac_->BrowserCompositorForTesting(); + BrowserCompositorMac* browser_compositor = rwhv_mac_->BrowserCompositor(); EXPECT_TRUE(browser_compositor->ForceNewSurfaceForTesting()); viz::LocalSurfaceId local_surface_id3(rwhv_mac_->GetLocalSurfaceId()); EXPECT_NE(local_surface_id1, local_surface_id3);
diff --git a/content/browser/service_worker/service_worker_navigation_loader.h b/content/browser/service_worker/service_worker_navigation_loader.h index 4f12d5b..66f608b 100644 --- a/content/browser/service_worker/service_worker_navigation_loader.h +++ b/content/browser/service_worker/service_worker_navigation_loader.h
@@ -57,8 +57,7 @@ // determines how the request should be served (e.g. should fallback // to network or should be sent to the SW). If it decides to fallback // to the network this will call |loader_callback| with a null - // RequestHandler, which will be then handled by - // NavigationURLLoaderNetworkService. + // RequestHandler, which will be then handled by NavigationURLLoaderImpl. // 2. If it is decided that the request should be sent to the SW, // this job dispatches a FetchEvent in StartRequest. // 3. In DidDispatchFetchEvent() this job determines the request's @@ -69,12 +68,12 @@ // StartResponse(). // 5. Then StartResponse() will be called with a // network::mojom::URLLoaderClientPtr that is connected to - // NavigationURLLoaderNetworkService (for resource loading for navigation). + // NavigationURLLoaderImpl (for resource loading for navigation). // This forwards the blob/stream data pipe to the NavigationURLLoader if // the response body was sent as a blob/stream. // // Loads for shared workers work similarly, except SharedWorkerScriptLoader - // is used instead of NavigationURLLoaderNetworkService. + // is used instead of NavigationURLLoaderImpl. ServiceWorkerNavigationLoader( NavigationLoaderInterceptor::LoaderCallback loader_callback, Delegate* delegate,
diff --git a/content/browser/shared_worker/shared_worker_script_loader.h b/content/browser/shared_worker/shared_worker_script_loader.h index 7e61d8c..f1d55c74 100644 --- a/content/browser/shared_worker/shared_worker_script_loader.h +++ b/content/browser/shared_worker/shared_worker_script_loader.h
@@ -21,7 +21,7 @@ // The URLLoader for loading a shared worker script. Only used for the main // script request. // -// This acts much like NavigationURLLoaderNetworkService. It allows a +// This acts much like NavigationURLLoaderImpl. It allows a // NavigationLoaderInterceptor to intercept the request with its own loader, and // goes to the network loader otherwise. Once a loader is started, this class // acts as the URLLoaderClient for it, forwarding messages to the outer client. @@ -76,8 +76,7 @@ SingleRequestURLLoaderFactory::RequestHandler single_request_handler); void LoadFromNetwork(); - // TODO(falken): Add other interceptors like in - // NavigationURLLoaderNetworkService. + // TODO(falken): Add other interceptors like in NavigationURLLoaderImpl. std::unique_ptr<NavigationLoaderInterceptor> service_worker_interceptor_; const int32_t routing_id_;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 6a9a264..0bb17c9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1954,7 +1954,7 @@ if (render_widget_host == mouse_lock_widget_) LostMouseLock(mouse_lock_widget_); - CancelKeyboardLock(keyboard_lock_widget_); + CancelKeyboardLock(render_widget_host); } void WebContentsImpl::RenderWidgetGotFocus( @@ -3906,6 +3906,9 @@ if (IsFullscreenForCurrentTab()) ExitFullscreen(false); DCHECK(!IsFullscreenForCurrentTab()); + + // Clean up keyboard lock state when navigating. + CancelKeyboardLock(keyboard_lock_widget_); } void WebContentsImpl::DidNavigateMainFramePostCommit(
diff --git a/content/browser/web_package/signed_exchange_cert_fetcher.cc b/content/browser/web_package/signed_exchange_cert_fetcher.cc index 2b25813..2b81230 100644 --- a/content/browser/web_package/signed_exchange_cert_fetcher.cc +++ b/content/browser/web_package/signed_exchange_cert_fetcher.cc
@@ -170,7 +170,8 @@ handle_watcher_ = nullptr; std::unique_ptr<SignedExchangeCertificateChain> cert_chain = - SignedExchangeCertificateChain::Parse(body_string_); + SignedExchangeCertificateChain::Parse( + base::as_bytes(base::make_span(body_string_))); body_string_.clear(); if (!cert_chain) { signed_exchange_utils::ReportErrorAndEndTraceEvent(
diff --git a/content/browser/web_package/signed_exchange_certificate_chain.cc b/content/browser/web_package/signed_exchange_certificate_chain.cc index ea587d69..1aed3bb 100644 --- a/content/browser/web_package/signed_exchange_certificate_chain.cc +++ b/content/browser/web_package/signed_exchange_certificate_chain.cc
@@ -15,30 +15,27 @@ namespace { -bool ConsumeByte(base::StringPiece* data, uint8_t* out) { +bool ConsumeByte(base::span<const uint8_t>* data, uint8_t* out) { if (data->empty()) return false; *out = (*data)[0]; - data->remove_prefix(1); + *data = data->subspan(1); return true; } -bool Consume2Bytes(base::StringPiece* data, uint16_t* out) { +bool Consume2Bytes(base::span<const uint8_t>* data, uint16_t* out) { if (data->size() < 2) return false; - *out = (static_cast<uint8_t>((*data)[0]) << 8) | - static_cast<uint8_t>((*data)[1]); - data->remove_prefix(2); + *out = ((*data)[0] << 8) | (*data)[1]; + *data = data->subspan(2); return true; } -bool Consume3Bytes(base::StringPiece* data, uint32_t* out) { +bool Consume3Bytes(base::span<const uint8_t>* data, uint32_t* out) { if (data->size() < 3) return false; - *out = (static_cast<uint8_t>((*data)[0]) << 16) | - (static_cast<uint8_t>((*data)[1]) << 8) | - static_cast<uint8_t>((*data)[2]); - data->remove_prefix(3); + *out = ((*data)[0] << 16) | ((*data)[1] << 8) | (*data)[2]; + *data = data->subspan(3); return true; } @@ -46,7 +43,8 @@ // static std::unique_ptr<SignedExchangeCertificateChain> -SignedExchangeCertificateChain::Parse(base::StringPiece cert_response_body) { +SignedExchangeCertificateChain::Parse( + base::span<const uint8_t> cert_response_body) { base::Optional<std::vector<base::StringPiece>> der_certs = GetCertChainFromMessage(cert_response_body); if (!der_certs) @@ -62,7 +60,7 @@ // static base::Optional<std::vector<base::StringPiece>> SignedExchangeCertificateChain::GetCertChainFromMessage( - base::StringPiece message) { + base::span<const uint8_t> message) { uint8_t cert_request_context_size = 0; if (!ConsumeByte(&message, &cert_request_context_size)) { DVLOG(1) << "Can't read certificate request request context size."; @@ -79,9 +77,9 @@ return base::nullopt; } - if (cert_list_size != message.length()) { + if (cert_list_size != message.size()) { DVLOG(1) << "Certificate list size error: cert_list_size=" << cert_list_size - << " remaining=" << message.length(); + << " remaining=" << message.size(); return base::nullopt; } @@ -92,25 +90,26 @@ DVLOG(1) << "Can't read certificate data size."; return base::nullopt; } - if (message.length() < cert_data_size) { + if (message.size() < cert_data_size) { DVLOG(1) << "Certificate data size error: cert_data_size=" - << cert_data_size << " remaining=" << message.length(); + << cert_data_size << " remaining=" << message.size(); return base::nullopt; } - certs.emplace_back(message.substr(0, cert_data_size)); - message.remove_prefix(cert_data_size); + certs.emplace_back(base::StringPiece( + reinterpret_cast<const char*>(message.data()), cert_data_size)); + message = message.subspan(cert_data_size); uint16_t extensions_size = 0; if (!Consume2Bytes(&message, &extensions_size)) { DVLOG(1) << "Can't read extensions size."; return base::nullopt; } - if (message.length() < extensions_size) { + if (message.size() < extensions_size) { DVLOG(1) << "Extensions size error: extensions_size=" << extensions_size - << " remaining=" << message.length(); + << " remaining=" << message.size(); return base::nullopt; } - message.remove_prefix(extensions_size); + message = message.subspan(extensions_size); } return certs; }
diff --git a/content/browser/web_package/signed_exchange_certificate_chain.h b/content/browser/web_package/signed_exchange_certificate_chain.h index d98d57e5..05daf2b 100644 --- a/content/browser/web_package/signed_exchange_certificate_chain.h +++ b/content/browser/web_package/signed_exchange_certificate_chain.h
@@ -25,12 +25,12 @@ class CONTENT_EXPORT SignedExchangeCertificateChain { public: static std::unique_ptr<SignedExchangeCertificateChain> Parse( - base::StringPiece cert_response_body); + base::span<const uint8_t> cert_response_body); // Parses a TLS 1.3 Certificate message containing X.509v3 certificates and // returns a vector of cert_data. Returns nullopt when failed to parse. static base::Optional<std::vector<base::StringPiece>> GetCertChainFromMessage( - base::StringPiece message); + base::span<const uint8_t> message); ~SignedExchangeCertificateChain();
diff --git a/content/browser/web_package/signed_exchange_certificate_chain_fuzzer.cc b/content/browser/web_package/signed_exchange_certificate_chain_fuzzer.cc index e2ccc4ba..788b5d9 100644 --- a/content/browser/web_package/signed_exchange_certificate_chain_fuzzer.cc +++ b/content/browser/web_package/signed_exchange_certificate_chain_fuzzer.cc
@@ -9,8 +9,8 @@ namespace content { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - base::StringPiece input(reinterpret_cast<const char*>(data), size); - SignedExchangeCertificateChain::GetCertChainFromMessage(input); + SignedExchangeCertificateChain::GetCertChainFromMessage( + base::make_span(data, size)); return 0; }
diff --git a/content/browser/web_package/signed_exchange_certificate_chain_unittest.cc b/content/browser/web_package/signed_exchange_certificate_chain_unittest.cc index 1dd2681..f5578466 100644 --- a/content/browser/web_package/signed_exchange_certificate_chain_unittest.cc +++ b/content/browser/web_package/signed_exchange_certificate_chain_unittest.cc
@@ -17,7 +17,7 @@ const uint8_t* input, size_t input_size) { return SignedExchangeCertificateChain::GetCertChainFromMessage( - base::StringPiece(reinterpret_cast<const char*>(input), input_size)); + base::make_span(input, input_size)); } } // namespace
diff --git a/content/browser/web_package/signed_exchange_devtools_proxy.cc b/content/browser/web_package/signed_exchange_devtools_proxy.cc index 02c6c70..4d48eb0 100644 --- a/content/browser/web_package/signed_exchange_devtools_proxy.cc +++ b/content/browser/web_package/signed_exchange_devtools_proxy.cc
@@ -5,8 +5,11 @@ #include "content/browser/web_package/signed_exchange_devtools_proxy.h" #include "base/trace_event/trace_event.h" +#include "content/browser/devtools/render_frame_devtools_agent_host.h" #include "content/browser/frame_host/frame_tree_node.h" +#include "content/browser/web_package/signed_exchange_header.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" namespace content { @@ -25,11 +28,33 @@ content::CONSOLE_MESSAGE_LEVEL_ERROR, error_message); } +void OnSignedExchangeReceivedOnUI( + base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + const GURL& outer_request_url, + scoped_refptr<network::ResourceResponse> outer_response, + base::Optional<const base::UnguessableToken> devtools_navigation_token) { + FrameTreeNode* frame_tree_node = + FrameTreeNode::GloballyFindByID(frame_tree_node_id_getter.Run()); + if (!frame_tree_node) + return; + RenderFrameDevToolsAgentHost::OnSignedExchangeReceived( + frame_tree_node, devtools_navigation_token, outer_request_url, + outer_response->head); +} + } // namespace SignedExchangeDevToolsProxy::SignedExchangeDevToolsProxy( - base::RepeatingCallback<int(void)> frame_tree_node_id_getter) - : frame_tree_node_id_getter_(frame_tree_node_id_getter) { + const GURL& outer_request_url, + const network::ResourceResponseHead& outer_response, + base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + base::Optional<const base::UnguessableToken> devtools_navigation_token, + bool report_raw_headers) + : outer_request_url_(outer_request_url), + outer_response_(outer_response), + frame_tree_node_id_getter_(frame_tree_node_id_getter), + devtools_navigation_token_(devtools_navigation_token), + devtools_enabled_(report_raw_headers) { DCHECK_CURRENTLY_ON(BrowserThread::IO); } @@ -46,4 +71,23 @@ std::move(message))); } +void SignedExchangeDevToolsProxy::OnSignedExchangeReceived( + const base::Optional<SignedExchangeHeader>& header) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (!devtools_enabled_) + return; + + // Make a deep copy of ResourceResponseHead before passing it cross-thread. + auto resource_response = base::MakeRefCounted<network::ResourceResponse>(); + resource_response->head = outer_response_; + + // TODO(crbug/830505): Send |header| information to DevTools. + + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce(&OnSignedExchangeReceivedOnUI, frame_tree_node_id_getter_, + outer_request_url_, resource_response->DeepCopy(), + devtools_navigation_token_)); +} + } // namespace content
diff --git a/content/browser/web_package/signed_exchange_devtools_proxy.h b/content/browser/web_package/signed_exchange_devtools_proxy.h index e0ab6903..ae376c7 100644 --- a/content/browser/web_package/signed_exchange_devtools_proxy.h +++ b/content/browser/web_package/signed_exchange_devtools_proxy.h
@@ -9,28 +9,57 @@ #include "base/callback.h" #include "base/macros.h" +#include "base/optional.h" +#include "base/unguessable_token.h" #include "content/common/content_export.h" +#include "services/network/public/cpp/resource_response.h" + +class GURL; + +namespace base { +class UnguessableToken; +} // namespace base + +namespace network { +struct ResourceResponseHead; +} // namespace network namespace content { +class SignedExchangeHeader; // SignedExchangeDevToolsProxy lives on the IO thread and sends messages to // DevTools via the UI thread to show signed exchange related information. -// Currently it is used only to send error messages. class CONTENT_EXPORT SignedExchangeDevToolsProxy { public: // |frame_tree_node_id_getter| callback will be called on the UI thread to get // the frame tree node ID. Note: We are using callback beause when Network // Service is not enabled the ID is not available while handling prefetch - // requests on the IO thread. TODO(crbug/830506): Stop using callback after - // shipping Network Service. - explicit SignedExchangeDevToolsProxy( - base::RepeatingCallback<int(void)> frame_tree_node_id_getter); + // requests on the IO thread. + // When the signed exchange request is a navigation request, + // |devtools_navigation_token| can be used to find the matching request in + // DevTools. But when the signed exchange request is a prefetch request, the + // browser process doesn't know the request id used in DevTools. So DevTools + // looks up the inflight requests using |outer_request_url| to find the + // matching request. + SignedExchangeDevToolsProxy( + const GURL& outer_request_url, + const network::ResourceResponseHead& outer_response, + base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + base::Optional<const base::UnguessableToken> devtools_navigation_token, + bool report_raw_headers); ~SignedExchangeDevToolsProxy(); void ReportErrorMessage(const std::string& message); + void OnSignedExchangeReceived( + const base::Optional<SignedExchangeHeader>& header); + private: + const GURL outer_request_url_; + const network::ResourceResponseHead outer_response_; const base::RepeatingCallback<int(void)> frame_tree_node_id_getter_; + const base::Optional<const base::UnguessableToken> devtools_navigation_token_; + const bool devtools_enabled_; DISALLOW_COPY_AND_ASSIGN(SignedExchangeDevToolsProxy); };
diff --git a/content/browser/web_package/signed_exchange_handler.cc b/content/browser/web_package/signed_exchange_handler.cc index e94e767e7..19655c99 100644 --- a/content/browser/web_package/signed_exchange_handler.cc +++ b/content/browser/web_package/signed_exchange_handler.cc
@@ -256,6 +256,8 @@ void SignedExchangeHandler::RunErrorCallback(net::Error error) { DCHECK_NE(state_, State::kHeadersCallbackCalled); + if (devtools_proxy_) + devtools_proxy_->OnSignedExchangeReceived(header_); std::move(headers_callback_) .Run(error, GURL(), std::string(), network::ResourceResponseHead(), nullptr); @@ -373,6 +375,10 @@ ssl_info.is_fatal_cert_error = net::IsCertStatusError(ssl_info.cert_status) && !net::IsCertStatusMinorError(ssl_info.cert_status); + + if (devtools_proxy_) + devtools_proxy_->OnSignedExchangeReceived(header_); + response_head.ssl_info = std::move(ssl_info); // TODO(https://crbug.com/815025): Verify the Certificate Transparency status. std::move(headers_callback_)
diff --git a/content/browser/web_package/signed_exchange_handler_unittest.cc b/content/browser/web_package/signed_exchange_handler_unittest.cc index 1784e835..e768d98 100644 --- a/content/browser/web_package/signed_exchange_handler_unittest.cc +++ b/content/browser/web_package/signed_exchange_handler_unittest.cc
@@ -64,7 +64,8 @@ SignedExchangeDevToolsProxy* devtools_proxy) override { EXPECT_EQ(cert_url, expected_cert_url_); - auto cert_chain = SignedExchangeCertificateChain::Parse(cert_str_); + auto cert_chain = SignedExchangeCertificateChain::Parse( + base::as_bytes(base::make_span(cert_str_))); EXPECT_TRUE(cert_chain); base::SequencedTaskRunnerHandle::Get()->PostTask(
diff --git a/content/browser/web_package/web_package_loader.cc b/content/browser/web_package/web_package_loader.cc index 03981e3..abd5fed5 100644 --- a/content/browser/web_package/web_package_loader.cc +++ b/content/browser/web_package/web_package_loader.cc
@@ -77,22 +77,23 @@ }; WebPackageLoader::WebPackageLoader( - const network::ResourceResponseHead& original_response, + const network::ResourceResponseHead& outer_response, network::mojom::URLLoaderClientPtr forwarding_client, network::mojom::URLLoaderClientEndpointsPtr endpoints, url::Origin request_initiator, uint32_t url_loader_options, - base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + std::unique_ptr<SignedExchangeDevToolsProxy> devtools_proxy, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, URLLoaderThrottlesGetter url_loader_throttles_getter, scoped_refptr<net::URLRequestContextGetter> request_context_getter) - : original_response_timing_info_( - std::make_unique<ResponseTimingInfo>(original_response)), + : outer_response_timing_info_( + std::make_unique<ResponseTimingInfo>(outer_response)), + outer_response_(outer_response), forwarding_client_(std::move(forwarding_client)), url_loader_client_binding_(this), request_initiator_(request_initiator), url_loader_options_(url_loader_options), - frame_tree_node_id_getter_(std::move(frame_tree_node_id_getter)), + devtools_proxy_(std::move(devtools_proxy)), url_loader_factory_(std::move(url_loader_factory)), url_loader_throttles_getter_(std::move(url_loader_throttles_getter)), request_context_getter_(std::move(request_context_getter)), @@ -101,8 +102,8 @@ // Can't use HttpResponseHeaders::GetMimeType() because SignedExchangeHandler // checks "v=" parameter. - original_response.headers->EnumerateHeader(nullptr, "content-type", - &content_type_); + outer_response.headers->EnumerateHeader(nullptr, "content-type", + &content_type_); url_loader_.Bind(std::move(endpoints->url_loader)); @@ -187,8 +188,7 @@ base::BindOnce(&WebPackageLoader::OnHTTPExchangeFound, weak_factory_.GetWeakPtr()), std::move(cert_fetcher_factory), std::move(request_context_getter_), - std::make_unique<SignedExchangeDevToolsProxy>( - std::move(frame_tree_node_id_getter_))); + std::move(devtools_proxy_)); } void WebPackageLoader::OnComplete( @@ -242,10 +242,10 @@ } // TODO(https://crbug.com/803774): Handle no-GET request_method as a error. - DCHECK(original_response_timing_info_); + DCHECK(outer_response_timing_info_); forwarding_client_->OnReceiveRedirect( CreateRedirectInfo(request_url), - std::move(original_response_timing_info_)->CreateRedirectResponseHead()); + std::move(outer_response_timing_info_)->CreateRedirectResponseHead()); forwarding_client_.reset(); const base::Optional<net::SSLInfo>& ssl_info = resource_response.ssl_info;
diff --git a/content/browser/web_package/web_package_loader.h b/content/browser/web_package/web_package_loader.h index 98a11c62..d80ec01 100644 --- a/content/browser/web_package/web_package_loader.h +++ b/content/browser/web_package/web_package_loader.h
@@ -5,8 +5,9 @@ #ifndef CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ #define CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ -#include "base/callback_forward.h" +#include "base/callback.h" #include "base/optional.h" +#include "base/unguessable_token.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/system/simple_watcher.h" @@ -27,6 +28,7 @@ namespace content { +class SignedExchangeDevToolsProxy; class SignedExchangeHandler; class SignedExchangeHandlerFactory; class URLLoaderThrottle; @@ -44,12 +46,12 @@ std::vector<std::unique_ptr<content::URLLoaderThrottle>>()>; WebPackageLoader( - const network::ResourceResponseHead& original_response, + const network::ResourceResponseHead& outer_response, network::mojom::URLLoaderClientPtr forwarding_client, network::mojom::URLLoaderClientEndpointsPtr endpoints, url::Origin request_initiator, uint32_t url_loader_options, - base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + std::unique_ptr<SignedExchangeDevToolsProxy> devtools_proxy, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, URLLoaderThrottlesGetter url_loader_throttles_getter, scoped_refptr<net::URLRequestContextGetter> request_context_getter); @@ -102,7 +104,10 @@ void FinishReadingBody(int result); // This timing info is used to create a dummy redirect response. - std::unique_ptr<const ResponseTimingInfo> original_response_timing_info_; + std::unique_ptr<const ResponseTimingInfo> outer_response_timing_info_; + + // The outer response of signed HTTP exchange which was received from network. + const network::ResourceResponseHead outer_response_; // This client is alive until OnHTTPExchangeFound() is called. network::mojom::URLLoaderClientPtr forwarding_client_; @@ -127,7 +132,7 @@ url::Origin request_initiator_; const uint32_t url_loader_options_; - base::RepeatingCallback<int(void)> frame_tree_node_id_getter_; + std::unique_ptr<SignedExchangeDevToolsProxy> devtools_proxy_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; URLLoaderThrottlesGetter url_loader_throttles_getter_; scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
diff --git a/content/browser/web_package/web_package_prefetch_handler.cc b/content/browser/web_package/web_package_prefetch_handler.cc index 9cd258f..6c8f207f 100644 --- a/content/browser/web_package/web_package_prefetch_handler.cc +++ b/content/browser/web_package/web_package_prefetch_handler.cc
@@ -5,6 +5,7 @@ #include "content/browser/web_package/web_package_prefetch_handler.h" #include "base/callback.h" +#include "content/browser/web_package/signed_exchange_devtools_proxy.h" #include "content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h" #include "content/browser/web_package/web_package_loader.h" #include "content/browser/web_package/web_package_request_handler.h" @@ -31,11 +32,13 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler( base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + bool report_raw_headers, const network::ResourceResponseHead& response, network::mojom::URLLoaderPtr network_loader, network::mojom::URLLoaderClientRequest network_client_request, scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory, url::Origin request_initiator, + const GURL& outer_request_url, URLLoaderThrottlesGetter loader_throttles_getter, ResourceContext* resource_context, scoped_refptr<net::URLRequestContextGetter> request_context_getter, @@ -58,8 +61,11 @@ web_package_loader_ = std::make_unique<WebPackageLoader>( response, std::move(client), std::move(endpoints), std::move(request_initiator), network::mojom::kURLLoadOptionNone, - frame_tree_node_id_getter, std::move(url_loader_factory), - loader_throttles_getter, request_context_getter); + std::make_unique<SignedExchangeDevToolsProxy>( + outer_request_url, response, std::move(frame_tree_node_id_getter), + base::nullopt /* devtools_navigation_token */, report_raw_headers), + std::move(url_loader_factory), loader_throttles_getter, + request_context_getter); } WebPackagePrefetchHandler::~WebPackagePrefetchHandler() = default;
diff --git a/content/browser/web_package/web_package_prefetch_handler.h b/content/browser/web_package/web_package_prefetch_handler.h index b75106d..4527372 100644 --- a/content/browser/web_package/web_package_prefetch_handler.h +++ b/content/browser/web_package/web_package_prefetch_handler.h
@@ -39,11 +39,13 @@ // creates this handler). WebPackagePrefetchHandler( base::RepeatingCallback<int(void)> frame_tree_node_id_getter, + bool report_raw_headers, const network::ResourceResponseHead& response, network::mojom::URLLoaderPtr network_loader, network::mojom::URLLoaderClientRequest network_client_request, scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory, url::Origin request_initiator, + const GURL& outer_request_url, URLLoaderThrottlesGetter loader_throttles_getter, ResourceContext* resource_context, scoped_refptr<net::URLRequestContextGetter> request_context_getter,
diff --git a/content/browser/web_package/web_package_request_handler.cc b/content/browser/web_package/web_package_request_handler.cc index cbc5153..591dec1ee 100644 --- a/content/browser/web_package/web_package_request_handler.cc +++ b/content/browser/web_package/web_package_request_handler.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/feature_list.h" +#include "content/browser/web_package/signed_exchange_devtools_proxy.h" #include "content/browser/web_package/web_package_loader.h" #include "content/common/throttling_url_loader.h" #include "content/public/common/content_features.h" @@ -29,14 +30,20 @@ WebPackageRequestHandler::WebPackageRequestHandler( url::Origin request_initiator, + const GURL& url, uint32_t url_loader_options, int frame_tree_node_id, + const base::UnguessableToken& devtools_navigation_token, + bool report_raw_headers, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, URLLoaderThrottlesGetter url_loader_throttles_getter, scoped_refptr<net::URLRequestContextGetter> request_context_getter) : request_initiator_(std::move(request_initiator)), + url_(url), url_loader_options_(url_loader_options), frame_tree_node_id_(frame_tree_node_id), + devtools_navigation_token_(devtools_navigation_token), + report_raw_headers_(report_raw_headers), url_loader_factory_(url_loader_factory), url_loader_throttles_getter_(std::move(url_loader_throttles_getter)), request_context_getter_(std::move(request_context_getter)), @@ -84,7 +91,10 @@ web_package_loader_ = std::make_unique<WebPackageLoader>( response, std::move(client), url_loader->Unbind(), std::move(request_initiator_), url_loader_options_, - base::BindRepeating([](int id) { return id; }, frame_tree_node_id_), + std::make_unique<SignedExchangeDevToolsProxy>( + std::move(url_), response, + base::BindRepeating([](int id) { return id; }, frame_tree_node_id_), + std::move(devtools_navigation_token_), report_raw_headers_), std::move(url_loader_factory_), std::move(url_loader_throttles_getter_), std::move(request_context_getter_)); return true;
diff --git a/content/browser/web_package/web_package_request_handler.h b/content/browser/web_package/web_package_request_handler.h index d988475..40f75c63 100644 --- a/content/browser/web_package/web_package_request_handler.h +++ b/content/browser/web_package/web_package_request_handler.h
@@ -6,6 +6,7 @@ #define CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_REQUEST_HANDLER_H_ #include "base/memory/weak_ptr.h" +#include "base/unguessable_token.h" #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/public/common/resource_type.h" #include "url/origin.h" @@ -32,8 +33,11 @@ WebPackageRequestHandler( url::Origin request_initiator, + const GURL& url, uint32_t url_loader_options, int frame_tree_node_id, + const base::UnguessableToken& devtools_navigation_token, + bool report_raw_headers, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, URLLoaderThrottlesGetter url_loader_throttles_getter, scoped_refptr<net::URLRequestContextGetter> request_context_getter); @@ -59,8 +63,11 @@ std::unique_ptr<WebPackageLoader> web_package_loader_; url::Origin request_initiator_; + GURL url_; const uint32_t url_loader_options_; const int frame_tree_node_id_; + base::Optional<const base::UnguessableToken> devtools_navigation_token_; + const bool report_raw_headers_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; URLLoaderThrottlesGetter url_loader_throttles_getter_; scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index fe062d6..0695f478 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn
@@ -41,6 +41,8 @@ "ax_event_notification_details.h", "background_fetch_delegate.cc", "background_fetch_delegate.h", + "background_fetch_description.cc", + "background_fetch_description.h", "background_fetch_response.cc", "background_fetch_response.h", "background_sync_controller.h",
diff --git a/content/public/browser/background_fetch_delegate.h b/content/public/browser/background_fetch_delegate.h index 6830505..e2f47ba 100644 --- a/content/public/browser/background_fetch_delegate.h +++ b/content/public/browser/background_fetch_delegate.h
@@ -16,7 +16,6 @@ #include "content/common/content_export.h" class GURL; -class SkBitmap; namespace gfx { class Size; @@ -27,13 +26,10 @@ struct NetworkTrafficAnnotationTag; } // namespace net -namespace url { -class Origin; -} // namespace url - namespace content { struct BackgroundFetchResponse; struct BackgroundFetchResult; +struct BackgroundFetchDescription; // Interface for launching background fetches. Implementing classes would // generally interface with the DownloadService or DownloadManager. @@ -92,13 +88,7 @@ // contain the GUIDs of in progress downloads, while completed downloads are // recorded in |completed_parts|. virtual void CreateDownloadJob( - const std::string& job_unique_id, - const std::string& title, - const url::Origin& origin, - const SkBitmap& icon, - int completed_parts, - int total_parts, - const std::vector<std::string>& current_guids) = 0; + std::unique_ptr<BackgroundFetchDescription> fetch_description) = 0; // Creates a new download identified by |download_guid| in the download job // identified by |job_unique_id|.
diff --git a/content/public/browser/background_fetch_description.cc b/content/public/browser/background_fetch_description.cc new file mode 100644 index 0000000..7857bfd2 --- /dev/null +++ b/content/public/browser/background_fetch_description.cc
@@ -0,0 +1,31 @@ +// 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 "content/public/browser/background_fetch_description.h" + +namespace content { + +BackgroundFetchDescription::BackgroundFetchDescription( + std::string job_unique_id, + std::string title, + url::Origin origin, + SkBitmap icon, + int completed_parts, + int total_parts, + int completed_parts_size, + int total_parts_size, + std::vector<std::string> current_guids) + : job_unique_id(job_unique_id), + title(title), + origin(origin), + icon(icon), + completed_parts(completed_parts), + total_parts(total_parts), + completed_parts_size(completed_parts_size), + total_parts_size(total_parts_size), + current_guids(std::move(current_guids)) {} + +BackgroundFetchDescription::~BackgroundFetchDescription() = default; + +} // namespace content
diff --git a/content/public/browser/background_fetch_description.h b/content/public/browser/background_fetch_description.h new file mode 100644 index 0000000..40d56f0 --- /dev/null +++ b/content/public/browser/background_fetch_description.h
@@ -0,0 +1,45 @@ +// 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 CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_DESCRIPTION_H_ +#define CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_DESCRIPTION_H_ + +#include <vector> +#include "content/common/content_export.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "url/origin.h" + +namespace content { + +// Contains all information necessary to create +// a BackgroundFetch download (and in the future, upload) job. +struct CONTENT_EXPORT BackgroundFetchDescription { + BackgroundFetchDescription(std::string job_unique_id, + std::string title, + url::Origin origin, + SkBitmap icon, + int completed_parts, + int total_parts, + int completed_parts_size, + int total_parts_size, + std::vector<std::string> current_guids); + ~BackgroundFetchDescription(); + + const std::string job_unique_id; + std::string title; + const url::Origin origin; + SkBitmap icon; + int completed_parts; + int total_parts; + int completed_parts_size; + int total_parts_size; + std::vector<std::string> current_guids; + + private: + DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDescription); +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_DESCRIPTION_H
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index b9cef096..1cb6291 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -167,7 +167,7 @@ } bool ContentBrowserClient::ShouldIsolateErrorPage(bool in_main_frame) { - return in_main_frame; + return false; } std::unique_ptr<media::AudioManager> ContentBrowserClient::CreateAudioManager(
diff --git a/content/public/browser/site_isolation_policy.cc b/content/public/browser/site_isolation_policy.cc index 0a75907..f6736b3 100644 --- a/content/public/browser/site_isolation_policy.cc +++ b/content/public/browser/site_isolation_policy.cc
@@ -100,7 +100,11 @@ } // static +bool SiteIsolationPolicy::IsErrorPageIsolationEnabled(bool in_main_frame) { + return GetContentClient()->browser()->ShouldIsolateErrorPage(in_main_frame); +} +// static bool SiteIsolationPolicy::ShouldPdfCompositorBeEnabledForOopifs() { // TODO(weili): We only create pdf compositor client and use pdf compositor // service when site-per-process or isolate-origins flag/feature is enabled,
diff --git a/content/public/browser/site_isolation_policy.h b/content/public/browser/site_isolation_policy.h index 06e13c0..e0edfc6 100644 --- a/content/public/browser/site_isolation_policy.h +++ b/content/public/browser/site_isolation_policy.h
@@ -43,6 +43,9 @@ // Returns true if isolated origins feature is enabled. static bool AreIsolatedOriginsEnabled(); + // Returns true if error page isolation is enabled. + static bool IsErrorPageIsolationEnabled(bool in_main_frame); + // Returns true if the PDF compositor should be enabled to allow out-of- // process iframes (OOPIF's) to print properly. static bool ShouldPdfCompositorBeEnabledForOopifs();
diff --git a/content/public/test/test_download_http_response.cc b/content/public/test/test_download_http_response.cc index 1cd615a..9e4347f 100644 --- a/content/public/test/test_download_http_response.cc +++ b/content/public/test/test_download_http_response.cc
@@ -121,6 +121,7 @@ size(102400), pattern_generator_seed(1), support_byte_ranges(true), + support_partial_response(true), connection_type( net::HttpResponseInfo::ConnectionInfo::CONNECTION_INFO_UNKNOWN) {} @@ -136,6 +137,7 @@ size(that.size), pattern_generator_seed(that.pattern_generator_seed), support_byte_ranges(that.support_byte_ranges), + support_partial_response(that.support_partial_response), connection_type(that.connection_type), static_response(std::move(that.static_response)), injected_errors(std::move(that.injected_errors)), @@ -146,11 +148,12 @@ TestDownloadHttpResponse::Parameters& TestDownloadHttpResponse::Parameters:: operator=(Parameters&& that) { etag = std::move(that.etag); - last_modified = std::move(that.etag); + last_modified = std::move(that.last_modified); content_type = std::move(that.content_type); size = that.size; pattern_generator_seed = that.pattern_generator_seed; support_byte_ranges = that.support_byte_ranges; + support_partial_response = that.support_partial_response; static_response = std::move(that.static_response); injected_errors = std::move(that.injected_errors); inject_error_cb = that.inject_error_cb; @@ -297,7 +300,8 @@ // Adjust the response range according to request range. The first byte offset // of the request may be larger than entity body size. request_range_ = ranges[0]; - range_.set_first_byte_position(request_range_.first_byte_position()); + if (parameters_.support_partial_response) + range_.set_first_byte_position(request_range_.first_byte_position()); range_.ComputeBounds(parameters_.size); response_sent_offset_ = range_.first_byte_position(); @@ -325,7 +329,7 @@ std::string TestDownloadHttpResponse::GetDefaultResponseHeaders() { std::string headers; // Send partial response. - if (parameters_.support_byte_ranges && + if (parameters_.support_partial_response && parameters_.support_byte_ranges && request_.headers.find(net::HttpRequestHeaders::kIfRange) != request_.headers.end() && request_.headers.at(net::HttpRequestHeaders::kIfRange) == @@ -335,7 +339,7 @@ } // Send precondition failed for "If-Match" request header. - if (parameters_.support_byte_ranges && + if (parameters_.support_partial_response && parameters_.support_byte_ranges && request_.headers.find(net::HttpRequestHeaders::kIfMatch) != request_.headers.end()) { if (request_.headers.at(net::HttpRequestHeaders::kIfMatch) !=
diff --git a/content/public/test/test_download_http_response.h b/content/public/test/test_download_http_response.h index 6fb801d8..0ab178d 100644 --- a/content/public/test/test_download_http_response.h +++ b/content/public/test/test_download_http_response.h
@@ -108,6 +108,12 @@ // response, or contains 'Content-Range' header for HTTP 206 response. bool support_byte_ranges; + // Whether the server supports partial range responses. A server can claim + // it support byte ranges, but actually doesn't send partial responses. In + // that case, Set |support_byte_ranges| to true and this variable to false + // to simulate the case. + bool support_partial_response; + // The connection type in the response. net::HttpResponseInfo::ConnectionInfo connection_type;
diff --git a/content/public/test/url_loader_interceptor.cc b/content/public/test/url_loader_interceptor.cc index eeda084..95f2d6d 100644 --- a/content/public/test/url_loader_interceptor.cc +++ b/content/public/test/url_loader_interceptor.cc
@@ -6,7 +6,7 @@ #include "base/test/bind_test_util.h" #include "content/browser/frame_host/render_frame_host_impl.h" -#include "content/browser/loader/navigation_url_loader_network_service.h" +#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/resource_message_filter.h" #include "content/browser/loader/url_loader_factory_impl.h" #include "content/browser/storage_partition_impl.h" @@ -367,7 +367,7 @@ base::BindRepeating(&URLLoaderInterceptor::GetNetworkFactoryCallback, base::Unretained(this))); } else { - NavigationURLLoaderNetworkService::SetBeginNavigationInterceptorForTesting( + NavigationURLLoaderImpl::SetBeginNavigationInterceptorForTesting( base::BindRepeating(&URLLoaderInterceptor::BeginNavigationCallback, base::Unretained(this))); } @@ -398,8 +398,8 @@ URLLoaderFactoryGetter::SetGetNetworkFactoryCallbackForTesting( URLLoaderFactoryGetter::GetNetworkFactoryCallback()); } else { - NavigationURLLoaderNetworkService::SetBeginNavigationInterceptorForTesting( - NavigationURLLoaderNetworkService::BeginNavigationInterceptor()); + NavigationURLLoaderImpl::SetBeginNavigationInterceptorForTesting( + NavigationURLLoaderImpl::BeginNavigationInterceptor()); } if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
diff --git a/content/public/test/url_loader_interceptor.h b/content/public/test/url_loader_interceptor.h index 5321f22..46a3730 100644 --- a/content/public/test/url_loader_interceptor.h +++ b/content/public/test/url_loader_interceptor.h
@@ -102,9 +102,9 @@ void GetNetworkFactoryCallback( URLLoaderFactoryGetter* url_loader_factory_getter); - // Callback on IO thread whenever a NavigationURLLoaderNetworkService - // is loading a frame request through ResourceDispatcherHost (i.e. when the - // network service is disabled). + // Callback on IO thread whenever a NavigationURLLoaderImpl is loading a frame + // request through ResourceDispatcherHost (i.e. when the network service is + // disabled). bool BeginNavigationCallback( network::mojom::URLLoaderRequest* request, int32_t routing_id,
diff --git a/content/renderer/image_downloader/image_downloader_base.cc b/content/renderer/image_downloader/image_downloader_base.cc index 19dda4f..cd2b138 100644 --- a/content/renderer/image_downloader/image_downloader_base.cc +++ b/content/renderer/image_downloader/image_downloader_base.cc
@@ -111,7 +111,7 @@ iter->release(); image_fetchers_.erase(iter); render_frame() - ->GetTaskRunner(blink::TaskType::kUnthrottled) + ->GetTaskRunner(blink::TaskType::kInternalLoading) ->DeleteSoon(FROM_HERE, fetcher); break; }
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 4a33896c..3e3fc181 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1337,7 +1337,7 @@ "../browser/loader/mock_resource_loader.cc", "../browser/loader/mock_resource_loader.h", "../browser/loader/mojo_async_resource_handler_unittest.cc", - "../browser/loader/navigation_url_loader_network_service_unittest.cc", + "../browser/loader/navigation_url_loader_impl_unittest.cc", "../browser/loader/navigation_url_loader_unittest.cc", "../browser/loader/redirect_to_file_resource_handler_unittest.cc", "../browser/loader/resource_buffer_unittest.cc", @@ -1399,6 +1399,7 @@ "../browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc", "../browser/renderer_host/frame_token_message_queue_unittest.cc", "../browser/renderer_host/input/fling_controller_unittest.cc", + "../browser/renderer_host/input/fling_scheduler_unittest.cc", "../browser/renderer_host/input/gesture_event_queue_unittest.cc", "../browser/renderer_host/input/input_router_impl_unittest.cc", "../browser/renderer_host/input/mock_input_disposition_handler.cc", @@ -1769,6 +1770,7 @@ "//gpu/ipc/host", "//gpu/ipc/service", "//ipc:test_support", + "//jingle:jingle_glue", "//media:test_support", "//media/blink", "//media/capture",
diff --git a/content/test/gpu/generate_buildbot_json.py b/content/test/gpu/generate_buildbot_json.py index b42fd2c..e35e9031 100755 --- a/content/test/gpu/generate_buildbot_json.py +++ b/content/test/gpu/generate_buildbot_json.py
@@ -37,8 +37,7 @@ # Intel HD 630 (both Windows and Linux). INTEL_HD_630 = '8086:5912' WIN10_INTEL_HD_630_STABLE_DRIVER = '8086:5912-23.20.16.4877' -# TODO(zmo): Add the following bot. -# WIN10_INTEL_HD_630_EXPERIMENTAL_DRIVER = '8086:5912-24.20.100.6025' +WIN10_INTEL_HD_630_EXPERIMENTAL_DRIVER = '8086:5912-24.20.100.6025' # "Types" of waterfalls and bots. A bot's type is the union of its own # type and the type of its waterfall. Predicates can apply to these @@ -393,6 +392,18 @@ 'os_type': 'win', 'type': Types.DEQP, }, + 'Win10 FYI Exp Release (Intel HD 630)': { + 'swarming_dimensions': [ + { + 'gpu': WIN10_INTEL_HD_630_EXPERIMENTAL_DRIVER, + 'os': 'Windows-10', + 'pool': 'Chrome-GPU', + }, + ], + 'build_config': 'Release', + 'swarming': True, + 'os_type': 'win', + }, 'Win10 FYI Release (Intel HD 630)': { 'swarming_dimensions': [ { @@ -1818,6 +1829,7 @@ { 'names': [ 'Win10 FYI Release (Intel HD 630)', + 'Win10 FYI Exp Release (Intel HD 630)', ], }, ],
diff --git a/extensions/browser/browsertest_util.cc b/extensions/browser/browsertest_util.cc index 0b24b68..634d380 100644 --- a/extensions/browser/browsertest_util.cc +++ b/extensions/browser/browsertest_util.cc
@@ -12,9 +12,11 @@ namespace extensions { namespace browsertest_util { -std::string ExecuteScriptInBackgroundPage(content::BrowserContext* context, - const std::string& extension_id, - const std::string& script) { +std::string ExecuteScriptInBackgroundPage( + content::BrowserContext* context, + const std::string& extension_id, + const std::string& script, + ScriptUserActivation script_user_activation) { ExtensionHost* host = ProcessManager::Get(context)->GetBackgroundHostForExtension(extension_id); if (!host) { @@ -23,8 +25,17 @@ } std::string result; - if (!content::ExecuteScriptAndExtractString(host->host_contents(), script, - &result)) { + bool success; + if (script_user_activation == ScriptUserActivation::kActivate) { + success = content::ExecuteScriptAndExtractString(host->host_contents(), + script, &result); + } else { + DCHECK_EQ(script_user_activation, ScriptUserActivation::kDontActivate); + success = content::ExecuteScriptWithoutUserGestureAndExtractString( + host->host_contents(), script, &result); + } + + if (!success) { ADD_FAILURE() << "Executing script failed: " << script; result.clear(); }
diff --git a/extensions/browser/browsertest_util.h b/extensions/browser/browsertest_util.h index e2798c0..9774259 100644 --- a/extensions/browser/browsertest_util.h +++ b/extensions/browser/browsertest_util.h
@@ -14,13 +14,25 @@ namespace extensions { namespace browsertest_util { +// Determine if a user activation notification should be triggered before +// executing a script +enum class ScriptUserActivation { + kActivate, + kDontActivate, +}; + // Waits until |script| calls "window.domAutomationController.send(result)", // where |result| is a string, and returns |result|. Fails the test and returns // an empty string if |extension_id| isn't installed in |context| or doesn't -// have a background page, or if executing the script fails. -std::string ExecuteScriptInBackgroundPage(content::BrowserContext* context, - const std::string& extension_id, - const std::string& script); +// have a background page, or if executing the script fails. The argument +// |script_user_activation| determines if the script should be executed after a +// user activation. +std::string ExecuteScriptInBackgroundPage( + content::BrowserContext* context, + const std::string& extension_id, + const std::string& script, + ScriptUserActivation script_user_activation = + ScriptUserActivation::kActivate); // Same as ExecuteScriptInBackgroundPage, but doesn't wait for the script // to return a result. Fails the test and returns false if |extension_id|
diff --git a/extensions/common/api/test.json b/extensions/common/api/test.json index db758f9..4539fc1 100644 --- a/extensions/common/api/test.json +++ b/extensions/common/api/test.json
@@ -353,18 +353,6 @@ ] }, { - "name": "runWithoutUserGesture", - "type": "function", - "nocompile": true, - "parameters": [ - { - "type": "function", - "name": "callback", - "parameters": [] - } - ] - }, - { "name": "waitForRoundTrip", "type": "function", "description": "Sends a string message one round trip from the renderer to the browser process and back.",
diff --git a/extensions/renderer/resources/test_custom_bindings.js b/extensions/renderer/resources/test_custom_bindings.js index 4d9ed64..bd98cc26 100644 --- a/extensions/renderer/resources/test_custom_bindings.js +++ b/extensions/renderer/resources/test_custom_bindings.js
@@ -375,11 +375,6 @@ return userGestures.RunWithUserGesture(callback); }); - apiFunctions.setHandleRequest('runWithoutUserGesture', function(callback) { - chromeTest.assertEq(typeof(callback), 'function'); - return userGestures.RunWithoutUserGesture(callback); - }); - apiFunctions.setHandleRequest('setExceptionHandler', function(callback) { chromeTest.assertEq(typeof(callback), 'function'); setExceptionHandler(callback);
diff --git a/extensions/renderer/user_gestures_native_handler.cc b/extensions/renderer/user_gestures_native_handler.cc index 73b3d43e..79e111b7 100644 --- a/extensions/renderer/user_gestures_native_handler.cc +++ b/extensions/renderer/user_gestures_native_handler.cc
@@ -23,10 +23,6 @@ "RunWithUserGesture", "test", base::Bind(&UserGesturesNativeHandler::RunWithUserGesture, base::Unretained(this))); - RouteHandlerFunction( - "RunWithoutUserGesture", "test", - base::Bind(&UserGesturesNativeHandler::RunWithoutUserGesture, - base::Unretained(this))); } void UserGesturesNativeHandler::IsProcessingUserGesture( @@ -46,14 +42,4 @@ nullptr); } -void UserGesturesNativeHandler::RunWithoutUserGesture( - const v8::FunctionCallbackInfo<v8::Value>& args) { - blink::WebUserGestureIndicator::ConsumeUserGesture(context()->web_frame()); - CHECK_EQ(args.Length(), 1); - CHECK(args[0]->IsFunction()); - v8::Local<v8::Value> no_args; - context()->SafeCallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, - nullptr); -} - } // namespace extensions
diff --git a/extensions/renderer/user_gestures_native_handler.h b/extensions/renderer/user_gestures_native_handler.h index 2073add..2d04b794 100644 --- a/extensions/renderer/user_gestures_native_handler.h +++ b/extensions/renderer/user_gestures_native_handler.h
@@ -19,7 +19,6 @@ private: void IsProcessingUserGesture(const v8::FunctionCallbackInfo<v8::Value>& args); void RunWithUserGesture(const v8::FunctionCallbackInfo<v8::Value>& args); - void RunWithoutUserGesture(const v8::FunctionCallbackInfo<v8::Value>& args); }; } // namespace extensions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index a10c7d2..dca71dc 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -5042,6 +5042,11 @@ DCHECK(!have_context || context_->IsCurrent(nullptr)); + // Prepare to destroy the surface while the context is still current, because + // some surface destructors make GL calls. + if (surface_) + surface_->PrepareToDestroy(have_context); + ReleaseAllBackTextures(have_context); if (have_context) { if (apply_framebuffer_attachment_cmaa_intel_.get()) { @@ -5232,14 +5237,11 @@ group_ = nullptr; } - // Destroy the surface before the context, some surface destructors make GL - // calls. - surface_ = nullptr; - if (context_.get()) { context_->ReleaseCurrent(nullptr); context_ = nullptr; } + surface_ = nullptr; } void GLES2DecoderImpl::SetSurface(const scoped_refptr<gl::GLSurface>& surface) {
diff --git a/gpu/ipc/in_process_command_buffer.cc b/gpu/ipc/in_process_command_buffer.cc index d831605..8a1e7f3 100644 --- a/gpu/ipc/in_process_command_buffer.cc +++ b/gpu/ipc/in_process_command_buffer.cc
@@ -560,16 +560,17 @@ gpu_thread_weak_ptr_factory_.InvalidateWeakPtrs(); // Clean up GL resources if possible. bool have_context = context_.get() && context_->MakeCurrent(surface_.get()); + + // Prepare to destroy the surface while the context is still current, because + // some surface destructors make GL calls. + if (surface_) + surface_->PrepareToDestroy(have_context); + if (decoder_) { decoder_->Destroy(have_context); decoder_.reset(); } command_buffer_.reset(); - - // Destroy the surface with the context current, some surface destructors make - // GL calls. - if (context_) - context_->MakeCurrent(surface_.get()); surface_ = nullptr; context_ = nullptr;
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h index 6ce36ee..472acb6 100644 --- a/gpu/ipc/service/image_transport_surface_overlay_mac.h +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h
@@ -37,6 +37,7 @@ // GLSurface implementation bool Initialize(gl::GLSurfaceFormat format) override; void Destroy() override; + void PrepareToDestroy(bool have_context) override; bool Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space,
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm index 0fd57b2..0ce5e61 100644 --- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -82,15 +82,26 @@ return true; } +void ImageTransportSurfaceOverlayMac::PrepareToDestroy(bool have_context) { + if (!previous_frame_fence_) + return; + if (!have_context) { + // If we have no context, leak the GL objects, since we have no way to + // delete them. + DLOG(ERROR) << "Leaking GL fences."; + previous_frame_fence_.release(); + return; + } + // Ensure we are using the context with which the fence was created. + DCHECK_EQ(fence_context_obj_, CGLGetCurrentContext()); + CheckGLErrors("Before destroy fence"); + previous_frame_fence_.reset(); + CheckGLErrors("After destroy fence"); +} + void ImageTransportSurfaceOverlayMac::Destroy() { ca_layer_tree_coordinator_.reset(); - if (previous_frame_fence_) { - // Ensure we are using the context with which the fence was created. - gl::ScopedCGLSetCurrentContext scoped_set_current(fence_context_obj_); - CheckGLErrors("Before destroy fence"); - previous_frame_fence_.reset(); - CheckGLErrors("After destroy fence"); - } + DCHECK(!previous_frame_fence_); } bool ImageTransportSurfaceOverlayMac::IsOffscreen() {
diff --git a/infra/config/branch/cq.cfg b/infra/config/branch/cq.cfg index f052ca9..9fd4c98 100644 --- a/infra/config/branch/cq.cfg +++ b/infra/config/branch/cq.cfg
@@ -43,16 +43,8 @@ builders { name: "linux_chromium_rel_ng" } builders { name: "linux_chromium_tsan_rel_ng" } builders { name: "mac_chromium_compile_dbg_ng" } - builders { - name: "mac_chromium_compile_dbg_ng_patch_on_gclient" - experiment_percentage: 5 - } builders { name: "mac_chromium_rel_ng" } builders { name: "win_chromium_compile_dbg_ng" } - builders { - name: "win_chromium_compile_dbg_ng_patch_on_gclient" - experiment_percentage: 5 - } } buckets { name: "master.tryserver.chromium.android"
diff --git a/infra/config/global/cr-buildbucket.cfg b/infra/config/global/cr-buildbucket.cfg index 6f9af9e..aa92f27 100644 --- a/infra/config/global/cr-buildbucket.cfg +++ b/infra/config/global/cr-buildbucket.cfg
@@ -106,6 +106,7 @@ name: "android-try" recipe { properties: "mastername:tryserver.chromium.android" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } builder_mixins { @@ -150,6 +151,7 @@ service_account: "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" recipe { properties: "mastername:tryserver.chromium.angle" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -170,6 +172,7 @@ mixins: "linux" recipe { properties: "mastername:tryserver.chromium.chromiumos" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -210,6 +213,7 @@ mixins: "gpu-optional-try" recipe { properties: "mastername:tryserver.chromium.linux" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -271,6 +275,7 @@ mixins: "gpu-optional-try" recipe { properties: "mastername:tryserver.chromium.mac" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -279,6 +284,7 @@ mixins: "mac" recipe { properties: "mastername:tryserver.chromium.mac" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -360,6 +366,7 @@ mixins: "gpu-optional-try" recipe { properties: "mastername:tryserver.chromium.win" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -368,6 +375,7 @@ mixins: "win" recipe { properties: "mastername:tryserver.chromium.win" + properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" } } @@ -1144,6 +1152,10 @@ mixins: "win-gpu-fyi-ci" } builders { + name: "Win10 FYI Exp Release (Intel HD 630)" + mixins: "win-gpu-fyi-ci" + } + builders { name: "Win10 FYI Release (NVIDIA)" mixins: "win-gpu-fyi-ci" } @@ -1446,18 +1458,6 @@ builders { mixins: "mac-try" name: "mac_chromium_asan_rel_ng" } builders { mixins: "mac-try" name: "mac_chromium_asan_variable" } builders { mixins: "mac-try" name: "mac_chromium_compile_dbg_ng" dimensions:"os:Mac-10.13.3"} - builders { - mixins: "mac-try" - name: "mac_chromium_compile_dbg_ng_patch_on_gclient" - dimensions: "builder:mac_chromium_compile_dbg_ng" - dimensions: "os:Mac-10.13.3" - experimental: YES - auto_builder_dimension: NO - recipe { - properties: "buildername:mac_chromium_compile_dbg_ng" - properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" - } - } builders { mixins: "mac-try" name: "mac_chromium_compile_rel_ng" } builders { mixins: "mac-try" name: "mac_chromium_dbg_ng" dimensions:"os:Mac-10.12"} builders { mixins: "mac-try" name: "mac_chromium_gn_upload" } @@ -1501,17 +1501,6 @@ builders { mixins: "win-try" name: "win_archive" } builders { mixins: "win-try" name: "win_chrome_official" } builders { mixins: "win-try" name: "win_chromium_compile_dbg_ng" } - builders { - mixins: "win-try" - name: "win_chromium_compile_dbg_ng_patch_on_gclient" - dimensions: "builder:win_chromium_compile_dbg_ng" - experimental: YES - auto_builder_dimension: NO - recipe { - properties: "buildername:win_chromium_compile_dbg_ng" - properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" - } - } builders { mixins: "win-try" name: "win_chromium_compile_rel_ng" } # TODO(crbug/794085): Revisit exceptional extra-long timeout when we speed # up the builder.
diff --git a/infra/config/global/luci-milo-dev.cfg b/infra/config/global/luci-milo-dev.cfg index 2e14f91d..8497032 100644 --- a/infra/config/global/luci-milo-dev.cfg +++ b/infra/config/global/luci-milo-dev.cfg
@@ -3017,52 +3017,52 @@ builders: { name: "buildbot/chromium.webrtc/Linux Builder" - category: "linux|release" + category: "linux" short_name: "bld" } builders: { name: "buildbot/chromium.webrtc/Linux Tester" - category: "linux|release" + category: "linux" short_name: "tst" } builders: { name: "buildbot/chromium.webrtc/Mac Builder" - category: "mac|release" + category: "mac" short_name: "bld" } builders: { name: "buildbot/chromium.webrtc/Mac Tester" - category: "mac|release" + category: "mac" short_name: "tst" } builders: { name: "buildbot/chromium.webrtc/Mac Tester (long-running)" - category: "mac|release" - short_name: "long" + category: "mac" + short_name: "lng" } builders: { name: "buildbot/chromium.webrtc/Win Builder" - category: "win|release" + category: "win" short_name: "bld" } builders: { name: "buildbot/chromium.webrtc/Win10 Tester" - category: "win|release" + category: "win" short_name: "10" } builders: { name: "buildbot/chromium.webrtc/Win7 Tester" - category: "win|release" + category: "win" short_name: "7" } builders: { name: "buildbot/chromium.webrtc/Win7 Tester (long-running)" - category: "win|release" + category: "win" short_name: "lng" } builders: { name: "buildbot/chromium.webrtc/Win8 Tester" - category: "win|release" + category: "win" short_name: "8" } } @@ -3076,11 +3076,6 @@ header_id: "chromium" builders: { - name: "buildbot/chromium.webrtc.fyi/Android Builder" - category: "android|release" - short_name: "32" - } - builders: { name: "buildbot/chromium.webrtc.fyi/Android Builder (dbg)" category: "android|debug|builder" short_name: "32" @@ -3101,6 +3096,11 @@ short_name: "M" } builders: { + name: "buildbot/chromium.webrtc.fyi/Android Builder" + category: "android|release" + short_name: "32" + } + builders: { name: "buildbot/chromium.webrtc.fyi/Linux Builder (dbg)" category: "linux|debug" short_name: "bld" @@ -3116,13 +3116,13 @@ short_name: "tst" } builders: { - name: "buildbot/chromium.webrtc.fyi/Mac Builder" - category: "mac|release" + name: "buildbot/chromium.webrtc.fyi/Mac Builder (dbg)" + category: "mac|debug" short_name: "bld" } builders: { - name: "buildbot/chromium.webrtc.fyi/Mac Builder (dbg)" - category: "mac|debug" + name: "buildbot/chromium.webrtc.fyi/Mac Builder" + category: "mac|release" short_name: "bld" } builders: {
diff --git a/infra/config/global/luci-milo.cfg b/infra/config/global/luci-milo.cfg index dcef344..d261c1b 100644 --- a/infra/config/global/luci-milo.cfg +++ b/infra/config/global/luci-milo.cfg
@@ -2723,18 +2723,23 @@ } builders: { name: "buildbucket/luci.chromium.ci/Win10 FYI Debug (NVIDIA)" - category: "Windows|10" - short_name: "nvi" + category: "Windows|10|Nvidia" + short_name: "dbg" } builders: { name: "buildbucket/luci.chromium.ci/Win10 FYI Release (Intel HD 630)" - category: "Windows|10|Release" - short_name: "int" + category: "Windows|10|Intel" + short_name: "rel" + } + builders: { + name: "buildbucket/luci.chromium.ci/Win10 FYI Exp Release (Intel HD 630)" + category: "Windows|10|Intel" + short_name: "exp" } builders: { name: "buildbucket/luci.chromium.ci/Win10 FYI Release (NVIDIA)" - category: "Windows|10|Release" - short_name: "nvi" + category: "Windows|10|Nvidia" + short_name: "rel" } builders: { name: "buildbucket/luci.chromium.ci/Win7 FYI Debug (AMD)" @@ -3331,52 +3336,52 @@ builders: { name: "buildbot/chromium.webrtc/Linux Builder" - category: "linux|release" + category: "linux" short_name: "bld" } builders: { name: "buildbot/chromium.webrtc/Linux Tester" - category: "linux|release" + category: "linux" short_name: "tst" } builders: { name: "buildbot/chromium.webrtc/Mac Builder" - category: "mac|release" + category: "mac" short_name: "bld" } builders: { name: "buildbot/chromium.webrtc/Mac Tester" - category: "mac|release" + category: "mac" short_name: "tst" } builders: { name: "buildbot/chromium.webrtc/Mac Tester (long-running)" - category: "mac|release" - short_name: "long" + category: "mac" + short_name: "lng" } builders: { name: "buildbot/chromium.webrtc/Win Builder" - category: "win|release" + category: "win" short_name: "bld" } builders: { name: "buildbot/chromium.webrtc/Win10 Tester" - category: "win|release" + category: "win" short_name: "10" } builders: { name: "buildbot/chromium.webrtc/Win7 Tester" - category: "win|release" + category: "win" short_name: "7" } builders: { name: "buildbot/chromium.webrtc/Win7 Tester (long-running)" - category: "win|release" + category: "win" short_name: "lng" } builders: { name: "buildbot/chromium.webrtc/Win8 Tester" - category: "win|release" + category: "win" short_name: "8" } } @@ -3390,11 +3395,6 @@ header_id: "chromium" builders: { - name: "buildbot/chromium.webrtc.fyi/Android Builder" - category: "android|release" - short_name: "32" - } - builders: { name: "buildbot/chromium.webrtc.fyi/Android Builder (dbg)" category: "android|debug|builder" short_name: "32" @@ -3415,6 +3415,11 @@ short_name: "M" } builders: { + name: "buildbot/chromium.webrtc.fyi/Android Builder" + category: "android|release" + short_name: "32" + } + builders: { name: "buildbot/chromium.webrtc.fyi/Linux Builder (dbg)" category: "linux|debug" short_name: "bld" @@ -3430,13 +3435,13 @@ short_name: "tst" } builders: { - name: "buildbot/chromium.webrtc.fyi/Mac Builder" - category: "mac|release" + name: "buildbot/chromium.webrtc.fyi/Mac Builder (dbg)" + category: "mac|debug" short_name: "bld" } builders: { - name: "buildbot/chromium.webrtc.fyi/Mac Builder (dbg)" - category: "mac|debug" + name: "buildbot/chromium.webrtc.fyi/Mac Builder" + category: "mac|release" short_name: "bld" } builders: {
diff --git a/infra/config/global/luci-scheduler.cfg b/infra/config/global/luci-scheduler.cfg index 20f11b2..720e626 100644 --- a/infra/config/global/luci-scheduler.cfg +++ b/infra/config/global/luci-scheduler.cfg
@@ -1406,6 +1406,17 @@ } job { + id: "Win10 FYI Exp Release (Intel HD 630)" + # Triggered by "GPU FYI Win Builder" + acl_sets: "triggered-by-parent-builders" + buildbucket: { + server: "cr-buildbucket.appspot.com" + bucket: "luci.chromium.ci" + builder: "Win10 FYI Exp Release (Intel HD 630)" + } +} + +job { id: "Win10 FYI Exp Release (NVIDIA)" # Triggered by "GPU FYI Win Builder" acl_sets: "triggered-by-parent-builders"
diff --git a/ios/chrome/browser/infobars/BUILD.gn b/ios/chrome/browser/infobars/BUILD.gn index dccece93a..8a5e240 100644 --- a/ios/chrome/browser/infobars/BUILD.gn +++ b/ios/chrome/browser/infobars/BUILD.gn
@@ -17,8 +17,10 @@ "infobar_container_state_delegate.h", "infobar_container_view.h", "infobar_container_view.mm", + "infobar_controller+protected.h", "infobar_controller.h", "infobar_controller.mm", + "infobar_controller_delegate.h", "infobar_manager_impl.h", "infobar_manager_impl.mm", "infobar_utils.h",
diff --git a/ios/chrome/browser/infobars/confirm_infobar_controller+protected.h b/ios/chrome/browser/infobars/confirm_infobar_controller+protected.h index aca4957..7d9fff96 100644 --- a/ios/chrome/browser/infobars/confirm_infobar_controller+protected.h +++ b/ios/chrome/browser/infobars/confirm_infobar_controller+protected.h
@@ -7,13 +7,20 @@ #import "ios/chrome/browser/infobars/confirm_infobar_controller.h" +@class ConfirmInfoBarView; + @interface ConfirmInfoBarController () + +// Accesses the view. +- (ConfirmInfoBarView*)view; + // Action for any of the user defined buttons. - (void)infoBarButtonDidPress:(id)sender; // Action for any of the user defined links. - (void)infobarLinkDidPress:(NSUInteger)tag; // Updates the label on the provided view. -- (void)updateInfobarLabel:(InfoBarView*)view; +- (void)updateInfobarLabel:(ConfirmInfoBarView*)view; + @end #endif // IOS_CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_CONTROLLER_PROTECTED_H_
diff --git a/ios/chrome/browser/infobars/confirm_infobar_controller.h b/ios/chrome/browser/infobars/confirm_infobar_controller.h index 927d2fa..410a4c720 100644 --- a/ios/chrome/browser/infobars/confirm_infobar_controller.h +++ b/ios/chrome/browser/infobars/confirm_infobar_controller.h
@@ -7,8 +7,14 @@ #import "ios/chrome/browser/infobars/infobar_controller.h" +class ConfirmInfoBarDelegate; + @interface ConfirmInfoBarController : InfoBarController +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithInfoBarDelegate:(ConfirmInfoBarDelegate*)delegate; + @end #endif // IOS_CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_CONTROLLER_H_
diff --git a/ios/chrome/browser/infobars/confirm_infobar_controller.mm b/ios/chrome/browser/infobars/confirm_infobar_controller.mm index d4b2a94..e939c29 100644 --- a/ios/chrome/browser/infobars/confirm_infobar_controller.mm +++ b/ios/chrome/browser/infobars/confirm_infobar_controller.mm
@@ -8,8 +8,9 @@ #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "components/infobars/core/confirm_infobar_delegate.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/infobars/infobar_controller+protected.h" +#include "ios/chrome/browser/infobars/infobar_controller_delegate.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/window_open_disposition.h" #include "ui/gfx/image/image.h" @@ -28,27 +29,15 @@ TITLE_LINK }; -// Converts a UI button tag to the corresponding InfoBarButton. -ConfirmInfoBarDelegate::InfoBarButton UITagToButton(NSUInteger tag) { - switch (tag) { - case ConfirmInfoBarUITags::OK: - return ConfirmInfoBarDelegate::BUTTON_OK; - case ConfirmInfoBarUITags::CANCEL: - case ConfirmInfoBarUITags::CLOSE: - return ConfirmInfoBarDelegate::BUTTON_CANCEL; - default: - NOTREACHED(); - return ConfirmInfoBarDelegate::BUTTON_CANCEL; - } -} - } // namespace #pragma mark - ConfirmInfoBarController @interface ConfirmInfoBarController () { ConfirmInfoBarDelegate* _confirmInfobarDelegate; + __weak ConfirmInfoBarView* _infoBarView; } + @end @implementation ConfirmInfoBarController @@ -56,11 +45,18 @@ #pragma mark - #pragma mark InfoBarController -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)frame { - _confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate(); - InfoBarView* infoBarView = - [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]; +- (instancetype)initWithInfoBarDelegate:(ConfirmInfoBarDelegate*)delegate { + self = [super init]; + if (self) { + _confirmInfobarDelegate = delegate; + } + return self; +} + +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)frame { + ConfirmInfoBarView* infoBarView = + [[ConfirmInfoBarView alloc] initWithFrame:frame]; + _infoBarView = infoBarView; // Model data. gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon(); int buttons = _confirmInfobarDelegate->GetButtons(); @@ -106,7 +102,7 @@ return infoBarView; } -- (void)updateInfobarLabel:(InfoBarView*)view { +- (void)updateInfobarLabel:(ConfirmInfoBarView*)view { if (!_confirmInfobarDelegate->GetMessageText().length()) return; if (_confirmInfobarDelegate->GetLinkText().length()) { @@ -130,6 +126,10 @@ } } +- (ConfirmInfoBarView*)view { + return _infoBarView; +} + #pragma mark - Handling of User Events - (void)infoBarButtonDidPress:(id)sender { @@ -139,12 +139,26 @@ if (!self.delegate) { return; } - if ([sender isKindOfClass:[UIButton class]]) { - NSUInteger tag = static_cast<UIButton*>(sender).tag; - if (tag == ConfirmInfoBarUITags::CLOSE) - self.delegate->InfoBarDidCancel(); - else - self.delegate->InfoBarButtonDidPress(UITagToButton(tag)); + + NSUInteger buttonId = base::mac::ObjCCastStrict<UIButton>(sender).tag; + switch (buttonId) { + case ConfirmInfoBarUITags::OK: + if (_confirmInfobarDelegate->Accept()) { + self.delegate->RemoveInfoBar(); + } + break; + case ConfirmInfoBarUITags::CANCEL: + if (_confirmInfobarDelegate->Cancel()) { + self.delegate->RemoveInfoBar(); + } + break; + case ConfirmInfoBarUITags::CLOSE: + _confirmInfobarDelegate->InfoBarDismissed(); + self.delegate->RemoveInfoBar(); + break; + default: + NOTREACHED() << "Unexpected button pressed"; + break; } } @@ -153,10 +167,10 @@ if (!self.delegate) { return; } - if (tag == ConfirmInfoBarUITags::TITLE_LINK) { - _confirmInfobarDelegate->LinkClicked( - WindowOpenDisposition::NEW_FOREGROUND_TAB); - } + + DCHECK(tag == ConfirmInfoBarUITags::TITLE_LINK); + _confirmInfobarDelegate->LinkClicked( + WindowOpenDisposition::NEW_FOREGROUND_TAB); } @end
diff --git a/ios/chrome/browser/infobars/infobar.h b/ios/chrome/browser/infobars/infobar.h index 4da0829..8e01e56 100644 --- a/ios/chrome/browser/infobars/infobar.h +++ b/ios/chrome/browser/infobars/infobar.h
@@ -9,41 +9,37 @@ #include "base/macros.h" #include "components/infobars/core/infobar.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/infobars/infobar_controller_delegate.h" +#import "ios/chrome/browser/ui/infobars/infobar_view_sizing.h" @class InfoBarController; -@class UIView; namespace infobars { class InfoBarDelegate; } -// InfoBar for iOS acts as a UIViewController for InfoBarView. -class InfoBarIOS : public infobars::InfoBar, public InfoBarViewDelegate { +// The iOS version of infobars::InfoBar. +class InfoBarIOS : public infobars::InfoBar, public InfoBarControllerDelegate { public: - explicit InfoBarIOS(std::unique_ptr<infobars::InfoBarDelegate> delegate); + InfoBarIOS(InfoBarController* controller, + std::unique_ptr<infobars::InfoBarDelegate> delegate); ~InfoBarIOS() override; - // Layouts the infobar using data from delegate and prepare it for adding to - // superview. + // Lays out the infobar view using data from the delegate to add to superview. void Layout(CGRect container_bounds); - // Returns UIView holding content of this infobar. - UIView* view(); + // Returns the infobar view holding contents of this infobar. + UIView<InfoBarViewSizing>* view(); // Remove the infobar view from infobar container view. void RemoveView(); - // Sets the controller. Should be called right after the infobar's creation. - void SetController(InfoBarController* controller); - private: - // InfoBar overrides: + // infobars::InfoBar overrides: void PlatformSpecificOnHeightRecalculated() override; - // InfoBarViewDelegate: + // InfoBarControllerDelegate overrides: void SetInfoBarTargetHeight(int height) override; - void InfoBarDidCancel() override; - void InfoBarButtonDidPress(NSUInteger button_id) override; + void RemoveInfoBar() override; InfoBarController* controller_; DISALLOW_COPY_AND_ASSIGN(InfoBarIOS);
diff --git a/ios/chrome/browser/infobars/infobar.mm b/ios/chrome/browser/infobars/infobar.mm index 3b13a37..f68bbe1 100644 --- a/ios/chrome/browser/infobars/infobar.mm +++ b/ios/chrome/browser/infobars/infobar.mm
@@ -12,7 +12,7 @@ #import "ios/chrome/browser/infobars/confirm_infobar_controller.h" #include "ios/chrome/browser/infobars/infobar_controller.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" +#import "ios/chrome/browser/ui/infobars/infobar_view_sizing.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -21,8 +21,12 @@ using infobars::InfoBar; using infobars::InfoBarDelegate; -InfoBarIOS::InfoBarIOS(std::unique_ptr<InfoBarDelegate> delegate) - : InfoBar(std::move(delegate)) {} +InfoBarIOS::InfoBarIOS(InfoBarController* controller, + std::unique_ptr<InfoBarDelegate> delegate) + : InfoBar(std::move(delegate)), controller_(controller) { + DCHECK(controller_); + [controller_ setDelegate:this]; +} InfoBarIOS::~InfoBarIOS() { DCHECK(controller_); @@ -30,21 +34,13 @@ controller_ = nil; } -void InfoBarIOS::SetController(InfoBarController* controller) { - controller_ = controller; -} - void InfoBarIOS::Layout(CGRect container_bounds) { DCHECK(controller_); - if ([controller_ view]) { - [[controller_ view] setFrame:container_bounds]; - } else { - [controller_ layoutForDelegate:delegate() frame:container_bounds]; - } + [controller_ layoutForFrame:container_bounds]; SetTargetHeight([controller_ barHeight]); } -UIView* InfoBarIOS::view() { +UIView<InfoBarViewSizing>* InfoBarIOS::view() { DCHECK(controller_); return [controller_ view]; } @@ -59,71 +55,12 @@ [controller_ onHeightRecalculated:computed_height()]; } -#pragma mark - InfoBarViewDelegate +#pragma mark - InfoBarControllerDelegate void InfoBarIOS::SetInfoBarTargetHeight(int height) { SetTargetHeight(height); } -// Some infobar button was pressed. -void InfoBarIOS::InfoBarButtonDidPress(NSUInteger button_id) { - // Do not add new logic for specific info bar delegates. - // TODO(droger): Move the logic elsewhere, http://crbug.com/307552. - // If not owned, the infobar has already been removed. - if (!owner()) - return; - if (delegate()->AsConfirmInfoBarDelegate()) { - ConfirmInfoBarDelegate* confirmDelegate = - delegate()->AsConfirmInfoBarDelegate(); - if ((button_id == ConfirmInfoBarDelegate::BUTTON_OK && - confirmDelegate->Accept()) || - (button_id == ConfirmInfoBarDelegate::BUTTON_CANCEL && - delegate()->AsConfirmInfoBarDelegate()->Cancel())) { - RemoveSelf(); - } - } else if (delegate()->AsTranslateInfoBarDelegate()) { - translate::TranslateInfoBarDelegate* translateDelegate = - delegate()->AsTranslateInfoBarDelegate(); - switch (button_id) { - case TranslateInfoBarIOSTag::AFTER_DONE: - InfoBarDidCancel(); - break; - case TranslateInfoBarIOSTag::AFTER_REVERT: - translateDelegate->RevertTranslation(); - break; - case TranslateInfoBarIOSTag::BEFORE_ACCEPT: - translateDelegate->Translate(); - break; - case TranslateInfoBarIOSTag::BEFORE_DENY: - translateDelegate->TranslationDeclined(); - if (translateDelegate->ShouldShowNeverTranslateShortcut()) - translateDelegate->ShowNeverTranslateInfobar(); - else - RemoveSelf(); - break; - case TranslateInfoBarIOSTag::DENY_LANGUAGE: - translateDelegate->NeverTranslatePageLanguage(); - RemoveSelf(); - break; - case TranslateInfoBarIOSTag::DENY_WEBSITE: - if (!translateDelegate->IsSiteBlacklisted()) - translateDelegate->ToggleSiteBlacklist(); - RemoveSelf(); - break; - case TranslateInfoBarIOSTag::MESSAGE: - translateDelegate->MessageInfoBarButtonPressed(); - break; - default: - NOTREACHED() << "Unexpected Translate button label"; - break; - } - } -} - -void InfoBarIOS::InfoBarDidCancel() { - // If not owned, the infobar has already been removed. - if (!owner()) - return; - delegate()->InfoBarDismissed(); +void InfoBarIOS::RemoveInfoBar() { RemoveSelf(); }
diff --git a/ios/chrome/browser/infobars/infobar_container_view.mm b/ios/chrome/browser/infobars/infobar_container_view.mm index bc6bb66..ffff0a0 100644 --- a/ios/chrome/browser/infobars/infobar_container_view.mm +++ b/ios/chrome/browser/infobars/infobar_container_view.mm
@@ -6,7 +6,6 @@ #include "base/logging.h" #include "ios/chrome/browser/infobars/infobar.h" -#include "ios/chrome/browser/ui/infobars/infobar_view.h" #include "ui/base/device_form_factor.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -19,7 +18,7 @@ DCHECK_LE((NSUInteger)position, [[self subviews] count]); CGRect containerBounds = [self bounds]; infoBarIOS->Layout(containerBounds); - UIView* view = infoBarIOS->view(); + UIView<InfoBarViewSizing>* view = infoBarIOS->view(); [self insertSubview:view atIndex:position]; } @@ -42,7 +41,7 @@ } - (void)layoutSubviews { - for (InfoBarView* view in self.subviews) { + for (UIView<InfoBarViewSizing>* view in self.subviews) { [view sizeToFit]; CGRect frame = view.frame; frame.origin.y = CGRectGetHeight(frame) - [view visibleHeight]; @@ -51,7 +50,7 @@ } - (CGFloat)topmostVisibleInfoBarHeight { - for (InfoBarView* view in [self.subviews reverseObjectEnumerator]) { + for (UIView* view in [self.subviews reverseObjectEnumerator]) { return [view sizeThatFits:self.frame.size].height; } return 0;
diff --git a/ios/chrome/browser/infobars/infobar_controller+protected.h b/ios/chrome/browser/infobars/infobar_controller+protected.h new file mode 100644 index 0000000..f3f9ca8f --- /dev/null +++ b/ios/chrome/browser/infobars/infobar_controller+protected.h
@@ -0,0 +1,18 @@ +// 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 IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_PROTECTED_H_ +#define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_PROTECTED_H_ + +#import "ios/chrome/browser/infobars/infobar_controller.h" + +@interface InfoBarController () + +// Creates and returns a view and lays out all the infobar elements in it. Will +// not add it as a subview yet. This method must be overriden in subclasses. +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)bounds; + +@end + +#endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_PROTECTED_H_
diff --git a/ios/chrome/browser/infobars/infobar_controller.h b/ios/chrome/browser/infobars/infobar_controller.h index 6fe43dba..9264cd6 100644 --- a/ios/chrome/browser/infobars/infobar_controller.h +++ b/ios/chrome/browser/infobars/infobar_controller.h
@@ -7,31 +7,17 @@ #import <UIKit/UIKit.h> -@class InfoBarView; -class InfoBarViewDelegate; -namespace infobars { -class InfoBarDelegate; -} +#import "ios/chrome/browser/ui/infobars/infobar_view_sizing_delegate.h" + +class InfoBarControllerDelegate; +@protocol InfoBarViewSizing; // InfoBar for iOS acts as a UIViewController for InfoBarView. -@interface InfoBarController : NSObject - -@property(nonatomic, readonly) InfoBarViewDelegate* delegate; - -// Designated initializer. -- (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate - NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; +@interface InfoBarController : NSObject<InfoBarViewSizingDelegate> // Creates a view and lays out all the infobar elements in it. Will not add -// it as a subview yet. This method must be overriden in subclasses. -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)bounds; - -// Creates the view. -- (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)bounds; +// it as a subview yet. +- (void)layoutForFrame:(CGRect)bounds; // Detaches view from its delegate. // After this function is called, no user interaction can be handled. @@ -47,7 +33,9 @@ - (void)removeView; // Accesses the view. -- (InfoBarView*)view; +- (UIView<InfoBarViewSizing>*)view; + +@property(nonatomic, assign) InfoBarControllerDelegate* delegate; // weak @end
diff --git a/ios/chrome/browser/infobars/infobar_controller.mm b/ios/chrome/browser/infobars/infobar_controller.mm index e00591b7..3bcc89f 100644 --- a/ios/chrome/browser/infobars/infobar_controller.mm +++ b/ios/chrome/browser/infobars/infobar_controller.mm
@@ -7,28 +7,21 @@ #include <memory> #include "base/logging.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" +#include "ios/chrome/browser/infobars/infobar_controller_delegate.h" +#import "ios/chrome/browser/ui/infobars/infobar_view_sizing.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @interface InfoBarController () { - InfoBarView* _infoBarView; + UIView<InfoBarViewSizing>* _infoBarView; } @end @implementation InfoBarController -@synthesize delegate = _delegate; -- (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate { - self = [super init]; - if (self) { - DCHECK(delegate); - _delegate = delegate; - } - return self; -} +@synthesize delegate = _delegate; - (void)dealloc { [_infoBarView removeFromSuperview]; @@ -38,16 +31,17 @@ return CGRectGetHeight([_infoBarView frame]); } -- (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)bounds { - DCHECK(!_infoBarView); - _infoBarView = [self viewForDelegate:delegate frame:bounds]; +- (void)layoutForFrame:(CGRect)bounds { + if (!_infoBarView) { + _infoBarView = [self viewForFrame:bounds]; + [_infoBarView setDelegate:self]; + } else { + [_infoBarView setFrame:bounds]; + } } -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)bounds { - // Must be overriden in subclasses. - NOTREACHED(); +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)bounds { + NOTREACHED() << "Must be overriden in subclasses."; return _infoBarView; } @@ -55,7 +49,7 @@ [_infoBarView setVisibleHeight:newHeight]; } -- (InfoBarView*)view { +- (UIView<InfoBarViewSizing>*)view { return _infoBarView; } @@ -64,8 +58,17 @@ } - (void)detachView { - [_infoBarView resetDelegate]; + [_infoBarView setDelegate:nil]; _delegate = nullptr; } +#pragma mark - InfoBarViewDelegate + +- (void)didSetInfoBarTargetHeight:(CGFloat)height { + if (!_delegate) + return; + + _delegate->SetInfoBarTargetHeight(height); +} + @end
diff --git a/ios/chrome/browser/infobars/infobar_controller_delegate.h b/ios/chrome/browser/infobars/infobar_controller_delegate.h new file mode 100644 index 0000000..3c9c4ee --- /dev/null +++ b/ios/chrome/browser/infobars/infobar_controller_delegate.h
@@ -0,0 +1,23 @@ +// 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 IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_DELEGATE_H_ +#define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_DELEGATE_H_ + +#import <Foundation/Foundation.h> + +// Interface for delegating events from infobar. +class InfoBarControllerDelegate { + public: + // Notifies that the target size has been changed (e.g. after rotation). + virtual void SetInfoBarTargetHeight(int height) = 0; + + // Notifies that the infobar must be removed. + virtual void RemoveInfoBar() = 0; + + protected: + virtual ~InfoBarControllerDelegate() {} +}; + +#endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_DELEGATE_H_
diff --git a/ios/chrome/browser/infobars/infobar_utils.mm b/ios/chrome/browser/infobars/infobar_utils.mm index 527b77b..8b5955a 100644 --- a/ios/chrome/browser/infobars/infobar_utils.mm +++ b/ios/chrome/browser/infobars/infobar_utils.mm
@@ -17,9 +17,7 @@ std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( std::unique_ptr<ConfirmInfoBarDelegate> delegate) { - std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate))); ConfirmInfoBarController* controller = - [[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()]; - infobar->SetController(controller); - return infobar; + [[ConfirmInfoBarController alloc] initWithInfoBarDelegate:delegate.get()]; + return std::make_unique<InfoBarIOS>(controller, std::move(delegate)); }
diff --git a/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm b/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm index 135782c..b688b06 100644 --- a/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm +++ b/ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.mm
@@ -37,11 +37,11 @@ auto delegate = base::WrapUnique(new IOSChromeUpdatePasswordInfoBarDelegate( is_smart_lock_branding_enabled, std::move(form_manager))); delegate->set_dispatcher(dispatcher); - std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate))); UpdatePasswordInfoBarController* controller = - [[UpdatePasswordInfoBarController alloc] initWithDelegate:infobar.get()]; - [controller setBaseViewController:baseViewController]; - infobar->SetController(controller); + [[UpdatePasswordInfoBarController alloc] + initWithBaseViewController:baseViewController + infoBarDelegate:delegate.get()]; + auto infobar = std::make_unique<InfoBarIOS>(controller, std::move(delegate)); infobar_manager->AddInfoBar(std::move(infobar)); }
diff --git a/ios/chrome/browser/passwords/update_password_infobar_controller.h b/ios/chrome/browser/passwords/update_password_infobar_controller.h index b08c988..1845429 100644 --- a/ios/chrome/browser/passwords/update_password_infobar_controller.h +++ b/ios/chrome/browser/passwords/update_password_infobar_controller.h
@@ -13,12 +13,11 @@ // the user whether they want to update their password. @interface UpdatePasswordInfoBarController : ConfirmInfoBarController -// The base view controller from which to present UI. -@property(nonatomic, readwrite, weak) UIViewController* baseViewController; +- (instancetype)init NS_UNAVAILABLE; -- (InfoBarView*)viewForDelegate: - (IOSChromeUpdatePasswordInfoBarDelegate*)delegate - frame:(CGRect)frame; +- (instancetype) +initWithBaseViewController:(UIViewController*)baseViewController + infoBarDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate; @end
diff --git a/ios/chrome/browser/passwords/update_password_infobar_controller.mm b/ios/chrome/browser/passwords/update_password_infobar_controller.mm index e743fc6..8eec95d 100644 --- a/ios/chrome/browser/passwords/update_password_infobar_controller.mm +++ b/ios/chrome/browser/passwords/update_password_infobar_controller.mm
@@ -7,9 +7,10 @@ #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "ios/chrome/browser/infobars/confirm_infobar_controller+protected.h" +#import "ios/chrome/browser/infobars/infobar_controller+protected.h" #include "ios/chrome/browser/passwords/ios_chrome_update_password_infobar_delegate.h" #import "ios/chrome/browser/ui/elements/selector_coordinator.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -24,21 +25,34 @@ @interface UpdatePasswordInfoBarController ()<SelectorCoordinatorDelegate> { IOSChromeUpdatePasswordInfoBarDelegate* _delegate; } + +// The base view controller from which to present UI. +@property(nonatomic, readwrite, weak) UIViewController* baseViewController; + @property(nonatomic, strong) SelectorCoordinator* selectorCoordinator; + +// Action for any of the user defined links. +- (void)infobarLinkDidPress:(NSUInteger)tag; + @end @implementation UpdatePasswordInfoBarController + @synthesize baseViewController = _baseViewController; @synthesize selectorCoordinator = _selectorCoordinator; -- (InfoBarView*)viewForDelegate: - (IOSChromeUpdatePasswordInfoBarDelegate*)delegate - frame:(CGRect)frame { - _delegate = delegate; - return [super viewForDelegate:delegate frame:frame]; +- (instancetype) +initWithBaseViewController:(UIViewController*)baseViewController + infoBarDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate { + self = [super initWithInfoBarDelegate:delegate]; + if (self) { + _baseViewController = baseViewController; + _delegate = delegate; + } + return self; } -- (void)updateInfobarLabel:(InfoBarView*)view { +- (void)updateInfobarLabel:(ConfirmInfoBarView*)view { [super updateInfobarLabel:view]; // Get the message text with current links marked.
diff --git a/ios/chrome/browser/snapshots/BUILD.gn b/ios/chrome/browser/snapshots/BUILD.gn index 845122d..3026311 100644 --- a/ios/chrome/browser/snapshots/BUILD.gn +++ b/ios/chrome/browser/snapshots/BUILD.gn
@@ -37,6 +37,7 @@ "//ios/chrome/browser/browser_state", "//ios/chrome/browser/infobars", "//ios/chrome/browser/ui", + "//ios/chrome/browser/ui:feature_flags", "//ios/chrome/browser/web:tab_id_tab_helper", "//ios/chrome/browser/web_state_list", "//ios/web/public",
diff --git a/ios/chrome/browser/snapshots/snapshot_generator.mm b/ios/chrome/browser/snapshots/snapshot_generator.mm index deb2b2f5..30207bb 100644 --- a/ios/chrome/browser/snapshots/snapshot_generator.mm +++ b/ios/chrome/browser/snapshots/snapshot_generator.mm
@@ -17,6 +17,7 @@ #import "ios/chrome/browser/snapshots/snapshot_cache_factory.h" #import "ios/chrome/browser/snapshots/snapshot_generator_delegate.h" #import "ios/chrome/browser/snapshots/snapshot_overlay.h" +#include "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state_observer_bridge.h" @@ -201,18 +202,7 @@ if (!snapshot) return [[self class] defaultSnapshotImage]; - UIImage* snapshotToCache = snapshot; - if (!visibleFrameOnly) { - UIEdgeInsets insets = [_delegate snapshotEdgeInsetsForWebState:_webState]; - if (!UIEdgeInsetsEqualToEdgeInsets(insets, UIEdgeInsetsZero)) { - CGRect cropRect = - UIEdgeInsetsInsetRect(CGRect{CGPointZero, [snapshot size]}, insets); - snapshotToCache = CropImage(snapshot, cropRect); - } - } - - [self.snapshotCache setImage:snapshotToCache - withSessionID:_snapshotSessionId]; + [self.snapshotCache setImage:snapshot withSessionID:_snapshotSessionId]; return snapshot; } @@ -279,10 +269,13 @@ UIView* view = _webState->GetView(); CGRect frame = [view bounds]; + UIEdgeInsets headerInsets = UIEdgeInsetsZero; if (visibleFrameOnly) { - UIEdgeInsets insets = [_delegate snapshotEdgeInsetsForWebState:_webState]; - frame = UIEdgeInsetsInsetRect(frame, insets); + headerInsets = [_delegate snapshotEdgeInsetsForWebState:_webState]; + } else if (base::FeatureList::IsEnabled(kBrowserContainerFullscreen)) { + headerInsets = UIEdgeInsetsMake(StatusBarHeight(), 0, 0, 0); } + frame = UIEdgeInsetsInsetRect(frame, headerInsets); return frame; }
diff --git a/ios/chrome/browser/ssl/ios_captive_portal_blocking_page.mm b/ios/chrome/browser/ssl/ios_captive_portal_blocking_page.mm index a8bc542a..2404f50 100644 --- a/ios/chrome/browser/ssl/ios_captive_portal_blocking_page.mm +++ b/ios/chrome/browser/ssl/ios_captive_portal_blocking_page.mm
@@ -77,6 +77,8 @@ load_time_data->SetString("closeDetails", base::string16()); load_time_data->SetString("explanationParagraph", base::string16()); load_time_data->SetString("finalParagraph", base::string16()); + load_time_data->SetString("recurrentErrorParagraph", base::string16()); + load_time_data->SetBoolean("show_recurrent_error_paragraph", false); } void IOSCaptivePortalBlockingPage::AfterShow() {}
diff --git a/ios/chrome/browser/translate/after_translate_infobar_controller.h b/ios/chrome/browser/translate/after_translate_infobar_controller.h index 57eee80d..589ac35 100644 --- a/ios/chrome/browser/translate/after_translate_infobar_controller.h +++ b/ios/chrome/browser/translate/after_translate_infobar_controller.h
@@ -7,8 +7,17 @@ #include "ios/chrome/browser/infobars/infobar_controller.h" +namespace translate { +class TranslateInfoBarDelegate; +} + @interface AfterTranslateInfoBarController : InfoBarController +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate; + @end #endif // IOS_CHROME_BROWSER_TRANSLATE_AFTER_TRANSLATE_INFOBAR_CONTROLLER_H_
diff --git a/ios/chrome/browser/translate/after_translate_infobar_controller.mm b/ios/chrome/browser/translate/after_translate_infobar_controller.mm index a14bb2a1..9543d3d 100644 --- a/ios/chrome/browser/translate/after_translate_infobar_controller.mm +++ b/ios/chrome/browser/translate/after_translate_infobar_controller.mm
@@ -4,13 +4,14 @@ #include "ios/chrome/browser/translate/after_translate_infobar_controller.h" +#include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/strings/grit/components_strings.h" #include "components/translate/core/browser/translate_infobar_delegate.h" +#include "ios/chrome/browser/infobars/infobar_controller_delegate.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/image/image.h" @@ -31,9 +32,6 @@ AlwaysTranslateSwitchState _alwaysTranslateSwitchState; } -// Action for any of the user defined buttons. -- (void)infoBarButtonDidPress:(id)sender; - @end @implementation AfterTranslateInfoBarController @@ -41,13 +39,18 @@ #pragma mark - #pragma mark InfoBarControllerProtocol -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)frame { - InfoBarView* infoBarView; - _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); - DCHECK(_translateInfoBarDelegate); - infoBarView = - [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]; +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate { + self = [super init]; + if (self) { + _translateInfoBarDelegate = delegate; + } + return self; +} + +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)frame { + ConfirmInfoBarView* infoBarView = + [[ConfirmInfoBarView alloc] initWithFrame:frame]; // Icon gfx::Image icon = _translateInfoBarDelegate->GetIcon(); if (!icon.IsEmpty()) @@ -113,17 +116,24 @@ if (!self.delegate) { return; } - if ([sender isKindOfClass:[UIButton class]]) { - NSUInteger buttonId = static_cast<UIButton*>(sender).tag; - if (buttonId == TranslateInfoBarIOSTag::CLOSE) { - self.delegate->InfoBarDidCancel(); - } else { - DCHECK(buttonId == TranslateInfoBarIOSTag::AFTER_REVERT || - buttonId == TranslateInfoBarIOSTag::AFTER_DONE); - if (buttonId == TranslateInfoBarIOSTag::AFTER_DONE) - [self saveAlwaysTranslateState]; - self.delegate->InfoBarButtonDidPress(buttonId); - } + + NSUInteger buttonId = base::mac::ObjCCastStrict<UIButton>(sender).tag; + switch (buttonId) { + case TranslateInfoBarIOSTag::CLOSE: + _translateInfoBarDelegate->InfoBarDismissed(); + self.delegate->RemoveInfoBar(); + break; + case TranslateInfoBarIOSTag::AFTER_DONE: + [self saveAlwaysTranslateState]; + _translateInfoBarDelegate->InfoBarDismissed(); + self.delegate->RemoveInfoBar(); + break; + case TranslateInfoBarIOSTag::AFTER_REVERT: + _translateInfoBarDelegate->RevertTranslation(); + break; + default: + NOTREACHED() << "Unexpected Translate button label"; + break; } }
diff --git a/ios/chrome/browser/translate/before_translate_infobar_controller.h b/ios/chrome/browser/translate/before_translate_infobar_controller.h index 39dc3b78..e74cb9e 100644 --- a/ios/chrome/browser/translate/before_translate_infobar_controller.h +++ b/ios/chrome/browser/translate/before_translate_infobar_controller.h
@@ -8,9 +8,17 @@ #include "ios/chrome/browser/infobars/infobar_controller.h" @protocol LanguageSelectionHandler; +namespace translate { +class TranslateInfoBarDelegate; +} @interface BeforeTranslateInfoBarController : InfoBarController +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate; + @property(nonatomic, weak) id<LanguageSelectionHandler> languageSelectionHandler;
diff --git a/ios/chrome/browser/translate/before_translate_infobar_controller.mm b/ios/chrome/browser/translate/before_translate_infobar_controller.mm index 4a6b58a..9f18d72 100644 --- a/ios/chrome/browser/translate/before_translate_infobar_controller.mm +++ b/ios/chrome/browser/translate/before_translate_infobar_controller.mm
@@ -8,16 +8,17 @@ #import <UIKit/UIKit.h> #include "base/logging.h" +#include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/strings/grit/components_strings.h" #include "components/translate/core/browser/translate_infobar_delegate.h" +#include "ios/chrome/browser/infobars/infobar_controller_delegate.h" #include "ios/chrome/browser/translate/language_selection_context.h" #include "ios/chrome/browser/translate/language_selection_delegate.h" #include "ios/chrome/browser/translate/language_selection_handler.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #import "ios/chrome/browser/ui/util/top_view_controller.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/image/image.h" @@ -28,13 +29,6 @@ @interface BeforeTranslateInfoBarController ()<LanguageSelectionDelegate> -// Action for any of the user defined buttons. -- (void)infoBarButtonDidPress:(id)sender; -// Action for any of the user defined links. -- (void)infobarLinkDidPress:(NSUInteger)tag; -// Changes the text on the view to match the language. -- (void)updateInfobarLabelOnView:(InfoBarView*)view; - @end @implementation BeforeTranslateInfoBarController { @@ -42,6 +36,7 @@ // Stores whether the user is currently choosing in the UIPickerView the // original language, or the target language. TranslateInfoBarIOSTag::Tag _languageSelectionType; + __weak ConfirmInfoBarView* _infoBarView; } @synthesize languageSelectionHandler = _languageSelectionHandler; @@ -49,12 +44,19 @@ #pragma mark - #pragma mark InfoBarControllerProtocol -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)frame { - InfoBarView* infoBarView; - _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); - infoBarView = - [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]; +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate { + self = [super init]; + if (self) { + _translateInfoBarDelegate = delegate; + } + return self; +} + +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)frame { + ConfirmInfoBarView* infoBarView = + [[ConfirmInfoBarView alloc] initWithFrame:frame]; + _infoBarView = infoBarView; // Icon gfx::Image icon = _translateInfoBarDelegate->GetIcon(); if (!icon.IsEmpty()) @@ -79,7 +81,7 @@ return infoBarView; } -- (void)updateInfobarLabelOnView:(InfoBarView*)view { +- (void)updateInfobarLabelOnView:(ConfirmInfoBarView*)view { NSString* originalLanguage = base::SysUTF16ToNSString( _translateInfoBarDelegate->original_language_name()); NSString* targetLanguage = base::SysUTF16ToNSString( @@ -111,11 +113,22 @@ if (!self.delegate) { return; } - if ([sender isKindOfClass:[UIButton class]]) { - NSUInteger buttonId = static_cast<UIButton*>(sender).tag; - DCHECK(buttonId == TranslateInfoBarIOSTag::BEFORE_ACCEPT || - buttonId == TranslateInfoBarIOSTag::BEFORE_DENY); - self.delegate->InfoBarButtonDidPress(buttonId); + + NSUInteger buttonId = base::mac::ObjCCastStrict<UIButton>(sender).tag; + switch (buttonId) { + case TranslateInfoBarIOSTag::BEFORE_ACCEPT: + _translateInfoBarDelegate->Translate(); + break; + case TranslateInfoBarIOSTag::BEFORE_DENY: + _translateInfoBarDelegate->TranslationDeclined(); + if (_translateInfoBarDelegate->ShouldShowNeverTranslateShortcut()) + _translateInfoBarDelegate->ShowNeverTranslateInfobar(); + else + self.delegate->RemoveInfoBar(); + break; + default: + NOTREACHED() << "Unexpected Translate button label"; + break; } } @@ -173,7 +186,7 @@ languageCode != _translateInfoBarDelegate->original_language_code()) { _translateInfoBarDelegate->UpdateTargetLanguage(languageCode); } - [self updateInfobarLabelOnView:self.view]; + [self updateInfobarLabelOnView:_infoBarView]; } - (void)languageSelectorClosedWithoutSelection {
diff --git a/ios/chrome/browser/translate/chrome_ios_translate_client.mm b/ios/chrome/browser/translate/chrome_ios_translate_client.mm index 78af9eb..547afd1 100644 --- a/ios/chrome/browser/translate/chrome_ios_translate_client.mm +++ b/ios/chrome/browser/translate/chrome_ios_translate_client.mm
@@ -105,35 +105,33 @@ std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const { translate::TranslateStep step = delegate->translate_step(); - std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate))); InfoBarController* controller; switch (step) { case translate::TRANSLATE_STEP_AFTER_TRANSLATE: controller = [[AfterTranslateInfoBarController alloc] - initWithDelegate:infobar.get()]; + initWithInfoBarDelegate:delegate.get()]; break; case translate::TRANSLATE_STEP_BEFORE_TRANSLATE: { BeforeTranslateInfoBarController* beforeController = [[BeforeTranslateInfoBarController alloc] - initWithDelegate:infobar.get()]; + initWithInfoBarDelegate:delegate.get()]; beforeController.languageSelectionHandler = language_selection_handler_; controller = beforeController; break; } case translate::TRANSLATE_STEP_NEVER_TRANSLATE: controller = [[NeverTranslateInfoBarController alloc] - initWithDelegate:infobar.get()]; + initWithInfoBarDelegate:delegate.get()]; break; case translate::TRANSLATE_STEP_TRANSLATING: case translate::TRANSLATE_STEP_TRANSLATE_ERROR: controller = [[TranslateMessageInfoBarController alloc] - initWithDelegate:infobar.get()]; + initWithInfoBarDelegate:delegate.get()]; break; default: NOTREACHED(); } - infobar->SetController(controller); - return infobar; + return std::make_unique<InfoBarIOS>(controller, std::move(delegate)); } void ChromeIOSTranslateClient::RecordTranslateEvent(
diff --git a/ios/chrome/browser/translate/never_translate_infobar_controller.h b/ios/chrome/browser/translate/never_translate_infobar_controller.h index 54ecf8c..d823b1d8 100644 --- a/ios/chrome/browser/translate/never_translate_infobar_controller.h +++ b/ios/chrome/browser/translate/never_translate_infobar_controller.h
@@ -7,8 +7,17 @@ #include "ios/chrome/browser/infobars/infobar_controller.h" +namespace translate { +class TranslateInfoBarDelegate; +} + @interface NeverTranslateInfoBarController : InfoBarController +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate; + @end #endif // IOS_CHROME_BROWSER_TRANSLATE_NEVER_TRANSLATE_INFOBAR_CONTROLLER_H_
diff --git a/ios/chrome/browser/translate/never_translate_infobar_controller.mm b/ios/chrome/browser/translate/never_translate_infobar_controller.mm index a88d8c7..91a312bf 100644 --- a/ios/chrome/browser/translate/never_translate_infobar_controller.mm +++ b/ios/chrome/browser/translate/never_translate_infobar_controller.mm
@@ -4,13 +4,14 @@ #include "ios/chrome/browser/translate/never_translate_infobar_controller.h" +#include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/strings/grit/components_strings.h" #include "components/translate/core/browser/translate_infobar_delegate.h" +#include "ios/chrome/browser/infobars/infobar_controller_delegate.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #include "ios/chrome/grit/ios_chromium_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/image/image.h" @@ -19,7 +20,9 @@ #error "This file requires ARC support." #endif -@interface NeverTranslateInfoBarController () +@interface NeverTranslateInfoBarController () { + translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; +} // Action for any of the user defined buttons. - (void)infoBarButtonDidPress:(id)sender; @@ -31,20 +34,25 @@ #pragma mark - #pragma mark InfoBarControllerProtocol -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)frame { - InfoBarView* infoBarView; - translate::TranslateInfoBarDelegate* translateInfoBarDelegate = - delegate->AsTranslateInfoBarDelegate(); - infoBarView = - [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]; +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate { + self = [super init]; + if (self) { + _translateInfoBarDelegate = delegate; + } + return self; +} + +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)frame { + ConfirmInfoBarView* infoBarView = + [[ConfirmInfoBarView alloc] initWithFrame:frame]; // Icon - gfx::Image icon = translateInfoBarDelegate->GetIcon(); + gfx::Image icon = _translateInfoBarDelegate->GetIcon(); if (!icon.IsEmpty()) [infoBarView addLeftIcon:icon.ToUIImage()]; // Main text. base::string16 originalLanguage = - translateInfoBarDelegate->original_language_name(); + _translateInfoBarDelegate->original_language_name(); [infoBarView addLabel:l10n_util::GetNSStringF(IDS_IOS_TRANSLATE_INFOBAR_NEVER_MESSAGE, originalLanguage)]; @@ -75,15 +83,25 @@ if (!self.delegate) { return; } - if ([sender isKindOfClass:[UIButton class]]) { - NSUInteger buttonId = static_cast<UIButton*>(sender).tag; - if (buttonId == TranslateInfoBarIOSTag::CLOSE) { - self.delegate->InfoBarDidCancel(); - } else { - DCHECK(buttonId == TranslateInfoBarIOSTag::DENY_LANGUAGE || - buttonId == TranslateInfoBarIOSTag::DENY_WEBSITE); - self.delegate->InfoBarButtonDidPress(buttonId); - } + + NSUInteger buttonId = base::mac::ObjCCastStrict<UIButton>(sender).tag; + switch (buttonId) { + case TranslateInfoBarIOSTag::CLOSE: + _translateInfoBarDelegate->InfoBarDismissed(); + self.delegate->RemoveInfoBar(); + break; + case TranslateInfoBarIOSTag::DENY_LANGUAGE: + _translateInfoBarDelegate->NeverTranslatePageLanguage(); + self.delegate->RemoveInfoBar(); + break; + case TranslateInfoBarIOSTag::DENY_WEBSITE: + if (!_translateInfoBarDelegate->IsSiteBlacklisted()) + _translateInfoBarDelegate->ToggleSiteBlacklist(); + self.delegate->RemoveInfoBar(); + break; + default: + NOTREACHED() << "Unexpected Translate button label"; + break; } }
diff --git a/ios/chrome/browser/translate/translate_message_infobar_controller.h b/ios/chrome/browser/translate/translate_message_infobar_controller.h index fe9faa4..95ecf73 100644 --- a/ios/chrome/browser/translate/translate_message_infobar_controller.h +++ b/ios/chrome/browser/translate/translate_message_infobar_controller.h
@@ -7,8 +7,17 @@ #include "ios/chrome/browser/infobars/infobar_controller.h" +namespace translate { +class TranslateInfoBarDelegate; +} + @interface TranslateMessageInfoBarController : InfoBarController +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate; + @end #endif // IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_MESSAGE_INFOBAR_CONTROLLER_H_
diff --git a/ios/chrome/browser/translate/translate_message_infobar_controller.mm b/ios/chrome/browser/translate/translate_message_infobar_controller.mm index fea850a9..aff14325 100644 --- a/ios/chrome/browser/translate/translate_message_infobar_controller.mm +++ b/ios/chrome/browser/translate/translate_message_infobar_controller.mm
@@ -4,47 +4,53 @@ #include "ios/chrome/browser/translate/translate_message_infobar_controller.h" +#include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/translate/core/browser/translate_infobar_delegate.h" +#include "ios/chrome/browser/infobars/infobar_controller_delegate.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h" -#import "ios/chrome/browser/ui/infobars/infobar_view.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #include "ui/gfx/image/image.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -@interface TranslateMessageInfoBarController () - -// Action for any of the user defined buttons. -- (void)infoBarButtonDidPress:(id)sender; +@interface TranslateMessageInfoBarController () { + translate::TranslateInfoBarDelegate* _translateInfoBarDelegate; +} @end @implementation TranslateMessageInfoBarController -- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate - frame:(CGRect)frame { - InfoBarView* infoBarView; - translate::TranslateInfoBarDelegate* translateInfoBarDelegate = - delegate->AsTranslateInfoBarDelegate(); - infoBarView = - [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]; +- (instancetype)initWithInfoBarDelegate: + (translate::TranslateInfoBarDelegate*)delegate { + self = [super init]; + if (self) { + _translateInfoBarDelegate = delegate; + } + return self; +} + +- (UIView<InfoBarViewSizing>*)viewForFrame:(CGRect)frame { + ConfirmInfoBarView* infoBarView = + [[ConfirmInfoBarView alloc] initWithFrame:frame]; // Icon - gfx::Image icon = translateInfoBarDelegate->GetIcon(); + gfx::Image icon = _translateInfoBarDelegate->GetIcon(); if (!icon.IsEmpty()) [infoBarView addLeftIcon:icon.ToUIImage()]; // Text. - [infoBarView addLabel:base::SysUTF16ToNSString( - translateInfoBarDelegate->GetMessageInfoBarText())]; + [infoBarView + addLabel:base::SysUTF16ToNSString( + _translateInfoBarDelegate->GetMessageInfoBarText())]; // Close button. [infoBarView addCloseButtonWithTag:TranslateInfoBarIOSTag::CLOSE target:self action:@selector(infoBarButtonDidPress:)]; // Other button. base::string16 buttonText( - translateInfoBarDelegate->GetMessageInfoBarButtonText()); + _translateInfoBarDelegate->GetMessageInfoBarButtonText()); if (!buttonText.empty()) { [infoBarView addButton:base::SysUTF16ToNSString(buttonText) tag:TranslateInfoBarIOSTag::MESSAGE @@ -63,14 +69,19 @@ if (!self.delegate) { return; } - if ([sender isKindOfClass:[UIButton class]]) { - NSUInteger buttonId = static_cast<UIButton*>(sender).tag; - if (buttonId == TranslateInfoBarIOSTag::CLOSE) { - self.delegate->InfoBarDidCancel(); - } else { - DCHECK(buttonId == TranslateInfoBarIOSTag::MESSAGE); - self.delegate->InfoBarButtonDidPress(buttonId); - } + + NSUInteger buttonId = base::mac::ObjCCastStrict<UIButton>(sender).tag; + switch (buttonId) { + case TranslateInfoBarIOSTag::CLOSE: + _translateInfoBarDelegate->InfoBarDismissed(); + self.delegate->RemoveInfoBar(); + break; + case TranslateInfoBarIOSTag::MESSAGE: + _translateInfoBarDelegate->MessageInfoBarButtonPressed(); + break; + default: + NOTREACHED() << "Unexpected Translate button label"; + break; } }
diff --git a/ios/chrome/browser/ui/activity_services/BUILD.gn b/ios/chrome/browser/ui/activity_services/BUILD.gn index 6b7ab0a..8c9528b 100644 --- a/ios/chrome/browser/ui/activity_services/BUILD.gn +++ b/ios/chrome/browser/ui/activity_services/BUILD.gn
@@ -30,8 +30,10 @@ "share_to_data_builder.mm", ] deps = [ + "resources:activity_services_add_bookmark", + "resources:activity_services_edit_bookmark", "resources:activity_services_print", - "resources:activity_services_reading_list", + "resources:activity_services_read_later", "//base", "//components/bookmarks/browser", "//components/ui_metrics",
diff --git a/ios/chrome/browser/ui/activity_services/bookmark_activity.mm b/ios/chrome/browser/ui/activity_services/bookmark_activity.mm index 6cc3d75..0730c30 100644 --- a/ios/chrome/browser/ui/activity_services/bookmark_activity.mm +++ b/ios/chrome/browser/ui/activity_services/bookmark_activity.mm
@@ -64,7 +64,9 @@ } - (UIImage*)activityImage { - return [UIImage imageNamed:@"popup_menu_bookmarks"]; + if (self.bookmarked) + return [UIImage imageNamed:@"activity_services_edit_bookmark"]; + return [UIImage imageNamed:@"activity_services_add_bookmark"]; } - (BOOL)canPerformWithActivityItems:(NSArray*)activityItems {
diff --git a/ios/chrome/browser/ui/activity_services/reading_list_activity.mm b/ios/chrome/browser/ui/activity_services/reading_list_activity.mm index edd22f3..bb52d24 100644 --- a/ios/chrome/browser/ui/activity_services/reading_list_activity.mm +++ b/ios/chrome/browser/ui/activity_services/reading_list_activity.mm
@@ -61,7 +61,7 @@ } - (UIImage*)activityImage { - return [UIImage imageNamed:@"activity_services_reading_list"]; + return [UIImage imageNamed:@"activity_services_read_later"]; } - (BOOL)canPerformWithActivityItems:(NSArray*)activityItems {
diff --git a/ios/chrome/browser/ui/activity_services/resources/BUILD.gn b/ios/chrome/browser/ui/activity_services/resources/BUILD.gn index 1475c664..c1f595c7 100644 --- a/ios/chrome/browser/ui/activity_services/resources/BUILD.gn +++ b/ios/chrome/browser/ui/activity_services/resources/BUILD.gn
@@ -14,11 +14,29 @@ ] } -imageset("activity_services_reading_list") { +imageset("activity_services_add_bookmark") { sources = [ - "activity_services_reading_list.imageset/Contents.json", - "activity_services_reading_list.imageset/activity_services_reading_list.png", - "activity_services_reading_list.imageset/activity_services_reading_list@2x.png", - "activity_services_reading_list.imageset/activity_services_reading_list@3x.png", + "activity_services_add_bookmark.imageset/Contents.json", + "activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@2x.png", + "activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@3x.png", + "activity_services_add_bookmark.imageset/activity_services_add_bookmark_76@2x.png", + ] +} + +imageset("activity_services_edit_bookmark") { + sources = [ + "activity_services_edit_bookmark.imageset/Contents.json", + "activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@2x.png", + "activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@3x.png", + "activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_76@2x.png", + ] +} + +imageset("activity_services_read_later") { + sources = [ + "activity_services_read_later.imageset/Contents.json", + "activity_services_read_later.imageset/activity_services_read_later_60@2x.png", + "activity_services_read_later.imageset/activity_services_read_later_60@3x.png", + "activity_services_read_later.imageset/activity_services_read_later_76@2x.png", ] }
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/Contents.json b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/Contents.json new file mode 100644 index 0000000..3c796fa --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/Contents.json
@@ -0,0 +1,31 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "filename" : "activity_services_add_bookmark_60@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "filename" : "activity_services_add_bookmark_60@3x.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "filename" : "activity_services_add_bookmark_76@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@2x.png new file mode 100644 index 0000000..9c89a84d --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@3x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@3x.png new file mode 100644 index 0000000..f93dee1 --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_60@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_76@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_76@2x.png new file mode 100644 index 0000000..087aff92 --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_add_bookmark.imageset/activity_services_add_bookmark_76@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/Contents.json b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/Contents.json new file mode 100644 index 0000000..6006fafa --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/Contents.json
@@ -0,0 +1,31 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "filename" : "activity_services_edit_bookmark_60@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "filename" : "activity_services_edit_bookmark_60@3x.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "filename" : "activity_services_edit_bookmark_76@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@2x.png new file mode 100644 index 0000000..4888abe3 --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@3x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@3x.png new file mode 100644 index 0000000..1a8f8d31 --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_60@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_76@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_76@2x.png new file mode 100644 index 0000000..a0777edf --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_edit_bookmark.imageset/activity_services_edit_bookmark_76@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/Contents.json b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/Contents.json new file mode 100644 index 0000000..029fe1a --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/Contents.json
@@ -0,0 +1,31 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "filename" : "activity_services_read_later_60@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "filename" : "activity_services_read_later_60@3x.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "filename" : "activity_services_read_later_76@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_60@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_60@2x.png new file mode 100644 index 0000000..0e6fb50b --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_60@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_60@3x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_60@3x.png new file mode 100644 index 0000000..6bc9c79d --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_60@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_76@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_76@2x.png new file mode 100644 index 0000000..234026a6 --- /dev/null +++ b/ios/chrome/browser/ui/activity_services/resources/activity_services_read_later.imageset/activity_services_read_later_76@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/Contents.json b/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/Contents.json deleted file mode 100644 index 7baa6596..0000000 --- a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/Contents.json +++ /dev/null
@@ -1,23 +0,0 @@ -{ - "images": [ - { - "idiom": "universal", - "scale": "1x", - "filename": "activity_services_reading_list.png" - }, - { - "idiom": "universal", - "scale": "2x", - "filename": "activity_services_reading_list@2x.png" - }, - { - "idiom": "universal", - "scale": "3x", - "filename": "activity_services_reading_list@3x.png" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -}
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list.png deleted file mode 100644 index 7b26c42..0000000 --- a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list@2x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list@2x.png deleted file mode 100644 index 280a2fd..0000000 --- a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list@2x.png +++ /dev/null Binary files differ
diff --git a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list@3x.png b/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list@3x.png deleted file mode 100644 index 0f6dcbfe..0000000 --- a/ios/chrome/browser/ui/activity_services/resources/activity_services_reading_list.imageset/activity_services_reading_list@3x.png +++ /dev/null Binary files differ
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 9d4dcc1f..cdc92a8 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
@@ -218,11 +218,22 @@ NSString* view_name = NSStringFromClass([view class]); // Views that don't display strings. NSArray* other_views = @[ - @"AccountControlCell", @"CollectionViewFooterCell", @"UIButtonLabel", - @"UICollectionView", @"UICollectionViewControllerWrapperView", - @"UIImageView", @"UIView", @"MDCActivityIndicator", @"MDCButtonBar", - @"MDCFlexibleHeaderView", @"MDCHeaderStackView", @"MDCInkView", - @"MDCNavigationBar", @"UIScrollView", @"IdentityPickerView" + @"AccountControlCell", + @"CollectionViewFooterCell", + @"IdentityPickerView", + @"IdentityView", + @"UIButtonLabel", + @"MDCActivityIndicator", + @"MDCButtonBar", + @"MDCFlexibleHeaderView", + @"MDCHeaderStackView", + @"MDCInkView", + @"MDCNavigationBar", + @"UICollectionView", + @"UICollectionViewControllerWrapperView", + @"UIImageView", + @"UIScrollView", + @"UIView", ]; // If this test fails, the unknown class should be added in other_views if // it doesn't display any strings, otherwise the strings diplay by this
diff --git a/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm b/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm index 3e3a5de5..10062672 100644 --- a/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm +++ b/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm
@@ -123,8 +123,7 @@ signin_metrics::RecordSigninUserActionForAccessPoint( signin_metrics::AccessPoint::ACCESS_POINT_RESIGNIN_INFOBAR, signin_metrics::PromoAction::PROMO_ACTION_NO_SIGNIN_PROMO); - UIView* infobarView = static_cast<InfoBarIOS*>(infobar())->view(); - DCHECK(infobarView); + DCHECK(static_cast<InfoBarIOS*>(infobar())->view()); ShowSigninCommand* command = [[ShowSigninCommand alloc] initWithOperation:AUTHENTICATION_OPERATION_REAUTHENTICATE accessPoint:signin_metrics::AccessPoint::
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn b/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn index 3179a17..17f6153 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn +++ b/ios/chrome/browser/ui/authentication/unified_consent/BUILD.gn
@@ -26,6 +26,8 @@ sources = [ "identity_picker_view.h", "identity_picker_view.mm", + "identity_view.h", + "identity_view.mm", "unified_consent_view_controller.h", "unified_consent_view_controller.mm", ]
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.mm b/ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.mm index 9e83887..b9efc3195 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.mm +++ b/ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.h" #include "base/logging.h" +#import "ios/chrome/browser/ui/authentication/unified_consent/identity_view.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/constraints_ui_util.h" #import "ios/third_party/material_components_ios/src/components/Ink/src/MaterialInk.h" @@ -17,43 +18,27 @@ const CGFloat kIdentityPickerViewRadius = 8.; // Sizes. -const CGFloat kIdentityAvatarSize = 40.; -const CGFloat kTitleFontSize = 14.; -const CGFloat kSubtitleFontSize = 12.; const CGFloat kArrowDownSize = 24.; // Distances/margins. -const CGFloat kTitleOffset = 2; const CGFloat kArrowDownMargin = 12.; const CGFloat kHorizontalAvatarMargin = 16.; const CGFloat kVerticalMargin = 12.; // Colors const int kHeaderBackgroundColor = 0xf1f3f4; -const CGFloat kTitleTextColorAlpha = .87; -const CGFloat kSubtitleTextColorAlpha = .54; } // namespace @interface IdentityPickerView () -@property(nonatomic) UIImageView* avatarImageView; -@property(nonatomic) UILabel* title; -@property(nonatomic) UILabel* subtitle; -@property(nonatomic) MDCInkView* inkView; -@property(nonatomic) NSLayoutConstraint* titleConstraintForNameAndEmail; -@property(nonatomic) NSLayoutConstraint* titleConstraintForEmailOnly; +@property(nonatomic, strong) IdentityView* identityView; +@property(nonatomic, strong) MDCInkView* inkView; @end @implementation IdentityPickerView -@synthesize avatarImageView = _avatarImageView; -@synthesize title = _title; -@synthesize subtitle = _subtitle; +@synthesize identityView = _identityView; @synthesize inkView = _inkView; -// Constraints when email and name are available. -@synthesize titleConstraintForNameAndEmail = _titleConstraintForNameAndEmail; -// Constraints when only the email is avaiable. -@synthesize titleConstraintForEmailOnly = _titleConstraintForEmailOnly; - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; @@ -68,11 +53,6 @@ _inkView.translatesAutoresizingMaskIntoConstraints = NO; [self addSubview:_inkView]; - // Avatar view. - _avatarImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; - _avatarImageView.translatesAutoresizingMaskIntoConstraints = NO; - [self addSubview:_avatarImageView]; - // Arrow down. UIImageView* arrowDownImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; @@ -81,61 +61,33 @@ [UIImage imageNamed:@"identity_picker_view_arrow_down"]; [self addSubview:arrowDownImageView]; - // Title. - _title = [[UILabel alloc] initWithFrame:CGRectZero]; - _title.translatesAutoresizingMaskIntoConstraints = NO; - _title.textColor = [UIColor colorWithWhite:0 alpha:kTitleTextColorAlpha]; - _title.font = [UIFont systemFontOfSize:kTitleFontSize]; - [self addSubview:_title]; - - // Subtitle. - _subtitle = [[UILabel alloc] initWithFrame:CGRectZero]; - _subtitle.translatesAutoresizingMaskIntoConstraints = NO; - _subtitle.textColor = - [UIColor colorWithWhite:0 alpha:kSubtitleTextColorAlpha]; - _subtitle.font = [UIFont systemFontOfSize:kSubtitleFontSize]; - [self addSubview:_subtitle]; + // Main view with avatar, name and email. + _identityView = [[IdentityView alloc] initWithFrame:CGRectZero]; + _identityView.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:_identityView]; // Layout constraints. NSDictionary* views = @{ - @"avatar" : _avatarImageView, - @"title" : _title, - @"subtitle" : _subtitle, + @"identityview" : _identityView, @"arrow" : arrowDownImageView, }; NSDictionary* metrics = @{ - @"ArMrg" : @(kArrowDownMargin), + @"ArrowMargin" : @(kArrowDownMargin), @"ArrowSize" : @(kArrowDownSize), - @"AvatarSize" : @(kIdentityAvatarSize), @"HAvatMrg" : @(kHorizontalAvatarMargin), @"VMargin" : @(kVerticalMargin), }; NSArray* constraints = @[ // Horizontal constraints. - @"H:|-(HAvatMrg)-[avatar]-(HAvatMrg)-[title]-(ArMrg)-[arrow]-(ArMrg)-|", + @"H:|[identityview]-(ArrowMargin)-[arrow]-(ArrowMargin)-|", // Vertical constraints. - @"V:|-(>=VMargin)-[avatar]-(>=VMargin)-|", - @"V:|-(>=VMargin)-[title]", - @"V:[subtitle]-(>=VMargin)-|", + @"V:|[identityview]|", // Size constraints. - @"H:[avatar(AvatarSize)]", - @"V:[avatar(AvatarSize)]", @"H:[arrow(ArrowSize)]", @"V:[arrow(ArrowSize)]", ]; - AddSameCenterYConstraint(self, _avatarImageView); AddSameCenterYConstraint(self, arrowDownImageView); ApplyVisualConstraintsWithMetrics(constraints, views, metrics); - AddSameConstraintsToSides(_title, _subtitle, - LayoutSides::kLeading | LayoutSides::kTrailing); - _titleConstraintForNameAndEmail = - [self.centerYAnchor constraintEqualToAnchor:_title.bottomAnchor - constant:kTitleOffset]; - _titleConstraintForEmailOnly = - [self.centerYAnchor constraintEqualToAnchor:_title.centerYAnchor]; - [self.centerYAnchor constraintEqualToAnchor:_subtitle.topAnchor - constant:-kTitleOffset] - .active = YES; } return self; } @@ -143,24 +95,12 @@ #pragma mark - Setter - (void)setIdentityAvatar:(UIImage*)identityAvatar { - _avatarImageView.image = - CircularImageFromImage(identityAvatar, kIdentityAvatarSize); + [self.identityView setAvatar:identityAvatar]; } - (void)setIdentityName:(NSString*)name email:(NSString*)email { DCHECK(email); - if (!name || name.length == 0) { - self.titleConstraintForNameAndEmail.active = NO; - self.titleConstraintForEmailOnly.active = YES; - self.subtitle.hidden = YES; - self.title.text = email; - } else { - self.titleConstraintForEmailOnly.active = NO; - self.titleConstraintForNameAndEmail.active = YES; - self.subtitle.hidden = NO; - self.title.text = name; - self.subtitle.text = email; - } + [self.identityView setName:name email:email]; } #pragma mark - Private
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/identity_view.h b/ios/chrome/browser/ui/authentication/unified_consent/identity_view.h new file mode 100644 index 0000000..53b1805 --- /dev/null +++ b/ios/chrome/browser/ui/authentication/unified_consent/identity_view.h
@@ -0,0 +1,39 @@ +// 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 IOS_CHROME_BROWSER_UI_AUTHENTICATION_UNIFIED_CONSENT_IDENTITY_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_UNIFIED_CONSENT_IDENTITY_VIEW_H_ + +#import <UIKit/UIKit.h> + +// View with the avatar on the leading side, the name and the email address of +// an identity. +// The email address is required. The name and the avatar are optional. +// If the name is empty (or nil), then the email address is vertically centered. +// The avatar is displayed as a round image. +// +--------------------------------+ +// | +------+ | +// | | | Full Name | +// | |Avatar| Email address | +// | +------+ | +// +--------------------------------+ +@interface IdentityView : UIView + +// Initialises IdentityView. +- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; + +// See -[IdentityView initWithFrame:]. +- (instancetype)init NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; + +// Sets the avatar shown. The image is resized (40px) and shaped as a round +// image. +- (void)setAvatar:(UIImage*)avatar; + +// Sets the name and the email address. |name| can be nil. +- (void)setName:(NSString*)name email:(NSString*)email; + +@end + +#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_UNIFIED_CONSENT_IDENTITY_VIEW_H_
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/identity_view.mm b/ios/chrome/browser/ui/authentication/unified_consent/identity_view.mm new file mode 100644 index 0000000..814ed2b --- /dev/null +++ b/ios/chrome/browser/ui/authentication/unified_consent/identity_view.mm
@@ -0,0 +1,143 @@ +// 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. + +#import "ios/chrome/browser/ui/authentication/unified_consent/identity_view.h" + +#include "base/logging.h" +#import "ios/chrome/browser/ui/uikit_ui_util.h" +#import "ios/chrome/browser/ui/util/constraints_ui_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +// Sizes. +const CGFloat kAvatarSize = 40.; +const CGFloat kTitleFontSize = 14.; +const CGFloat kSubtitleFontSize = 12.; +// Distances/margins. +const CGFloat kTitleOffset = 2; +const CGFloat kHorizontalAvatarMargin = 16.; +const CGFloat kVerticalMargin = 12.; +// Colors +const CGFloat kTitleTextColorAlpha = .87; +const CGFloat kSubtitleTextColorAlpha = .54; + +} // namespace + +@interface IdentityView () + +// Avatar. +@property(nonatomic, strong) UIImageView* avatarView; +// Contains the name if it exists, otherwise it contains the email. +@property(nonatomic, strong) UILabel* title; +// Contains the email if the name exists, otherwise it is hidden. +@property(nonatomic, strong) UILabel* subtitle; +// Constraints if the name exists. +@property(nonatomic, strong) NSLayoutConstraint* titleConstraintForNameAndEmail; +// Constraints if the name doesn't exist. +@property(nonatomic, strong) NSLayoutConstraint* titleConstraintForEmailOnly; + +@end + +@implementation IdentityView + +@synthesize avatarView = _avatarView; +@synthesize title = _title; +@synthesize subtitle = _subtitle; +// Constraints when email and name are available. +@synthesize titleConstraintForNameAndEmail = _titleConstraintForNameAndEmail; +// Constraints when only the email is available. +@synthesize titleConstraintForEmailOnly = _titleConstraintForEmailOnly; + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + // Avatar view. + _avatarView = [[UIImageView alloc] init]; + _avatarView.translatesAutoresizingMaskIntoConstraints = NO; + [self addSubview:_avatarView]; + + // Title. + _title = [[UILabel alloc] init]; + _title.translatesAutoresizingMaskIntoConstraints = NO; + _title.textColor = [UIColor colorWithWhite:0 alpha:kTitleTextColorAlpha]; + _title.font = [UIFont systemFontOfSize:kTitleFontSize]; + [self addSubview:_title]; + + // Subtitle. + _subtitle = [[UILabel alloc] init]; + _subtitle.translatesAutoresizingMaskIntoConstraints = NO; + _subtitle.textColor = + [UIColor colorWithWhite:0 alpha:kSubtitleTextColorAlpha]; + _subtitle.font = [UIFont systemFontOfSize:kSubtitleFontSize]; + [self addSubview:_subtitle]; + + // Layout constraints. + NSDictionary* views = @{ + @"avatar" : _avatarView, + @"title" : _title, + @"subtitle" : _subtitle, + }; + NSDictionary* metrics = @{ + @"AvatarSize" : @(kAvatarSize), + @"HAvatarMargin" : @(kHorizontalAvatarMargin), + @"VMargin" : @(kVerticalMargin), + }; + NSArray* constraints = @[ + // Horizontal constraints. + @"H:|-(HAvatarMargin)-[avatar]-(HAvatarMargin)-[title]|", + // Vertical constraints. + @"V:|-(>=VMargin)-[avatar]-(>=VMargin)-|", + @"V:|-(>=VMargin)-[title]", + @"V:[subtitle]-(>=VMargin)-|", + // Size constraints. + @"H:[avatar(AvatarSize)]", + @"V:[avatar(AvatarSize)]", + ]; + AddSameCenterYConstraint(self, _avatarView); + ApplyVisualConstraintsWithMetrics(constraints, views, metrics); + AddSameConstraintsToSides(_title, _subtitle, + LayoutSides::kLeading | LayoutSides::kTrailing); + _titleConstraintForNameAndEmail = + [self.centerYAnchor constraintEqualToAnchor:_title.bottomAnchor + constant:kTitleOffset]; + _titleConstraintForEmailOnly = + [self.centerYAnchor constraintEqualToAnchor:_title.centerYAnchor]; + [self.centerYAnchor constraintEqualToAnchor:_subtitle.topAnchor + constant:-kTitleOffset] + .active = YES; + } + return self; +} + +#pragma mark - Setter + +- (void)setAvatar:(UIImage*)avatarImage { + if (avatarImage) { + self.avatarView.image = CircularImageFromImage(avatarImage, kAvatarSize); + } else { + self.avatarView.image = nil; + } +} + +- (void)setName:(NSString*)name email:(NSString*)email { + DCHECK(email); + if (!name || name.length == 0) { + self.titleConstraintForNameAndEmail.active = NO; + self.titleConstraintForEmailOnly.active = YES; + self.subtitle.hidden = YES; + self.title.text = email; + } else { + self.titleConstraintForEmailOnly.active = NO; + self.titleConstraintForNameAndEmail.active = YES; + self.subtitle.hidden = NO; + self.title.text = name; + self.subtitle.text = email; + } +} + +@end
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 7393344..645bf69 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -432,6 +432,7 @@ TabHistoryPresentation, TabModelObserver, TabStripPresentation, + ToolbarHeightProviderForFullscreen, ToolsMenuConfigurationProvider, UIGestureRecognizerDelegate, UpgradeCenterClient, @@ -1273,7 +1274,7 @@ } - (BOOL)isToolbarOnScreen { - return self.headerHeight - [self currentHeaderOffset] > 0; + return [self nonFullscreenToolbarHeight] - [self currentHeaderOffset] > 0; } - (void)setInNewTabAnimation:(BOOL)inNewTabAnimation { @@ -2597,9 +2598,11 @@ - (CardView*)addCardViewInFullscreen:(BOOL)fullScreen { CGRect frame = self.contentArea.frame; + // Changing the origin here is unnecessary, it's set in page_animation_util. if (!fullScreen) { - // Changing the origin here is unnecessary, it's set in page_animation_util. frame.size.height -= self.headerHeight; + } else if (base::FeatureList::IsEnabled(kBrowserContainerFullscreen)) { + frame.size.height -= StatusBarHeight(); } CGFloat shortAxis = frame.size.width; @@ -3982,6 +3985,19 @@ } } +#pragma mark - ToolbarHeightProviderForFullscreen + +- (CGFloat)nonFullscreenToolbarHeight { + CGFloat toolbarHeightFullscreen = 0; + if (IsUIRefreshPhase1Enabled()) { + toolbarHeightFullscreen = kToolbarHeightFullscreen; + } + if (base::FeatureList::IsEnabled(kBrowserContainerFullscreen)) { + toolbarHeightFullscreen += StatusBarHeight(); + } + return MAX(0, self.headerHeight - toolbarHeightFullscreen); +} + #pragma mark - FullscreenUIElement methods - (void)updateForFullscreenProgress:(CGFloat)progress { @@ -4053,12 +4069,8 @@ // progress of 1.0 fully shows the headers and a progress of 0.0 fully hides // them. - (void)updateHeadersForFullscreenProgress:(CGFloat)progress { - CGFloat toolbarHeightFullscreen = 0; - if (IsUIRefreshPhase1Enabled()) { - toolbarHeightFullscreen = kToolbarHeightFullscreen; - } - CGFloat offset = AlignValueToPixel( - (1.0 - progress) * ([self toolbarHeight] - toolbarHeightFullscreen)); + CGFloat offset = + AlignValueToPixel((1.0 - progress) * [self nonFullscreenToolbarHeight]); [self setFramesForHeaders:[self headerViews] atOffset:offset]; } @@ -4106,13 +4118,10 @@ if (self.currentWebState) { UIEdgeInsets contentPadding = self.currentWebState->GetWebViewProxy().contentInset; - CGFloat toolbarHeightFullscreen = 0; - if (IsUIRefreshPhase1Enabled()) { - toolbarHeightFullscreen = kToolbarHeightFullscreen; - } - CGFloat toolbarHeightDelta = [self toolbarHeight] - toolbarHeightFullscreen; - contentPadding.top = AlignValueToPixel(toolbarHeightFullscreen + - progress * toolbarHeightDelta); + CGFloat toolbarHeightFullscreen = + self.headerHeight - [self nonFullscreenToolbarHeight]; + contentPadding.top = AlignValueToPixel( + toolbarHeightFullscreen + progress * [self nonFullscreenToolbarHeight]); contentPadding.bottom = AlignValueToPixel(progress * [self secondaryToolbarHeightWithInset]); self.currentWebState->GetWebViewProxy().contentInset = contentPadding; @@ -4936,10 +4945,6 @@ #pragma mark - ToolbarOwner (Public) -- (CGFloat)toolbarHeight { - return self.headerHeight; -} - - (CGRect)toolbarFrame { return _toolbarCoordinator.viewController.view.frame; } @@ -5181,6 +5186,10 @@ [self snapshotEdgeInsetsForWebState:topTab.webState]); } else { imageFrame = [topTab.webState->GetView() bounds]; + if (base::FeatureList::IsEnabled(kBrowserContainerFullscreen)) { + imageFrame.origin.y += StatusBarHeight(); + imageFrame.size.height -= StatusBarHeight(); + } } // Add three layers in order on top of the contentArea for the animation:
diff --git a/ios/chrome/browser/ui/infobars/BUILD.gn b/ios/chrome/browser/ui/infobars/BUILD.gn index cb06930..210a51c 100644 --- a/ios/chrome/browser/ui/infobars/BUILD.gn +++ b/ios/chrome/browser/ui/infobars/BUILD.gn
@@ -5,9 +5,10 @@ source_set("infobars") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ - "infobar_view.h", - "infobar_view.mm", - "infobar_view_delegate.h", + "confirm_infobar_view.h", + "confirm_infobar_view.mm", + "infobar_view_sizing.h", + "infobar_view_sizing_delegate.h", ] deps = [ "resources:infobar_close", @@ -41,7 +42,7 @@ configs += [ "//build/config/compiler:enable_arc" ] testonly = true sources = [ - "infobar_view_unittest.mm", + "confirm_infobar_view_unittest.mm", ] deps = [ ":infobars",
diff --git a/ios/chrome/browser/ui/infobars/infobar_view.h b/ios/chrome/browser/ui/infobars/confirm_infobar_view.h similarity index 77% rename from ios/chrome/browser/ui/infobars/infobar_view.h rename to ios/chrome/browser/ui/infobars/confirm_infobar_view.h index 8550e31..ae6d1850 100644 --- a/ios/chrome/browser/ui/infobars/infobar_view.h +++ b/ios/chrome/browser/ui/infobars/confirm_infobar_view.h
@@ -1,31 +1,21 @@ // Copyright (c) 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. -#ifndef IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ -#define IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ + +#ifndef IOS_CHROME_BROWSER_UI_INFOBARS_CONFIRM_INFOBAR_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_INFOBARS_CONFIRM_INFOBAR_VIEW_H_ #import <UIKit/UIKit.h> #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" +#import "ios/chrome/browser/ui/infobars/infobar_view_sizing.h" -class InfoBarViewDelegate; - -// UIView representing a single infobar. -@interface InfoBarView : BidiContainerView - -- (instancetype)initWithFrame:(CGRect)frame - delegate:(InfoBarViewDelegate*)delegate; - -// How much of infobar is visible. The infobar is only partly visible during -// showing/hiding animation. -@property(nonatomic, assign) CGFloat visibleHeight; +// An inforbar with an optional message, icon, two action buttons, and a switch. +@interface ConfirmInfoBarView : BidiContainerView<InfoBarViewSizing> // Label text with links initialized with |stringAsLink:|. @property(nonatomic, strong, readonly) NSString* markedLabel; -// Stops propagating events to delegate. -- (void)resetDelegate; - // TODO(crbug.com/302582): rename methods from add* to set*. // Adds a dismiss button subview. - (void)addCloseButtonWithTag:(NSInteger)tag @@ -72,4 +62,4 @@ @end -#endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ +#endif // IOS_CHROME_BROWSER_UI_INFOBARS_CONFIRM_INFOBAR_VIEW_H_
diff --git a/ios/chrome/browser/ui/infobars/infobar_view.mm b/ios/chrome/browser/ui/infobars/confirm_infobar_view.mm similarity index 97% rename from ios/chrome/browser/ui/infobars/infobar_view.mm rename to ios/chrome/browser/ui/infobars/confirm_infobar_view.mm index c55473f2..f9b5a03 100644 --- a/ios/chrome/browser/ui/infobars/infobar_view.mm +++ b/ios/chrome/browser/ui/infobars/confirm_infobar_view.mm
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "ios/chrome/browser/ui/infobars/infobar_view.h" +#import "ios/chrome/browser/ui/infobars/confirm_infobar_view.h" #import <CoreGraphics/CoreGraphics.h> #import <QuartzCore/QuartzCore.h> @@ -14,7 +14,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" -#import "ios/chrome/browser/ui/infobars/infobar_view_delegate.h" +#import "ios/chrome/browser/ui/infobars/infobar_view_sizing_delegate.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/label_link_controller.h" @@ -277,7 +277,7 @@ @end -@interface InfoBarView (Testing) +@interface ConfirmInfoBarView (Testing) // Returns the buttons' height. - (CGFloat)buttonsHeight; // Returns the button margin applied in some views. @@ -307,7 +307,7 @@ - (const std::vector<std::pair<NSUInteger, NSRange>>&)linkRanges; @end -@interface InfoBarView () +@interface ConfirmInfoBarView () // Returns the marker delimiting the start of a link. + (NSString*)openingMarkerForLink; @@ -316,12 +316,7 @@ @end -@implementation InfoBarView { - // Delegates UIView events. - InfoBarViewDelegate* delegate_; // weak. - // The current height of this infobar (used for animations where part of the - // infobar is hidden). - CGFloat visibleHeight_; +@implementation ConfirmInfoBarView { // The height of this infobar when fully visible. CGFloat targetHeight_; // View containing the icon. @@ -352,12 +347,11 @@ } @synthesize visibleHeight = visibleHeight_; +@synthesize delegate = delegate_; -- (instancetype)initWithFrame:(CGRect)frame - delegate:(InfoBarViewDelegate*)delegate { +- (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { - delegate_ = delegate; metrics_ = InfoBarLayoutMetrics(); if (!IsRefreshInfobarEnabled()) { // Make the drop shadow. @@ -372,15 +366,10 @@ return self; } - - (NSString*)markedLabel { return markedLabel_; } -- (void)resetDelegate { - delegate_ = NULL; -} - // Returns the width reserved for the icon. - (CGFloat)leftMarginOnFirstLine { CGFloat leftMargin = 0; @@ -763,7 +752,7 @@ targetHeight_ = [self computeRequiredHeightAndLayoutSubviews:YES]; if (delegate_) - delegate_->SetInfoBarTargetHeight(targetHeight_); + [delegate_ didSetInfoBarTargetHeight:targetHeight_]; [self resetBackground]; // Asks the BidiContainerView to reposition of all the subviews. @@ -830,7 +819,7 @@ for (;;) { // Find the opening marker, followed by the tag between parentheses. NSRange startingRange = - [string rangeOfString:[[InfoBarView openingMarkerForLink] + [string rangeOfString:[[ConfirmInfoBarView openingMarkerForLink] stringByAppendingString:@"("]]; if (!startingRange.length) return [string copy]; @@ -852,7 +841,7 @@ startingRange.length = closingParenthesis.location - startingRange.location + 1; NSRange endingRange = - [string rangeOfString:[InfoBarView closingMarkerForLink]]; + [string rangeOfString:[ConfirmInfoBarView closingMarkerForLink]]; DCHECK(endingRange.length); // Compute range of link in stripped string and add it to the array. NSRange rangeOfLinkInStrippedString = @@ -1040,8 +1029,9 @@ + (NSString*)stringAsLink:(NSString*)string tag:(NSUInteger)tag { DCHECK_NE(0u, tag); return [NSString stringWithFormat:@"%@(%" PRIuNS ")%@%@", - [InfoBarView openingMarkerForLink], tag, - string, [InfoBarView closingMarkerForLink]]; + [ConfirmInfoBarView openingMarkerForLink], + tag, string, + [ConfirmInfoBarView closingMarkerForLink]]; } #pragma mark - Testing
diff --git a/ios/chrome/browser/ui/infobars/confirm_infobar_view_unittest.mm b/ios/chrome/browser/ui/infobars/confirm_infobar_view_unittest.mm new file mode 100644 index 0000000..953fd8b1 --- /dev/null +++ b/ios/chrome/browser/ui/infobars/confirm_infobar_view_unittest.mm
@@ -0,0 +1,193 @@ +// Copyright 2013 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/ui/infobars/confirm_infobar_view.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/gtest_mac.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface ConfirmInfoBarView (Testing) +- (CGFloat)buttonsHeight; +- (CGFloat)buttonMargin; +- (CGFloat)computeRequiredHeightAndLayoutSubviews:(BOOL)layout; +- (CGFloat)heightThatFitsButtonsUnderOtherWidgets:(CGFloat)heightOfFirstLine + layout:(BOOL)layout; +- (CGFloat)minimumInfobarHeight; +- (NSString*)stripMarkersFromString:(NSString*)string; +- (const std::vector<std::pair<NSUInteger, NSRange>>&)linkRanges; +@end + +namespace { + +const int kShortStringLength = 4; +const int kLongStringLength = 1000; + +class ConfirmInfoBarViewTest : public PlatformTest { + protected: + void SetUp() override { + PlatformTest::SetUp(); + CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width; + confirmInfobarView_ = [[ConfirmInfoBarView alloc] + initWithFrame:CGRectMake(0, 0, screenWidth, 0)]; + [confirmInfobarView_ addCloseButtonWithTag:0 target:nil action:nil]; + } + + NSString* RandomString(int numberOfCharacters) { + NSMutableString* string = [NSMutableString string]; + NSString* letters = @"abcde "; + for (int i = 0; i < numberOfCharacters; i++) { + [string + appendFormat:@"%C", [letters characterAtIndex:arc4random_uniform( + [letters length])]]; + } + return string; + } + + NSString* ShortRandomString() { return RandomString(kShortStringLength); } + + NSString* LongRandomString() { return RandomString(kLongStringLength); } + + CGFloat InfobarHeight() { + return [confirmInfobarView_ computeRequiredHeightAndLayoutSubviews:NO]; + } + + CGFloat MinimumInfobarHeight() { + return [confirmInfobarView_ minimumInfobarHeight]; + } + + CGFloat ButtonsHeight() { return [confirmInfobarView_ buttonsHeight]; } + + CGFloat ButtonMargin() { return [confirmInfobarView_ buttonMargin]; } + + void TestLinkDetectionHelper( + NSString* input, + NSString* expectedOutput, + const std::vector<std::pair<NSUInteger, NSRange>>& expectedRanges) { + NSString* output = [confirmInfobarView_ stripMarkersFromString:input]; + EXPECT_NSEQ(expectedOutput, output); + const std::vector<std::pair<NSUInteger, NSRange>>& ranges = + [confirmInfobarView_ linkRanges]; + EXPECT_EQ(expectedRanges.size(), ranges.size()); + for (unsigned int i = 0; i < expectedRanges.size(); ++i) { + EXPECT_EQ(expectedRanges[i].first, ranges[i].first); + EXPECT_TRUE(NSEqualRanges(expectedRanges[i].second, ranges[i].second)); + } + } + + ConfirmInfoBarView* confirmInfobarView_; +}; + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithNoLabel) { + // Do not call -addLabel: to test the case when there is no label. + EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithShortLabel) { + [confirmInfobarView_ addLabel:ShortRandomString()]; + EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithLongLabel) { + [confirmInfobarView_ addLabel:LongRandomString()]; + EXPECT_LT(MinimumInfobarHeight(), InfobarHeight()); + EXPECT_EQ(0, [confirmInfobarView_ heightThatFitsButtonsUnderOtherWidgets:0 + layout:NO]); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithShortButtons) { + [confirmInfobarView_ addLabel:ShortRandomString()]; + [confirmInfobarView_ addButton1:ShortRandomString() + tag1:0 + button2:ShortRandomString() + tag2:0 + target:nil + action:nil]; + EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); + EXPECT_EQ( + ButtonsHeight(), + [confirmInfobarView_ heightThatFitsButtonsUnderOtherWidgets:0 layout:NO]); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithOneLongButtonAndOneShortButton) { + [confirmInfobarView_ addLabel:ShortRandomString()]; + [confirmInfobarView_ addButton1:LongRandomString() + tag1:0 + button2:ShortRandomString() + tag2:0 + target:nil + action:nil]; + EXPECT_EQ(MinimumInfobarHeight() + ButtonsHeight() * 2 + ButtonMargin(), + InfobarHeight()); + EXPECT_EQ( + ButtonsHeight() * 2, + [confirmInfobarView_ heightThatFitsButtonsUnderOtherWidgets:0 layout:NO]); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithShortLabelAndShortButton) { + [confirmInfobarView_ addLabel:ShortRandomString()]; + [confirmInfobarView_ addButton:ShortRandomString() + tag:0 + target:nil + action:nil]; + EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithShortLabelAndLongButton) { + [confirmInfobarView_ addLabel:ShortRandomString()]; + [confirmInfobarView_ addButton:LongRandomString() + tag:0 + target:nil + action:nil]; + EXPECT_EQ(MinimumInfobarHeight() + ButtonsHeight() + ButtonMargin(), + InfobarHeight()); +} + +TEST_F(ConfirmInfoBarViewTest, TestLayoutWithLongLabelAndLongButtons) { + [confirmInfobarView_ addLabel:LongRandomString()]; + [confirmInfobarView_ addButton1:ShortRandomString() + tag1:0 + button2:LongRandomString() + tag2:0 + target:nil + action:nil]; + EXPECT_LT(MinimumInfobarHeight() + ButtonsHeight() * 2, InfobarHeight()); +} + +TEST_F(ConfirmInfoBarViewTest, TestLinkDetection) { + [confirmInfobarView_ addLabel:ShortRandomString()]; + NSString* linkFoo = [ConfirmInfoBarView stringAsLink:@"foo" tag:1]; + NSString* linkBar = [ConfirmInfoBarView stringAsLink:@"bar" tag:2]; + std::vector<std::pair<NSUInteger, NSRange>> ranges; + // No link. + TestLinkDetectionHelper(@"", @"", ranges); + TestLinkDetectionHelper(@"foo", @"foo", ranges); + // One link. + ranges.push_back(std::make_pair(1, NSMakeRange(0, 3))); + TestLinkDetectionHelper(linkFoo, @"foo", ranges); + NSString* link1 = [NSString stringWithFormat:@"baz%@qux", linkFoo]; + // Link in the middle. + ranges.clear(); + ranges.push_back(std::make_pair(1, NSMakeRange(3, 3))); + TestLinkDetectionHelper(link1, @"bazfooqux", ranges); + // Multiple links. + NSString* link2 = [NSString stringWithFormat:@"%@%@", linkFoo, linkBar]; + ranges.clear(); + ranges.push_back(std::make_pair(1, NSMakeRange(0, 3))); + ranges.push_back(std::make_pair(2, NSMakeRange(3, 3))); + TestLinkDetectionHelper(link2, @"foobar", ranges); + // Multiple links and text. + NSString* link3 = + [NSString stringWithFormat:@"baz%@qux%@tot", linkFoo, linkBar]; + ranges.clear(); + ranges.push_back(std::make_pair(1, NSMakeRange(3, 3))); + ranges.push_back(std::make_pair(2, NSMakeRange(9, 3))); + TestLinkDetectionHelper(link3, @"bazfooquxbartot", ranges); +} + +} // namespace
diff --git a/ios/chrome/browser/ui/infobars/infobar_view_delegate.h b/ios/chrome/browser/ui/infobars/infobar_view_delegate.h deleted file mode 100644 index 6cbc7f2..0000000 --- a/ios/chrome/browser/ui/infobars/infobar_view_delegate.h +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2013 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_UI_INFOBARS_INFOBAR_VIEW_DELEGATE_H_ -#define IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_DELEGATE_H_ - -#import <Foundation/Foundation.h> - -// Interface for delegating events from infobar. -class InfoBarViewDelegate { - public: - // Notifies that the target size has been changed (e.g. after rotation). - virtual void SetInfoBarTargetHeight(int height) = 0; - - // Notifies that the close button was pressed. - virtual void InfoBarDidCancel() = 0; - - // Notifies that an infobar button was pressed. - virtual void InfoBarButtonDidPress(NSUInteger button_id) = 0; - - protected: - virtual ~InfoBarViewDelegate() {} -}; - -#endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_DELEGATE_H_
diff --git a/ios/chrome/browser/ui/infobars/infobar_view_sizing.h b/ios/chrome/browser/ui/infobars/infobar_view_sizing.h new file mode 100644 index 0000000..24fecfe8 --- /dev/null +++ b/ios/chrome/browser/ui/infobars/infobar_view_sizing.h
@@ -0,0 +1,26 @@ +// 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 IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_SIZING_H_ +#define IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_SIZING_H_ + +#import <UIKit/UIKit.h> + +@protocol InfoBarViewSizingDelegate; + +// Protocol implemented by UIView subclasses representing an infobar. It has +// information about the infobar's visible height and a reference to the +// delegate that gets notified of infobar's height changes. +@protocol InfoBarViewSizing + +// How much of the infobar (in points) is visible (e.g., during showing/hiding +// animation). +@property(nonatomic, assign) CGFloat visibleHeight; + +// The delegate that gets notified of infobar's height changes. +@property(nonatomic, weak) id<InfoBarViewSizingDelegate> delegate; + +@end + +#endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_SIZING_H_
diff --git a/ios/chrome/browser/ui/infobars/infobar_view_sizing_delegate.h b/ios/chrome/browser/ui/infobars/infobar_view_sizing_delegate.h new file mode 100644 index 0000000..2ce29bf --- /dev/null +++ b/ios/chrome/browser/ui/infobars/infobar_view_sizing_delegate.h
@@ -0,0 +1,18 @@ +// 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 IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_SIZING_DELEGATE_H_ +#define IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_SIZING_DELEGATE_H_ + +#import <Foundation/Foundation.h> + +// A protocol implemented by a delegate of InfoBarViewSizing. +@protocol InfoBarViewSizingDelegate + +// Notifies that the target size has been changed (e.g. after rotation). +- (void)didSetInfoBarTargetHeight:(CGFloat)height; + +@end + +#endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_SIZING_DELEGATE_H_
diff --git a/ios/chrome/browser/ui/infobars/infobar_view_unittest.mm b/ios/chrome/browser/ui/infobars/infobar_view_unittest.mm deleted file mode 100644 index 2e29452..0000000 --- a/ios/chrome/browser/ui/infobars/infobar_view_unittest.mm +++ /dev/null
@@ -1,184 +0,0 @@ -// Copyright 2013 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/ui/infobars/infobar_view.h" - -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/gtest_mac.h" -#include "testing/platform_test.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -@interface InfoBarView (Testing) -- (CGFloat)buttonsHeight; -- (CGFloat)buttonMargin; -- (CGFloat)computeRequiredHeightAndLayoutSubviews:(BOOL)layout; -- (CGFloat)heightThatFitsButtonsUnderOtherWidgets:(CGFloat)heightOfFirstLine - layout:(BOOL)layout; -- (CGFloat)minimumInfobarHeight; -- (NSString*)stripMarkersFromString:(NSString*)string; -- (const std::vector<std::pair<NSUInteger, NSRange>>&)linkRanges; -@end - -namespace { - -const int kShortStringLength = 4; -const int kLongStringLength = 1000; - -class InfoBarViewTest : public PlatformTest { - protected: - void SetUp() override { - PlatformTest::SetUp(); - CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width; - infobarView_ = - [[InfoBarView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 0) - delegate:NULL]; - [infobarView_ addCloseButtonWithTag:0 target:nil action:nil]; - } - - NSString* RandomString(int numberOfCharacters) { - NSMutableString* string = [NSMutableString string]; - NSString* letters = @"abcde "; - for (int i = 0; i < numberOfCharacters; i++) { - [string - appendFormat:@"%C", [letters characterAtIndex:arc4random_uniform( - [letters length])]]; - } - return string; - } - - NSString* ShortRandomString() { return RandomString(kShortStringLength); } - - NSString* LongRandomString() { return RandomString(kLongStringLength); } - - CGFloat InfobarHeight() { - return [infobarView_ computeRequiredHeightAndLayoutSubviews:NO]; - } - - CGFloat MinimumInfobarHeight() { return [infobarView_ minimumInfobarHeight]; } - - CGFloat ButtonsHeight() { return [infobarView_ buttonsHeight]; } - - CGFloat ButtonMargin() { return [infobarView_ buttonMargin]; } - - void TestLinkDetectionHelper( - NSString* input, - NSString* expectedOutput, - const std::vector<std::pair<NSUInteger, NSRange>>& expectedRanges) { - NSString* output = [infobarView_ stripMarkersFromString:input]; - EXPECT_NSEQ(expectedOutput, output); - const std::vector<std::pair<NSUInteger, NSRange>>& ranges = - [infobarView_ linkRanges]; - EXPECT_EQ(expectedRanges.size(), ranges.size()); - for (unsigned int i = 0; i < expectedRanges.size(); ++i) { - EXPECT_EQ(expectedRanges[i].first, ranges[i].first); - EXPECT_TRUE(NSEqualRanges(expectedRanges[i].second, ranges[i].second)); - } - } - - InfoBarView* infobarView_; -}; - -TEST_F(InfoBarViewTest, TestLayoutWithNoLabel) { - // Do not call -addLabel: to test the case when there is no label. - EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); -} - -TEST_F(InfoBarViewTest, TestLayoutWithShortLabel) { - [infobarView_ addLabel:ShortRandomString()]; - EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); -} - -TEST_F(InfoBarViewTest, TestLayoutWithLongLabel) { - [infobarView_ addLabel:LongRandomString()]; - EXPECT_LT(MinimumInfobarHeight(), InfobarHeight()); - EXPECT_EQ(0, - [infobarView_ heightThatFitsButtonsUnderOtherWidgets:0 layout:NO]); -} - -TEST_F(InfoBarViewTest, TestLayoutWithShortButtons) { - [infobarView_ addLabel:ShortRandomString()]; - [infobarView_ addButton1:ShortRandomString() - tag1:0 - button2:ShortRandomString() - tag2:0 - target:nil - action:nil]; - EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); - EXPECT_EQ(ButtonsHeight(), - [infobarView_ heightThatFitsButtonsUnderOtherWidgets:0 layout:NO]); -} - -TEST_F(InfoBarViewTest, TestLayoutWithOneLongButtonAndOneShortButton) { - [infobarView_ addLabel:ShortRandomString()]; - [infobarView_ addButton1:LongRandomString() - tag1:0 - button2:ShortRandomString() - tag2:0 - target:nil - action:nil]; - EXPECT_EQ(MinimumInfobarHeight() + ButtonsHeight() * 2 + ButtonMargin(), - InfobarHeight()); - EXPECT_EQ(ButtonsHeight() * 2, - [infobarView_ heightThatFitsButtonsUnderOtherWidgets:0 layout:NO]); -} - -TEST_F(InfoBarViewTest, TestLayoutWithShortLabelAndShortButton) { - [infobarView_ addLabel:ShortRandomString()]; - [infobarView_ addButton:ShortRandomString() tag:0 target:nil action:nil]; - EXPECT_EQ(MinimumInfobarHeight(), InfobarHeight()); -} - -TEST_F(InfoBarViewTest, TestLayoutWithShortLabelAndLongButton) { - [infobarView_ addLabel:ShortRandomString()]; - [infobarView_ addButton:LongRandomString() tag:0 target:nil action:nil]; - EXPECT_EQ(MinimumInfobarHeight() + ButtonsHeight() + ButtonMargin(), - InfobarHeight()); -} - -TEST_F(InfoBarViewTest, TestLayoutWithLongLabelAndLongButtons) { - [infobarView_ addLabel:LongRandomString()]; - [infobarView_ addButton1:ShortRandomString() - tag1:0 - button2:LongRandomString() - tag2:0 - target:nil - action:nil]; - EXPECT_LT(MinimumInfobarHeight() + ButtonsHeight() * 2, InfobarHeight()); -} - -TEST_F(InfoBarViewTest, TestLinkDetection) { - [infobarView_ addLabel:ShortRandomString()]; - NSString* linkFoo = [InfoBarView stringAsLink:@"foo" tag:1]; - NSString* linkBar = [InfoBarView stringAsLink:@"bar" tag:2]; - std::vector<std::pair<NSUInteger, NSRange>> ranges; - // No link. - TestLinkDetectionHelper(@"", @"", ranges); - TestLinkDetectionHelper(@"foo", @"foo", ranges); - // One link. - ranges.push_back(std::make_pair(1, NSMakeRange(0, 3))); - TestLinkDetectionHelper(linkFoo, @"foo", ranges); - NSString* link1 = [NSString stringWithFormat:@"baz%@qux", linkFoo]; - // Link in the middle. - ranges.clear(); - ranges.push_back(std::make_pair(1, NSMakeRange(3, 3))); - TestLinkDetectionHelper(link1, @"bazfooqux", ranges); - // Multiple links. - NSString* link2 = [NSString stringWithFormat:@"%@%@", linkFoo, linkBar]; - ranges.clear(); - ranges.push_back(std::make_pair(1, NSMakeRange(0, 3))); - ranges.push_back(std::make_pair(2, NSMakeRange(3, 3))); - TestLinkDetectionHelper(link2, @"foobar", ranges); - // Multiple links and text. - NSString* link3 = - [NSString stringWithFormat:@"baz%@qux%@tot", linkFoo, linkBar]; - ranges.clear(); - ranges.push_back(std::make_pair(1, NSMakeRange(3, 3))); - ranges.push_back(std::make_pair(2, NSMakeRange(9, 3))); - TestLinkDetectionHelper(link3, @"bazfooquxbartot", ranges); -} - -} // namespace
diff --git a/ios/chrome/browser/ui/keyboard_commands_egtest.mm b/ios/chrome/browser/ui/keyboard_commands_egtest.mm index d1bb85db..955384c 100644 --- a/ios/chrome/browser/ui/keyboard_commands_egtest.mm +++ b/ios/chrome/browser/ui/keyboard_commands_egtest.mm
@@ -200,10 +200,16 @@ [self verifyKeyboardCommandsAreRegistered]; UIResponder* firstResponder = GetFirstResponder(); - GREYAssert( - [firstResponder isKindOfClass:NSClassFromString(@"WKContentView")], - @"Expected first responder to be a WKContentView. Instead, is a %@", - NSStringFromClass([firstResponder class])); + if (@available(iOS 11.3, *)) { + GREYAssert([firstResponder isKindOfClass:NSClassFromString(@"WKWebView")], + @"Expected first responder to be a WKWebView. Instead, is a %@", + NSStringFromClass([firstResponder class])); + } else { + GREYAssert( + [firstResponder isKindOfClass:NSClassFromString(@"WKContentView")], + @"Expected first responder to be a WKContentView. Instead, is a %@", + NSStringFromClass([firstResponder class])); + } } @end
diff --git a/ios/chrome/browser/ui/tabs/tab_strip_controller.mm b/ios/chrome/browser/ui/tabs/tab_strip_controller.mm index aa1ec5e7..b24f145 100644 --- a/ios/chrome/browser/ui/tabs/tab_strip_controller.mm +++ b/ios/chrome/browser/ui/tabs/tab_strip_controller.mm
@@ -1106,9 +1106,8 @@ } - (void)tabModelDidChangeTabCount:(TabModel*)model { - const NSUInteger tabCount = [_tabArray count] - [_closingTabs count]; if (IsUIRefreshPhase1Enabled()) { - [_tabSwitcherButton setTitle:StringForItemCount(tabCount) + [_tabSwitcherButton setTitle:StringForItemCount(model.count) forState:UIControlStateNormal]; } } @@ -1171,6 +1170,7 @@ [_tabSwitcherButton addTarget:self action:@selector(recordUserMetrics:) forControlEvents:UIControlEventTouchUpInside]; + [self tabModelDidChangeTabCount:_tabModel]; SetA11yLabelAndUiAutomationName(_tabSwitcherButton, tabSwitcherButtonIdsAccessibilityLabel,
diff --git a/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.h b/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.h index f6e5e7a..a2d8fdc 100644 --- a/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.h +++ b/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.h
@@ -5,12 +5,18 @@ #ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_UI_UPDATER_H_ #define IOS_CHROME_BROWSER_UI_TOOLBAR_LEGACY_TOOLBAR_UI_UPDATER_H_ -#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> @protocol ToolbarOwner; @class ToolbarUIState; class WebStateList; +@protocol ToolbarHeightProviderForFullscreen +// Returns the height of the part of the toolbar that is only displayed when not +// in fullscreen. +- (CGFloat)nonFullscreenToolbarHeight; +@end + // Helper object that uses navigation events to update a ToolbarUIState. @interface LegacyToolbarUIUpdater : NSObject @@ -19,10 +25,10 @@ // Designated initializer that uses navigation events from |webStateList| and // the height provided by |toolbarOwner| to update |state|'s broadcast value. -- (nullable instancetype)initWithToolbarUI:(nonnull ToolbarUIState*)toolbarUI - toolbarOwner:(nonnull id<ToolbarOwner>)owner - webStateList:(nonnull WebStateList*)webStateList - NS_DESIGNATED_INITIALIZER; +- (nullable instancetype) +initWithToolbarUI:(nonnull ToolbarUIState*)toolbarUI + toolbarOwner:(nonnull id<ToolbarHeightProviderForFullscreen>)owner + webStateList:(nonnull WebStateList*)webStateList NS_DESIGNATED_INITIALIZER; - (nullable instancetype)init NS_UNAVAILABLE; // Starts updating |state|.
diff --git a/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.mm b/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.mm index 92688a99..61e7b2da 100644 --- a/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.mm +++ b/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater.mm
@@ -27,7 +27,8 @@ std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; } // The ToolbarOwner passed on initialization. -@property(nonatomic, readonly, strong) id<ToolbarOwner> owner; +@property(nonatomic, readonly, strong) id<ToolbarHeightProviderForFullscreen> + owner; // The WebStateList whose navigations are driving this updater. @property(nonatomic, readonly) WebStateList* webStateList; // The active WebState in |webStateList|. @@ -44,9 +45,10 @@ @synthesize webStateList = _webStateList; @synthesize webState = _webState; -- (nullable instancetype)initWithToolbarUI:(nonnull ToolbarUIState*)toolbarUI - toolbarOwner:(nonnull id<ToolbarOwner>)owner - webStateList:(nonnull WebStateList*)webStateList { +- (nullable instancetype) +initWithToolbarUI:(nonnull ToolbarUIState*)toolbarUI + toolbarOwner:(nonnull id<ToolbarHeightProviderForFullscreen>)owner + webStateList:(nonnull WebStateList*)webStateList { if (self = [super init]) { _toolbarUI = toolbarUI; DCHECK(_toolbarUI); @@ -136,7 +138,7 @@ #pragma mark Private - (void)updateState { - self.toolbarUI.toolbarHeight = [self.owner toolbarHeight]; + self.toolbarUI.toolbarHeight = [self.owner nonFullscreenToolbarHeight]; } @end
diff --git a/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater_unittest.mm b/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater_unittest.mm index a562948a..1d8b9ce1 100644 --- a/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater_unittest.mm +++ b/ios/chrome/browser/ui/toolbar/legacy_toolbar_ui_updater_unittest.mm
@@ -20,18 +20,14 @@ #error "This file requires ARC support." #endif -@interface TestToolbarOwner : NSObject<ToolbarOwner> -// Define writable property with same name as |-toolbarHeight| getter defined in -// ToolbarOwner. -@property(nonatomic, assign) CGFloat toolbarHeight; +@interface TestToolbarOwner : NSObject<ToolbarHeightProviderForFullscreen> +// Define writable property with same name as |-nonFullscreenToolbarHeight| +// getter defined in ToolbarHeightProviderForFullscreen. +@property(nonatomic, assign) CGFloat nonFullscreenToolbarHeight; @end @implementation TestToolbarOwner -@synthesize toolbarHeight = _toolbarHeight; -@synthesize toolbarSnapshotProvider = _toolbarSnapshotProvider; -- (CGRect)toolbarFrame { - return CGRectZero; -} +@synthesize nonFullscreenToolbarHeight = _nonFullscreenToolbarHeight; @end class LegacyToolbarUIUpdaterTest : public PlatformTest { @@ -91,7 +87,7 @@ TEST_F(LegacyToolbarUIUpdaterTest, StartUpdating) { EXPECT_EQ(toolbar_height(), 0.0); const CGFloat kHeight = 150.0; - toolbar_owner().toolbarHeight = kHeight; + toolbar_owner().nonFullscreenToolbarHeight = kHeight; StartUpdating(); EXPECT_EQ(toolbar_height(), kHeight); } @@ -101,13 +97,13 @@ web::TestWebState* web_state = InsertActiveWebState(); StartUpdating(); const CGFloat kHeight = 150.0; - toolbar_owner().toolbarHeight = kHeight; + toolbar_owner().nonFullscreenToolbarHeight = kHeight; web::FakeNavigationContext context; web_state->OnNavigationFinished(&context); EXPECT_EQ(toolbar_height(), kHeight); const CGFloat kNonUpdatedHeight = 500.0; StopUpdating(); - toolbar_owner().toolbarHeight = kNonUpdatedHeight; + toolbar_owner().nonFullscreenToolbarHeight = kNonUpdatedHeight; web_state->OnNavigationFinished(&context); EXPECT_EQ(toolbar_height(), kHeight); } @@ -117,7 +113,7 @@ TEST_F(LegacyToolbarUIUpdaterTest, UpdateActiveWebState) { StartUpdating(); const CGFloat kHeight = 150.0; - toolbar_owner().toolbarHeight = kHeight; + toolbar_owner().nonFullscreenToolbarHeight = kHeight; EXPECT_EQ(toolbar_height(), 0.0); InsertActiveWebState(); EXPECT_EQ(toolbar_height(), kHeight); @@ -129,7 +125,7 @@ web::TestWebState* web_state = InsertActiveWebState(); StartUpdating(); const CGFloat kHeight = 150.0; - toolbar_owner().toolbarHeight = kHeight; + toolbar_owner().nonFullscreenToolbarHeight = kHeight; EXPECT_EQ(toolbar_height(), 0.0); web::FakeNavigationContext context; context.SetIsRendererInitiated(false); @@ -143,7 +139,7 @@ web::TestWebState* web_state = InsertActiveWebState(); StartUpdating(); const CGFloat kHeight = 150.0; - toolbar_owner().toolbarHeight = kHeight; + toolbar_owner().nonFullscreenToolbarHeight = kHeight; EXPECT_EQ(toolbar_height(), 0.0); web::FakeNavigationContext context; context.SetIsRendererInitiated(true);
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_owner.h b/ios/chrome/browser/ui/toolbar/toolbar_owner.h index 0828f24..affa198 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_owner.h +++ b/ios/chrome/browser/ui/toolbar/toolbar_owner.h
@@ -20,10 +20,6 @@ @property(nonatomic, strong, readonly) id<ToolbarSnapshotProviding> toolbarSnapshotProvider; -@optional -// Returns the height of the toolbar owned by the implementing class. -- (CGFloat)toolbarHeight; - @end #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_OWNER_H_
diff --git a/ios/chrome/test/app/sync_test_util.mm b/ios/chrome/test/app/sync_test_util.mm index 2b877c2..0d4d2b6 100644 --- a/ios/chrome/test/app/sync_test_util.mm +++ b/ios/chrome/test/app/sync_test_util.mm
@@ -289,7 +289,7 @@ __block bool history_service_callback_called = false; __block int count = 0; using history::OriginCountAndLastVisitMap; - history_service->GetCountsAndLastVisitForOrigins( + history_service->GetCountsAndLastVisitForOriginsForTesting( origins, base::BindBlockArc(^(const OriginCountAndLastVisitMap& result) { auto iter = result.find(block_safe_url); if (iter != result.end())
diff --git a/ios/web/browser_state_web_view_partition_inttest.mm b/ios/web/browser_state_web_view_partition_inttest.mm index 7ebd8b80..68fffd2 100644 --- a/ios/web/browser_state_web_view_partition_inttest.mm +++ b/ios/web/browser_state_web_view_partition_inttest.mm
@@ -7,16 +7,15 @@ #include <memory> #include <string> +#include "base/compiler_specific.h" #include "base/mac/foundation_util.h" -#import "base/test/ios/wait_util.h" -#include "base/test/test_timeouts.h" +#import "ios/testing/wait_util.h" #include "ios/web/public/browser_state.h" -#import "ios/web/public/test/http_server/http_server.h" -#import "ios/web/public/test/http_server/string_response_provider.h" #import "ios/web/public/test/js_test_util.h" #import "ios/web/public/web_view_creation_util.h" #import "ios/web/test/web_int_test.h" #import "net/base/mac/url_conversions.h" +#include "net/test/embedded_test_server/default_handlers.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" @@ -24,14 +23,17 @@ #error "This file requires ARC support." #endif +using testing::kWaitForPageLoadTimeout; +using testing::WaitUntilConditionOrTimeout; + // A WKNavigationDelegate that is used to check if a WKWebView has finished // a navigation. Used for testing purposes. -@interface TestNavigationDelegate : NSObject <WKNavigationDelegate> +@interface FakeNavigationDelegate : NSObject<WKNavigationDelegate> // YES if a navigation has finished. @property (nonatomic, assign) BOOL didFinishNavigation; @end -@implementation TestNavigationDelegate +@implementation FakeNavigationDelegate @synthesize didFinishNavigation = _didFinishNavigation; @@ -42,31 +44,21 @@ @end +namespace web { + // A test fixture for testing that browsing data is partitioned between // web views created with a non-OTR BrowserState and web views created with an // OTR BrowserState. -class BrowserStateWebViewPartitionTest : public web::WebIntTest { +class BrowserStateWebViewPartitionTest : public WebIntTest { protected: + BrowserStateWebViewPartitionTest() = default; void SetUp() override { - web::WebIntTest::SetUp(); + WebIntTest::SetUp(); otr_browser_state_.SetOffTheRecord(true); - web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance(); - ASSERT_TRUE(server.IsRunning()); - - auto provider = - std::make_unique<web::StringResponseProvider>("Hello World"); - provider_ = provider.get(); // Keep a weak copy to allow unregistration. - server.AddResponseProvider(std::move(provider)); - } - - void TearDown() override { - web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance(); - server.RemoveResponseProvider(provider_); - provider_ = nullptr; - - web::WebIntTest::TearDown(); + RegisterDefaultHandlers(&server_); + ASSERT_TRUE(server_.Start()); } // Sets a persistent cookie with key, value on |web_view|. @@ -103,49 +95,42 @@ // Loads a test web page (that contains a small string) in |web_view| and // waits until the web view has finished the navigation. - void LoadTestWebPage(WKWebView* web_view) { - DCHECK(web_view); - - TestNavigationDelegate* navigation_delegate = - [[TestNavigationDelegate alloc] init]; + bool LoadTestWebPage(WKWebView* web_view) WARN_UNUSED_RESULT { + FakeNavigationDelegate* navigation_delegate = + [[FakeNavigationDelegate alloc] init]; id old_navigation_delegate = web_view.navigationDelegate; web_view.navigationDelegate = navigation_delegate; - web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance(); - ASSERT_TRUE(server.IsRunning()); - - NSURL* url = net::NSURLWithGURL(server.MakeUrl("http://whatever/")); + NSURL* url = net::NSURLWithGURL(server_.GetURL("/echo")); [web_view loadRequest:[NSURLRequest requestWithURL:url]]; - base::test::ios::WaitUntilCondition( - ^bool { - return [navigation_delegate didFinishNavigation]; - }, - false, TestTimeouts::action_max_timeout()); + + bool result = WaitUntilConditionOrTimeout(kWaitForPageLoadTimeout, ^bool { + return navigation_delegate.didFinishNavigation; + }); web_view.navigationDelegate = old_navigation_delegate; + + return result; } - // Returns the BrowserState that is used for testing. - web::BrowserState* GetOtrBrowserState() { return &otr_browser_state_; } + protected: + net::EmbeddedTestServer server_; + TestBrowserState otr_browser_state_; - private: - // The ResponseProvider used to load a simple web page. - web::ResponseProvider* provider_; - // The OTR browser state used in tests. - web::TestBrowserState otr_browser_state_; + DISALLOW_COPY_AND_ASSIGN(BrowserStateWebViewPartitionTest); }; // Tests that cookies are partitioned between web views created with a // non-OTR BrowserState and an OTR BrowserState. TEST_F(BrowserStateWebViewPartitionTest, Cookies) { - WKWebView* web_view_1 = web::BuildWKWebView(CGRectZero, GetBrowserState()); - LoadTestWebPage(web_view_1); + WKWebView* web_view_1 = BuildWKWebView(CGRectZero, GetBrowserState()); + ASSERT_TRUE(LoadTestWebPage(web_view_1)); SetCookie(@"someCookieName1", @"someCookieValue1", web_view_1); ASSERT_NSEQ(@"someCookieName1=someCookieValue1", GetCookies(web_view_1)); - WKWebView* web_view_2 = web::BuildWKWebView(CGRectZero, GetOtrBrowserState()); - LoadTestWebPage(web_view_2); + WKWebView* web_view_2 = BuildWKWebView(CGRectZero, &otr_browser_state_); + ASSERT_TRUE(LoadTestWebPage(web_view_2)); // Test that the cookie has not leaked over to |web_view_2|. ASSERT_NSEQ(@"", GetCookies(web_view_2)); @@ -161,13 +146,13 @@ // Tests that localStorage is partitioned between web views created with a // non-OTR BrowserState and an OTR BrowserState. TEST_F(BrowserStateWebViewPartitionTest, LocalStorage) { - WKWebView* web_view_1 = web::BuildWKWebView(CGRectZero, GetBrowserState()); - LoadTestWebPage(web_view_1); + WKWebView* web_view_1 = BuildWKWebView(CGRectZero, GetBrowserState()); + ASSERT_TRUE(LoadTestWebPage(web_view_1)); SetLocalStorageItem(@"someKey1", @"someValue1", web_view_1); EXPECT_NSEQ(@"someValue1", GetLocalStorageItem(@"someKey1", web_view_1)); - WKWebView* web_view_2 = web::BuildWKWebView(CGRectZero, GetOtrBrowserState()); - LoadTestWebPage(web_view_2); + WKWebView* web_view_2 = BuildWKWebView(CGRectZero, &otr_browser_state_); + ASSERT_TRUE(LoadTestWebPage(web_view_2)); // Test that LocalStorage has not leaked over to |web_view_2|. EXPECT_NSEQ([NSNull null], GetLocalStorageItem(@"someKey1", web_view_2)); @@ -182,3 +167,5 @@ // Test that LocalStorage has not leaked over to |web_view_1|. EXPECT_NSEQ([NSNull null], GetLocalStorageItem(@"someKey2", web_view_1)); } + +} // namespace web
diff --git a/ios/web/download/download_inttest.mm b/ios/web/download/download_inttest.mm index 916c766..00f305e 100644 --- a/ios/web/download/download_inttest.mm +++ b/ios/web/download/download_inttest.mm
@@ -9,8 +9,8 @@ #import "ios/testing/wait_util.h" #import "ios/web/public/download/download_controller.h" #import "ios/web/public/download/download_task.h" -#import "ios/web/public/navigation_manager.h" #include "ios/web/public/test/fakes/fake_download_controller_delegate.h" +#import "ios/web/public/test/navigation_test_util.h" #import "ios/web/public/test/web_test_with_web_state.h" #import "ios/web/public/web_client.h" #import "ios/web/public/web_state/web_state.h" @@ -74,9 +74,7 @@ // Load download URL. ASSERT_TRUE(server_.Start()); GURL url(server_.GetURL("/")); - web::NavigationManager::WebLoadParams params(url); - params.transition_type = ui::PageTransition::PAGE_TRANSITION_TYPED; - web_state()->GetNavigationManager()->LoadURLWithParams(params); + test::LoadUrl(web_state(), url); // Wait until download task is created. ASSERT_TRUE(WaitUntilConditionOrTimeout(testing::kWaitForDownloadTimeout, ^{
diff --git a/ios/web/navigation/navigation_item_impl.mm b/ios/web/navigation/navigation_item_impl.mm index fb037eb..44772fd 100644 --- a/ios/web/navigation/navigation_item_impl.mm +++ b/ios/web/navigation/navigation_item_impl.mm
@@ -353,13 +353,15 @@ NSString* NavigationItemImpl::GetDescription() const { return [NSString stringWithFormat: - @"url:%s originalurl:%s referrer: %s title:%s transition:%d " + @"url:%s virtual_url_:%s originalurl:%s referrer: %s title:%s " + @"transition:%d " "displayState:%@ userAgentType:%s is_create_from_push_state: %@ " "has_state_been_replaced: %@ is_created_from_hash_change: %@ " "navigation_initiation_type: %d", - url_.spec().c_str(), original_request_url_.spec().c_str(), - referrer_.url.spec().c_str(), base::UTF16ToUTF8(title_).c_str(), - transition_type_, page_display_state_.GetDescription(), + url_.spec().c_str(), virtual_url_.spec().c_str(), + original_request_url_.spec().c_str(), referrer_.url.spec().c_str(), + base::UTF16ToUTF8(title_).c_str(), transition_type_, + page_display_state_.GetDescription(), GetUserAgentTypeDescription(user_agent_type_).c_str(), is_created_from_push_state_ ? @"true" : @"false", has_state_been_replaced_ ? @"true" : @"false",
diff --git a/ios/web/navigation/navigation_item_impl_unittest.mm b/ios/web/navigation/navigation_item_impl_unittest.mm index 8430db87..227c47f4 100644 --- a/ios/web/navigation/navigation_item_impl_unittest.mm +++ b/ios/web/navigation/navigation_item_impl_unittest.mm
@@ -52,13 +52,17 @@ // Tests that the debug description is as expected. TEST_F(NavigationItemTest, Description) { item_->SetTitle(base::UTF8ToUTF16("Title")); - EXPECT_NSEQ(@"url:http://init.test/ originalurl:http://init.test/ referrer: " - @"title:Title transition:2 displayState:{ scrollOffset:(nan, " - @"nan), zoomScaleRange:(nan, nan), zoomScale:nan } " - @"userAgentType:MOBILE is_create_from_push_state: false " - @"has_state_been_replaced: false is_created_from_hash_change: " - @"false navigation_initiation_type: 0", - item_->GetDescription()); + NSString* description = item_->GetDescription(); + EXPECT_TRUE([description containsString:@"url:http://init.test/"]); + EXPECT_TRUE([description containsString:@"originalurl:http://init.test/"]); + EXPECT_TRUE([description containsString:@"title:Title"]); + EXPECT_TRUE([description containsString:@"transition:2"]); + EXPECT_TRUE([description containsString:@"userAgentType:MOBILE"]); + EXPECT_TRUE([description containsString:@"is_create_from_push_state: false"]); + EXPECT_TRUE([description containsString:@"has_state_been_replaced: false"]); + EXPECT_TRUE( + [description containsString:@"is_created_from_hash_change: false"]); + EXPECT_TRUE([description containsString:@"navigation_initiation_type: 0"]); } #endif
diff --git a/ios/web/web_state/error_page_inttest.mm b/ios/web/web_state/error_page_inttest.mm index 03510160..b83ca65d 100644 --- a/ios/web/web_state/error_page_inttest.mm +++ b/ios/web/web_state/error_page_inttest.mm
@@ -8,6 +8,7 @@ #include "ios/web/public/features.h" #import "ios/web/public/navigation_manager.h" #include "ios/web/public/reload_type.h" +#include "ios/web/public/test/fakes/test_browser_state.h" #import "ios/web/public/test/navigation_test_util.h" #import "ios/web/public/test/web_test_with_web_state.h" #import "ios/web/public/test/web_view_content_test_util.h" @@ -75,7 +76,7 @@ server_responds_with_content_ = false; test::LoadUrl(web_state(), server_.GetURL("/echo-query?foo")); ASSERT_TRUE(test::WaitForWebViewContainingText( - web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 1")); + web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 0")); // Reload the page, which should load without errors. server_responds_with_content_ = true; @@ -96,7 +97,7 @@ web_state()->GetNavigationManager()->Reload(ReloadType::NORMAL, /*check_for_repost=*/false); ASSERT_TRUE(test::WaitForWebViewContainingText( - web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 1")); + web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 0")); } // Sucessfully loads the page, goes back, stops the server, goes forward and @@ -127,7 +128,7 @@ web_state()->GetNavigationManager()->Reload(ReloadType::NORMAL, /*check_for_repost=*/false); ASSERT_TRUE(test::WaitForWebViewContainingText( - web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 1")); + web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 0")); #endif // TARGET_IPHONE_SIMULATOR } @@ -141,7 +142,7 @@ // Second page fails to load. test::LoadUrl(web_state(), server_.GetURL("/close-socket")); ASSERT_TRUE(test::WaitForWebViewContainingText( - web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 1")); + web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 0")); // Going back should sucessfully load the first page. web_state()->GetNavigationManager()->GoBack(); @@ -154,7 +155,7 @@ server_responds_with_content_ = false; test::LoadUrl(web_state(), server_.GetURL("/server-redirect?echo-query")); ASSERT_TRUE(test::WaitForWebViewContainingText( - web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 1")); + web_state(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 0")); } // Loads the page with iframe, and that iframe fails to load. There should be no @@ -167,4 +168,21 @@ })); } +// Loads the URL with off the record browser state; +TEST_F(ErrorPageTest, OtrError) { + TestBrowserState browser_state; + browser_state.SetOffTheRecord(true); + WebState::CreateParams params(&browser_state); + auto web_state = WebState::Create(params); + + // No response leads to -1005 error code. + server_responds_with_content_ = false; + test::LoadUrl(web_state.get(), server_.GetURL("/echo-query?foo")); + // LoadIfNecessary is needed because the view is not created (but needed) when + // loading the page. TODO(crbug.com/705819): Remove this call. + web_state->GetNavigationManager()->LoadIfNecessary(); + ASSERT_TRUE(test::WaitForWebViewContainingText( + web_state.get(), "domain: NSURLErrorDomain code: -1005 post: 0 otr: 1")); +} + } // namespace web
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index ddb6478..041bbc5 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -1738,7 +1738,8 @@ } else { NSString* errorHTML = nil; web::GetWebClient()->PrepareErrorPage( - error, context->IsPost(), _webStateImpl->GetBrowserState(), &errorHTML); + error, context->IsPost(), + _webStateImpl->GetBrowserState()->IsOffTheRecord(), &errorHTML); [_webView loadHTMLString:errorHTML baseURL:net::NSURLWithGURL(currentURL)]; }
diff --git a/media/base/BUILD.gn b/media/base/BUILD.gn index 971cb27c..ad4a75d 100644 --- a/media/base/BUILD.gn +++ b/media/base/BUILD.gn
@@ -231,6 +231,7 @@ "stream_parser.h", "stream_parser_buffer.cc", "stream_parser_buffer.h", + "subsample_entry.cc", "subsample_entry.h", "surface_manager.h", "text_cue.cc", @@ -488,6 +489,7 @@ "silent_sink_suspender_unittest.cc", "sinc_resampler_unittest.cc", "stream_parser_unittest.cc", + "subsample_entry_unittest.cc", "text_ranges_unittest.cc", "text_renderer_unittest.cc", "time_delta_interpolator_unittest.cc",
diff --git a/media/base/subsample_entry.cc b/media/base/subsample_entry.cc new file mode 100644 index 0000000..85975ce2 --- /dev/null +++ b/media/base/subsample_entry.cc
@@ -0,0 +1,29 @@ +// 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 "media/base/subsample_entry.h" + +#include "base/logging.h" +#include "base/numerics/safe_math.h" + +namespace media { + +bool VerifySubsamplesMatchSize(const std::vector<SubsampleEntry>& subsamples, + size_t input_size) { + base::CheckedNumeric<size_t> total_size = 0; + for (const auto& subsample : subsamples) { + // Add each entry separately to avoid the compiler doing the wrong thing. + total_size += subsample.clear_bytes; + total_size += subsample.cypher_bytes; + } + + if (!total_size.IsValid() || total_size.ValueOrDie() != input_size) { + DVLOG(1) << "Subsample sizes do not equal input size"; + return false; + } + + return true; +} + +} // namespace media
diff --git a/media/base/subsample_entry.h b/media/base/subsample_entry.h index 07c5eee..48f8ea7 100644 --- a/media/base/subsample_entry.h +++ b/media/base/subsample_entry.h
@@ -7,6 +7,10 @@ #include <stdint.h> +#include <vector> + +#include "media/base/media_export.h" + namespace media { // The Common Encryption spec provides for subsample encryption, where portions @@ -26,6 +30,13 @@ uint32_t cypher_bytes; }; +// Verifies that |subsamples| correctly specifies a buffer of length +// |input_size|. Returns false if the total of bytes specified in |subsamples| +// does not match |input_size|. +MEDIA_EXPORT bool VerifySubsamplesMatchSize( + const std::vector<SubsampleEntry>& subsamples, + size_t input_size); + } // namespace media #endif // MEDIA_BASE_SUBSAMPLE_ENTRY_H_
diff --git a/media/base/subsample_entry_unittest.cc b/media/base/subsample_entry_unittest.cc new file mode 100644 index 0000000..84b0d28 --- /dev/null +++ b/media/base/subsample_entry_unittest.cc
@@ -0,0 +1,38 @@ +// 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 "media/base/subsample_entry.h" + +#include <limits> + +#include "base/numerics/safe_conversions.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media { + +constexpr uint32_t kMax = std::numeric_limits<uint32_t>::max(); + +TEST(SubsampleEntryTest, NoEntries) { + EXPECT_TRUE(VerifySubsamplesMatchSize({}, 0)); + EXPECT_FALSE(VerifySubsamplesMatchSize({}, 100)); +} + +TEST(SubsampleEntryTest, OneEntry) { + EXPECT_TRUE(VerifySubsamplesMatchSize({{0, 50}}, 50)); + EXPECT_TRUE(VerifySubsamplesMatchSize({{100, 00}}, 100)); + EXPECT_TRUE(VerifySubsamplesMatchSize({{150, 200}}, 350)); +} + +TEST(SubsampleEntryTest, MultipleEntries) { + EXPECT_TRUE(VerifySubsamplesMatchSize({{0, 50}, {100, 00}, {150, 200}}, 500)); +} + +TEST(SubsampleEntryTest, NoOverflow) { + EXPECT_TRUE( + VerifySubsamplesMatchSize({{kMax, 0}}, base::strict_cast<size_t>(kMax))); + EXPECT_TRUE( + VerifySubsamplesMatchSize({{0, kMax}}, base::strict_cast<size_t>(kMax))); +} + +} // namespace media
diff --git a/media/cdm/BUILD.gn b/media/cdm/BUILD.gn index 363cbc4..f3dbef7 100644 --- a/media/cdm/BUILD.gn +++ b/media/cdm/BUILD.gn
@@ -26,8 +26,12 @@ ] sources = [ + "aes_cbc_crypto.cc", + "aes_cbc_crypto.h", "aes_decryptor.cc", "aes_decryptor.h", + "cbcs_decryptor.cc", + "cbcs_decryptor.h", "cdm_context_ref_impl.cc", "cdm_context_ref_impl.h", "cenc_decryptor.cc", @@ -54,6 +58,7 @@ "//crypto", "//media/base", "//media/formats", + "//third_party/boringssl", "//ui/gfx/geometry", "//url", ] @@ -141,7 +146,9 @@ source_set("unit_tests") { testonly = true sources = [ + "aes_cbc_crypto_unittest.cc", "aes_decryptor_unittest.cc", + "cbcs_decryptor_unittest.cc", "cenc_decryptor_unittest.cc", "json_web_key_unittest.cc", ] @@ -152,6 +159,7 @@ "//media:test_support", "//testing/gmock", "//testing/gtest", + "//third_party/boringssl", "//ui/gfx:test_support", "//url", ]
diff --git a/media/cdm/DEPS b/media/cdm/DEPS index b4addf5d..c8585a64 100644 --- a/media/cdm/DEPS +++ b/media/cdm/DEPS
@@ -1,4 +1,5 @@ include_rules = [ "+components/crash/core/common/crash_key.h", "+crypto", + "+third_party/boringssl/src/include", ]
diff --git a/media/cdm/aes_cbc_crypto.cc b/media/cdm/aes_cbc_crypto.cc new file mode 100644 index 0000000..b16f2c17 --- /dev/null +++ b/media/cdm/aes_cbc_crypto.cc
@@ -0,0 +1,99 @@ +// 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 "media/cdm/aes_cbc_crypto.h" + +#include "base/logging.h" +#include "base/numerics/safe_conversions.h" +#include "crypto/openssl_util.h" +#include "crypto/symmetric_key.h" +#include "third_party/boringssl/src/include/openssl/aes.h" +#include "third_party/boringssl/src/include/openssl/crypto.h" +#include "third_party/boringssl/src/include/openssl/err.h" +#include "third_party/boringssl/src/include/openssl/evp.h" + +// Notes on using OpenSSL: +// https://www.openssl.org/docs/man1.1.0/crypto/EVP_DecryptUpdate.html +// The documentation for EVP_DecryptUpdate() only states +// "EVP_DecryptInit_ex(), EVP_DecryptUpdate() and EVP_DecryptFinal_ex() +// are the corresponding decryption operations. EVP_DecryptFinal() will +// return an error code if padding is enabled and the final block is not +// correctly formatted. The parameters and restrictions are identical +// to the encryption operations except that if padding is enabled ..." +// As this implementation does not use padding, the last part should not be +// an issue. However, there is no mention whether data can be decrypted +// block-by-block or if all the data must be unencrypted at once. +// +// The documentation for EVP_EncryptUpdate() (same page as above) states +// "EVP_EncryptUpdate() encrypts inl bytes from the buffer in and writes +// the encrypted version to out. This function can be called multiple times +// to encrypt successive blocks of data." +// Given that the EVP_Decrypt* methods have the same restrictions, the code +// below assumes that EVP_DecryptUpdate() can be called on a block-by-block +// basis. A test in aes_cbc_crypto_unittest.cc verifies this. + +namespace media { + +AesCbcCrypto::AesCbcCrypto() { + // Ensure the crypto library is initialized. CRYPTO_library_init may be + // safely called concurrently. + CRYPTO_library_init(); + EVP_CIPHER_CTX_init(&ctx_); +} + +AesCbcCrypto::~AesCbcCrypto() { + EVP_CIPHER_CTX_cleanup(&ctx_); +} + +bool AesCbcCrypto::Initialize(const crypto::SymmetricKey& key, + base::span<const uint8_t> iv) { + crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); + + // This uses AES-CBC-128, so the key must be 128 bits. + const EVP_CIPHER* cipher = EVP_aes_128_cbc(); + const uint8_t* key_data = reinterpret_cast<const uint8_t*>(key.key().data()); + if (key.key().length() != EVP_CIPHER_key_length(cipher)) { + DVLOG(1) << "Key length is incorrect."; + return false; + } + + // |iv| must also be 128 bits. + if (iv.size_bytes() != EVP_CIPHER_iv_length(cipher)) { + DVLOG(1) << "IV length is incorrect."; + return false; + } + + if (!EVP_DecryptInit_ex(&ctx_, cipher, nullptr, key_data, iv.data())) { + DVLOG(1) << "EVP_DecryptInit_ex() failed."; + return false; + } + + if (!EVP_CIPHER_CTX_set_padding(&ctx_, 0)) { + DVLOG(1) << "EVP_CIPHER_CTX_set_padding() failed."; + return false; + } + + return true; +} + +bool AesCbcCrypto::Decrypt(base::span<const uint8_t> encrypted_data, + uint8_t* decrypted_data) { + crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); + + if (encrypted_data.size_bytes() % EVP_CIPHER_CTX_block_size(&ctx_) != 0) { + DVLOG(1) << "Encrypted bytes not a multiple of block size."; + return false; + } + + int out_length; + if (!EVP_DecryptUpdate(&ctx_, decrypted_data, &out_length, + encrypted_data.data(), encrypted_data.size_bytes())) { + DVLOG(1) << "EVP_DecryptUpdate() failed."; + return false; + } + + return encrypted_data.size_bytes() == base::checked_cast<size_t>(out_length); +} + +} // namespace media
diff --git a/media/cdm/aes_cbc_crypto.h b/media/cdm/aes_cbc_crypto.h new file mode 100644 index 0000000..b6e0ee59 --- /dev/null +++ b/media/cdm/aes_cbc_crypto.h
@@ -0,0 +1,53 @@ +// 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 MEDIA_CDM_AES_CBC_CRYPTO_H_ +#define MEDIA_CDM_AES_CBC_CRYPTO_H_ + +#include <stdint.h> + +#include <string> + +#include "base/containers/span.h" +#include "base/macros.h" +#include "media/base/media_export.h" +#include "third_party/boringssl/src/include/openssl/evp.h" + +namespace crypto { +class SymmetricKey; +} + +namespace media { + +// This class implements AES-CBC-128 decryption as described in the Advanced +// Encryption Standard specified by AES [FIPS-197, https://www.nist.gov] +// using 128-bit keys in Cipher Block Chaining mode, as specified in Block +// Cipher Modes [NIST 800-38A, https://www.nist.gov]. + +class MEDIA_EXPORT AesCbcCrypto { + public: + AesCbcCrypto(); + ~AesCbcCrypto(); + + // Initializes the encryptor using |key| and |iv|. Returns false if either + // the key or the initialization vector cannot be used. + bool Initialize(const crypto::SymmetricKey& key, + base::span<const uint8_t> iv); + + // Decrypts |encrypted_data| into |decrypted_data|. |encrypted_data| must be + // a multiple of the blocksize (128 bits), and |decrypted_data| must have + // enough space for |encrypted_data|.size(). Returns false if the decryption + // fails. + bool Decrypt(base::span<const uint8_t> encrypted_data, + uint8_t* decrypted_data); + + private: + EVP_CIPHER_CTX ctx_; + + DISALLOW_COPY_AND_ASSIGN(AesCbcCrypto); +}; + +} // namespace media + +#endif // MEDIA_CDM_AES_CBC_CRYPTO_H_
diff --git a/media/cdm/aes_cbc_crypto_unittest.cc b/media/cdm/aes_cbc_crypto_unittest.cc new file mode 100644 index 0000000..4b99601 --- /dev/null +++ b/media/cdm/aes_cbc_crypto_unittest.cc
@@ -0,0 +1,208 @@ +// 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 "media/cdm/aes_cbc_crypto.h" + +#include <memory> + +#include "base/containers/span.h" +#include "base/optional.h" +#include "base/stl_util.h" +#include "crypto/encryptor.h" +#include "crypto/symmetric_key.h" +#include "media/base/decoder_buffer.h" +#include "media/base/decrypt_config.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/boringssl/src/include/openssl/aes.h" +#include "third_party/boringssl/src/include/openssl/crypto.h" +#include "third_party/boringssl/src/include/openssl/err.h" +#include "third_party/boringssl/src/include/openssl/evp.h" + +namespace media { + +namespace { + +// Pattern decryption uses 16-byte blocks. +constexpr size_t kBlockSize = 16; + +// Keys and IV have to be 128 bits. +const uint8_t kKey1[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13}; +static_assert(base::size(kKey1) == 128 / 8, "kKey1 must be 128 bits"); + +const uint8_t kKey2[] = {0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b}; +static_assert(base::size(kKey2) == 128 / 8, "kKey2 must be 128 bits"); + +const uint8_t kIv[] = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static_assert(base::size(kIv) == 128 / 8, "kIv must be 128 bits"); + +const uint8_t kOneBlock[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'}; +static_assert(base::size(kOneBlock) == kBlockSize, "kOneBlock not block sized"); + +std::string MakeString(const std::vector<uint8_t>& chars) { + return std::string(chars.begin(), chars.end()); +} + +// Returns a std::vector<uint8_t> containing |count| copies of |input|. +std::vector<uint8_t> Repeat(const std::vector<uint8_t>& input, size_t count) { + std::vector<uint8_t> result; + for (size_t i = 0; i < count; ++i) + result.insert(result.end(), input.begin(), input.end()); + return result; +} + +} // namespace + +class AesCbcCryptoTest : public testing::Test { + public: + AesCbcCryptoTest() + : key1_(crypto::SymmetricKey::Import( + crypto::SymmetricKey::AES, + std::string(std::begin(kKey1), std::end(kKey1)))), + key2_(crypto::SymmetricKey::Import( + crypto::SymmetricKey::AES, + std::string(std::begin(kKey2), std::end(kKey2)))), + iv_(std::begin(kIv), std::end(kIv)), + one_block_(std::begin(kOneBlock), std::end(kOneBlock)) {} + + // Encrypt |original| using AES-CBC encryption with |key| and |iv|. + std::vector<uint8_t> Encrypt(const std::vector<uint8_t>& original, + const crypto::SymmetricKey& key, + base::span<const uint8_t> iv) { + // This code uses crypto::Encryptor to encrypt |original| rather than + // calling EVP_EncryptInit_ex() / EVP_EncryptUpdate() / etc. This is done + // for simplicity, as the crypto:: code wraps all the calls up nicely. + // However, for AES-CBC encryption, the crypto:: code does add padding to + // the output, which is simply stripped off. + crypto::Encryptor encryptor; + std::string iv_as_string(std::begin(iv), std::end(iv)); + EXPECT_TRUE(encryptor.Init(&key, crypto::Encryptor::CBC, iv_as_string)); + + std::string ciphertext; + EXPECT_TRUE(encryptor.Encrypt(MakeString(original), &ciphertext)); + + // CBC encyption adds a block of padding at the end, so discard it. + EXPECT_GT(ciphertext.size(), original.size()); + ciphertext.resize(original.size()); + + return std::vector<uint8_t>(ciphertext.begin(), ciphertext.end()); + } + + // Constants for testing. + std::unique_ptr<crypto::SymmetricKey> key1_; + std::unique_ptr<crypto::SymmetricKey> key2_; + base::span<const uint8_t> iv_; + const std::vector<uint8_t> one_block_; +}; + +TEST_F(AesCbcCryptoTest, OneBlock) { + auto encrypted_block = Encrypt(one_block_, *key1_, iv_); + EXPECT_EQ(kBlockSize, encrypted_block.size()); + + AesCbcCrypto crypto; + EXPECT_TRUE(crypto.Initialize(*key1_, iv_)); + + std::vector<uint8_t> output(encrypted_block.size()); + EXPECT_TRUE(crypto.Decrypt(encrypted_block, output.data())); + EXPECT_EQ(output, one_block_); +} + +TEST_F(AesCbcCryptoTest, WrongKey) { + auto encrypted_block = Encrypt(one_block_, *key1_, iv_); + EXPECT_EQ(kBlockSize, encrypted_block.size()); + + // Use |key2_| when trying to decrypt. + AesCbcCrypto crypto; + EXPECT_TRUE(crypto.Initialize(*key2_, iv_)); + + std::vector<uint8_t> output(encrypted_block.size()); + EXPECT_TRUE(crypto.Decrypt(encrypted_block, output.data())); + EXPECT_NE(output, one_block_); +} + +TEST_F(AesCbcCryptoTest, WrongIV) { + auto encrypted_block = Encrypt(one_block_, *key1_, iv_); + EXPECT_EQ(kBlockSize, encrypted_block.size()); + + // Use a different IV when trying to decrypt. + AesCbcCrypto crypto; + std::vector<uint8_t> alternate_iv(iv_.size(), 'a'); + EXPECT_TRUE(crypto.Initialize(*key1_, alternate_iv)); + + std::vector<uint8_t> output(encrypted_block.size()); + EXPECT_TRUE(crypto.Decrypt(encrypted_block, output.data())); + EXPECT_NE(output, one_block_); +} + +TEST_F(AesCbcCryptoTest, PartialBlock) { + auto encrypted_block = Encrypt(one_block_, *key1_, iv_); + EXPECT_EQ(kBlockSize, encrypted_block.size()); + + AesCbcCrypto crypto; + EXPECT_TRUE(crypto.Initialize(*key2_, iv_)); + + // Try to decrypt less than a full block. + std::vector<uint8_t> output(encrypted_block.size()); + EXPECT_FALSE(crypto.Decrypt( + base::make_span(encrypted_block).first(encrypted_block.size() - 5), + output.data())); +} + +TEST_F(AesCbcCryptoTest, MultipleBlocks) { + // Encrypt 10 copies of |one_block_| together. + constexpr size_t kNumBlocksInData = 10; + auto encrypted_block = + Encrypt(Repeat(one_block_, kNumBlocksInData), *key2_, iv_); + ASSERT_EQ(kNumBlocksInData * kBlockSize, encrypted_block.size()); + + AesCbcCrypto crypto; + EXPECT_TRUE(crypto.Initialize(*key2_, iv_)); + + std::vector<uint8_t> output(encrypted_block.size()); + EXPECT_TRUE(crypto.Decrypt(encrypted_block, output.data())); + EXPECT_EQ(output, Repeat(one_block_, kNumBlocksInData)); +} + +// As the code in aes_cbc_crypto.cc relies on decrypting the data block by +// block, ensure that the crypto routines work the same way whether it +// decrypts one block at a time or all the blocks in one call. +TEST_F(AesCbcCryptoTest, BlockDecryptionWorks) { + constexpr size_t kNumBlocksInData = 5; + std::vector<uint8_t> data = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0}; + ASSERT_EQ(data.size(), kNumBlocksInData * kBlockSize); + auto encrypted_data = Encrypt(data, *key1_, iv_); + + // Decrypt |encrypted_data| in one pass. + { + AesCbcCrypto crypto; + EXPECT_TRUE(crypto.Initialize(*key1_, iv_)); + + std::vector<uint8_t> output(kNumBlocksInData * kBlockSize); + EXPECT_TRUE(crypto.Decrypt(encrypted_data, output.data())); + EXPECT_EQ(output, data); + } + + // Repeat but call Decrypt() once for each block. + { + AesCbcCrypto crypto; + EXPECT_TRUE(crypto.Initialize(*key1_, iv_)); + + std::vector<uint8_t> output(kNumBlocksInData * kBlockSize); + auto input = base::make_span(encrypted_data); + for (size_t offset = 0; offset < output.size(); offset += kBlockSize) { + EXPECT_TRUE( + crypto.Decrypt(input.subspan(offset, kBlockSize), &output[offset])); + } + EXPECT_EQ(output, data); + } +} + +} // namespace media
diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc index 545a7b5..b1a95211 100644 --- a/media/cdm/aes_decryptor.cc +++ b/media/cdm/aes_decryptor.cc
@@ -23,6 +23,7 @@ #include "media/base/limits.h" #include "media/base/video_decoder_config.h" #include "media/base/video_frame.h" +#include "media/cdm/cbcs_decryptor.h" #include "media/cdm/cenc_decryptor.h" #include "media/cdm/cenc_utils.h" #include "media/cdm/json_web_key.h" @@ -157,8 +158,10 @@ if (input.decrypt_config()->encryption_mode() == EncryptionMode::kCenc) return DecryptCencBuffer(input, key); - // TODO(crbug.com/658026): Add support for 'cbcs'. - DVLOG(1) << "Only 'cenc' mode supported."; + if (input.decrypt_config()->encryption_mode() == EncryptionMode::kCbcs) + return DecryptCbcsBuffer(input, key); + + DVLOG(1) << "Only 'cenc' and 'cbcs' modes supported."; return nullptr; } @@ -495,7 +498,7 @@ DecryptionKey* key = GetKey_Locked(key_id); if (!key) { DVLOG(1) << "Could not find a matching key for the given key ID."; - decrypt_cb.Run(kNoKey, NULL); + decrypt_cb.Run(kNoKey, nullptr); return; } @@ -503,12 +506,12 @@ DecryptData(*encrypted.get(), *key->decryption_key()); if (!decrypted) { DVLOG(1) << "Decryption failed."; - decrypt_cb.Run(kError, NULL); + decrypt_cb.Run(kError, nullptr); return; } - decrypted->set_timestamp(encrypted->timestamp()); - decrypted->set_duration(encrypted->duration()); + DCHECK_EQ(decrypted->timestamp(), encrypted->timestamp()); + DCHECK_EQ(decrypted->duration(), encrypted->duration()); decrypt_cb.Run(kSuccess, std::move(decrypted)); }
diff --git a/media/cdm/cbcs_decryptor.cc b/media/cdm/cbcs_decryptor.cc new file mode 100644 index 0000000..c1e2189 --- /dev/null +++ b/media/cdm/cbcs_decryptor.cc
@@ -0,0 +1,184 @@ +// 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 "media/cdm/cbcs_decryptor.h" + +#include <stdint.h> + +#include <algorithm> +#include <string> +#include <vector> + +#include "base/containers/span.h" +#include "base/logging.h" +#include "base/memory/scoped_refptr.h" +#include "base/numerics/checked_math.h" +#include "crypto/symmetric_key.h" +#include "media/base/decoder_buffer.h" +#include "media/base/decrypt_config.h" +#include "media/base/encryption_pattern.h" +#include "media/base/subsample_entry.h" +#include "media/cdm/aes_cbc_crypto.h" + +namespace media { + +namespace { + +constexpr size_t kAesBlockSizeInBytes = 16; + +// Decrypts |input_data| into |output_data|, using the pattern specified in +// |pattern|. |pattern| only applies to full blocks. Any partial block at +// the end is considered unencrypted. |output_data| must have enough room to +// hold |input_data|.size() bytes. +bool DecryptWithPattern(const crypto::SymmetricKey& key, + base::span<const uint8_t> iv, + const EncryptionPattern& pattern, + base::span<const uint8_t> input_data, + uint8_t* output_data) { + // The AES_CBC decryption is reset for each subsample. + AesCbcCrypto aes_cbc_crypto; + if (!aes_cbc_crypto.Initialize(key, iv)) + return false; + + // |total_blocks| is the number of blocks in the buffer, ignoring any + // partial block at the end. |remaining_bytes| is the number of bytes + // in the partial block at the end of the buffer, if any. + size_t total_blocks = input_data.size_bytes() / kAesBlockSizeInBytes; + size_t remaining_bytes = input_data.size_bytes() % kAesBlockSizeInBytes; + + size_t crypt_byte_block = + base::strict_cast<size_t>(pattern.crypt_byte_block()); + size_t skip_byte_block = base::strict_cast<size_t>(pattern.skip_byte_block()); + + // |crypt_byte_block| and |skip_byte_block| come from 4 bit values, so fail + // if these are too large. + if (crypt_byte_block >= 16 || skip_byte_block >= 16) + return false; + + if (crypt_byte_block == 0 && skip_byte_block == 0) { + // From ISO/IEC 23001-7:2016(E), section 9.6.1: + // "When the fields default_crypt_byte_block and default_skip_byte_block + // in a version 1 Track Encryption Box ('tenc') are non-zero numbers, + // pattern encryption SHALL be applied." + // So for the pattern 0:0, assume that all blocks are encrypted. + crypt_byte_block = total_blocks; + } + + // Apply the pattern to |input_data|. + // Example (using Pattern(2,3), Ex is encrypted, Ux unencrypted) + // input_data: |E1|E2|U3|U4|U5|E6|E7|U8|U9|U10|E11| + // We must decrypt 2 blocks, then simply copy the next 3 blocks, and + // repeat until the end. Note that the input does not have to contain + // a full pattern at the end (although see the comment below). + size_t blocks_processed = 0; + const uint8_t* src = input_data.data(); + uint8_t* dest = output_data; + bool is_encrypted_blocks = false; + while (blocks_processed < total_blocks) { + is_encrypted_blocks = !is_encrypted_blocks; + size_t blocks_to_process = + std::min(is_encrypted_blocks ? crypt_byte_block : skip_byte_block, + total_blocks - blocks_processed); + + if (blocks_to_process == 0) + continue; + + size_t bytes_to_process = blocks_to_process * kAesBlockSizeInBytes; + + // From ISO/IEC 23001-7:2016(E), section 9.6.1: + // "If the last Block pattern in a Subsample is incomplete, the partial + // pattern SHALL be followed until truncated by the BytesOfProtectedData + // size and any partial crypt_byte_block SHALL remain unencrypted." + // So if the last Block pattern is incomplete, it needs to have at least + // |crypt_byte_block| blocks to be considered encrypted. If it doesn't, + // it is treated as unencrypted and simply copied over. + if (is_encrypted_blocks && blocks_to_process == crypt_byte_block) { + if (!aes_cbc_crypto.Decrypt(base::make_span(src, bytes_to_process), + dest)) { + return false; + } + } else { + memcpy(dest, src, bytes_to_process); + } + + blocks_processed += blocks_to_process; + src += bytes_to_process; + dest += bytes_to_process; + } + + // Any partial block data remaining in this subsample is considered + // unencrypted so simply copy it into |dest|. + if (remaining_bytes > 0) + memcpy(dest, src, remaining_bytes); + + return true; +} + +} // namespace + +scoped_refptr<DecoderBuffer> DecryptCbcsBuffer( + const DecoderBuffer& input, + const crypto::SymmetricKey& key) { + size_t sample_size = input.data_size(); + DCHECK(sample_size) << "No data to decrypt."; + + const DecryptConfig* decrypt_config = input.decrypt_config(); + DCHECK(decrypt_config) << "No need to call Decrypt() on unencrypted buffer."; + DCHECK_EQ(EncryptionMode::kCbcs, decrypt_config->encryption_mode()); + + DCHECK(decrypt_config->HasPattern()); + const EncryptionPattern pattern = + decrypt_config->encryption_pattern().value(); + + // Decrypted data will be the same size as |input| size. + auto buffer = base::MakeRefCounted<DecoderBuffer>(sample_size); + uint8_t* output_data = buffer->writable_data(); + buffer->set_timestamp(input.timestamp()); + buffer->set_duration(input.duration()); + buffer->set_is_key_frame(input.is_key_frame()); + buffer->CopySideDataFrom(input.side_data(), input.side_data_size()); + + const std::vector<SubsampleEntry>& subsamples = decrypt_config->subsamples(); + if (subsamples.empty()) { + // Assume the whole buffer is encrypted. + return DecryptWithPattern( + key, base::as_bytes(base::make_span(decrypt_config->iv())), + pattern, base::make_span(input.data(), sample_size), output_data) + ? buffer + : nullptr; + } + + if (!VerifySubsamplesMatchSize(subsamples, sample_size)) { + DVLOG(1) << "Subsample sizes do not equal input size"; + return nullptr; + } + + const uint8_t* src = input.data(); + uint8_t* dest = output_data; + for (const auto& subsample : subsamples) { + if (subsample.clear_bytes) { + DVLOG(4) << "Copying clear_bytes: " << subsample.clear_bytes; + memcpy(dest, src, subsample.clear_bytes); + src += subsample.clear_bytes; + dest += subsample.clear_bytes; + } + + if (subsample.cypher_bytes) { + DVLOG(4) << "Processing cypher_bytes: " << subsample.cypher_bytes + << ", pattern(" << pattern.crypt_byte_block() << "," + << pattern.skip_byte_block() << ")"; + if (!DecryptWithPattern( + key, base::as_bytes(base::make_span(decrypt_config->iv())), + pattern, base::make_span(src, subsample.cypher_bytes), dest)) { + return nullptr; + } + src += subsample.cypher_bytes; + dest += subsample.cypher_bytes; + } + } + + return buffer; +} + +} // namespace media
diff --git a/media/cdm/cbcs_decryptor.h b/media/cdm/cbcs_decryptor.h new file mode 100644 index 0000000..702eb7a --- /dev/null +++ b/media/cdm/cbcs_decryptor.h
@@ -0,0 +1,55 @@ +// 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 MEDIA_CDM_CBCS_DECRYPTOR_H_ +#define MEDIA_CDM_CBCS_DECRYPTOR_H_ + +#include "base/memory/ref_counted.h" +#include "media/base/media_export.h" + +namespace crypto { +class SymmetricKey; +} + +namespace media { +class DecoderBuffer; + +// This class implements pattern decryption as specified by +// ISO/IEC 23001-7:2016, section 10.4 (https://www.iso.org), +// using AES-CBC-128 decryption. +// +// Subsample encryption divides each input buffer into one or more contiguous +// subsamples. Each subsample has an unprotected part (unencrypted) followed +// by a protected part (encrypted), only one of which may be zero bytes in +// length. For example: +// | DecoderBuffer.data() | +// | Subsample#1 | Subsample#2 | Subsample#3 | +// |uuuuu|eeeeeeeeee|uuuu|eeeeeeeeeeee|uu|eeeeeeeeeeee| +// Within the protected part of each subsample, the data is treated as a +// chain of 16 byte cipher blocks, starting with the initialization vector +// associated with the sample. The IV is applied to the first encrypted +// cipher block of each subsample. +// +// A partial block at the end of a subsample (if any) is unencrypted. +// +// This supports pattern decryption, where a pattern of encrypted and clear +// (skipped) blocks is used. The Pattern is specified with each DecoderBuffer +// (in the DecryptConfig). Typically encrypted video tracks use a pattern of +// (1,9) which indicates that one 16 byte block is encrypted followed by 9 +// blocks unencrypted, and then the pattern repeats through all the blocks in +// the protected part. Tracks other than video usually use full-sample +// encryption. +// +// If a pattern is not specified, the protected part will use full-sample +// encryption. + +// Decrypts the encrypted buffer |input| using |key| and values found in +// |input|->DecryptConfig. The key size must be 128 bits. +MEDIA_EXPORT scoped_refptr<DecoderBuffer> DecryptCbcsBuffer( + const DecoderBuffer& input, + const crypto::SymmetricKey& key); + +} // namespace media + +#endif // MEDIA_CDM_CBCS_DECRYPTOR_H_
diff --git a/media/cdm/cbcs_decryptor_unittest.cc b/media/cdm/cbcs_decryptor_unittest.cc new file mode 100644 index 0000000..da2f48a --- /dev/null +++ b/media/cdm/cbcs_decryptor_unittest.cc
@@ -0,0 +1,408 @@ +// 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 "media/cdm/cbcs_decryptor.h" + +#include <array> +#include <memory> + +#include "base/containers/span.h" +#include "base/optional.h" +#include "base/stl_util.h" +#include "base/time/time.h" +#include "crypto/encryptor.h" +#include "crypto/symmetric_key.h" +#include "media/base/decoder_buffer.h" +#include "media/base/decrypt_config.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media { + +namespace { + +// Pattern decryption uses 16-byte blocks. +constexpr size_t kBlockSize = 16; + +// Keys and IVs have to be 128 bits. +const std::array<uint8_t, 16> kKey = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13}; + +const std::array<uint8_t, 16> kIv = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, + 0x26, 0x27, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; + +const std::array<uint8_t, kBlockSize> kOneBlock = {'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', + 'm', 'n', 'o', 'p'}; + +const std::array<uint8_t, 6> kPartialBlock = {'a', 'b', 'c', 'd', 'e', 'f'}; +static_assert(base::size(kPartialBlock) != kBlockSize, "kPartialBlock wrong"); + +std::string MakeString(const std::vector<uint8_t>& chars) { + return std::string(chars.begin(), chars.end()); +} + +// Combine multiple std::vector<uint8_t> into one. +std::vector<uint8_t> Combine(const std::vector<std::vector<uint8_t>>& inputs) { + std::vector<uint8_t> result; + for (const auto& input : inputs) + result.insert(result.end(), input.begin(), input.end()); + + return result; +} + +// Extract the |n|th block of |input|. The first block is number 1. +std::vector<uint8_t> GetBlock(size_t n, const std::vector<uint8_t>& input) { + DCHECK_LE(n, input.size() / kBlockSize); + auto it = input.begin() + ((n - 1) * kBlockSize); + return std::vector<uint8_t>(it, it + kBlockSize); +} + +// Returns a std::vector<uint8_t> containing |count| copies of |input|. +std::vector<uint8_t> Repeat(const std::vector<uint8_t>& input, size_t count) { + std::vector<uint8_t> result; + for (size_t i = 0; i < count; ++i) + result.insert(result.end(), input.begin(), input.end()); + return result; +} + +} // namespace + +class CbcsDecryptorTest : public testing::Test { + public: + CbcsDecryptorTest() + : key_(crypto::SymmetricKey::Import( + crypto::SymmetricKey::AES, + std::string(std::begin(kKey), std::end(kKey)))), + iv_(std::begin(kIv), std::end(kIv)), + one_block_(std::begin(kOneBlock), std::end(kOneBlock)), + partial_block_(std::begin(kPartialBlock), std::end(kPartialBlock)) {} + + // Excrypt |original| using AES-CBC encryption with |key| and |iv|. + std::vector<uint8_t> Encrypt(const std::vector<uint8_t>& original, + const crypto::SymmetricKey& key, + const std::string& iv) { + // This code uses crypto::Encryptor to encrypt |original| rather than + // calling EVP_EncryptInit_ex() / EVP_EncryptUpdate() / etc. This is done + // for simplicity, as the crypto:: code wraps all the calls up nicely. + // However, for AES-CBC encryption, the crypto:: code does add padding to + // the output, which is simply stripped off. + crypto::Encryptor encryptor; + EXPECT_TRUE(encryptor.Init(&key, crypto::Encryptor::CBC, iv)); + + std::string ciphertext; + EXPECT_TRUE(encryptor.Encrypt(MakeString(original), &ciphertext)); + + // CBC encyption adds a block of padding at the end, so discard it. + DCHECK_GT(ciphertext.size(), original.size()); + ciphertext.resize(original.size()); + + return std::vector<uint8_t>(ciphertext.begin(), ciphertext.end()); + } + + // Returns a 'cbcs' DecoderBuffer using the data and other parameters. + scoped_refptr<DecoderBuffer> CreateEncryptedBuffer( + const std::vector<uint8_t>& data, + const std::string& iv, + const std::vector<SubsampleEntry>& subsample_entries, + base::Optional<EncryptionPattern> encryption_pattern) { + EXPECT_FALSE(data.empty()); + EXPECT_FALSE(iv.empty()); + + auto encrypted_buffer = DecoderBuffer::CopyFrom(data.data(), data.size()); + + // Key_ID is never used. + encrypted_buffer->set_decrypt_config(DecryptConfig::CreateCbcsConfig( + "key_id", iv, subsample_entries, encryption_pattern)); + return encrypted_buffer; + } + + // Calls DecryptCbcsBuffer() to decrypt |encrypted| using |key|, + // and then returns the data in the decrypted buffer. + std::vector<uint8_t> DecryptWithKey(scoped_refptr<DecoderBuffer> encrypted, + const crypto::SymmetricKey& key) { + auto decrypted = DecryptCbcsBuffer(*encrypted, key); + + std::vector<uint8_t> decrypted_data; + if (decrypted.get()) { + EXPECT_TRUE(decrypted->data_size()); + decrypted_data.assign(decrypted->data(), + decrypted->data() + decrypted->data_size()); + } + + return decrypted_data; + } + + // Constants for testing. + std::unique_ptr<crypto::SymmetricKey> key_; + const std::string iv_; + const std::vector<uint8_t> one_block_; + const std::vector<uint8_t> partial_block_; +}; + +TEST_F(CbcsDecryptorTest, OneBlock) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // Only 1 subsample, all encrypted data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 9)); + EXPECT_EQ(one_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, AdditionalData) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // Only 1 subsample, all encrypted data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 9)); + encrypted_buffer->set_timestamp(base::TimeDelta::FromDays(2)); + encrypted_buffer->set_duration(base::TimeDelta::FromMinutes(5)); + encrypted_buffer->set_is_key_frame(true); + encrypted_buffer->CopySideDataFrom(encrypted_block.data(), + encrypted_block.size()); + + auto decrypted_buffer = DecryptCbcsBuffer(*encrypted_buffer, *key_); + EXPECT_EQ(encrypted_buffer->timestamp(), decrypted_buffer->timestamp()); + EXPECT_EQ(encrypted_buffer->duration(), decrypted_buffer->duration()); + EXPECT_EQ(encrypted_buffer->end_of_stream(), + decrypted_buffer->end_of_stream()); + EXPECT_EQ(encrypted_buffer->is_key_frame(), decrypted_buffer->is_key_frame()); + EXPECT_EQ(encrypted_buffer->side_data_size(), + decrypted_buffer->side_data_size()); + EXPECT_EQ(base::make_span(encrypted_buffer->side_data(), + encrypted_buffer->side_data_size()), + base::make_span(decrypted_buffer->side_data(), + decrypted_buffer->side_data_size())); +} + +TEST_F(CbcsDecryptorTest, DifferentPattern) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // Only 1 subsample, all encrypted data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 0)); + EXPECT_EQ(one_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, EmptyPattern) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // Only 1 subsample, all encrypted data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + // Pattern 0:0 treats the buffer as all encrypted. + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(0, 0)); + EXPECT_EQ(one_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, PatternTooLarge) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // Only 1 subsample, all encrypted data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + // Pattern 100:0 is too large, so decryption will fail. + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(100, 0)); + EXPECT_EQ(std::vector<uint8_t>(), DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, NoSubsamples) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + std::vector<SubsampleEntry> subsamples = {}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 9)); + EXPECT_EQ(one_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, BadSubsamples) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + + // Subsample size > data size. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size() + 1}}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 0)); + EXPECT_EQ(std::vector<uint8_t>(), DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, InvalidIv) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + // Use an invalid IV for decryption. Call should succeed, but return + // something other than the original data. + std::string invalid_iv(iv_.size(), 'a'); + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, invalid_iv, subsamples, EncryptionPattern(1, 0)); + EXPECT_NE(one_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, InvalidKey) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + // Use a different key for decryption. Call should succeed, but return + // something other than the original data. + std::unique_ptr<crypto::SymmetricKey> bad_key = crypto::SymmetricKey::Import( + crypto::SymmetricKey::AES, std::string(base::size(kKey), 'b')); + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 0)); + EXPECT_NE(one_block_, DecryptWithKey(encrypted_buffer, *bad_key)); +} + +TEST_F(CbcsDecryptorTest, PartialBlock) { + // Only 1 subsample, all "encrypted" data. However, as it's not a full block, + // it will be treated as unencrypted. + std::vector<SubsampleEntry> subsamples = {{0, partial_block_.size()}}; + + auto encrypted_buffer = CreateEncryptedBuffer(partial_block_, iv_, subsamples, + EncryptionPattern(1, 0)); + EXPECT_EQ(partial_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, SingleBlockWithExtraData) { + // Create some data that is longer than a single block. The full block will + // be encrypted, but the extra data at the end will be considered unencrypted. + auto encrypted_block = + Combine({Encrypt(one_block_, *key_, iv_), partial_block_}); + auto expected_result = Combine({one_block_, partial_block_}); + + // Only 1 subsample, all "encrypted" data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(1, 0)); + EXPECT_EQ(expected_result, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, SkipBlock) { + // Only 1 subsample, but all unencrypted data. + std::vector<SubsampleEntry> subsamples = {{one_block_.size(), 0}}; + + auto encrypted_buffer = CreateEncryptedBuffer(one_block_, iv_, subsamples, + EncryptionPattern(1, 0)); + EXPECT_EQ(one_block_, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, MultipleBlocks) { + // Encrypt 2 copies of |one_block_| together using kKey and kIv. + auto encrypted_block = Encrypt(Repeat(one_block_, 2), *key_, iv_); + DCHECK_EQ(2 * kBlockSize, encrypted_block.size()); + + // 1 subsample, 4 blocks in (1,1) pattern. + // Encrypted blocks come from |encrypted_block|. + // data: | enc1 | clear | enc2 | clear | + // subsamples: | subsample#1 | + // |eeeeeeeeeeeeeeeeeeeeeeeeeeeee| + auto input_data = Combine({GetBlock(1, encrypted_block), one_block_, + GetBlock(2, encrypted_block), one_block_}); + auto expected_result = Repeat(one_block_, 4); + std::vector<SubsampleEntry> subsamples = {{0, 4 * kBlockSize}}; + + auto encrypted_buffer = CreateEncryptedBuffer(input_data, iv_, subsamples, + EncryptionPattern(1, 1)); + EXPECT_EQ(expected_result, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, PartialPattern) { + // Encrypt 4 copies of |one_block_| together using kKey and kIv. + auto encrypted_block = Encrypt(Repeat(one_block_, 4), *key_, iv_); + DCHECK_EQ(4 * kBlockSize, encrypted_block.size()); + + // 1 subsample, 4 blocks in (8,2) pattern. As there are not 8 blocks, the + // whole buffer will be considered unencrypted. + std::vector<SubsampleEntry> subsamples = {{0, 4 * kBlockSize}}; + + auto encrypted_buffer = CreateEncryptedBuffer( + encrypted_block, iv_, subsamples, EncryptionPattern(8, 2)); + EXPECT_EQ(encrypted_block, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, SkipBlocks) { + // Encrypt 5 blocks together using kKey and kIv. + auto encrypted_block = Encrypt(Repeat(one_block_, 5), *key_, iv_); + DCHECK_EQ(5 * kBlockSize, encrypted_block.size()); + + // 1 subsample, 1 unencrypted block followed by 7 blocks in (2,1) pattern. + // Encrypted blocks come from |encrypted_block|. + // data: | clear | enc1 | enc2 | clear | enc3 | enc4 | clear | enc5 | + // subsamples: | subsample#1 | + // |uuuuuuu eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee| + // Note that the last part only contains one encrypted block. Since it + // doesn't contain a full 2 blocks, it will not be decrypted. + auto input_data = Combine( + {one_block_, GetBlock(1, encrypted_block), GetBlock(2, encrypted_block), + one_block_, GetBlock(3, encrypted_block), GetBlock(4, encrypted_block), + one_block_, GetBlock(5, encrypted_block)}); + auto expected_result = + Combine({Repeat(one_block_, 7), GetBlock(5, encrypted_block)}); + std::vector<SubsampleEntry> subsamples = {{kBlockSize, 7 * kBlockSize}}; + + auto encrypted_buffer = CreateEncryptedBuffer(input_data, iv_, subsamples, + EncryptionPattern(2, 1)); + EXPECT_EQ(expected_result, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, MultipleSubsamples) { + // Encrypt |one_block_| using kKey and kIv. + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // 3 subsamples, each 1 block of |encrypted_block|. + // data: | encrypted | encrypted | encrypted | + // subsamples: | subsample#1 | subsample#2 | subsample#3 | + // |eeeeeeeeeeeee|eeeeeeeeeeeee|eeeeeeeeeeeee| + auto input_data = Repeat(encrypted_block, 3); + auto expected_result = Repeat(one_block_, 3); + std::vector<SubsampleEntry> subsamples = { + {0, kBlockSize}, {0, kBlockSize}, {0, kBlockSize}}; + + auto encrypted_buffer = CreateEncryptedBuffer(input_data, iv_, subsamples, + EncryptionPattern(1, 0)); + EXPECT_EQ(expected_result, DecryptWithKey(encrypted_buffer, *key_)); +} + +TEST_F(CbcsDecryptorTest, MultipleSubsamplesWithClearBytes) { + // Encrypt |one_block_| using kKey and kIv. + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + DCHECK_EQ(kBlockSize, encrypted_block.size()); + + // Combine into alternating clear/encrypted blocks in 3 subsamples. Split + // the second and third clear blocks into part of encrypted data of the + // previous block (which as a partial block will be considered unencrypted). + // data: | clear | encrypted | clear | encrypted | clear | encrypted | + // subsamples: | subsample#1 | subsample#2 | subsample#3 | + // |uuuuuuu eeeeeeeeeeee|uuuuuu eeeeeeeeeeeeeeee|uu eeeeeeeeeee| + auto input_data = Combine({one_block_, encrypted_block, one_block_, + encrypted_block, one_block_, encrypted_block}); + auto expected_result = Repeat(one_block_, 6); + std::vector<SubsampleEntry> subsamples = {{kBlockSize, kBlockSize + 1}, + {kBlockSize - 1, kBlockSize + 10}, + {kBlockSize - 10, kBlockSize}}; + + auto encrypted_buffer = CreateEncryptedBuffer(input_data, iv_, subsamples, + EncryptionPattern(1, 0)); + EXPECT_EQ(expected_result, DecryptWithKey(encrypted_buffer, *key_)); +} + +} // namespace media
diff --git a/media/cdm/cenc_decryptor.cc b/media/cdm/cenc_decryptor.cc index 0a29e0967..ae0442f 100644 --- a/media/cdm/cenc_decryptor.cc +++ b/media/cdm/cenc_decryptor.cc
@@ -48,6 +48,15 @@ } } +// TODO(crbug.com/840983): This should be done in DecoderBuffer so that +// additional fields are more easily handled. +void CopyExtraSettings(const DecoderBuffer& input, DecoderBuffer* output) { + output->set_timestamp(input.timestamp()); + output->set_duration(input.duration()); + output->set_is_key_frame(input.is_key_frame()); + output->CopySideDataFrom(input.side_data(), input.side_data_size()); +} + } // namespace scoped_refptr<DecoderBuffer> DecryptCencBuffer( @@ -85,31 +94,30 @@ } // TODO(xhwang): Find a way to avoid this data copy. - return DecoderBuffer::CopyFrom( + auto output = DecoderBuffer::CopyFrom( reinterpret_cast<const uint8_t*>(decrypted_text.data()), decrypted_text.size()); + CopyExtraSettings(input, output.get()); + return output; } - // Verify the entries in |subsamples|. - size_t total_clear_size = 0; - size_t total_encrypted_size = 0; - for (size_t i = 0; i < subsamples.size(); i++) { - total_clear_size += subsamples[i].clear_bytes; - total_encrypted_size += subsamples[i].cypher_bytes; - // Check for overflow. This check is valid because *_size is unsigned. - DCHECK(total_clear_size >= subsamples[i].clear_bytes); - if (total_encrypted_size < subsamples[i].cypher_bytes) - return nullptr; - } - size_t total_size = total_clear_size + total_encrypted_size; - if (total_size < total_clear_size || total_size != sample_size) { + if (!VerifySubsamplesMatchSize(subsamples, sample_size)) { DVLOG(1) << "Subsample sizes do not equal input size"; return nullptr; } + // Compute the size of the encrypted portion. Overflow, etc. checked by + // the call to VerifySubsamplesMatchSize(). + size_t total_encrypted_size = 0; + for (const auto& subsample : subsamples) + total_encrypted_size += subsample.cypher_bytes; + // No need to decrypt if there is no encrypted data. - if (total_encrypted_size == 0) - return DecoderBuffer::CopyFrom(input.data(), sample_size); + if (total_encrypted_size == 0) { + auto output = DecoderBuffer::CopyFrom(input.data(), sample_size); + CopyExtraSettings(input, output.get()); + return output; + } // The encrypted portions of all subsamples must form a contiguous block, // such that an encrypted subsample that ends away from a block boundary is @@ -137,6 +145,7 @@ CopySubsamples(subsamples, kDstContainsClearBytes, reinterpret_cast<const uint8_t*>(decrypted_text.data()), output->writable_data()); + CopyExtraSettings(input, output.get()); return output; }
diff --git a/media/cdm/cenc_decryptor_unittest.cc b/media/cdm/cenc_decryptor_unittest.cc index 3f95ab6..2fa6b690 100644 --- a/media/cdm/cenc_decryptor_unittest.cc +++ b/media/cdm/cenc_decryptor_unittest.cc
@@ -9,6 +9,8 @@ #include <string> #include <vector> +#include "base/containers/span.h" +#include "base/time/time.h" #include "crypto/encryptor.h" #include "crypto/symmetric_key.h" #include "media/base/decoder_buffer.h" @@ -134,6 +136,34 @@ EXPECT_EQ(one_block_, DecryptWithKey(encrypted_buffer, *key_)); } +TEST_F(CencDecryptorTest, ExtraData) { + auto encrypted_block = Encrypt(one_block_, *key_, iv_); + + // Only 1 subsample, all encrypted data. + std::vector<SubsampleEntry> subsamples = {{0, encrypted_block.size()}}; + + auto encrypted_buffer = + CreateEncryptedBuffer(encrypted_block, iv_, subsamples); + encrypted_buffer->set_timestamp(base::TimeDelta::FromDays(2)); + encrypted_buffer->set_duration(base::TimeDelta::FromMinutes(5)); + encrypted_buffer->set_is_key_frame(true); + encrypted_buffer->CopySideDataFrom(encrypted_block.data(), + encrypted_block.size()); + + auto decrypted_buffer = DecryptCencBuffer(*encrypted_buffer, *key_); + EXPECT_EQ(encrypted_buffer->timestamp(), decrypted_buffer->timestamp()); + EXPECT_EQ(encrypted_buffer->duration(), decrypted_buffer->duration()); + EXPECT_EQ(encrypted_buffer->end_of_stream(), + decrypted_buffer->end_of_stream()); + EXPECT_EQ(encrypted_buffer->is_key_frame(), decrypted_buffer->is_key_frame()); + EXPECT_EQ(encrypted_buffer->side_data_size(), + decrypted_buffer->side_data_size()); + EXPECT_EQ(base::make_span(encrypted_buffer->side_data(), + encrypted_buffer->side_data_size()), + base::make_span(decrypted_buffer->side_data(), + decrypted_buffer->side_data_size())); +} + TEST_F(CencDecryptorTest, NoSubsamples) { auto encrypted_block = Encrypt(one_block_, *key_, iv_);
diff --git a/media/gpu/video_decode_accelerator_unittest.cc b/media/gpu/video_decode_accelerator_unittest.cc index 672a225..85254a5 100644 --- a/media/gpu/video_decode_accelerator_unittest.cc +++ b/media/gpu/video_decode_accelerator_unittest.cc
@@ -1262,35 +1262,43 @@ base::FilePath filepath(test_video_files_[0]->file_name); auto golden_md5s = media::test::ReadGoldenThumbnailMD5s( filepath.AddExtension(FILE_PATH_LITERAL(".md5"))); - if (!base::ContainsValue(golden_md5s, md5_string)) { - // Convert raw RGBA into PNG for export. - std::vector<unsigned char> png; - gfx::PNGCodec::Encode(&rgba[0], gfx::PNGCodec::FORMAT_RGBA, - kThumbnailsPageSize, - kThumbnailsPageSize.width() * 4, true, - std::vector<gfx::PNGCodec::Comment>(), &png); + bool is_valid_thumbnail = base::ContainsValue(golden_md5s, md5_string); - if (!g_thumbnail_output_dir.empty() && - base::DirectoryExists(g_thumbnail_output_dir)) { - // Write bad thumbnails image to where --thumbnail_output_dir assigned. - filepath = g_thumbnail_output_dir.Append(filepath.BaseName()); - } else { - // Fallback to write to test data directory. - // Note: test data directory is not writable by vda_unittest while - // running by autotest. It should assign its resultsdir as output - // directory. - filepath = GetTestDataFile(filepath); - } + // Convert raw RGBA into PNG for export. + std::vector<unsigned char> png; + gfx::PNGCodec::Encode(&rgba[0], gfx::PNGCodec::FORMAT_RGBA, + kThumbnailsPageSize, kThumbnailsPageSize.width() * 4, + true, std::vector<gfx::PNGCodec::Comment>(), &png); + + if (!g_thumbnail_output_dir.empty() && + base::DirectoryExists(g_thumbnail_output_dir)) { + // Write thumbnails image to where --thumbnail_output_dir assigned. + filepath = g_thumbnail_output_dir.Append(filepath.BaseName()); + } else { + // Fallback to write to test data directory. + // Note: test data directory is not writable by vda_unittest while + // running by autotest. It should assign its resultsdir as output + // directory. + filepath = GetTestDataFile(filepath); + } + + if (is_valid_thumbnail) { + filepath = + filepath.AddExtension(FILE_PATH_LITERAL(".good_thumbnails.png")); + LOG(INFO) << "Write good thumbnails image to: " + << filepath.value().c_str(); + } else { filepath = filepath.AddExtension(FILE_PATH_LITERAL(".bad_thumbnails.png")); LOG(INFO) << "Write bad thumbnails image to: " << filepath.value().c_str(); - int num_bytes = base::WriteFile( - filepath, reinterpret_cast<char*>(&png[0]), png.size()); - LOG_ASSERT(num_bytes != -1); - EXPECT_EQ(static_cast<size_t>(num_bytes), png.size()); - LOG(FATAL) << "Unknown thumbnails MD5: " << md5_string; } + int num_bytes = + base::WriteFile(filepath, reinterpret_cast<char*>(&png[0]), png.size()); + LOG_ASSERT(num_bytes != -1); + EXPECT_EQ(static_cast<size_t>(num_bytes), png.size()); + EXPECT_EQ(is_valid_thumbnail, true) + << "Unknown thumbnails MD5: " << md5_string; } // Output the frame delivery time to file
diff --git a/net/base/registry_controlled_domains/effective_tld_names.dat b/net/base/registry_controlled_domains/effective_tld_names.dat index efda68a..a210b9d6 100644 --- a/net/base/registry_controlled_domains/effective_tld_names.dat +++ b/net/base/registry_controlled_domains/effective_tld_names.dat
@@ -449,6 +449,7 @@ art.br ato.br b.br +barueri.br belem.br bhz.br bio.br @@ -1133,7 +1134,7 @@ net.gy org.gy -// hk : https://www.hkdnr.hk +// hk : https://www.hkirc.hk // Submitted by registry <hk.tech@hkirc.hk> hk com.hk @@ -1344,10 +1345,8 @@ it gov.it edu.it -// Reserved geo-names: -// http://www.nic.it/documenti/regolamenti-e-linee-guida/regolamento-assegnazione-versione-6.0.pdf -// There is also a list of reserved geo-names corresponding to Italian municipalities -// http://www.nic.it/documenti/appendice-c.pdf, but it is not included here. +// Reserved geo-names (regions and provinces): +// http://www.nic.it/sites/default/files/docs/Regulation_assignation_v7.1.pdf // Regions abr.it abruzzo.it @@ -1401,6 +1400,12 @@ taa.it tos.it toscana.it +trentin-sud-tirol.it +trentin-süd-tirol.it +trentin-sudtirol.it +trentin-südtirol.it +trentin-sued-tirol.it +trentin-suedtirol.it trentino-a-adige.it trentino-aadige.it trentino-alto-adige.it @@ -1408,9 +1413,12 @@ trentino-s-tirol.it trentino-stirol.it trentino-sud-tirol.it +trentino-süd-tirol.it trentino-sudtirol.it +trentino-südtirol.it trentino-sued-tirol.it trentino-suedtirol.it +trentino.it trentinoa-adige.it trentinoaadige.it trentinoalto-adige.it @@ -1418,9 +1426,17 @@ trentinos-tirol.it trentinostirol.it trentinosud-tirol.it +trentinosüd-tirol.it trentinosudtirol.it +trentinosüdtirol.it trentinosued-tirol.it trentinosuedtirol.it +trentinsud-tirol.it +trentinsüd-tirol.it +trentinsudtirol.it +trentinsüdtirol.it +trentinsued-tirol.it +trentinsuedtirol.it tuscany.it umb.it umbria.it @@ -1435,7 +1451,13 @@ valled-aosta.it valledaosta.it vallee-aoste.it +vallée-aoste.it +vallee-d-aoste.it +vallée-d-aoste.it valleeaoste.it +valléeaoste.it +valleedaoste.it +valléedaoste.it vao.it vda.it ven.it @@ -1468,6 +1490,9 @@ av.it avellino.it ba.it +balsan-sudtirol.it +balsan-südtirol.it +balsan-suedtirol.it balsan.it bari.it barletta-trani-andria.it @@ -1482,13 +1507,21 @@ bn.it bo.it bologna.it +bolzano-altoadige.it bolzano.it +bozen-sudtirol.it +bozen-südtirol.it +bozen-suedtirol.it bozen.it br.it brescia.it brindisi.it bs.it bt.it +bulsan-sudtirol.it +bulsan-südtirol.it +bulsan-suedtirol.it +bulsan.it bz.it ca.it cagliari.it @@ -1506,7 +1539,9 @@ cb.it ce.it cesena-forli.it +cesena-forlì.it cesenaforli.it +cesenaforlì.it ch.it chieti.it ci.it @@ -1537,7 +1572,9 @@ fm.it foggia.it forli-cesena.it +forlì-cesena.it forlicesena.it +forlìcesena.it fr.it frosinone.it ge.it @@ -1668,6 +1705,7 @@ sr.it ss.it suedtirol.it +südtirol.it sv.it ta.it taranto.it @@ -1686,7 +1724,6 @@ traniandriabarletta.it tranibarlettaandria.it trapani.it -trentino.it trento.it treviso.it trieste.it @@ -6156,9 +6193,6 @@ // Used by government agencies of Northern Cyprus gov.nc.tr -// travel : https://en.wikipedia.org/wiki/.travel -travel - // tt : http://www.nic.tt/ tt co.tt @@ -6733,8 +6767,16 @@ ελ // xn--j6w193g ("Hong Kong", Chinese) : HK -// https://www2.hkirc.hk/register/rules.jsp +// https://www.hkirc.hk +// Submitted by registry <hk.tech@hkirc.hk> +// https://www.hkirc.hk/content.jsp?id=30#!/34 香港 +公司.香港 +教育.香港 +政府.香港 +個人.香港 +網絡.香港 +組織.香港 // xn--2scrj9c ("Bharat", Kannada) : IN // India @@ -6768,6 +6810,10 @@ // India भारत +// xn--mgbbh1a ("Bharat", Kashmiri) : IN +// India +بارت + // xn--mgbbh1a71e ("Bharat", Arabic) : IN // India بھارت @@ -6982,7 +7028,10 @@ mil.zw org.zw -// List of new gTLDs imported from https://newgtlds.icann.org/newgtlds.csv on 2017-02-23T00:46:09Z + +// newGTLDs +// List of new gTLDs imported from https://newgtlds.icann.org/newgtlds.csv on 2018-05-08T19:40:37Z +// This list is auto-generated, don't edit it manually. // aaa : 2015-02-26 American Automobile Association, Inc. aaa @@ -7008,13 +7057,13 @@ // able : 2015-06-25 Able Inc. able -// abogado : 2014-04-24 Top Level Domain Holdings Limited +// abogado : 2014-04-24 Minds + Machines Group Limited abogado // abudhabi : 2015-07-30 Abu Dhabi Systems and Information Centre abudhabi -// academy : 2013-11-07 Half Oaks, LLC +// academy : 2013-11-07 Binky Moon, LLC academy // accenture : 2014-08-15 Accenture plc @@ -7023,13 +7072,13 @@ // accountant : 2014-11-20 dot Accountant Limited accountant -// accountants : 2014-03-20 Knob Town, LLC +// accountants : 2014-03-20 Binky Moon, LLC accountants // aco : 2015-01-08 ACO Severin Ahlmann GmbH & Co. KG aco -// active : 2014-05-01 The Active Network, Inc +// active : 2014-05-01 Active Network, LLC active // actor : 2013-12-12 United TLD Holdco Ltd. @@ -7062,7 +7111,7 @@ // agakhan : 2015-04-23 Fondation Aga Khan (Aga Khan Foundation) agakhan -// agency : 2013-11-14 Steel Falls, LLC +// agency : 2013-11-14 Binky Moon, LLC agency // aig : 2014-12-18 American International Group, Inc. @@ -7101,7 +7150,7 @@ // ally : 2015-06-18 Ally Financial Inc. ally -// alsace : 2014-07-02 REGION D ALSACE +// alsace : 2014-07-02 Region Grand Est alsace // alstom : 2015-07-30 ALSTOM @@ -7137,10 +7186,10 @@ // anz : 2015-07-31 Australia and New Zealand Banking Group Limited anz -// aol : 2015-09-17 AOL Inc. +// aol : 2015-09-17 Oath Inc. aol -// apartments : 2014-12-11 June Maple, LLC +// apartments : 2014-12-11 Binky Moon, LLC apartments // app : 2015-05-14 Charleston Road Registry Inc. @@ -7158,7 +7207,7 @@ // aramco : 2014-11-20 Aramco Services Company aramco -// archi : 2014-02-06 STARTING DOT LIMITED +// archi : 2014-02-06 Afilias plc archi // army : 2014-03-06 United TLD Holdco Ltd. @@ -7173,22 +7222,22 @@ // asda : 2015-07-31 Wal-Mart Stores, Inc. asda -// associates : 2014-03-06 Baxter Hill, LLC +// associates : 2014-03-06 Binky Moon, LLC associates // athleta : 2015-07-30 The Gap, Inc. athleta -// attorney : 2014-03-20 +// attorney : 2014-03-20 United TLD Holdco Ltd. attorney -// auction : 2014-03-20 +// auction : 2014-03-20 United TLD Holdco Ltd. auction // audi : 2015-05-21 AUDI Aktiengesellschaft audi -// audible : 2015-06-25 Amazon EU S.à r.l. +// audible : 2015-06-25 Amazon Registry Services, Inc. audible // audio : 2014-03-20 Uniregistry, Corp. @@ -7197,10 +7246,10 @@ // auspost : 2015-08-13 Australian Postal Corporation auspost -// author : 2014-12-18 Amazon EU S.à r.l. +// author : 2014-12-18 Amazon Registry Services, Inc. author -// auto : 2014-11-13 +// auto : 2014-11-13 Cars Registry Limited auto // autos : 2014-01-09 DERAutos, LLC @@ -7209,7 +7258,7 @@ // avianca : 2015-01-08 Aerovias del Continente Americano S.A. Avianca avianca -// aws : 2015-06-25 Amazon EU S.à r.l. +// aws : 2015-06-25 Amazon Registry Services, Inc. aws // axa : 2013-12-19 AXA SA @@ -7230,7 +7279,7 @@ // bananarepublic : 2015-07-31 The Gap, Inc. bananarepublic -// band : 2014-06-12 +// band : 2014-06-12 United TLD Holdco Ltd. band // bank : 2014-09-25 fTLD Registry Services LLC @@ -7251,7 +7300,7 @@ // barefoot : 2015-06-11 Gallo Vineyards, Inc. barefoot -// bargains : 2013-11-14 Half Hallow, LLC +// bargains : 2013-11-14 Binky Moon, LLC bargains // baseball : 2015-10-29 MLB Advanced Media DH, LLC @@ -7287,7 +7336,7 @@ // beauty : 2015-12-03 L'Oréal beauty -// beer : 2014-01-09 Top Level Domain Holdings Limited +// beer : 2014-01-09 Minds + Machines Group Limited beer // bentley : 2014-12-18 Bentley Motors Limited @@ -7314,19 +7363,19 @@ // bid : 2013-12-19 dot Bid Limited bid -// bike : 2013-08-27 Grand Hollow, LLC +// bike : 2013-08-27 Binky Moon, LLC bike // bing : 2014-12-18 Microsoft Corporation bing -// bingo : 2014-12-04 Sand Cedar, LLC +// bingo : 2014-12-04 Binky Moon, LLC bingo -// bio : 2014-03-06 STARTING DOT LIMITED +// bio : 2014-03-06 Afilias plc bio -// black : 2014-01-16 Afilias Limited +// black : 2014-01-16 Afilias plc black // blackfriday : 2014-01-16 Uniregistry, Corp. @@ -7338,13 +7387,13 @@ // blockbuster : 2015-07-30 Dish DBS Corporation blockbuster -// blog : 2015-05-14 +// blog : 2015-05-14 Knock Knock WHOIS There, LLC blog // bloomberg : 2014-07-17 Bloomberg IP Holdings LLC bloomberg -// blue : 2013-11-07 Afilias Limited +// blue : 2013-11-07 Afilias plc blue // bms : 2014-10-30 Bristol-Myers Squibb Company @@ -7365,7 +7414,7 @@ // boehringer : 2015-07-09 Boehringer Ingelheim International GmbH boehringer -// bofa : 2015-07-31 NMS Services, Inc. +// bofa : 2015-07-31 Bank of America Corporation bofa // bom : 2014-10-16 Núcleo de Informação e Coordenação do Ponto BR - NIC.br @@ -7377,28 +7426,25 @@ // boo : 2014-01-30 Charleston Road Registry Inc. boo -// book : 2015-08-27 Amazon EU S.à r.l. +// book : 2015-08-27 Amazon Registry Services, Inc. book // booking : 2015-07-16 Booking.com B.V. booking -// boots : 2015-01-08 THE BOOTS COMPANY PLC -boots - // bosch : 2015-06-18 Robert Bosch GMBH bosch // bostik : 2015-05-28 Bostik SA bostik -// boston : 2015-12-10 +// boston : 2015-12-10 Boston TLD Management, LLC boston -// bot : 2014-12-18 Amazon EU S.à r.l. +// bot : 2014-12-18 Amazon Registry Services, Inc. bot -// boutique : 2013-11-14 Over Galley, LLC +// boutique : 2013-11-14 Binky Moon, LLC boutique // box : 2015-11-12 NS1 Limited @@ -7413,7 +7459,7 @@ // broadway : 2014-12-22 Celebrate Broadway, Inc. broadway -// broker : 2014-12-11 IG Group Holdings PLC +// broker : 2014-12-11 Dotbroker Registry Limited broker // brother : 2015-01-29 Brother Industries, Ltd. @@ -7422,7 +7468,7 @@ // brussels : 2014-02-06 DNS.be vzw brussels -// budapest : 2013-11-21 Top Level Domain Holdings Limited +// budapest : 2013-11-21 Minds + Machines Group Limited budapest // bugatti : 2015-07-23 Bugatti International SA @@ -7431,13 +7477,13 @@ // build : 2013-11-07 Plan Bee LLC build -// builders : 2013-11-07 Atomic Madison, LLC +// builders : 2013-11-07 Binky Moon, LLC builders -// business : 2013-11-07 Spring Cross, LLC +// business : 2013-11-07 Binky Moon, LLC business -// buy : 2014-12-18 Amazon EU S.à r.l. +// buy : 2014-12-18 Amazon Registry Services, Inc. buy // buzz : 2013-10-02 DOTSTRATEGY CO. @@ -7446,16 +7492,16 @@ // bzh : 2014-02-27 Association www.bzh bzh -// cab : 2013-10-24 Half Sunset, LLC +// cab : 2013-10-24 Binky Moon, LLC cab -// cafe : 2015-02-11 Pioneer Canyon, LLC +// cafe : 2015-02-11 Binky Moon, LLC cafe // cal : 2014-07-24 Charleston Road Registry Inc. cal -// call : 2014-12-18 Amazon EU S.à r.l. +// call : 2014-12-18 Amazon Registry Services, Inc. call // calvinklein : 2015-07-30 PVH gTLD Holdings LLC @@ -7464,10 +7510,10 @@ // cam : 2016-04-21 AC Webconnecting Holding B.V. cam -// camera : 2013-08-27 Atomic Maple, LLC +// camera : 2013-08-27 Binky Moon, LLC camera -// camp : 2013-11-07 Delta Dynamite, LLC +// camp : 2013-11-07 Binky Moon, LLC camp // cancerresearch : 2014-05-15 Australian Cancer Research Foundation @@ -7479,37 +7525,37 @@ // capetown : 2014-03-24 ZA Central Registry NPC trading as ZA Central Registry capetown -// capital : 2014-03-06 Delta Mill, LLC +// capital : 2014-03-06 Binky Moon, LLC capital // capitalone : 2015-08-06 Capital One Financial Corporation capitalone -// car : 2015-01-22 +// car : 2015-01-22 Cars Registry Limited car // caravan : 2013-12-12 Caravan International, Inc. caravan -// cards : 2013-12-05 Foggy Hollow, LLC +// cards : 2013-12-05 Binky Moon, LLC cards -// care : 2014-03-06 Goose Cross +// care : 2014-03-06 Binky Moon, LLC care // career : 2013-10-09 dotCareer LLC career -// careers : 2013-10-02 Wild Corner, LLC +// careers : 2013-10-02 Binky Moon, LLC careers -// cars : 2014-11-13 +// cars : 2014-11-13 Cars Registry Limited cars // cartier : 2014-06-23 Richemont DNS Inc. cartier -// casa : 2013-11-21 Top Level Domain Holdings Limited +// casa : 2013-11-21 Minds + Machines Group Limited casa // case : 2015-09-03 CNH Industrial N.V. @@ -7518,13 +7564,13 @@ // caseih : 2015-09-03 CNH Industrial N.V. caseih -// cash : 2014-03-06 Delta Lake, LLC +// cash : 2014-03-06 Binky Moon, LLC cash -// casino : 2014-12-18 Binky Sky, LLC +// casino : 2014-12-18 Binky Moon, LLC casino -// catering : 2013-12-05 New Falls. LLC +// catering : 2013-12-05 Binky Moon, LLC catering // catholic : 2015-10-21 Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication) @@ -7545,7 +7591,7 @@ // ceb : 2015-04-09 The Corporate Executive Board Company ceb -// center : 2013-11-07 Tin Mill, LLC +// center : 2013-11-07 Binky Moon, LLC center // ceo : 2013-11-07 CEOTLD Pty Ltd @@ -7557,7 +7603,7 @@ // cfa : 2014-08-28 CFA Institute cfa -// cfd : 2014-12-11 IG Group Holdings PLC +// cfd : 2014-12-11 DotCFD Registry Limited cfd // chanel : 2015-04-09 Chanel International B.V. @@ -7566,13 +7612,16 @@ // channel : 2014-05-08 Charleston Road Registry Inc. channel -// chase : 2015-04-30 JPMorgan Chase & Co. +// charity : 2018-04-11 Corn Lake, LLC +charity + +// chase : 2015-04-30 JPMorgan Chase Bank, National Association chase -// chat : 2014-12-04 Sand Fields, LLC +// chat : 2014-12-04 Binky Moon, LLC chat -// cheap : 2013-11-14 Sand Cover, LLC +// cheap : 2013-11-14 Binky Moon, LLC cheap // chintai : 2015-06-11 CHINTAI Corporation @@ -7587,13 +7636,13 @@ // chrysler : 2015-07-30 FCA US LLC. chrysler -// church : 2014-02-06 Holly Fields, LLC +// church : 2014-02-06 Binky Moon, LLC church // cipriani : 2015-02-19 Hotel Cipriani Srl cipriani -// circle : 2014-12-18 Amazon EU S.à r.l. +// circle : 2014-12-18 Amazon Registry Services, Inc. circle // cisco : 2014-12-22 Cisco Technology, Inc. @@ -7608,31 +7657,31 @@ // citic : 2014-01-09 CITIC Group Corporation citic -// city : 2014-05-29 Snow Sky, LLC +// city : 2014-05-29 Binky Moon, LLC city // cityeats : 2014-12-11 Lifestyle Domain Holdings, Inc. cityeats -// claims : 2014-03-20 Black Corner, LLC +// claims : 2014-03-20 Binky Moon, LLC claims -// cleaning : 2013-12-05 Fox Shadow, LLC +// cleaning : 2013-12-05 Binky Moon, LLC cleaning // click : 2014-06-05 Uniregistry, Corp. click -// clinic : 2014-03-20 Goose Park, LLC +// clinic : 2014-03-20 Binky Moon, LLC clinic // clinique : 2015-10-01 The Estée Lauder Companies Inc. clinique -// clothing : 2013-08-27 Steel Lake, LLC +// clothing : 2013-08-27 Binky Moon, LLC clothing -// cloud : 2015-04-16 ARUBA S.p.A. +// cloud : 2015-04-16 Aruba PEC S.p.A. cloud // club : 2013-11-08 .CLUB DOMAINS, LLC @@ -7641,19 +7690,19 @@ // clubmed : 2015-06-25 Club Méditerranée S.A. clubmed -// coach : 2014-10-09 Koko Island, LLC +// coach : 2014-10-09 Binky Moon, LLC coach -// codes : 2013-10-31 Puff Willow, LLC +// codes : 2013-10-31 Binky Moon, LLC codes -// coffee : 2013-10-17 Trixy Cover, LLC +// coffee : 2013-10-17 Binky Moon, LLC coffee // college : 2014-01-16 XYZ.COM LLC college -// cologne : 2014-02-05 NetCologne Gesellschaft für Telekommunikation mbH +// cologne : 2014-02-05 punkt.wien GmbH cologne // comcast : 2015-07-23 Comcast IP Holdings I, LLC @@ -7662,64 +7711,64 @@ // commbank : 2014-06-26 COMMONWEALTH BANK OF AUSTRALIA commbank -// community : 2013-12-05 Fox Orchard, LLC +// community : 2013-12-05 Binky Moon, LLC community -// company : 2013-11-07 Silver Avenue, LLC +// company : 2013-11-07 Binky Moon, LLC company // compare : 2015-10-08 iSelect Ltd compare -// computer : 2013-10-24 Pine Mill, LLC +// computer : 2013-10-24 Binky Moon, LLC computer // comsec : 2015-01-08 VeriSign, Inc. comsec -// condos : 2013-12-05 Pine House, LLC +// condos : 2013-12-05 Binky Moon, LLC condos -// construction : 2013-09-16 Fox Dynamite, LLC +// construction : 2013-09-16 Binky Moon, LLC construction -// consulting : 2013-12-05 +// consulting : 2013-12-05 United TLD Holdco Ltd. consulting // contact : 2015-01-08 Top Level Spectrum, Inc. contact -// contractors : 2013-09-10 Magic Woods, LLC +// contractors : 2013-09-10 Binky Moon, LLC contractors -// cooking : 2013-11-21 Top Level Domain Holdings Limited +// cooking : 2013-11-21 Minds + Machines Group Limited cooking // cookingchannel : 2015-07-02 Lifestyle Domain Holdings, Inc. cookingchannel -// cool : 2013-11-14 Koko Lake, LLC +// cool : 2013-11-14 Binky Moon, LLC cool -// corsica : 2014-09-25 Collectivité Territoriale de Corse +// corsica : 2014-09-25 Collectivité de Corse corsica -// country : 2013-12-19 Top Level Domain Holdings Limited +// country : 2013-12-19 DotCountry LLC country -// coupon : 2015-02-26 Amazon EU S.à r.l. +// coupon : 2015-02-26 Amazon Registry Services, Inc. coupon -// coupons : 2015-03-26 Black Island, LLC +// coupons : 2015-03-26 Binky Moon, LLC coupons // courses : 2014-12-04 OPEN UNIVERSITIES AUSTRALIA PTY LTD courses -// credit : 2014-03-20 Snow Shadow, LLC +// credit : 2014-03-20 Binky Moon, LLC credit -// creditcard : 2014-03-20 Binky Frostbite, LLC +// creditcard : 2014-03-20 Binky Moon, LLC creditcard // creditunion : 2015-01-22 CUNA Performance Resources, LLC @@ -7737,7 +7786,7 @@ // cruise : 2015-12-10 Viking River Cruises (Bermuda) Ltd. cruise -// cruises : 2013-12-05 Spring Way, LLC +// cruises : 2013-12-05 Binky Moon, LLC cruises // csc : 2014-09-25 Alliance-One Services, Inc. @@ -7767,7 +7816,7 @@ // date : 2014-11-20 dot Date Limited date -// dating : 2013-12-05 Pine Fest, LLC +// dating : 2013-12-05 Binky Moon, LLC dating // datsun : 2014-03-27 NISSAN MOTOR CO., LTD. @@ -7779,22 +7828,22 @@ // dclk : 2014-11-20 Charleston Road Registry Inc. dclk -// dds : 2015-05-07 Top Level Domain Holdings Limited +// dds : 2015-05-07 Minds + Machines Group Limited dds -// deal : 2015-06-25 Amazon EU S.à r.l. +// deal : 2015-06-25 Amazon Registry Services, Inc. deal // dealer : 2014-12-22 Dealer Dot Com, Inc. dealer -// deals : 2014-05-22 Sand Sunset, LLC +// deals : 2014-05-22 Binky Moon, LLC deals -// degree : 2014-03-06 +// degree : 2014-03-06 United TLD Holdco Ltd. degree -// delivery : 2014-09-11 Steel Station, LLC +// delivery : 2014-09-11 Binky Moon, LLC delivery // dell : 2014-10-24 Dell Inc. @@ -7809,10 +7858,10 @@ // democrat : 2013-10-24 United TLD Holdco Ltd. democrat -// dental : 2014-03-20 Tin Birch, LLC +// dental : 2014-03-20 Binky Moon, LLC dental -// dentist : 2014-03-20 +// dentist : 2014-03-20 United TLD Holdco Ltd. dentist // desi : 2013-11-14 Desi Networks LLC @@ -7827,22 +7876,22 @@ // dhl : 2015-07-23 Deutsche Post AG dhl -// diamonds : 2013-09-22 John Edge, LLC +// diamonds : 2013-09-22 Binky Moon, LLC diamonds // diet : 2014-06-26 Uniregistry, Corp. diet -// digital : 2014-03-06 Dash Park, LLC +// digital : 2014-03-06 Binky Moon, LLC digital -// direct : 2014-04-10 Half Trail, LLC +// direct : 2014-04-10 Binky Moon, LLC direct -// directory : 2013-09-20 Extra Madison, LLC +// directory : 2013-09-20 Binky Moon, LLC directory -// discount : 2014-03-06 Holly Hill, LLC +// discount : 2014-03-06 Binky Moon, LLC discount // discover : 2015-07-23 Discover Financial Services @@ -7860,19 +7909,19 @@ // docs : 2014-10-16 Charleston Road Registry Inc. docs -// doctor : 2016-06-02 Brice Trail, LLC +// doctor : 2016-06-02 Binky Moon, LLC doctor // dodge : 2015-07-30 FCA US LLC. dodge -// dog : 2014-12-04 Koko Mill, LLC +// dog : 2014-12-04 Binky Moon, LLC dog // doha : 2014-09-18 Communications Regulatory Authority (CRA) doha -// domains : 2013-10-17 Sugar Cross, LLC +// domains : 2013-10-17 Binky Moon, LLC domains // dot : 2015-05-21 Dish DBS Corporation @@ -7923,25 +7972,25 @@ // edeka : 2014-12-18 EDEKA Verband kaufmännischer Genossenschaften e.V. edeka -// education : 2013-11-07 Brice Way, LLC +// education : 2013-11-07 Binky Moon, LLC education -// email : 2013-10-31 Spring Madison, LLC +// email : 2013-10-31 Binky Moon, LLC email // emerck : 2014-04-03 Merck KGaA emerck -// energy : 2014-09-11 Binky Birch, LLC +// energy : 2014-09-11 Binky Moon, LLC energy // engineer : 2014-03-06 United TLD Holdco Ltd. engineer -// engineering : 2014-03-06 Romeo Canyon +// engineering : 2014-03-06 Binky Moon, LLC engineering -// enterprises : 2013-09-20 Snow Oaks, LLC +// enterprises : 2013-09-20 Binky Moon, LLC enterprises // epost : 2015-07-23 Deutsche Post AG @@ -7950,7 +7999,7 @@ // epson : 2014-12-04 Seiko Epson Corporation epson -// equipment : 2013-08-27 Corn Station, LLC +// equipment : 2013-08-27 Binky Moon, LLC equipment // ericsson : 2015-07-09 Telefonaktiebolaget L M Ericsson @@ -7962,7 +8011,7 @@ // esq : 2014-05-08 Charleston Road Registry Inc. esq -// estate : 2013-08-27 Trixy Park, LLC +// estate : 2013-08-27 Binky Moon, LLC estate // esurance : 2015-07-23 Esurance Insurance Company @@ -7977,22 +8026,22 @@ // eus : 2013-12-12 Puntueus Fundazioa eus -// events : 2013-12-05 Pioneer Maple, LLC +// events : 2013-12-05 Binky Moon, LLC events // everbank : 2014-05-15 EverBank everbank -// exchange : 2014-03-06 Spring Falls, LLC +// exchange : 2014-03-06 Binky Moon, LLC exchange -// expert : 2013-11-21 Magic Pass, LLC +// expert : 2013-11-21 Binky Moon, LLC expert -// exposed : 2013-12-05 Victor Beach, LLC +// exposed : 2013-12-05 Binky Moon, LLC exposed -// express : 2015-02-11 Sea Sunset, LLC +// express : 2015-02-11 Binky Moon, LLC express // extraspace : 2015-05-14 Extra Space Storage LLC @@ -8001,7 +8050,7 @@ // fage : 2014-12-18 Fage International S.A. fage -// fail : 2014-03-06 Atomic Pipe, LLC +// fail : 2014-03-06 Binky Moon, LLC fail // fairwinds : 2014-11-13 FairWinds Partners, LLC @@ -8010,25 +8059,25 @@ // faith : 2014-11-20 dot Faith Limited faith -// family : 2015-04-02 +// family : 2015-04-02 United TLD Holdco Ltd. family -// fan : 2014-03-06 +// fan : 2014-03-06 Asiamix Digital Limited fan // fans : 2014-11-07 Asiamix Digital Limited fans -// farm : 2013-11-07 Just Maple, LLC +// farm : 2013-11-07 Binky Moon, LLC farm // farmers : 2015-07-09 Farmers Insurance Exchange farmers -// fashion : 2014-07-03 Top Level Domain Holdings Limited +// fashion : 2014-07-03 Minds + Machines Group Limited fashion -// fast : 2014-12-18 Amazon EU S.à r.l. +// fast : 2014-12-18 Amazon Registry Services, Inc. fast // fedex : 2015-08-06 Federal Express Corporation @@ -8049,7 +8098,7 @@ // fidelity : 2015-07-30 Fidelity Brokerage Services LLC fidelity -// fido : 2015-08-06 Rogers Communications Partnership +// fido : 2015-08-06 Rogers Communications Canada Inc. fido // film : 2015-01-08 Motion Picture Domain Registry Pty Ltd @@ -8058,43 +8107,43 @@ // final : 2014-10-16 Núcleo de Informação e Coordenação do Ponto BR - NIC.br final -// finance : 2014-03-20 Cotton Cypress, LLC +// finance : 2014-03-20 Binky Moon, LLC finance -// financial : 2014-03-06 Just Cover, LLC +// financial : 2014-03-06 Binky Moon, LLC financial -// fire : 2015-06-25 Amazon EU S.à r.l. +// fire : 2015-06-25 Amazon Registry Services, Inc. fire -// firestone : 2014-12-18 Bridgestone Corporation +// firestone : 2014-12-18 Bridgestone Licensing Services, Inc firestone // firmdale : 2014-03-27 Firmdale Holdings Limited firmdale -// fish : 2013-12-12 Fox Woods, LLC +// fish : 2013-12-12 Binky Moon, LLC fish -// fishing : 2013-11-21 Top Level Domain Holdings Limited +// fishing : 2013-11-21 Minds + Machines Group Limited fishing -// fit : 2014-11-07 Top Level Domain Holdings Limited +// fit : 2014-11-07 Minds + Machines Group Limited fit -// fitness : 2014-03-06 Brice Orchard, LLC +// fitness : 2014-03-06 Binky Moon, LLC fitness // flickr : 2015-04-02 Yahoo! Domain Services Inc. flickr -// flights : 2013-12-05 Fox Station, LLC +// flights : 2013-12-05 Binky Moon, LLC flights // flir : 2015-07-23 FLIR Systems, Inc. flir -// florist : 2013-11-07 Half Cypress, LLC +// florist : 2013-11-07 Binky Moon, LLC florist // flowers : 2014-10-09 Uniregistry, Corp. @@ -8112,28 +8161,28 @@ // foodnetwork : 2015-07-02 Lifestyle Domain Holdings, Inc. foodnetwork -// football : 2014-12-18 Foggy Farms, LLC +// football : 2014-12-18 Binky Moon, LLC football // ford : 2014-11-13 Ford Motor Company ford -// forex : 2014-12-11 IG Group Holdings PLC +// forex : 2014-12-11 Dotforex Registry Limited forex -// forsale : 2014-05-22 +// forsale : 2014-05-22 United TLD Holdco Ltd. forsale // forum : 2015-04-02 Fegistry, LLC forum -// foundation : 2013-12-05 John Dale, LLC +// foundation : 2013-12-05 Binky Moon, LLC foundation // fox : 2015-09-11 FOX Registry, LLC fox -// free : 2015-12-10 Amazon EU S.à r.l. +// free : 2015-12-10 Amazon Registry Services, Inc. free // fresenius : 2015-07-30 Fresenius Immobilien-Verwaltungs-GmbH @@ -8160,25 +8209,25 @@ // fujixerox : 2015-07-23 Xerox DNHC LLC fujixerox -// fun : 2016-01-14 +// fun : 2016-01-14 DotSpace Inc. fun -// fund : 2014-03-20 John Castle, LLC +// fund : 2014-03-20 Binky Moon, LLC fund -// furniture : 2014-03-20 Lone Fields, LLC +// furniture : 2014-03-20 Binky Moon, LLC furniture -// futbol : 2013-09-20 +// futbol : 2013-09-20 United TLD Holdco Ltd. futbol -// fyi : 2015-04-02 Silver Tigers, LLC +// fyi : 2015-04-02 Binky Moon, LLC fyi // gal : 2013-11-07 Asociación puntoGAL gal -// gallery : 2013-09-13 Sugar House, LLC +// gallery : 2013-09-13 Binky Moon, LLC gallery // gallo : 2015-06-11 Gallo Vineyards, Inc. @@ -8190,13 +8239,13 @@ // game : 2015-05-28 Uniregistry, Corp. game -// games : 2015-05-28 +// games : 2015-05-28 United TLD Holdco Ltd. games // gap : 2015-07-31 The Gap, Inc. gap -// garden : 2014-06-26 Top Level Domain Holdings Limited +// garden : 2014-06-26 Minds + Machines Group Limited garden // gbiz : 2014-07-17 Charleston Road Registry Inc. @@ -8208,7 +8257,7 @@ // gea : 2014-12-04 GEA Group Aktiengesellschaft gea -// gent : 2014-01-23 COMBELL GROUP NV/SA +// gent : 2014-01-23 COMBELL NV gent // genting : 2015-03-12 Resorts World Inc Pte. Ltd. @@ -8220,10 +8269,10 @@ // ggee : 2014-01-09 GMO Internet, Inc. ggee -// gift : 2013-10-17 Uniregistry, Corp. +// gift : 2013-10-17 DotGift, LLC gift -// gifts : 2014-07-03 Goose Sky, LLC +// gifts : 2014-07-03 Binky Moon, LLC gifts // gives : 2014-03-06 United TLD Holdco Ltd. @@ -8235,13 +8284,13 @@ // glade : 2015-07-23 Johnson Shareholdings, Inc. glade -// glass : 2013-11-07 Black Cover, LLC +// glass : 2013-11-07 Binky Moon, LLC glass // gle : 2014-07-24 Charleston Road Registry Inc. gle -// global : 2014-04-17 Dot GLOBAL AS +// global : 2014-04-17 Dot Global Domain Registry Limited global // globo : 2013-12-19 Globo Comunicação e Participações S.A @@ -8250,10 +8299,10 @@ // gmail : 2014-05-01 Charleston Road Registry Inc. gmail -// gmbh : 2016-01-29 Extra Dynamite, LLC +// gmbh : 2016-01-29 Binky Moon, LLC gmbh -// gmo : 2014-01-09 GMO Internet, Inc. +// gmo : 2014-01-09 GMO Internet Pte. Ltd. gmo // gmx : 2014-04-24 1&1 Mail & Media GmbH @@ -8262,13 +8311,13 @@ // godaddy : 2015-07-23 Go Daddy East, LLC godaddy -// gold : 2015-01-22 June Edge, LLC +// gold : 2015-01-22 Binky Moon, LLC gold // goldpoint : 2014-11-20 YODOBASHI CAMERA CO.,LTD. goldpoint -// golf : 2014-12-18 Lone falls, LLC +// golf : 2014-12-18 Binky Moon, LLC golf // goo : 2014-12-18 NTT Resonant Inc. @@ -8289,28 +8338,28 @@ // gop : 2014-01-16 Republican State Leadership Committee, Inc. gop -// got : 2014-12-18 Amazon EU S.à r.l. +// got : 2014-12-18 Amazon Registry Services, Inc. got // grainger : 2015-05-07 Grainger Registry Services, LLC grainger -// graphics : 2013-09-13 Over Madison, LLC +// graphics : 2013-09-13 Binky Moon, LLC graphics -// gratis : 2014-03-20 Pioneer Tigers, LLC +// gratis : 2014-03-20 Binky Moon, LLC gratis -// green : 2014-05-08 Afilias Limited +// green : 2014-05-08 Afilias plc green -// gripe : 2014-03-06 Corn Sunset, LLC +// gripe : 2014-03-06 Binky Moon, LLC gripe // grocery : 2016-06-16 Wal-Mart Stores, Inc. grocery -// group : 2014-08-15 Romeo Town, LLC +// group : 2014-08-15 Binky Moon, LLC group // guardian : 2015-07-30 The Guardian Life Insurance Company of America @@ -8322,13 +8371,13 @@ // guge : 2014-08-28 Charleston Road Registry Inc. guge -// guide : 2013-09-13 Snow Moon, LLC +// guide : 2013-09-13 Binky Moon, LLC guide // guitars : 2013-11-14 Uniregistry, Corp. guitars -// guru : 2013-08-27 Pioneer Cypress, LLC +// guru : 2013-08-27 Binky Moon, LLC guru // hair : 2015-12-03 L'Oréal @@ -8340,7 +8389,7 @@ // hangout : 2014-11-13 Charleston Road Registry Inc. hangout -// haus : 2013-12-05 +// haus : 2013-12-05 United TLD Holdco Ltd. haus // hbo : 2015-07-30 HBO Registry Services, Inc. @@ -8355,7 +8404,7 @@ // health : 2015-02-11 DotHealth, LLC health -// healthcare : 2014-06-12 Silver Glen, LLC +// healthcare : 2014-06-12 Binky Moon, LLC healthcare // help : 2014-06-26 Uniregistry, Corp. @@ -8382,22 +8431,22 @@ // hitachi : 2014-10-31 Hitachi, Ltd. hitachi -// hiv : 2014-03-13 +// hiv : 2014-03-13 Uniregistry, Corp. hiv // hkt : 2015-05-14 PCCW-HKT DataCom Services Limited hkt -// hockey : 2015-03-19 Half Willow, LLC +// hockey : 2015-03-19 Binky Moon, LLC hockey -// holdings : 2013-08-27 John Madison, LLC +// holdings : 2013-08-27 Binky Moon, LLC holdings -// holiday : 2013-11-07 Goose Woods, LLC +// holiday : 2013-11-07 Binky Moon, LLC holiday -// homedepot : 2015-04-02 Homer TLC, Inc. +// homedepot : 2015-04-02 Home Depot Product Authority, LLC homedepot // homegoods : 2015-07-16 The TJX Companies, Inc. @@ -8415,10 +8464,10 @@ // honeywell : 2015-07-23 Honeywell GTLD LLC honeywell -// horse : 2013-11-21 Top Level Domain Holdings Limited +// horse : 2013-11-21 Minds + Machines Group Limited horse -// hospital : 2016-10-20 Ruby Pike, LLC +// hospital : 2016-10-20 Binky Moon, LLC hospital // host : 2014-04-17 DotHost Inc. @@ -8427,7 +8476,7 @@ // hosting : 2014-05-29 Uniregistry, Corp. hosting -// hot : 2015-08-27 Amazon EU S.à r.l. +// hot : 2015-08-27 Amazon Registry Services, Inc. hot // hoteles : 2015-03-05 Travel Reservations SRL @@ -8439,13 +8488,13 @@ // hotmail : 2014-12-18 Microsoft Corporation hotmail -// house : 2013-11-07 Sugar Park, LLC +// house : 2013-11-07 Binky Moon, LLC house // how : 2014-01-23 Charleston Road Registry Inc. how -// hsbc : 2014-10-24 HSBC Holdings PLC +// hsbc : 2014-10-24 HSBC Global Services (UK) Limited hsbc // hughes : 2015-07-30 Hughes Satellite Systems Corporation @@ -8466,7 +8515,7 @@ // ice : 2014-10-30 IntercontinentalExchange, Inc. ice -// icu : 2015-01-08 One.com A/S +// icu : 2015-01-08 ShortDot SA icu // ieee : 2015-07-23 IEEE Global LLC @@ -8481,16 +8530,19 @@ // imamat : 2015-08-06 Fondation Aga Khan (Aga Khan Foundation) imamat -// imdb : 2015-06-25 Amazon EU S.à r.l. +// imdb : 2015-06-25 Amazon Registry Services, Inc. imdb -// immo : 2014-07-10 Auburn Bloom, LLC +// immo : 2014-07-10 Binky Moon, LLC immo // immobilien : 2013-11-07 United TLD Holdco Ltd. immobilien -// industries : 2013-12-05 Outer House, LLC +// inc : 2018-03-10 GTLD Limited +inc + +// industries : 2013-12-05 Binky Moon, LLC industries // infiniti : 2014-03-27 NISSAN MOTOR CO., LTD. @@ -8502,31 +8554,31 @@ // ink : 2013-12-05 Top Level Design, LLC ink -// institute : 2013-11-07 Outer Maple, LLC +// institute : 2013-11-07 Binky Moon, LLC institute // insurance : 2015-02-19 fTLD Registry Services LLC insurance -// insure : 2014-03-20 Pioneer Willow, LLC +// insure : 2014-03-20 Binky Moon, LLC insure // intel : 2015-08-06 Intel Corporation intel -// international : 2013-11-07 Wild Way, LLC +// international : 2013-11-07 Binky Moon, LLC international // intuit : 2015-07-30 Intuit Administrative Services, Inc. intuit -// investments : 2014-03-20 Holly Glen, LLC +// investments : 2014-03-20 Binky Moon, LLC investments // ipiranga : 2014-08-28 Ipiranga Produtos de Petroleo S.A. ipiranga -// irish : 2014-08-07 Dot-Irish LLC +// irish : 2014-08-07 Binky Moon, LLC irish // iselect : 2015-02-11 iSelect Ltd @@ -8568,13 +8620,13 @@ // jeep : 2015-07-30 FCA US LLC. jeep -// jetzt : 2014-01-09 +// jetzt : 2014-01-09 Binky Moon, LLC jetzt -// jewelry : 2015-03-05 Wild Bloom, LLC +// jewelry : 2015-03-05 Binky Moon, LLC jewelry -// jio : 2015-04-02 Affinity Names, Inc. +// jio : 2015-04-02 Reliance Industries Limited jio // jlc : 2014-12-04 Richemont DNS Inc. @@ -8592,13 +8644,13 @@ // joburg : 2014-03-24 ZA Central Registry NPC trading as ZA Central Registry joburg -// jot : 2014-12-18 Amazon EU S.à r.l. +// jot : 2014-12-18 Amazon Registry Services, Inc. jot -// joy : 2014-12-18 Amazon EU S.à r.l. +// joy : 2014-12-18 Amazon Registry Services, Inc. joy -// jpmorgan : 2015-04-30 JPMorgan Chase & Co. +// jpmorgan : 2015-04-30 JPMorgan Chase Bank, National Association jpmorgan // jprs : 2014-09-18 Japan Registry Services Co., Ltd. @@ -8631,22 +8683,22 @@ // kia : 2015-07-09 KIA MOTORS CORPORATION kia -// kim : 2013-09-23 Afilias Limited +// kim : 2013-09-23 Afilias plc kim // kinder : 2014-11-07 Ferrero Trading Lux S.A. kinder -// kindle : 2015-06-25 Amazon EU S.à r.l. +// kindle : 2015-06-25 Amazon Registry Services, Inc. kindle -// kitchen : 2013-09-20 Just Goodbye, LLC +// kitchen : 2013-09-20 Binky Moon, LLC kitchen // kiwi : 2013-09-20 DOT KIWI LIMITED kiwi -// koeln : 2014-01-09 NetCologne Gesellschaft für Telekommunikation mbH +// koeln : 2014-01-09 punkt.wien GmbH koeln // komatsu : 2015-01-08 Komatsu Ltd. @@ -8673,7 +8725,7 @@ // kyoto : 2014-11-07 Academic Institution: Kyoto Jyoho Gakuen kyoto -// lacaixa : 2014-01-09 CAIXA D'ESTALVIS I PENSIONS DE BARCELONA +// lacaixa : 2014-01-09 Fundación Bancaria Caixa d’Estalvis i Pensions de Barcelona, “la Caixa” lacaixa // ladbrokes : 2015-08-06 LADBROKES INTERNATIONAL PLC @@ -8694,7 +8746,7 @@ // lancome : 2015-07-23 L'Oréal lancome -// land : 2013-09-10 Pine Moon, LLC +// land : 2013-09-10 Binky Moon, LLC land // landrover : 2014-11-13 Jaguar Land Rover Ltd @@ -8718,13 +8770,13 @@ // law : 2015-01-22 Minds + Machines Group Limited law -// lawyer : 2014-03-20 +// lawyer : 2014-03-20 United TLD Holdco Ltd. lawyer // lds : 2014-03-20 IRI Domain Management, LLC ("Applicant") lds -// lease : 2014-03-06 Victor Trail, LLC +// lease : 2014-03-06 Binky Moon, LLC lease // leclerc : 2014-08-07 A.C.D. LEC Association des Centres Distributeurs Edouard Leclerc @@ -8733,7 +8785,7 @@ // lefrak : 2015-07-16 LeFrak Organization, Inc. lefrak -// legal : 2014-10-16 Blue Falls, LLC +// legal : 2014-10-16 Binky Moon, LLC legal // lego : 2015-07-16 LEGO Juris A/S @@ -8742,7 +8794,7 @@ // lexus : 2015-04-23 TOYOTA MOTOR CORPORATION lexus -// lgbt : 2014-05-08 Afilias Limited +// lgbt : 2014-05-08 Afilias plc lgbt // liaison : 2014-10-02 Liaison Technologies, Incorporated @@ -8751,7 +8803,7 @@ // lidl : 2014-09-18 Schwarz Domains und Services GmbH & Co. KG lidl -// life : 2014-02-06 Trixy Oaks, LLC +// life : 2014-02-06 Binky Moon, LLC life // lifeinsurance : 2015-01-15 American Council of Life Insurers @@ -8760,19 +8812,19 @@ // lifestyle : 2014-12-11 Lifestyle Domain Holdings, Inc. lifestyle -// lighting : 2013-08-27 John McCook, LLC +// lighting : 2013-08-27 Binky Moon, LLC lighting -// like : 2014-12-18 Amazon EU S.à r.l. +// like : 2014-12-18 Amazon Registry Services, Inc. like // lilly : 2015-07-31 Eli Lilly and Company lilly -// limited : 2014-03-06 Big Fest, LLC +// limited : 2014-03-06 Binky Moon, LLC limited -// limo : 2013-10-17 Hidden Frostbite, LLC +// limo : 2013-10-17 Binky Moon, LLC limo // lincoln : 2014-11-13 Ford Motor Company @@ -8787,7 +8839,7 @@ // lipsy : 2015-06-25 Lipsy Ltd lipsy -// live : 2014-12-04 +// live : 2014-12-04 United TLD Holdco Ltd. live // living : 2015-07-30 Lifestyle Domain Holdings, Inc. @@ -8796,10 +8848,13 @@ // lixil : 2015-03-19 LIXIL Group Corporation lixil +// llc : 2017-12-14 Afilias plc +llc + // loan : 2014-11-20 dot Loan Limited loan -// loans : 2014-03-20 June Woods, LLC +// loans : 2014-03-20 Binky Moon, LLC loans // locker : 2015-06-04 Dish DBS Corporation @@ -8820,7 +8875,7 @@ // lotte : 2014-11-07 Lotte Holdings Co., Ltd. lotte -// lotto : 2014-04-10 Afilias Limited +// lotto : 2014-04-10 Afilias plc lotto // love : 2014-12-22 Merchant Law Group LLP @@ -8832,10 +8887,10 @@ // lplfinancial : 2015-07-30 LPL Holdings, Inc. lplfinancial -// ltd : 2014-09-25 Over Corner, LLC +// ltd : 2014-09-25 Binky Moon, LLC ltd -// ltda : 2014-04-17 DOMAIN ROBOT SERVICOS DE HOSPEDAGEM NA INTERNET LTDA +// ltda : 2014-04-17 InterNetX, Corp ltda // lundbeck : 2015-08-06 H. Lundbeck A/S @@ -8844,7 +8899,7 @@ // lupin : 2014-11-07 LUPIN LIMITED lupin -// luxe : 2014-01-09 Top Level Domain Holdings Limited +// luxe : 2014-01-09 Minds + Machines Group Limited luxe // luxury : 2013-10-17 Luxury Partners, LLC @@ -8859,7 +8914,7 @@ // maif : 2014-10-02 Mutuelle Assurance Instituteur France (MAIF) maif -// maison : 2013-12-05 Victor Frostbite, LLC +// maison : 2013-12-05 Binky Moon, LLC maison // makeup : 2015-01-15 L'Oréal @@ -8868,7 +8923,7 @@ // man : 2014-12-04 MAN SE man -// management : 2013-11-07 John Goodbye, LLC +// management : 2013-11-07 Binky Moon, LLC management // mango : 2013-10-24 PUNTO FA S.L. @@ -8877,13 +8932,13 @@ // map : 2016-06-09 Charleston Road Registry Inc. map -// market : 2014-03-06 +// market : 2014-03-06 United TLD Holdco Ltd. market -// marketing : 2013-11-07 Fern Pass, LLC +// marketing : 2013-11-07 Binky Moon, LLC marketing -// markets : 2014-12-11 IG Group Holdings PLC +// markets : 2014-12-11 Dotmarkets Registry Limited markets // marriott : 2014-10-09 Marriott Worldwide Corporation @@ -8898,7 +8953,7 @@ // mattel : 2015-08-06 Mattel Sites, Inc. mattel -// mba : 2015-04-02 Lone Hollow, LLC +// mba : 2015-04-02 Binky Moon, LLC mba // mckinsey : 2015-07-31 McKinsey Holdings, Inc. @@ -8907,10 +8962,10 @@ // med : 2015-08-06 Medistry LLC med -// media : 2014-03-06 Grand Glen, LLC +// media : 2014-03-06 Binky Moon, LLC media -// meet : 2014-01-16 +// meet : 2014-01-16 Charleston Road Registry Inc. meet // melbourne : 2014-05-29 The Crown in right of the State of Victoria, represented by its Department of State Development, Business and Innovation @@ -8928,7 +8983,7 @@ // menu : 2013-09-11 Wedding TLD2, LLC menu -// meo : 2014-11-07 PT Comunicacoes S.A. +// meo : 2014-11-07 MEO Servicos de Comunicacoes e Multimedia, S.A. meo // merckmsd : 2016-07-14 MSD Registry Holdings, Inc. @@ -8937,7 +8992,7 @@ // metlife : 2015-05-07 MetLife Services and Solutions, LLC metlife -// miami : 2013-12-19 Top Level Domain Holdings Limited +// miami : 2013-12-19 Minds + Machines Group Limited miami // microsoft : 2014-12-18 Microsoft Corporation @@ -8976,7 +9031,7 @@ // moe : 2013-11-13 Interlink Co., Ltd. moe -// moi : 2014-12-18 Amazon EU S.à r.l. +// moi : 2014-12-18 Amazon Registry Services, Inc. moi // mom : 2015-04-16 Uniregistry, Corp. @@ -8985,7 +9040,7 @@ // monash : 2013-09-30 Monash University monash -// money : 2014-10-16 Outer McCook, LLC +// money : 2014-10-16 Binky Moon, LLC money // monster : 2015-09-11 Monster Worldwide, Inc. @@ -8997,13 +9052,13 @@ // mormon : 2013-12-05 IRI Domain Management, LLC ("Applicant") mormon -// mortgage : 2014-03-20 +// mortgage : 2014-03-20 United TLD Holdco Ltd. mortgage // moscow : 2013-12-19 Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID) moscow -// moto : 2015-06-04 +// moto : 2015-06-04 Motorola Trademark Holdings, LLC moto // motorcycles : 2014-01-09 DERMotorcycles, LLC @@ -9012,7 +9067,7 @@ // mov : 2014-01-30 Charleston Road Registry Inc. mov -// movie : 2015-02-05 New Frostbite, LLC +// movie : 2015-02-05 Binky Moon, LLC movie // movistar : 2014-10-16 Telefónica S.A. @@ -9024,9 +9079,6 @@ // mtn : 2014-12-04 MTN Dubai Limited mtn -// mtpc : 2014-11-20 Mitsubishi Tanabe Pharma Corporation -mtpc - // mtr : 2015-03-12 MTR Corporation Limited mtr @@ -9036,7 +9088,7 @@ // nab : 2015-08-20 National Australia Bank Limited nab -// nadex : 2014-12-11 IG Group Holdings PLC +// nadex : 2014-12-11 Nadex Domains, Inc. nadex // nagoya : 2013-10-24 GMO Registry, Inc. @@ -9063,10 +9115,10 @@ // netflix : 2015-06-18 Netflix, Inc. netflix -// network : 2013-11-14 Trixy Manor, LLC +// network : 2013-11-14 Binky Moon, LLC network -// neustar : 2013-12-05 NeuStar, Inc. +// neustar : 2013-12-05 Registry Services, LLC neustar // new : 2014-01-30 Charleston Road Registry Inc. @@ -9075,7 +9127,7 @@ // newholland : 2015-09-03 CNH Industrial N.V. newholland -// news : 2014-12-18 +// news : 2014-12-18 United TLD Holdco Ltd. news // next : 2015-06-18 Next plc @@ -9123,7 +9175,7 @@ // norton : 2014-12-04 Symantec Corporation norton -// now : 2015-06-25 Amazon EU S.à r.l. +// now : 2015-06-25 Amazon Registry Services, Inc. now // nowruz : 2014-09-04 Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. @@ -9147,7 +9199,7 @@ // obi : 2014-09-25 OBI Group Holding SE & Co. KGaA obi -// observer : 2015-04-30 +// observer : 2015-04-30 Top Level Spectrum, Inc. observer // off : 2015-07-23 Johnson Shareholdings, Inc. @@ -9156,7 +9208,7 @@ // office : 2015-03-12 Microsoft Corporation office -// okinawa : 2013-12-05 BusinessRalliart Inc. +// okinawa : 2013-12-05 BRregistry, Inc. okinawa // olayan : 2015-05-14 Crescent Holding GmbH @@ -9201,13 +9253,13 @@ // orange : 2015-03-12 Orange Brand Services Limited orange -// organic : 2014-03-27 Afilias Limited +// organic : 2014-03-27 Afilias plc organic // origins : 2015-10-01 The Estée Lauder Companies Inc. origins -// osaka : 2014-09-04 Interlink Co., Ltd. +// osaka : 2014-09-04 Osaka Registry Co., Ltd. osaka // otsuka : 2013-10-11 Otsuka Holdings Co., Ltd. @@ -9234,10 +9286,10 @@ // pars : 2014-09-04 Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. pars -// partners : 2013-12-05 Magic Glen, LLC +// partners : 2013-12-05 Binky Moon, LLC partners -// parts : 2013-12-05 Sea Goodbye, LLC +// parts : 2013-12-05 Binky Moon, LLC parts // party : 2014-09-11 Blue Sky Registry Limited @@ -9246,7 +9298,7 @@ // passagens : 2015-03-05 Travel Reservations SRL passagens -// pay : 2015-08-27 Amazon EU S.à r.l. +// pay : 2015-08-27 Amazon Registry Services, Inc. pay // pccw : 2015-05-14 PCCW Enterprises Limited @@ -9273,10 +9325,10 @@ // photo : 2013-11-14 Uniregistry, Corp. photo -// photography : 2013-09-20 Sugar Glen, LLC +// photography : 2013-09-20 Binky Moon, LLC photography -// photos : 2013-10-17 Sea Corner, LLC +// photos : 2013-10-17 Binky Moon, LLC photos // physio : 2014-05-01 PhysBiz Pty Ltd @@ -9291,28 +9343,28 @@ // pictet : 2014-06-26 Pictet Europe S.A. pictet -// pictures : 2014-03-06 Foggy Sky, LLC +// pictures : 2014-03-06 Binky Moon, LLC pictures // pid : 2015-01-08 Top Level Spectrum, Inc. pid -// pin : 2014-12-18 Amazon EU S.à r.l. +// pin : 2014-12-18 Amazon Registry Services, Inc. pin // ping : 2015-06-11 Ping Registry Provider, Inc. ping -// pink : 2013-10-01 Afilias Limited +// pink : 2013-10-01 Afilias plc pink // pioneer : 2015-07-16 Pioneer Corporation pioneer -// pizza : 2014-06-26 Foggy Moon, LLC +// pizza : 2014-06-26 Binky Moon, LLC pizza -// place : 2014-04-24 Snow Galley, LLC +// place : 2014-04-24 Binky Moon, LLC place // play : 2015-03-05 Charleston Road Registry Inc. @@ -9321,10 +9373,10 @@ // playstation : 2015-07-02 Sony Computer Entertainment Inc. playstation -// plumbing : 2013-09-10 Spring Tigers, LLC +// plumbing : 2013-09-10 Binky Moon, LLC plumbing -// plus : 2015-02-05 Sugar Mill, LLC +// plus : 2015-02-05 Binky Moon, LLC plus // pnc : 2015-07-02 PNC Domain Co., LLC @@ -9333,7 +9385,7 @@ // pohl : 2014-06-23 Deutsche Vermögensberatung Aktiengesellschaft DVAG pohl -// poker : 2014-07-03 Afilias Domains No. 5 Limited +// poker : 2014-07-03 Afilias plc poker // politie : 2015-08-20 Politie Nederland @@ -9351,13 +9403,13 @@ // press : 2014-04-03 DotPress Inc. press -// prime : 2015-06-25 Amazon EU S.à r.l. +// prime : 2015-06-25 Amazon Registry Services, Inc. prime // prod : 2014-01-23 Charleston Road Registry Inc. prod -// productions : 2013-12-05 Magic Birch, LLC +// productions : 2013-12-05 Binky Moon, LLC productions // prof : 2014-07-24 Charleston Road Registry Inc. @@ -9366,16 +9418,16 @@ // progressive : 2015-07-23 Progressive Casualty Insurance Company progressive -// promo : 2014-12-18 +// promo : 2014-12-18 Afilias plc promo -// properties : 2013-12-05 Big Pass, LLC +// properties : 2013-12-05 Binky Moon, LLC properties // property : 2014-05-22 Uniregistry, Corp. property -// protection : 2015-04-23 +// protection : 2015-04-23 XYZ.COM LLC protection // pru : 2015-07-30 Prudential Financial, Inc. @@ -9411,7 +9463,7 @@ // raid : 2015-07-23 Johnson Shareholdings, Inc. raid -// read : 2014-12-18 Amazon EU S.à r.l. +// read : 2014-12-18 Amazon Registry Services, Inc. read // realestate : 2015-09-11 dotRealEstate LLC @@ -9423,10 +9475,10 @@ // realty : 2015-03-19 Fegistry, LLC realty -// recipes : 2013-10-17 Grand Island, LLC +// recipes : 2013-10-17 Binky Moon, LLC recipes -// red : 2013-11-07 Afilias Limited +// red : 2013-11-07 Afilias plc red // redstone : 2014-10-31 Redstone Haute Couture Co., Ltd. @@ -9438,10 +9490,10 @@ // rehab : 2014-03-06 United TLD Holdco Ltd. rehab -// reise : 2014-03-13 +// reise : 2014-03-13 Binky Moon, LLC reise -// reisen : 2014-03-06 New Cypress, LLC +// reisen : 2014-03-06 Binky Moon, LLC reisen // reit : 2014-09-04 National Association of Real Estate Investment Trusts, Inc. @@ -9453,16 +9505,16 @@ // ren : 2013-12-12 Beijing Qianxiang Wangjing Technology Development Co., Ltd. ren -// rent : 2014-12-04 DERRent, LLC +// rent : 2014-12-04 XYZ.COM LLC rent -// rentals : 2013-12-05 Big Hollow,LLC +// rentals : 2013-12-05 Binky Moon, LLC rentals -// repair : 2013-11-07 Lone Sunset, LLC +// repair : 2013-11-07 Binky Moon, LLC repair -// report : 2013-12-05 Binky Glen, LLC +// report : 2013-12-05 Binky Moon, LLC report // republican : 2014-03-20 United TLD Holdco Ltd. @@ -9471,13 +9523,13 @@ // rest : 2013-12-19 Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable rest -// restaurant : 2014-07-03 Snow Avenue, LLC +// restaurant : 2014-07-03 Binky Moon, LLC restaurant // review : 2014-11-20 dot Review Limited review -// reviews : 2013-09-13 +// reviews : 2013-09-13 United TLD Holdco Ltd. reviews // rexroth : 2015-06-18 Robert Bosch GMBH @@ -9510,16 +9562,16 @@ // rocher : 2014-12-18 Ferrero Trading Lux S.A. rocher -// rocks : 2013-11-14 +// rocks : 2013-11-14 United TLD Holdco Ltd. rocks -// rodeo : 2013-12-19 Top Level Domain Holdings Limited +// rodeo : 2013-12-19 Minds + Machines Group Limited rodeo -// rogers : 2015-08-06 Rogers Communications Partnership +// rogers : 2015-08-06 Rogers Communications Canada Inc. rogers -// room : 2014-12-18 Amazon EU S.à r.l. +// room : 2014-12-18 Amazon Registry Services, Inc. room // rsvp : 2014-05-08 Charleston Road Registry Inc. @@ -9531,19 +9583,19 @@ // ruhr : 2013-10-02 regiodot GmbH & Co. KG ruhr -// run : 2015-03-19 Snow Park, LLC +// run : 2015-03-19 Binky Moon, LLC run // rwe : 2015-04-02 RWE AG rwe -// ryukyu : 2014-01-09 BusinessRalliart Inc. +// ryukyu : 2014-01-09 BRregistry, Inc. ryukyu // saarland : 2013-12-12 dotSaarland GmbH saarland -// safe : 2014-12-18 Amazon EU S.à r.l. +// safe : 2014-12-18 Amazon Registry Services, Inc. safe // safety : 2015-01-08 Safety Registry Services, LLC. @@ -9552,10 +9604,10 @@ // sakura : 2014-12-18 SAKURA Internet Inc. sakura -// sale : 2014-10-16 +// sale : 2014-10-16 United TLD Holdco Ltd. sale -// salon : 2014-12-11 Outer Orchard, LLC +// salon : 2014-12-11 Binky Moon, LLC salon // samsclub : 2015-07-31 Wal-Mart Stores, Inc. @@ -9576,16 +9628,16 @@ // sap : 2014-03-27 SAP AG sap -// sapo : 2014-11-07 PT Comunicacoes S.A. +// sapo : 2014-11-07 MEO Servicos de Comunicacoes e Multimedia, S.A. sapo -// sarl : 2014-07-03 Delta Orchard, LLC +// sarl : 2014-07-03 Binky Moon, LLC sarl // sas : 2015-04-02 Research IP LLC sas -// save : 2015-06-25 Amazon EU S.à r.l. +// save : 2015-06-25 Amazon Registry Services, Inc. save // saxo : 2014-10-31 Saxo Bank A/S @@ -9612,10 +9664,10 @@ // scholarships : 2014-04-24 Scholarships.com, LLC scholarships -// school : 2014-12-18 Little Galley, LLC +// school : 2014-12-18 Binky Moon, LLC school -// schule : 2014-03-06 Outer Moon, LLC +// schule : 2014-03-06 Binky Moon, LLC schule // schwarz : 2014-09-18 Schwarz Domains und Services GmbH & Co. KG @@ -9639,10 +9691,10 @@ // seat : 2014-05-22 SEAT, S.A. (Sociedad Unipersonal) seat -// secure : 2015-08-27 Amazon EU S.à r.l. +// secure : 2015-08-27 Amazon Registry Services, Inc. secure -// security : 2015-05-14 +// security : 2015-05-14 XYZ.COM LLC security // seek : 2014-12-04 Seek Limited @@ -9654,7 +9706,7 @@ // sener : 2014-10-24 Sener Ingeniería y Sistemas, S.A. sener -// services : 2014-02-27 Fox Castle, LLC +// services : 2014-02-27 Binky Moon, LLC services // ses : 2015-07-23 SES @@ -9690,22 +9742,22 @@ // shia : 2014-09-04 Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. shia -// shiksha : 2013-11-14 Afilias Limited +// shiksha : 2013-11-14 Afilias plc shiksha -// shoes : 2013-10-02 Binky Galley, LLC +// shoes : 2013-10-02 Binky Moon, LLC shoes // shop : 2016-04-08 GMO Registry, Inc. shop -// shopping : 2016-03-31 +// shopping : 2016-03-31 Binky Moon, LLC shopping // shouji : 2015-01-08 QIHOO 360 TECHNOLOGY CO. LTD. shouji -// show : 2015-03-05 Snow Beach, LLC +// show : 2015-03-05 Binky Moon, LLC show // showtime : 2015-08-06 CBS Domains Inc. @@ -9714,25 +9766,25 @@ // shriram : 2014-01-23 Shriram Capital Ltd. shriram -// silk : 2015-06-25 Amazon EU S.à r.l. +// silk : 2015-06-25 Amazon Registry Services, Inc. silk // sina : 2015-03-12 Sina Corporation sina -// singles : 2013-08-27 Fern Madison, LLC +// singles : 2013-08-27 Binky Moon, LLC singles // site : 2015-01-15 DotSite Inc. site -// ski : 2015-04-09 STARTING DOT LIMITED +// ski : 2015-04-09 Afilias plc ski // skin : 2015-01-15 L'Oréal skin -// sky : 2014-06-19 Sky IP International Ltd, a company incorporated in England and Wales, operating via its registered Swiss branch +// sky : 2014-06-19 Sky International AG sky // skype : 2014-12-18 Microsoft Corporation @@ -9744,13 +9796,13 @@ // smart : 2015-07-09 Smart Communications, Inc. (SMART) smart -// smile : 2014-12-18 Amazon EU S.à r.l. +// smile : 2014-12-18 Amazon Registry Services, Inc. smile // sncf : 2015-02-19 Société Nationale des Chemins de fer Francais S N C F sncf -// soccer : 2015-03-26 Foggy Shadow, LLC +// soccer : 2015-03-26 Binky Moon, LLC soccer // social : 2013-11-07 United TLD Holdco Ltd. @@ -9759,19 +9811,19 @@ // softbank : 2015-07-02 SoftBank Corp. softbank -// software : 2014-03-20 +// software : 2014-03-20 United TLD Holdco Ltd. software // sohu : 2013-12-19 Sohu.com Limited sohu -// solar : 2013-11-07 Ruby Town, LLC +// solar : 2013-11-07 Binky Moon, LLC solar -// solutions : 2013-11-07 Silver Cover, LLC +// solutions : 2013-11-07 Binky Moon, LLC solutions -// song : 2015-02-26 Amazon EU S.à r.l. +// song : 2015-02-26 Amazon Registry Services, Inc. song // sony : 2015-01-08 Sony Corporation @@ -9786,13 +9838,16 @@ // spiegel : 2014-02-05 SPIEGEL-Verlag Rudolf Augstein GmbH & Co. KG spiegel -// spot : 2015-02-26 Amazon EU S.à r.l. +// sport : 2017-11-16 Global Association of International Sports Federations (GAISF) +sport + +// spot : 2015-02-26 Amazon Registry Services, Inc. spot -// spreadbetting : 2014-12-11 IG Group Holdings PLC +// spreadbetting : 2014-12-11 Dotspreadbetting Registry Limited spreadbetting -// srl : 2015-05-07 mySRL GmbH +// srl : 2015-05-07 InterNetX, Corp srl // srt : 2015-07-30 FCA US LLC. @@ -9828,7 +9883,7 @@ // stockholm : 2014-12-18 Stockholms kommun stockholm -// storage : 2014-12-22 Self Storage Company LLC +// storage : 2014-12-22 XYZ.COM LLC storage // store : 2015-04-09 DotStore Inc. @@ -9837,7 +9892,7 @@ // stream : 2016-01-08 dot Stream Limited stream -// studio : 2015-02-11 +// studio : 2015-02-11 United TLD Holdco Ltd. studio // study : 2014-12-11 OPEN UNIVERSITIES AUSTRALIA PTY LTD @@ -9846,22 +9901,22 @@ // style : 2014-12-04 Binky Moon, LLC style -// sucks : 2014-12-22 Vox Populi Registry Inc. +// sucks : 2014-12-22 Vox Populi Registry Ltd. sucks -// supplies : 2013-12-19 Atomic Fields, LLC +// supplies : 2013-12-19 Binky Moon, LLC supplies -// supply : 2013-12-19 Half Falls, LLC +// supply : 2013-12-19 Binky Moon, LLC supply -// support : 2013-10-24 Grand Orchard, LLC +// support : 2013-10-24 Binky Moon, LLC support -// surf : 2014-01-09 Top Level Domain Holdings Limited +// surf : 2014-01-09 Minds + Machines Group Limited surf -// surgery : 2014-03-20 Tin Avenue, LLC +// surgery : 2014-03-20 Binky Moon, LLC surgery // suzuki : 2014-02-20 SUZUKI MOTOR CORPORATION @@ -9882,7 +9937,7 @@ // symantec : 2014-12-04 Symantec Corporation symantec -// systems : 2013-11-07 Dash Cypress, LLC +// systems : 2013-11-07 Binky Moon, LLC systems // tab : 2014-12-04 Tabcorp Holdings Limited @@ -9891,7 +9946,7 @@ // taipei : 2014-07-10 Taipei City Government taipei -// talk : 2015-04-09 Amazon EU S.à r.l. +// talk : 2015-04-09 Amazon Registry Services, Inc. talk // taobao : 2015-01-15 Alibaba Group Holding Limited @@ -9909,10 +9964,10 @@ // tattoo : 2013-08-30 Uniregistry, Corp. tattoo -// tax : 2014-03-20 Storm Orchard, LLC +// tax : 2014-03-20 Binky Moon, LLC tax -// taxi : 2015-03-19 Pine Falls, LLC +// taxi : 2015-03-19 Binky Moon, LLC taxi // tci : 2014-09-12 Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. @@ -9921,13 +9976,13 @@ // tdk : 2015-06-11 TDK Corporation tdk -// team : 2015-03-05 Atomic Lake, LLC +// team : 2015-03-05 Binky Moon, LLC team -// tech : 2015-01-30 Dot Tech LLC +// tech : 2015-01-30 Personals TLD Inc. tech -// technology : 2013-09-13 Auburn Falls +// technology : 2013-09-13 Binky Moon, LLC technology // telecity : 2015-02-19 TelecityGroup International Limited @@ -9939,19 +9994,19 @@ // temasek : 2014-08-07 Temasek Holdings (Private) Limited temasek -// tennis : 2014-12-04 Cotton Bloom, LLC +// tennis : 2014-12-04 Binky Moon, LLC tennis // teva : 2015-07-02 Teva Pharmaceutical Industries Limited teva -// thd : 2015-04-02 Homer TLC, Inc. +// thd : 2015-04-02 Home Depot Product Authority, LLC thd -// theater : 2015-03-19 Blue Tigers, LLC +// theater : 2015-03-19 Binky Moon, LLC theater -// theatre : 2015-05-07 +// theatre : 2015-05-07 XYZ.COM LLC theatre // tiaa : 2015-07-23 Teachers Insurance and Annuity Association of America @@ -9960,16 +10015,16 @@ // tickets : 2015-02-05 Accent Media Limited tickets -// tienda : 2013-11-14 Victor Manor, LLC +// tienda : 2013-11-14 Binky Moon, LLC tienda // tiffany : 2015-01-30 Tiffany and Company tiffany -// tips : 2013-09-20 Corn Willow, LLC +// tips : 2013-09-20 Binky Moon, LLC tips -// tires : 2014-11-07 Dog Edge, LLC +// tires : 2014-11-07 Binky Moon, LLC tires // tirol : 2014-04-24 punkt Tirol GmbH @@ -9987,16 +10042,16 @@ // tmall : 2015-01-15 Alibaba Group Holding Limited tmall -// today : 2013-09-20 Pearl Woods, LLC +// today : 2013-09-20 Binky Moon, LLC today // tokyo : 2013-11-13 GMO Registry, Inc. tokyo -// tools : 2013-11-21 Pioneer North, LLC +// tools : 2013-11-21 Binky Moon, LLC tools -// top : 2014-03-20 Jiangsu Bangning Science & Technology Co.,Ltd. +// top : 2014-03-20 .TOP Registry top // toray : 2014-12-18 Toray Industries, Inc. @@ -10008,27 +10063,30 @@ // total : 2015-08-06 Total SA total -// tours : 2015-01-22 Sugar Station, LLC +// tours : 2015-01-22 Binky Moon, LLC tours -// town : 2014-03-06 Koko Moon, LLC +// town : 2014-03-06 Binky Moon, LLC town // toyota : 2015-04-23 TOYOTA MOTOR CORPORATION toyota -// toys : 2014-03-06 Pioneer Orchard, LLC +// toys : 2014-03-06 Binky Moon, LLC toys // trade : 2014-01-23 Elite Registry Limited trade -// trading : 2014-12-11 IG Group Holdings PLC +// trading : 2014-12-11 Dottrading Registry Limited trading -// training : 2013-11-07 Wild Willow, LLC +// training : 2013-11-07 Binky Moon, LLC training +// travel : Dog Beach, LLC +travel + // travelchannel : 2015-07-02 Lifestyle Domain Holdings, Inc. travelchannel @@ -10038,7 +10096,7 @@ // travelersinsurance : 2015-03-26 Travelers TLD, LLC travelersinsurance -// trust : 2014-10-16 +// trust : 2014-10-16 NCC Group Inc. trust // trv : 2015-03-26 Travelers TLD, LLC @@ -10050,10 +10108,10 @@ // tui : 2014-07-03 TUI AG tui -// tunes : 2015-02-26 Amazon EU S.à r.l. +// tunes : 2015-02-26 Amazon Registry Services, Inc. tunes -// tushu : 2014-12-18 Amazon EU S.à r.l. +// tushu : 2014-12-18 Amazon Registry Services, Inc. tushu // tvs : 2015-02-19 T V SUNDRAM IYENGAR & SONS LIMITED @@ -10071,7 +10129,7 @@ // unicom : 2015-10-15 China United Network Communications Corporation Limited unicom -// university : 2014-03-06 Little Station, LLC +// university : 2014-03-06 Binky Moon, LLC university // uno : 2013-09-11 Dot Latin LLC @@ -10083,7 +10141,7 @@ // ups : 2015-06-25 UPS Market Driver, Inc. ups -// vacations : 2013-12-05 Atomic Tigers, LLC +// vacations : 2013-12-05 Binky Moon, LLC vacations // vana : 2014-12-11 Lifestyle Domain Holdings, Inc. @@ -10095,22 +10153,22 @@ // vegas : 2014-01-16 Dot Vegas, Inc. vegas -// ventures : 2013-08-27 Binky Lake, LLC +// ventures : 2013-08-27 Binky Moon, LLC ventures // verisign : 2015-08-13 VeriSign, Inc. verisign -// versicherung : 2014-03-20 +// versicherung : 2014-03-20 TLD-BOX Registrydienstleistungen GmbH versicherung -// vet : 2014-03-06 +// vet : 2014-03-06 United TLD Holdco Ltd. vet -// viajes : 2013-10-17 Black Madison, LLC +// viajes : 2013-10-17 Binky Moon, LLC viajes -// video : 2014-10-16 +// video : 2014-10-16 United TLD Holdco Ltd. video // vig : 2015-05-14 VIENNA INSURANCE GROUP AG Wiener Versicherung Gruppe @@ -10119,10 +10177,10 @@ // viking : 2015-04-02 Viking River Cruises (Bermuda) Ltd. viking -// villas : 2013-12-05 New Sky, LLC +// villas : 2013-12-05 Binky Moon, LLC villas -// vin : 2015-06-18 Holly Shadow, LLC +// vin : 2015-06-18 Binky Moon, LLC vin // vip : 2015-01-22 Minds + Machines Group Limited @@ -10134,7 +10192,7 @@ // visa : 2015-07-30 Visa Worldwide Pte. Limited visa -// vision : 2013-12-05 Koko Station, LLC +// vision : 2013-12-05 Binky Moon, LLC vision // vista : 2014-09-18 Vistaprint Limited @@ -10152,7 +10210,7 @@ // vlaanderen : 2014-02-06 DNS.be vzw vlaanderen -// vodka : 2013-12-19 Top Level Domain Holdings Limited +// vodka : 2013-12-19 Minds + Machines Group Limited vodka // volkswagen : 2015-05-14 Volkswagen Group of America Inc. @@ -10170,7 +10228,7 @@ // voto : 2013-11-21 Monolith Registry LLC voto -// voyage : 2013-08-27 Ruby House, LLC +// voyage : 2013-08-27 Binky Moon, LLC voyage // vuelos : 2015-03-05 Travel Reservations SRL @@ -10185,25 +10243,25 @@ // walter : 2014-11-13 Sandvik AB walter -// wang : 2013-10-24 Zodiac Leo Limited +// wang : 2013-10-24 Zodiac Wang Limited wang -// wanggou : 2014-12-18 Amazon EU S.à r.l. +// wanggou : 2014-12-18 Amazon Registry Services, Inc. wanggou // warman : 2015-06-18 Weir Group IP Limited warman -// watch : 2013-11-14 Sand Shadow, LLC +// watch : 2013-11-14 Binky Moon, LLC watch // watches : 2014-12-22 Richemont DNS Inc. watches -// weather : 2015-01-08 The Weather Channel, LLC +// weather : 2015-01-08 International Business Machines Corporation weather -// weatherchannel : 2015-03-12 The Weather Channel, LLC +// weatherchannel : 2015-03-12 International Business Machines Corporation weatherchannel // webcam : 2014-01-23 dot Webcam Limited @@ -10218,7 +10276,7 @@ // wed : 2013-10-01 Atgron, Inc. wed -// wedding : 2014-04-24 Top Level Domain Holdings Limited +// wedding : 2014-04-24 Minds + Machines Group Limited wedding // weibo : 2015-03-05 Sina Corporation @@ -10245,7 +10303,7 @@ // windows : 2014-12-18 Microsoft Corporation windows -// wine : 2015-06-18 June Station, LLC +// wine : 2015-06-18 Binky Moon, LLC wine // winners : 2015-07-16 The TJX Companies, Inc. @@ -10260,22 +10318,22 @@ // woodside : 2015-07-09 Woodside Petroleum Limited woodside -// work : 2013-12-19 Top Level Domain Holdings Limited +// work : 2013-12-19 Minds + Machines Group Limited work -// works : 2013-11-14 Little Dynamite, LLC +// works : 2013-11-14 Binky Moon, LLC works -// world : 2014-06-12 Bitter Fields, LLC +// world : 2014-06-12 Binky Moon, LLC world -// wow : 2015-10-08 Amazon EU S.à r.l. +// wow : 2015-10-08 Amazon Registry Services, Inc. wow // wtc : 2013-12-19 World Trade Centers Association, Inc. wtc -// wtf : 2014-03-06 Hidden Way, LLC +// wtf : 2014-03-06 Binky Moon, LLC wtf // xbox : 2014-12-18 Microsoft Corporation @@ -10296,7 +10354,7 @@ // xn--11b4c3d : 2015-01-15 VeriSign Sarl कॉम -// xn--1ck2e1b : 2015-02-26 Amazon EU S.à r.l. +// xn--1ck2e1b : 2015-02-26 Amazon Registry Services, Inc. セール // xn--1qqw23a : 2014-01-09 Guangzhou YU Wei Information Technology Co., Ltd. @@ -10320,7 +10378,7 @@ // xn--42c2d9a : 2015-01-15 VeriSign Sarl คอม -// xn--45q11c : 2013-11-21 Zodiac Scorpio Limited +// xn--45q11c : 2013-11-21 Zodiac Gemini Ltd 八卦 // xn--4gbrim : 2013-10-04 Suhub Electronic Establishment @@ -10329,7 +10387,7 @@ // xn--55qw42g : 2013-11-08 China Organizational Name Administration Center 公益 -// xn--55qx5d : 2013-11-14 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center) +// xn--55qx5d : 2013-11-14 China Internet Network Information Center (CNNIC) 公司 // xn--5su34j936bgsg : 2015-09-03 Shangri‐La International Hotel Management Limited @@ -10338,7 +10396,7 @@ // xn--5tzm5g : 2014-12-22 Global Website TLD Asia Limited 网站 -// xn--6frz82g : 2013-09-23 Afilias Limited +// xn--6frz82g : 2013-09-23 Afilias plc 移动 // xn--6qq986b3xl : 2013-09-13 Tycoon Treasure Limited @@ -10371,7 +10429,7 @@ // xn--b4w605ferd : 2014-08-07 Temasek Holdings (Private) Limited 淡马锡 -// xn--bck1b9a5dre4c : 2015-02-26 Amazon EU S.à r.l. +// xn--bck1b9a5dre4c : 2015-02-26 Amazon Registry Services, Inc. ファッション // xn--c1avg : 2013-11-14 Public Interest Registry @@ -10380,7 +10438,7 @@ // xn--c2br7g : 2015-01-15 VeriSign Sarl नेट -// xn--cck2b3b : 2015-02-26 Amazon EU S.à r.l. +// xn--cck2b3b : 2015-02-26 Amazon Registry Services, Inc. ストア // xn--cg4bki : 2013-09-27 SAMSUNG SDS CO., LTD @@ -10389,25 +10447,25 @@ // xn--czr694b : 2014-01-16 Dot Trademark TLD Holding Company Limited 商标 -// xn--czrs0t : 2013-12-19 Wild Island, LLC +// xn--czrs0t : 2013-12-19 Binky Moon, LLC 商店 -// xn--czru2d : 2013-11-21 Zodiac Capricorn Limited +// xn--czru2d : 2013-11-21 Zodiac Aquarius Limited 商城 // xn--d1acj3b : 2013-11-20 The Foundation for Network Initiatives “The Smart Internet” дети -// xn--eckvdtc9d : 2014-12-18 Amazon EU S.à r.l. +// xn--eckvdtc9d : 2014-12-18 Amazon Registry Services, Inc. ポイント -// xn--efvy88h : 2014-08-22 Xinhua News Agency Guangdong Branch 新华通讯社广东分社 +// xn--efvy88h : 2014-08-22 Guangzhou YU Wei Information Technology Co., Ltd. 新闻 // xn--estv75g : 2015-02-19 Industrial and Commercial Bank of China Limited 工行 -// xn--fct429k : 2015-04-09 Amazon EU S.à r.l. +// xn--fct429k : 2015-04-09 Amazon Registry Services, Inc. 家電 // xn--fhbei : 2015-01-15 VeriSign Sarl @@ -10419,7 +10477,7 @@ // xn--fiq64b : 2013-10-14 CITIC Group Corporation 中信 -// xn--fjq720a : 2014-05-22 Will Bloom, LLC +// xn--fjq720a : 2014-05-22 Binky Moon, LLC 娱乐 // xn--flw351e : 2014-07-31 Charleston Road Registry Inc. @@ -10431,13 +10489,13 @@ // xn--g2xx48c : 2015-01-30 Minds + Machines Group Limited 购物 -// xn--gckr3f0f : 2015-02-26 Amazon EU S.à r.l. +// xn--gckr3f0f : 2015-02-26 Amazon Registry Services, Inc. クラウド -// xn--gk3at1e : 2015-10-08 Amazon EU S.à r.l. +// xn--gk3at1e : 2015-10-08 Amazon Registry Services, Inc. 通販 -// xn--hxt814e : 2014-05-15 Zodiac Libra Limited +// xn--hxt814e : 2014-05-15 Zodiac Taurus Limited 网店 // xn--i1b6b1a6a2e : 2013-11-14 Public Interest Registry @@ -10446,7 +10504,7 @@ // xn--imr513n : 2014-12-11 Dot Trademark TLD Holding Company Limited 餐厅 -// xn--io0a7i : 2013-11-14 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center) +// xn--io0a7i : 2013-11-14 China Internet Network Information Center (CNNIC) 网络 // xn--j1aef : 2015-01-15 VeriSign Sarl @@ -10455,7 +10513,7 @@ // xn--jlq61u9w7b : 2015-01-08 Nokia Corporation 诺基亚 -// xn--jvr189m : 2015-02-26 Amazon EU S.à r.l. +// xn--jvr189m : 2015-02-26 Amazon Registry Services, Inc. 食品 // xn--kcrx77d1x4a : 2014-11-07 Koninklijke Philips N.V. @@ -10515,6 +10573,9 @@ // xn--nyqy26a : 2014-11-07 Stable Tone Limited 健康 +// xn--otu796d : 2017-08-06 Dot Trademark TLD Holding Company Limited +招聘 + // xn--p1acf : 2013-12-12 Rusnames Limited рус @@ -10533,10 +10594,10 @@ // xn--rhqv96g : 2013-09-11 Stable Tone Limited 世界 -// xn--rovu88b : 2015-02-26 Amazon EU S.à r.l. +// xn--rovu88b : 2015-02-26 Amazon Registry Services, Inc. 書籍 -// xn--ses554g : 2014-01-16 +// xn--ses554g : 2014-01-16 KNET Co., Ltd. 网址 // xn--t60b56a : 2015-01-15 VeriSign Sarl @@ -10548,7 +10609,7 @@ // xn--tiq49xqyj : 2015-10-21 Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication) 天主教 -// xn--unup4y : 2013-07-14 Spring Fields, LLC +// xn--unup4y : 2013-07-14 Binky Moon, LLC 游戏 // xn--vermgensberater-ctb : 2014-06-23 Deutsche Vermögensberatung Aktiengesellschaft DVAG @@ -10557,7 +10618,7 @@ // xn--vermgensberatung-pwb : 2014-06-23 Deutsche Vermögensberatung Aktiengesellschaft DVAG vermögensberatung -// xn--vhquv : 2013-08-27 Dash McCook, LLC +// xn--vhquv : 2013-08-27 Binky Moon, LLC 企业 // xn--vuq861b : 2014-10-16 Beijing Tele-info Network Technology Co., Ltd. @@ -10587,7 +10648,7 @@ // yahoo : 2015-04-02 Yahoo! Domain Services Inc. yahoo -// yamaxun : 2014-12-18 Amazon EU S.à r.l. +// yamaxun : 2014-12-18 Amazon Registry Services, Inc. yamaxun // yandex : 2014-04-10 YANDEX, LLC @@ -10596,13 +10657,13 @@ // yodobashi : 2014-11-20 YODOBASHI CAMERA CO.,LTD. yodobashi -// yoga : 2014-05-29 Top Level Domain Holdings Limited +// yoga : 2014-05-29 Minds + Machines Group Limited yoga // yokohama : 2013-12-12 GMO Registry, Inc. yokohama -// you : 2015-04-09 Amazon EU S.à r.l. +// you : 2015-04-09 Amazon Registry Services, Inc. you // youtube : 2014-05-01 Charleston Road Registry Inc. @@ -10611,13 +10672,13 @@ // yun : 2015-01-08 QIHOO 360 TECHNOLOGY CO. LTD. yun -// zappos : 2015-06-25 Amazon EU S.à r.l. +// zappos : 2015-06-25 Amazon Registry Services, Inc. zappos // zara : 2014-11-07 Industria de Diseño Textil, S.A. (INDITEX, S.A.) zara -// zero : 2014-12-18 Amazon EU S.à r.l. +// zero : 2014-12-18 Amazon Registry Services, Inc. zero // zip : 2014-05-08 Charleston Road Registry Inc. @@ -10626,7 +10687,7 @@ // zippo : 2015-07-02 Zadco Company zippo -// zone : 2013-11-14 Outer Falls, LLC +// zone : 2013-11-14 Binky Moon, LLC zone // zuerich : 2014-11-07 Kanton Zürich (Canton of Zurich) @@ -10643,12 +10704,6 @@ inf.ua ltd.ua -// AgileBits Inc : https://agilebits.com -// Submitted by Roustem Karimov <roustem@agilebits.com> -1password.ca -1password.com -1password.eu - // Agnat sp. z o.o. : https://domena.pl // Submitted by Przemyslaw Plewa <it-admin@domena.pl> beep.pl @@ -10679,6 +10734,7 @@ elasticbeanstalk.com ap-northeast-1.elasticbeanstalk.com ap-northeast-2.elasticbeanstalk.com +ap-northeast-3.elasticbeanstalk.com ap-south-1.elasticbeanstalk.com ap-southeast-1.elasticbeanstalk.com ap-southeast-2.elasticbeanstalk.com @@ -10801,6 +10857,10 @@ // Submitted by Nathan O'Sullivan <nathan@mammoth.com.au> bnr.la +// Blackbaud, Inc. : https://www.blackbaud.com +// Submitted by Paul Crowder <paul.crowder@blackbaud.com> +blackbaudcdn.net + // Boomla : https://boomla.com // Submitted by Tibor Halter <thalter@boomla.com> boomla.net @@ -10848,7 +10908,6 @@ qc.com ru.com sa.com -se.com se.net uk.com uk.net @@ -10892,9 +10951,14 @@ // Submitted by Leon Rowland <leon@clearvox.nl> virtueeldomein.nl +// Clever Cloud : https://www.clever-cloud.com/ +// Submitted by Quentin Adam <noc@clever-cloud.com> +cleverapps.io + // Cloud66 : https://www.cloud66.com/ // Submitted by Khash Sajadi <khash@cloud66.com> c66.me +cloud66.ws // CloudAccess.net : https://www.cloudaccess.net/ // Submitted by Pawel Panek <noc@cloudaccess.net> @@ -10912,6 +10976,10 @@ // co.ca : http://registry.co.ca/ co.ca +// Co & Co : https://co-co.nl/ +// Submitted by Govert Versluis <govert@co-co.nl> +*.otap.co + // i-registry s.r.o. : http://www.i-registry.cz/ // Submitted by Martin Semrad <semrad@i-registry.cz> co.cz @@ -10938,6 +11006,10 @@ cloudns.pw cloudns.us +// Cloudeity Inc : https://cloudeity.com +// Submitted by Stefan Dimitrov <contact@cloudeity.com> +cloudeity.net + // CoDNS B.V. co.nl co.no @@ -10981,6 +11053,15 @@ daplie.me localhost.daplie.me +// Datto, Inc. : https://www.datto.com/ +// Submitted by Philipp Heckel <ph@datto.com> +dattolocal.com +dattorelay.com +dattoweb.com +mydatto.com +dattolocal.net +mydatto.net + // Dansk.net : http://www.dansk.net/ // Submitted by Anani Voule <digital@digital.co.dk> biz.dk @@ -11325,6 +11406,10 @@ definima.net definima.io +// dnstrace.pro : https://dnstrace.pro/ +// Submitted by Chris Partridge <chris@partridge.tech> +bci.dnstrace.pro + // Dynu.com : https://www.dynu.com/ // Submitted by Sue Ye <sue@dynu.com> ddnsfree.com @@ -11536,6 +11621,11 @@ b.ssl.fastly.net global.ssl.fastly.net +// FASTVPS EESTI OU : https://fastvps.ru/ +// Submitted by Likhachev Vasiliy <lihachev@fastvps.ru> +fastpanel.direct +fastvps-server.com + // Featherhead : https://featherhead.xyz/ // Submitted by Simon Menke <simon@featherhead.xyz> fhapp.xyz @@ -11573,6 +11663,8 @@ // Futureweb OG : http://www.futureweb.at // Submitted by Andreas Schnederle-Wagner <schnederle@futureweb.at> *.futurecms.at +*.ex.futurecms.at +*.in.futurecms.at futurehosting.at futuremailing.at *.ex.ortsinfo.at @@ -11709,6 +11801,14 @@ herokuapp.com herokussl.com +// Hibernating Rhinos +// Submitted by Oren Eini <oren@ravendb.net> +myravendb.com +ravendb.community +ravendb.me +development.run +ravendb.run + // Ici la Lune : http://www.icilalune.com/ // Submitted by Simon Morvan <simon@icilalune.com> moonscale.net @@ -11763,6 +11863,19 @@ // Submitted by Matthew Hardeman <mhardeman@ipifony.com> ipifony.net +// IServ GmbH : https://iserv.eu +// Submitted by Kim-Alexander Brodowski <kim.brodowski@iserv.eu> +mein-iserv.de +test-iserv.de + +// Jino : https://www.jino.ru +// Submitted by Sergey Ulyashin <ulyashin@jino.ru> +myjino.ru +*.hosting.myjino.ru +*.landing.myjino.ru +*.spectrum.myjino.ru +*.vps.myjino.ru + // Joyent : https://www.joyent.com/ // Submitted by Brian Bennett <brian.bennett@joyent.com> *.triton.zone @@ -11790,34 +11903,84 @@ lcube-server.de svn-repos.de +// Lightmaker Property Manager, Inc. : https://app.lmpm.com/ +// Submitted by Greg Holland <greg.holland@lmpm.com> +app.lmpm.com + +// Linki Tools UG : https://linki.tools +// Submitted by Paulo Matos <pmatos@linki.tools> +linkitools.space + +// linkyard ldt: https://www.linkyard.ch/ +// Submitted by Mario Siegenthaler <mario.siegenthaler@linkyard.ch> +linkyard.cloud +linkyard-cloud.ch + // LiquidNet Ltd : http://www.liquidnetlimited.com/ // Submitted by Victor Velchev <admin@liquidnetlimited.com> we.bs +// Lug.org.uk : https://lug.org.uk +// Submitted by Jon Spriggs <admin@lug.org.uk> +uklugs.org +glug.org.uk +lug.org.uk +lugs.org.uk + // Lukanet Ltd : https://lukanet.com // Submitted by Anton Avramov <register@lukanet.com> barsy.bg +barsy.co.uk +barsyonline.co.uk +barsycenter.com barsyonline.com +barsy.club barsy.de barsy.eu barsy.in +barsy.info +barsy.io +barsy.me +barsy.menu +barsy.mobi barsy.net barsy.online +barsy.org +barsy.pro +barsy.pub +barsy.shop +barsy.site barsy.support +barsy.uk // Magento Commerce // Submitted by Damien Tournoud <dtournoud@magento.cloud> *.magentosite.cloud +// May First - People Link : https://mayfirst.org/ +// Submitted by Jamie McClelland <info@mayfirst.org> +mayfirst.info +mayfirst.org + // Mail.Ru Group : https://hb.cldmail.ru // Submitted by Ilya Zaretskiy <zaretskiy@corp.mail.ru> hb.cldmail.ru +// Memset hosting : https://www.memset.com +// Submitted by Tom Whitwell <domains@memset.com> +miniserver.com +memset.net + // MetaCentrum, CESNET z.s.p.o. : https://www.metacentrum.cz/en/ // Submitted by Zdeněk Šustr <zdenek.sustr@cesnet.cz> cloud.metacentrum.cz custom.metacentrum.cz +// MetaCentrum, CESNET z.s.p.o. : https://www.metacentrum.cz/en/ +// Submitted by Radim Janča <janca@cesnet.cz> +flt.cloud.muni.cz +usr.cloud.muni.cz + // Meteor Development Group : https://www.meteor.com/hosting // Submitted by Pierre Carrier <pierre@meteor.com> meteorapp.com @@ -11826,12 +11989,17 @@ // Michau Enterprises Limited : http://www.co.pl/ co.pl -// Microsoft : http://microsoft.com -// Submitted by Barry Dorrans <bdorrans@microsoft.com> +// Microsoft Corporation : http://microsoft.com +// Submitted by Justin Luk <juluk@microsoft.com> +azurecontainer.io azurewebsites.net azure-mobile.net cloudapp.net +// Mozilla Corporation : https://mozilla.com +// Submitted by Ben Francis <bfrancis@mozilla.com> +mozilla-iot.org + // Mozilla Foundation : https://mozilla.org/ // Submitted by glob <glob@mozilla.com> bmoattachments.org @@ -11863,6 +12031,34 @@ // Submitted by Jeff Wheelhouse <support@nearlyfreespeech.net> nfshost.com +// Now-DNS : https://now-dns.com +// Submitted by Steve Russell <steve@now-dns.com> +dnsking.ch +mypi.co +n4t.co +001www.com +ddnslive.com +myiphost.com +forumz.info +16-b.it +32-b.it +64-b.it +soundcast.me +tcp4.me +dnsup.net +hicam.net +now-dns.net +ownip.net +vpndns.net +dynserv.org +now-dns.org +x443.pw +now-dns.top +ntdll.top +freeddns.us +crafting.xyz +zapto.xyz + // nsupdate.info : https://www.nsupdate.info/ // Submitted by Thomas Waldmann <info@nsupdate.info> nsupdate.info @@ -11965,6 +12161,10 @@ nodum.co nodum.io +// Nucleos Inc. : https://nucleos.com +// Submitted by Piotr Zduniak <piotr@nucleos.com> +pcloud.host + // NYC.mn : http://www.information.nyc.mn // Submitted by Matthew Brown <mattbrown@nyc.mn> nyc.mn @@ -11972,25 +12172,32 @@ // NymNom : https://nymnom.com/ // Submitted by Dave McCormack <dave.mccormack@nymnom.com> nom.ae +nom.af nom.ai nom.al nym.by nym.bz nom.cl nom.gd +nom.ge nom.gl nym.gr nom.gt +nym.gy nom.hn +nym.ie nom.im +nom.ke nym.kz nym.la +nym.lc nom.li nym.li nym.lt nym.lu nym.me nom.mk +nym.mn nym.mx nom.nu nym.nz @@ -11998,11 +12205,14 @@ nym.pt nom.pw nom.qa +nym.ro nom.rs nom.si nym.sk +nom.st nym.su nym.sx +nom.tj nym.tw nom.ug nom.uy @@ -12029,9 +12239,14 @@ // Submitted by Duarte Santos <domain-admin@outsystemscloud.com> outsystemscloud.com -// OwnProvider : http://www.ownprovider.com +// OwnProvider GmbH: http://www.ownprovider.com // Submitted by Jan Moennich <jan.moennich@ownprovider.com> ownprovider.com +own.pm + +// OX : http://www.ox.rs +// Submitted by Adam Grand <webmaster@mail.ox.rs> +ox.rs // oy.lc // Submitted by Charly Coste <changaco@changaco.oy.lc> @@ -12085,10 +12300,14 @@ protonet.io // Publication Presse Communication SARL : https://ppcom.fr -// Submitted by Yaacov Akiba Slama <admin@chirurgiens-dentistes-en-france.fr> +// Submitted by Yaacov Akiba Slama <admin@chirurfgiens-dentistes-en-france.fr> chirurgiens-dentistes-en-france.fr byen.site +// Russian Academy of Sciences +// Submitted by Tech Support <support@rasnet.ru> +ras.ru + // QA2 // Submitted by Daniel Dent (https://www.danieldent.com/) qa2.com @@ -12141,6 +12360,10 @@ logoip.de logoip.com +// schokokeks.org GbR : https://schokokeks.org/ +// Submitted by Hanno Böck <hanno@schokokeks.org> +schokokeks.net + // Scry Security : http://www.scrysec.com // Submitted by Shante Adam <shante@skyhat.io> scrysec.com @@ -12206,6 +12429,10 @@ // Submitted by Reza Akhavan <spacekit.io@gmail.com> spacekit.io +// SpeedPartner GmbH: https://www.speedpartner.de/ +// Submitted by Stefan Neufeind <info@speedpartner.de> +customer.speedpartner.de + // Stackspace : https://www.stackspace.io/ // Submitted by Lina He <info@stackspace.io> stackspace.space @@ -12214,6 +12441,10 @@ // Submitted by Philip Hutchins <hostmaster@storj.io> storj.farm +// Studenten Net Twente : http://www.snt.utwente.nl/ +// Submitted by Silke Hofstra <syscom@snt.utwente.nl> +utwente.io + // Sub 6 Limited: http://www.sub6.com // Submitted by Dan Miller <dm@sub6.com> temp-dns.com @@ -12246,6 +12477,10 @@ med.pl sopot.pl +// The Gwiddle Foundation : https://gwiddlefoundation.org.uk +// Submitted by Joshua Bayfield <joshua.bayfield@gwiddlefoundation.org.uk> +gwiddle.co.uk + // Thingdust AG : https://thingdust.com/ // Submitted by Adrian Imboden <adi@thingdust.com> cust.dev.thingdust.io @@ -12309,6 +12544,7 @@ // Uberspace : https://uberspace.de // Submitted by Moritz Werner <mwerner@jonaspasche.com> uber.space +*.uberspace.de // UDR Limited : http://www.udr.hk.com // Submitted by registry <hostmaster@udr.hk.com> @@ -12317,10 +12553,19 @@ ltd.hk inc.hk +// United Gameserver GmbH : https://united-gameserver.de +// Submitted by Stefan Schwarz <sysadm@united-gameserver.de> +virtualuser.de +virtual-user.de + // .US // Submitted by Ed Moore <Ed.Moore@lib.de.us> lib.de.us +// VeryPositive SIA : http://very.lv +// Submitted by Danko Aleksejevs <danko@very.lv> +2038.io + // Viprinet Europe GmbH : http://www.viprinet.com // Submitted by Simon Kissel <hostmaster@viprinet.com> router.management @@ -12343,12 +12588,26 @@ // Submitted by Yuvi Panda <yuvipanda@wikimedia.org> wmflabs.org +// XenonCloud GbR: https://xenoncloud.net +// Submitted by Julian Uphoff <publicsuffixlist@xenoncloud.net> +half.host + +// XnBay Technology : http://www.xnbay.com/ +// Submitted by XnBay Developer <developer.xncloud@gmail.com> +xnbay.com +u2.xnbay.com +u2-local.xnbay.com + // XS4ALL Internet bv : https://www.xs4all.nl/ // Submitted by Daniel Mostertman <unixbeheer+publicsuffix@xs4all.net> cistron.nl demon.nl xs4all.space +// YesCourse Pty Ltd : https://yescourse.com +// Submitted by Atul Bhouraskar <atul@yescourse.com> +official.academy + // Yola : https://www.yola.com/ // Submitted by Stefano Rivera <stefano@yola.com> yolasite.com @@ -12363,6 +12622,11 @@ ybo.science ybo.trade +// Yunohost : https://yunohost.org +// Submitted by Valentin Grimaud <security@yunohost.org> +nohost.me +noho.st + // ZaNiC : http://www.za.net/ // Submitted by registry <hostmaster@nic.za.net> za.net @@ -12372,4 +12636,8 @@ // Submitted by Olli Vanhoja <olli@zeit.co> now.sh +// Zone.id : https://zone.id/ +// Submitted by Su Hendro <admin@zone.id> +zone.id + // ===END PRIVATE DOMAINS===
diff --git a/net/base/registry_controlled_domains/effective_tld_names.gperf b/net/base/registry_controlled_domains/effective_tld_names.gperf index c8a96e0..f1a5a5b 100644 --- a/net/base/registry_controlled_domains/effective_tld_names.gperf +++ b/net/base/registry_controlled_domains/effective_tld_names.gperf
@@ -12,22 +12,23 @@ }; %% 0.bg, 0 +001www.com, 4 0emm.com, 6 1.bg, 0 12hp.at, 4 12hp.ch, 4 12hp.de, 4 1337.pictures, 4 +16-b.it, 4 1kapp.com, 4 -1password.ca, 4 -1password.com, 4 -1password.eu, 4 2.bg, 0 2000.hu, 0 +2038.io, 4 2ix.at, 4 2ix.ch, 4 2ix.de, 4 3.bg, 0 +32-b.it, 4 3utilities.com, 4 4.bg, 0 4lima.at, 4 @@ -36,6 +37,7 @@ 4u.com, 4 5.bg, 0 6.bg, 0 +64-b.it, 4 7.bg, 0 8.bg, 0 9.bg, 0 @@ -324,6 +326,7 @@ aoste.it, 0 ap-northeast-1.elasticbeanstalk.com, 4 ap-northeast-2.elasticbeanstalk.com, 4 +ap-northeast-3.elasticbeanstalk.com, 4 ap-south-1.elasticbeanstalk.com, 4 ap-southeast-1.elasticbeanstalk.com, 4 ap-southeast-2.elasticbeanstalk.com, 4 @@ -334,6 +337,7 @@ aparecida.br, 0 apartments, 0 app, 0 +app.lmpm.com, 4 app.os.fedoraproject.org, 4 app.os.stg.fedoraproject.org, 4 appchizi.com, 4 @@ -516,6 +520,7 @@ azumino.nagano.jp, 0 azure, 0 azure-mobile.net, 4 +azurecontainer.io, 4 azurewebsites.net, 4 b.bg, 0 b.br, 0 @@ -543,6 +548,8 @@ balestrand.no, 0 ballangen.no, 0 ballooning.aero, 0 +balsan-sudtirol.it, 0 +balsan-suedtirol.it, 0 balsan.it, 0 balsfjord.no, 0 baltimore.museum, 0 @@ -569,13 +576,29 @@ barrel-of-knowledge.info, 4 barrell-of-knowledge.info, 4 barsy.bg, 4 +barsy.club, 4 +barsy.co.uk, 4 barsy.de, 4 barsy.eu, 4 barsy.in, 4 +barsy.info, 4 +barsy.io, 4 +barsy.me, 4 +barsy.menu, 4 +barsy.mobi, 4 barsy.net, 4 barsy.online, 4 +barsy.org, 4 +barsy.pro, 4 +barsy.pub, 4 +barsy.shop, 4 +barsy.site, 4 barsy.support, 4 +barsy.uk, 4 +barsycenter.com, 4 +barsyonline.co.uk, 4 barsyonline.com, 4 +barueri.br, 0 barum.no, 0 bas.it, 0 baseball, 0 @@ -598,6 +621,7 @@ bbva, 0 bc.ca, 0 bcg, 0 +bci.dnstrace.pro, 4 bcn, 0 bd, 2 bd.se, 0 @@ -703,6 +727,7 @@ bjugn.no, 0 bl.it, 0 black, 0 +blackbaudcdn.net, 4 blackfriday, 0 blanco, 0 blockbuster, 0 @@ -817,6 +842,7 @@ bolivia.bo, 0 bologna.it, 0 bolt.hu, 0 +bolzano-altoadige.it, 0 bolzano.it, 0 bom, 0 bomlo.no, 0 @@ -826,7 +852,6 @@ book, 0 booking, 0 boomla.net, 4 -boots, 0 bosch, 0 bostik, 0 boston, 0 @@ -841,6 +866,8 @@ boutique, 0 box, 0 boxfuse.io, 4 +bozen-sudtirol.it, 0 +bozen-suedtirol.it, 0 bozen.it, 0 bplaced.com, 4 bplaced.de, 4 @@ -890,6 +917,9 @@ builders, 0 building.museum, 0 bukhara.su, 4 +bulsan-sudtirol.it, 0 +bulsan-suedtirol.it, 0 +bulsan.it, 0 bungoono.oita.jp, 0 bungotakada.oita.jp, 0 bunkyo.tokyo.jp, 0 @@ -1086,6 +1116,7 @@ chanel, 0 channel, 0 channelsdvr.net, 4 +charity, 0 charter.aero, 0 chase, 0 chat, 0 @@ -1186,6 +1217,7 @@ claims, 0 clan.rip, 4 cleaning, 0 +cleverapps.io, 4 click, 0 clinic, 0 clinique, 0 @@ -1196,11 +1228,13 @@ cloud.fedoraproject.org, 4 cloud.goog, 4 cloud.metacentrum.cz, 4 +cloud66.ws, 4 cloudaccess.host, 4 cloudaccess.net, 4 cloudapp.net, 4 cloudcontrolapp.com, 4 cloudcontrolled.com, 4 +cloudeity.net, 4 cloudfront.net, 4 cloudfunctions.net, 4 cloudns.asia, 4 @@ -1508,6 +1542,7 @@ cr, 0 cr.it, 0 cr.ua, 0 +crafting.xyz, 4 crafts.museum, 0 cranbrook.museum, 0 creation.museum, 0 @@ -1545,6 +1580,7 @@ cust.testing.thingdust.io, 4 custom.metacentrum.cz, 4 customer.enonic.io, 4 +customer.speedpartner.de, 4 cv, 0 cv.ua, 0 cw, 0 @@ -1587,6 +1623,10 @@ date.hokkaido.jp, 0 dating, 0 datsun, 0 +dattolocal.com, 4 +dattolocal.net, 4 +dattorelay.com, 4 +dattoweb.com, 4 davvenjarga.no, 0 davvesiida.no, 0 day, 0 @@ -1599,6 +1639,7 @@ ddnsfree.com, 4 ddnsgeek.com, 4 ddnsking.com, 4 +ddnslive.com, 4 ddnss.de, 4 ddnss.org, 4 ddr.museum, 0 @@ -1646,6 +1687,7 @@ dev, 0 dev-myqnapcloud.com, 4 dev.static.land, 4 +development.run, 4 devices.resinstaging.io, 4 df.gov.br, 0 df.leg.br, 4 @@ -1688,6 +1730,8 @@ dnsfor.me, 4 dnshome.de, 4 dnsiskinky.com, 4 +dnsking.ch, 4 +dnsup.net, 4 dnsupdater.de, 4 do, 0 docs, 0 @@ -1781,6 +1825,7 @@ dyndns.ws, 4 dyndns1.de, 4 dynns.com, 4 +dynserv.org, 4 dynu.net, 4 dynv6.net, 4 dynvpn.de, 4 @@ -2058,6 +2103,7 @@ events, 0 everbank, 0 evje-og-hornnes.no, 0 +ex.futurecms.at, 6 ex.ortsinfo.at, 6 exchange, 0 exchange.aero, 0 @@ -2096,6 +2142,8 @@ fashion, 0 fast, 0 fastlylb.net, 4 +fastpanel.direct, 4 +fastvps-server.com, 4 fauske.no, 0 fbx-os.fr, 4 fbxos.fr, 4 @@ -2190,6 +2238,7 @@ florist, 0 floro.no, 0 flowers, 0 +flt.cloud.muni.cz, 4 fly, 0 flynnhosting.net, 4 flynnhub.com, 4 @@ -2226,6 +2275,7 @@ fortworth.museum, 0 forum, 0 forum.hu, 0 +forumz.info, 4 fosnes.no, 0 fot.br, 0 foundation, 0 @@ -2246,6 +2296,7 @@ freeboxos.com, 4 freeboxos.fr, 4 freeddns.org, 4 +freeddns.us, 4 freemasonry.museum, 0 freesite.host, 4 freetls.fastly.net, 4 @@ -2508,6 +2559,7 @@ globo, 0 glogow.pl, 0 gloppen.no, 0 +glug.org.uk, 4 gm, 0 gmail, 0 gmbh, 0 @@ -2796,6 +2848,7 @@ gv.at, 0 gw, 0 gwangju.kr, 0 +gwiddle.co.uk, 4 gx.cn, 0 gy, 0 gyeongbuk.kr, 0 @@ -2829,6 +2882,7 @@ hakui.ishikawa.jp, 0 hakusan.ishikawa.jp, 0 halden.no, 0 +half.host, 4 halloffame.museum, 0 halsa.no, 0 ham-radio-op.net, 4 @@ -2916,6 +2970,7 @@ hgtv, 0 hi.cn, 0 hi.us, 0 +hicam.net, 4 hichiso.gifu.jp, 0 hida.gifu.jp, 0 hidaka.hokkaido.jp, 0 @@ -3069,6 +3124,7 @@ host, 0 hosting, 0 hosting-cluster.nl, 4 +hosting.myjino.ru, 6 hot, 0 hotel.hu, 0 hotel.lk, 0 @@ -3192,6 +3248,7 @@ in-addr.arpa, 0 in-the-band.net, 4 in.eu.org, 4 +in.futurecms.at, 6 in.na, 0 in.net, 4 in.ni, 0 @@ -3211,6 +3268,7 @@ inatsuki.fukuoka.jp, 0 inawashiro.fukushima.jp, 0 inazawa.aichi.jp, 0 +inc, 0 inc.hk, 4 incheon.kr, 0 ind.br, 0 @@ -4040,6 +4098,7 @@ land, 0 land-4-sale.us, 4 landes.museum, 0 +landing.myjino.ru, 6 landrover, 0 langevag.no, 0 lans.museum, 0 @@ -4188,6 +4247,9 @@ linde, 0 lindesnes.no, 0 link, 0 +linkitools.space, 4 +linkyard-cloud.ch, 4 +linkyard.cloud, 4 linz.museum, 0 lipsy, 0 live, 0 @@ -4197,6 +4259,7 @@ livorno.it, 0 lixil, 0 lk, 0 +llc, 0 ln.cn, 0 lo.it, 0 loabat.no, 0 @@ -4257,7 +4320,9 @@ lucania.it, 0 lucca.it, 0 lucerne.museum, 0 +lug.org.uk, 4 lugansk.ua, 0 +lugs.org.uk, 4 lukow.pl, 0 lund.no, 0 lundbeck, 0 @@ -4375,6 +4440,8 @@ matsuzaki.shizuoka.jp, 0 matta-varjjat.no, 0 mattel, 0 +mayfirst.info, 4 +mayfirst.org, 4 mazowsze.pl, 0 mazury.pl, 0 mb.ca, 0 @@ -4421,6 +4488,7 @@ meeres.museum, 0 meet, 0 meguro.tokyo.jp, 0 +mein-iserv.de, 4 mein-vigor.de, 4 meiwa.gunma.jp, 0 meiwa.mie.jp, 0 @@ -4432,6 +4500,7 @@ meme, 0 memorial, 0 memorial.museum, 0 +memset.net, 4 men, 0 menu, 0 meo, 0 @@ -4573,6 +4642,7 @@ miners.museum, 0 mini, 0 mining.museum, 0 +miniserver.com, 4 minnesota.museum, 0 mino.gifu.jp, 0 minobu.yamanashi.jp, 0 @@ -4721,6 +4791,7 @@ movie, 0 movimiento.bo, 0 movistar, 0 +mozilla-iot.org, 4 mp, 0 mp.br, 0 mq, 0 @@ -4743,7 +4814,6 @@ mt.leg.br, 4 mt.us, 0 mtn, 0 -mtpc, 0 mtr, 0 mu, 0 muenchen.museum, 0 @@ -4799,6 +4869,8 @@ myactivedirectory.com, 4 myasustor.com, 4 mycd.eu, 4 +mydatto.com, 4 +mydatto.net, 4 myddns.rocks, 4 mydissent.net, 4 mydrobo.com, 4 @@ -4809,6 +4881,8 @@ myftp.biz, 4 myftp.org, 4 myhome-server.de, 4 +myiphost.com, 4 +myjino.ru, 4 mykolaiv.ua, 0 mymailer.com.tw, 4 mymediapc.net, 4 @@ -4816,8 +4890,10 @@ mypep.link, 4 mypets.ws, 4 myphotos.cc, 4 +mypi.co, 4 mypsx.net, 4 myqnapcloud.com, 4 +myravendb.com, 4 mysecuritycamera.com, 4 mysecuritycamera.net, 4 mysecuritycamera.org, 4 @@ -4829,6 +4905,7 @@ mz, 0 n.bg, 0 n.se, 0 +n4t.co, 4 na, 0 na.it, 0 naamesjevuemie.no, 0 @@ -5237,11 +5314,14 @@ nogata.fukuoka.jp, 0 nogi.tochigi.jp, 0 noheji.aomori.jp, 0 +noho.st, 4 +nohost.me, 4 noip.me, 4 noip.us, 4 nokia, 0 nom.ad, 0 nom.ae, 4 +nom.af, 4 nom.ag, 0 nom.ai, 4 nom.al, 4 @@ -5251,10 +5331,12 @@ nom.es, 0 nom.fr, 0 nom.gd, 4 +nom.ge, 4 nom.gl, 4 nom.gt, 4 nom.hn, 4 nom.im, 4 +nom.ke, 4 nom.km, 0 nom.li, 4 nom.mg, 0 @@ -5271,6 +5353,8 @@ nom.ro, 0 nom.rs, 4 nom.si, 4 +nom.st, 4 +nom.tj, 4 nom.tm, 0 nom.ug, 4 nom.uy, 4 @@ -5309,6 +5393,9 @@ nov.su, 4 novara.it, 0 now, 0 +now-dns.net, 4 +now-dns.org, 4 +now-dns.top, 4 now.sh, 4 nowaruda.pl, 0 nowruz, 0 @@ -5329,6 +5416,7 @@ nt.edu.au, 0 nt.no, 0 nt.ro, 0 +ntdll.top, 4 ntr.br, 0 ntt, 0 nu, 0 @@ -5349,16 +5437,21 @@ nym.by, 4 nym.bz, 4 nym.gr, 4 +nym.gy, 4 +nym.ie, 4 nym.kz, 4 nym.la, 4 +nym.lc, 4 nym.li, 4 nym.lt, 4 nym.lu, 4 nym.me, 4 +nym.mn, 4 nym.mx, 4 nym.nz, 4 nym.pe, 4 nym.pt, 4 +nym.ro, 4 nym.sk, 4 nym.su, 4 nym.sx, 4 @@ -5399,6 +5492,7 @@ off.ai, 0 office, 0 office-on-the.net, 4 +official.academy, 4 ofunato.iwate.jp, 0 og.ao, 0 og.it, 0 @@ -5722,6 +5816,7 @@ otaki.nagano.jp, 0 otaki.saitama.jp, 0 otama.fukushima.jp, 0 +otap.co, 6 otari.nagano.jp, 0 otaru.hokkaido.jp, 0 other.nf, 0 @@ -5746,7 +5841,10 @@ ovre-eiker.no, 0 owani.aomori.jp, 0 owariasahi.aichi.jp, 0 +own.pm, 4 +ownip.net, 4 ownprovider.com, 4 +ox.rs, 4 oxford.museum, 0 oy.lc, 4 oyabe.toyama.jp, 0 @@ -5810,6 +5908,7 @@ pc.it, 0 pc.pl, 0 pccw, 0 +pcloud.host, 4 pd.it, 0 pe, 0 pe.ca, 0 @@ -6082,7 +6181,11 @@ randaberg.no, 0 rankoshi.hokkaido.jp, 0 ranzan.saitama.jp, 0 +ras.ru, 4 rauma.no, 0 +ravendb.community, 4 +ravendb.me, 4 +ravendb.run, 4 ravenna.it, 0 rawa-maz.pl, 0 rc.it, 0 @@ -6461,6 +6564,7 @@ schlesisches.museum, 0 schmidt, 0 schoenbrunn.museum, 0 +schokokeks.net, 4 schokoladen.museum, 0 scholarships, 0 school, 0 @@ -6495,7 +6599,6 @@ sd.us, 0 sdn.gov.pl, 0 se, 0 -se.com, 4 se.eu.org, 4 se.gov.br, 0 se.leg.br, 4 @@ -6817,6 +6920,7 @@ sosa.chiba.jp, 0 sosnowiec.pl, 0 soundandvision.museum, 0 +soundcast.me, 4 southcarolina.museum, 0 southwest.museum, 0 sowa.ibaraki.jp, 0 @@ -6833,8 +6937,10 @@ spdns.de, 4 spdns.eu, 4 spdns.org, 4 +spectrum.myjino.ru, 6 spiegel, 0 spjelkavik.no, 0 +sport, 0 sport.hu, 0 spot, 0 spreadbetting, 0 @@ -7105,6 +7211,7 @@ tc, 0 tci, 0 tcm.museum, 0 +tcp4.me, 4 td, 0 tdk, 0 te.it, 0 @@ -7139,6 +7246,7 @@ terni.it, 0 ternopil.ua, 0 teshikaga.hokkaido.jp, 0 +test-iserv.de, 4 test.ru, 0 test.tj, 0 teva, 0 @@ -7335,6 +7443,10 @@ travelersinsurance, 0 trd.br, 0 tree.museum, 0 +trentin-sud-tirol.it, 0 +trentin-sudtirol.it, 0 +trentin-sued-tirol.it, 0 +trentin-suedtirol.it, 0 trentino-a-adige.it, 0 trentino-aadige.it, 0 trentino-alto-adige.it, 0 @@ -7356,6 +7468,10 @@ trentinosudtirol.it, 0 trentinosued-tirol.it, 0 trentinosuedtirol.it, 0 +trentinsud-tirol.it, 0 +trentinsudtirol.it, 0 +trentinsued-tirol.it, 0 +trentinsuedtirol.it, 0 trento.it, 0 treviso.it, 0 trieste.it, 0 @@ -7445,10 +7561,13 @@ tz, 0 u.bg, 0 u.se, 0 +u2-local.xnbay.com, 4 +u2.xnbay.com, 4 ua, 0 ubank, 0 ube.yamaguchi.jp, 0 uber.space, 4 +uberspace.de, 6 ubs, 0 uchihara.ibaraki.jp, 0 uchiko.ehime.jp, 0 @@ -7477,6 +7596,7 @@ uk.net, 4 uki.kumamoto.jp, 0 ukiha.fukuoka.jp, 0 +uklugs.org, 4 ullensaker.no, 0 ullensvang.no, 0 ulm.museum, 0 @@ -7548,6 +7668,7 @@ ushistory.museum, 0 ushuaia.museum, 0 uslivinghistory.museum, 0 +usr.cloud.muni.cz, 4 ustka.pl, 0 usui.fukuoka.jp, 0 usuki.oita.jp, 0 @@ -7559,6 +7680,7 @@ uto.kumamoto.jp, 0 utsira.no, 0 utsunomiya.tochigi.jp, 0 +utwente.io, 4 uvic.museum, 0 uw.gov.pl, 0 uwajima.ehime.jp, 0 @@ -7595,7 +7717,9 @@ valled-aosta.it, 0 valledaosta.it, 0 vallee-aoste.it, 0 +vallee-d-aoste.it, 0 valleeaoste.it, 0 +valleedaoste.it, 0 valley.museum, 0 vana, 0 vang.no, 0 @@ -7673,7 +7797,9 @@ vipsinaapp.com, 4 virgin, 0 virginia.museum, 0 +virtual-user.de, 4 virtual.museum, 0 +virtualuser.de, 4 virtueeldomein.nl, 4 virtuel.museum, 0 visa, 0 @@ -7707,7 +7833,9 @@ voting, 0 voto, 0 voyage, 0 +vpndns.net, 4 vpnplus.to, 4 +vps.myjino.ru, 6 vr.it, 0 vs.it, 0 vt.it, 0 @@ -7854,6 +7982,7 @@ wzmiuw.gov.pl, 0 x.bg, 0 x.se, 0 +x443.pw, 4 xbox, 0 xen.prgmr.com, 4 xenapponazure.com, 4 @@ -7895,6 +8024,7 @@ xn--55qx5d, 0 xn--55qx5d.cn, 0 xn--55qx5d.hk, 0 +xn--55qx5d.xn--j6w193g, 0 xn--5js045d.jp, 0 xn--5rtp49c.jp, 0 xn--5rtq34k.jp, 0 @@ -7930,6 +8060,7 @@ xn--b-5ga.nordland.no, 0 xn--b-5ga.telemark.no, 0 xn--b4w605ferd, 0 +xn--balsan-sdtirol-nsb.it, 0 xn--bck1b9a5dre4c, 0 xn--bdddj-mrabd.no, 0 xn--bearalvhki-y4a.no, 0 @@ -7943,15 +8074,19 @@ xn--blt-elab.no, 0 xn--bmlo-gra.no, 0 xn--bod-2na.no, 0 +xn--bozen-sdtirol-2ob.it, 0 xn--brnny-wuac.no, 0 xn--brnnysund-m8ac.no, 0 xn--brum-voa.no, 0 xn--btsfjord-9za.no, 0 +xn--bulsan-sdtirol-nsb.it, 0 xn--c1avg, 0 xn--c1avg.xn--90a3ac, 0 xn--c2br7g, 0 xn--c3s14m.jp, 0 xn--cck2b3b, 0 +xn--cesena-forl-mcb.it, 0 +xn--cesenaforl-i8a.it, 0 xn--cg4bki, 0 xn--ciqpn.hk, 0 xn--clchc0ea0b2g2a9gcd, 0 @@ -7992,6 +8127,8 @@ xn--fl-zia.no, 0 xn--flor-jra.no, 0 xn--flw351e, 0 +xn--forl-cesena-fcb.it, 0 +xn--forlcesena-c8a.it, 0 xn--fpcrj9c3d, 0 xn--frde-gra.no, 0 xn--frna-woa.no, 0 @@ -8009,6 +8146,7 @@ xn--gls-elac.no, 0 xn--gmq050i.hk, 0 xn--gmqw5a.hk, 0 +xn--gmqw5a.xn--j6w193g, 0 xn--h-2fa.no, 0 xn--h1aegh.museum, 0 xn--h2breg3eve, 0 @@ -8102,6 +8240,7 @@ xn--mgbai9azgqp6j, 0 xn--mgbayh7gpa, 0 xn--mgbb9fbpob, 0 +xn--mgbbh1a, 0 xn--mgbbh1a71e, 0 xn--mgbc0a9azcg, 0 xn--mgbca7dzdo, 0 @@ -8134,6 +8273,7 @@ xn--muost-0qa.no, 0 xn--mxtq1m, 0 xn--mxtq1m.hk, 0 +xn--mxtq1m.xn--j6w193g, 0 xn--ngbc5azd, 0 xn--ngbe9e0a, 0 xn--ngbrx, 0 @@ -8155,11 +8295,13 @@ xn--o3cyx2a.xn--o3cw4h, 0 xn--od0alg.cn, 0 xn--od0alg.hk, 0 +xn--od0alg.xn--j6w193g, 0 xn--od0aq3b.hk, 0 xn--ogbpf8fl, 0 xn--oppegrd-ixa.no, 0 xn--ostery-fya.no, 0 xn--osyro-wua.no, 0 +xn--otu796d, 0 xn--p1acf, 0 xn--p1ai, 0 xn--pbt977c, 0 @@ -8200,6 +8342,7 @@ xn--s9brj9c, 0 xn--sandnessjen-ogb.no, 0 xn--sandy-yua.no, 0 +xn--sdtirol-n2a.it, 0 xn--seral-lra.no, 0 xn--ses554g, 0 xn--sgne-gra.no, 0 @@ -8234,12 +8377,21 @@ xn--tnsberg-q1a.no, 0 xn--tor131o.jp, 0 xn--trany-yua.no, 0 +xn--trentin-sd-tirol-rzb.it, 0 +xn--trentin-sdtirol-7vb.it, 0 +xn--trentino-sd-tirol-c3b.it, 0 +xn--trentino-sdtirol-szb.it, 0 +xn--trentinosd-tirol-rzb.it, 0 +xn--trentinosdtirol-7vb.it, 0 +xn--trentinsd-tirol-6vb.it, 0 +xn--trentinsdtirol-nsb.it, 0 xn--trgstad-r1a.no, 0 xn--trna-woa.no, 0 xn--troms-zua.no, 0 xn--tysvr-vra.no, 0 xn--uc0atv.hk, 0 xn--uc0atv.tw, 0 +xn--uc0atv.xn--j6w193g, 0 xn--uc0ay4a.hk, 0 xn--uist22h.jp, 0 xn--uisz3g.jp, 0 @@ -8247,6 +8399,10 @@ xn--unup4y, 0 xn--uuwu58a.jp, 0 xn--vads-jra.no, 0 +xn--valle-aoste-ebb.it, 0 +xn--valle-d-aoste-ehb.it, 0 +xn--valleaoste-e7a.it, 0 +xn--valledaoste-ebb.it, 0 xn--vard-jra.no, 0 xn--vegrshei-c0a.no, 0 xn--vermgensberater-ctb, 0 @@ -8266,6 +8422,7 @@ xn--w4r85el8fhu5dnra, 0 xn--w4rs40l, 0 xn--wcvs22d.hk, 0 +xn--wcvs22d.xn--j6w193g, 0 xn--wgbh1c, 0 xn--wgbl6a, 0 xn--xhq521b, 0 @@ -8281,6 +8438,7 @@ xn--zf0ao64a.tw, 0 xn--zf0avx.hk, 0 xn--zfr164b, 0 +xnbay.com, 4 xperia, 0 xs4all.space, 4 xxx, 0 @@ -8428,6 +8586,7 @@ zaporizhzhia.ua, 0 zappos, 0 zapto.org, 4 +zapto.xyz, 4 zara, 0 zarow.pl, 0 zentsuji.kagawa.jp, 0 @@ -8442,6 +8601,7 @@ zlg.br, 0 zm, 0 zone, 0 +zone.id, 4 zoological.museum, 0 zoology.museum, 0 zp.gov.pl, 0
diff --git a/net/network_error_logging/network_error_logging_service.cc b/net/network_error_logging/network_error_logging_service.cc index fe4c15d6..b0f7f12 100644 --- a/net/network_error_logging/network_error_logging_service.cc +++ b/net/network_error_logging/network_error_logging_service.cc
@@ -276,12 +276,6 @@ void RemoveBrowsingData(const base::RepeatingCallback<bool(const GURL&)>& origin_filter) override { - if (origin_filter.is_null()) { - wildcard_policies_.clear(); - policies_.clear(); - return; - } - std::vector<url::Origin> origins_to_remove; for (auto it = policies_.begin(); it != policies_.end(); ++it) { @@ -296,6 +290,11 @@ } } + void RemoveAllBrowsingData() override { + wildcard_policies_.clear(); + policies_.clear(); + } + base::Value StatusAsValue() const override { base::Value dict(base::Value::Type::DICTIONARY); std::vector<base::Value> policy_list; @@ -321,6 +320,14 @@ return dict; } + std::set<url::Origin> GetPolicyOriginsForTesting() override { + std::set<url::Origin> origins; + for (const auto& entry : policies_) { + origins.insert(entry.first); + } + return origins; + } + private: // NEL Policy set by an origin. struct OriginPolicy { @@ -592,6 +599,11 @@ return base::Value(); } +std::set<url::Origin> NetworkErrorLoggingService::GetPolicyOriginsForTesting() { + NOTIMPLEMENTED(); + return std::set<url::Origin>(); +} + NetworkErrorLoggingService::NetworkErrorLoggingService() : tick_clock_(base::DefaultTickClock::GetInstance()), reporting_service_(nullptr) {}
diff --git a/net/network_error_logging/network_error_logging_service.h b/net/network_error_logging/network_error_logging_service.h index 2c7892d4..7a8d5df 100644 --- a/net/network_error_logging/network_error_logging_service.h +++ b/net/network_error_logging/network_error_logging_service.h
@@ -109,11 +109,14 @@ virtual void OnRequest(const RequestDetails& details) = 0; // Removes browsing data (origin policies) associated with any origin for - // which |origin_filter| returns true, or for all origins if - // |origin_filter.is_null()|. + // which |origin_filter| returns true. virtual void RemoveBrowsingData( const base::RepeatingCallback<bool(const GURL&)>& origin_filter) = 0; + // Removes browsing data (origin policies) for all origins. Allows slight + // optimization over passing an always-true filter to RemoveBrowsingData. + virtual void RemoveAllBrowsingData() = 0; + // Sets the ReportingService that will be used to queue network error reports. // If |nullptr| is passed, reports will be queued locally or discarded. // |reporting_service| must outlive the NetworkErrorLoggingService. @@ -126,6 +129,8 @@ virtual base::Value StatusAsValue() const; + virtual std::set<url::Origin> GetPolicyOriginsForTesting(); + protected: NetworkErrorLoggingService();
diff --git a/net/network_error_logging/network_error_logging_service_unittest.cc b/net/network_error_logging/network_error_logging_service_unittest.cc index 7a8693a..cdd68e4 100644 --- a/net/network_error_logging/network_error_logging_service_unittest.cc +++ b/net/network_error_logging/network_error_logging_service_unittest.cc
@@ -494,7 +494,7 @@ TEST_F(NetworkErrorLoggingServiceTest, RemoveAllBrowsingData) { service()->OnHeader(kOrigin_, kHeader_); - service()->RemoveBrowsingData(base::RepeatingCallback<bool(const GURL&)>()); + service()->RemoveAllBrowsingData(); service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
diff --git a/net/quic/core/congestion_control/rtt_stats.h b/net/quic/core/congestion_control/rtt_stats.h index 025e38d..6ebaf17 100644 --- a/net/quic/core/congestion_control/rtt_stats.h +++ b/net/quic/core/congestion_control/rtt_stats.h
@@ -81,7 +81,6 @@ } void set_initial_max_ack_delay(QuicTime::Delta initial_max_ack_delay) { - DCHECK(max_ack_delay_.IsZero()); max_ack_delay_ = std::max(max_ack_delay_, initial_max_ack_delay); }
diff --git a/net/socket/tcp_socket_unittest.cc b/net/socket/tcp_socket_unittest.cc index 5b97c310..83c2b96b 100644 --- a/net/socket/tcp_socket_unittest.cc +++ b/net/socket/tcp_socket_unittest.cc
@@ -575,12 +575,16 @@ const int msg_size = strlen(kMsg); ASSERT_EQ(msg_size, write_result); - // Try reading again. ReadIfReady() should still succeed. TestCompletionCallback read_callback2; int read_result = connecting_socket->ReadIfReady( read_buffer.get(), read_buffer->size(), read_callback2.callback()); + if (read_result == ERR_IO_PENDING) { + ASSERT_EQ(OK, read_callback2.GetResult(read_result)); + read_result = connecting_socket->ReadIfReady( + read_buffer.get(), read_buffer->size(), read_callback2.callback()); + } - ASSERT_EQ(msg_size, read_callback2.GetResult(read_result)); + ASSERT_EQ(msg_size, read_result); ASSERT_EQ(0, memcmp(&kMsg, read_buffer->data(), msg_size)); }
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index b3a71959..7102804 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -7608,6 +7608,8 @@ NOTREACHED(); } + void RemoveAllBrowsingData() override { NOTREACHED(); } + private: std::vector<Header> headers_; std::vector<RequestDetails> errors_;
diff --git a/pdf/pdfium/fuzzers/BUILD.gn b/pdf/pdfium/fuzzers/BUILD.gn index 98062af..1c325d1b 100644 --- a/pdf/pdfium/fuzzers/BUILD.gn +++ b/pdf/pdfium/fuzzers/BUILD.gn
@@ -31,11 +31,7 @@ if (pdf_enable_xfa) { deps += [ ":pdf_cfx_barcode_fuzzer", - ":pdf_codec_bmp_fuzzer", - ":pdf_codec_gif_fuzzer", ":pdf_codec_jpeg_fuzzer", - ":pdf_codec_png_fuzzer", - ":pdf_codec_tiff_fuzzer", ":pdf_css_fuzzer", ":pdf_fm2js_fuzzer", ":pdf_formcalc_fuzzer", @@ -43,6 +39,18 @@ ":pdf_xml_fuzzer", ":pdfium_xfa_fuzzer", ] + if (pdf_enable_xfa_bmp) { + deps += [ ":pdf_codec_bmp_fuzzer" ] + } + if (pdf_enable_xfa_gif) { + deps += [ ":pdf_codec_gif_fuzzer" ] + } + if (pdf_enable_xfa_png) { + deps += [ ":pdf_codec_png_fuzzer" ] + } + if (pdf_enable_xfa_tiff) { + deps += [ ":pdf_codec_tiff_fuzzer" ] + } } } @@ -146,21 +154,25 @@ } if (pdf_enable_xfa) { - fuzzer_test("pdf_codec_bmp_fuzzer") { - sources = [] - deps = [ - "//third_party/pdfium/testing/libfuzzer:pdf_codec_bmp_fuzzer", - ] - seed_corpus = "corpora/pdf_codec_bmp" + if (pdf_enable_xfa_bmp) { + fuzzer_test("pdf_codec_bmp_fuzzer") { + sources = [] + deps = [ + "//third_party/pdfium/testing/libfuzzer:pdf_codec_bmp_fuzzer", + ] + seed_corpus = "corpora/pdf_codec_bmp" + } } - fuzzer_test("pdf_codec_gif_fuzzer") { - sources = [] - deps = [ - "//third_party/pdfium/testing/libfuzzer:pdf_codec_gif_fuzzer", - ] - dict = "dicts/pdf_codec_gif.dict" - seed_corpus = "corpora/pdf_codec_gif" + if (pdf_enable_xfa_gif) { + fuzzer_test("pdf_codec_gif_fuzzer") { + sources = [] + deps = [ + "//third_party/pdfium/testing/libfuzzer:pdf_codec_gif_fuzzer", + ] + dict = "dicts/pdf_codec_gif.dict" + seed_corpus = "corpora/pdf_codec_gif" + } } fuzzer_test("pdf_codec_jpeg_fuzzer") { @@ -172,27 +184,31 @@ seed_corpus = "corpora/pdf_codec_jpeg" } - fuzzer_test("pdf_codec_png_fuzzer") { - sources = [] - deps = [ - "//third_party/pdfium/testing/libfuzzer:pdf_codec_png_fuzzer", - ] - dict = "dicts/pdf_codec_png.dict" - seed_corpuses = [ - "corpora/pdf_codec_png", - "//components/viz/test/data", - "//third_party/WebKit/LayoutTests/images/png-suite/samples", - "//third_party/WebKit/LayoutTests/images/resources/pngfuzz", - ] + if (pdf_enable_xfa_png) { + fuzzer_test("pdf_codec_png_fuzzer") { + sources = [] + deps = [ + "//third_party/pdfium/testing/libfuzzer:pdf_codec_png_fuzzer", + ] + dict = "dicts/pdf_codec_png.dict" + seed_corpuses = [ + "corpora/pdf_codec_png", + "//components/viz/test/data", + "//third_party/WebKit/LayoutTests/images/png-suite/samples", + "//third_party/WebKit/LayoutTests/images/resources/pngfuzz", + ] + } } - fuzzer_test("pdf_codec_tiff_fuzzer") { - sources = [] - deps = [ - "//third_party/pdfium/testing/libfuzzer:pdf_codec_tiff_fuzzer", - ] - dict = "dicts/pdf_codec_tiff.dict" - seed_corpus = "corpora/pdf_codec_tiff" + if (pdf_enable_xfa_tiff) { + fuzzer_test("pdf_codec_tiff_fuzzer") { + sources = [] + deps = [ + "//third_party/pdfium/testing/libfuzzer:pdf_codec_tiff_fuzzer", + ] + dict = "dicts/pdf_codec_tiff.dict" + seed_corpus = "corpora/pdf_codec_tiff" + } } fuzzer_test("pdf_css_fuzzer") {
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index f0d7dbf8d..8545d73 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -77,6 +77,7 @@ #if BUILDFLAG(ENABLE_REPORTING) #include "net/base/registry_controlled_domains/registry_controlled_domain.h" +#include "net/network_error_logging/network_error_logging_service.h" #include "net/reporting/reporting_browsing_data_remover.h" #include "net/reporting/reporting_policy.h" #include "net/reporting/reporting_service.h" @@ -762,6 +763,22 @@ std::move(callback).Run(); } + +void NetworkContext::ClearNetworkErrorLogging( + mojom::ClearDataFilterPtr filter, + ClearNetworkErrorLoggingCallback callback) { + net::NetworkErrorLoggingService* logging_service = + url_request_context_->network_error_logging_service(); + if (logging_service) { + if (filter) { + logging_service->RemoveBrowsingData(BuildUrlFilter(std::move(filter))); + } else { + logging_service->RemoveAllBrowsingData(); + } + } + + std::move(callback).Run(); +} #else // BUILDFLAG(ENABLE_REPORTING) void NetworkContext::ClearReportingCacheReports( mojom::ClearDataFilterPtr filter, @@ -774,6 +791,12 @@ ClearReportingCacheClientsCallback callback) { NOTREACHED(); } + +void NetworkContext::ClearNetworkErrorLogging( + mojom::ClearDataFilterPtr filter, + ClearNetworkErrorLoggingCallback callback) { + NOTREACHED(); +} #endif // BUILDFLAG(ENABLE_REPORTING) void NetworkContext::SetNetworkConditions(
diff --git a/services/network/network_context.h b/services/network/network_context.h index 02d19a5..a653987a 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h
@@ -134,6 +134,9 @@ void ClearReportingCacheClients( mojom::ClearDataFilterPtr filter, ClearReportingCacheClientsCallback callback) override; + void ClearNetworkErrorLogging( + mojom::ClearDataFilterPtr filter, + ClearNetworkErrorLoggingCallback callback) override; void SetNetworkConditions(const std::string& profile_id, mojom::NetworkConditionsPtr conditions) override; void SetAcceptLanguage(const std::string& new_accept_language) override;
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index 3e36ac3..e85bbc5 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -76,6 +76,7 @@ #include "url/url_constants.h" #if BUILDFLAG(ENABLE_REPORTING) +#include "net/network_error_logging/network_error_logging_service.h" #include "net/reporting/reporting_cache.h" #include "net/reporting/reporting_report.h" #include "net/reporting/reporting_service.h" @@ -1267,6 +1268,98 @@ run_loop.QuitClosure()); run_loop.Run(); } + +TEST_F(NetworkContextTest, ClearNetworkErrorLogging) { + base::test::ScopedFeatureList scoped_feature_list_; + scoped_feature_list_.InitAndEnableFeature(features::kNetworkErrorLogging); + std::unique_ptr<NetworkContext> network_context = + CreateContextWithParams(CreateContextParams()); + + net::NetworkErrorLoggingService* logging_service = + network_context->url_request_context()->network_error_logging_service(); + ASSERT_TRUE(logging_service); + + GURL domain("https://google.com"); + logging_service->OnHeader(url::Origin::Create(domain), + "{\"report-to\":\"group\",\"max-age\":86400}"); + + ASSERT_EQ(1u, logging_service->GetPolicyOriginsForTesting().size()); + + base::RunLoop run_loop; + network_context->ClearNetworkErrorLogging(nullptr /* filter */, + run_loop.QuitClosure()); + run_loop.Run(); + + EXPECT_TRUE(logging_service->GetPolicyOriginsForTesting().empty()); +} + +TEST_F(NetworkContextTest, ClearNetworkErrorLoggingWithFilter) { + base::test::ScopedFeatureList scoped_feature_list_; + scoped_feature_list_.InitAndEnableFeature(features::kNetworkErrorLogging); + std::unique_ptr<NetworkContext> network_context = + CreateContextWithParams(CreateContextParams()); + + net::NetworkErrorLoggingService* logging_service = + network_context->url_request_context()->network_error_logging_service(); + ASSERT_TRUE(logging_service); + + GURL domain1("https://google.com"); + logging_service->OnHeader(url::Origin::Create(domain1), + "{\"report-to\":\"group\",\"max-age\":86400}"); + GURL domain2("https://chromium.org"); + logging_service->OnHeader(url::Origin::Create(domain2), + "{\"report-to\":\"group\",\"max-age\":86400}"); + + ASSERT_EQ(2u, logging_service->GetPolicyOriginsForTesting().size()); + + mojom::ClearDataFilterPtr filter = mojom::ClearDataFilter::New(); + filter->type = mojom::ClearDataFilter_Type::KEEP_MATCHES; + filter->domains.push_back("chromium.org"); + + base::RunLoop run_loop; + network_context->ClearNetworkErrorLogging(std::move(filter), + run_loop.QuitClosure()); + run_loop.Run(); + + std::set<url::Origin> policy_origins = + logging_service->GetPolicyOriginsForTesting(); + EXPECT_EQ(1u, policy_origins.size()); + EXPECT_NE(policy_origins.end(), + policy_origins.find(url::Origin::Create(domain2))); +} + +TEST_F(NetworkContextTest, ClearEmptyNetworkErrorLogging) { + base::test::ScopedFeatureList scoped_feature_list_; + scoped_feature_list_.InitAndEnableFeature(features::kNetworkErrorLogging); + std::unique_ptr<NetworkContext> network_context = + CreateContextWithParams(CreateContextParams()); + + net::NetworkErrorLoggingService* logging_service = + network_context->url_request_context()->network_error_logging_service(); + ASSERT_TRUE(logging_service); + + ASSERT_TRUE(logging_service->GetPolicyOriginsForTesting().empty()); + + base::RunLoop run_loop; + network_context->ClearNetworkErrorLogging(nullptr /* filter */, + run_loop.QuitClosure()); + run_loop.Run(); + + EXPECT_TRUE(logging_service->GetPolicyOriginsForTesting().empty()); +} + +TEST_F(NetworkContextTest, ClearEmptyNetworkErrorLoggingWithNoService) { + std::unique_ptr<NetworkContext> network_context = + CreateContextWithParams(CreateContextParams()); + + ASSERT_FALSE( + network_context->url_request_context()->network_error_logging_service()); + + base::RunLoop run_loop; + network_context->ClearNetworkErrorLogging(nullptr /* filter */, + run_loop.QuitClosure()); + run_loop.Run(); +} #endif // BUILDFLAG(ENABLE_REPORTING) void SetCookieCallback(base::RunLoop* run_loop, bool* result_out, bool result) {
diff --git a/services/network/proxy_resolving_client_socket.cc b/services/network/proxy_resolving_client_socket.cc index eb0701e9..bec21dc9 100644 --- a/services/network/proxy_resolving_client_socket.cc +++ b/services/network/proxy_resolving_client_socket.cc
@@ -86,6 +86,7 @@ int ProxyResolvingClientSocket::Connect(net::CompletionOnceCallback callback) { DCHECK(user_connect_callback_.is_null()); + DCHECK(!socket_handle_->socket()); next_state_ = STATE_PROXY_RESOLVE; int result = DoLoop(net::OK);
diff --git a/services/network/public/mojom/network_service.mojom b/services/network/public/mojom/network_service.mojom index 72b64f0..f151fdf0 100644 --- a/services/network/public/mojom/network_service.mojom +++ b/services/network/public/mojom/network_service.mojom
@@ -304,6 +304,13 @@ // filter. ClearReportingCacheClients(ClearDataFilter? filter) => (); + // Clears policy entries from the NetworkErrorLoggingService. Should not be + // called if the ENABLE_REPORTING build flag is false. + // + // If a non-null |filter| is specified, will clear only entries matching the + // filter. + ClearNetworkErrorLogging(ClearDataFilter? filter) => (); + // Configures network conditions for the specified throttling profile. // The throttling will be applied only to requests that have // X-DevTools-Emulate-Network-Conditions-Client-Id: <profile_id>
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h index a55b4489..0c3a302 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h
@@ -59,6 +59,9 @@ void ClearReportingCacheClients( mojom::ClearDataFilterPtr filter, ClearReportingCacheClientsCallback callback) override {} + void ClearNetworkErrorLogging( + mojom::ClearDataFilterPtr filter, + ClearNetworkErrorLoggingCallback callback) override {} void SetNetworkConditions(const std::string& profile_id, mojom::NetworkConditionsPtr conditions) override {} void SetAcceptLanguage(const std::string& new_accept_language) override {}
diff --git a/services/ui/ws2/BUILD.gn b/services/ui/ws2/BUILD.gn index f3a792a7..aa8267e 100644 --- a/services/ui/ws2/BUILD.gn +++ b/services/ui/ws2/BUILD.gn
@@ -116,6 +116,7 @@ "//mojo/public/cpp/bindings", "//services/service_manager/public/cpp:service_test_support", "//services/service_manager/public/mojom", + "//services/ui/public/cpp", "//services/ui/public/interfaces", "//testing/gtest", "//third_party/mesa:osmesa",
diff --git a/services/ui/ws2/window_service.h b/services/ui/ws2/window_service.h index ed4e72bf..e05326bf 100644 --- a/services/ui/ws2/window_service.h +++ b/services/ui/ws2/window_service.h
@@ -16,6 +16,7 @@ #include "services/ui/public/interfaces/ime/ime.mojom.h" #include "services/ui/public/interfaces/window_tree.mojom.h" #include "services/ui/ws2/ids.h" +#include "ui/aura/mus/property_converter.h" namespace aura { class Window; @@ -58,6 +59,8 @@ WindowServiceDelegate* delegate() { return delegate_; } + aura::PropertyConverter* property_converter() { return &property_converter_; } + // service_manager::Service: void OnStart() override; void OnBindInterface(const service_manager::BindSourceInfo& remote_info, @@ -80,6 +83,9 @@ std::unique_ptr<WindowTreeFactory> window_tree_factory_; + // Helper used to serialize and deserialize window properties. + aura::PropertyConverter property_converter_; + // Id for the next WindowServiceClient. ClientSpecificId next_client_id_ = kWindowServerClientId + 1;
diff --git a/services/ui/ws2/window_service_client.cc b/services/ui/ws2/window_service_client.cc index 1dc7efe..4304bbf 100644 --- a/services/ui/ws2/window_service_client.cc +++ b/services/ui/ws2/window_service_client.cc
@@ -18,6 +18,7 @@ #include "services/ui/ws2/window_service_delegate.h" #include "ui/aura/client/transient_window_client.h" #include "ui/aura/env.h" +#include "ui/aura/mus/property_converter.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" #include "ui/compositor/layer.h" @@ -330,7 +331,7 @@ : kInvalidTransportId; client_window->bounds = window->bounds(); - // TODO: use property mapping. + // TODO(crbug.com/837695): Include the window properties. client_window->visible = window->TargetVisibility(); return client_window; } @@ -368,6 +369,7 @@ window->Init(LAYER_NOT_DRAWN); // Windows created by the client should only be destroyed by the client. window->set_owned_by_parent(false); + // TODO(crbug.com/837695): Apply |properties|. return true; } @@ -476,6 +478,31 @@ return false; } +bool WindowServiceClient::SetWindowPropertyImpl( + const ClientWindowId& window_id, + const std::string& name, + const base::Optional<std::vector<uint8_t>>& value) { + aura::Window* window = GetWindowByClientId(window_id); + DVLOG(3) << "SetWindowProperty client=" << client_id_ + << " client window_id= " << window_id.ToString(); + if (!window) { + DVLOG(1) << "SetWindowProperty failed (no window)"; + return false; + } + DCHECK(window_service_->property_converter()->IsTransportNameRegistered(name)) + << "Attempting to set an unrgistered property; this is not implemented."; + if (IsClientCreatedWindow(window) || IsClientRootWindow(window)) { + std::unique_ptr<std::vector<uint8_t>> data; + if (value.has_value()) + data = std::make_unique<std::vector<uint8_t>>(value.value()); + window_service_->property_converter()->SetPropertyFromTransportValue( + window, name, data.get()); + return true; + } + DVLOG(1) << "SetWindowProperty failed (access policy denied change)"; + return false; +} + bool WindowServiceClient::SetWindowOpacityImpl(const ClientWindowId& window_id, float opacity) { aura::Window* window = GetWindowByClientId(window_id); @@ -632,7 +659,7 @@ Id transport_window_id, const base::Optional<base::flat_map<std::string, std::vector<uint8_t>>>& transport_properties) { - // TODO: needs to map and validate |transport_properties|. + // TODO(crbug.com/837695): Map and validate |transport_properties|. std::map<std::string, std::vector<uint8_t>> properties; window_tree_client_->OnChangeCompleted( @@ -752,7 +779,9 @@ Id window_id, const std::string& name, const base::Optional<std::vector<uint8_t>>& value) { - NOTIMPLEMENTED(); + window_tree_client_->OnChangeCompleted( + change_id, + SetWindowPropertyImpl(MakeClientWindowId(window_id), name, value)); } void WindowServiceClient::SetWindowOpacity(uint32_t change_id,
diff --git a/services/ui/ws2/window_service_client.h b/services/ui/ws2/window_service_client.h index dc073f6..cfb1447 100644 --- a/services/ui/ws2/window_service_client.h +++ b/services/ui/ws2/window_service_client.h
@@ -172,6 +172,9 @@ const ClientWindowId& child_id); bool RemoveWindowFromParentImpl(const ClientWindowId& client_window_id); bool SetWindowVisibilityImpl(const ClientWindowId& window_id, bool visible); + bool SetWindowPropertyImpl(const ClientWindowId& window_id, + const std::string& name, + const base::Optional<std::vector<uint8_t>>& value); bool EmbedImpl(const ClientWindowId& window_id, mojom::WindowTreeClientPtr window_tree_client, uint32_t flags);
diff --git a/services/ui/ws2/window_service_client_test_helper.cc b/services/ui/ws2/window_service_client_test_helper.cc index 96935a9..b7a03f06 100644 --- a/services/ui/ws2/window_service_client_test_helper.cc +++ b/services/ui/ws2/window_service_client_test_helper.cc
@@ -34,5 +34,15 @@ local_surface_id); } +void WindowServiceClientTestHelper::SetWindowProperty( + aura::Window* window, + const std::string& name, + const std::vector<uint8_t>& value, + uint32_t change_id) { + window_service_client_->SetWindowProperty( + change_id, window_service_client_->TransportIdForWindow(window), name, + value); +} + } // namespace ws2 } // namespace ui
diff --git a/services/ui/ws2/window_service_client_test_helper.h b/services/ui/ws2/window_service_client_test_helper.h index 4fa5f7c..9a6b71c 100644 --- a/services/ui/ws2/window_service_client_test_helper.h +++ b/services/ui/ws2/window_service_client_test_helper.h
@@ -32,6 +32,10 @@ void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds, uint32_t change_id = 1); + void SetWindowProperty(aura::Window* window, + const std::string& name, + const std::vector<uint8_t>& value, + uint32_t change_id = 1); private: WindowServiceClient* window_service_client_;
diff --git a/services/ui/ws2/window_service_client_unittest.cc b/services/ui/ws2/window_service_client_unittest.cc index 4112c45..984c152 100644 --- a/services/ui/ws2/window_service_client_unittest.cc +++ b/services/ui/ws2/window_service_client_unittest.cc
@@ -10,12 +10,15 @@ #include <memory> #include "base/test/scoped_task_environment.h" +#include "services/ui/public/cpp/property_type_converters.h" +#include "services/ui/public/interfaces/window_manager.mojom.h" #include "services/ui/ws2/gpu_support.h" #include "services/ui/ws2/test_window_service_delegate.h" #include "services/ui/ws2/test_window_tree_client.h" #include "services/ui/ws2/window_service.h" #include "services/ui/ws2/window_service_client_test_helper.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/aura/client/aura_constants.h" #include "ui/aura/layout_manager.h" #include "ui/aura/test/aura_test_helper.h" #include "ui/aura/window.h" @@ -30,23 +33,36 @@ class WindowServiceTestHelper { public: WindowServiceTestHelper() { + if (gl::GetGLImplementation() == gl::kGLImplementationNone) + gl::GLSurfaceTestSupport::InitializeOneOff(); + ui::ContextFactory* context_factory = nullptr; ui::ContextFactoryPrivate* context_factory_private = nullptr; const bool enable_pixel_output = false; - gl::GLSurfaceTestSupport::InitializeOneOff(); ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, &context_factory_private); aura_test_helper_.SetUp(context_factory, context_factory_private); service_ = std::make_unique<WindowService>(&delegate_, nullptr); - delegate_.set_top_level_parent(root()); + delegate_.set_top_level_parent(aura_test_helper_.root_window()); + + const bool intercepts_events = false; + window_service_client_ = service_->CreateWindowServiceClient( + &window_tree_client_, intercepts_events); + window_service_client_->InitFromFactory(); + helper_ = std::make_unique<WindowServiceClientTestHelper>( + window_service_client_.get()); } + ~WindowServiceTestHelper() { aura_test_helper_.TearDown(); ui::TerminateContextFactoryForTests(); } - WindowService* service() { return service_.get(); } - aura::Window* root() { return aura_test_helper_.root_window(); } + std::vector<Change>* changes() { + return window_tree_client_.tracker()->changes(); + } + + std::unique_ptr<WindowServiceClientTestHelper> helper_; private: base::test::ScopedTaskEnvironment task_environment_{ @@ -54,6 +70,8 @@ aura::test::AuraTestHelper aura_test_helper_; TestWindowServiceDelegate delegate_; std::unique_ptr<WindowService> service_; + TestWindowTreeClient window_tree_client_; + std::unique_ptr<WindowServiceClient> window_service_client_; DISALLOW_COPY_AND_ASSIGN(WindowServiceTestHelper); }; @@ -88,38 +106,34 @@ DISALLOW_COPY_AND_ASSIGN(TestLayoutManager); }; -TEST(WindowServiceClientTest, SetBounds) { +TEST(WindowServiceClientTest, CreateTopLevel) { WindowServiceTestHelper helper; - TestWindowTreeClient window_tree_client; - const bool intercepts_events = false; - std::unique_ptr<WindowServiceClient> window_service_client = - helper.service()->CreateWindowServiceClient(&window_tree_client, - intercepts_events); - window_service_client->InitFromFactory(); - std::vector<Change>* changes = window_tree_client.tracker()->changes(); - EXPECT_TRUE(changes->empty()); - WindowServiceClientTestHelper window_service_client_helper( - window_service_client.get()); - aura::Window* top_level = window_service_client_helper.NewTopLevelWindow(1); + EXPECT_TRUE(helper.changes()->empty()); + aura::Window* top_level = helper.helper_->NewTopLevelWindow(1); ASSERT_TRUE(top_level); EXPECT_EQ("TopLevelCreated id=1 window_id=0,1 drawn=false", - SingleChangeToDescription(*changes)); - changes->clear(); + SingleChangeToDescription(*helper.changes())); + helper.changes()->clear(); +} + +TEST(WindowServiceClientTest, SetBounds) { + WindowServiceTestHelper helper; + aura::Window* top_level = helper.helper_->NewTopLevelWindow(1); + helper.changes()->clear(); const gfx::Rect bounds_from_client = gfx::Rect(1, 2, 300, 400); - window_service_client_helper.SetWindowBounds(top_level, bounds_from_client, - 2); + helper.helper_->SetWindowBounds(top_level, bounds_from_client, 2); EXPECT_EQ(bounds_from_client, top_level->bounds()); EXPECT_EQ("ChangeCompleted id=2 sucess=true", - SingleChangeToDescription(*changes)); - changes->clear(); + SingleChangeToDescription(*helper.changes())); + helper.changes()->clear(); const gfx::Rect bounds_from_server = gfx::Rect(101, 102, 103, 104); top_level->SetBounds(bounds_from_server); - ASSERT_EQ(1u, changes->size()); - EXPECT_EQ(CHANGE_TYPE_NODE_BOUNDS_CHANGED, (*changes)[0].type); - EXPECT_EQ(bounds_from_server, (*changes)[0].bounds2); - changes->clear(); + ASSERT_EQ(1u, helper.changes()->size()); + EXPECT_EQ(CHANGE_TYPE_NODE_BOUNDS_CHANGED, (*helper.changes())[0].type); + EXPECT_EQ(bounds_from_server, (*helper.changes())[0].bounds2); + helper.changes()->clear(); // Set a LayoutManager so that when the client requests a bounds change the // window is resized to a different bounds. @@ -128,19 +142,34 @@ const gfx::Rect restricted_bounds = gfx::Rect(401, 405, 406, 407); layout_manager->set_next_bounds(restricted_bounds); top_level->parent()->SetLayoutManager(layout_manager); - window_service_client_helper.SetWindowBounds(top_level, bounds_from_client, - 3); - ASSERT_EQ(2u, changes->size()); + helper.helper_->SetWindowBounds(top_level, bounds_from_client, 3); + ASSERT_EQ(2u, helper.changes()->size()); // The layout manager changes the bounds to a different value than the client // requested, so the client should get OnWindowBoundsChanged() with // |restricted_bounds|. - EXPECT_EQ(CHANGE_TYPE_NODE_BOUNDS_CHANGED, (*changes)[0].type); - EXPECT_EQ(restricted_bounds, (*changes)[0].bounds2); + EXPECT_EQ(CHANGE_TYPE_NODE_BOUNDS_CHANGED, (*helper.changes())[0].type); + EXPECT_EQ(restricted_bounds, (*helper.changes())[0].bounds2); // And because the layout manager changed the bounds the result is false. EXPECT_EQ("ChangeCompleted id=3 sucess=false", - ChangeToDescription((*changes)[1])); - changes->clear(); + ChangeToDescription((*helper.changes())[1])); + helper.changes()->clear(); +} + +TEST(WindowServiceClientTest, SetProperty) { + WindowServiceTestHelper helper; + aura::Window* top_level = helper.helper_->NewTopLevelWindow(1); + helper.changes()->clear(); + + EXPECT_FALSE(top_level->GetProperty(aura::client::kAlwaysOnTopKey)); + aura::PropertyConverter::PrimitiveType value = true; + std::vector<uint8_t> transport = mojo::ConvertTo<std::vector<uint8_t>>(value); + helper.helper_->SetWindowProperty( + top_level, ui::mojom::WindowManager::kAlwaysOnTop_Property, transport, 2); + EXPECT_EQ("ChangeCompleted id=2 sucess=true", + SingleChangeToDescription(*helper.changes())); + EXPECT_TRUE(top_level->GetProperty(aura::client::kAlwaysOnTopKey)); + helper.changes()->clear(); } } // namespace
diff --git a/skia/BUILD.gn b/skia/BUILD.gn index f45a941..56d04e92 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn
@@ -149,10 +149,7 @@ # TODO: remove after Skia shader relocation (https://skia-review.googlesource.com/c/17927) include_dirs += [ "//third_party/skia/src/effects/gradients" ] - defines = [ - "SK_USE_SKCMS", - "SK_IGNORE_MASK_FILTER_GLYPH_FIX", - ] + defines = [ "SK_USE_SKCMS" ] if (!is_ios && !use_system_freetype) { defines += [ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR) * 0x01000000) | ((FREETYPE_MINOR) * 0x00010000) | ((FREETYPE_PATCH) * 0x00000100))" ]
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 77a38b1..276ac70 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -203,13 +203,6 @@ #define SK_SUPPORT_LEGACY_TILED_BITMAPS #endif -// cc_unittests LayerTreeHostFiltersPixelTest.BackgroundFilterBlurOutsets fail -// with the Skia blur imagefilter bug-fix. They need to be updated at the -// same time this flag is removed. -#ifndef SK_IGNORE_BLUR_IMAGE_FILTER_FIX -#define SK_IGNORE_BLUR_IMAGE_FILTER_FIX -#endif - // remove after rebaselining svg layout tests #ifndef SK_SUPPORT_LEGACY_SVG_ARC_TO #define SK_SUPPORT_LEGACY_SVG_ARC_TO
diff --git a/testing/buildbot/OWNERS b/testing/buildbot/OWNERS index 23b6c77..13b16bd0 100644 --- a/testing/buildbot/OWNERS +++ b/testing/buildbot/OWNERS
@@ -1,6 +1,7 @@ # This is reserved for people that are comfortably with buildbot recipes # and understand the implications of changing these files. +bpastene@chromium.org dpranke@chromium.org jam@chromium.org jbudorick@chromium.org
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 1b42861..acfbb32a 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -12516,6 +12516,691 @@ } ] }, + "Win10 FYI Exp Release (Intel HD 630)": { + "gtest_tests": [ + { + "args": [ + "--use-gpu-in-tests", + "--test-launcher-retry-limit=0" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "angle_end2end_tests", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "angle_gles1_conformance_tests", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests", + "--test-launcher-retry-limit=0" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "angle_unittests", + "use_xvfb": false + }, + { + "args": [ + "--test-launcher-retry-limit=0" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "angle_white_box_tests", + "use_xvfb": false + }, + { + "args": [ + "--enable-gpu", + "--test-launcher-bot-mode", + "--test-launcher-jobs=1", + "--gtest_filter=CastStreamingApiTestWithPixelOutput.EndToEnd*:TabCaptureApiPixelTest.EndToEnd*" + ], + "name": "tab_capture_end2end_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "browser_tests", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests", + "--use-cmd-decoder=validating" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gl_tests", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests", + "--use-cmd-decoder=passthrough" + ], + "name": "gl_tests_passthrough", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gl_tests", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gl_unittests", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests", + "--use-angle=d3d9" + ], + "name": "gles2_conform_d3d9_test", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gles2_conform_test", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests", + "--use-angle=gl", + "--disable-gpu-sandbox" + ], + "name": "gles2_conform_gl_test", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gles2_conform_test", + "use_xvfb": false + }, + { + "args": [ + "--use-gpu-in-tests" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gles2_conform_test", + "use_xvfb": false + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "gpu_unittests", + "use_xvfb": false + }, + { + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "swiftshader_unittests", + "use_xvfb": false + }, + { + "args": [ + "--use-angle=d3d11", + "--use-test-data-path", + "--test_video_data=test-25fps.h264:320:240:250:258:::1" + ], + "name": "video_decode_accelerator_d3d11_unittest", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "video_decode_accelerator_unittest", + "use_xvfb": false + }, + { + "args": [ + "--use-angle=d3d9", + "--use-test-data-path", + "--test_video_data=test-25fps.h264:320:240:250:258:::1" + ], + "name": "video_decode_accelerator_d3d9_unittest", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "video_decode_accelerator_unittest", + "use_xvfb": false + } + ], + "isolated_scripts": [ + { + "args": [ + "context_lost", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "context_lost_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "depth_capture", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "depth_capture_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "gpu_process", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "gpu_process_launch_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "hardware_accelerated_feature", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "hardware_accelerated_feature_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "info_collection", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--expected-vendor-id", + "8086", + "--expected-device-id", + "5912" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "info_collection_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "maps", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--dont-restore-color-profile-after-test", + "--os-type", + "win", + "--build-revision", + "${got_revision}", + "--test-machine-name", + "${buildername}" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "maps_pixel_test", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "pixel", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--dont-restore-color-profile-after-test", + "--refimg-cloud-storage-bucket", + "chromium-gpu-archive/reference-images", + "--os-type", + "win", + "--build-revision", + "${got_revision}", + "--test-machine-name", + "${buildername}" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "pixel_test", + "non_precommit_args": [ + "--upload-refimg-to-cloud-storage" + ], + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "precommit_args": [ + "--download-refimg-from-cloud-storage" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "screenshot_sync", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", + "--dont-restore-color-profile-after-test" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "screenshot_sync_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "trace_test", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "trace_test", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=validating", + "--webgl-conformance-version=2.0.1", + "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl2_conformance_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "shards": 20 + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-angle=d3d11 --use-cmd-decoder=passthrough" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl_conformance_d3d11_passthrough_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "shards": 2 + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-angle=d3d9 --use-cmd-decoder=passthrough" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl_conformance_d3d9_passthrough_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "shards": 2 + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-angle=d3d9 --use-cmd-decoder=validating" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl_conformance_d3d9_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "shards": 2 + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl_conformance_gl_passthrough_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "shards": 2 + } + }, + { + "args": [ + "webgl_conformance", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=validating" + ], + "isolate_name": "telemetry_gpu_integration_test", + "name": "webgl_conformance_tests", + "override_compile_targets": [ + "telemetry_gpu_integration_test" + ], + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:5912-24.20.100.6025", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ], + "shards": 2 + } + } + ] + }, "Win10 FYI Exp Release (NVIDIA)": { "gtest_tests": [], "isolated_scripts": [
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index e3a2916..3ae26ba 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -3968,6 +3968,10 @@ } }, { + "args": [ + "--xvfb", + "--jobs=1" + ], "isolate_name": "telemetry_perf_unittests", "name": "telemetry_perf_unittests", "swarming": {
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index eca58f87..fa048abe 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -19,9 +19,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -48,9 +48,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -79,9 +79,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -108,9 +108,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -139,9 +139,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -168,9 +168,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -199,9 +199,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -228,9 +228,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -259,9 +259,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -288,9 +288,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -319,9 +319,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -348,9 +348,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -379,9 +379,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -408,9 +408,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -439,9 +439,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -468,9 +468,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -499,9 +499,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -528,9 +528,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -559,9 +559,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -588,9 +588,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -619,9 +619,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -648,9 +648,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device7", + "id": "build199-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -679,9 +679,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device7", + "id": "build199-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -708,9 +708,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -739,9 +739,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -759,9 +759,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -788,9 +788,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -819,9 +819,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -848,9 +848,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -879,9 +879,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -908,9 +908,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -939,9 +939,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -968,9 +968,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -999,9 +999,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1019,9 +1019,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device2", + "id": "build199-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1048,9 +1048,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1079,9 +1079,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1108,9 +1108,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1139,9 +1139,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1168,9 +1168,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device1", + "id": "build201-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1197,9 +1197,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device1", + "id": "build201-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1228,9 +1228,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device1", + "id": "build201-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1257,9 +1257,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1288,9 +1288,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1317,9 +1317,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device7", + "id": "build200-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1348,9 +1348,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device7", + "id": "build200-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1377,9 +1377,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1408,9 +1408,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1437,9 +1437,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1468,9 +1468,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1497,9 +1497,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1528,9 +1528,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1557,9 +1557,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device7", + "id": "build199-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1586,9 +1586,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1617,9 +1617,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1646,9 +1646,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1677,9 +1677,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1706,9 +1706,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1737,9 +1737,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1766,9 +1766,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1797,9 +1797,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1826,9 +1826,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1857,9 +1857,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1886,9 +1886,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1917,9 +1917,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1946,9 +1946,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -1977,9 +1977,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2006,9 +2006,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2037,9 +2037,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2066,9 +2066,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2097,9 +2097,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2126,9 +2126,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2157,9 +2157,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2186,9 +2186,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2217,9 +2217,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2246,9 +2246,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device7", + "id": "build199-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2277,9 +2277,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device7", + "id": "build199-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2306,9 +2306,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2337,9 +2337,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2366,9 +2366,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2397,9 +2397,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2426,9 +2426,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device2", + "id": "build199-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2457,9 +2457,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device2", + "id": "build199-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2486,9 +2486,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2517,9 +2517,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2546,9 +2546,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2577,9 +2577,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2606,9 +2606,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device2", + "id": "build199-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2637,9 +2637,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device2", + "id": "build199-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2666,9 +2666,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device3", + "id": "build201-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2697,9 +2697,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device3", + "id": "build201-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2726,9 +2726,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2757,9 +2757,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2786,9 +2786,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2817,9 +2817,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device2", + "id": "build201-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2846,9 +2846,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2877,9 +2877,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2906,9 +2906,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2937,9 +2937,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2966,9 +2966,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -2997,9 +2997,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3026,9 +3026,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3057,9 +3057,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3086,9 +3086,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device7", + "id": "build201-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3117,9 +3117,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device7", + "id": "build201-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3146,9 +3146,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3177,9 +3177,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device3", + "id": "build200-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3206,9 +3206,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device7", + "id": "build201-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3237,9 +3237,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device7", + "id": "build201-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3266,9 +3266,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3297,9 +3297,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3326,9 +3326,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device1", + "id": "build201-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3357,9 +3357,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device1", + "id": "build201-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3386,9 +3386,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3417,9 +3417,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3446,9 +3446,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3475,9 +3475,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device4", + "id": "build199-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3506,9 +3506,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device4", + "id": "build199-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3537,9 +3537,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3566,9 +3566,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3595,9 +3595,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device4", + "id": "build199-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3626,9 +3626,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device4", + "id": "build199-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3657,9 +3657,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device2", + "id": "build200-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3686,9 +3686,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3717,9 +3717,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device4", + "id": "build200-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3746,9 +3746,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3777,9 +3777,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device5", + "id": "build201-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3795,7 +3795,7 @@ "-v", "--upload-results", "--browser=android-chromium", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_mobile", @@ -3806,9 +3806,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device7", + "id": "build200-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3824,7 +3824,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -3837,9 +3837,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device7", + "id": "build200-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3855,7 +3855,7 @@ "-v", "--upload-results", "--browser=android-chromium", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_mobile", @@ -3866,9 +3866,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device1", + "id": "build199-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3884,7 +3884,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -3897,9 +3897,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device1", + "id": "build199-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3926,9 +3926,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3957,9 +3957,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -3986,9 +3986,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4017,9 +4017,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device1", + "id": "build200-b7--device1", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4046,9 +4046,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4077,9 +4077,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4106,9 +4106,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4137,9 +4137,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device6", + "id": "build200-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4166,9 +4166,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4197,9 +4197,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device4", + "id": "build201-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4226,9 +4226,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4257,9 +4257,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build14-b1--device5", + "id": "build200-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4286,9 +4286,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device3", + "id": "build201-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4317,9 +4317,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device3", + "id": "build201-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4346,9 +4346,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device3", + "id": "build201-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4377,9 +4377,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device3", + "id": "build201-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4406,9 +4406,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4437,9 +4437,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device6", + "id": "build201-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4457,9 +4457,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device2", + "id": "build199-b7--device2", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4486,9 +4486,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device5", + "id": "build199-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4515,9 +4515,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device4", + "id": "build199-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4546,9 +4546,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device4", + "id": "build199-b7--device4", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4577,9 +4577,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device5", + "id": "build199-b7--device5", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4606,9 +4606,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build48-b1--device7", + "id": "build201-b7--device7", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4635,9 +4635,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4666,9 +4666,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device3", + "id": "build199-b7--device3", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4695,9 +4695,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -4726,9 +4726,9 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "id": "build13-b1--device6", + "id": "build199-b7--device6", "os": "Android", - "pool": "Chrome-perf" + "pool": "chrome.tests.perf" } ], "expiration": 36000, @@ -8548,7 +8548,7 @@ "-v", "--upload-results", "--browser=android-chromium", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_mobile", @@ -8577,7 +8577,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -8608,7 +8608,7 @@ "-v", "--upload-results", "--browser=android-chromium", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_mobile", @@ -8637,7 +8637,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -11271,7 +11271,7 @@ "-v", "--upload-results", "--browser=android-webview", - "--output-format=histograms", + "--output-format=chartjson", "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" ], "isolate_name": "telemetry_perf_webview_tests", @@ -11301,7 +11301,7 @@ "-v", "--upload-results", "--browser=android-webview", - "--output-format=histograms", + "--output-format=chartjson", "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" ], "isolate_name": "telemetry_perf_webview_tests", @@ -11331,7 +11331,7 @@ "-v", "--upload-results", "--browser=android-webview", - "--output-format=histograms", + "--output-format=chartjson", "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" ], "isolate_name": "telemetry_perf_webview_tests", @@ -13555,7 +13555,7 @@ "-v", "--upload-results", "--browser=android-webview", - "--output-format=histograms", + "--output-format=chartjson", "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" ], "isolate_name": "telemetry_perf_webview_tests", @@ -13585,7 +13585,7 @@ "-v", "--upload-results", "--browser=android-webview", - "--output-format=histograms", + "--output-format=chartjson", "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" ], "isolate_name": "telemetry_perf_webview_tests", @@ -13615,7 +13615,7 @@ "-v", "--upload-results", "--browser=android-webview", - "--output-format=histograms", + "--output-format=chartjson", "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" ], "isolate_name": "telemetry_perf_webview_tests", @@ -17787,7 +17787,7 @@ "-v", "--upload-results", "--browser=android-chromium", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_mobile", @@ -17816,7 +17816,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -17847,7 +17847,7 @@ "-v", "--upload-results", "--browser=android-chromium", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_mobile", @@ -17876,7 +17876,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -22118,7 +22118,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -22148,7 +22148,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -22180,7 +22180,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -22210,7 +22210,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -26160,7 +26160,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -26190,7 +26190,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -26222,7 +26222,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -26252,7 +26252,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -30186,7 +30186,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -30216,7 +30216,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -30248,7 +30248,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -30278,7 +30278,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -34062,7 +34062,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -34092,7 +34092,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -34124,7 +34124,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -34154,7 +34154,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -37980,7 +37980,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -38010,7 +38010,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -38042,7 +38042,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -38072,7 +38072,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -41940,7 +41940,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -41970,7 +41970,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -42002,7 +42002,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -42032,7 +42032,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -45903,7 +45903,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -45933,7 +45933,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -45965,7 +45965,7 @@ "-v", "--upload-results", "--browser=release_x64", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -45995,7 +45995,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -49866,7 +49866,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.common_desktop", @@ -49896,7 +49896,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ], @@ -49928,7 +49928,7 @@ "-v", "--upload-results", "--browser=release", - "--output-format=histograms" + "--output-format=chartjson" ], "isolate_name": "telemetry_perf_tests", "name": "system_health.memory_desktop", @@ -49958,7 +49958,7 @@ "-v", "--upload-results", "--browser=reference", - "--output-format=histograms", + "--output-format=chartjson", "--max-failures=5", "--output-trace-tag=_ref" ],
diff --git a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter index 0bef714..70930a2 100644 --- a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
@@ -138,7 +138,9 @@ -ExtensionWebRequestApiTest.WebRequestDiceHeaderProtection -ExtensionWebRequestApiTest.WebRequestTypes -ExtensionWebRequestApiTest.WebRequestTestOSDD +# http://crbug.com/841002 -ExtensionWebRequestApiTest.WebRequestURLFetcherInterception +-ExtensionWebRequestApiTest.WebRequestClientsGoogleComProtection # Note WebRequestUnloadImmediately is disabled on Linux -ExtensionWebRequestApiTest.WebRequestUnloadImmediately
diff --git a/testing/buildbot/filters/viz.content_browsertests.filter b/testing/buildbot/filters/viz.content_browsertests.filter index f1bc00f..57c02d90 100644 --- a/testing/buildbot/filters/viz.content_browsertests.filter +++ b/testing/buildbot/filters/viz.content_browsertests.filter
@@ -88,9 +88,5 @@ # Flaky Result on Windows-7 http://crbug.com/883463 -MainThreadEventQueueBrowserTest.MouseMove -# Browser side fling cannot use SetNeedsBeginFrame on viz https://crbug.com/823310 --CompositorEventAckBrowserTest.TouchStartDuringFling --BrowserSideFlingBrowserTest.* - # Uses LatencyInfo for input info https://crbug.com/791557 -MouseLatencyBrowserTest.CoalescedMouseMovesCorrectlyTerminated
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 3ff9aef..47cdd33 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -2894,6 +2894,12 @@ '--jobs=1', ], }, + 'linux-xenial-rel': { + 'args': [ + '--xvfb', + '--jobs=1', + ], + }, # chromium.mac # Disable parallelism on all Mac bots. 'Mac10.10 Tests': {
diff --git a/testing/scripts/run_performance_tests.py b/testing/scripts/run_performance_tests.py index 9da7d93..f5f411e1 100755 --- a/testing/scripts/run_performance_tests.py +++ b/testing/scripts/run_performance_tests.py
@@ -72,12 +72,7 @@ 'blink_perf.parser', 'blink_perf.shadow_dom', 'blink_perf.svg', - 'memory.top_10_mobile', - 'system_health.common_desktop', - 'system_health.common_mobile', - 'system_health.memory_desktop', - 'system_health.memory_mobile', - 'system_health.webview_startup', + 'memory.top_10_mobile' ] # We currently have two different sharding schemes for android
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 15873a7..2c0849f 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2803,20 +2803,6 @@ ] } ], - "RefreshTokenDeviceId": [ - { - "platforms": [ - "linux", - "mac", - "win" - ], - "experiments": [ - { - "name": "Enabled" - } - ] - } - ], "RemoveNavigationHistory": [ { "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index c6293ca..44c2771 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -11,8 +11,6 @@ crbug.com/707656 fast/inline-block/14498-positionForCoordinates.html [ Failure ] crbug.com/789878 fast/inline/inline-focus-ring.html [ Failure ] -# Need support for selection modification by granularity - # Non-interoperable behavior not worth to fix. crbug.com/591099 fast/text/apply-start-width-after-skipped-text.html [ Skip ] @@ -45,6 +43,8 @@ crbug.com/594672 virtual/mouseevent_fractional/fast/events/updateLayoutForHitTest.html [ Crash ] # New passes +crbug.com/591099 external/wpt/css/CSS2/floats-clear/no-clearance-adjoining-opposite-float.html [ Pass ] +crbug.com/591099 external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin-after-left-right.html [ Pass ] crbug.com/626703 external/wpt/css/css-ui/text-overflow-021.html [ Failure ] crbug.com/492664 external/wpt/css/css-writing-modes/inline-block-alignment-003.xht [ Pass ] crbug.com/492664 external/wpt/css/css-writing-modes/inline-block-alignment-005.xht [ Pass ] @@ -214,7 +214,7 @@ crbug.com/591099 editing/selection/mixed-editability-10.html [ Failure ] crbug.com/591099 editing/selection/modify_extend/extend_by_character.html [ Failure ] crbug.com/714962 editing/selection/modify_move/move-forward-after-line-break.html [ Failure ] -crbug.com/591099 editing/selection/move-left-right.html [ Timeout ] +crbug.com/591099 editing/selection/move-left-right.html [ Pass Timeout ] crbug.com/714962 editing/selection/offset-from-point-complex-scripts.html [ Failure ] crbug.com/714962 editing/selection/offset-from-point.html [ Failure ] crbug.com/591099 editing/selection/paint-hyphen.html [ Failure ] @@ -653,7 +653,6 @@ crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/descriptor-fallback.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/descriptor-prefix.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-content-vert-001a.xhtml [ Failure ] -crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-multi-item-vert-001b.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-break-request-horiz-001a.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-definite-sizes-002.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-definite-sizes-004.html [ Failure ] @@ -814,7 +813,7 @@ crbug.com/591099 external/wpt/fetch/api/response/response-clone.html [ Failure Pass ] crbug.com/591099 external/wpt/fetch/api/response/response-error.html [ Pass Timeout ] crbug.com/591099 external/wpt/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html [ Failure Pass ] -crbug.com/591099 external/wpt/geolocation-API/PositionOptions.https.html [ Failure Pass ] +crbug.com/591099 external/wpt/geolocation-API/PositionOptions.https.html [ Failure ] crbug.com/591099 external/wpt/hr-time/timing-attack.html [ Pass Timeout ] crbug.com/591099 external/wpt/html-media-capture/capture_audio_cancel-manual.html [ Failure ] crbug.com/591099 external/wpt/html-media-capture/capture_image_cancel-manual.html [ Failure ] @@ -905,7 +904,6 @@ crbug.com/591099 external/wpt/selection/extend-00.html [ Timeout ] crbug.com/591099 external/wpt/selection/extend-20.html [ Timeout ] crbug.com/591099 external/wpt/selection/selectAllChildren.html [ Timeout ] -crbug.com/591099 external/wpt/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html [ Failure Pass ] crbug.com/591099 external/wpt/shadow-dom/DocumentOrShadowRoot-prototype-elementFromPoint.html [ Failure ] crbug.com/591099 external/wpt/shadow-dom/ShadowRoot-interface.html [ Failure Pass ] crbug.com/591099 external/wpt/shadow-dom/untriaged/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-010.html [ Pass Timeout ] @@ -1022,7 +1020,7 @@ crbug.com/591099 fast/box-shadow/box-shadow.html [ Failure ] crbug.com/591099 fast/box-shadow/inset-subpixel.html [ Failure ] crbug.com/591099 fast/box-shadow/inset.html [ Failure ] -crbug.com/591099 fast/box-sizing/replaced.html [ Failure ] +crbug.com/591099 fast/box-sizing/replaced.html [ Failure Pass ] crbug.com/591099 fast/css-generated-content/015.html [ Failure ] crbug.com/805301 fast/css-generated-content/crash-selection-editing-removes-pseudo.html [ Failure ] crbug.com/591099 fast/css-generated-content/first-letter-next-sibling-crash.html [ Crash ] @@ -1173,7 +1171,6 @@ crbug.com/591099 fast/events/onclick-list-marker.html [ Failure ] crbug.com/591099 fast/events/pointerevents/mouse-pointer-capture-transition-events.html [ Timeout ] crbug.com/591099 fast/events/pointerevents/mouse-pointer-event-properties.html [ Timeout ] -crbug.com/591099 fast/events/pointerevents/mouse-pointer-preventdefault.html [ Failure Pass ] crbug.com/591099 fast/events/pointerevents/touch-capture.html [ Timeout ] crbug.com/591099 fast/events/select-element.html [ Timeout ] crbug.com/591099 fast/events/sequential-focus-navigation-starting-point.html [ Failure ] @@ -1607,7 +1604,7 @@ crbug.com/591099 http/tests/csspaint/invalidation-background-image.html [ Timeout ] crbug.com/591099 http/tests/csspaint/invalidation-border-image.html [ Timeout ] crbug.com/591099 http/tests/csspaint/invalidation-content-image.html [ Timeout ] -crbug.com/591099 http/tests/devtools/console/console-functions.js [ Timeout ] +crbug.com/591099 http/tests/devtools/console/console-functions.js [ Pass Timeout ] crbug.com/591099 http/tests/devtools/console/console-preserve-scroll.js [ Timeout ] crbug.com/591099 http/tests/devtools/console/console-search.js [ Timeout ] crbug.com/591099 http/tests/devtools/console/console-viewport-control.js [ Failure ] @@ -1615,7 +1612,9 @@ crbug.com/591099 http/tests/devtools/editor/text-editor-ctrl-d-2.js [ Timeout ] crbug.com/591099 http/tests/devtools/editor/text-editor-enter-behaviour.js [ Pass Timeout ] crbug.com/714962 http/tests/devtools/editor/text-editor-formatter.js [ Timeout ] +crbug.com/591099 http/tests/devtools/editor/text-editor-line-breaks.js [ Timeout ] crbug.com/591099 http/tests/devtools/editor/text-editor-reveal-line.js [ Timeout ] +crbug.com/591099 http/tests/devtools/editor/text-editor-search-switch-editor.js [ Timeout ] crbug.com/591099 http/tests/devtools/editor/text-editor-word-jumps.js [ Pass ] crbug.com/714962 http/tests/devtools/elements/edit/edit-dom-actions-4.js [ Crash ] crbug.com/591099 http/tests/devtools/elements/elements-inspect-iframe-from-different-domain.js [ Timeout ] @@ -1643,11 +1642,12 @@ crbug.com/591099 http/tests/devtools/extensions/extensions-sidebar.js [ Timeout ] crbug.com/591099 http/tests/devtools/network/network-datareceived.js [ Failure ] crbug.com/591099 http/tests/devtools/persistence/persistence-merge-editor-tabs.js [ Failure ] +crbug.com/591099 http/tests/devtools/search/source-frame-replace-2.js [ Timeout ] crbug.com/591099 http/tests/devtools/search/source-frame-replace-4.js [ Timeout ] crbug.com/591099 http/tests/devtools/sources/debugger-breakpoints/dom-breakpoints.js [ Timeout ] crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints.js [ Timeout ] -crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-skip-step-in.js [ Timeout ] -crbug.com/591099 http/tests/devtools/sources/debugger-ui/debugger-inline-values.js [ Failure ] +crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-skip-step-in.js [ Pass Timeout ] +crbug.com/591099 http/tests/devtools/sources/debugger-ui/debugger-inline-values.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/sources/debugger/debugger-proto-property.js [ Timeout ] crbug.com/591099 http/tests/devtools/text-autosizing-override.js [ Failure ] crbug.com/591099 http/tests/devtools/tracing/scroll-invalidations.js [ Failure ] @@ -1658,7 +1658,7 @@ crbug.com/591099 http/tests/devtools/tracing/timeline-paint/timeline-paint-with-layout-invalidations.js [ Failure ] crbug.com/591099 http/tests/devtools/tracing/timeline-paint/timeline-paint-with-style-recalc-invalidations.js [ Failure ] crbug.com/591099 http/tests/images/restyle-decode-error.html [ Failure ] -crbug.com/783102 http/tests/incremental/frame-focus-before-load.html [ Pass Timeout ] +crbug.com/783102 http/tests/incremental/frame-focus-before-load.html [ Timeout ] crbug.com/591099 http/tests/incremental/slow-utf8-text.pl [ Pass Timeout ] crbug.com/591099 http/tests/loading/nested_bad_objects.php [ Failure ] crbug.com/591099 http/tests/loading/preload-picture-nested.html [ Failure ] @@ -1673,7 +1673,7 @@ crbug.com/591099 http/tests/security/contentSecurityPolicy/source-list-parsing-04.html [ Failure ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-appcache.https.html [ Crash Failure ] crbug.com/591099 http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.https.html [ Crash Failure Pass ] -crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash ] +crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash Pass ] crbug.com/591099 http/tests/security/shape-image-cors-allow-origin.html [ Failure ] crbug.com/591099 http/tests/security/shape-image-cors-data-url.html [ Failure ] crbug.com/591099 http/tests/security/shape-image-cors-same-origin.html [ Failure ] @@ -2084,7 +2084,7 @@ crbug.com/591099 virtual/mouseevent_fractional/fast/events/onclick-list-marker.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-capture-transition-events.html [ Timeout ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/touch-capture.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/select-element.html [ Timeout ] +crbug.com/591099 virtual/mouseevent_fractional/fast/events/select-element.html [ Failure Timeout ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/sequential-focus-navigation-starting-point.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/wheel/mainthread-touchpad-fling-latching.html [ Pass ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees index bea5e441..1cebf926 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-gen-property-trees
@@ -181,6 +181,7 @@ crbug.com/836912 compositing/squashing/vertical-writing-mode-squashed.html [ Failure ] crbug.com/836912 scrollbars/scrollbar-added-during-drag.html [ Crash ] crbug.com/836912 scrollbars/scrollbar-removed-by-viewport-crash.html [ Crash ] +crbug.com/841342 scrollbars/border-box-rect-clips-scrollbars.html [ Failure ] # These visual viewport tests should pass. Bug(none) external/wpt/visual-viewport [ Pass ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 010bc3b..179f5d7 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -178,6 +178,8 @@ crbug.com/711709 external/wpt/css/CSS2/floats-clear/floats-130.xht [ Skip ] crbug.com/711709 external/wpt/css/CSS2/floats-clear/floats-131.xht [ Skip ] crbug.com/711709 external/wpt/css/CSS2/floats-clear/floats-137.xht [ Skip ] +crbug.com/711709 external/wpt/css/CSS2/floats-clear/no-clearance-adjoining-opposite-float.html [ Failure ] +crbug.com/711709 external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin-after-left-right.html [ Failure ] crbug.com/711805 external/wpt/css/CSS2/positioning/abspos-inline-001.xht [ Skip ] crbug.com/711805 external/wpt/css/CSS2/positioning/abspos-inline-002.xht [ Skip ] @@ -2786,6 +2788,7 @@ crbug.com/832071 virtual/navigation-mojo-response/external/wpt/service-workers/service-worker/worker-client-id.https.html [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Mac10.12 ] external/wpt/accelerometer/Accelerometer.https.html [ Timeout ] crbug.com/626703 [ Retina ] external/wpt/pointerevents/pointerevent_touch-action-button-test_touch-manual.html [ Skip ] crbug.com/626703 [ Retina ] external/wpt/pointerevents/pointerevent_touch-action-table-test_touch-manual.html [ Skip ] crbug.com/626703 [ Mac10.12 ] external/wpt/pointerevents/pointerevent_touch-action-button-test_touch-manual.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index 46632e3..8ff44fbb 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -5197,6 +5197,12 @@ {} ] ], + "pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual.html": [ + [ + "/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual.html", + {} + ] + ], "pointerevents/pointerevent_boundary_events_in_capturing-manual.html": [ [ "/pointerevents/pointerevent_boundary_events_in_capturing-manual.html", @@ -139422,6 +139428,16 @@ {} ] ], + "fetch/api/cors/cors-filtering-expected.txt": [ + [ + {} + ] + ], + "fetch/api/cors/cors-filtering-worker-expected.txt": [ + [ + {} + ] + ], "fetch/api/cors/cors-filtering.js": [ [ {} @@ -148447,6 +148463,11 @@ {} ] ], + "html/infrastructure/urls/resolving-urls/query-encoding/location.sub_encoding=x-cp1251-expected.txt": [ + [ + {} + ] + ], "html/infrastructure/urls/resolving-urls/query-encoding/resources/blank.py": [ [ {} @@ -202123,6 +202144,16 @@ {} ] ], + "html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html": [ + [ + "/html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html?encoding=utf8", + {} + ], + [ + "/html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html?encoding=x-cp1251", + {} + ] + ], "html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html": [ [ "/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html", @@ -250641,7 +250672,7 @@ "support" ], "./CONTRIBUTING.md": [ - "cc9b0261662898aef7f4eed81741361c3f7c6467", + "d29b019e9828ee3b23b428c684412aa402ec9fff", "support" ], "./LICENSE.md": [ @@ -250649,7 +250680,7 @@ "support" ], "./README.md": [ - "766bb4d66deef9bcb90339d76e3280abb36103df", + "99961df1909cc6fe0a4a7aa50ae9f34bd271d54f", "support" ], "./lint.whitelist": [ @@ -277109,7 +277140,7 @@ "support" ], "css/README.md": [ - "ab97108074d4c07c5333ff1148fe9a5e425484ca", + "4cd0a3eee196e6ca0eb72e84a8bd4bf45f5bb02e", "support" ], "css/build-css-testsuites.sh": [ @@ -287109,7 +287140,7 @@ "visual" ], "css/css-fonts/matching/README.md": [ - "194fbc4cdaf1ff4a43e1a4e6b7bc7fbc17eec6d8", + "d1bf1cd04e0df5e54eeeb60c8a9311cb2d63f15e", "support" ], "css/css-fonts/matching/fixed-stretch-style-over-weight-ref.html": [ @@ -293317,7 +293348,7 @@ "testharness" ], "css/css-fonts/variations/font-weight-matching-installed-fonts.html": [ - "f0362338e6a16a1c3cd2823f2da30651ba63b567", + "c56c7b8c274f918945f8cfc02ddc3543b4ff0c4f", "manual" ], "css/css-fonts/variations/font-weight-matching.html": [ @@ -335800,6 +335831,14 @@ "f026be2d5244f1077b6f65e2c22ecbfdb40026c2", "testharness" ], + "fetch/api/cors/cors-filtering-expected.txt": [ + "afa8ce27fa1f693a5bd97a5bf112a99513502f45", + "support" + ], + "fetch/api/cors/cors-filtering-worker-expected.txt": [ + "afa8ce27fa1f693a5bd97a5bf112a99513502f45", + "support" + ], "fetch/api/cors/cors-filtering-worker.html": [ "636a08cb1943b3f1cb6a06944bdc7675d18233f0", "testharness" @@ -335809,7 +335848,7 @@ "testharness" ], "fetch/api/cors/cors-filtering.js": [ - "5beac80fa31e80addfdd29fa58557ef59865744a", + "44029d3879fb0efdd6e2bfea6b5ce78b63b8e14e", "support" ], "fetch/api/cors/cors-multiple-origins-expected.txt": [ @@ -336601,7 +336640,7 @@ "support" ], "fetch/corb/README.md": [ - "d532c359cdb1359f88ef79afff88052b3387dbf6", + "c786c1df10c1edad9b25be4ec112250864c328e5", "support" ], "fetch/corb/img-html-correctly-labeled.sub-expected.html": [ @@ -336769,7 +336808,7 @@ "testharness" ], "fetch/data-urls/README.md": [ - "83d54a0532dd87ab1fa9f5f9b7e01d9a43d91eae", + "868cb170fa0c5626008fef77e37dee16e76b10d5", "support" ], "fetch/data-urls/base64.any-expected.txt": [ @@ -337793,7 +337832,7 @@ "support" ], "graphics-aam/graphics-document_on_html_element-manual.html": [ - "933fcb47c29bb5e119326147266457231dabf810", + "f686aecabb2b93aec606027a0c49deb6a6a47be4", "manual" ], "graphics-aam/graphics-document_on_svg_element-manual-expected.txt": [ @@ -337801,7 +337840,7 @@ "support" ], "graphics-aam/graphics-document_on_svg_element-manual.html": [ - "126688d4b899c2b718914a9e7454f4ff14e21ae3", + "4032238193305de5716fd73fda5565b5b4be0d30", "manual" ], "graphics-aam/graphics-object_on_html_element-manual-expected.txt": [ @@ -337809,7 +337848,7 @@ "support" ], "graphics-aam/graphics-object_on_html_element-manual.html": [ - "5fef647bd9e1cfed38467ca790b8796ef9d58bbe", + "a5b486cd6a8ab9b3cff11bc05ff53cf282540959", "manual" ], "graphics-aam/graphics-object_on_svg_element-manual-expected.txt": [ @@ -337817,7 +337856,7 @@ "support" ], "graphics-aam/graphics-object_on_svg_element-manual.html": [ - "ae94b8f962584ba8afa6ccb40c992a597bb9d9af", + "0026225d08a733406bf83bd33847950dea7832f8", "manual" ], "graphics-aam/graphics-symbol_on_html_element-manual-expected.txt": [ @@ -337825,7 +337864,7 @@ "support" ], "graphics-aam/graphics-symbol_on_html_element-manual.html": [ - "be301a3a71514708c547fa033eab0271367a3fb9", + "9641390cc19feb44f311b46c32f45c913412c000", "manual" ], "graphics-aam/graphics-symbol_on_svg_element-manual-expected.txt": [ @@ -337833,7 +337872,7 @@ "support" ], "graphics-aam/graphics-symbol_on_svg_element-manual.html": [ - "52b2e48333492373708b86cf558e578b04ac5977", + "433d0e83ee0556b94e00edc138bd32e36b10b1a0", "manual" ], "gyroscope/Gyroscope-disabled-by-feature-policy.https.html": [ @@ -346944,6 +346983,14 @@ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], + "html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html": [ + "bc42ced67ad1368f3cf459dd113b131c69aaba78", + "testharness" + ], + "html/infrastructure/urls/resolving-urls/query-encoding/location.sub_encoding=x-cp1251-expected.txt": [ + "79ed6d8c5f9f99f63e18831d9175bc2366fe734b", + "support" + ], "html/infrastructure/urls/resolving-urls/query-encoding/resources/blank.py": [ "e55787bc9f46f01aece15afed2ce0686d143dc03", "support" @@ -346961,7 +347008,7 @@ "support" ], "html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js": [ - "5b09875b7207da2b908e66e1d75f095f12887247", + "70fd863f8335a2026d5755cf2ba7a01d98222ec0", "support" ], "html/infrastructure/urls/resolving-urls/query-encoding/resources/resource.py": [ @@ -358629,7 +358676,7 @@ "testharness" ], "media-source/generate-config-change-tests.py": [ - "044023540660d9b81484d1ae14851e13af907055", + "fefa39b93290d8d97b18f606c5166d7792193251", "support" ], "media-source/import_tests.sh": [ @@ -367525,7 +367572,7 @@ "testharness" ], "page-visibility/test_minimize-manual.html": [ - "7cf8bf5781fc968fedbd346dafe098218e37f0ac", + "2b8cdc5d56ee9edde9a38920011b327e06249cb5", "manual" ], "page-visibility/test_read_only.html": [ @@ -367533,7 +367580,7 @@ "testharness" ], "page-visibility/test_tab_state_change-manual.html": [ - "6c6c0d50dc4cf367646375170181d0135a403ae3", + "8acd2d1b2f9e397f9f533f845686745059cba300", "manual" ], "page-visibility/unload-1.html": [ @@ -367617,7 +367664,7 @@ "support" ], "payment-handler/app-can-make-payment.js": [ - "95d11a09c5468bcea9172e1511be5c8fa5b4d9d7", + "f789d5de3dcb915d66ca43142c940ac74fcedf6a", "support" ], "payment-handler/basic-card.js": [ @@ -367633,7 +367680,7 @@ "testharness" ], "payment-handler/can-make-payment-event-constructor.https.worker.js": [ - "39e90eca2f6cb7d4fa62655a1aa492acea30f436", + "4a77b5b3444c490b673b7c08862f1565b705f0e2", "testharness" ], "payment-handler/can-make-payment-event.https-expected.txt": [ @@ -368192,6 +368239,10 @@ "b010a8ff22c0522c8bbd5332e5d4ff8f1032a766", "manual" ], + "pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual.html": [ + "ed1a314a4240bdc127210fe11de23aabc6805ee2", + "manual" + ], "pointerevents/pointerevent_boundary_events_in_capturing-manual.html": [ "f7159ac1ef1627fcd2d48497037bae2b67144e6f", "manual" @@ -368477,35 +368528,35 @@ "testharness" ], "pointerlock/movementX_Y_basic-manual.html": [ - "eb22c6fb2fbae178f2b662a09a9153635bdb17e6", + "45eea8be5393873e6c02331b4aff6f4622be692f", "manual" ], "pointerlock/movementX_Y_no-jumps-manual.html": [ - "a58e494ab143d0658535cb571acbf85544c52c51", + "0d92e1e270e9ab01c863815c07a02ff3081aede9", "manual" ], "pointerlock/pointerlock_basic-manual.html": [ - "4914806f0c1dc76a630dc82a8a0ee9ceacef06b4", + "c815d770b9663dbf9899b0cb53c16f246dc061af", "manual" ], "pointerlock/pointerlock_fullscreen-manual.html": [ - "c6cf680894c699d610716dfce34e8c67d0917498", + "1a342e8a079fecf49b8e86145ef371325bdfa87f", "manual" ], "pointerlock/pointerlock_indefinite-manual.html": [ - "d52319bd8c660491ac5528ae90aece83a2cf5642", + "599e7fab6b6592f23294f5183b10fae7c3bc041f", "manual" ], "pointerlock/pointerlock_leave_Tab-manual.html": [ - "41b0799807f5b7d88ebfc1e819ef10b5d4194aaf", + "8a5ecf9e4bce67edf50ef6f672e6837c917d0999", "manual" ], "pointerlock/pointerlock_leave_UA-manual.html": [ - "3794be5ea066cb99e32a5669f3e5d08b9732159d", + "c89cd123ef253704332cd3e80bc04c1188a7a2d0", "manual" ], "pointerlock/pointerlock_remove_target-manual.html": [ - "6262b231ca8af095dee42c493e77662ee132dc05", + "d593c6f437c50ec52d5c6befed19f26627697379", "manual" ], "pointerlock/pointerlock_remove_target_on_mouseup-manual.html": [ @@ -368853,15 +368904,15 @@ "support" ], "presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html": [ - "ac16b8b189403d4b3c520f69c1675b6acd979e18", + "dba8e21a493a87fc11a14067c5cc99856877d7c5", "manual" ], "presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html": [ - "e44406efbfe55bb74ac62d5fae7700102ce8e706", + "f0e257255a33eed38aa766ff6929562508b6a6e5", "manual" ], "presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html": [ - "3c98bfaf0bc18436501f724210a1f33d9f273573", + "05fbd54d5ec8cec09ee3a9d2148e392640b602bf", "manual" ], "presentation-api/receiving-ua/PresentationConnection_send-manual.https.html": [ @@ -368885,7 +368936,7 @@ "support" ], "presentation-api/receiving-ua/idlharness-manual.https.html": [ - "fdabdbe847d78dd22754d72ed62f293cd55227ee", + "fadcaa8c9e3d9df537f8a9a7a02ecbea98b9c1bf", "manual" ], "presentation-api/receiving-ua/serviceworker.js": [ @@ -376909,7 +376960,7 @@ "testharness" ], "screen-orientation/page-visibility-manual.html": [ - "dab433a2b2f0c479f03fc54119b89501c907fda9", + "e53d0575971ee59ed235eb08ccf0355d2bb5acbd", "manual" ], "screen-orientation/resources/iframe-listen-orientation-change.html": [ @@ -384813,7 +384864,7 @@ "support" ], "web-nfc/nfc_push_ArrayBuffer-manual.https.html": [ - "79189e00a1d62f0e1f936d5ca687bb48522dd0bc", + "acb2d28a5af18c96a234f4ff3312e7ea1831e23a", "manual" ], "web-nfc/nfc_push_DOMString-manual.https-expected.txt": [ @@ -384821,7 +384872,7 @@ "support" ], "web-nfc/nfc_push_DOMString-manual.https.html": [ - "f2656df15c0d0cf49eeb3645cf71bc1ab1c967c9", + "7cdeafe31291135dd99eb956fc9c6ff1b76211c0", "manual" ], "web-nfc/nfc_recordType_empty-manual.https-expected.txt": [ @@ -384829,7 +384880,7 @@ "support" ], "web-nfc/nfc_recordType_empty-manual.https.html": [ - "e85ae0dbad98d4f842d3b9d8b4a6f36b8071e5d6", + "4c24083a30ca16067454b6131ef2ae9f9ca12e27", "manual" ], "web-nfc/nfc_recordType_json-manual.https-expected.txt": [ @@ -384837,7 +384888,7 @@ "support" ], "web-nfc/nfc_recordType_json-manual.https.html": [ - "58a65c05bbb9ba434dffb5d4a4adf9575ee5eaf8", + "194fa3df3ba9fd0e817c7c5651766d3c1c3d4292", "manual" ], "web-nfc/nfc_recordType_opaque-manual.https-expected.txt": [ @@ -384845,7 +384896,7 @@ "support" ], "web-nfc/nfc_recordType_opaque-manual.https.html": [ - "3dd5221c1532b10c6aeb1e2380da73977f59993f", + "2aad46712ae71944fad51eca2b7a763866ba135f", "manual" ], "web-nfc/nfc_recordType_text-manual.https-expected.txt": [ @@ -384853,7 +384904,7 @@ "support" ], "web-nfc/nfc_recordType_text-manual.https.html": [ - "287fb5e7659b0fe56e7747f8d0ecbeb461494b0d", + "9971b4c2c05587ceb3c6620fafd53887f0e1815d", "manual" ], "web-nfc/nfc_recordType_url-manual.https-expected.txt": [ @@ -384861,7 +384912,7 @@ "support" ], "web-nfc/nfc_recordType_url-manual.https.html": [ - "efeacce32b87627d824131af5624d4f88f1f6045", + "f1b038d79eaf826bd52f8f137d4015e00650f81d", "manual" ], "web-nfc/nfc_watch.https-expected.txt": [ @@ -384989,7 +385040,7 @@ "support" ], "webaudio/js/helpers.js": [ - "3cb468605c1fa8e5005bc8552b15f7a37ee9b935", + "358f8c8b19509c9d0b1f24d098585add5c9f4519", "support" ], "webaudio/refresh_idl.rb": [ @@ -393013,15 +393064,15 @@ "testharness" ], "xhr/access-control-basic-denied.htm": [ - "b83febc0462507d5a26be9b801cd7842b97f6e90", + "665f4c60237b69e3f85cc18785fffc93e6bed11e", "testharness" ], "xhr/access-control-basic-get-fail-non-simple.htm": [ - "54815c2c527f83e0dd2e4d0462efce8c91cdda6e", + "633746c76163c9e2427068c1d7dc7acd77ff1feb", "testharness" ], "xhr/access-control-basic-non-cors-safelisted-content-type.htm": [ - "69be9a4a9241abd923539c351e60ff6f32b9790b", + "f13827add41610f3595d504780e289daccfb6b84", "testharness" ], "xhr/access-control-basic-post-success-no-content-type.htm": [ @@ -393029,7 +393080,7 @@ "testharness" ], "xhr/access-control-basic-post-with-non-cors-safelisted-content-type.htm": [ - "94c893c91a4ab574e956f4a27c62d5c294e29d7a", + "47266b34b4371387d8bdba2ac80feb0d6f7678c0", "testharness" ], "xhr/access-control-basic-preflight-denied.htm": [ @@ -393093,15 +393144,15 @@ "testharness" ], "xhr/access-control-preflight-sync-header-denied.htm": [ - "f10476c35d6316b90bebfc38fe5f4bf436b6d89b", + "d2f129e8190e7b7255ec816c0fbca921e24d590a", "testharness" ], "xhr/access-control-preflight-sync-method-denied.htm": [ - "34b48c93dc7b4875082378c73d08eb0b22706e94", + "d20f43761f78b5b8679b7a25c41bf7493f754f40", "testharness" ], "xhr/access-control-preflight-sync-not-supported.htm": [ - "bc71e3358aab575c9732eebe36eb4152964691cd", + "0afed5f832be48edf1f2f2118e95ddaf88025c97", "testharness" ], "xhr/access-control-recursive-failed-request.htm": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/CONTRIBUTING.md b/third_party/WebKit/LayoutTests/external/wpt/CONTRIBUTING.md index d085231..427ec682 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/CONTRIBUTING.md +++ b/third_party/WebKit/LayoutTests/external/wpt/CONTRIBUTING.md
@@ -31,4 +31,4 @@ Documentation ------------- -See [web-platform-tests.org](http://web-platform-tests.org/). +See [web-platform-tests.org](https://web-platform-tests.org/).
diff --git a/third_party/WebKit/LayoutTests/external/wpt/README.md b/third_party/WebKit/LayoutTests/external/wpt/README.md index 2a0007c..db5612e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/README.md +++ b/third_party/WebKit/LayoutTests/external/wpt/README.md
@@ -373,7 +373,7 @@ For more details, see the [lint-tool documentation][lint-tool]. -[lint-tool]: http://web-platform-tests.org/writing-tests/lint-tool.html +[lint-tool]: https://web-platform-tests.org/writing-tests/lint-tool.html Adding command-line scripts ("tools" subdirs) --------------------------------------------- @@ -449,5 +449,5 @@ Documentation ============= -* [How to write and review tests](http://web-platform-tests.org/) +* [How to write and review tests](https://web-platform-tests.org/) * [Documentation for the wptserve server](http://wptserve.readthedocs.org/en/latest/)
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/adjoining-float-new-fc.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/adjoining-float-new-fc.html new file mode 100644 index 0000000..587bbf5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/adjoining-float-new-fc.html
@@ -0,0 +1,13 @@ +<!DOCTYPE html> +<title>New formatting context next to adjoining float</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="help" href="https://www.w3.org/TR/CSS22/box.html#collapsing-margins" title="8.3.1 Collapsing margins"> +<link rel="match" href="../reference/ref-filled-green-100px-square.xht" /> +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div style="width:100px; overflow:hidden; background:red;"> + <div> + <div style="float:left; width:100px; height:50px; background:green;"></div> + <div style="margin-top:300px; clear:left; overflow:hidden; width:100px; height:50px; background:green;"></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/clear-after-top-margin.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/clear-after-top-margin.html new file mode 100644 index 0000000..95b4456 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/clear-after-top-margin.html
@@ -0,0 +1,14 @@ +<!DOCTYPE html> +<title>Clearance inside block with top margin</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="help" href="https://www.w3.org/TR/CSS22/box.html#collapsing-margins" title="8.3.1 Collapsing margins"> +<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html"> +<p>Test passes if there is a filled green square.</p> +<div style="float:right; width:100px; height:100px;"></div> +<!-- Using padding to prevent the child margin from pulling the block down. --> +<div style="padding-top:10px; width:100px; background:green;"> + <div style="margin-top:80px;"> + <div style="clear:right;"></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/nested-clearance-new-formatting-context.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/nested-clearance-new-formatting-context.html new file mode 100644 index 0000000..5e43b250 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/nested-clearance-new-formatting-context.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Nested clearance on new formatting context</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="match" href="../../reference/ref-filled-green-200px-square.html"> +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div style="width:200px; height:200px; background:red;"> + <div style="width:500px;"> + <div style="float:left; width:200px; height:100px; background:green;"></div> + <div style="clear:left; margin-top:40px;"> + <div style="float:left; width:200px; height:80px; background:green;"></div> + <div style="overflow:hidden; clear:left; margin-top:50px; width:200px; height:20px; background:green;"></div> + </div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-adjoining-opposite-float.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-adjoining-opposite-float.html new file mode 100644 index 0000000..01a457e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-adjoining-opposite-float.html
@@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>No clearance due to large top margin that takes us past the float</title> +<meta name="assert" content="Check that we don't apply clearance when the top margin of the clearance candidate takes it past the relevant float, and that a preceding empty block with a right float that's adjoining to the clearance candidate doesn't cause confusion"> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="match" href="../../reference/nothing.html"> +<p>There should be nothing below.</p> +<div style="float:left; width:10px; height:100px;"></div> +<div> + <div> + <div style="float:right; width:10px; height:200px;"></div> + </div> + <div style="background:red;"> + <div style="margin-top:150px; clear:left; background:hotpink;"></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin-after-left-right.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin-after-left-right.html new file mode 100644 index 0000000..bc459d0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin-after-left-right.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>No clearance due to large top margin inside clear:right inside clear:left that takes us past the floats</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div style="float:left; width:50px; height:50px;"></div> +<div style="float:right; width:50px; height:100px;"></div> +<div style="width:100px; height:100px; background:green;"> + <div style="height:15px; margin-bottom:20px;"></div> + <div style="background:red;"> + <div style="clear:left; background:red;"> + <div style="clear:right; background:red;"> + <div style="margin-top:185px; background:red;"></div> + </div> + </div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin.html new file mode 100644 index 0000000..cabb1ac8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/no-clearance-due-to-large-margin.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<title>No clearance due to large top margin that takes us past the float</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div style="float:left; width:100px; height:100px; background:green;"></div> +<div style="padding-top:1px;"> + <div style="background:red;"> + <div style="clear:left; background:white; margin-top:150px;"><br></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/second-float-inside-empty-cleared-block-after-margin.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/second-float-inside-empty-cleared-block-after-margin.html new file mode 100644 index 0000000..ee8bebc53 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/second-float-inside-empty-cleared-block-after-margin.html
@@ -0,0 +1,14 @@ +<!DOCTYPE html> +<title>Float separated from float inside empty cleared block, margin before clearance</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="help" href="https://www.w3.org/TR/CSS22/box.html#collapsing-margins" title="8.3.1 Collapsing margins"> +<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html"> +<p>Test passes if there is a filled green square.</p> +<div style="float:left; width:100px; height:50px; background:green;"></div> +<div style="height:1px;"></div> +<div style="margin-top:20px;"> + <div style="clear:left;"> + <div style="float:left; width:100px; height:50px; background:green;"></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/second-float-inside-empty-cleared-block.html b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/second-float-inside-empty-cleared-block.html new file mode 100644 index 0000000..a383e9a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/CSS2/floats-clear/second-float-inside-empty-cleared-block.html
@@ -0,0 +1,14 @@ +<!DOCTYPE html> +<title>Float separated from float inside empty cleared block</title> +<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property"> +<link rel="help" href="https://www.w3.org/TR/CSS22/box.html#collapsing-margins" title="8.3.1 Collapsing margins"> +<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html"> +<p>Test passes if there is a filled green square.</p> +<div style="float:left; width:100px; height:50px; background:green;"></div> +<div style="height:1px;"></div> +<div> + <div style="clear:left;"> + <div style="float:left; width:100px; height:50px; background:green;"></div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/README.md b/third_party/WebKit/LayoutTests/external/wpt/css/README.md index 4967f8cf..959bab6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/README.md +++ b/third_party/WebKit/LayoutTests/external/wpt/css/README.md
@@ -67,5 +67,5 @@ [harness]: https://test.csswg.org/harness/ -[spec-link]: http://web-platform-tests.org/writing-tests/css-metadata.html#specification-links +[spec-link]: https://web-platform-tests.org/writing-tests/css-metadata.html#specification-links [hg-patch-to-git-patch]: https://raw.githubusercontent.com/mozilla/moz-git-tools/master/hg-patch-to-git-patch
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/matching/README.md b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/matching/README.md index 0d76075..653f4d9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/matching/README.md +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/matching/README.md
@@ -23,7 +23,7 @@ ### Building reference tests -Using the **Variable Test Axis Matching** font, [reference tests](http://web-platform-tests.org/writing-tests/reftests.html) in this directory are created as follows: +Using the **Variable Test Axis Matching** font, [reference tests](https://web-platform-tests.org/writing-tests/reftests.html) in this directory are created as follows: 1. Define `@font-face`s with range expressions, which trigger variation axes to be applied to the variable font. 2. Use CSS style definitions to request font faces from the set of declared `@font-face`s and use blocks of the glyph sequence MNOP.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/variations/font-weight-matching-installed-fonts.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/variations/font-weight-matching-installed-fonts.html index 9d08d5b..e00e317 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/variations/font-weight-matching-installed-fonts.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/variations/font-weight-matching-installed-fonts.html
@@ -4,7 +4,6 @@ <title>Testing new font-matching algorithm for font-weight values introduced in CSS Fonts level 4 (for system fonts)</title> <link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-matching-algorithm" /> <script src="/resources/testharness.js"></script> - <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <!-- THIS TEST REQUIRES THAT YOU INSTALL THE [csstest-*.ttf] FONTS OF THE [resources] FOLDER --> <meta name="flags" content="font" />
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering-expected.txt new file mode 100644 index 0000000..a15f49a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering-expected.txt
@@ -0,0 +1,22 @@ +This is a testharness.js-based test. +PASS CORS filter on Cache-Control header +PASS CORS filter on Content-Language header +PASS CORS filter on Content-Type header +PASS CORS filter on Expires header +PASS CORS filter on Last-Modified header +PASS CORS filter on Pragma header +FAIL CORS filter on Content-Length header assert_equals: Content-Length header should be included in response with value: 3 expected (string) "3" but got (object) null +PASS CORS filter on Age header +PASS CORS filter on Server header +PASS CORS filter on Warning header +PASS CORS filter on Set-Cookie header +PASS CORS filter on Set-Cookie2 header +PASS CORS filter on Age header, header is exposed +PASS CORS filter on Server header, header is exposed +PASS CORS filter on Warning header, header is exposed +PASS CORS filter on Set-Cookie header, header is forbidden +PASS CORS filter on Set-Cookie2 header, header is forbidden +PASS CORS filter on Set-Cookie header, header is forbidden(credentials = include) +PASS CORS filter on Set-Cookie2 header, header is forbidden(credentials = include) +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering-worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering-worker-expected.txt new file mode 100644 index 0000000..a15f49a --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering-worker-expected.txt
@@ -0,0 +1,22 @@ +This is a testharness.js-based test. +PASS CORS filter on Cache-Control header +PASS CORS filter on Content-Language header +PASS CORS filter on Content-Type header +PASS CORS filter on Expires header +PASS CORS filter on Last-Modified header +PASS CORS filter on Pragma header +FAIL CORS filter on Content-Length header assert_equals: Content-Length header should be included in response with value: 3 expected (string) "3" but got (object) null +PASS CORS filter on Age header +PASS CORS filter on Server header +PASS CORS filter on Warning header +PASS CORS filter on Set-Cookie header +PASS CORS filter on Set-Cookie2 header +PASS CORS filter on Age header, header is exposed +PASS CORS filter on Server header, header is exposed +PASS CORS filter on Warning header, header is exposed +PASS CORS filter on Set-Cookie header, header is forbidden +PASS CORS filter on Set-Cookie2 header, header is forbidden +PASS CORS filter on Set-Cookie header, header is forbidden(credentials = include) +PASS CORS filter on Set-Cookie2 header, header is forbidden(credentials = include) +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering.js b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering.js index 1feaa59..e755a16 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering.js +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/cors/cors-filtering.js
@@ -52,18 +52,17 @@ corsFilter(url, "Expires","04 May 1988 22:22:22 GMT" , false); corsFilter(url, "Last-Modified", "04 May 1988 22:22:22 GMT", false); corsFilter(url, "Pragma", "no-cache", false); +corsFilter(url, "Content-Length", "3" , false); // top.txt contains "top" corsFilter(url, "Age", "27", true); corsFilter(url, "Server", "wptServe" , true); corsFilter(url, "Warning", "Mind the gap" , true); -corsFilter(url, "Content-Length", "3" , true); // top.txt contains "top" corsFilter(url, "Set-Cookie", "name=value" , true); corsFilter(url, "Set-Cookie2", "name=value" , true); corsExposeFilter(url, "Age", "27", false); corsExposeFilter(url, "Server", "wptServe" , false); corsExposeFilter(url, "Warning", "Mind the gap" , false); -corsExposeFilter(url, "Content-Length", "3" , false); corsExposeFilter(url, "Set-Cookie", "name=value" , true); corsExposeFilter(url, "Set-Cookie2", "name=value" , true);
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/corb/README.md b/third_party/WebKit/LayoutTests/external/wpt/fetch/corb/README.md index 04c5b8a..48fc4ad6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/corb/README.md +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/corb/README.md
@@ -21,7 +21,7 @@ valuable independently from CORB's standardization efforts. Tests that cover behavior that is changed by CORB have to be marked as -[tentative](http://web-platform-tests.org/writing-tests/file-names.html) +[tentative](https://web-platform-tests.org/writing-tests/file-names.html) (using `.tentative` substring in their filename) until CORB is included in the official [Fetch spec](https://fetch.spec.whatwg.org/). Such tests may fail unless
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/data-urls/README.md b/third_party/WebKit/LayoutTests/external/wpt/fetch/data-urls/README.md index 64c3d7e..1ce5b18 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fetch/data-urls/README.md +++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/data-urls/README.md
@@ -1,10 +1,10 @@ -== data: URLs == +## data: URLs `resources/data-urls.json` contains `data:` URL tests. The tests are encoded as a JSON array. Each value in the array is an array of two or three values. The first value describes the input, the second value describes the expected MIME type, null if the input is expected to fail somehow, or the empty string if the expected value is `text/plain;charset=US-ASCII`. The third value, if present, describes the expected body as an array of integers representing bytes. These tests are used for `data:` URLs in this directory (see `processing.any.js`). -== Forgiving-base64 decode == +## Forgiving-base64 decode `resources/base64.json` contains [forgiving-base64 decode](https://infra.spec.whatwg.org/#forgiving-base64-decode) tests. The tests are encoded as a JSON array. Each value in the array is an array of two values. The first value describes the input, the second value describes the output as an array of integers representing bytes or null if the input cannot be decoded.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_html_element-manual.html b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_html_element-manual.html index 293ad2ea..cc9b407 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_html_element-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_html_element-manual.html
@@ -3,7 +3,6 @@ <head> <title>graphics-document on HTML element</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> - <link rel="stylesheet" href="/resources/testharness.css"> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_svg_element-manual.html b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_svg_element-manual.html index 4984bc35..1b61446 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_svg_element-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-document_on_svg_element-manual.html
@@ -3,7 +3,6 @@ <head> <title>graphics-document on SVG element</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> - <link rel="stylesheet" href="/resources/testharness.css"> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_html_element-manual.html b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_html_element-manual.html index 19979b2..074fe51 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_html_element-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_html_element-manual.html
@@ -3,7 +3,6 @@ <head> <title>graphics-object on HTML element</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> - <link rel="stylesheet" href="/resources/testharness.css"> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_svg_element-manual.html b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_svg_element-manual.html index 5c2cf28..d326ec5 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_svg_element-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-object_on_svg_element-manual.html
@@ -3,7 +3,6 @@ <head> <title>graphics-object on SVG element</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> - <link rel="stylesheet" href="/resources/testharness.css"> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_html_element-manual.html b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_html_element-manual.html index 3b9c77ff..913a7d1 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_html_element-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_html_element-manual.html
@@ -3,7 +3,6 @@ <head> <title>graphics-symbol on HTML element</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> - <link rel="stylesheet" href="/resources/testharness.css"> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_svg_element-manual.html b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_svg_element-manual.html index 6663225..78848269 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_svg_element-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/graphics-aam/graphics-symbol_on_svg_element-manual.html
@@ -3,7 +3,6 @@ <head> <title>graphics-symbol on SVG element</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> - <link rel="stylesheet" href="/resources/testharness.css"> <link rel="stylesheet" href="/wai-aria/scripts/manual.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html new file mode 100644 index 0000000..b1a4d5bd --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/location.sub.html
@@ -0,0 +1,44 @@ +<!doctype html> +<meta charset={{GET[encoding]}}> <!-- ends up as <meta charset> by default which is windows-1252 --> +<meta name=variant content="?encoding=x-cp1251"> +<meta name=variant content="?encoding=utf8"> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<div id=log></div> +<script> +function expected(encoding) { + return "?" + { + "UTF-8": "%C3%BF", + "windows-1251": "&%23255;", + "windows-1252": "%FF" + }[encoding]; +} + +[ + [(win, input) => { win.location = input; }, "location [PutForwards]"], + [(win, input) => { win.location.assign(input); }, "location.assign()"], + [(win, input) => { win.location.replace(input); }, "location.replace()"], + [(win, input) => { win.location.href = input; }, "location.href"] +].forEach(([callback, desc]) => { + async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")), + actualEncoding = document.characterSet + callback(frame.contentWindow, "/common/blank.html?\u00FF"); + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.location.search, expected(actualEncoding)); + }); + }, desc); +}); + +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")), + actualEncoding = document.characterSet; + frame.src = "/common/blank.html"; + frame.onload = t.step_func(() => { + frame.contentWindow.location.search = "\u00FF"; + frame.onload = t.step_func_done(() => { + assert_equals(frame.contentWindow.location.search, expected(actualEncoding)); + }); + }); +}, "location.search"); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/location.sub_encoding=x-cp1251-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/location.sub_encoding=x-cp1251-expected.txt new file mode 100644 index 0000000..cafd2d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/location.sub_encoding=x-cp1251-expected.txt
@@ -0,0 +1,8 @@ +This is a testharness.js-based test. +FAIL location [PutForwards] assert_equals: expected "?&%23255;" but got "?%26%23255%3B" +FAIL location.assign() assert_equals: expected "?&%23255;" but got "?%26%23255%3B" +FAIL location.replace() assert_equals: expected "?&%23255;" but got "?%26%23255%3B" +FAIL location.href assert_equals: expected "?&%23255;" but got "?%26%23255%3B" +FAIL location.search assert_equals: expected "?&%23255;" but got "?%C3%BF" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js index 769b41b..0d14fe70 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js +++ b/third_party/WebKit/LayoutTests/external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js
@@ -1,3 +1,6 @@ +// NOTE: this file needs to be split up rather than expanded. See ../location.sub.html for some +// extracted tests. Tracked by https://github.com/w3c/web-platform-tests/issues/4934. + setup({explicit_done:true}); onload = function() { var encoding = '{{GET[encoding]}}'; @@ -35,7 +38,7 @@ // page and the test timing out test_obj.force_timeout(); } - step_timeout(poll, 200); + test_obj.step_timeout(poll, 200); } else { assert_equals(xhr.response, expected); test_obj.done(); @@ -43,7 +46,7 @@ }); xhr.send(); }) - step_timeout(poll, 200); + test_obj.step_timeout(poll, 200); } // background attribute, check with getComputedStyle @@ -505,55 +508,6 @@ }, 'window.open()', {help:'https://html.spec.whatwg.org/multipage/#dom-open'}); - // location - function test_location(func, desc) { - async_test(function() { - var iframe = document.createElement('iframe'); - document.body.appendChild(iframe); - this.add_cleanup(function() { - document.body.removeChild(iframe); - }); - func(iframe.contentWindow, input_url_html); - iframe.onload = this.step_func(function() { - var got = iframe.contentDocument.body.textContent; - if (got != '') { - assert_equals(got, expected_current); - this.done(); - } - }); - }, desc, - {help:'https://html.spec.whatwg.org/multipage/#the-location-interface'}); - } - [[function(win, input) { win.location = input; }, "location [PutForwards]"], - [function(win, input) { win.location.assign(input); }, "location.assign()"], - [function(win, input) { win.location.replace(input); }, "location.replace()"], - [function(win, input) { win.location.href = input; }, "location.href"]].forEach(function(arr) { - test_location(arr[0], arr[1]); - }); - - // location.search - async_test(function() { - var iframe = document.createElement('iframe'); - iframe.src = input_url_html; - document.body.appendChild(iframe); - this.add_cleanup(function() { - document.body.removeChild(iframe); - }); - var i = 0; - iframe.onload = this.step_func(function() { - i++; - if (i == 1) { - iframe.contentWindow.location.search = '?' + input_url_html.split('?')[1] + '&other=foobar'; - } else { - var got = iframe.contentDocument.body.textContent; - assert_equals(got, expected_current); - this.done(); - } - }); - }, 'location.search', - {help:['https://html.spec.whatwg.org/multipage/#the-location-interface', - 'http://url.spec.whatwg.org/#dom-url-search']}); - // a.search, area.search function test_hyperlink_search(tag) { test(function() {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-source/generate-config-change-tests.py b/third_party/WebKit/LayoutTests/external/wpt/media-source/generate-config-change-tests.py index 4edb925b..6ab2c8b 100755 --- a/third_party/WebKit/LayoutTests/external/wpt/media-source/generate-config-change-tests.py +++ b/third_party/WebKit/LayoutTests/external/wpt/media-source/generate-config-change-tests.py
@@ -83,7 +83,6 @@ <script src="/w3c/resources/testharnessreport.js"></script> <script src="mediasource-util.js"></script> <script src="mediasource-config-changes.js"></script> - <link rel="stylesheet" href="/w3c/resources/testharness.css"> </head> <body> <div id="log"></div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_minimize-manual.html b/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_minimize-manual.html index 28e8486..27fd0d7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_minimize-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_minimize-manual.html
@@ -5,6 +5,7 @@ <title>Page Visibility API Operation While Minimizing Browser Window</title> <meta name="flags" content="interact" /> <script type="text/javascript" src="/resources/testharness.js"></script> + <script type="text/javascript" src="/resources/testharnessreport.js"></script> <script type="text/javascript" src="resources/pagevistestharness.js"></script> </head>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_tab_state_change-manual.html b/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_tab_state_change-manual.html index c701e50..75d1da6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_tab_state_change-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/page-visibility/test_tab_state_change-manual.html
@@ -5,6 +5,7 @@ <title>Page Visibility API Operation While Changing Tabs</title> <meta name="flags" content="interact" /> <script type="text/javascript" src="/resources/testharness.js"></script> + <script type="text/javascript" src="/resources/testharnessreport.js"></script> <script type="text/javascript" src="resources/pagevistestharness.js"></script> </head>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/app-can-make-payment.js b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/app-can-make-payment.js index beec328..0bb9490 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/app-can-make-payment.js +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/app-can-make-payment.js
@@ -76,9 +76,9 @@ } const methodAsURL = new URL(methodName); - if (event.topLevelOrigin !== methodAsURL.origin) { - const msg = `Unexpected event.topLevelOrigin: "${ - event.topLevelOrigin + if (event.topOrigin !== methodAsURL.origin) { + const msg = `Unexpected event.topOrigin: "${ + event.topOrigin }". Expected "${methodAsURL.origin}".`; event.respondWith(Promise.reject(new Error(msg))); return;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/can-make-payment-event-constructor.https.worker.js b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/can-make-payment-event-constructor.https.worker.js index 06af7de..8ae05d7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/payment-handler/can-make-payment-event-constructor.https.worker.js +++ b/third_party/WebKit/LayoutTests/external/wpt/payment-handler/can-make-payment-event-constructor.https.worker.js
@@ -30,13 +30,13 @@ test(() => { const ev = new CanMakePaymentEvent('test', { - topLevelOrigin: 'https://foo.com', + topOrigin: 'https://foo.com', paymentRequestOrigin: 'https://bar.com', methodData: [], modifiers: [], }); assert_false(ev.isTrusted, 'constructed in script, so not be trusted'); - assert_equals(ev.topLevelOrigin, 'https://foo.com'); + assert_equals(ev.topOrigin, 'https://foo.com'); assert_equals(ev.paymentRequestOrigin, 'https://bar.com'); }, 'CanMakePaymentEvent can be constructed with a CanMakePaymentEventInit, even if not trusted');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual.html new file mode 100644 index 0000000..62a0a6d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual.html
@@ -0,0 +1,81 @@ +<!doctype html> +<html> + <head> + <title>Pointer Event: Boundary event sequence at implicit capture release</title> + <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> + <link rel="author" title="Google" href="http://www.google.com "/> + <meta name="assert" content="When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event."/> + <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript" src="pointerevent_support.js"></script> + <script type="text/javascript"> + var detected_pointertypes = {}; + var event_log = []; + var start_logging = false; + + function resetTestState() { + detected_eventTypes = {}; + event_log = []; + start_logging = false; + } + + function run() { + var test_pointer_event = setup_pointerevent_test("Event sequence at implicit release on click", ["mouse"]); + + var target = document.getElementById("target"); + var capture_target = document.getElementById("capture-target"); + + All_Pointer_Events.forEach(function(eventName) { + on_event(target, eventName, function (event) { + detected_pointertypes[event.pointerType] = true; + + if (event.type == "pointerdown") { + capture_target.setPointerCapture(event.pointerId); + start_logging = true; + } else if (start_logging) { + event_log.push(event.type + '@' + event.target.id); + } + }); + + on_event(capture_target, eventName, function (event) { + detected_pointertypes[event.pointerType] = true; + event_log.push(event.type + '@' + event.target.id); + if (event.type == 'lostpointercapture') { + setTimeout(function() { + test_pointer_event.step(function () { + var expected_events = "pointerup, lostpointercapture, pointerout, pointerleave"; + assert_equals(event_log.join(", "), "pointerout@target, pointerleave@target, pointerover@capture-target, pointerenter@capture-target, gotpointercapture@capture-target, pointerup@capture-target, lostpointercapture@capture-target, pointerout@capture-target, pointerleave@capture-target, pointerover@target, pointerenter@target"); + }); + test_pointer_event.done(); + }, 200); + } + }); + }); + } + </script> + <style> + #target { + margin: 20px; + background-color: black; + } + </style> + </head> + <body onload="run()"> + <h1>Pointer Event: Boundary event sequence at implicit capture release</h1> + <h2 id="pointerTypeDescription"></h2> + <h4> + When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event. + </h4> + <ol> + <li>Click on the black box with mouse and do not move the mouse after or during the click.</li> + </ol> + <div id="capture-target"></div> + <div id="target"></div> + <div id="complete-notice"> + <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p> + <p>The following events were logged: <span id="event-log"></span>.</p> + </div> + <div id="log"></div> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_basic-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_basic-manual.html index c058d24..083b707 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_basic-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_basic-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> #status-log { margin: 10px 0;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_no-jumps-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_no-jumps-manual.html index 9c8fabd..11b8d2a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_no-jumps-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/movementX_Y_no-jumps-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> #status-log { margin: 10px 0;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_basic-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_basic-manual.html index d926318a..141b349 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_basic-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_basic-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> button { color: blue;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_fullscreen-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_fullscreen-manual.html index 7ce91ad..19f4cbe 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_fullscreen-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_fullscreen-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> button { color: blue;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_indefinite-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_indefinite-manual.html index 0db1227a..96d5f94 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_indefinite-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_indefinite-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> button { color: blue;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_Tab-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_Tab-manual.html index 198e2fe..f32c71ab 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_Tab-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_Tab-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> button { color: blue;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_UA-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_UA-manual.html index e1440084..8373a345 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_UA-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_leave_UA-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> button { color: blue;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_remove_target-manual.html b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_remove_target-manual.html index 2103650..a38b06e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_remove_target-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/pointerlock/pointerlock_remove_target-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <style type="text/css"> button { color: blue;
diff --git a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html index 84971cb..9b75a85e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnectionList_onconnectionavailable-manual.https.html
@@ -3,7 +3,6 @@ <title>Monitoring incoming presentation connections</title> <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs"> <link rel="help" href="https://w3c.github.io/presentation-api/#monitoring-incoming-presentation-connections"> -<link rel="stylesheet" href="/resources/testharness.css"> <script src="common.js"></script> <script src="support/stash.js"></script> <style> @@ -75,4 +74,4 @@ connection.terminate(); }); }; -</script> \ No newline at end of file +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html index d6baad1..50585f781 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onclose-manual.https.html
@@ -3,7 +3,6 @@ <title>Closing a PresentationConnection</title> <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs"> <link rel="help" href="https://w3c.github.io/presentation-api/#closing-a-presentationconnection"> -<link rel="stylesheet" href="/resources/testharness.css"> <script src="common.js"></script> <script src="support/stash.js"></script> <style> @@ -82,4 +81,4 @@ connection.terminate(); }); }; -</script> \ No newline at end of file +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html index 4b05cdc..53451a6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/PresentationConnection_onmessage-manual.https.html
@@ -3,7 +3,6 @@ <title>Receiving a message through PresentationConnection</title> <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs/"> <link rel="help" href="http://w3c.github.io/presentation-api/#receiving-a-message-through-presentationconnection"> -<link rel="stylesheet" href="/resources/testharness.css"> <script src="common.js"></script> <script src="support/stash.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/idlharness-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/idlharness-manual.https.html index 079bb094..c7bd734 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/idlharness-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/presentation-api/receiving-ua/idlharness-manual.https.html
@@ -3,7 +3,6 @@ <title>Presentation API IDL tests for Receiving User Agent</title> <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs"> <link rel="help" href="http://w3c.github.io/presentation-api/#dfn-receiving-user-agent"> -<link rel="stylesheet" href="/resources/testharness.css"> <script src="common.js"></script> <script src="support/stash.js"></script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/resources/readme.md b/third_party/WebKit/LayoutTests/external/wpt/resources/readme.md index 8cf95b4..97d2e6f 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/resources/readme.md +++ b/third_party/WebKit/LayoutTests/external/wpt/resources/readme.md
@@ -18,7 +18,7 @@ ### Full documentation -For detailed API documentation please visit [http://web-platform-tests.org/writing-tests/testharness-api.html](http://web-platform-tests.org/writing-tests/testharness-api.html). +For detailed API documentation please visit [https://web-platform-tests.org/writing-tests/testharness-api.html](https://web-platform-tests.org/writing-tests/testharness-api.html). ### Tutorials
diff --git a/third_party/WebKit/LayoutTests/external/wpt/resources/testharness.js b/third_party/WebKit/LayoutTests/external/wpt/resources/testharness.js index 39a467c3..f37d059 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/resources/testharness.js +++ b/third_party/WebKit/LayoutTests/external/wpt/resources/testharness.js
@@ -10,7 +10,7 @@ [3] http://www.w3.org/2004/10/27-testcases */ -/* Documentation: http://web-platform-tests.org/writing-tests/testharness-api.html +/* Documentation: https://web-platform-tests.org/writing-tests/testharness-api.html * (../docs/_writing-tests/testharness-api.md) */ (function (global_scope)
diff --git a/third_party/WebKit/LayoutTests/external/wpt/screen-orientation/page-visibility-manual.html b/third_party/WebKit/LayoutTests/external/wpt/screen-orientation/page-visibility-manual.html index 95633ba..cc632792 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/screen-orientation/page-visibility-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/screen-orientation/page-visibility-manual.html
@@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <body> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='interact'> -<meta name="timeout" content="long"> <p>Switch the page to background, then switch back in a minute.</p> <iframe src='about:blank'></iframe> <script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_ArrayBuffer-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_ArrayBuffer-manual.https.html index 89dbff0..8d12e42 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_ArrayBuffer-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_ArrayBuffer-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push ArrayBuffer message</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_DOMString-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_DOMString-manual.https.html index 9782f67b..a6c3df8 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_DOMString-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_push_DOMString-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push DOMString message</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_empty-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_empty-manual.https.html index a213537..213d6fe 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_empty-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_empty-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push and watch empty records</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_json-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_json-manual.https.html index 883bbe731..6a0129ef 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_json-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_json-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push and watch json records</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_opaque-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_opaque-manual.https.html index 81e9ec1..8035a30 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_opaque-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_opaque-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push and watch opaque records</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_text-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_text-manual.https.html index 279bd663..9b0ee27 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_text-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_text-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push and watch text records</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_url-manual.https.html b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_url-manual.https.html index 70f9823..b2e1cfef 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_url-manual.https.html +++ b/third_party/WebKit/LayoutTests/external/wpt/web-nfc/nfc_recordType_url-manual.https.html
@@ -3,11 +3,11 @@ <title>Web NFC Test: push and watch url records</title> <link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/> +<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/nfc_help.js"></script> <meta name="flags" content="interact"> -<meta name="timeout" content="long"> <p>Tap an NFC tag to the test device with NFC support.</p>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webaudio/js/helpers.js b/third_party/WebKit/LayoutTests/external/wpt/webaudio/js/helpers.js index 650d25c..fbbfc8e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/webaudio/js/helpers.js +++ b/third_party/WebKit/LayoutTests/external/wpt/webaudio/js/helpers.js
@@ -5,7 +5,7 @@ function trimEmptyElements(array) { var start = 0; var end = array.length; - + while (start < array.length) { if (array[start] !== 0) { break; @@ -115,7 +115,7 @@ * + skipOfflineContextTests: optional. when true, skips running tests on an offline * context by circumventing testOnOfflineContext. * - * [0]: http://web-platform-tests.org/writing-tests/testharness-api.html#single-page-tests + * [0]: https://web-platform-tests.org/writing-tests/testharness-api.html#single-page-tests */ function runTest(name) {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb.dedicatedworker.sharedworker.js b/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb.dedicatedworker.sharedworker.js new file mode 100644 index 0000000..61ee0a58 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb.dedicatedworker.sharedworker.js
@@ -0,0 +1,13 @@ +'use strict'; +importScripts('/resources/testharness.js'); + +test(() => { + assert_true(navigator.usb instanceof USB, + 'navigator.usb should be defined as a USB object'); + assert_true(navigator.usb.getDevices instanceof Function, + 'navigator.usb.getDevices should be defined as a function'); + assert_equals(typeof navigator.usb.requestDevice, 'undefined', + 'navigator.usb.requestDevice should not be defined'); +}, 'Web workers should have the WebUSB API exposed as defined in the spec.'); + +done(); \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb.serviceworker.js b/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb.serviceworker.js new file mode 100644 index 0000000..c509adfe --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/resources/usb.serviceworker.js
@@ -0,0 +1,9 @@ +'use strict'; +importScripts('/resources/testharness.js'); + +test(() => { + assert_equals(typeof navigator.usb, 'undefined', + 'navigator.usb should not be a USB object'); +}, 'Service workers should not have access to the WebUSB API.'); + +done(); \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.dedicatedworker.https.html b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.dedicatedworker.https.html new file mode 100644 index 0000000..e3a0f985 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.dedicatedworker.https.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +'use strict'; + +fetch_tests_from_worker(new Worker( + '/webusb/resources/usb.dedicatedworker.sharedworker.js')); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.serviceworker.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.serviceworker.https-expected.txt new file mode 100644 index 0000000..011ed2a1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.serviceworker.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +PASS Ensure that WebUSB is inaccessible from a service worker. +FAIL Service workers should not have access to the WebUSB API. assert_equals: navigator.usb should not be a USB object expected "undefined" but got "object" +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.serviceworker.https.html b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.serviceworker.https.html new file mode 100644 index 0000000..a5600e3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.serviceworker.https.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script> +<div id="log"></div> +<script> +'use strict'; + +service_worker_test('/webusb/resources/usb.serviceworker.js', + 'Ensure that WebUSB is inaccessible from a service worker.'); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.sharedworker.https.html b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.sharedworker.https.html new file mode 100644 index 0000000..5779b7fe --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/worker/usb.sharedworker.https.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +'use strict'; + +fetch_tests_from_worker(new SharedWorker( + '/webusb/resources/usb.dedicatedworker.sharedworker.js')); + +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-denied.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-denied.htm index 3bcd251..535762d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-denied.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-denied.htm
@@ -22,12 +22,8 @@ const xhr = new XMLHttpRequest; xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + path, false); - try { - xhr.send(); - assert_unreached("Error should occur here"); - } catch(e) { - assert_equals(xhr.status, 0); - } + assert_throws("NetworkError", () => xhr.send()); + assert_equals(xhr.status, 0); }, "Cross-origin request denied"); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-get-fail-non-simple.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-get-fail-non-simple.htm index 38f7a34..a4fe234 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-get-fail-non-simple.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-get-fail-non-simple.htm
@@ -18,13 +18,8 @@ xhr.setRequestHeader("x-test", "foobar"); // This fails because the server-side script is not prepared for an OPTIONS request - try { - xhr.send(); - } catch(e) { - assert_equals(xhr.status, 0); - return; - } - assert_unreached("Preflighted request was not denied."); + assert_throws("NetworkError", () => xhr.send()); + assert_equals(xhr.status, 0); }, "Preflighted cross-origin request denied"); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-non-cors-safelisted-content-type.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-non-cors-safelisted-content-type.htm index b1cf9c8a..062f8b0 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-non-cors-safelisted-content-type.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-non-cors-safelisted-content-type.htm
@@ -22,13 +22,8 @@ "/xhr/resources/access-control-basic-put-allow.py", false); xhr.setRequestHeader("Content-Type", "application/xml"); - try { - xhr.send("FAIL: PUT data received"); - } catch(e) { - assert_equals(xhr.status, 0, "Cross-domain access was denied in 'send'."); - return; - } - assert_unreached("Cross-domain access was not denied in 'send'."); + assert_throws("NetworkError", () => xhr.send("FAIL: PUT data received")); + assert_equals(xhr.status, 0, "Cross-domain access was denied in 'send'."); }, "Deny cross-origin request with non-CORS-safelisted content type"); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-post-with-non-cors-safelisted-content-type.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-post-with-non-cors-safelisted-content-type.htm index 9b3bc54..0a6df93 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-post-with-non-cors-safelisted-content-type.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-basic-post-with-non-cors-safelisted-content-type.htm
@@ -29,13 +29,8 @@ xhr.setRequestHeader("Content-Type", "application/xml"); - try { - xhr.send(); - } catch(e) { - assert_equals(xhr.status, 0, "Cross-domain access was denied in 'send'."); - return; - } - assert_unreached("Cross-domain access was not denied in 'send'."); + assert_throws("NetworkError", () => xhr.send()); + assert_equals(xhr.status, 0, "Cross-domain access was denied in 'send'."); }, "CORS request with non-safelisted content type sends preflight and fails"); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-header-denied.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-header-denied.htm index f400985b..7948c18 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-header-denied.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-header-denied.htm
@@ -22,17 +22,12 @@ xhr.open("GET", url + "&command=header", false); xhr.setRequestHeader("x-test", "foo"); - try { - xhr.send(); - } catch(e) { - xhr = new XMLHttpRequest; - xhr.open("GET", url + "&command=complete", false); - xhr.send(); - assert_equals(xhr.responseText, "Request successfully blocked."); - return; - } + assert_throws("NetworkError", () => xhr.send()); - assert_unreached("Cross-domain access with custom header allowed without throwing exception"); + xhr = new XMLHttpRequest; + xhr.open("GET", url + "&command=complete", false); + xhr.send(); + assert_equals(xhr.responseText, "Request successfully blocked."); }, "Sync request denied at preflight"); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-method-denied.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-method-denied.htm index 021f9e37..a54c308 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-method-denied.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-method-denied.htm
@@ -21,17 +21,12 @@ xhr = new XMLHttpRequest; xhr.open("DELETE", url + "&command=method", false); - try { - xhr.send(); - } catch(e) { - xhr = new XMLHttpRequest; - xhr.open("GET", url + "&command=complete", false); - xhr.send(); - assert_equals(xhr.responseText, "Request successfully blocked."); - return; - } + assert_throws("NetworkError", () => xhr.send()); - assert_unreached("Cross-domain access with non-CORS-safelisted method allowed without throwing exception"); + xhr = new XMLHttpRequest; + xhr.open("GET", url + "&command=complete", false); + xhr.send(); + assert_equals(xhr.responseText, "Request successfully blocked."); }); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-not-supported.htm b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-not-supported.htm index c5ff94bc..bb08296 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-not-supported.htm +++ b/third_party/WebKit/LayoutTests/external/wpt/xhr/access-control-preflight-sync-not-supported.htm
@@ -21,17 +21,12 @@ xhr = new XMLHttpRequest; xhr.open("PUT", url, false); - try { - xhr.send(""); - } catch(e) { - xhr = new XMLHttpRequest; - xhr.open("GET", url + "&command=complete", false); - xhr.send(); - assert_equals(xhr.responseText, "Request successfully blocked."); - return; - } + assert_throws("NetworkError", () => xhr.send("")); - assert_unreached("Cross-domain access allowed without throwing exception"); + xhr = new XMLHttpRequest; + xhr.open("GET", url + "&command=complete", false); + xhr.send(); + assert_equals(xhr.responseText, "Request successfully blocked."); }); </script> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual-automation.js b/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual-automation.js new file mode 100644 index 0000000..cb7c7ae1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_boundary_events_at_implicit_release_hoverable_pointers-manual-automation.js
@@ -0,0 +1,5 @@ +importAutomationScript('/pointerevents/pointerevent_common_input.js'); + +function inject_input() { + return mouseClickInTarget('#target'); +}
diff --git a/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt index 1734da9..eebe3da3 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt
@@ -33,15 +33,15 @@ PASS walker.nextNode(); walker.currentNode.id is 'B1' Testing with object lacking acceptNode property -PASS walker.firstChild(); threw exception TypeError: Failed to execute 'firstChild' on 'TreeWalker': NodeFilter object does not have an acceptNode function. +PASS walker.firstChild(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable.. PASS walker.currentNode.id; is 'root' -PASS walker.nextNode(); threw exception TypeError: Failed to execute 'nextNode' on 'TreeWalker': NodeFilter object does not have an acceptNode function. +PASS walker.nextNode(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable.. PASS walker.currentNode.id; is 'root' Testing with object with non-function acceptNode property -PASS walker.firstChild(); threw exception TypeError: Failed to execute 'firstChild' on 'TreeWalker': NodeFilter object does not have an acceptNode function. +PASS walker.firstChild(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable.. PASS walker.currentNode.id; is 'root' -PASS walker.nextNode(); threw exception TypeError: Failed to execute 'nextNode' on 'TreeWalker': NodeFilter object does not have an acceptNode function. +PASS walker.nextNode(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable.. PASS walker.currentNode.id; is 'root' Testing with function having acceptNode function
diff --git a/third_party/WebKit/LayoutTests/fast/dom/node-filter-gc.html b/third_party/WebKit/LayoutTests/fast/dom/node-filter-gc.html index 2821f9c..d08b002 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/node-filter-gc.html +++ b/third_party/WebKit/LayoutTests/fast/dom/node-filter-gc.html
@@ -6,15 +6,15 @@ testRunner.dumpAsText(); var filter = { acceptNode: function(node) { return true; } }; -var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, 0, false); -var walker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, 0, false); +var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, null); +var walker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, null); // test that garbage collecting a node iterator or a tree walker without a // filter doesn't crash. gc(); // test that iterator keeps its filter alive -iterator = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, filter, false); +iterator = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, filter); filter = null; shouldBeUndefined("iterator.filter.foo"); iterator.filter.foo = 42; @@ -24,7 +24,7 @@ // test that walker keeps its filter alive filter = { acceptNode: function(node) { return true; } }; -walker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, filter, false); +walker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, filter); shouldBeUndefined("walker.filter.foo"); filter = null; walker.filter.foo = 42;
diff --git a/third_party/WebKit/LayoutTests/fast/dom/node-filter-use-counters.html b/third_party/WebKit/LayoutTests/fast/dom/node-filter-use-counters.html index 73854fb..592d441 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/node-filter-use-counters.html +++ b/third_party/WebKit/LayoutTests/fast/dom/node-filter-use-counters.html
@@ -10,13 +10,13 @@ var filterCalled = false; var filter = function() { - assert_true(internals.isUseCounted(document, NodeFilterIsFunction)); filter.called = true; }; var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, filter); iterator.nextNode(); assert_true(filter.called); + assert_true(internals.isUseCounted(document, NodeFilterIsFunction)); }, 'NodeFilter UseCounter for callback function'); test(function() { @@ -25,9 +25,7 @@ assert_false(internals.isUseCounted(document, NodeFilterIsObject)); var filter = { - acceptNodeCalled: false, acceptNode: function() { - assert_true(internals.isUseCounted(document, NodeFilterIsObject)); filter.called = true; } }; @@ -35,5 +33,6 @@ var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, filter); iterator.nextNode(); assert_true(filter.called); + assert_true(internals.isUseCounted(document, NodeFilterIsObject)); }, 'NodeFilter UseCounter for callback function'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-capture-expected.txt b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-capture-expected.txt index 3b76bf3..5f6372d 100644 --- a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-capture-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-capture-expected.txt
@@ -41,7 +41,6 @@ green received mouseup green received lostpointercapture Capture pointer event attributes are correct! - **** Jiggle in blue box ***** green received pointerout green received pointerleave grey received pointerleave @@ -52,6 +51,7 @@ grey received mouseleave blue received mouseover blue received mouseenter + **** Jiggle in blue box ***** blue received pointermove blue received mousemove **** Move to (0,0) *****
diff --git a/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line-expected.html b/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line-expected.html index 2950ab7..e6b74ef 100644 --- a/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line-expected.html +++ b/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line-expected.html
@@ -1,6 +1,8 @@ <!DOCTYPE html> <style> +p { + font-family: Ahem; + line-height: 2; +} </style> -<p>THIS IS A SOMEWHAT<br>long HTML<br>paragraph.</p> -<script> - +<p>PPPP PP P PPPPPPPP<br>pppp PPPP<br>pppppppppppp</p>
diff --git a/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line.html b/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line.html index 204eca8..e4eb88c 100644 --- a/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line.html +++ b/third_party/WebKit/LayoutTests/fast/text/transform-text-first-line.html
@@ -1,7 +1,10 @@ <!DOCTYPE html> <style> -p { width: 140px } +p { + font-family: Ahem; + line-height: 2; + width: 20ch; +} p::first-line { text-transform: uppercase; } </style> -<p>This is a somewhat long HTML paragraph.</p> - +<p>Pppp pp p pppppppp pppp PPPP pppppppppppp</p>
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/svg/animate-fill-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/svg/animate-fill-expected.txt index 63a69b11..215b551 100644 --- a/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/svg/animate-fill-expected.txt +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-slimming-paint-v2/paint/invalidation/svg/animate-fill-expected.txt
@@ -17,7 +17,7 @@ "objectPaintInvalidations": [ { "object": "LayoutSVGRect rect id='rect'", - "reason": "SVG resource change" + "reason": "style change" } ] }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-child-node-count-mismatch-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-child-node-count-mismatch-expected.txt new file mode 100644 index 0000000..225d048 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-child-node-count-mismatch-expected.txt
@@ -0,0 +1,7 @@ +Tests that Elements properly populate and select after immediate updates crbug.com/829884 + +BEFORE: children: null, childNodeCount: 2 +AFTER: children: null, childNodeCount: 3 +AFTER EXPAND: TreeElement childCount: 3 +Selected element:'BODY' +
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-child-node-count-mismatch.js b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-child-node-count-mismatch.js new file mode 100644 index 0000000..334aed30 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-child-node-count-mismatch.js
@@ -0,0 +1,43 @@ +// 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. + +(async function() { + TestRunner.addResult(`Tests that Elements properly populate and select after immediate updates crbug.com/829884\n`); + await TestRunner.loadModule('elements_test_runner'); + await TestRunner.showPanel('elements'); + await TestRunner.loadHTML(` + <!DOCTYPE HTML"> + <html> + <head></head> + <body id="body"> + <div>FooBar1</div> + <div>FooBar2</div> + </body> + </html> + `); + + const treeOutline = ElementsTestRunner.firstElementsTreeOutline(); + ElementsTestRunner.selectNodeWithId('body', node => { + TestRunner.addResult(`BEFORE: children: ${node.children()}, childNodeCount: ${node.childNodeCount()}`); + + // Any operation that modifies the node, followed by an immediate, synchronous update. + TestRunner.domModel._childNodeCountUpdated(node.id, 3); + treeOutline._updateModifiedNodes(); + + TestRunner.addResult(`AFTER: children: ${node.children()}, childNodeCount: ${node.childNodeCount()}`); + ElementsTestRunner.expandElementsTree(afterExpand); + }); + + function afterExpand() { + ElementsTestRunner.selectNodeWithId('body', node => { + treeElement = node[treeOutline.treeElementSymbol()]; + TestRunner.addResult(`AFTER EXPAND: TreeElement childCount: ${treeElement.childCount()}`); + + var selectedElement = treeOutline.selectedTreeElement; + var nodeName = selectedElement ? selectedElement.node().nodeName() : 'null'; + TestRunner.addResult('Selected element:\'' + nodeName + '\''); + TestRunner.completeTest(); + }); + } +})();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expected.txt index c952a0a3..a25c5f77 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expected.txt
@@ -2,7 +2,7 @@ * http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg failed: false - statusCode: 302 + statusCode: 200 * https://www.127.0.0.1/test.html failed: false statusCode: 200
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expired-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expired-expected.txt index ddee6b5..3e60528 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expired-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-navigation-expired-expected.txt
@@ -4,5 +4,5 @@ inspected-page.html:1 Failed to verify the signed exchange header. * http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg failed: true - statusCode: 0 + statusCode: 200
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expected.txt index 2ecbba1f..f941f89 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expected.txt
@@ -2,7 +2,7 @@ * http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg failed: false - statusCode: 302 + statusCode: 200 * https://www.127.0.0.1/test.html failed: false statusCode: 200
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expired-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expired-expected.txt index e09f49a9..e1a5cc2 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expired-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/htxg/htxg-prefetch-expired-expected.txt
@@ -2,5 +2,5 @@ * http://127.0.0.1:8000/loading/htxg/resources/htxg-location.htxg failed: true - statusCode: 0 + statusCode: 200
diff --git a/third_party/WebKit/LayoutTests/http/tests/locks/ifAvailable.html b/third_party/WebKit/LayoutTests/http/tests/locks/ifAvailable.html index 36e1f52a..ee190b2b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/locks/ifAvailable.html +++ b/third_party/WebKit/LayoutTests/http/tests/locks/ifAvailable.html
@@ -4,12 +4,14 @@ <link rel=help href="https://github.com/inexorabletash/web-locks"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="resources/helpers.js"></script> <script> 'use strict'; promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', {ifAvailable: true}, async lock => { + await navigator.locks.request(res, {ifAvailable: true}, async lock => { callback_called = true; assert_not_equals(lock, null, 'lock should be granted'); }); @@ -17,11 +19,12 @@ }, 'Lock request with ifAvailable - lock available'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', async lock => { + await navigator.locks.request(res, async lock => { // Request would time out if |ifAvailable| was not specified. const result = await navigator.locks.request( - 'resource', {ifAvailable: true}, async lock => { + res, {ifAvailable: true}, async lock => { callback_called = true; assert_equals(lock, null, 'lock should not be granted'); return 123; @@ -32,11 +35,12 @@ }, 'Lock request with ifAvailable - lock not available'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', async lock => { + await navigator.locks.request(res, async lock => { try { // Request would time out if |ifAvailable| was not specified. - await navigator.locks.request('resource', {ifAvailable: true}, async lock => { + await navigator.locks.request(res, {ifAvailable: true}, async lock => { callback_called = true; assert_equals(lock, null, 'lock should not be granted'); throw 123; @@ -50,8 +54,9 @@ }, 'Lock request with ifAvailable - lock not available, callback throws'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', async lock => { + await navigator.locks.request(res, async lock => { // Request with a different name - should be grantable. await navigator.locks.request('different', {ifAvailable: true}, async lock => { callback_called = true; @@ -62,10 +67,11 @@ }, 'Lock request with ifAvailable - unrelated lock held'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', {mode: 'shared'}, async lock => { + await navigator.locks.request(res, {mode: 'shared'}, async lock => { await navigator.locks.request( - 'resource', {mode: 'shared', ifAvailable: true}, async lock => { + res, {mode: 'shared', ifAvailable: true}, async lock => { callback_called = true; assert_not_equals(lock, null, 'lock should be granted'); }); @@ -74,10 +80,11 @@ }, 'Shared lock request with ifAvailable - shared lock held'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', {mode: 'shared'}, async lock => { + await navigator.locks.request(res, {mode: 'shared'}, async lock => { // Request would time out if |ifAvailable| was not specified. - await navigator.locks.request('resource', {ifAvailable: true}, async lock => { + await navigator.locks.request(res, {ifAvailable: true}, async lock => { callback_called = true; assert_equals(lock, null, 'lock should not be granted'); }); @@ -86,11 +93,12 @@ }, 'Exclusive lock request with ifAvailable - shared lock held'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', async lock => { + await navigator.locks.request(res, async lock => { // Request would time out if |ifAvailable| was not specified. await navigator.locks.request( - 'resource', {mode: 'shared', ifAvailable: true}, async lock => { + res, {mode: 'shared', ifAvailable: true}, async lock => { callback_called = true; assert_equals(lock, null, 'lock should not be granted'); }); @@ -99,12 +107,13 @@ }, 'Shared lock request with ifAvailable - exclusive lock held'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', async lock => { + await navigator.locks.request(res, async lock => { callback_called = true; const test_error = {name: 'test'}; const p = navigator.locks.request( - 'resource', {ifAvailable: true}, lock => { + res, {ifAvailable: true}, lock => { assert_equals(lock, null, 'lock should not be available'); throw test_error; }); @@ -115,12 +124,13 @@ }, 'Returned Promise rejects if callback throws synchronously'); promise_test(async t => { + const res = self.uniqueName(t); let callback_called = false; - await navigator.locks.request('resource', async lock => { + await navigator.locks.request(res, async lock => { callback_called = true; const test_error = {name: 'test'}; const p = navigator.locks.request( - 'resource', {ifAvailable: true}, async lock => { + res, {ifAvailable: true}, async lock => { assert_equals(lock, null, 'lock should not be available'); throw test_error; }); @@ -130,4 +140,30 @@ assert_true(callback_called, 'callback should be called'); }, 'Returned Promise rejects if async callback yields rejected promise'); +// Regression test for: https://crbug.com/840994 +promise_test(async t => { + const res1 = self.uniqueName(t); + const res2 = self.uniqueName(t); + let callback1_called = false; + await navigator.locks.request(res1, async lock => { + callback1_called = true; + let callback2_called = false; + await navigator.locks.request(res2, async lock => { + callback2_called = true; + }); + assert_true(callback2_called, 'callback2 should be called'); + + let callback3_called = false; + await navigator.locks.request(res2, {ifAvailable: true}, async lock => { + callback3_called = true; + // This request would fail if the "is this grantable?" test + // failed, e.g. due to the release without a pending request + // skipping steps. + assert_not_equals(lock, null, 'Lock should be available'); + }); + assert_true(callback3_called, 'callback2 should be called'); + }); + assert_true(callback1_called, 'callback1 should be called'); +}, 'Locks are available once previous release is processed'); + </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index f632228..320225e 100644 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -2599,6 +2599,7 @@ getter platform getter product getter storage + getter usb getter userAgent method constructor interface WritableStream
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/emulation/performance-return-real-time-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/performance-return-real-time-expected.txt new file mode 100644 index 0000000..645644c --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/performance-return-real-time-expected.txt
@@ -0,0 +1,5 @@ +Tests that perf metrics return real time even if there is a virtual time override in place. +Does real time advance? true. +Does virtual time advance? false. +Is script duration increased? true. +
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/emulation/performance-return-real-time.js b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/performance-return-real-time.js new file mode 100644 index 0000000..517d6d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/performance-return-real-time.js
@@ -0,0 +1,39 @@ +(async function(testRunner) { + let {page, session, dp} = await testRunner.startHTML(` + <script> + // Function returns true if the JavaScript time does advance during the + // computation. + function doesJavaScriptTimeAdvance() { + let event = new Event('test'); + let start = Date.now(); + addEventListener('test', () => { + let f = (x) => x > 1 ? f(x-1) + x : 1; + for (let x = 0; x < 100; x++) { f(1000); } + }, false); + dispatchEvent(event); + return Date.now() > start; + } + </script> + `, 'Tests that perf metrics return real time even if there is a virtual time override in place.'); + + let v = await session.evaluate("doesJavaScriptTimeAdvance()"); + testRunner.log(`Does real time advance? ${v}.`); + + await dp.Performance.enable(); + await dp.Emulation.setVirtualTimePolicy( + {policy: 'advance', initialVirtualTime: 1234567890}); + let before = await getScriptDuration(); + v = await session.evaluate("doesJavaScriptTimeAdvance()"); + testRunner.log(`Does virtual time advance? ${v}.`); + let after = await getScriptDuration(); + testRunner.log(`Is script duration increased? ${after > before}.`); + + async function getScriptDuration() { + const {result:{metrics}} = await dp.Performance.getMetrics(); + //testRunner.log(metrics); + const metric = metrics.find(metric => metric.name === "ScriptDuration"); + return metric.value; + } + + testRunner.completeTest(); +})
diff --git a/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html b/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html deleted file mode 100644 index ef4792c..0000000 --- a/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change-expected.html +++ /dev/null
@@ -1,35 +0,0 @@ -<!DOCTYPE html> -<style> - /* restrict to just the play button, so the slider doesn't mismatch */ - audio { - width: 40px; - height: 40px; - } -</style> -<script src="../resources/run-after-layout-and-paint.js"></script> -<script src=media-file.js></script> -<script src=media-controls.js></script> -<script> - -testRunner.waitUntilDone(); - -function test() { - var audios = document.querySelectorAll("audio"); - audios.forEach(audio => { - enableTestMode(audio); - }); - var src = "content/empty.oga"; - document.getElementById("audio1").src = src; - - runAfterLayoutAndPaint(function() { - testRunner.notifyDone(); - }); -} -</script> - -<body onload="test()"> - <audio controls></audio> - <audio id="audio1" controls></audio> - <p>Test that network state transitions paint audio controls properly.</p> -</body> -
diff --git a/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change.html b/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change.html deleted file mode 100644 index dc200b7..0000000 --- a/third_party/WebKit/LayoutTests/media/controls-repaint-for-network-change.html +++ /dev/null
@@ -1,34 +0,0 @@ -<!DOCTYPE html> -<style> - /* restrict to just the play button, so the slider doesn't mismatch */ - audio { - width: 40px; - height: 40px; - } -</style> -<script src="../resources/run-after-layout-and-paint.js"></script> -<script src=media-file.js></script> -<script src=media-controls.js></script> - -<audio controls></audio> -<audio controls></audio> -<p>Test that network state transitions paint audio controls properly.</p> - -<script> - -testRunner.waitUntilDone(); - -var audios = document.querySelectorAll("audio"); -audios.forEach(audio => { - enableTestMode(audio); -}); - -runAfterLayoutAndPaint(function() { - // These will cause the play buttons to become enabled, and should - // also cause a repaint. - window.internals.setMediaElementNetworkState(audios[1], 2); - - testRunner.notifyDone(); -}); -</script> -
diff --git a/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt b/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt index c0dc8058..f9969a5 100644 --- a/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt +++ b/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt
@@ -5,7 +5,6 @@ PASS playAfterPlaybackStarted PASS playNotSupportedContent PASS playDecodeError -PASS playNetworkError PASS playWithErrorAlreadySet PASS playSrcChangedAfterError PASS playRaceWithSrcChangeError
diff --git a/third_party/WebKit/LayoutTests/media/media-play-promise.html b/third_party/WebKit/LayoutTests/media/media-play-promise.html index 9beb061..9deb1610 100644 --- a/third_party/WebKit/LayoutTests/media/media-play-promise.html +++ b/third_party/WebKit/LayoutTests/media/media-play-promise.html
@@ -2,6 +2,7 @@ <title>Test the play() behaviour with regards to the returned promise for media elements.</title> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="network-error.js"></script> <script> // This is testing the behavior of play() with regards to the returned // promise. This test file is creating a small framework in order to be able @@ -64,38 +65,36 @@ // This test doesn't test a spec behaviour but tests that the Blink // implementation properly changed after the spec changed. function playDecodeError(t, audio) { - audio.src = "content/test.oga"; + audio.src = "content/corrupt.webm"; audio.onerror = t.step_func(function() { assert_true(audio.error instanceof MediaError); assert_equals(audio.error.code, MediaError.MEDIA_ERR_DECODE); }); - // The setMediaElementNetworkState() method requires metadata to be available. - audio.onloadedmetadata = t.step_func(function() { - internals.setMediaElementNetworkState(audio, 6); // NetworkStateDecodeError. - playExpectingResolvedPromise(t, audio); - }); + playExpectingResolvedPromise(t, audio); }, // Test that play() returns a resolved promise if called after the // element suffered from a network error. // This test doesn't test a spec behaviour but tests that the Blink // implementation properly changed after the spec changed - function playNetworkError(t, audio) { - audio.src = "content/test.oga"; + // + // TODO(mlamouri): This test is disabled because the underlying behavior it + // is intended to test is actually broken. http://crbug.com/841063 + // + // function playNetworkError(t, audio) { + // audio.onerror = t.step_func(function() { + // assert_true(audio.error instanceof MediaError); + // assert_equals(audio.error.code, MediaError.MEDIA_ERR_NETWORK); + // }); - audio.onerror = t.step_func(function() { - assert_true(audio.error instanceof MediaError); - assert_equals(audio.error.code, MediaError.MEDIA_ERR_NETWORK); - }); + // audio.onloadedmetadata = t.step_func(function() { + // playExpectingResolvedPromise(t, audio); + // }); - // The setMediaElementNetworkState() method requires metadata to be available. - audio.onloadedmetadata = t.step_func(function() { - internals.setMediaElementNetworkState(audio, 5); // NetworkStateNetworkError. - playExpectingResolvedPromise(t, audio); - }); - }, + // generateNetworkError(audio); + // }, // Test that play() returns a rejected promise if the element is // sufferring from a not supported error.
diff --git a/third_party/WebKit/LayoutTests/media/network-error.js b/third_party/WebKit/LayoutTests/media/network-error.js new file mode 100644 index 0000000..4e8a929 --- /dev/null +++ b/third_party/WebKit/LayoutTests/media/network-error.js
@@ -0,0 +1,23 @@ +// 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. + +// Webm Opus init segment. Must be defined here since XHR can't be used to load +// local files; even in the layout test harness. +var OPUS_INIT_SEGMENT = "GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAH6xFNm3RALE27i1OrhBVJqWZTrIHlTbuMU6uEFlSua1OsggEhTbuMU6uEElTDZ1OsggGP7AEAAAAAAACqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAADAq17GDD0JATYCMTGF2ZjU4LjkuMTAwV0GMTGF2ZjU4LjkuMTAwRImIQGmAAAAAAAAWVK5rAQAAAAAAAGKuAQAAAAAAAFnXgQFzxYEBnIEAIrWcg3VuZIaGQV9PUFVTVqqDJiWgVruEBMS0AIOBAuEBAAAAAAAAEZ+BAbWIQOdwAAAAAABiZIEgY6KTT3B1c0hlYWQBAXgAgLsAAAAAABJUw2cBAAAAAAAAvHNzAQAAAAAAAC1jwAEAAAAAAAAAZ8gBAAAAAAAAGUWjh0VOQ09ERVJEh4xMYXZmNTguOS4xMDBzcwEAAAAAAAA3Y8ABAAAAAAAABGPFgQFnyAEAAAAAAAAfRaOHRU5DT0RFUkSHkkxhdmM1OC4xMi4xMDIgb3B1c3NzAQAAAAAAADpjwAEAAAAAAAAEY8WBAWfIAQAAAAAAACJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjIwNDAwMDAwMAAAH0O2dQEAAAAAAAWI54EAo/0="; + +// Uses Media Source Extensions to generate a Network Error using EndOfStream. +function generateNetworkError(element) { + var mediaSource = new MediaSource(); + mediaSource.addEventListener('sourceopen', function() { + sourceBuffer = mediaSource.addSourceBuffer('audio/webm; codecs="opus"'); + sourceBuffer.appendBuffer( + Uint8Array.from(window.atob(OPUS_INIT_SEGMENT), c => c.charCodeAt(0))); + }); + + element.addEventListener('loadedmetadata', function() { + mediaSource.endOfStream("network"); + }); + + element.src = window.URL.createObjectURL(mediaSource); +}
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animate-fill-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animate-fill-expected.txt index 8bd1473..ecfc5fa 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/animate-fill-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/animate-fill-expected.txt
@@ -28,7 +28,7 @@ "objectPaintInvalidations": [ { "object": "LayoutSVGRect rect id='rect'", - "reason": "SVG resource change" + "reason": "style change" } ] }
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt index e863f613..b2ef912 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/filter-refresh-expected.txt
@@ -250,7 +250,7 @@ }, { "object": "LayoutSVGRect rect id='separate2'", - "reason": "SVG resource change" + "reason": "style change" } ] }
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/svg/paintorder-filtered-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/svg/paintorder-filtered-expected.txt index fec53330..7a256bd 100644 --- a/third_party/WebKit/LayoutTests/paint/invalidation/svg/paintorder-filtered-expected.txt +++ b/third_party/WebKit/LayoutTests/paint/invalidation/svg/paintorder-filtered-expected.txt
@@ -25,12 +25,12 @@ { "object": "LayoutSVGContainer use id='t2'", "rect": [179, 160, 140, 140], - "reason": "SVG resource change" + "reason": "style change" }, { "object": "LayoutSVGContainer use id='t1'", "rect": [42, 160, 140, 140], - "reason": "SVG resource change" + "reason": "style change" }, { "object": "LayoutSVGViewportContainer svg", @@ -43,7 +43,7 @@ "objectPaintInvalidations": [ { "object": "LayoutSVGContainer use id='t1'", - "reason": "SVG resource change" + "reason": "style change" }, { "object": "LayoutSVGViewportContainer svg id='poly'", @@ -55,7 +55,7 @@ }, { "object": "LayoutSVGContainer use id='t2'", - "reason": "SVG resource change" + "reason": "style change" }, { "object": "LayoutSVGViewportContainer svg id='poly'",
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/svg/repaint-shadow-expected.png b/third_party/WebKit/LayoutTests/paint/invalidation/svg/repaint-shadow-expected.png similarity index 100% rename from third_party/WebKit/LayoutTests/platform/win/paint/invalidation/svg/repaint-shadow-expected.png rename to third_party/WebKit/LayoutTests/paint/invalidation/svg/repaint-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/animate-fill-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/animate-fill-expected.txt deleted file mode 100644 index ea2e28c..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/animate-fill-expected.txt +++ /dev/null
@@ -1,35 +0,0 @@ -{ - "layers": [ - { - "name": "LayoutView #document", - "bounds": [800, 600], - "drawsContent": false, - "backgroundColor": "#FFFFFF" - }, - { - "name": "Scrolling Layer", - "bounds": [800, 600], - "drawsContent": false - }, - { - "name": "Scrolling Contents Layer", - "bounds": [800, 600], - "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "paintInvalidations": [ - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [0, 0, 110, 110], - "reason": "SVG resource change" - } - ] - } - ], - "objectPaintInvalidations": [ - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "SVG resource change" - } - ] -} -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/filter-refresh-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/filter-refresh-expected.txt deleted file mode 100644 index bbe1a786..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/filter-refresh-expected.txt +++ /dev/null
@@ -1,470 +0,0 @@ -{ - "layers": [ - { - "name": "LayoutView #document", - "bounds": [800, 600], - "drawsContent": false, - "backgroundColor": "#FFFFFF" - }, - { - "name": "Scrolling Layer", - "bounds": [800, 600], - "drawsContent": false - }, - { - "name": "Scrolling Contents Layer", - "bounds": [800, 600], - "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "paintInvalidations": [ - { - "object": "LayoutSVGContainer g", - "rect": [10, 170, 132, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [10, 130, 132, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='separate2'", - "rect": [140, 140, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='filtered'", - "rect": [140, 100, 36, 36], - "reason": "subtree" - }, - { - "object": "LayoutSVGContainer g", - "rect": [140, 60, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [90, 170, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [90, 130, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [90, 90, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [90, 90, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [90, 50, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [90, 50, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [50, 170, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [50, 130, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [50, 90, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [50, 90, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [50, 50, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [50, 50, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [10, 90, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "rect": [10, 50, 36, 36], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='separate1'", - "rect": [140, 60, 30, 30], - "reason": "style change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 170, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 170, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 130, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 130, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 90, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 90, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 50, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [90, 50, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 170, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 170, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 130, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 130, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 90, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 90, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 50, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [50, 50, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 170, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 170, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 130, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 130, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 90, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 90, 30, 30], - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 50, 30, 30], - "reason": "appeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "rect": [10, 50, 30, 30], - "reason": "disappeared" - } - ] - } - ], - "objectPaintInvalidations": [ - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "disappeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='rect'", - "reason": "appeared" - }, - { - "object": "LayoutSVGContainer g", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGRect rect id='separate1'", - "reason": "style change" - }, - { - "object": "LayoutSVGRect rect id='filtered'", - "reason": "subtree" - }, - { - "object": "LayoutSVGRect rect id='separate2'", - "reason": "SVG resource change" - } - ] -} -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/paintorder-filtered-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/paintorder-filtered-expected.txt deleted file mode 100644 index b0ef29e7..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spv175/paint/invalidation/svg/paintorder-filtered-expected.txt +++ /dev/null
@@ -1,120 +0,0 @@ -{ - "layers": [ - { - "name": "LayoutView #document", - "bounds": [800, 600], - "drawsContent": false, - "backgroundColor": "#FFFFFF" - }, - { - "name": "Scrolling Layer", - "bounds": [800, 600], - "drawsContent": false - }, - { - "name": "Scrolling Contents Layer", - "bounds": [800, 600], - "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "paintInvalidations": [ - { - "object": "LayoutSVGPath polygon", - "rect": [168, 150, 164, 163], - "reason": "style change" - }, - { - "object": "LayoutSVGViewportContainer svg id='poly'", - "rect": [168, 150, 164, 163], - "reason": "style change" - }, - { - "object": "LayoutSVGPath polygon", - "rect": [441, 150, 163, 163], - "reason": "style change" - }, - { - "object": "LayoutSVGPath polygon id='t3'", - "rect": [305, 150, 163, 163], - "reason": "style change" - }, - { - "object": "LayoutSVGPath polygon", - "rect": [32, 150, 163, 163], - "reason": "style change" - }, - { - "object": "LayoutSVGViewportContainer svg id='poly'", - "rect": [32, 150, 163, 163], - "reason": "style change" - }, - { - "object": "LayoutSVGContainer use id='t2'", - "rect": [181, 163, 138, 137], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use", - "rect": [454, 163, 137, 137], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGViewportContainer svg", - "rect": [318, 163, 137, 137], - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGContainer use id='t1'", - "rect": [45, 163, 137, 137], - "reason": "SVG resource change" - } - ] - } - ], - "objectPaintInvalidations": [ - { - "object": "LayoutSVGContainer use id='t1'", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGViewportContainer svg id='poly'", - "reason": "style change" - }, - { - "object": "LayoutSVGPath polygon", - "reason": "style change" - }, - { - "object": "LayoutSVGContainer use id='t2'", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGViewportContainer svg id='poly'", - "reason": "style change" - }, - { - "object": "LayoutSVGPath polygon", - "reason": "style change" - }, - { - "object": "LayoutSVGViewportContainer svg", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGPath polygon id='t3'", - "reason": "style change" - }, - { - "object": "LayoutSVGContainer use", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGViewportContainer svg id='poly2'", - "reason": "SVG resource change" - }, - { - "object": "LayoutSVGPath polygon", - "reason": "style change" - } - ] -} -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..69192ad4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-layout-direction-expected.png new file mode 100644 index 0000000..faedbcf --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.png new file mode 100644 index 0000000..195d14e --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/controls-styling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-controls-clone-expected.png new file mode 100644 index 0000000..3e9bc90 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..3422961a --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/video-surface-layer/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/compositing/shadows/shadow-drawing-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/compositing/shadows/shadow-drawing-expected.png deleted file mode 100644 index 82d2e06..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/compositing/shadows/shadow-drawing-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/css/color-correction-on-text-shadow-expected.png deleted file mode 100644 index e85bf07..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/css/color-correction-on-text-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/css/shadow-multiple-expected.png deleted file mode 100644 index 4892da77..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/css/shadow-multiple-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/english-lr-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/english-lr-text-expected.png deleted file mode 100644 index 8487fbf..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/writing-mode/english-lr-text-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-002-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-002-expected.png deleted file mode 100644 index e31377054..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-002-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-003-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-003-expected.png deleted file mode 100644 index c6e92c675..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-003-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-004-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-004-expected.png deleted file mode 100644 index 332a999d3..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-004-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-010-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-010-expected.png deleted file mode 100644 index 06d6ee7..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/ietestcenter/css3/text/textshadow-010-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/audio-controls-rendering-expected.png deleted file mode 100644 index 329e06a..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/audio-controls-rendering-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/controls-layout-direction-expected.png deleted file mode 100644 index 9ef87ef6..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/controls-layout-direction-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/controls-styling-expected.png deleted file mode 100644 index 005d699..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/controls-styling-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/media-controls-clone-expected.png deleted file mode 100644 index 5b8fbd43..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/media-controls-clone-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/media-document-audio-repaint-expected.png deleted file mode 100644 index 0a12125b..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/media/media-document-audio-repaint-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/paint/invalidation/shadow-multiple-expected.png deleted file mode 100644 index 980f937..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/paint/invalidation/shadow-multiple-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/paint/printing/print-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/paint/printing/print-text-shadow-expected.png deleted file mode 100644 index 5f968a73..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/paint/printing/print-text-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/svg/css/text-gradient-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/svg/css/text-gradient-shadow-expected.png deleted file mode 100644 index d6d9a50..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/svg/css/text-gradient-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/svg/css/text-shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/svg/css/text-shadow-multiple-expected.png deleted file mode 100644 index 3bb69d6..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/svg/css/text-shadow-multiple-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/compositing/shadows/shadow-drawing-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/compositing/shadows/shadow-drawing-expected.png deleted file mode 100644 index 2a3ad117..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/compositing/shadows/shadow-drawing-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/fast/writing-mode/english-lr-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/fast/writing-mode/english-lr-text-expected.png deleted file mode 100644 index ae0ebab..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/fast/writing-mode/english-lr-text-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 9cc9997..8632660 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-003-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-003-expected.png deleted file mode 100644 index 97ffd04..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-003-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-004-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-004-expected.png deleted file mode 100644 index 42f9665..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-004-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-010-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-010-expected.png deleted file mode 100644 index a3cc1a6..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/ietestcenter/css3/text/textshadow-010-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/audio-controls-rendering-expected.png index 8e023ee..f5eb453 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/audio-controls-rendering-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-layout-direction-expected.png index 378f69e..c737512 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-layout-direction-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-styling-expected.png index 0911aff..2cb1255fa 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-styling-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/controls-styling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-controls-clone-expected.png index 489338d..3c5a8bc 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-controls-clone-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-document-audio-repaint-expected.png index 96847743..ed55197a1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-document-audio-repaint-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/paint/printing/print-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/paint/printing/print-text-shadow-expected.png deleted file mode 100644 index 7403aa0..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/paint/printing/print-text-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/svg/css/text-gradient-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/svg/css/text-gradient-shadow-expected.png deleted file mode 100644 index 14d8a0f..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/svg/css/text-gradient-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..f5eb453 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/controls-layout-direction-expected.png new file mode 100644 index 0000000..c737512 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/controls-styling-expected.png new file mode 100644 index 0000000..2cb1255fa --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/controls-styling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/media-controls-clone-expected.png new file mode 100644 index 0000000..3c5a8bc --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..ed55197a1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.12/virtual/video-surface-layer/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png b/third_party/WebKit/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png index e480fb0e..4983b94 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/shadows/shadow-drawing-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt index 65818d5..6c062961 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 581 tests; 405 PASS, 176 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 581 tests; 397 PASS, 184 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS align-content (type: discrete) has testAccumulation function PASS align-content: "flex-end" onto "flex-start" PASS align-content: "flex-start" onto "flex-end" @@ -356,17 +356,17 @@ PASS list-style-type: "square" onto "circle" PASS list-style-type: "circle" onto "square" PASS marker-end (type: discrete) has testAccumulation function -PASS marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-mid (type: discrete) has testAccumulation function -PASS marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-start (type: discrete) has testAccumulation function -PASS marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask (type: discrete) has testAccumulation function -PASS mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask-type (type: discrete) has testAccumulation function PASS mask-type: "luminance" onto "alpha" PASS mask-type: "alpha" onto "luminance"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt index 833d706e..bba66014 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 578 tests; 536 PASS, 42 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 578 tests; 528 PASS, 50 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS align-content (type: discrete) has testAddition function PASS align-content: "flex-end" onto "flex-start" PASS align-content: "flex-start" onto "flex-end" @@ -356,17 +356,17 @@ PASS list-style-type: "square" onto "circle" PASS list-style-type: "circle" onto "square" PASS marker-end (type: discrete) has testAddition function -PASS marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-mid (type: discrete) has testAddition function -PASS marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-start (type: discrete) has testAddition function -PASS marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask (type: discrete) has testAddition function -PASS mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask-type (type: discrete) has testAddition function PASS mask-type: "luminance" onto "alpha" PASS mask-type: "alpha" onto "luminance"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt index 1eee23f8..704f5c0 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 721 tests; 646 PASS, 75 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 721 tests; 634 PASS, 87 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS align-content (type: discrete) has testInterpolation function PASS align-content uses discrete animation when animating between "flex-start" and "flex-end" with linear easing PASS align-content uses discrete animation when animating between "flex-start" and "flex-end" with effect easing @@ -443,21 +443,21 @@ PASS list-style-type uses discrete animation when animating between "circle" and "square" with effect easing PASS list-style-type uses discrete animation when animating between "circle" and "square" with keyframe easing PASS marker-end (type: discrete) has testInterpolation function -PASS marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-mid (type: discrete) has testInterpolation function -PASS marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-start (type: discrete) has testInterpolation function -PASS marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask (type: discrete) has testInterpolation function -PASS mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask-type (type: discrete) has testInterpolation function PASS mask-type uses discrete animation when animating between "alpha" and "luminance" with linear easing PASS mask-type uses discrete animation when animating between "alpha" and "luminance" with effect easing
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/color-correction-on-text-shadow-expected.png index caf2a46..6108f5b 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/color-correction-on-text-shadow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/color-correction-on-text-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/shadow-multiple-expected.png index d0b2bfe6..f16b8a8 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/shadow-multiple-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/shadow-multiple-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/english-lr-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/english-lr-text-expected.png index abdca024..dc37ba6 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/english-lr-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/english-lr-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 270d75c9..66559c4 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-001-expected.png b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-001-expected.png index 32294bae..11f42d3 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-001-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-001-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-002-expected.png b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-002-expected.png index e7f1cae..22c5830 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-002-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-002-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-003-expected.png b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-003-expected.png index c9774fe..a5bbbb1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-003-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-003-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-004-expected.png b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-004-expected.png index f3c3101..507a2cc 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-004-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-004-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-010-expected.png b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-010-expected.png index d17bda2..82301b1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-010-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/ietestcenter/css3/text/textshadow-010-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png index d008f664..dde8996 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/controls-layout-direction-expected.png index 1c1f0d5..bff4933e 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-layout-direction-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.png index 6b2cc82..aa5b80c4 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/controls-styling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/media-controls-clone-expected.png index c66b995..ecfc5c1 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/media-controls-clone-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.png index 729b553..58ac52c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/shadow-multiple-expected.png index 732fb2ce..82c4cb6c95 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/shadow-multiple-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/shadow-multiple-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/svg/repaint-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/svg/repaint-shadow-expected.png deleted file mode 100644 index 5c5a4e7..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/svg/repaint-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/printing/print-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/paint/printing/print-text-shadow-expected.png index 773f423..a59b900 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/paint/printing/print-text-shadow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/paint/printing/print-text-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-gradient-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-gradient-shadow-expected.png index f571bd8..734f55c 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-gradient-shadow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-gradient-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-shadow-multiple-expected.png index 6865883..666baed3 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-shadow-multiple-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/svg/css/text-shadow-multiple-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/transforms/shadows-expected.png b/third_party/WebKit/LayoutTests/platform/mac/transforms/shadows-expected.png index 99c1371b..eccb0800 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/transforms/shadows-expected.png +++ b/third_party/WebKit/LayoutTests/platform/mac/transforms/shadows-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/shadows/shadow-drawing-expected.png b/third_party/WebKit/LayoutTests/platform/win/compositing/shadows/shadow-drawing-expected.png index 281740a..6072329a 100644 --- a/third_party/WebKit/LayoutTests/platform/win/compositing/shadows/shadow-drawing-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/compositing/shadows/shadow-drawing-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt index d1fcefb2..74c9824 100644 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 581 tests; 404 PASS, 177 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 581 tests; 396 PASS, 185 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS align-content (type: discrete) has testAccumulation function PASS align-content: "flex-end" onto "flex-start" PASS align-content: "flex-start" onto "flex-end" @@ -356,17 +356,17 @@ PASS list-style-type: "square" onto "circle" PASS list-style-type: "circle" onto "square" PASS marker-end (type: discrete) has testAccumulation function -PASS marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-mid (type: discrete) has testAccumulation function -PASS marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-start (type: discrete) has testAccumulation function -PASS marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask (type: discrete) has testAccumulation function -PASS mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask-type (type: discrete) has testAccumulation function PASS mask-type: "luminance" onto "alpha" PASS mask-type: "alpha" onto "luminance"
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt index f50490c8..816c8c5 100644 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/addition-per-property-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 578 tests; 535 PASS, 43 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 578 tests; 527 PASS, 51 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS align-content (type: discrete) has testAddition function PASS align-content: "flex-end" onto "flex-start" PASS align-content: "flex-start" onto "flex-end" @@ -356,17 +356,17 @@ PASS list-style-type: "square" onto "circle" PASS list-style-type: "circle" onto "square" PASS marker-end (type: discrete) has testAddition function -PASS marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-end: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-end: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-mid (type: discrete) has testAddition function -PASS marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-mid: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-mid: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-start (type: discrete) has testAddition function -PASS marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL marker-start: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL marker-start: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask (type: discrete) has testAddition function -PASS mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" -PASS mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" +FAIL mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "none" +FAIL mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask-type (type: discrete) has testAddition function PASS mask-type: "luminance" onto "alpha" PASS mask-type: "alpha" onto "luminance"
diff --git a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt index e41032f..1969948 100644 --- a/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/external/wpt/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 721 tests; 643 PASS, 78 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 721 tests; 631 PASS, 90 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS align-content (type: discrete) has testInterpolation function PASS align-content uses discrete animation when animating between "flex-start" and "flex-end" with linear easing PASS align-content uses discrete animation when animating between "flex-start" and "flex-end" with effect easing @@ -443,21 +443,21 @@ PASS list-style-type uses discrete animation when animating between "circle" and "square" with effect easing PASS list-style-type uses discrete animation when animating between "circle" and "square" with keyframe easing PASS marker-end (type: discrete) has testInterpolation function -PASS marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-end uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-mid (type: discrete) has testInterpolation function -PASS marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-mid uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS marker-start (type: discrete) has testInterpolation function -PASS marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL marker-start uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask (type: discrete) has testInterpolation function -PASS mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing -PASS mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing -PASS mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing +FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" +FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "none" PASS mask-type (type: discrete) has testInterpolation function PASS mask-type uses discrete animation when animating between "alpha" and "luminance" with linear easing PASS mask-type uses discrete animation when animating between "alpha" and "luminance" with effect easing
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png index 234ac1dd..58f8b8f 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png index c4450a28..5554c722 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/english-lr-text-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/english-lr-text-expected.png index 87278ee2..ff47cab 100644 --- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/english-lr-text-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/english-lr-text-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png index e58acefb..e06b88e 100644 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-002-expected.png b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-002-expected.png index 44d1f8bdb..5906a3e 100644 --- a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-002-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-002-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-003-expected.png b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-003-expected.png index ea0cd02..531867a7 100644 --- a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-003-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-003-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-004-expected.png b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-004-expected.png index 3a49246b..76b4049 100644 --- a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-004-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-004-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-010-expected.png b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-010-expected.png index 6bfc2283..d2c4307 100644 --- a/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-010-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/ietestcenter/css3/text/textshadow-010-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.png index a47062f..90899719 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/win/media/controls-layout-direction-expected.png index 0856872..cff85e5 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-layout-direction-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.png index fa05a18f..e4c204d5 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/media/controls-styling-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/win/media/media-controls-clone-expected.png index 6d34411..378b48c 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/media-controls-clone-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.png index f80f1d5..51748e6b 100644 --- a/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png index 222ab1f..49b5a83 100644 --- a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/printing/print-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win/paint/printing/print-text-shadow-expected.png index b4586f95..a33159d 100644 --- a/third_party/WebKit/LayoutTests/platform/win/paint/printing/print-text-shadow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/paint/printing/print-text-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/svg/css/text-gradient-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win/svg/css/text-gradient-shadow-expected.png index a04a8ce..22e18b8 100644 --- a/third_party/WebKit/LayoutTests/platform/win/svg/css/text-gradient-shadow-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/svg/css/text-gradient-shadow-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/svg/css/text-shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/svg/css/text-shadow-multiple-expected.png index 04fa682..c92c987 100644 --- a/third_party/WebKit/LayoutTests/platform/win/svg/css/text-shadow-multiple-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/svg/css/text-shadow-multiple-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/transforms/shadows-expected.png b/third_party/WebKit/LayoutTests/platform/win/transforms/shadows-expected.png index 623a8515c..0704e7b 100644 --- a/third_party/WebKit/LayoutTests/platform/win/transforms/shadows-expected.png +++ b/third_party/WebKit/LayoutTests/platform/win/transforms/shadows-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/compositing/shadows/shadow-drawing-expected.png b/third_party/WebKit/LayoutTests/platform/win7/compositing/shadows/shadow-drawing-expected.png deleted file mode 100644 index 372d5cf..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/compositing/shadows/shadow-drawing-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png deleted file mode 100644 index 70b3e12..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png deleted file mode 100644 index 9c30700..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-001-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-001-expected.png deleted file mode 100644 index b861a1f..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-001-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png deleted file mode 100644 index 777b882..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-003-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-003-expected.png deleted file mode 100644 index 6555c49..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-003-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-004-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-004-expected.png deleted file mode 100644 index 27ee79cd..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-004-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png deleted file mode 100644 index 36e114a..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/media/audio-controls-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/win7/media/audio-controls-rendering-expected.png deleted file mode 100644 index c077eeba..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/media/audio-controls-rendering-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/win7/media/controls-layout-direction-expected.png deleted file mode 100644 index 78c17c1..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/media/controls-layout-direction-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/media/controls-styling-expected.png b/third_party/WebKit/LayoutTests/platform/win7/media/controls-styling-expected.png deleted file mode 100644 index e7e45131..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/media/controls-styling-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/media/media-controls-clone-expected.png b/third_party/WebKit/LayoutTests/platform/win7/media/media-controls-clone-expected.png deleted file mode 100644 index 8ffd7d9..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/media/media-controls-clone-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/media/media-document-audio-repaint-expected.png b/third_party/WebKit/LayoutTests/platform/win7/media/media-document-audio-repaint-expected.png deleted file mode 100644 index d5832e2..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/media/media-document-audio-repaint-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png deleted file mode 100644 index a2698a41..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/svg/repaint-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/svg/repaint-shadow-expected.png deleted file mode 100644 index ae105758..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/svg/repaint-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/paint/printing/print-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/paint/printing/print-text-shadow-expected.png deleted file mode 100644 index a7e1dc77..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/paint/printing/print-text-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png deleted file mode 100644 index 7397e3d..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png deleted file mode 100644 index 6580abf..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/transforms/shadows-expected.png b/third_party/WebKit/LayoutTests/platform/win7/transforms/shadows-expected.png deleted file mode 100644 index 837ddff..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/transforms/shadows-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/video-surface-layer/media/controls-layout-direction-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/video-surface-layer/media/controls-layout-direction-expected.png deleted file mode 100644 index 78c17c1..0000000 --- a/third_party/WebKit/LayoutTests/platform/win7/virtual/video-surface-layer/media/controls-layout-direction-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/traversal/size-zero-run.html b/third_party/WebKit/LayoutTests/traversal/size-zero-run.html index 988ffb5..7bd07128 100644 --- a/third_party/WebKit/LayoutTests/traversal/size-zero-run.html +++ b/third_party/WebKit/LayoutTests/traversal/size-zero-run.html
@@ -12,7 +12,7 @@ textnode2.nodeValue = ""; var root = document.body; - var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, NodeFilter.FILTER_ACCEPT, false); + var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, null); var n = it.nextNode(); while(n) {
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 64f86b377..4cfc7a4 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -2490,6 +2490,7 @@ [Worker] getter platform [Worker] getter product [Worker] getter storage +[Worker] getter usb [Worker] getter userAgent [Worker] method constructor [Worker] interface WritableStream
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt index bc31776..9fd0a90 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -2490,6 +2490,7 @@ [Worker] getter platform [Worker] getter product [Worker] getter storage +[Worker] getter usb [Worker] getter userAgent [Worker] method constructor [Worker] interface WritableStream
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp index e61096c..5cbecf3 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_library_list.cpp
@@ -356,8 +356,7 @@ return NULL; } - LibraryView* wrap = new LibraryView(); - wrap->SetSystem(system_lib, lib_name); + LibraryView* wrap = new LibraryView(system_lib, base_name); known_libraries_.PushBack(wrap); LOG("System library %s loaded at %p", lib_name, wrap); @@ -370,34 +369,17 @@ // Find the full library path. String full_path; - if (!strchr(lib_name, '/')) { - LOG("Looking through the search path list"); - const char* path = search_path_list->FindFile(lib_name); - if (!path) { - error->Format("Can't find library file %s", lib_name); - return NULL; - } - full_path = path; - } else { - if (lib_name[0] != '/') { - // Need to transform this into a full path. - full_path = GetCurrentDirectory(); - if (full_path.size() && full_path[full_path.size() - 1] != '/') - full_path += '/'; - full_path += lib_name; - } else { - // Absolute path. Easy. - full_path = lib_name; - } - LOG("Full library path: %s", full_path.c_str()); - if (!PathIsFile(full_path.c_str())) { - error->Format("Library file doesn't exist: %s", full_path.c_str()); - return NULL; - } + LOG("Looking through the search path list"); + SearchPathList::Result probe = search_path_list->FindFile(lib_name); + if (!probe.IsValid()) { + error->Format("Can't find library file %s", lib_name); + return NULL; } + LOG("Found library: path %s @ 0x%x", probe.path.c_str(), probe.offset); // Load the library - if (!lib->Load(full_path.c_str(), load_address, file_offset, error)) + if (!lib->Load(probe.path.c_str(), load_address, file_offset + probe.offset, + error)) return NULL; // Load all dependendent libraries. @@ -447,8 +429,12 @@ head_ = lib.Get(); // Then create a new LibraryView for it. - wrap = new LibraryView(); - wrap->SetCrazy(lib.Get(), lib_name); + // TODO(digit): Use the library's soname() instead of |lib_name| here. + // This is not possible yet because the current code relies on the fact + // that lib_name is /data/data/..../base.apk + a file offset at the moment + // to perform RELRO sharing properly. This will be fixed in a future CL + // that also modifies the client code in chromium_android_linker. + wrap = new LibraryView(lib.Get(), lib_name); known_libraries_.PushBack(wrap); LOG("Running constructors for %s", base_name);
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp index 3e68127..b8cd1ac 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_library_view.cpp
@@ -11,6 +11,9 @@ namespace crazy { +LibraryView::LibraryView(SharedLibrary* crazy_lib) + : type_(TYPE_CRAZY), crazy_(crazy_lib), name_(crazy_lib->soname()) {} + LibraryView::~LibraryView() { LOG("Destroying %s", name_.c_str()); if (type_ == TYPE_SYSTEM) {
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h b/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h index 23c32d55..a412f2d 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h +++ b/third_party/android_crazy_linker/src/src/crazy_linker_library_view.h
@@ -16,8 +16,9 @@ // crazy::SharedLibrary object or a library handle returned by the system's // dlopen() function. // -// It has a name, which is always a base name, because only one -// library with a given base name can be loaded in the system. +// It has a name, which normally corresponds to the DT_SONAME entry in the +// dynamic table (i.e. the name embedded within the ELF file, which does not +// always matches its file path name). class LibraryView { public: enum { @@ -26,33 +27,39 @@ TYPE_CRAZY = 0xcdef2387, }; - LibraryView() - : type_(TYPE_NONE), crazy_(NULL), system_(NULL), name_(), ref_count_(1) {} + // Constructor for wrapping a system library handle. + // |system_lib| is the dlopen() handle, and |lib_name| should be the + // library soname for it. + LibraryView(void* system_handle, const char* lib_name) + : type_(TYPE_SYSTEM), system_(system_handle), name_(lib_name) {} + // Constructor for wrapping a crazy::SharedLibrary instance. + LibraryView(SharedLibrary* crazy_lib, const char* lib_name) + : type_(TYPE_CRAZY), crazy_(crazy_lib), name_(lib_name) {} + + // Constructor for warpping a crazy::SharedLibrary instance. + // This version takes the library name from the its soname() value. + LibraryView(SharedLibrary* crazy_lib); + + // Destructor, this will either dlclose() a system library, or delete + // a SharedLibrary instance. ~LibraryView(); + // Returns true iff this is a system library handle. bool IsSystem() const { return type_ == TYPE_SYSTEM; } + // Returns true iff this is a SharedLibrary instance. bool IsCrazy() const { return type_ == TYPE_CRAZY; } - void SetSystem(void* system_lib, const char* name) { - type_ = TYPE_SYSTEM; - system_ = system_lib; - name_ = name; - } - - void SetCrazy(SharedLibrary* crazy_lib, const char* name) { - type_ = TYPE_CRAZY; - crazy_ = crazy_lib; - name_ = name; - } - + // Returns the soname of the current library (or its base name if not + // available). const char* GetName() { return name_.c_str(); } SharedLibrary* GetCrazy() { return IsCrazy() ? crazy_ : NULL; } void* GetSystem() { return IsSystem() ? system_ : NULL; } + // Increment reference count for this LibraryView. void AddRef() { ref_count_++; } // Decrement reference count. Returns true iff it reaches 0. @@ -75,13 +82,15 @@ int ref_count() const { return ref_count_; } private: - uint32_t type_; - SharedLibrary* crazy_; - void* system_; + uint32_t type_ = TYPE_NONE; + int ref_count_ = 1; + union { + SharedLibrary* crazy_ = nullptr; + void* system_; + }; String name_; - int ref_count_; }; } // namespace crazy -#endif // CRAZY_LINKER_LIBRARY_VIEW_H \ No newline at end of file +#endif // CRAZY_LINKER_LIBRARY_VIEW_H
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.cpp index 46867c2..4f76a42 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.cpp
@@ -4,17 +4,144 @@ #include "crazy_linker_search_path_list.h" -#include <string.h> - +#include "crazy_linker.h" #include "crazy_linker_debug.h" #include "crazy_linker_system.h" +#include "crazy_linker_zip.h" + +#include <utility> + +#include <string.h> namespace crazy { +namespace { + +// Helper class used to parse over the items of two column-separated lists. +// Usage is the following: +// 1) Create new instance, passing the first and second list as parameters. +// 2) Call NextItem() in a loop until it returns false. Each call will +// return the current item. +// +// Items of the first list are returned in order before items of the second +// list. +class MultiListParser { + public: + // Constructor. + MultiListParser(const String& a_list, const String& b_list) + : p_(a_list.cbegin()), end_(a_list.cend()), b_list_(b_list) {} + + // Grab next item. On success return true and sets |*result|. On end of list, + // just return false. + bool NextItem(String* result) { + for (;;) { + if (p_ == end_) { + if (p_ != b_list_.cend()) { + p_ = b_list_.cbegin(); + end_ = b_list_.cend(); + continue; + } + return false; + } + // compute current list item, and next item start at the same time. + const char* item = p_; + const char* item_end = item; + while (item_end < end_ && item_end[0] != ':') + item_end++; + + p_ = item_end + (item_end < end_); + + if (item_end > item) { // Skip over empty entries. + result->Assign(item, item_end - item); + return true; + } + } + } + + private: + const char* p_; + const char* end_; + const String& b_list_; +}; + +// Look into zip archive at |zip_path| for a file named |file_name|. +// As a special convenience trick, this will also try to find a file with +// the same name with a 'crazy.' prefix. In other words, when looking for +// 'lib/libfoo.so', this will first look for 'lib/libfoo.so', then for +// 'lib/crazy.libfoo.so'. This allows storing uncompressed libraries inside +// Android APKs while preventing the system from extracting them at installation +// time (which will always happen before Android M). Note that these files +// should just be renamed, i.e. their internal soname should still be +// 'libfoo.so'. +// +// On success, return offset within zip archive, or CRAZY_OFFSET_FAILED +// if the library is not found. +int32_t FindLibFileInZipArchive(const char* zip_path, const char* file_name) { + // First attempt is direct lookup. + int32_t offset = FindStartOffsetOfFileInZipFile(zip_path, file_name); + if (offset != CRAZY_OFFSET_FAILED) { + LOG(" FOUND_IN_ZIP %s!%s @ 0x%x", zip_path, file_name, offset); + return offset; + } + + // Second attempt adding a crazy. prefix to the library name. + String crazy_name; + const char* pos = ::strrchr(file_name, '/'); + if (pos) { + crazy_name.Assign(file_name, (pos + 1 - file_name)); + file_name = pos + 1; + } + crazy_name.Append("crazy."); + crazy_name.Append(file_name); + + offset = FindStartOffsetOfFileInZipFile(zip_path, crazy_name.c_str()); + if (offset != CRAZY_OFFSET_FAILED) { + LOG(" FOUND IN ZIP %s!%s @ 0x%x", zip_path, crazy_name.c_str(), offset); + } + return offset; +} + +// Try to find the library file pointed by |path|. +// If |path| contains an exclamation mark, this is interpreted as a separator +// between a zip archive file path, and a file contained inside it. +// Also supports crazy. prefix for storing renamed libraries inside the zip +// archive (see comment for FindLibFileInZipArchive). +SearchPathList::Result FindLibFile(const char* path) { + // An exclamation mark in the file name indicates that one should look + // inside a zip archive. This is supported by the platform, see the + // "Opening shared libraries directly from an APK" in the following article: + // https://github.com/aosp-mirror/platform_bionic/blob/master/android-changes-for-ndk-developers.md + const char* bang = ::strchr(path, '!'); + if (bang) { + if (bang == path || bang[1] == '\0') { + // An initial or final '!' is always an error. + LOG(" INVALID_ZIP_PATH %s", path); + } else { + String zip_path = MakeAbsolutePathFrom(path, bang - path); + const char* file_name = bang + 1; + int32_t offset = FindLibFileInZipArchive(zip_path.c_str(), bang + 1); + if (offset != CRAZY_OFFSET_FAILED) { + return {std::move(zip_path), offset}; + } + } + } else { + // Regular file path. + String file_path = MakeAbsolutePathFrom(path); + if (PathIsFile(file_path.c_str())) { + LOG(" FOUND FILE %s", file_path.c_str()); + return {std::move(file_path), 0}; + } + } + + LOG(" skip %s", path); + return {}; +} + +} // namespace + void SearchPathList::Reset() { list_.Resize(0); env_list_.Resize(0); - full_path_.Resize(0); } void SearchPathList::ResetFromEnv(const char* var_name) { @@ -31,53 +158,35 @@ list_.Append(list, list_end - list); } -const char* SearchPathList::FindFile(const char* file_name) { - // Sanity checks. - if (!file_name || !*file_name) - return NULL; - +SearchPathList::Result SearchPathList::FindFile(const char* file_name) const { LOG("Looking for %s", file_name); + if (::strchr(file_name, '/') != nullptr || + ::strchr(file_name, '!') != nullptr) { + // This is an absolute or relative file path, so ignore the search list. + return FindLibFile(file_name); + } + // Build full list by appending the env_list_ after the regular one. - String full_list = list_; - if (env_list_.size() > 0) { - if (full_list.size() > 0 && full_list[full_list.size() - 1] != ':') - full_list += ':'; - full_list += env_list_; - } - - // Iterate over all items in the list. - const char* p = full_list.c_str(); - const char* end = p + full_list.size(); - - while (p < end) { - // compute current list item, and next item start at the same time. - const char* item = p; - const char* item_end = - reinterpret_cast<const char*>(memchr(p, ':', end - p)); - if (item_end) - p = item_end + 1; - else { - item_end = end; - p = end; - } - - full_path_.Assign(item, item_end - item); - + MultiListParser parser(list_, env_list_); + String file_path; + Result result; + while (parser.NextItem(&file_path)) { // Add trailing directory separator if needed. - if (full_path_.size() > 0 && full_path_[full_path_.size() - 1] != '/') - full_path_ += '/'; + if (file_path[file_path.size() - 1] != '/') + file_path += '/'; - full_path_ += file_name; + file_path += file_name; - if (PathIsFile(full_path_.c_str())) { - LOG(" FOUND %s", full_path_.c_str()); - return full_path_.c_str(); - } else - LOG(" skip %s", full_path_.c_str()); + result = FindLibFile(file_path.c_str()); + if (result.IsValid()) { + return result; + } + LOG(" SKIPPED %s", file_path.c_str()); } - return NULL; + LOG(" MISSING %s", file_name); + return result; } } // namespace crazy
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.h b/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.h index 9797e912..16cc1215 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.h +++ b/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list.h
@@ -5,6 +5,7 @@ #ifndef CRAZY_LINKER_SEARCH_PATH_LIST_H #define CRAZY_LINKER_SEARCH_PATH_LIST_H +#include <stdint.h> #include <string.h> #include "crazy_linker_util.h" // for String @@ -15,7 +16,7 @@ // file system probing with it. class SearchPathList { public: - SearchPathList() : list_(), env_list_(), full_path_() {} + SearchPathList() = default; // Reset the list, i.e. make it empty. void Reset(); @@ -26,6 +27,13 @@ // Add one or more paths to the list. // |path_list| contains a list of paths separated by columns. // |path_list_end| points after the list's last character. + // + // NOTE: Adding a zip archive to the list is supported by using an + // exclamation mark as a delimiter inside a path. For example, the value + // '/path/to/archive.zip!lib/armeabi-v7a', means looking for libraries + // inside the zip archive at '/path/to/archive.zip', that are stored + // as 'lib/armeabi-v7a/<libname>', or even 'lib/armeabi-v7a/crazy.<libname>'. + // Read the documentation for FindFile() below for more details. void AddPaths(const char* path_list, const char* path_list_end); // Convenience function that takes a 0-terminated string. @@ -33,17 +41,62 @@ AddPaths(path_list, path_list + ::strlen(path_list)); } - // Try to find a file named |file_name| by probing the file system - // with every item in the list as a suffix. On success, returns the - // full path string, or NULL on failure. - const char* FindFile(const char* file_name); + // The result of FindFile() below. + // |path| is the path to the file containing the library, or nullptr on error. + // |offset| is the byte offset within |path| where the library is located. + struct Result { + String path; + int32_t offset = 0; + + // Returns true iff this instance matches a valid file and offset. + inline bool IsValid() const { return !path.IsEmpty(); } + }; + + // Try to find a library file named |file_name| by probing the directories + // added through AddPaths(). This returns a (path, offset) tuple where + // |path| corresponds to the file path to load the library from, and + // |offset| to its offset inside the file. This allows loading libraries + // directly from zip archives, when they are uncompressed and page-aligned + // within them. + // + // In case of failure, the path will be empty, and the offset will be 0. + // + // Note that if |file_name| does not contain any directory separator or + // exclamation name, the corresponding file will be searched in the list + // of paths added through AddPaths(). Otherwise, this is considered a direct + // file path and the search list will be ignored. + // + // File paths, either given directly by |file_name| or created by prepending + // search list items to it, can contain an exclamation mark to indicate that + // the library should be looked into a zip archive. For a concrete example + // 'path/to/archive.zip!libs/libfoo.so' will look into the zip archive + // at 'path/to/archive.zip' for a file within it named 'libs/libfoo.so'. + // + // This matches the behaviour of the Android system linker, starting with M + // (i.e. API level 23), but can be used on previous Android releases too. + // + // Said libraries must be uncompressed and page-aligned for the linker + // to later be able to load them properly. + // + // NOTE: It is also possible to store library files with a 'crazy.' prefix + // inside zip archives. In the following example, the function will first + // look for 'libs/libfoo.so', and if not found, will also look for a file + // named 'libs/crazy.libfoo.so'. + // + // Using such a prefix is useful on Android: such libraries can still be + // loaded directly from the APK, but will not be extracted by the system + // at installation into the application data directory (at least before + // Android M). Note that said libraries should simply be renamed within + // the zip file (i.e. they should still use the same internal DT_SONAME + // of 'libfoo.so' for the linker to work properly). + // + Result FindFile(const char* file_name) const; private: String list_; String env_list_; - String full_path_; }; } // namespace crazy -#endif // CRAZY_LINKER_SEARCH_PATH_LIST_H \ No newline at end of file +#endif // CRAZY_LINKER_SEARCH_PATH_LIST_H
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list_unittest.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list_unittest.cpp index b51712a..b17630c2 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list_unittest.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_search_path_list_unittest.cpp
@@ -6,9 +6,18 @@ #include <gtest/gtest.h> #include "crazy_linker_system_mock.h" +#include "crazy_linker_zip_test_data.h" namespace crazy { +namespace { + +// MAGIC CONSTANT WARNING: These offsets have been determined empirically. +// If you update the content of lib_archive_zip, you will have to adjust +// them for these tests to continue to run. +const int32_t kFooFileOffset = 80; +const int32_t kBarFileOffset = 197; + class TestSystem { public: TestSystem() : sys_() { @@ -24,54 +33,124 @@ sys_.AddRegularFile(path, data, len); } + void SetCurrentDir(const char* path) { sys_.SetCurrentDir(path); } + private: SystemMock sys_; }; +// A mock CPU ABI name used during testing. +// NOTE: This is hard-coded into the zip test tables, do not change it! +const char kTestAbi[] = "test-abi"; + +// Small structure used to store test data. +// |input_path| is an input file path. +// |expected_path| is either nullptr or an expected file path. +// |expected_offset| is the expected offset (or 0). +struct TestData { + const char* input_path; + const char* expected_path; + int32_t expected_offset; +}; + +// Perform one single check for the TestData instance |data|, using |list|. +void CheckData(const TestData& data, const SearchPathList& list) { + auto result = list.FindFile(data.input_path); + if (data.expected_path) { + EXPECT_STREQ(data.expected_path, result.path.c_str()) + << "For: " << data.input_path; + EXPECT_EQ(data.expected_offset, result.offset) + << "For: " << data.input_path; + } else { + EXPECT_STREQ("", result.path.c_str()) << "For: " << data.input_path; + } +} + +} // namespace + TEST(SearchPathList, Empty) { TestSystem sys; SearchPathList list; - EXPECT_FALSE(list.FindFile("/foo")); - EXPECT_FALSE(list.FindFile("/tmp/zoo")); - EXPECT_FALSE(list.FindFile("/tmp/foo/bar")); + sys.SetCurrentDir("/tmp"); + static const TestData kData[] = { + // Paths without a directory separator should not work. + {"foo", nullptr, 0}, + // Relative paths should work. + {"foo/bar", "/tmp/foo/bar", 0}, + // Absolute paths should work + {"/foo", "/foo", 0}, + {"/tmp/zoo", "/tmp/zoo", 0}, + {"/tmp/foo/bar", "/tmp/foo/bar", 0}, + // File that do not exist should error. + {"/no-such-file", nullptr, 0}, + }; + for (const auto& data : kData) { + CheckData(data, list); + } } TEST(SearchPathList, OneItem) { TestSystem sys; SearchPathList list; list.AddPaths("/tmp/foo"); - EXPECT_STREQ("/tmp/foo/bar", list.FindFile("bar")); - EXPECT_FALSE(list.FindFile("zoo")); - EXPECT_FALSE(list.FindFile("foo")); + + static const TestData kData[] = { + {"bar", "/tmp/foo/bar", 0}, {"zoo", nullptr, 0}, {"foo", nullptr, 0}, + }; + for (const auto& data : kData) { + CheckData(data, list); + } } TEST(SearchPathList, Reset) { TestSystem sys; SearchPathList list; list.AddPaths("/tmp/foo"); - EXPECT_STREQ("/tmp/foo/bar", list.FindFile("bar")); + + auto result = list.FindFile("bar"); + EXPECT_STREQ("/tmp/foo/bar", result.path.c_str()); list.Reset(); - EXPECT_FALSE(list.FindFile("bar")); + result = list.FindFile("bar"); + EXPECT_STREQ("", result.path.c_str()); } TEST(SearchPathList, ResetFromEnv) { TestSystem sys; SearchPathList list; list.ResetFromEnv("TEST_LIBRARY_PATH"); - EXPECT_STREQ("/tmp/foo/bar", list.FindFile("foo/bar")); - EXPECT_STREQ("/foo", list.FindFile("foo")); + + static const TestData kData[] = { + // Find file name from env search list. + {"zoo", "/tmp/zoo", 0}, + {"foo", "/foo", 0}, + // Ignore search list if path contains a directory separator. + {"foo/bar", nullptr, 0}, + // Or an exclamation mark. + {"foo!bar", nullptr, 0}, + }; + for (const auto& data : kData) { + CheckData(data, list); + } } TEST(SearchPathList, ThreeItems) { TestSystem sys; SearchPathList list; - list.AddPaths("/tmp/foo"); - list.AddPaths("/tmp/"); + list.AddPaths("/tmp/foo:/tmp/"); - EXPECT_STREQ("/tmp/foo/bar", list.FindFile("bar")); - EXPECT_STREQ("/tmp/zoo", list.FindFile("zoo")); - EXPECT_FALSE(list.FindFile("foo")); + static const TestData kData[] = { + // Relative path ignores search list. Current directory is /. + {"foo/bar", nullptr, 0}, + {"tmp/zoo", "/tmp/zoo", 0}, + // Base name uses search list, finds file in /tmp/. + {"zoo", "/tmp/zoo", 0}, + // Base name uses search list, doesn't find file in / which is no listed. + {"foo", nullptr, 0}, + }; + for (const auto& data : kData) { + CheckData(data, list); + } } TEST(SearchPathList, EnvPathsAfterAddedOnes) { @@ -84,7 +163,74 @@ // This checks that paths added with AddPaths() have priority over // paths added with ResetFromEnv(). An invalid implementation would // find '/tmp/foo' instead. - EXPECT_STREQ("/opt/foo", list.FindFile("foo")); + static const TestData data = {"foo", "/opt/foo", 0}; + CheckData(data, list); } -} // namespace crazy \ No newline at end of file +TEST(SearchPathList, FindDirectlyInsizeZipArchive) { + TestSystem sys; + sys.AddFile("/zips/archive.zip", + reinterpret_cast<const char*>(testing::lib_archive_zip), + testing::lib_archive_zip_len); + sys.SetCurrentDir("/zips"); + // Empty search path list. + SearchPathList list; + + static const TestData kData[] = { + // Lookup directly in archive. Full path. + {"/zips/archive.zip!lib/test-abi/libfoo.so", "/zips/archive.zip", + kFooFileOffset}, + + {"/zips/archive.zip!lib/test-abi/crazy.libbar.so", "/zips/archive.zip", + kBarFileOffset}, + + // Lookup directly in archive, from current directory. + {"archive.zip!lib/test-abi/libfoo.so", "/zips/archive.zip", + kFooFileOffset}, + + // Cannot find libraries if the zip archive is not in the search list. + {"libfoo.so", nullptr, 0}, + {"libbar.so", nullptr, 0}, + }; + for (const auto& data : kData) { + CheckData(data, list); + } +} + +TEST(SearchPathList, FindInsideListedZipArchive) { + TestSystem sys; + sys.AddFile("/zips/archive.zip", + reinterpret_cast<const char*>(testing::lib_archive_zip), + testing::lib_archive_zip_len); + SearchPathList list; + list.AddPaths("/zips/archive.zip!lib/test-abi/"); + + // MAGIC CONSTANT WARNING: These offsets have been determined empirically. + // If you update the content of lib_archive_zip, you will have to adjust + // them for these tests to continue to run. + static const int32_t kFooFileOffset = 80; + static const int32_t kBarFileOffset = 197; + static const TestData kData[] = { + // Lookup directly in archive. Full path. + {"/zips/archive.zip!lib/test-abi/libfoo.so", "/zips/archive.zip", + kFooFileOffset}, + + {"/zips/archive.zip!lib/test-abi/crazy.libbar.so", "/zips/archive.zip", + kBarFileOffset}, + + // Same, but automatically handle crazy. storage prefix! + {"/zips/archive.zip!lib/test-abi/libbar.so", "/zips/archive.zip", + kBarFileOffset}, + + // Lookup in archive because it is in the search path. + {"libfoo.so", "/zips/archive.zip", kFooFileOffset}, + + // Same, but automatically handle crazy. storage prefix! + {"libbar.so", "/zips/archive.zip", kBarFileOffset}, + }; + for (const auto& data : kData) { + CheckData(data, list); + } +} + +} // namespace crazy
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp index 391098f..7692b5c 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
@@ -219,6 +219,13 @@ strlcpy(full_path_, full_path, sizeof(full_path_)); base_name_ = GetBaseNamePtr(full_path_); + // Default value of |soname_| will be |base_name_| unless overidden + // by a DT_SONAME entry. This helps deal with broken libraries that don't + // have one. Note that starting with Android N, the system linker requires + // every library to have a DT_SONAME, as these are used to uniquely identify + // libraries for dependency resolution (barring namespace isolation). + soname_ = base_name_; + // Load the ELF binary in memory. LOG("Loading ELF segments for %s", base_name_); @@ -318,6 +325,11 @@ reinterpret_cast<ELF::Addr>(rdebug->GetAddress()); break; #endif + case DT_SONAME: + soname_ = symbols_.string_table() + dyn_value; + LOG(" DT_SONAME %s", soname_); + break; + default: ; }
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.h b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.h index ef8f469..52ff560 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.h +++ b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.h
@@ -40,6 +40,10 @@ size_t phdr_count() const { return view_.phdr_count(); } const char* base_name() const { return base_name_; } + // Return name of the library as found in DT_SONAME entry, or same + // as base_name() if not available. + const char* soname() const { return soname_; } + // Load a library (without its dependents) from an ELF file. // Note: This does not apply relocations, nor runs constructors. // |full_path| if the file full path. @@ -200,6 +204,7 @@ void* java_vm_; + const char* soname_; const char* base_name_; char full_path_[512]; };
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_system.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_system.cpp index c6fd017..1c53bb8 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_system.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_system.cpp
@@ -18,6 +18,41 @@ // Note: unit-testing support files are in crazy_linker_files_mock.cpp +namespace crazy { + +String MakeDirectoryPath(const char* parent) { + return MakeDirectoryPath(parent, ::strlen(parent)); +} + +String MakeDirectoryPath(const char* parent, size_t parent_len) { + if (parent_len == 0) { + // Special case for empty inputs. + return String("./"); + } + String result(parent); + if (parent_len > 0 && parent[parent_len - 1] != '/') { + result += '/'; + } + return result; +} + +String MakeAbsolutePathFrom(const char* path) { + return MakeAbsolutePathFrom(path, ::strlen(path)); +} + +String MakeAbsolutePathFrom(const char* path, size_t path_len) { + if (path[0] == '/') { + return String(path, path_len); + } else { + String cur_dir = GetCurrentDirectory(); + String result = MakeDirectoryPath(cur_dir.c_str(), cur_dir.size()); + result.Append(path, path_len); + return result; + } +} + +} // namespace crazy + #ifndef UNIT_TESTS namespace crazy {
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_system.h b/third_party/android_crazy_linker/src/src/crazy_linker_system.h index a8674b2f..64d0812f 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_system.h +++ b/third_party/android_crazy_linker/src/src/crazy_linker_system.h
@@ -133,6 +133,19 @@ // Returns the current directory, as a string. String GetCurrentDirectory(); +// Convert |path| into a String, and appends a trailing directory separator +// if there isn't already one. NOTE: As a special case, if the input is empty, +// then "./" will be returned. +String MakeDirectoryPath(const char* path); +String MakeDirectoryPath(const char* path, size_t path_len); + +// Convert |path| into an absolute path if necessary, always returns a new +// String instance as well. +String MakeAbsolutePathFrom(const char* path); + +// Same, but for the [path..path + path_len) input string. +String MakeAbsolutePathFrom(const char* path, size_t path_len); + // Returns the value of a given environment variable. const char* GetEnv(const char* var_name);
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_system_unittest.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_system_unittest.cpp index 2fb7f9e..55abac31 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_system_unittest.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_system_unittest.cpp
@@ -27,6 +27,64 @@ EXPECT_STREQ(kString, buff2); } +TEST(System, MakeDirectoryPath) { + static const struct { + const char* input; + const char* expected; + } kData[] = { + {"", "./"}, {".", "./"}, {"..", "../"}, + {"./", "./"}, {"../", "../"}, {"foo", "foo/"}, + {"foo/", "foo/"}, {"/foo", "/foo/"}, {"foo/bar", "foo/bar/"}, + }; + for (const auto& data : kData) { + EXPECT_STREQ(data.expected, MakeDirectoryPath(data.input).c_str()) + << "For [" << data.input << "]"; + } +} + +TEST(System, MakeAbsolutePathFrom) { + SystemMock sys; + + static const struct { + const char* input; + const char* expected; + } kData[] = { + {"/foo", "/foo"}, + {"/foo/bar/", "/foo/bar/"}, + {"foo", "/home/foo"}, + {"foo/bar", "/home/foo/bar"}, + {"./foo", "/home/./foo"}, + {"../foo", "/home/../foo"}, + {"../../foo", "/home/../../foo"}, + }; + + sys.SetCurrentDir("/home"); + + for (const auto& data : kData) { + EXPECT_STREQ(data.expected, MakeAbsolutePathFrom(data.input).c_str()) + << "For [" << data.input << "]"; + } + + for (const auto& data : kData) { + EXPECT_STREQ(data.expected, + MakeAbsolutePathFrom(data.input, strlen(data.input)).c_str()) + << "For [" << data.input << "]"; + } + + sys.SetCurrentDir("/home/"); + + for (const auto& data : kData) { + EXPECT_STREQ(data.expected, MakeAbsolutePathFrom(data.input).c_str()) + << "For [" << data.input << "]"; + } + + for (const auto& data : kData) { + EXPECT_STREQ(data.expected, + MakeAbsolutePathFrom(data.input, strlen(data.input)).c_str()) + << "For [" << data.input << "]"; + } +} + TEST(System, PathExists) { SystemMock sys; sys.AddRegularFile("/tmp/foo", "FOO", 3);
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp index 3a48f61..b1561ab8 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_wrappers.cpp
@@ -112,8 +112,7 @@ return NULL; } - LibraryView* wrap_lib = new LibraryView(); - wrap_lib->SetSystem(system_lib, path ? path : "<executable>"); + auto* wrap_lib = new LibraryView(system_lib, path ? path : "<executable>"); globals->libraries()->AddLibrary(wrap_lib); globals->valid_handles()->Add(wrap_lib); return wrap_lib;
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index b9d0fbf..7216b60 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -232,7 +232,6 @@ "platform/web_content_decryption_module_exception.h", "platform/web_content_decryption_module_result.h", "platform/web_content_decryption_module_session.h", - "platform/web_content_layer.h", "platform/web_content_security_policy.h", "platform/web_content_security_policy_struct.h", "platform/web_content_setting_callbacks.h", @@ -383,7 +382,6 @@ "platform/web_scrollbar.h", "platform/web_scrollbar_behavior.h", "platform/web_scrollbar_buttons_placement.h", - "platform/web_scrollbar_layer.h", "platform/web_scrollbar_overlay_color_theme.h", "platform/web_scrollbar_theme_geometry.h", "platform/web_scrollbar_theme_painter.h",
diff --git a/third_party/blink/public/platform/web_compositor_support.h b/third_party/blink/public/platform/web_compositor_support.h index 6fd2c79..4dc25f9 100644 --- a/third_party/blink/public/platform/web_compositor_support.h +++ b/third_party/blink/public/platform/web_compositor_support.h
@@ -35,47 +35,21 @@ #include <memory> namespace cc { -class ContentLayerClient; class Layer; } namespace blink { -class WebContentLayer; class WebImageLayer; class WebLayer; -class WebScrollbarLayer; -class WebScrollbarThemeGeometry; class WebCompositorSupport { public: // Layers ------------------------------------------------------- - virtual std::unique_ptr<WebLayer> CreateLayer() = 0; - virtual std::unique_ptr<WebLayer> CreateLayerFromCCLayer(cc::Layer*) = 0; - - virtual std::unique_ptr<WebContentLayer> CreateContentLayer( - cc::ContentLayerClient*) = 0; - virtual std::unique_ptr<WebImageLayer> CreateImageLayer() = 0; - virtual std::unique_ptr<WebScrollbarLayer> CreateScrollbarLayer( - std::unique_ptr<WebScrollbar>, - WebScrollbarThemePainter, - std::unique_ptr<WebScrollbarThemeGeometry>) = 0; - - virtual std::unique_ptr<WebScrollbarLayer> CreateOverlayScrollbarLayer( - std::unique_ptr<WebScrollbar>, - WebScrollbarThemePainter, - std::unique_ptr<WebScrollbarThemeGeometry>) = 0; - - virtual std::unique_ptr<WebScrollbarLayer> CreateSolidColorScrollbarLayer( - WebScrollbar::Orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar) = 0; - protected: virtual ~WebCompositorSupport() = default; };
diff --git a/third_party/blink/public/platform/web_content_layer.h b/third_party/blink/public/platform/web_content_layer.h deleted file mode 100644 index 2193d92..0000000 --- a/third_party/blink/public/platform/web_content_layer.h +++ /dev/null
@@ -1,51 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. - */ - -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_LAYER_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_LAYER_H_ - -#include "third_party/blink/public/platform/web_common.h" -#include "third_party/blink/public/platform/web_layer.h" - -namespace blink { - -class WebContentLayer { - public: - virtual ~WebContentLayer() = default; - - // The WebContentLayer has ownership of this wrapper. - virtual WebLayer* Layer() = 0; - - // Normally content layers are rasterized in a space with both axis and - // origin aligned to local layer space, optionally with a uniform scale. - // With this flag set to true, the compositor may raster contents in any - // space, e.g. device pixel space. - virtual void SetTransformedRasterizationAllowed(bool) = 0; - virtual bool TransformedRasterizationAllowed() const = 0; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_CONTENT_LAYER_H_
diff --git a/third_party/blink/public/platform/web_feature.mojom b/third_party/blink/public/platform/web_feature.mojom index 3c73c9cf..1d5c2e93 100644 --- a/third_party/blink/public/platform/web_feature.mojom +++ b/third_party/blink/public/platform/web_feature.mojom
@@ -1913,6 +1913,7 @@ kCSSSelectorPseudoIS = 2431, kKeyboardApiGetLayoutMap = 2432, kWebRtcVaapiHWVP8Encoding = 2433, + kPerformanceResourceTimingInitiatorType = 2434, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/platform/web_point.h b/third_party/blink/public/platform/web_point.h index 3f94d3bc..287ae6b8 100644 --- a/third_party/blink/public/platform/web_point.h +++ b/third_party/blink/public/platform/web_point.h
@@ -32,11 +32,10 @@ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_POINT_H_ #include "third_party/blink/public/platform/web_common.h" +#include "ui/gfx/geometry/point.h" #if INSIDE_BLINK #include "third_party/blink/renderer/platform/geometry/int_point.h" -#else -#include <ui/gfx/geometry/point.h> #endif namespace blink { @@ -59,6 +58,10 @@ } operator IntPoint() const { return IntPoint(x, y); } + + explicit WebPoint(const gfx::Point& p) : x(p.x()), y(p.y()) {} + + explicit operator gfx::Point() const { return gfx::Point(x, y); } #else WebPoint(const gfx::Point& p) : x(p.x()), y(p.y()) {}
diff --git a/third_party/blink/public/platform/web_rect.h b/third_party/blink/public/platform/web_rect.h index d3e51bc..2edd0af 100644 --- a/third_party/blink/public/platform/web_rect.h +++ b/third_party/blink/public/platform/web_rect.h
@@ -32,13 +32,13 @@ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RECT_H_ #include "third_party/blink/public/platform/web_common.h" +#include "ui/gfx/geometry/rect.h" #if INSIDE_BLINK #include "third_party/blink/renderer/platform/geometry/int_rect.h" #else #include <algorithm> #include <cmath> -#include <ui/gfx/geometry/rect.h> #endif namespace blink { @@ -69,6 +69,12 @@ } operator IntRect() const { return IntRect(x, y, width, height); } + + explicit WebRect(const gfx::Rect& r) + : x(r.x()), y(r.y()), width(r.width()), height(r.height()) {} + + // Note that this conversion clamps the size to be non-negative. + explicit operator gfx::Rect() const { return gfx::Rect(x, y, width, height); } #else WebRect(const gfx::Rect& r) : x(r.x()), y(r.y()), width(r.width()), height(r.height()) {} @@ -81,9 +87,8 @@ return *this; } - operator gfx::Rect() const { - return gfx::Rect(x, y, std::max(0, width), std::max(0, height)); - } + // Note that this conversion clamps the size to be non-negative. + operator gfx::Rect() const { return gfx::Rect(x, y, width, height); } #endif };
diff --git a/third_party/blink/public/platform/web_scrollbar_layer.h b/third_party/blink/public/platform/web_scrollbar_layer.h deleted file mode 100644 index 7065ad4..0000000 --- a/third_party/blink/public/platform/web_scrollbar_layer.h +++ /dev/null
@@ -1,57 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. - */ - -#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCROLLBAR_LAYER_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCROLLBAR_LAYER_H_ - -#include "third_party/blink/public/platform/web_layer.h" -#include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h" -#include "third_party/blink/public/platform/web_scrollbar_theme_painter.h" - -namespace cc { - -struct ElementId; -} - -namespace blink { - -class WebScrollbarLayer { - public: - virtual ~WebScrollbarLayer() = default; - - virtual WebLayer* Layer() = 0; - - virtual void SetScrollLayer(WebLayer*) = 0; - - // This is an element id for the scrollbar, not the scrolling layer. - // This is not to be confused with scrolling_element_id, which is the - // element id of the scrolling layer that has a scrollbar. - // All scrollbar layers require element ids. - virtual void SetElementId(const cc::ElementId&) = 0; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCROLLBAR_LAYER_H_
diff --git a/third_party/blink/public/platform/web_size.h b/third_party/blink/public/platform/web_size.h index a22acc72..6c9b193e 100644 --- a/third_party/blink/public/platform/web_size.h +++ b/third_party/blink/public/platform/web_size.h
@@ -32,14 +32,14 @@ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SIZE_H_ #include "third_party/blink/public/platform/web_common.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/geometry/vector2d.h" #if INSIDE_BLINK #include "third_party/blink/renderer/platform/geometry/int_size.h" #else #include <algorithm> #include <cmath> -#include <ui/gfx/geometry/size.h> -#include <ui/gfx/geometry/vector2d.h> #endif namespace blink { @@ -64,9 +64,18 @@ } operator IntSize() const { return IntSize(width, height); } + + explicit WebSize(const gfx::Size& s) : width(s.width()), height(s.height()) {} + explicit WebSize(const gfx::Vector2d& v) : width(v.x()), height(v.y()) {} + + // Note that this conversion clamps to non-negative values. + explicit operator gfx::Size() const { return gfx::Size(width, height); } + + explicit operator gfx::Vector2d() const { + return gfx::Vector2d(width, height); + } #else WebSize(const gfx::Size& s) : width(s.width()), height(s.height()) {} - WebSize(const gfx::Vector2d& v) : width(v.x()), height(v.y()) {} WebSize& operator=(const gfx::Size& s) { @@ -81,9 +90,8 @@ return *this; } - operator gfx::Size() const { - return gfx::Size(std::max(0, width), std::max(0, height)); - } + // Note that this conversion clamps to non-negative values. + operator gfx::Size() const { return gfx::Size(width, height); } operator gfx::Vector2d() const { return gfx::Vector2d(width, height); } #endif
diff --git a/third_party/blink/public/web/web_form_control_element.h b/third_party/blink/public/web/web_form_control_element.h index 7bb9658..cfa4125 100644 --- a/third_party/blink/public/web/web_form_control_element.h +++ b/third_party/blink/public/web/web_form_control_element.h
@@ -119,6 +119,12 @@ WebFormElement Form() const; + // Returns the identifier which is unique among all form control elements in + // the current renderer process. In the current implementation ids are + // consecutive numbers so their uniqueness might be broken in case of + // overflow. + unsigned UniqueRendererFormControlId() const; + #if INSIDE_BLINK WebFormControlElement(HTMLFormControlElement*); WebFormControlElement& operator=(HTMLFormControlElement*);
diff --git a/third_party/blink/public/web/web_form_element.h b/third_party/blink/public/web/web_form_element.h index 1f070cb..fc9bdd2 100644 --- a/third_party/blink/public/web/web_form_element.h +++ b/third_party/blink/public/web/web_form_element.h
@@ -59,6 +59,12 @@ WebString GetName() const; WebString Method() const; + // Returns the identifier which is unique among all form elements in the + // current renderer process. In the current implementation ids are + // consecutive numbers so their uniqueness might be broken in case of + // overflow. + unsigned UniqueRendererFormId() const; + void GetFormControlElements(WebVector<WebFormControlElement>&) const; #if INSIDE_BLINK
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index 93051a1..2d9fe19 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -135,8 +135,6 @@ "core/v8/v8_iterator_result_value.h", "core/v8/v8_lazy_event_listener.cc", "core/v8/v8_lazy_event_listener.h", - "core/v8/v8_node_filter_condition.cc", - "core/v8/v8_node_filter_condition.h", "core/v8/v8_object_builder.cc", "core/v8/v8_object_builder.h", "core/v8/v8_object_parser.cc",
diff --git a/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h b/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h index 244732e..fa43f5a 100644 --- a/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h +++ b/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/bindings/core/v8/idl_dictionary_base.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.h" #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/platform/bindings/to_v8.h" @@ -49,12 +48,6 @@ return ToV8(value.View(), creation_context, isolate); } -inline v8::Local<v8::Value> ToV8(const V8NodeFilterCondition* value, - v8::Local<v8::Object> creation_context, - v8::Isolate* isolate) { - return value ? value->Callback(isolate) : v8::Null(isolate).As<v8::Value>(); -} - // Dictionary inline v8::Local<v8::Value> ToV8(const IDLDictionaryBase& value,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.cc b/third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.cc deleted file mode 100644 index a1928d2..0000000 --- a/third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.cc +++ /dev/null
@@ -1,129 +0,0 @@ -/* - * Copyright (C) 2008, 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT - * OWNER OR 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. - */ - -#include "third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.h" - -#include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_node.h" -#include "third_party/blink/renderer/core/dom/node.h" -#include "third_party/blink/renderer/core/dom/node_filter.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/frame/use_counter.h" -#include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/v8_private_property.h" - -namespace blink { - -V8NodeFilterCondition::V8NodeFilterCondition(v8::Local<v8::Value> filter, - ScriptState* script_state) - : script_state_(script_state), active_flag_(false) { - // ..acceptNode(..) will only dispatch filter_ if filter_->IsObject(). - // We'll make sure filter_ is either usable by acceptNode or empty. - // (See the fast/dom/node-filter-gc test for a case where 'empty' happens.) - if (!filter.IsEmpty() && filter->IsObject()) - filter_.Set(script_state->GetIsolate(), filter.As<v8::Object>()); -} - -V8NodeFilterCondition::~V8NodeFilterCondition() = default; - -void V8NodeFilterCondition::TraceWrappers( - ScriptWrappableVisitor* visitor) const { - visitor->TraceWrappers(filter_.Cast<v8::Value>()); -} - -unsigned V8NodeFilterCondition::acceptNode(Node* node, - ExceptionState& exception_state) { - if (active_flag_) { - exception_state.ThrowDOMException(kInvalidStateError, - "Filter function can't be recursive"); - return NodeFilter::kFilterReject; - } - WTF::AutoReset<bool> set_active_flag(&active_flag_, true); - v8::Isolate* isolate = script_state_->GetIsolate(); - DCHECK(!script_state_->GetContext().IsEmpty()); - v8::HandleScope handle_scope(isolate); - v8::Local<v8::Object> filter = filter_.NewLocal(isolate); - - if (filter.IsEmpty()) - return NodeFilter::kFilterAccept; - - v8::TryCatch exception_catcher(isolate); - - v8::Local<v8::Function> callback; - v8::Local<v8::Value> receiver; - if (filter->IsFunction()) { - UseCounter::Count(CurrentExecutionContext(isolate), - WebFeature::kNodeFilterIsFunction); - callback = v8::Local<v8::Function>::Cast(filter); - receiver = v8::Undefined(isolate); - } else { - v8::Local<v8::Value> value; - if (!filter - ->Get(script_state_->GetContext(), - V8AtomicString(isolate, "acceptNode")) - .ToLocal(&value) || - !value->IsFunction()) { - exception_state.ThrowTypeError( - "NodeFilter object does not have an acceptNode function"); - return NodeFilter::kFilterReject; - } - UseCounter::Count(CurrentExecutionContext(isolate), - WebFeature::kNodeFilterIsObject); - callback = v8::Local<v8::Function>::Cast(value); - receiver = filter; - } - - v8::Local<v8::Value> node_wrapper = ToV8(node, script_state_.get()); - if (node_wrapper.IsEmpty()) { - if (exception_catcher.HasCaught()) - exception_state.RethrowV8Exception(exception_catcher.Exception()); - return NodeFilter::kFilterReject; - } - - v8::Local<v8::Value> result; - v8::Local<v8::Value> args[] = {node_wrapper}; - if (!V8ScriptRunner::CallFunction(callback, - ExecutionContext::From(script_state_.get()), - receiver, 1, args, isolate) - .ToLocal(&result)) { - exception_state.RethrowV8Exception(exception_catcher.Exception()); - return NodeFilter::kFilterReject; - } - DCHECK(!result.IsEmpty()); - - uint32_t uint32_value; - if (!result->Uint32Value(script_state_->GetContext()).To(&uint32_value)) { - exception_state.RethrowV8Exception(exception_catcher.Exception()); - return NodeFilter::kFilterReject; - } - return uint32_value; -} - -} // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.h b/third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.h deleted file mode 100644 index 876bd48..0000000 --- a/third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.h +++ /dev/null
@@ -1,82 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT - * OWNER OR 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. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_NODE_FILTER_CONDITION_H_ -#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_NODE_FILTER_CONDITION_H_ - -#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" -#include "third_party/blink/renderer/platform/heap/handle.h" -#include "v8/include/v8.h" - -namespace blink { - -class ExceptionState; -class Node; -class ScriptState; - -// V8NodeFilterCondition maintains a Javascript implemented callback for -// filtering Node returned by NodeIterator/TreeWalker. A V8NodeFilterCondition -// is referenced by a NodeIterator/TreeWalker. -// -// Binding generator should generate this code. See crbug.com/630986. -class V8NodeFilterCondition final - : public GarbageCollectedFinalized<V8NodeFilterCondition>, - public TraceWrapperBase { - public: - static V8NodeFilterCondition* CreateOrNull(v8::Local<v8::Value> filter, - ScriptState* script_state) { - return filter->IsNull() ? nullptr - : new V8NodeFilterCondition(filter, script_state); - } - - ~V8NodeFilterCondition(); - virtual void Trace(blink::Visitor* visitor) {} - void TraceWrappers(ScriptWrappableVisitor*) const override; - const char* NameInHeapSnapshot() const override { - return "V8NodeFilterCondition"; - } - - unsigned acceptNode(Node*, ExceptionState&); - v8::Local<v8::Value> Callback(v8::Isolate* isolate) const { - return filter_.NewLocal(isolate); - } - - private: - V8NodeFilterCondition(v8::Local<v8::Value> filter, ScriptState*); - - scoped_refptr<ScriptState> script_state_; - TraceWrapperV8Reference<v8::Object> filter_; - bool active_flag_; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_NODE_FILTER_CONDITION_H_
diff --git a/third_party/blink/renderer/bindings/scripts/code_generator_v8.py b/third_party/blink/renderer/bindings/scripts/code_generator_v8.py index a9e3ea4..9bf9c4d 100644 --- a/third_party/blink/renderer/bindings/scripts/code_generator_v8.py +++ b/third_party/blink/renderer/bindings/scripts/code_generator_v8.py
@@ -185,14 +185,7 @@ include_paths = interface_info.get('dependencies_include_paths') # Select appropriate Jinja template and contents function - # - # A callback interface with constants needs a special handling. - # https://heycam.github.io/webidl/#legacy-callback-interface-object - if interface.is_callback and len(interface.constants) > 0: - header_template_filename = 'legacy_callback_interface.h.tmpl' - cpp_template_filename = 'legacy_callback_interface.cpp.tmpl' - interface_context = v8_callback_interface.legacy_callback_interface_context - elif interface.is_callback: + if interface.is_callback: header_template_filename = 'callback_interface.h.tmpl' cpp_template_filename = 'callback_interface.cpp.tmpl' interface_context = v8_callback_interface.callback_interface_context @@ -218,8 +211,7 @@ if IdlType(interface_name).is_typed_array: template_context['header_includes'].add('core/typed_arrays/dom_typed_array.h') elif interface.is_callback: - if len(interface.constants) > 0: # legacy callback interface - includes.add(interface_info['include_path']) + pass else: template_context['header_includes'].add(interface_info['include_path']) template_context['header_includes'].update(
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 190cf9e..30c030dc 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_callback_interface.py +++ b/third_party/blink/renderer/bindings/scripts/v8_callback_interface.py
@@ -51,7 +51,6 @@ 'platform/bindings/dom_wrapper_world.h', ]) LEGACY_CALLBACK_INTERFACE_CPP_INCLUDES = frozenset([ - 'bindings/core/v8/v8_binding_for_core.h', 'bindings/core/v8/v8_dom_configuration.h', ]) @@ -75,8 +74,16 @@ def callback_interface_context(callback_interface, _): + is_legacy_callback_interface = len(callback_interface.constants) > 0 + includes.clear() includes.update(CALLBACK_INTERFACE_CPP_INCLUDES) + if is_legacy_callback_interface: + includes.update(LEGACY_CALLBACK_INTERFACE_CPP_INCLUDES) + + header_includes = set(CALLBACK_INTERFACE_H_INCLUDES) + if is_legacy_callback_interface: + header_includes.update(LEGACY_CALLBACK_INTERFACE_H_INCLUDES) # https://heycam.github.io/webidl/#dfn-single-operation-callback-interface is_single_operation = True @@ -93,26 +100,17 @@ break return { - 'cpp_class': callback_interface.name, - 'forward_declarations': sorted(forward_declarations(callback_interface)), - 'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES), - 'is_single_operation_callback_interface': is_single_operation, - 'methods': [method_context(operation) - for operation in callback_interface.operations], - 'v8_class': v8_utilities.v8_class_name(callback_interface), - } - - -def legacy_callback_interface_context(callback_interface, _): - includes.clear() - includes.update(LEGACY_CALLBACK_INTERFACE_CPP_INCLUDES) - return { - # TODO(bashi): Fix crbug.com/630986, and add 'methods'. 'constants': [constant_context(constant, callback_interface) for constant in callback_interface.constants], 'cpp_class': callback_interface.name, - 'header_includes': set(LEGACY_CALLBACK_INTERFACE_H_INCLUDES), + 'do_not_check_constants': 'DoNotCheckConstants' in callback_interface.extended_attributes, + 'forward_declarations': sorted(forward_declarations(callback_interface)), + 'header_includes': header_includes, 'interface_name': callback_interface.name, + 'is_legacy_callback_interface': is_legacy_callback_interface, + 'is_single_operation_callback_interface': is_single_operation, + 'methods': [method_context(operation) + for operation in callback_interface.operations], 'v8_class': v8_utilities.v8_class_name(callback_interface), } @@ -144,13 +142,25 @@ extended_attributes = operation.extended_attributes idl_type = operation.idl_type idl_type_str = str(idl_type) - if idl_type_str not in ['boolean', 'void']: - raise Exception('We only support callbacks that return boolean or void values.') + + # TODO(yukishiino,peria,rakuco): We should have this mapping as part of the + # bindings generator's infrastructure. + native_value_traits_tag_map = { + 'boolean': 'IDLBoolean', + 'unsigned short': 'IDLUnsignedShort', + 'void': None, + } + if idl_type_str in native_value_traits_tag_map: + native_value_traits_tag_name = native_value_traits_tag_map[idl_type_str] + else: + raise Exception("Callback that returns type `%s' is not supported." % idl_type_str) + add_includes_for_operation(operation) context = { 'cpp_type': idl_type.callback_cpp_type, 'idl_type': idl_type_str, 'name': operation.name, + 'native_value_traits_tag': native_value_traits_tag_name, } context.update(arguments_context(operation.arguments)) return context
diff --git a/third_party/blink/renderer/bindings/scripts/v8_interface.py b/third_party/blink/renderer/bindings/scripts/v8_interface.py index b96549c..0930da42 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_interface.py +++ b/third_party/blink/renderer/bindings/scripts/v8_interface.py
@@ -827,6 +827,7 @@ return { 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), + 'cpp_type': constant.idl_type.cpp_type, 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] 'idl_type': constant.idl_type.name, 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureAs]
diff --git a/third_party/blink/renderer/bindings/scripts/v8_types.py b/third_party/blink/renderer/bindings/scripts/v8_types.py index 09682084..bf74a91 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_types.py +++ b/third_party/blink/renderer/bindings/scripts/v8_types.py
@@ -126,7 +126,6 @@ 'Dictionary': 'Dictionary', 'EventHandler': 'EventListener*', 'EventListener': 'EventListener*', - 'NodeFilter': 'V8NodeFilterCondition*', 'Promise': 'ScriptPromise', 'ScriptValue': 'ScriptValue', # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345529 @@ -422,7 +421,6 @@ 'core/html/html_table_rows_collection.h', 'core/html/forms/html_data_list_options_collection.h', 'core/html/forms/html_form_controls_collection.h']), - 'NodeFilter': set(['bindings/core/v8/v8_node_filter_condition.h']), 'NodeList': set(['bindings/core/v8/v8_node_list.h', 'core/dom/name_node_list.h', 'core/dom/node_list.h',
diff --git a/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl b/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl index fc4c895..14b3f095 100644 --- a/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl
@@ -10,6 +10,59 @@ namespace blink { +{% if is_legacy_callback_interface %} +// Support of "legacy callback interface" + +// Suppress warning: global constructors, because struct WrapperTypeInfo is +// trivial and does not depend on another global objects. +#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wglobal-constructors" +#endif +const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { + gin::kEmbedderBlink, + {{v8_class}}::DomTemplate, + nullptr, + "{{interface_name}}", + nullptr, + WrapperTypeInfo::kWrapperTypeNoPrototype, + WrapperTypeInfo::kObjectClassId, + WrapperTypeInfo::kNotInheritFromActiveScriptWrappable, +}; +#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) +#pragma clang diagnostic pop +#endif + +{% from 'constants.cpp.tmpl' import install_constants with context %} +static void Install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interface_template) { + // Legacy callback interface must not have a prototype object. + interface_template->RemovePrototype(); + + // Initialize the interface object's template. + V8DOMConfiguration::InitializeDOMInterfaceTemplate( + isolate, interface_template, + {{v8_class}}::wrapperTypeInfo.interface_name, + v8::Local<v8::FunctionTemplate>(), + kV8DefaultWrapperInternalFieldCount); + interface_template->SetLength(0); + + // Register IDL constants. + {# |install_constants| requires |interfaceTemplate| and |prototypeTemplate|. #} + v8::Local<v8::FunctionTemplate> interfaceTemplate = interface_template; + v8::Local<v8::ObjectTemplate> prototypeTemplate = + interface_template->PrototypeTemplate(); + {{install_constants() | trim | indent(2)}} +} + +v8::Local<v8::FunctionTemplate> {{v8_class}}::DomTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) { + return V8DOMConfiguration::DomClassTemplate( + isolate, + world, + const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), + Install{{v8_class}}Template); +} +{% endif %}{# is_legacy_callback_interface #} + {% for method in methods %} v8::Maybe<{{method.cpp_type}}> {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) { @@ -153,9 +206,8 @@ ExceptionState::kExecutionContext, "{{cpp_class}}", "{{method.name}}"); - {% set idl_return_type = 'IDLBoolean' if method.cpp_type == 'bool' %} auto native_result = - NativeValueTraits<{{idl_return_type}}>::NativeValue( + NativeValueTraits<{{method.native_value_traits_tag}}>::NativeValue( GetIsolate(), call_result, exception_state); if (exception_state.HadException()) return v8::Nothing<{{method.cpp_type}}>();
diff --git a/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl b/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl index 66c1064..4682e10a 100644 --- a/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl +++ b/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl
@@ -17,6 +17,16 @@ class {{exported}}{{v8_class}} final : public CallbackInterfaceBase { public: +{% if is_legacy_callback_interface %} + // Support of "legacy callback interface" + static v8::Local<v8::FunctionTemplate> DomTemplate(v8::Isolate*, const DOMWrapperWorld&); + static const WrapperTypeInfo wrapperTypeInfo; + // Constants +{% for constant in constants %} + static constexpr {{constant.cpp_type}} {{constant.name}} = {{constant.value}}; +{% endfor %} + +{% endif %} static {{v8_class}}* Create(v8::Local<v8::Object> callback_object) { return new {{v8_class}}(callback_object); }
diff --git a/third_party/blink/renderer/bindings/templates/legacy_callback_interface.cpp.tmpl b/third_party/blink/renderer/bindings/templates/legacy_callback_interface.cpp.tmpl deleted file mode 100644 index 2ed2904..0000000 --- a/third_party/blink/renderer/bindings/templates/legacy_callback_interface.cpp.tmpl +++ /dev/null
@@ -1,75 +0,0 @@ -{% filter format_blink_cpp_source_code %} - -{% include 'copyright_block.txt' %} -#include "{{this_include_header_path}}" - -{% for filename in cpp_includes %} -#include "{{filename}}" -{% endfor %} - -namespace blink { - -// Suppress warning: global constructors, because struct WrapperTypeInfo is -// trivial and does not depend on another global objects. -#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wglobal-constructors" -#endif -const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { - gin::kEmbedderBlink, - {{v8_class}}::DomTemplate, - nullptr, - "{{interface_name}}", - nullptr, - WrapperTypeInfo::kWrapperTypeNoPrototype, - WrapperTypeInfo::kObjectClassId, - WrapperTypeInfo::kNotInheritFromActiveScriptWrappable, -}; -#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) -#pragma clang diagnostic pop -#endif - -void {{v8_class}}::TypeErrorConstructorCallback( - const v8::FunctionCallbackInfo<v8::Value>& info) { - V8ThrowException::ThrowTypeError(info.GetIsolate(), - "Illegal constructor: {{interface_name}}"); -} - -{% from 'constants.cpp.tmpl' import install_constants with context %} -static void Install{{v8_class}}Template( - v8::Isolate* isolate, - const DOMWrapperWorld& world, - v8::Local<v8::FunctionTemplate> interfaceTemplate) { - // Legacy callback interface must not have a prototype object. - interfaceTemplate->RemovePrototype(); - - // Initialize the interface object's template. - V8DOMConfiguration::InitializeDOMInterfaceTemplate(isolate, interfaceTemplate, - {{v8_class}}::wrapperTypeInfo.interface_name, v8::Local<v8::FunctionTemplate>(), - kV8DefaultWrapperInternalFieldCount); - interfaceTemplate->SetCallHandler({{v8_class}}::TypeErrorConstructorCallback); - interfaceTemplate->SetLength(0); - - v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate); - ALLOW_UNUSED_LOCAL(signature); - v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate(); - ALLOW_UNUSED_LOCAL(instanceTemplate); - v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate(); - ALLOW_UNUSED_LOCAL(prototypeTemplate); - - // Register DOM constants. - {{install_constants() | trim | indent(2)}} -} - -v8::Local<v8::FunctionTemplate> {{v8_class}}::DomTemplate(v8::Isolate* isolate, - const DOMWrapperWorld& world) { - return V8DOMConfiguration::DomClassTemplate( - isolate, - world, - const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), - Install{{v8_class}}Template); -} - -} // namespace blink - -{% endfilter %}{# format_blink_cpp_source_code #}
diff --git a/third_party/blink/renderer/bindings/templates/legacy_callback_interface.h.tmpl b/third_party/blink/renderer/bindings/templates/legacy_callback_interface.h.tmpl deleted file mode 100644 index cbf0373..0000000 --- a/third_party/blink/renderer/bindings/templates/legacy_callback_interface.h.tmpl +++ /dev/null
@@ -1,24 +0,0 @@ -{% filter format_blink_cpp_source_code %} - -{% include 'copyright_block.txt' %} -#ifndef {{v8_class}}_h -#define {{v8_class}}_h - -{% for filename in header_includes %} -#include "{{filename}}" -{% endfor %} - -namespace blink { - -class {{v8_class}} final { - STATIC_ONLY({{v8_class}}); - public: - static v8::Local<v8::FunctionTemplate> DomTemplate(v8::Isolate*, const DOMWrapperWorld&); - {{exported}} static const WrapperTypeInfo wrapperTypeInfo; - {{exported}} static void TypeErrorConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); -}; - -} -#endif // {{v8_class}}_h - -{% endfilter %}{# format_blink_cpp_source_code #}
diff --git a/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl b/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl index 3bd27b3..9453730 100644 --- a/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl +++ b/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl
@@ -151,7 +151,7 @@ } {% endif %} {% if argument.is_callback_interface %} -{# FIXME: remove EventListener/NodeFilter special case. crbug.com/630986 #} +{# FIXME: remove EventListener special case. crbug.com/630986 #} {% if argument.idl_type == 'EventListener' %} if (!IsUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->IsObject()) { {{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not an object.")}} @@ -162,31 +162,31 @@ {% else %}{# method.name == 'AddEventListener' #} {{argument.name}} = V8EventListenerHelper::GetEventListener(ScriptState::Current(info.GetIsolate()), info[{{argument.index}}], false, kListenerFindOrCreate); {% endif %}{# method.name #} -{% elif argument.idl_type == 'NodeFilter' %} -{{argument.name}} = V8NodeFilterCondition::CreateOrNull(info[{{argument.index}}], ScriptState::Current(info.GetIsolate())); -{% else %}{# argument.idl_type == 'EventListener'/'NodeFilter' #} +{% else %}{# argument.idl_type == 'EventListener' #} if (info[{{argument.index}}]->IsObject()) { {{argument.name}} = V8{{argument.idl_type}}::Create(info[{{argument.index}}].As<v8::Object>()); -{% if argument.is_optional %} +{% if argument.is_nullable %} } else if (info[{{argument.index}}]->IsNullOrUndefined()) { {{argument.name}} = nullptr; -{% elif argument.is_nullable %} -} else if ({{argument.index}} < info.Length() && info[{{argument.index}}]->IsNullOrUndefined()) { +{% elif argument.is_optional %} +{# TODO(yukishiino): Disallows ES null for optional arguments. #} +} else if (info[{{argument.index}}]->IsNullOrUndefined()) { {{argument.name}} = nullptr; {% endif %} } else { {{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not an object.")}} return; } -{% endif %}{# argument.idl_type == 'EventListener'/'NodeFilter' #} +{% endif %}{# argument.idl_type == 'EventListener' #} {% elif argument.is_callback_function %} if (info[{{argument.index}}]->IsFunction()) { {{v8_value_to_local_cpp_value(argument)}} -{% if argument.is_optional %} +{% if argument.is_nullable %} } else if (info[{{argument.index}}]->IsNullOrUndefined()) { {{argument.name}} = nullptr; -{% elif argument.is_nullable %} -} else if ({{argument.index}} < info.Length() && info[{{argument.index}}]->IsNullOrUndefined()) { +{% elif argument.is_optional %} +{# TODO(yukishiino): Disallows ES null for optional arguments. #} +} else if (info[{{argument.index}}]->IsNullOrUndefined()) { {{argument.name}} = nullptr; {% endif %} } else {
diff --git a/third_party/blink/renderer/bindings/templates/templates.gni b/third_party/blink/renderer/bindings/templates/templates.gni index 4a40cc4..8cd38ce9 100644 --- a/third_party/blink/renderer/bindings/templates/templates.gni +++ b/third_party/blink/renderer/bindings/templates/templates.gni
@@ -21,8 +21,6 @@ "interface.cpp.tmpl", "interface.h.tmpl", "interface_base.cpp.tmpl", - "legacy_callback_interface.cpp.tmpl", - "legacy_callback_interface.h.tmpl", "methods.cpp.tmpl", "partial_interface.cpp.tmpl", "partial_interface.h.tmpl",
diff --git a/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl b/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl index a4e66db..52e9f58 100644 --- a/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl +++ b/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl
@@ -80,7 +80,7 @@ attribute long svgAttribute; attribute long xmlAttribute; // Non-wrapper types - attribute NodeFilter nodeFilterAttribute; + readonly attribute NodeFilter nodeFilterAttribute; attribute SerializedScriptValue serializedScriptValueAttribute; attribute any anyAttribute; // Custom type conversions
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_functions.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_functions.cc index 8ba23c6..bac6753 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_functions.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_callback_functions.cc
@@ -180,7 +180,7 @@ V8VoidCallbackFunction* voidCallbackFunctionArg; if (info[0]->IsFunction()) { voidCallbackFunctionArg = V8VoidCallbackFunction::Create(info[0].As<v8::Function>()); - } else if (0 < info.Length() && info[0]->IsNullOrUndefined()) { + } else if (info[0]->IsNullOrUndefined()) { voidCallbackFunctionArg = nullptr; } else { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodNullableCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
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 02c8fcf2..0bbc58c 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
@@ -3,19 +3,26 @@ // found in the LICENSE file. // This file has been auto-generated from the Jinja2 template -// third_party/blink/renderer/bindings/templates/legacy_callback_interface.cpp.tmpl +// third_party/blink/renderer/bindings/templates/callback_interface.cpp.tmpl // by the script code_generator_v8.py. // DO NOT MODIFY! // clang-format off + #include "v8_test_legacy_callback_interface.h" +#include "bindings/core/v8/generated_code_helper.h" +#include "bindings/core/v8/idl_types.h" +#include "bindings/core/v8/native_value_traits_impl.h" #include "bindings/core/v8/v8_binding_for_core.h" #include "bindings/core/v8/v8_dom_configuration.h" -#include "bindings/tests/idls/core/test_legacy_callback_interface.h" +#include "bindings/core/v8/v8_node.h" +#include "core/execution_context/execution_context.h" namespace blink { +// Support of "legacy callback interface" + // Suppress warning: global constructors, because struct WrapperTypeInfo is // trivial and does not depend on another global objects. #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) @@ -36,34 +43,22 @@ #pragma clang diagnostic pop #endif -void V8TestLegacyCallbackInterface::TypeErrorConstructorCallback( - const v8::FunctionCallbackInfo<v8::Value>& info) { - V8ThrowException::ThrowTypeError(info.GetIsolate(), - "Illegal constructor: TestLegacyCallbackInterface"); -} - -static void InstallV8TestLegacyCallbackInterfaceTemplate( - v8::Isolate* isolate, - const DOMWrapperWorld& world, - v8::Local<v8::FunctionTemplate> interfaceTemplate) { +static void InstallV8TestLegacyCallbackInterfaceTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interface_template) { // Legacy callback interface must not have a prototype object. - interfaceTemplate->RemovePrototype(); + interface_template->RemovePrototype(); // Initialize the interface object's template. - V8DOMConfiguration::InitializeDOMInterfaceTemplate(isolate, interfaceTemplate, - V8TestLegacyCallbackInterface::wrapperTypeInfo.interface_name, v8::Local<v8::FunctionTemplate>(), + V8DOMConfiguration::InitializeDOMInterfaceTemplate( + isolate, interface_template, + V8TestLegacyCallbackInterface::wrapperTypeInfo.interface_name, + v8::Local<v8::FunctionTemplate>(), kV8DefaultWrapperInternalFieldCount); - interfaceTemplate->SetCallHandler(V8TestLegacyCallbackInterface::TypeErrorConstructorCallback); - interfaceTemplate->SetLength(0); + interface_template->SetLength(0); - v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate); - ALLOW_UNUSED_LOCAL(signature); - v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate(); - ALLOW_UNUSED_LOCAL(instanceTemplate); - v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate(); - ALLOW_UNUSED_LOCAL(prototypeTemplate); - - // Register DOM constants. + // Register IDL constants. + v8::Local<v8::FunctionTemplate> interfaceTemplate = interface_template; + v8::Local<v8::ObjectTemplate> prototypeTemplate = + interface_template->PrototypeTemplate(); static constexpr V8DOMConfiguration::ConstantConfiguration V8TestLegacyCallbackInterfaceConstants[] = { {"CONST_VALUE_USHORT_42", V8DOMConfiguration::kConstantTypeUnsignedShort, static_cast<int>(42)}, }; @@ -73,8 +68,7 @@ static_assert(42 == TestLegacyCallbackInterface::kConstValueUshort42, "the value of TestLegacyCallbackInterface_kConstValueUshort42 does not match with implementation"); } -v8::Local<v8::FunctionTemplate> V8TestLegacyCallbackInterface::DomTemplate(v8::Isolate* isolate, - const DOMWrapperWorld& world) { +v8::Local<v8::FunctionTemplate> V8TestLegacyCallbackInterface::DomTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) { return V8DOMConfiguration::DomClassTemplate( isolate, world, @@ -82,4 +76,130 @@ InstallV8TestLegacyCallbackInterfaceTemplate); } +v8::Maybe<uint16_t> V8TestLegacyCallbackInterface::acceptNode(ScriptWrappable* callback_this_value, Node* node) { + // This function implements "call a user object's operation". + // https://heycam.github.io/webidl/#call-a-user-objects-operation + + if (!IsCallbackFunctionRunnable(CallbackRelevantScriptState())) { + // Wrapper-tracing for the callback function makes the function object and + // its creation context alive. Thus it's safe to use the creation context + // of the callback function here. + v8::HandleScope handle_scope(GetIsolate()); + CHECK(!CallbackObject().IsEmpty()); + v8::Context::Scope context_scope(CallbackObject()->CreationContext()); + V8ThrowException::ThrowError( + GetIsolate(), + ExceptionMessages::FailedToExecute( + "acceptNode", + "TestLegacyCallbackInterface", + "The provided callback is no longer runnable.")); + return v8::Nothing<uint16_t>(); + } + + // step 7. Prepare to run script with relevant settings. + ScriptState::Scope callback_relevant_context_scope( + CallbackRelevantScriptState()); + // step 8. Prepare to run a callback with stored settings. + if (IncumbentScriptState()->GetContext().IsEmpty()) { + V8ThrowException::ThrowError( + GetIsolate(), + ExceptionMessages::FailedToExecute( + "acceptNode", + "TestLegacyCallbackInterface", + "The provided callback is no longer runnable.")); + return v8::Nothing<uint16_t>(); + } + v8::Context::BackupIncumbentScope backup_incumbent_scope( + IncumbentScriptState()->GetContext()); + + v8::Local<v8::Function> function; + if (IsCallbackObjectCallable()) { + // step 9.1. If value's interface is a single operation callback interface + // and !IsCallable(O) is true, then set X to O. + function = CallbackObject().As<v8::Function>(); + } else { + // step 9.2.1. Let getResult be Get(O, opName). + // step 9.2.2. If getResult is an abrupt completion, set completion to + // getResult and jump to the step labeled return. + v8::Local<v8::Value> value; + if (!CallbackObject()->Get(CallbackRelevantScriptState()->GetContext(), + V8String(GetIsolate(), "acceptNode")) + .ToLocal(&value)) { + return v8::Nothing<uint16_t>(); + } + // step 10. If !IsCallable(X) is false, then set completion to a new + // Completion{[[Type]]: throw, [[Value]]: a newly created TypeError + // object, [[Target]]: empty}, and jump to the step labeled return. + if (!value->IsFunction()) { + V8ThrowException::ThrowTypeError( + GetIsolate(), + ExceptionMessages::FailedToExecute( + "acceptNode", + "TestLegacyCallbackInterface", + "The provided callback is not callable.")); + return v8::Nothing<uint16_t>(); + } + function = value.As<v8::Function>(); + } + + v8::Local<v8::Value> this_arg; + 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) { + // step 2. If thisArg was not given, let thisArg be undefined. + this_arg = v8::Undefined(GetIsolate()); + } else { + this_arg = ToV8(callback_this_value, CallbackRelevantScriptState()); + } + + // step 12. Let esArgs be the result of converting args to an ECMAScript + // arguments list. If this throws an exception, set completion to the + // completion value representing the thrown exception and jump to the step + // labeled return. + v8::Local<v8::Object> argument_creation_context = + CallbackRelevantScriptState()->GetContext()->Global(); + ALLOW_UNUSED_LOCAL(argument_creation_context); + v8::Local<v8::Value> nodeHandle = ToV8(node, argument_creation_context, GetIsolate()); + v8::Local<v8::Value> argv[] = { nodeHandle }; + + // step 13. Let callResult be Call(X, thisArg, esArgs). + v8::Local<v8::Value> call_result; + if (!V8ScriptRunner::CallFunction( + function, + ExecutionContext::From(CallbackRelevantScriptState()), + this_arg, + 1, + argv, + GetIsolate()).ToLocal(&call_result)) { + // step 14. If callResult is an abrupt completion, set completion to + // callResult and jump to the step labeled return. + return v8::Nothing<uint16_t>(); + } + + // step 15. Set completion to the result of converting callResult.[[Value]] to + // an IDL value of the same type as the operation's return type. + { + ExceptionState exception_state(GetIsolate(), + ExceptionState::kExecutionContext, + "TestLegacyCallbackInterface", + "acceptNode"); + auto native_result = + NativeValueTraits<IDLUnsignedShort>::NativeValue( + GetIsolate(), call_result, exception_state); + if (exception_state.HadException()) + return v8::Nothing<uint16_t>(); + else + return v8::Just<uint16_t>(native_result); + } +} + +CORE_EXTERN_TEMPLATE_EXPORT +v8::Maybe<uint16_t> V8PersistentCallbackInterface<V8TestLegacyCallbackInterface>::acceptNode(ScriptWrappable* callback_this_value, Node* node) { + return Proxy()->acceptNode( + callback_this_value, node); +} + } // namespace blink
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 b9caee7..36d2945 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
@@ -3,25 +3,76 @@ // found in the LICENSE file. // This file has been auto-generated from the Jinja2 template -// third_party/blink/renderer/bindings/templates/legacy_callback_interface.h.tmpl +// third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl // by the script code_generator_v8.py. // DO NOT MODIFY! // clang-format off + #ifndef V8TestLegacyCallbackInterface_h #define V8TestLegacyCallbackInterface_h #include "core/core_export.h" +#include "platform/bindings/callback_interface_base.h" #include "platform/bindings/dom_wrapper_world.h" namespace blink { -class V8TestLegacyCallbackInterface final { - STATIC_ONLY(V8TestLegacyCallbackInterface); +class Node; + +class CORE_EXPORT V8TestLegacyCallbackInterface final : public CallbackInterfaceBase { public: + // Support of "legacy callback interface" static v8::Local<v8::FunctionTemplate> DomTemplate(v8::Isolate*, const DOMWrapperWorld&); - CORE_EXPORT static const WrapperTypeInfo wrapperTypeInfo; - CORE_EXPORT static void TypeErrorConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); + static const WrapperTypeInfo wrapperTypeInfo; + // Constants + static constexpr uint16_t CONST_VALUE_USHORT_42 = 42; + + static V8TestLegacyCallbackInterface* Create(v8::Local<v8::Object> callback_object) { + return new V8TestLegacyCallbackInterface(callback_object); + } + + ~V8TestLegacyCallbackInterface() override = default; + + // 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; + + private: + explicit V8TestLegacyCallbackInterface(v8::Local<v8::Object> callback_object) + : CallbackInterfaceBase(callback_object, kSingleOperation) {} }; -} + +template <> +class CORE_TEMPLATE_CLASS_EXPORT V8PersistentCallbackInterface<V8TestLegacyCallbackInterface> final : public V8PersistentCallbackInterfaceBase { + using V8CallbackInterface = V8TestLegacyCallbackInterface; + + public: + ~V8PersistentCallbackInterface() override = default; + + CORE_EXTERN_TEMPLATE_EXPORT + v8::Maybe<uint16_t> acceptNode(ScriptWrappable* callback_this_value, Node* node) WARN_UNUSED_RESULT; + + private: + explicit V8PersistentCallbackInterface(V8CallbackInterface* callback_interface) + : V8PersistentCallbackInterfaceBase(callback_interface) {} + + V8CallbackInterface* Proxy() { + return As<V8CallbackInterface>(); + } + + template <typename V8CallbackInterface> + friend V8PersistentCallbackInterface<V8CallbackInterface>* + ToV8PersistentCallbackInterface(V8CallbackInterface*); +}; + +// V8TestLegacyCallbackInterface is designed to be used with wrapper-tracing. +// As blink::Persistent does not perform wrapper-tracing, use of +// |WrapPersistent| for callback interfaces is likely (if not always) misuse. +// Thus, this code prohibits such a use case. The call sites should explicitly +// use WrapPersistent(V8PersistentCallbackInterface<T>*). +Persistent<V8TestLegacyCallbackInterface> WrapPersistent(V8TestLegacyCallbackInterface*) = delete; + +} // namespace blink + #endif // V8TestLegacyCallbackInterface_h
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc index 0be1593..2776754 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc
@@ -39,7 +39,7 @@ #include "bindings/core/v8/v8_int32_array.h" #include "bindings/core/v8/v8_iterator.h" #include "bindings/core/v8/v8_node.h" -#include "bindings/core/v8/v8_node_filter_condition.h" +#include "bindings/core/v8/v8_node_filter.h" #include "bindings/core/v8/v8_shadow_root.h" #include "bindings/core/v8/v8_test_callback_interface.h" #include "bindings/core/v8/v8_test_dictionary.h" @@ -842,21 +842,6 @@ V8SetReturnValue(info, ToV8(WTF::GetPtr(impl->nodeFilterAttribute()), info.Holder(), info.GetIsolate())); } -static void nodeFilterAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) { - v8::Isolate* isolate = info.GetIsolate(); - ALLOW_UNUSED_LOCAL(isolate); - - v8::Local<v8::Object> holder = info.Holder(); - ALLOW_UNUSED_LOCAL(holder); - - TestObject* impl = V8TestObject::ToImpl(holder); - - // Prepare the value to be set. - V8NodeFilterCondition* cppValue = V8NodeFilter::ToImplWithTypeCheck(info.GetIsolate(), v8Value); - - impl->setNodeFilterAttribute(cppValue); -} - static void serializedScriptValueAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); @@ -5618,7 +5603,7 @@ V8TestCallbackInterface* testCallbackInterfaceArg; if (info[0]->IsObject()) { testCallbackInterfaceArg = V8TestCallbackInterface::Create(info[0].As<v8::Object>()); - } else if (0 < info.Length() && info[0]->IsNullOrUndefined()) { + } else if (info[0]->IsNullOrUndefined()) { testCallbackInterfaceArg = nullptr; } else { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodTestCallbackInterfaceOrNullArg", "TestObject", "The callback provided as parameter 1 is not an object.")); @@ -5876,8 +5861,13 @@ return; } - V8NodeFilterCondition* nodeFilterArg; - nodeFilterArg = V8NodeFilterCondition::CreateOrNull(info[0], ScriptState::Current(info.GetIsolate())); + V8NodeFilter* nodeFilterArg; + if (info[0]->IsObject()) { + nodeFilterArg = V8NodeFilter::Create(info[0].As<v8::Object>()); + } else { + V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodNodeFilterArg", "TestObject", "The callback provided as parameter 1 is not an object.")); + return; + } impl->voidMethodNodeFilterArg(nodeFilterArg); } @@ -9821,14 +9811,6 @@ TestObjectV8Internal::nodeFilterAttributeAttributeGetter(info); } -void V8TestObject::nodeFilterAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { - RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_nodeFilterAttribute_Setter"); - - v8::Local<v8::Value> v8Value = info[0]; - - TestObjectV8Internal::nodeFilterAttributeAttributeSetter(v8Value, info); -} - void V8TestObject::serializedScriptValueAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_serializedScriptValueAttribute_Getter"); @@ -13233,7 +13215,7 @@ { "imeAttribute", V8TestObject::imeAttributeAttributeGetterCallback, V8TestObject::imeAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, { "svgAttribute", V8TestObject::svgAttributeAttributeGetterCallback, V8TestObject::svgAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, { "xmlAttribute", V8TestObject::xmlAttributeAttributeGetterCallback, V8TestObject::xmlAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, - { "nodeFilterAttribute", V8TestObject::nodeFilterAttributeAttributeGetterCallback, V8TestObject::nodeFilterAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, + { "nodeFilterAttribute", V8TestObject::nodeFilterAttributeAttributeGetterCallback, nullptr, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, { "serializedScriptValueAttribute", V8TestObject::serializedScriptValueAttributeAttributeGetterCallback, V8TestObject::serializedScriptValueAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, { "anyAttribute", V8TestObject::anyAttributeAttributeGetterCallback, V8TestObject::anyAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds }, { "promiseAttribute", V8TestObject::promiseAttributeAttributeGetterCallback, V8TestObject::promiseAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kDoNotCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAllWorlds },
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h index a5ae1482..b75a2d74 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h +++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h
@@ -132,7 +132,6 @@ CORE_EXPORT static void xmlAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); CORE_EXPORT static void xmlAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); CORE_EXPORT static void nodeFilterAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); - CORE_EXPORT static void nodeFilterAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); CORE_EXPORT static void serializedScriptValueAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); CORE_EXPORT static void serializedScriptValueAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); CORE_EXPORT static void anyAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 6f64a9c..cd1aff4 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -1819,6 +1819,7 @@ "html/forms/file_input_type_test.cc", "html/forms/form_data_test.cc", "html/forms/html_form_control_element_test.cc", + "html/forms/html_form_element_test.cc", "html/forms/html_input_element_test.cc", "html/forms/html_output_element_test.cc", "html/forms/html_select_element_test.cc", @@ -2002,6 +2003,7 @@ "paint/compositing/compositing_layer_assigner_test.cc", "paint/compositing/compositing_layer_property_updater_test.cc", "paint/compositing/compositing_reason_finder_test.cc", + "paint/compositing/compositing_requirements_updater_test.cc", "paint/compositing/paint_layer_compositor_test.cc", "paint/css_mask_painter_test.cc", "paint/first_meaningful_paint_detector_test.cc",
diff --git a/third_party/blink/renderer/core/DEPS b/third_party/blink/renderer/core/DEPS index eb0c9fa..f5cc566 100644 --- a/third_party/blink/renderer/core/DEPS +++ b/third_party/blink/renderer/core/DEPS
@@ -8,8 +8,10 @@ "+cc/base/region.h", "+cc/input/overscroll_behavior.h", "+cc/layers/content_layer_client.h", + "+cc/layers/layer.h", "+cc/layers/layer_position_constraint.h", "+cc/layers/layer_sticky_position_constraint.h", + "+cc/layers/scrollbar_layer_interface.h", "+cc/paint/display_item_list.h", "+gpu/config/gpu_feature_info.h", "-inspector/v8",
diff --git a/third_party/blink/renderer/core/css/CSSProperties.json5 b/third_party/blink/renderer/core/css/CSSProperties.json5 index 4a6979d..41b62d049 100644 --- a/third_party/blink/renderer/core/css/CSSProperties.json5 +++ b/third_party/blink/renderer/core/css/CSSProperties.json5
@@ -1950,7 +1950,7 @@ inherited: true, svg: true, name_for_methods: "MarkerEndResource", - converter: "ConvertElementReference", + converter: "ConvertFragmentIdentifier", keywords: ["none"], typedom_types: ["Keyword"] }, @@ -1960,7 +1960,7 @@ inherited: true, svg: true, name_for_methods: "MarkerMidResource", - converter: "ConvertElementReference", + converter: "ConvertFragmentIdentifier", keywords: ["none"], typedom_types: ["Keyword"] }, @@ -1970,7 +1970,7 @@ inherited: true, svg: true, name_for_methods: "MarkerStartResource", - converter: "ConvertElementReference", + converter: "ConvertFragmentIdentifier", keywords: ["none"], typedom_types: ["Keyword"] }, @@ -1979,7 +1979,7 @@ property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], svg: true, name_for_methods: "MaskerResource", - converter: "ConvertElementReference", + converter: "ConvertFragmentIdentifier", }, { name: "mask-source-type",
diff --git a/third_party/blink/renderer/core/css/invalidation/style_invalidator.h b/third_party/blink/renderer/core/css/invalidation/style_invalidator.h index 057e35c..6a5e4d2 100644 --- a/third_party/blink/renderer/core/css/invalidation/style_invalidator.h +++ b/third_party/blink/renderer/core/css/invalidation/style_invalidator.h
@@ -164,9 +164,7 @@ invalidates_slotted_(data->invalidates_slotted_), data_(data) {} ~RecursionCheckpoint() { - data_->invalidation_sets_.EraseAt( - prev_invalidation_sets_size_, - data_->invalidation_sets_.size() - prev_invalidation_sets_size_); + data_->invalidation_sets_.Shrink(prev_invalidation_sets_size_); data_->invalidate_custom_pseudo_ = prev_invalidate_custom_pseudo_; data_->whole_subtree_invalid_ = prev_whole_subtree_invalid_; data_->tree_boundary_crossing_ = tree_boundary_crossing_;
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index c9bedf9..043c463 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc
@@ -1893,13 +1893,6 @@ return CSSColorValue::Create(paint.GetColor().Rgb()); } -CSSValue* ComputedStyleUtils::ValueForSVGResource( - const StyleSVGResource* resource) { - if (resource) - return CSSURIValue::Create(resource->Url()); - return CSSIdentifierValue::Create(CSSValueNone); -} - CSSValue* ComputedStyleUtils::ValueForShadowData(const ShadowData& shadow, const ComputedStyle& style, bool use_spread) {
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.h b/third_party/blink/renderer/core/css/properties/computed_style_utils.h index 2ec83b6..868815b 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.h +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.h
@@ -26,6 +26,11 @@ STATIC_ONLY(ComputedStyleUtils); public: + static inline AtomicString SerializeAsFragmentIdentifier( + const AtomicString& resource) { + return "#" + resource; + } + inline static CSSValue* ZoomAdjustedPixelValueOrAuto( const Length& length, const ComputedStyle& style) { @@ -145,7 +150,6 @@ const ComputedStyle&); static CSSValue* PaintOrderToCSSValueList(const SVGComputedStyle&); static CSSValue* AdjustSVGPaintForCurrentColor(const SVGPaint&, const Color&); - static CSSValue* ValueForSVGResource(const StyleSVGResource*); static CSSValue* ValueForShadowData(const ShadowData&, const ComputedStyle&, bool use_spread);
diff --git a/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc index b8813a2..602abe5a 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc
@@ -28,7 +28,12 @@ const LayoutObject*, Node*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerEndResource()); + if (!svg_style.MarkerEndResource().IsEmpty()) { + return CSSURIValue::Create( + ComputedStyleUtils::SerializeAsFragmentIdentifier( + svg_style.MarkerEndResource())); + } + return CSSIdentifierValue::Create(CSSValueNone); } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc index 4f886cf..9f1346f1 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc
@@ -28,7 +28,12 @@ const LayoutObject*, Node*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerMidResource()); + if (!svg_style.MarkerMidResource().IsEmpty()) { + return CSSURIValue::Create( + ComputedStyleUtils::SerializeAsFragmentIdentifier( + svg_style.MarkerMidResource())); + } + return CSSIdentifierValue::Create(CSSValueNone); } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc index fc475fb..48b3b4f 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc
@@ -28,8 +28,12 @@ const LayoutObject*, Node*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource( - svg_style.MarkerStartResource()); + if (!svg_style.MarkerStartResource().IsEmpty()) { + return CSSURIValue::Create( + ComputedStyleUtils::SerializeAsFragmentIdentifier( + svg_style.MarkerStartResource())); + } + return CSSIdentifierValue::Create(CSSValueNone); } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc index 4f7ca4ff..4f58f38b 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc
@@ -27,7 +27,12 @@ const LayoutObject*, Node*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource(svg_style.MaskerResource()); + if (!svg_style.MaskerResource().IsEmpty()) { + return CSSURIValue::Create( + ComputedStyleUtils::SerializeAsFragmentIdentifier( + svg_style.MaskerResource())); + } + return CSSIdentifierValue::Create(CSSValueNone); } } // namespace CSSLonghand
diff --git a/third_party/blink/renderer/core/css/resolver/element_style_resources.cc b/third_party/blink/renderer/core/css/resolver/element_style_resources.cc index ddb97fe..64fe727d 100644 --- a/third_party/blink/renderer/core/css/resolver/element_style_resources.cc +++ b/third_party/blink/renderer/core/css/resolver/element_style_resources.cc
@@ -103,9 +103,7 @@ if (value.IsLocal(*document_)) { SVGTreeScopeResources& tree_scope_resources = tree_scope.EnsureSVGTreeScopedResources(); - AtomicString decoded_fragment( - DecodeURLEscapeSequences(value.FragmentIdentifier())); - return tree_scope_resources.ResourceForId(decoded_fragment); + return tree_scope_resources.ResourceForId(value.FragmentIdentifier()); } if (allow_external == kAllowExternalResource) return value.EnsureResourceReference();
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 b658ce9..1fea23f 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
@@ -50,7 +50,7 @@ #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/use_counter.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/core/style/style_svg_resource.h" +#include "third_party/blink/renderer/core/svg/svg_uri_reference.h" namespace blink { @@ -109,16 +109,13 @@ value, state.Style()->GetColor(), for_visited_link); } -scoped_refptr<StyleSVGResource> StyleBuilderConverter::ConvertElementReference( +AtomicString StyleBuilderConverter::ConvertFragmentIdentifier( StyleResolverState& state, const CSSValue& value) { - if (!value.IsURIValue()) - return nullptr; - const CSSURIValue& url_value = ToCSSURIValue(value); - SVGResource* resource = - state.GetElementStyleResources().GetSVGResourceFromValue( - state.GetTreeScope(), url_value); - return StyleSVGResource::Create(resource, AtomicString(url_value.Value())); + if (value.IsURIValue()) + return SVGURIReference::FragmentIdentifierFromIRIString( + ToCSSURIValue(value).Value(), state.GetElement()->GetTreeScope()); + return g_null_atom; } LengthBox StyleBuilderConverter::ConvertClip(StyleResolverState& state, @@ -1406,26 +1403,27 @@ if (value.IsValueList()) { const CSSValueList& list = ToCSSValueList(value); DCHECK_EQ(list.length(), 2u); - paint.resource = ConvertElementReference(state, list.Item(0)); + paint.url = ToCSSURIValue(list.Item(0)).Value(); local_value = &list.Item(1); } if (local_value->IsURIValue()) { paint.type = SVG_PAINTTYPE_URI; - paint.resource = ConvertElementReference(state, *local_value); + paint.url = ToCSSURIValue(local_value)->Value(); } else if (local_value->IsIdentifierValue() && ToCSSIdentifierValue(local_value)->GetValueID() == CSSValueNone) { - paint.type = !paint.resource ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE; + paint.type = + paint.url.IsEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE; } else if (local_value->IsIdentifierValue() && ToCSSIdentifierValue(local_value)->GetValueID() == CSSValueCurrentcolor) { paint.color = state.Style()->GetColor(); - paint.type = !paint.resource ? SVG_PAINTTYPE_CURRENTCOLOR - : SVG_PAINTTYPE_URI_CURRENTCOLOR; + paint.type = paint.url.IsEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR + : SVG_PAINTTYPE_URI_CURRENTCOLOR; } else { paint.color = ConvertColor(state, *local_value); - paint.type = - !paint.resource ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_RGBCOLOR; + paint.type = paint.url.IsEmpty() ? SVG_PAINTTYPE_RGBCOLOR + : SVG_PAINTTYPE_URI_RGBCOLOR; } return paint; }
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 16ad90e..63dab695 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
@@ -60,7 +60,6 @@ class StyleAutoColor; class StylePath; class StyleResolverState; -class StyleSVGResource; class TextSizeAdjust; class TranslateTransformOperation; class UnzoomedLength; @@ -92,6 +91,8 @@ public: static scoped_refptr<StyleReflection> ConvertBoxReflect(StyleResolverState&, const CSSValue&); + static AtomicString ConvertFragmentIdentifier(StyleResolverState&, + const CSSValue&); static Color ConvertColor(StyleResolverState&, const CSSValue&, bool for_visited_link = false); @@ -100,9 +101,6 @@ static LengthBox ConvertClip(StyleResolverState&, const CSSValue&); static scoped_refptr<ClipPathOperation> ConvertClipPath(StyleResolverState&, const CSSValue&); - static scoped_refptr<StyleSVGResource> ConvertElementReference( - StyleResolverState&, - const CSSValue&); static FilterOperations ConvertFilterOperations(StyleResolverState&, const CSSValue&); static FilterOperations ConvertOffscreenFilterOperations(const CSSValue&);
diff --git a/third_party/blink/renderer/core/dom/BUILD.gn b/third_party/blink/renderer/core/dom/BUILD.gn index 54f4350..f7e061d3 100644 --- a/third_party/blink/renderer/core/dom/BUILD.gn +++ b/third_party/blink/renderer/core/dom/BUILD.gn
@@ -199,7 +199,6 @@ "node_child_removal_tracker.cc", "node_child_removal_tracker.h", "node_computed_style.h", - "node_filter.h", "node_iterator.cc", "node_iterator.h", "node_iterator_base.cc",
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 833398da..091955aa 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -101,7 +101,6 @@ #include "third_party/blink/renderer/core/dom/ng/slot_assignment_engine.h" #include "third_party/blink/renderer/core/dom/node_child_removal_tracker.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h" -#include "third_party/blink/renderer/core/dom/node_filter.h" #include "third_party/blink/renderer/core/dom/node_iterator.h" #include "third_party/blink/renderer/core/dom/node_lists_node_data.h" #include "third_party/blink/renderer/core/dom/node_rare_data.h" @@ -1779,14 +1778,14 @@ NodeIterator* Document::createNodeIterator(Node* root, unsigned what_to_show, - V8NodeFilterCondition* filter) { + V8NodeFilter* filter) { DCHECK(root); return NodeIterator::Create(root, what_to_show, filter); } TreeWalker* Document::createTreeWalker(Node* root, unsigned what_to_show, - V8NodeFilterCondition* filter) { + V8NodeFilter* filter) { DCHECK(root); return TreeWalker::Create(root, what_to_show, filter); }
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index 7198469..d7455a1 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -184,7 +184,7 @@ class TouchList; class TransformSource; class TreeWalker; -class V8NodeFilterCondition; +class V8NodeFilter; class VisitedLinkState; class WebMouseEvent; struct AnnotatedRegionValue; @@ -510,10 +510,10 @@ NodeIterator* createNodeIterator(Node* root, unsigned what_to_show, - V8NodeFilterCondition*); + V8NodeFilter*); TreeWalker* createTreeWalker(Node* root, unsigned what_to_show, - V8NodeFilterCondition*); + V8NodeFilter*); // Special support for editing Text* CreateEditingTextNode(const String&);
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 66f3d76..8b24e60e 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -125,6 +125,7 @@ #include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h" #include "third_party/blink/renderer/core/layout/layout_text_fragment.h" #include "third_party/blink/renderer/core/layout/layout_view.h" +#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/focus_controller.h" @@ -1912,6 +1913,9 @@ if (this == GetDocument().CssTarget()) GetDocument().SetCSSTarget(nullptr); + if (HasPendingResources()) + SVGResources::RemoveWatchesForElement(*this); + if (GetCustomElementState() == CustomElementState::kCustom) CustomElement::EnqueueDisconnectedCallback(this); else if (IsUpgradedV0CustomElement()) @@ -4795,9 +4799,8 @@ CSSPropertyID property_id, const String& value) { DCHECK(IsStyledElement()); - Document& document = GetDocument(); - style->SetProperty(property_id, value, false, document.GetSecureContextMode(), - document.ElementSheet().Contents()); + style->SetProperty(property_id, value, false, + GetDocument().GetSecureContextMode()); } void Element::AddPropertyToPresentationAttributeStyle(
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index f1533d7d..67433507 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -95,9 +95,10 @@ kIsInCanvasSubtree = 1 << 2, kContainsFullScreenElement = 1 << 3, kIsInTopLayer = 1 << 4, - kContainsPersistentVideo = 1 << 5, + kHasPendingResources = 1 << 5, + kContainsPersistentVideo = 1 << 6, - kNumberOfElementFlags = 6, // Size of bitfield used to store the flags. + kNumberOfElementFlags = 7, // Size of bitfield used to store the flags. }; enum class ShadowRootType; @@ -764,6 +765,15 @@ virtual bool ShouldForceLegacyLayout() const { return false; } + bool HasPendingResources() const { + return HasElementFlag(ElementFlags::kHasPendingResources); + } + void SetHasPendingResources() { + SetElementFlag(ElementFlags::kHasPendingResources); + } + void ClearHasPendingResources() { + ClearElementFlag(ElementFlags::kHasPendingResources); + } virtual void BuildPendingResource() {} void V0SetCustomElementDefinition(V0CustomElementDefinition*);
diff --git a/third_party/blink/renderer/core/dom/node_filter.h b/third_party/blink/renderer/core/dom/node_filter.h deleted file mode 100644 index 0443b19..0000000 --- a/third_party/blink/renderer/core/dom/node_filter.h +++ /dev/null
@@ -1,70 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no) - * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) - * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_FILTER_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_FILTER_H_ - -#include "third_party/blink/renderer/platform/heap/handle.h" - -namespace blink { - -// We never create NodeFilter instances. -// The IDL interface 'NodeFilter' is represented by V8NodeFilterCondition and a -// V8 value in Blink. -class NodeFilter final { - STATIC_ONLY(NodeFilter); - - public: - /** - * The following constants are returned by the acceptNode() - * method: - */ - enum { kFilterAccept = 1, kFilterReject = 2, kFilterSkip = 3 }; - - /** - * These are the available values for the whatToShow parameter. - * They are the same as the set of possible types for Node, and - * their values are derived by using a bit position corresponding - * to the value of NodeType for the equivalent node type. - */ - enum { - kShowAll = 0xFFFFFFFF, - kShowElement = 0x00000001, - kShowAttribute = 0x00000002, - kShowText = 0x00000004, - kShowCdataSection = 0x00000008, - kShowEntityReference = 0x00000010, - kShowEntity = 0x00000020, - kShowProcessingInstruction = 0x00000040, - kShowComment = 0x00000080, - kShowDocument = 0x00000100, - kShowDocumentType = 0x00000200, - kShowDocumentFragment = 0x00000400, - kShowNotation = 0x00000800 - }; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_FILTER_H_
diff --git a/third_party/blink/renderer/core/dom/node_filter.idl b/third_party/blink/renderer/core/dom/node_filter.idl index e1031df5..e8ca30b8 100644 --- a/third_party/blink/renderer/core/dom/node_filter.idl +++ b/third_party/blink/renderer/core/dom/node_filter.idl
@@ -20,7 +20,9 @@ // https://dom.spec.whatwg.org/#interface-nodefilter -callback interface NodeFilter { +[ + DoNotCheckConstants +] callback interface NodeFilter { // Constants for acceptNode() const unsigned short FILTER_ACCEPT = 1; const unsigned short FILTER_REJECT = 2; @@ -41,8 +43,5 @@ const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400; const unsigned long SHOW_NOTATION = 0x800; // historical - // This function declaration doesn't generate any code because - // V8NodeFilterCondition represents this callback interface in Blink. - // TODO(bashi): Fix crbug.com/630986, and use generated code. - [RaisesException] unsigned short acceptNode(Node node); + unsigned short acceptNode(Node node); };
diff --git a/third_party/blink/renderer/core/dom/node_iterator.cc b/third_party/blink/renderer/core/dom/node_iterator.cc index 11e81a0b..2bcd8a6 100644 --- a/third_party/blink/renderer/core/dom/node_iterator.cc +++ b/third_party/blink/renderer/core/dom/node_iterator.cc
@@ -25,6 +25,7 @@ #include "third_party/blink/renderer/core/dom/node_iterator.h" #include "third_party/blink/renderer/bindings/core/v8/exception_state.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_node_filter.h" #include "third_party/blink/renderer/core/dom/attr.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/node_traversal.h" @@ -64,7 +65,7 @@ NodeIterator::NodeIterator(Node* root_node, unsigned what_to_show, - V8NodeFilterCondition* filter) + V8NodeFilter* filter) : NodeIteratorBase(root_node, what_to_show, filter), reference_node_(root(), true) { // If NodeIterator target is Attr node, don't subscribe for nodeWillBeRemoved, @@ -83,7 +84,7 @@ // of the rejected node. Hence, kFilterReject is the same as kFilterSkip. Node* provisional_result = candidate_node_.node; bool node_was_accepted = AcceptNode(provisional_result, exception_state) == - NodeFilter::kFilterAccept; + V8NodeFilter::FILTER_ACCEPT; if (exception_state.HadException()) break; if (node_was_accepted) { @@ -107,7 +108,7 @@ // of the rejected node. Hence, kFilterReject is the same as kFilterSkip. Node* provisional_result = candidate_node_.node; bool node_was_accepted = AcceptNode(provisional_result, exception_state) == - NodeFilter::kFilterAccept; + V8NodeFilter::FILTER_ACCEPT; if (exception_state.HadException()) break; if (node_was_accepted) {
diff --git a/third_party/blink/renderer/core/dom/node_iterator.h b/third_party/blink/renderer/core/dom/node_iterator.h index c63c016..be7d1ac 100644 --- a/third_party/blink/renderer/core/dom/node_iterator.h +++ b/third_party/blink/renderer/core/dom/node_iterator.h
@@ -25,7 +25,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_ITERATOR_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_ITERATOR_H_ -#include "third_party/blink/renderer/core/dom/node_filter.h" #include "third_party/blink/renderer/core/dom/node_iterator_base.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -41,7 +40,7 @@ public: static NodeIterator* Create(Node* root_node, unsigned what_to_show, - V8NodeFilterCondition* filter) { + V8NodeFilter* filter) { return new NodeIterator(root_node, what_to_show, filter); } @@ -62,7 +61,7 @@ void TraceWrappers(ScriptWrappableVisitor*) const override; private: - NodeIterator(Node*, unsigned what_to_show, V8NodeFilterCondition*); + NodeIterator(Node*, unsigned what_to_show, V8NodeFilter*); class NodePointer { DISALLOW_NEW();
diff --git a/third_party/blink/renderer/core/dom/node_iterator_base.cc b/third_party/blink/renderer/core/dom/node_iterator_base.cc index b9c7009..57166331 100644 --- a/third_party/blink/renderer/core/dom/node_iterator_base.cc +++ b/third_party/blink/renderer/core/dom/node_iterator_base.cc
@@ -25,26 +25,66 @@ #include "third_party/blink/renderer/core/dom/node_iterator_base.h" #include "third_party/blink/renderer/bindings/core/v8/exception_state.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_node_filter_condition.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_node_filter.h" #include "third_party/blink/renderer/core/dom/node.h" -#include "third_party/blink/renderer/core/dom/node_filter.h" +#include "third_party/blink/renderer/core/frame/use_counter.h" namespace blink { NodeIteratorBase::NodeIteratorBase(Node* root_node, unsigned what_to_show, - V8NodeFilterCondition* node_filter) + V8NodeFilter* node_filter) : root_(root_node), what_to_show_(what_to_show), filter_(node_filter) {} unsigned NodeIteratorBase::AcceptNode(Node* node, - ExceptionState& exception_state) const { + ExceptionState& exception_state) { + // DOM 6. Traversal + // https://dom.spec.whatwg.org/#traversal + // Each NodeIterator and TreeWalker object has an associated active flag to + // avoid recursive invocations. + if (active_flag_) { + // 1. If the active flag is set, then throw an "InvalidStateError" + // DOMException. + exception_state.ThrowDOMException(kInvalidStateError, + "Filter function can't be recursive"); + return V8NodeFilter::FILTER_REJECT; + } + + // 2. Let n be node’s nodeType attribute value minus 1. + // 3. If the nth bit (where 0 is the least significant bit) of whatToShow is + // not set, then return FILTER_SKIP. + // // The bit twiddling here is done to map DOM node types, which are given as // integers from 1 through 14, to whatToShow bit masks. if (!(((1 << (node->getNodeType() - 1)) & what_to_show_))) - return NodeFilter::kFilterSkip; + return V8NodeFilter::FILTER_SKIP; + + // 4. If filter is null, then return FILTER_ACCEPT. if (!filter_) - return NodeFilter::kFilterAccept; - return filter_->acceptNode(node, exception_state); + return V8NodeFilter::FILTER_ACCEPT; + + // 5. Set the active flag. + WTF::AutoReset<bool> set_active_flag(&active_flag_, true); + + // 6. Let result be the return value of call a user object’s operation with + // filter, "acceptNode", and « node ». If this throws an exception, then unset + // the active flag and rethrow the exception. + v8::TryCatch try_catch(filter_->GetIsolate()); + uint16_t result = 0; + if (!filter_->acceptNode(nullptr, node).To(&result)) { + exception_state.RethrowV8Exception(try_catch.Exception()); + return 0; + } + + UseCounter::Count( + ExecutionContext::From(filter_->CallbackRelevantScriptState()), + filter_->IsCallbackObjectCallableForNodeIteratorBase() + ? WebFeature::kNodeFilterIsFunction + : WebFeature::kNodeFilterIsObject); + + // 7. Unset the active flag. + // 8. Return result. + return result; } void NodeIteratorBase::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/dom/node_iterator_base.h b/third_party/blink/renderer/core/dom/node_iterator_base.h index 5976b4ab..d860ce0 100644 --- a/third_party/blink/renderer/core/dom/node_iterator_base.h +++ b/third_party/blink/renderer/core/dom/node_iterator_base.h
@@ -32,25 +32,28 @@ class ExceptionState; class Node; -class V8NodeFilterCondition; +class V8NodeFilter; class NodeIteratorBase : public GarbageCollectedMixin { public: + virtual ~NodeIteratorBase() = default; + Node* root() const { return root_.Get(); } unsigned whatToShow() const { return what_to_show_; } - V8NodeFilterCondition* filter() const { return filter_.Get(); } + V8NodeFilter* filter() const { return filter_.Get(); } void Trace(blink::Visitor*) override; virtual void TraceWrappers(ScriptWrappableVisitor*) const; protected: - NodeIteratorBase(Node*, unsigned what_to_show, V8NodeFilterCondition*); - unsigned AcceptNode(Node*, ExceptionState&) const; + NodeIteratorBase(Node*, unsigned what_to_show, V8NodeFilter*); + unsigned AcceptNode(Node*, ExceptionState&); private: Member<Node> root_; unsigned what_to_show_; - TraceWrapperMember<V8NodeFilterCondition> filter_; + TraceWrapperMember<V8NodeFilter> filter_; + bool active_flag_ = false; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/dom/node_rare_data.h b/third_party/blink/renderer/core/dom/node_rare_data.h index 03589702..3197cdd 100644 --- a/third_party/blink/renderer/core/dom/node_rare_data.h +++ b/third_party/blink/renderer/core/dom/node_rare_data.h
@@ -201,7 +201,7 @@ enum { kConnectedFrameCountBits = 10, // Must fit Page::maxNumberOfFrames. - kNumberOfElementFlags = 6, + kNumberOfElementFlags = 7, kNumberOfDynamicRestyleFlags = 14 };
diff --git a/third_party/blink/renderer/core/dom/tree_walker.cc b/third_party/blink/renderer/core/dom/tree_walker.cc index 2685062c..c016bff 100644 --- a/third_party/blink/renderer/core/dom/tree_walker.cc +++ b/third_party/blink/renderer/core/dom/tree_walker.cc
@@ -26,6 +26,7 @@ #include "third_party/blink/renderer/bindings/core/v8/exception_messages.h" #include "third_party/blink/renderer/bindings/core/v8/exception_state.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_node_filter.h" #include "third_party/blink/renderer/core/dom/container_node.h" #include "third_party/blink/renderer/core/dom/node_traversal.h" #include "third_party/blink/renderer/core/dom/node_traversal_strategy.h" @@ -34,7 +35,7 @@ TreeWalker::TreeWalker(Node* root_node, unsigned what_to_show, - V8NodeFilterCondition* filter) + V8NodeFilter* filter) : NodeIteratorBase(root_node, what_to_show, filter), current_(root()) {} void TreeWalker::setCurrentNode(Node* node) { @@ -56,7 +57,7 @@ unsigned accept_node_result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (accept_node_result == NodeFilter::kFilterAccept) + if (accept_node_result == V8NodeFilter::FILTER_ACCEPT) return SetCurrent(node); } return nullptr; @@ -68,16 +69,16 @@ if (exception_state.HadException()) return nullptr; switch (accept_node_result) { - case NodeFilter::kFilterAccept: + case V8NodeFilter::FILTER_ACCEPT: current_ = node; return current_.Get(); - case NodeFilter::kFilterSkip: + case V8NodeFilter::FILTER_SKIP: if (node->hasChildren()) { node = node->firstChild(); continue; } break; - case NodeFilter::kFilterReject: + case V8NodeFilter::FILTER_REJECT: break; } do { @@ -100,16 +101,16 @@ if (exception_state.HadException()) return nullptr; switch (accept_node_result) { - case NodeFilter::kFilterAccept: + case V8NodeFilter::FILTER_ACCEPT: current_ = node; return current_.Get(); - case NodeFilter::kFilterSkip: + case V8NodeFilter::FILTER_SKIP: if (node->lastChild()) { node = node->lastChild(); continue; } break; - case NodeFilter::kFilterReject: + case V8NodeFilter::FILTER_REJECT: break; } do { @@ -149,7 +150,7 @@ return nullptr; // 3. If result is FILTER_ACCEPT, then set the currentNode attribute to // node and return node. - if (result == NodeFilter::kFilterAccept) + if (result == V8NodeFilter::FILTER_ACCEPT) return SetCurrent(node); // 4. Set sibling to node's first child if type is next, and node's last // child if type is previous. @@ -157,7 +158,7 @@ // 5. If result is FILTER_REJECT or sibling is null, then set sibling to // node's next sibling if type is next, and node's previous sibling if // type is previous. - if (result == NodeFilter::kFilterReject || !sibling) + if (result == V8NodeFilter::FILTER_REJECT || !sibling) sibling = Strategy::NextNode(*node); } // 3. Set node to its parent. @@ -170,7 +171,7 @@ unsigned result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (result == NodeFilter::kFilterAccept) + if (result == V8NodeFilter::FILTER_ACCEPT) return nullptr; } } @@ -191,17 +192,17 @@ unsigned accept_node_result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (accept_node_result == NodeFilter::kFilterReject) + if (accept_node_result == V8NodeFilter::FILTER_REJECT) continue; while (Node* last_child = node->lastChild()) { node = last_child; accept_node_result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (accept_node_result == NodeFilter::kFilterReject) + if (accept_node_result == V8NodeFilter::FILTER_REJECT) break; } - if (accept_node_result == NodeFilter::kFilterAccept) { + if (accept_node_result == V8NodeFilter::FILTER_ACCEPT) { current_ = node; return current_.Get(); } @@ -215,7 +216,7 @@ unsigned accept_node_result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (accept_node_result == NodeFilter::kFilterAccept) + if (accept_node_result == V8NodeFilter::FILTER_ACCEPT) return SetCurrent(node); } return nullptr; @@ -229,9 +230,9 @@ unsigned accept_node_result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (accept_node_result == NodeFilter::kFilterAccept) + if (accept_node_result == V8NodeFilter::FILTER_ACCEPT) return SetCurrent(node); - if (accept_node_result == NodeFilter::kFilterReject) + if (accept_node_result == V8NodeFilter::FILTER_REJECT) break; } while (Node* next_sibling = @@ -240,9 +241,9 @@ unsigned accept_node_result = AcceptNode(node, exception_state); if (exception_state.HadException()) return nullptr; - if (accept_node_result == NodeFilter::kFilterAccept) + if (accept_node_result == V8NodeFilter::FILTER_ACCEPT) return SetCurrent(node); - if (accept_node_result == NodeFilter::kFilterSkip) + if (accept_node_result == V8NodeFilter::FILTER_SKIP) goto Children; } return nullptr;
diff --git a/third_party/blink/renderer/core/dom/tree_walker.h b/third_party/blink/renderer/core/dom/tree_walker.h index e732300..b38454b1 100644 --- a/third_party/blink/renderer/core/dom/tree_walker.h +++ b/third_party/blink/renderer/core/dom/tree_walker.h
@@ -25,7 +25,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TREE_WALKER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TREE_WALKER_H_ -#include "third_party/blink/renderer/core/dom/node_filter.h" #include "third_party/blink/renderer/core/dom/node_iterator_base.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -41,7 +40,7 @@ public: static TreeWalker* Create(Node* root_node, unsigned what_to_show, - V8NodeFilterCondition* filter) { + V8NodeFilter* filter) { return new TreeWalker(root_node, what_to_show, filter); } @@ -61,7 +60,7 @@ void TraceWrappers(ScriptWrappableVisitor*) const override; private: - TreeWalker(Node*, unsigned what_to_show, V8NodeFilterCondition*); + TreeWalker(Node*, unsigned what_to_show, V8NodeFilter*); Node* SetCurrent(Node*); template <typename Strategy>
diff --git a/third_party/blink/renderer/core/editing/iterators/character_iterator.cc b/third_party/blink/renderer/core/editing/iterators/character_iterator.cc index d07c56d..8ac17fd 100644 --- a/third_party/blink/renderer/core/editing/iterators/character_iterator.cc +++ b/third_party/blink/renderer/core/editing/iterators/character_iterator.cc
@@ -63,7 +63,7 @@ } template <typename Strategy> -const Node* CharacterIteratorAlgorithm<Strategy>::CurrentContainer() const { +const Node& CharacterIteratorAlgorithm<Strategy>::CurrentContainer() const { return text_iterator_.CurrentContainer(); } @@ -104,9 +104,9 @@ const { if (!text_iterator_.AtEnd()) { if (text_iterator_.length() > 1) { - const Node* n = text_iterator_.CurrentContainer(); + const Node& node = text_iterator_.CurrentContainer(); int offset = text_iterator_.StartOffsetInCurrentContainer() + run_offset_; - return PositionTemplate<Strategy>::EditingPositionOf(n, offset); + return PositionTemplate<Strategy>::EditingPositionOf(&node, offset); } DCHECK(!run_offset_); } @@ -118,9 +118,9 @@ const { if (!text_iterator_.AtEnd()) { if (text_iterator_.length() > 1) { - const Node* n = text_iterator_.CurrentContainer(); + const Node& node = text_iterator_.CurrentContainer(); int offset = text_iterator_.StartOffsetInCurrentContainer() + run_offset_; - return PositionTemplate<Strategy>::EditingPositionOf(n, offset + 1); + return PositionTemplate<Strategy>::EditingPositionOf(&node, offset + 1); } DCHECK(!run_offset_); }
diff --git a/third_party/blink/renderer/core/editing/iterators/character_iterator.h b/third_party/blink/renderer/core/editing/iterators/character_iterator.h index e3c8bdf..9f060a5 100644 --- a/third_party/blink/renderer/core/editing/iterators/character_iterator.h +++ b/third_party/blink/renderer/core/editing/iterators/character_iterator.h
@@ -65,7 +65,7 @@ int CharacterOffset() const { return offset_; } const Document& OwnerDocument() const; - const Node* CurrentContainer() const; + const Node& CurrentContainer() const; int StartOffset() const; int EndOffset() const;
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 9f42381..0e13f7e 100644 --- a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc +++ b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc
@@ -844,10 +844,10 @@ template <typename Strategy> const Node* TextIteratorAlgorithm<Strategy>::GetNode() const { - const Node* node = CurrentContainer(); - if (node->IsCharacterDataNode()) - return node; - return Strategy::ChildAt(*node, StartOffsetInCurrentContainer()); + const Node& node = CurrentContainer(); + if (node.IsCharacterDataNode()) + return &node; + return Strategy::ChildAt(node, StartOffsetInCurrentContainer()); } template <typename Strategy> @@ -867,11 +867,11 @@ } template <typename Strategy> -const Node* TextIteratorAlgorithm<Strategy>::CurrentContainer() const { +const Node& TextIteratorAlgorithm<Strategy>::CurrentContainer() const { if (!text_state_.PositionNode()) - return end_container_; + return *end_container_; EnsurePositionContainer(); - return text_state_.PositionContainerNode(); + return *text_state_.PositionContainerNode(); } template <typename Strategy> @@ -947,14 +947,14 @@ PositionTemplate<Strategy> TextIteratorAlgorithm<Strategy>::StartPositionInCurrentContainer() const { return PositionTemplate<Strategy>::EditingPositionOf( - CurrentContainer(), StartOffsetInCurrentContainer()); + &CurrentContainer(), StartOffsetInCurrentContainer()); } template <typename Strategy> PositionTemplate<Strategy> TextIteratorAlgorithm<Strategy>::EndPositionInCurrentContainer() const { return PositionTemplate<Strategy>::EditingPositionOf( - CurrentContainer(), EndOffsetInCurrentContainer()); + &CurrentContainer(), EndOffsetInCurrentContainer()); } template <typename Strategy>
diff --git a/third_party/blink/renderer/core/editing/iterators/text_iterator.h b/third_party/blink/renderer/core/editing/iterators/text_iterator.h index 75ddebc..81af941 100644 --- a/third_party/blink/renderer/core/editing/iterators/text_iterator.h +++ b/third_party/blink/renderer/core/editing/iterators/text_iterator.h
@@ -75,7 +75,7 @@ const Node* GetNode() const; const Document& OwnerDocument() const; - const Node* CurrentContainer() const; + const Node& CurrentContainer() const; int StartOffsetInCurrentContainer() const; int EndOffsetInCurrentContainer() const; PositionTemplate<Strategy> StartPositionInCurrentContainer() const;
diff --git a/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc b/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc index 1e851b0b..b30fd72 100644 --- a/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc +++ b/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc
@@ -267,8 +267,8 @@ // Ignore text emitted by TextIterator for non-text nodes (e.g. implicit // newlines) - const Node* const node = marked_text.CurrentContainer(); - if (!node->IsTextNode()) + const Node& node = marked_text.CurrentContainer(); + if (!node.IsTextNode()) continue; DocumentMarker* const new_marker = create_marker_from_offsets( @@ -277,13 +277,13 @@ } } -void DocumentMarkerController::AddMarkerToNode(const Node* node, +void DocumentMarkerController::AddMarkerToNode(const Node& node, DocumentMarker* new_marker) { possibly_existing_marker_types_.Add(new_marker->GetType()); SetContext(document_); Member<MarkerLists>& markers = - markers_.insert(node, nullptr).stored_value->value; + markers_.insert(&node, nullptr).stored_value->value; if (!markers) { markers = new MarkerLists; markers->Grow(DocumentMarker::kMarkerTypeIndexesCount); @@ -296,7 +296,7 @@ DocumentMarkerList* const list = ListForType(markers, new_marker_type); list->Add(new_marker); - InvalidatePaintForNode(*node); + InvalidatePaintForNode(node); } // Moves markers from src_node to dst_node. Markers are moved if their start @@ -342,7 +342,7 @@ } void DocumentMarkerController::RemoveMarkersInternal( - const Node* node, + const Node& node, unsigned start_offset, int length, DocumentMarker::MarkerTypes marker_types) { @@ -353,7 +353,7 @@ return; DCHECK(!(markers_.IsEmpty())); - MarkerLists* markers = markers_.at(node); + MarkerLists* const markers = markers_.at(&node); if (!markers) return; @@ -380,7 +380,7 @@ } if (empty_lists_count == DocumentMarker::kMarkerTypeIndexesCount) { - markers_.erase(node); + markers_.erase(&node); if (markers_.IsEmpty()) { possibly_existing_marker_types_ = 0; SetContext(nullptr); @@ -390,7 +390,7 @@ if (!doc_dirty) return; - InvalidatePaintForNode(*node); + InvalidatePaintForNode(node); } DocumentMarker* DocumentMarkerController::FirstMarkerIntersectingOffsetRange(
diff --git a/third_party/blink/renderer/core/editing/markers/document_marker_controller.h b/third_party/blink/renderer/core/editing/markers/document_marker_controller.h index ff9f5c4f..c0d3de4 100644 --- a/third_party/blink/renderer/core/editing/markers/document_marker_controller.h +++ b/third_party/blink/renderer/core/editing/markers/document_marker_controller.h
@@ -143,7 +143,7 @@ void AddMarkerInternal( const EphemeralRange&, std::function<DocumentMarker*(int, int)> create_marker_from_offsets); - void AddMarkerToNode(const Node*, DocumentMarker*); + void AddMarkerToNode(const Node&, DocumentMarker*); using MarkerLists = HeapVector<Member<DocumentMarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; @@ -153,7 +153,7 @@ bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); - void RemoveMarkersInternal(const Node*, + void RemoveMarkersInternal(const Node&, unsigned start_offset, int length, DocumentMarker::MarkerTypes);
diff --git a/third_party/blink/renderer/core/editing/selection_adjuster.cc b/third_party/blink/renderer/core/editing/selection_adjuster.cc index af992e1..c982005 100644 --- a/third_party/blink/renderer/core/editing/selection_adjuster.cc +++ b/third_party/blink/renderer/core/editing/selection_adjuster.cc
@@ -773,16 +773,19 @@ template <typename Strategy> static SelectionTemplate<Strategy> AdjustSelection( const SelectionTemplate<Strategy>& selection) { + if (selection.IsNone()) + return selection; const EphemeralRangeTemplate<Strategy>& range = selection.ComputeRange(); - const SelectionType selection_type = ComputeSelectionType(range); - if (selection_type == kCaretSelection) { + DCHECK(!NeedsLayoutTreeUpdate(range.StartPosition())) << range; + if (range.IsCollapsed() || + // TODO(editing-dev): Consider this canonicalization is really needed. + MostBackwardCaretPosition(range.StartPosition()) == + MostBackwardCaretPosition(range.EndPosition())) { return typename SelectionTemplate<Strategy>::Builder() .Collapse(PositionWithAffinityTemplate<Strategy>( range.StartPosition(), selection.Affinity())) .Build(); } - - DCHECK_EQ(selection_type, kRangeSelection); // "Constrain" the selection to be the smallest equivalent range of // nodes. This is a somewhat arbitrary choice, but experience shows that // it is useful to make to make the selection "canonical" (if only for @@ -802,22 +805,6 @@ .SetAsBackwardSelection(minimal_range) .Build(); } - - private: - template <typename Strategy> - static SelectionType ComputeSelectionType( - const EphemeralRangeTemplate<Strategy>& range) { - if (range.IsNull()) - return kNoSelection; - DCHECK(!NeedsLayoutTreeUpdate(range.StartPosition())) << range; - if (range.IsCollapsed()) - return kCaretSelection; - // TODO(editing-dev): Consider this canonicalization is really needed. - if (MostBackwardCaretPosition(range.StartPosition()) == - MostBackwardCaretPosition(range.EndPosition())) - return kCaretSelection; - return kRangeSelection; - } }; SelectionInDOMTree SelectionAdjuster::AdjustSelectionType(
diff --git a/third_party/blink/renderer/core/editing/web_substring_util.mm b/third_party/blink/renderer/core/editing/web_substring_util.mm index b6c0e511..4c2f665 100644 --- a/third_party/blink/renderer/core/editing/web_substring_util.mm +++ b/third_party/blink/renderer/core/editing/web_substring_util.mm
@@ -87,8 +87,8 @@ if (!num_characters) continue; - const Node* container = it.CurrentContainer(); - LayoutObject* layout_object = container->GetLayoutObject(); + const Node& container = it.CurrentContainer(); + LayoutObject* layout_object = container.GetLayoutObject(); DCHECK(layout_object); if (!layout_object) continue;
diff --git a/third_party/blink/renderer/core/exported/web_form_control_element.cc b/third_party/blink/renderer/core/exported/web_form_control_element.cc index c2817dc..7402ee27f 100644 --- a/third_party/blink/renderer/core/exported/web_form_control_element.cc +++ b/third_party/blink/renderer/core/exported/web_form_control_element.cc
@@ -215,6 +215,10 @@ return WebFormElement(ConstUnwrap<HTMLFormControlElement>()->Form()); } +unsigned WebFormControlElement::UniqueRendererFormControlId() const { + return ConstUnwrap<HTMLFormControlElement>()->UniqueRendererFormControlId(); +} + WebFormControlElement::WebFormControlElement(HTMLFormControlElement* elem) : WebElement(elem) {}
diff --git a/third_party/blink/renderer/core/exported/web_form_element.cc b/third_party/blink/renderer/core/exported/web_form_element.cc index f07a24a6..97330c2 100644 --- a/third_party/blink/renderer/core/exported/web_form_element.cc +++ b/third_party/blink/renderer/core/exported/web_form_element.cc
@@ -58,6 +58,10 @@ return ConstUnwrap<HTMLFormElement>()->method(); } +unsigned WebFormElement::UniqueRendererFormId() const { + return ConstUnwrap<HTMLFormElement>()->UniqueRendererFormId(); +} + void WebFormElement::GetFormControlElements( WebVector<WebFormControlElement>& result) const { const HTMLFormElement* form = ConstUnwrap<HTMLFormElement>();
diff --git a/third_party/blink/renderer/core/exported/web_plugin_container_test.cc b/third_party/blink/renderer/core/exported/web_plugin_container_test.cc index 1210242..440fe27 100644 --- a/third_party/blink/renderer/core/exported/web_plugin_container_test.cc +++ b/third_party/blink/renderer/core/exported/web_plugin_container_test.cc
@@ -34,6 +34,7 @@ #include <string> #include "build/build_config.h" +#include "cc/layers/layer.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_clipboard.h" @@ -1325,16 +1326,19 @@ public: explicit CompositedPlugin(const WebPluginParams& params) : FakeWebPlugin(params), - layer_(Platform::Current()->CompositorSupport()->CreateLayer()) {} + layer_(cc::Layer::Create()), + web_layer_( + Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer( + layer_.get())) {} - WebLayer* GetWebLayer() const { return layer_.get(); } + WebLayer* GetWebLayer() const { return web_layer_.get(); } // WebPlugin bool Initialize(WebPluginContainer* container) override { if (!FakeWebPlugin::Initialize(container)) return false; - container->SetWebLayer(layer_.get(), false); + container->SetWebLayer(web_layer_.get(), false); return true; } @@ -1346,7 +1350,8 @@ private: ~CompositedPlugin() override = default; - std::unique_ptr<WebLayer> layer_; + scoped_refptr<cc::Layer> layer_; + std::unique_ptr<WebLayer> web_layer_; }; } // namespace
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 66b7e9b..025d199c 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -2767,7 +2767,7 @@ else contents_size = ContentsSize(); - IntSize visible_content_size = VisibleContentRect().Size(); + IntSize visible_content_size = VisibleContentSize(); if (contents_size.Height() <= visible_content_size.Height() && contents_size.Width() <= visible_content_size.Width()) return kNotScrollableNoOverflow; @@ -4459,7 +4459,7 @@ // If no scrollbars are present, the content may still be scrollable. if (!scrollbar) { - IntSize scroll_size = ContentsSize() - VisibleContentRect().Size(); + IntSize scroll_size = ContentsSize() - VisibleContentSize(); scroll_size.ClampNegativeToZero(); return orientation == kHorizontalScrollbar ? scroll_size.Width() : scroll_size.Height(); @@ -4585,7 +4585,7 @@ if (HasOverlayScrollbars()) return; - IntSize full_visible_size = VisibleContentRect(kIncludeScrollbars).Size(); + IntSize full_visible_size = VisibleContentSize(kIncludeScrollbars); bool attempt_to_remove_scrollbars = (option == kFirstPass && doc_size.Width() <= full_visible_size.Width() &&
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index a8e290b..30fc3f4 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -31,10 +31,13 @@ #include "third_party/blink/renderer/core/frame/visual_viewport.h" #include <memory> + +#include "cc/layers/layer.h" +#include "cc/layers/scrollbar_layer_interface.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_compositor_support.h" +#include "third_party/blink/public/platform/web_layer.h" #include "third_party/blink/public/platform/web_scrollbar.h" -#include "third_party/blink/public/platform/web_scrollbar_layer.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -47,7 +50,6 @@ #include "third_party/blink/renderer/core/layout/text_autosizer.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/page.h" -#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/platform/geometry/double_rect.h" @@ -444,9 +446,9 @@ GraphicsLayer* scrollbar_graphics_layer = is_horizontal ? overlay_scrollbar_horizontal_.get() : overlay_scrollbar_vertical_.get(); - std::unique_ptr<WebScrollbarLayer>& web_scrollbar_layer = - is_horizontal ? web_overlay_scrollbar_horizontal_ - : web_overlay_scrollbar_vertical_; + std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup>& + scrollbar_layer_group = is_horizontal ? scrollbar_layer_group_horizontal_ + : scrollbar_layer_group_vertical_; ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::MobileTheme(); int thumb_thickness = clampTo<int>( @@ -459,23 +461,23 @@ std::floor(GetPage().GetChromeClient().WindowToViewportScalar( theme.ScrollbarMargin()))); - if (!web_scrollbar_layer) { + if (!scrollbar_layer_group) { ScrollingCoordinator* coordinator = GetPage().GetScrollingCoordinator(); DCHECK(coordinator); ScrollbarOrientation webcore_orientation = is_horizontal ? kHorizontalScrollbar : kVerticalScrollbar; - web_scrollbar_layer = coordinator->CreateSolidColorScrollbarLayer( + scrollbar_layer_group = coordinator->CreateSolidColorScrollbarLayer( webcore_orientation, thumb_thickness, scrollbar_margin, false); // The compositor will control the scrollbar's visibility. Set to invisible // by default so scrollbars don't show up in layout tests. - web_scrollbar_layer->Layer()->SetOpacity(0); + scrollbar_layer_group->layer->SetOpacity(0.f); scrollbar_graphics_layer->SetContentsToPlatformLayer( - web_scrollbar_layer->Layer(), + scrollbar_layer_group->web_layer.get(), /*prevent_contents_opaque_changes=*/false); scrollbar_graphics_layer->SetDrawsContent(false); - web_scrollbar_layer->SetScrollLayer( - inner_viewport_scroll_layer_->PlatformLayer()); + scrollbar_layer_group->scrollbar_layer->SetScrollElementId( + inner_viewport_scroll_layer_->PlatformLayer()->GetElementId()); } int x_position = is_horizontal
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.h b/third_party/blink/renderer/core/frame/visual_viewport.h index d0ba337..ccf495d 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.h +++ b/third_party/blink/renderer/core/frame/visual_viewport.h
@@ -32,11 +32,13 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_VISUAL_VIEWPORT_H_ #include <memory> + #include "base/single_thread_task_runner.h" #include "third_party/blink/public/platform/web_scrollbar.h" #include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/event.h" +#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h" #include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/geometry/int_size.h" @@ -45,10 +47,6 @@ #include "third_party/blink/renderer/platform/scroll/scrollable_area.h" namespace blink { -class WebScrollbarLayer; -} - -namespace blink { class GraphicsContext; class GraphicsLayer; @@ -286,10 +284,13 @@ std::unique_ptr<GraphicsLayer> page_scale_layer_; std::unique_ptr<GraphicsLayer> inner_viewport_scroll_layer_; - // The layers of the WebScrollbarLayers are referenced from the GraphicsLayers - // so the GraphicsLayers must be destructed first (declared after). - std::unique_ptr<WebScrollbarLayer> web_overlay_scrollbar_horizontal_; - std::unique_ptr<WebScrollbarLayer> web_overlay_scrollbar_vertical_; + // The layers of the ScrollbarLayerGroups are referenced from the + // GraphicsLayers, so the GraphicsLayers must be destructed first (declared + // after). + std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup> + scrollbar_layer_group_horizontal_; + std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup> + scrollbar_layer_group_vertical_; std::unique_ptr<GraphicsLayer> overlay_scrollbar_horizontal_; std::unique_ptr<GraphicsLayer> overlay_scrollbar_vertical_;
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element.cc b/third_party/blink/renderer/core/html/forms/html_form_control_element.cc index 1a3f8837..9900480 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_control_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_form_control_element.cc
@@ -63,6 +63,8 @@ validity_is_dirty_(false), blocks_form_submission_(false) { SetHasCustomStyleCallbacks(); + static unsigned next_free_unique_id = 0; + unique_renderer_form_control_id_ = next_free_unique_id++; } HTMLFormControlElement::~HTMLFormControlElement() = default;
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element.h b/third_party/blink/renderer/core/html/forms/html_form_control_element.h index e85ee8d4..008500b 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_control_element.h +++ b/third_party/blink/renderer/core/html/forms/html_form_control_element.h
@@ -142,6 +142,10 @@ bool BlocksFormSubmission() const { return blocks_form_submission_; } void SetBlocksFormSubmission(bool value) { blocks_form_submission_ = value; } + unsigned UniqueRendererFormControlId() const { + return unique_renderer_form_control_id_; + } + protected: HTMLFormControlElement(const QualifiedName& tag_name, Document&); @@ -190,6 +194,8 @@ // Requests validity recalc for all ancestor fieldsets, if exist. void FieldSetAncestorsSetNeedsValidityCheck(Node*); + unsigned unique_renderer_form_control_id_; + enum AncestorDisabledState { kAncestorDisabledStateUnknown, kAncestorDisabledStateEnabled,
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc b/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc index e64489b..b34b281 100644 --- a/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_form_control_element_test.cc
@@ -147,4 +147,15 @@ << "DOM mutation should not handle validation message UI in it."; } +TEST_F(HTMLFormControlElementTest, UniqueRendererFormControlId) { + SetHtmlInnerHTML("<body><input id=input1><input id=input2></body>"); + auto* form_control1 = ToHTMLFormControlElement(GetElementById("input1")); + unsigned first_id = form_control1->UniqueRendererFormControlId(); + auto* form_control2 = ToHTMLFormControlElement(GetElementById("input2")); + EXPECT_EQ(first_id + 1, form_control2->UniqueRendererFormControlId()); + SetHtmlInnerHTML("<body><select id=select1></body>"); + auto* form_control3 = ToHTMLFormControlElement(GetElementById("select1")); + EXPECT_EQ(first_id + 2, form_control3->UniqueRendererFormControlId()); +} + } // namespace blink
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 699de82..e774a4b 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
@@ -75,7 +75,10 @@ has_elements_associated_by_form_attribute_(false), did_finish_parsing_children_(false), is_in_reset_function_(false), - was_demoted_(false) {} + was_demoted_(false) { + static unsigned next_nique_renderer_form_id = 0; + unique_renderer_form_id_ = next_nique_renderer_form_id++; +} HTMLFormElement* HTMLFormElement::Create(Document& document) { UseCounter::Count(document, WebFeature::kFormElement);
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 6ba89f9..5097d875 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
@@ -112,6 +112,8 @@ void ConstructFormDataSet(HTMLFormControlElement* submit_button, FormData& form_data); + unsigned UniqueRendererFormId() const { return unique_renderer_form_id_; } + private: explicit HTMLFormElement(Document&); @@ -173,6 +175,8 @@ // function in 'submit' event handler. Member<FormSubmission> planned_navigation_; + unsigned unique_renderer_form_id_; + bool is_submitting_ = false; bool in_user_js_submit_event_ = false;
diff --git a/third_party/blink/renderer/core/html/forms/html_form_element_test.cc b/third_party/blink/renderer/core/html/forms/html_form_element_test.cc new file mode 100644 index 0000000..a9ce244e --- /dev/null +++ b/third_party/blink/renderer/core/html/forms/html_form_element_test.cc
@@ -0,0 +1,34 @@ +// 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 "third_party/blink/renderer/core/html/forms/html_form_element.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" + +namespace blink { + +class HTMLFormElementTest : public PageTestBase { + protected: + void SetUp() override; +}; + +void HTMLFormElementTest::SetUp() { + PageTestBase::SetUp(); + GetDocument().SetMimeType("text/html"); +} + +TEST_F(HTMLFormElementTest, UniqueRendererFormId) { + SetHtmlInnerHTML( + "<body><form id='form1'></form><form id='form2'></form></body>"); + auto* form1 = ToHTMLFormElement(GetElementById("form1")); + unsigned first_id = form1->UniqueRendererFormId(); + auto* form2 = ToHTMLFormElement(GetElementById("form2")); + EXPECT_EQ(first_id + 1, form2->UniqueRendererFormId()); + SetHtmlInnerHTML("<body><form id='form3'></form></body>"); + auto* form3 = ToHTMLFormElement(GetElementById("form3")); + EXPECT_EQ(first_id + 2, form3->UniqueRendererFormId()); +} + +} // namespace blink
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 66338a6..4915251 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
@@ -1871,8 +1871,8 @@ else if (auto* option = ToHTMLOptionElementOrNull(element)) item_string = option->TextIndentedToRespectGroupLabel(); - if (GetLayoutObject()) - ApplyTextTransform(GetLayoutObject()->Style(), item_string, ' '); + if (GetLayoutObject() && GetLayoutObject()->Style()) + GetLayoutObject()->Style()->ApplyTextTransform(&item_string); return item_string; }
diff --git a/third_party/blink/renderer/core/html/image_document.cc b/third_party/blink/renderer/core/html/image_document.cc index 0d57ff5..e2d4634 100644 --- a/third_party/blink/renderer/core/html/image_document.cc +++ b/third_party/blink/renderer/core/html/image_document.cc
@@ -122,6 +122,9 @@ if (!length) return; + if (IsDetached()) + return; + LocalFrame* frame = GetDocument()->GetFrame(); Settings* settings = frame->GetSettings(); if (!frame->GetContentSettingsClient()->AllowImage(
diff --git a/third_party/blink/renderer/core/input/pointer_event_manager.cc b/third_party/blink/renderer/core/input/pointer_event_manager.cc index 57f9b8e..c0a5097 100644 --- a/third_party/blink/renderer/core/input/pointer_event_manager.cc +++ b/third_party/blink/renderer/core/input/pointer_event_manager.cc
@@ -617,8 +617,21 @@ if (pointer_event->type() == EventTypeNames::pointerup || pointer_event->type() == EventTypeNames::pointercancel) { ReleasePointerCapture(pointer_event->pointerId()); + // Send got/lostpointercapture rightaway if necessary. - ProcessPendingPointerCapture(pointer_event); + if (pointer_event->type() == EventTypeNames::pointerup) { + // If pointerup releases the capture we also send boundary events + // rightaway when the pointer that supports hover. The following function + // does nothing when there was no capture to begin with in the first + // place. + ProcessCaptureAndPositionOfPointerEvent(pointer_event, target, + canvas_region_id, &mouse_event); + } else { + // Don't send out/leave events in this case as it is a little tricky. + // This case happens for the drag operation and currently we don't + // let the page know that the pointer left the page while dragging. + ProcessPendingPointerCapture(pointer_event); + } if (pointer_event->isPrimary()) { prevent_mouse_event_for_pointer_type_[ToPointerTypeIndex(
diff --git a/third_party/blink/renderer/core/inspector/DEPS b/third_party/blink/renderer/core/inspector/DEPS index 11ab397..5676a4a 100644 --- a/third_party/blink/renderer/core/inspector/DEPS +++ b/third_party/blink/renderer/core/inspector/DEPS
@@ -1,4 +1,5 @@ include_rules = [ + "+base/time/time_override.h", "+base/sampling_heap_profiler/sampling_heap_profiler.h", # for base::GetUniqueIdForProcess "+base/process/process_handle.h",
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl index 1f1e3920..3434b51 100644 --- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl +++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -3663,6 +3663,12 @@ # Stage at wich to begin intercepting requests. Default is Request. optional InterceptionStage interceptionStage + # Information about a signed exchange response. + experimental type SignedExchangeInfo extends object + properties + # The outer response of signed HTTP exchange which was received from network. + Response outerResponse + # Tells whether clearing browser cache is supported. deprecated command canClearBrowserCache returns @@ -4050,6 +4056,14 @@ # Timestamp. MonotonicTime timestamp + # Fired when a signed exchange was received over the network + experimental event signedExchangeReceived + parameters + # Request identifier. + RequestId requestId + # Information about the signed exchange response. + SignedExchangeInfo info + # Fired when HTTP response is available. event responseReceived parameters
diff --git a/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc b/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc index 32a631f93..d04403e 100644 --- a/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc
@@ -4,6 +4,9 @@ #include "third_party/blink/renderer/core/inspector/inspector_performance_agent.h" +#include <utility> + +#include "base/time/time_override.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/inspector/inspected_frames.h" @@ -53,8 +56,10 @@ state_->setBoolean(kPerformanceAgentEnabled, true); instrumenting_agents_->addInspectorPerformanceAgent(this); Platform::Current()->CurrentThread()->AddTaskTimeObserver(this); - task_start_time_ = TimeTicks(); - script_start_time_ = TimeTicks(); + layout_start_ticks_ = TimeTicks(); + recalc_style_start_ticks_ = TimeTicks(); + task_start_ticks_ = TimeTicks(); + script_start_ticks_ = TimeTicks(); return Response::OK(); } @@ -90,8 +95,8 @@ std::unique_ptr<protocol::Array<protocol::Performance::Metric>> result = protocol::Array<protocol::Performance::Metric>::create(); - TimeTicks now = CurrentTimeTicks(); - AppendMetric(result.get(), "Timestamp", TimeTicksInSeconds(now)); + AppendMetric(result.get(), "Timestamp", + TimeTicksInSeconds(CurrentTimeTicks())); // Renderer instance counters. for (size_t i = 0; i < ARRAY_SIZE(kInstanceCounterNames); ++i) { @@ -101,6 +106,7 @@ } // Page performance metrics. + TimeTicks now = base::subtle::TimeTicksNowIgnoringOverride(); AppendMetric(result.get(), "LayoutCount", static_cast<double>(layout_count_)); AppendMetric(result.get(), "RecalcStyleCount", static_cast<double>(recalc_style_count_)); @@ -108,12 +114,12 @@ AppendMetric(result.get(), "RecalcStyleDuration", recalc_style_duration_.InSecondsF()); TimeDelta script_duration = script_duration_; - if (!script_start_time_.is_null()) - script_duration += now - script_start_time_; + if (!script_start_ticks_.is_null()) + script_duration += now - script_start_ticks_; AppendMetric(result.get(), "ScriptDuration", script_duration.InSecondsF()); TimeDelta task_duration = task_duration_; - if (!task_start_time_.is_null()) - task_duration += now - task_start_time_; + if (!task_start_ticks_.is_null()) + task_duration += now - task_start_ticks_; AppendMetric(result.get(), "TaskDuration", task_duration.InSecondsF()); v8::HeapStatistics heap_statistics; @@ -149,60 +155,67 @@ GetFrontend()->metrics(std::move(metrics), title); } -void InspectorPerformanceAgent::Will(const probe::CallFunction& probe) { +void InspectorPerformanceAgent::ScriptStarts() { if (!script_call_depth_++) - script_start_time_ = probe.CaptureStartTime(); + script_start_ticks_ = base::subtle::TimeTicksNowIgnoringOverride(); +} + +void InspectorPerformanceAgent::ScriptEnds() { + if (--script_call_depth_) + return; + script_duration_ += + base::subtle::TimeTicksNowIgnoringOverride() - script_start_ticks_; + script_start_ticks_ = TimeTicks(); +} + +void InspectorPerformanceAgent::Will(const probe::CallFunction& probe) { + ScriptStarts(); } void InspectorPerformanceAgent::Did(const probe::CallFunction& probe) { - if (--script_call_depth_) - return; - script_duration_ += probe.Duration(); - script_start_time_ = TimeTicks(); + ScriptEnds(); } void InspectorPerformanceAgent::Will(const probe::ExecuteScript& probe) { - if (!script_call_depth_++) - script_start_time_ = probe.CaptureStartTime(); + ScriptStarts(); } void InspectorPerformanceAgent::Did(const probe::ExecuteScript& probe) { - if (--script_call_depth_) - return; - script_duration_ += probe.Duration(); - script_start_time_ = TimeTicks(); + ScriptEnds(); } void InspectorPerformanceAgent::Will(const probe::RecalculateStyle& probe) { - probe.CaptureStartTime(); + recalc_style_start_ticks_ = base::subtle::TimeTicksNowIgnoringOverride(); } void InspectorPerformanceAgent::Did(const probe::RecalculateStyle& probe) { - recalc_style_duration_ += probe.Duration(); + recalc_style_duration_ += + base::subtle::TimeTicksNowIgnoringOverride() - recalc_style_start_ticks_; recalc_style_count_++; } void InspectorPerformanceAgent::Will(const probe::UpdateLayout& probe) { if (!layout_depth_++) - probe.CaptureStartTime(); + layout_start_ticks_ = base::subtle::TimeTicksNowIgnoringOverride(); } void InspectorPerformanceAgent::Did(const probe::UpdateLayout& probe) { if (--layout_depth_) return; - layout_duration_ += probe.Duration(); + layout_duration_ += + base::subtle::TimeTicksNowIgnoringOverride() - layout_start_ticks_; layout_count_++; } void InspectorPerformanceAgent::WillProcessTask(double start_time) { - task_start_time_ = TimeTicksFromSeconds(start_time); + task_start_ticks_ = TimeTicksFromSeconds(start_time); } void InspectorPerformanceAgent::DidProcessTask(double start_time, double end_time) { - if (task_start_time_ == TimeTicksFromSeconds(start_time)) + if (task_start_ticks_ == TimeTicksFromSeconds(start_time)) task_duration_ += TimeDelta::FromSeconds(end_time - start_time); - task_start_time_ = TimeTicks(); + task_start_ticks_ = TimeTicks(); } void InspectorPerformanceAgent::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_performance_agent.h b/third_party/blink/renderer/core/inspector/inspector_performance_agent.h index 3d6cec93..210e7c2c 100644 --- a/third_party/blink/renderer/core/inspector/inspector_performance_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_performance_agent.h
@@ -5,6 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_PERFORMANCE_AGENT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_PERFORMANCE_AGENT_H_ +#include <memory> + #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/inspector/inspector_base_agent.h" @@ -59,16 +61,20 @@ void DidProcessTask(double start_time, double end_time) override; private: - InspectorPerformanceAgent(InspectedFrames*); + explicit InspectorPerformanceAgent(InspectedFrames*); + void ScriptStarts(); + void ScriptEnds(); Member<InspectedFrames> inspected_frames_; bool enabled_ = false; TimeDelta layout_duration_; + TimeTicks layout_start_ticks_; TimeDelta recalc_style_duration_; + TimeTicks recalc_style_start_ticks_; TimeDelta script_duration_; - TimeTicks script_start_time_; + TimeTicks script_start_ticks_; TimeDelta task_duration_; - TimeTicks task_start_time_; + TimeTicks task_start_ticks_; unsigned long long layout_count_ = 0; unsigned long long recalc_style_count_ = 0; int script_call_depth_ = 0;
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 ffa3a05..53e78f13 100644 --- a/third_party/blink/renderer/core/layout/layout_menu_list.cc +++ b/third_party/blink/renderer/core/layout/layout_menu_list.cc
@@ -181,7 +181,7 @@ String text = option->TextIndentedToRespectGroupLabel(); const ComputedStyle* item_style = option->GetComputedStyle() ? option->GetComputedStyle() : Style(); - ApplyTextTransform(item_style, text, ' '); + item_style->ApplyTextTransform(&text); // We apply SELECT's style, not OPTION's style because m_optionsWidth is // used to determine intrinsic width of the menulist box. TextRun text_run = ConstructTextRun(Style()->GetFont(), text, *Style());
diff --git a/third_party/blink/renderer/core/layout/layout_text.cc b/third_party/blink/renderer/core/layout/layout_text.cc index c78ee35..e1be2128 100644 --- a/third_party/blink/renderer/core/layout/layout_text.cc +++ b/third_party/blink/renderer/core/layout/layout_text.cc
@@ -60,7 +60,6 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/text/bidi_resolver.h" -#include "third_party/blink/renderer/platform/text/capitalize.h" #include "third_party/blink/renderer/platform/text/character.h" #include "third_party/blink/renderer/platform/text/hyphenation.h" #include "third_party/blink/renderer/platform/text/text_break_iterator.h" @@ -1663,37 +1662,16 @@ // Text nodes aren't event targets, so don't descend any further. } -void ApplyTextTransform(const ComputedStyle* style, - String& text, - UChar previous_character) { - if (!style) - return; - - switch (style->TextTransform()) { - case ETextTransform::kNone: - break; - case ETextTransform::kCapitalize: - text = Capitalize(text, previous_character); - break; - case ETextTransform::kUppercase: - text = text.UpperUnicode(style->Locale()); - break; - case ETextTransform::kLowercase: - text = text.LowerUnicode(style->Locale()); - break; - } -} - void LayoutText::SetTextInternal(scoped_refptr<StringImpl> text) { DCHECK(text); text_ = String(std::move(text)); - if (Style()) { - ApplyTextTransform(Style(), text_, PreviousCharacter()); + if (const ComputedStyle* style = Style()) { + style->ApplyTextTransform(&text_, PreviousCharacter()); // We use the same characters here as for list markers. // See the listMarkerText function in LayoutListMarker.cpp. - switch (Style()->TextSecurity()) { + switch (style->TextSecurity()) { case ETextSecurity::kNone: break; case ETextSecurity::kCircle:
diff --git a/third_party/blink/renderer/core/layout/layout_text.h b/third_party/blink/renderer/core/layout/layout_text.h index 57518c74..0c06d7f 100644 --- a/third_party/blink/renderer/core/layout/layout_text.h +++ b/third_party/blink/renderer/core/layout/layout_text.h
@@ -430,8 +430,6 @@ return ToLayoutText(CharacterData::GetLayoutObject()); } -void ApplyTextTransform(const ComputedStyle*, String&, UChar); - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_TEXT_H_
diff --git a/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.cc b/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.cc index 638da508..f0d1baf6 100644 --- a/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.cc +++ b/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.cc
@@ -159,9 +159,7 @@ NGExclusionSpace::NGExclusionSpace() : last_float_block_start_(LayoutUnit::Min()), left_float_clear_offset_(LayoutUnit::Min()), - right_float_clear_offset_(LayoutUnit::Min()), - has_left_float_(false), - has_right_float_(false) { + right_float_clear_offset_(LayoutUnit::Min()) { // The exclusion space must always have at least one shelf, at -Infinity. shelves_.push_back(NGShelf(/* block_offset */ LayoutUnit::Min())); } @@ -174,11 +172,9 @@ // Update the members used for clearance calculations. if (exclusion->type == EFloat::kLeft) { - has_left_float_ = true; left_float_clear_offset_ = std::max(left_float_clear_offset_, exclusion->rect.BlockEndOffset()); } else if (exclusion->type == EFloat::kRight) { - has_right_float_ = true; right_float_clear_offset_ = std::max(right_float_clear_offset_, exclusion->rect.BlockEndOffset()); }
diff --git a/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.h b/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.h index 5af8974..aa63477 100644 --- a/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.h +++ b/third_party/blink/renderer/core/layout/ng/exclusions/ng_exclusion_space.h
@@ -47,9 +47,6 @@ // Returns the block start offset of the last float added. LayoutUnit LastFloatBlockStart() const { return last_float_block_start_; } - bool HasLeftFloat() const { return has_left_float_; } - bool HasRightFloat() const { return has_right_float_; } - bool operator==(const NGExclusionSpace& other) const; bool operator!=(const NGExclusionSpace& other) const { return !(*this == other); @@ -147,9 +144,6 @@ // type of float. This is used for implementing float clearance. LayoutUnit left_float_clear_offset_; LayoutUnit right_float_clear_offset_; - - unsigned has_left_float_ : 1; - unsigned has_right_float_ : 1; }; } // namespace blink
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 7aba5c9..ea9d89cd 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
@@ -31,26 +31,15 @@ namespace blink { namespace { -// Returns if a child may be affected by its clear property. I.e. it will -// actually clear a float. -bool ClearanceMayAffectLayout(const NGExclusionSpace& exclusion_space, - NGFloatTypes adjoining_floats, - const ComputedStyle& child_style) { - EClear clear = child_style.Clear(); - - if (ToFloatTypes(clear) & adjoining_floats) - return true; - - bool should_clear_left = (clear == EClear::kBoth || clear == EClear::kLeft); - bool should_clear_right = (clear == EClear::kBoth || clear == EClear::kRight); - - if (exclusion_space.HasLeftFloat() && should_clear_left) - return true; - - if (exclusion_space.HasRightFloat() && should_clear_right) - return true; - - return false; +// Return true if a child is to be cleared past adjoining floats. These are +// floats that would otherwise (if 'clear' were 'none') be pulled down by the +// BFC offset of the child. If the child is to clear floats, though, we +// obviously need separate the child from the floats and move it past them, +// since that's what clearance is all about. This means that if we have any such +// floats to clear, we know for sure that we get clearance, even before layout. +inline bool HasClearancePastAdjoiningFloats(NGFloatTypes adjoining_floats, + const ComputedStyle& child_style) { + return ToFloatTypes(child_style.Clear()) & adjoining_floats; } // Returns if the resulting fragment should be considered an "empty block". @@ -655,6 +644,10 @@ // margin strut or not. child_margin_got_separated = bfc_offset.block_offset != adjoining_bfc_offset_estimate; + } else if (HasClearancePastAdjoiningFloats( + container_builder_.AdjoiningFloatTypes(), child_style)) { + child_bfc_offset_estimate = previous_inflow_position->NextBorderEdge(); + child_margin_got_separated = true; } // The BFC offset of this container gets resolved because of this child. @@ -870,21 +863,17 @@ bool is_non_empty_inline = child.IsInline() && !ToNGInlineNode(child).IsEmptyInline(); - // TODO(layout-dev): We should only resolve the BFC offset and position - // pending floats if there is something that we know in advance that we have - // to clear past. This is only the case when we have relevant adjoining - // floats. In all other cases we have to determine the child's BFC offset - // before we know if we have to apply clearance or not. - bool should_position_pending_floats = + bool has_clearance_past_adjoining_floats = child.IsBlock() && - ClearanceMayAffectLayout(*exclusion_space_, - container_builder_.AdjoiningFloatTypes(), - child.Style()); + HasClearancePastAdjoiningFloats(container_builder_.AdjoiningFloatTypes(), + child.Style()); - // There are two conditions where we need to resolve our BFC offset: - // 1. If the child will be affected by clearance. + // If we can separate the previous margin strut from what is to follow, do + // that. Then we're able to resolve *our* BFC offset and position any pending + // floats. There are two situations where this is necessary: + // 1. If the child is to be cleared by adjoining floats. // 2. If the child is a non-empty inline. - if (should_position_pending_floats || is_non_empty_inline) { + if (has_clearance_past_adjoining_floats || is_non_empty_inline) { if (!ResolveBfcOffset(previous_inflow_position)) return false; } @@ -908,20 +897,6 @@ !child_space->FloatsBfcOffset(); bool is_empty_block = IsEmptyBlock(child, *layout_result); - // If we don't know our BFC offset yet, and the child stumbled into something - // that needs it (unable to position floats when the BFC offset is unknown), - // we need abort layout once we manage to resolve it, and relayout. - // - // If we are a new formatting context, the child will get re-laid out once it - // has been positioned. - if (!container_builder_.BfcOffset()) { - abort_when_bfc_offset_updated_ |= relayout_child_when_bfc_resolved; - // If our BFC offset is unknown, and the child got pushed down by floats, so - // will we. - if (layout_result->IsPushedByFloats()) - container_builder_.SetIsPushedByFloats(); - } - // A child may have aborted its layout if it resolved its BFC offset. If // we don't have a BFC offset yet, we need to propagate the abortion up // to our parent. @@ -956,25 +931,49 @@ // We try and position the child within the block formatting context. This // may cause our BFC offset to be resolved, in which case we should abort our // layout if needed. - if (child_bfc_offset) { - // We shouldn't have any pending floats here, since an in-flow sibling found - // its BFC offset. - DCHECK(unpositioned_floats_.IsEmpty()); - - if (!ResolveBfcOffset(previous_inflow_position, - child_bfc_offset->block_offset)) + bool has_clearance = layout_result->IsPushedByFloats(); + if (!child_bfc_offset) { + if (!has_clearance && child_space->HasClearanceOffset() && + child.Style().Clear() != EClear::kNone) { + // This is an empty block child that we collapsed through, so we have to + // detect clearance manually. See if the child's hypothetical border edge + // is past the relevant floats. If it's not, we need to apply clearance + // before it. + LayoutUnit child_block_offset_estimate = + previous_inflow_position->bfc_block_offset + + layout_result->EndMarginStrut().Sum(); + if (child_block_offset_estimate < child_space->ClearanceOffset()) + has_clearance = empty_block_affected_by_clearance = true; + } + } + if (has_clearance) { + // The child has clearance. Clearance inhibits margin collapsing and acts as + // spacing before the block-start margin of the child. Our BFC offset is + // therefore resolvable, and if it hasn't already been resolved, we'll do it + // now to separate the child's collapsed margin from this container. + if (!ResolveBfcOffset(previous_inflow_position)) return false; - } else { + } + if (!child_bfc_offset) { + DCHECK(is_empty_block); // Layout wasn't able to determine the BFC offset of the child. This has to // mean that the child is empty (block-size-wise). - DCHECK(is_empty_block); if (container_builder_.BfcOffset()) { // Since we know our own BFC offset, though, we can calculate that of the // child as well. child_bfc_offset = PositionEmptyChildWithParentBfc( - child, *child_space, child_data, *layout_result, - &empty_block_affected_by_clearance); + child, *child_space, child_data, *layout_result); } + } else if (!has_clearance) { + // We shouldn't have any pending floats here, since an in-flow child found + // its BFC offset. + DCHECK(unpositioned_floats_.IsEmpty()); + + // The child's BFC offset is known, and since there's no clearance, this + // container will get the same offset, unless it has already been resolved. + if (!ResolveBfcOffset(previous_inflow_position, + child_bfc_offset->block_offset)) + return false; } // We need to re-layout a child if it was affected by clearance in order to @@ -1038,6 +1037,27 @@ DCHECK(layout_result->ExclusionSpace()); exclusion_space_ = std::make_unique<NGExclusionSpace>(*layout_result->ExclusionSpace()); + relayout_child_when_bfc_resolved = false; + } + + // If we don't know our BFC offset yet, and the child stumbled into something + // that needs it (unable to position floats when the BFC offset is unknown), + // we need abort layout once we manage to resolve it, and relayout. Note that + // this check is performed after the optional second layout pass above, since + // we may have been able to resolve our BFC offset (e.g. due to clearance) and + // position any descendant floats in the second pass. In particular, when it + // comes to clearance of empty blocks, if we just applied it and resolved the + // BFC offset to separate the margins before and after clearance, we cannot + // abort and re-layout this block, or clearance would be lost. + // + // If we are a new formatting context, the child will get re-laid out once it + // has been positioned. + if (!container_builder_.BfcOffset()) { + abort_when_bfc_offset_updated_ |= relayout_child_when_bfc_resolved; + // If our BFC offset is unknown, and the child got pushed down by floats, + // so will we. + if (layout_result->IsPushedByFloats()) + container_builder_.SetIsPushedByFloats(); } // A line-box may have a list of floats which we add as children. @@ -1234,8 +1254,7 @@ const NGLayoutInputNode& child, const NGConstraintSpace& child_space, const NGInflowChildData& child_data, - const NGLayoutResult& layout_result, - bool* has_clearance) const { + const NGLayoutResult& layout_result) const { DCHECK(IsEmptyBlock(child, layout_result)); // The child must be an in-flow zero-block-size fragment, use its end margin @@ -1253,8 +1272,7 @@ child_available_size_.inline_size); } - *has_clearance = - AdjustToClearance(child_space.ClearanceOffset(), &child_bfc_offset); + AdjustToClearance(child_space.ClearanceOffset(), &child_bfc_offset); return child_bfc_offset; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h index 8bd2ac7..9836a73 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.h
@@ -99,8 +99,7 @@ const NGLayoutInputNode& child, const NGConstraintSpace& child_space, const NGInflowChildData& child_data, - const NGLayoutResult&, - bool* has_clearance) const; + const NGLayoutResult&) const; void HandleOutOfFlowPositioned(const NGPreviousInflowPosition&, NGBlockNode); void HandleFloat(const NGPreviousInflowPosition&,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 5b69e27..13c93ec3 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -269,18 +269,17 @@ NGBoxStrut NGBlockNode::GetScrollbarSizes() const { NGPhysicalBoxStrut sizes; - const ComputedStyle* style = GetLayoutObject()->Style(); - if (!style->IsOverflowVisible()) { - const LayoutBox* box = ToLayoutBox(GetLayoutObject()); - LayoutUnit vertical = LayoutUnit(box->VerticalScrollbarWidth()); - LayoutUnit horizontal = LayoutUnit(box->HorizontalScrollbarHeight()); + const ComputedStyle& style = box_->StyleRef(); + if (!style.IsOverflowVisible()) { + LayoutUnit vertical = LayoutUnit(box_->VerticalScrollbarWidth()); + LayoutUnit horizontal = LayoutUnit(box_->HorizontalScrollbarHeight()); sizes.bottom = horizontal; - if (box->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) + if (box_->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) sizes.left = vertical; else sizes.right = vertical; } - return sizes.ConvertToLogical(style->GetWritingMode(), style->Direction()); + return sizes.ConvertToLogical(style.GetWritingMode(), style.Direction()); } NGLayoutInputNode NGBlockNode::NextSibling() const {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h index 5e93355f..110c724 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h +++ b/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
@@ -175,6 +175,7 @@ // - block_start border or padding in the current layout. // - Text content, atomic inlines, (see NGLineBreaker). // - The current layout having a block_size. + // - Clearance before a child. NGBfcOffset BfcOffset() const { return bfc_offset_; } // If present, and the current layout hasn't resolved its BFC offset yet (see
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_block.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_block.cc index ce23766..ddbe809 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_block.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_block.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_root.h" #include "third_party/blink/renderer/core/layout/svg/svg_layout_support.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/style/shadow_list.h" #include "third_party/blink/renderer/core/svg/svg_element.h" @@ -48,7 +47,6 @@ void LayoutSVGBlock::WillBeDestroyed() { SVGResourcesCache::ClientDestroyed(*this); - SVGResources::ClearClipPathFilterMask(*GetElement(), Style()); LayoutBlockFlow::WillBeDestroyed(); } @@ -75,7 +73,6 @@ } LayoutBlock::StyleDidChange(diff, old_style); - SVGResources::UpdateClipPathFilterMask(*GetElement(), old_style, StyleRef()); SVGResourcesCache::ClientStyleChanged(*this, diff, StyleRef()); }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc index 5ab1d05..8fd4c13 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/layout/svg/layout_svg_text.h" #include "third_party/blink/renderer/core/layout/svg/line/svg_inline_flow_box.h" #include "third_party/blink/renderer/core/layout/svg/svg_layout_support.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/svg/svg_a_element.h" @@ -120,8 +119,6 @@ void LayoutSVGInline::WillBeDestroyed() { SVGResourcesCache::ClientDestroyed(*this); - SVGResources::ClearClipPathFilterMask(ToSVGElement(*GetNode()), Style()); - SVGResources::ClearPaints(ToSVGElement(*GetNode()), Style()); LayoutInline::WillBeDestroyed(); } @@ -131,9 +128,6 @@ SetNeedsBoundariesUpdate(); LayoutInline::StyleDidChange(diff, old_style); - SVGResources::UpdateClipPathFilterMask(ToSVGElement(*GetNode()), old_style, - StyleRef()); - SVGResources::UpdatePaints(ToSVGElement(*GetNode()), old_style, StyleRef()); SVGResourcesCache::ClientStyleChanged(*this, diff, StyleRef()); }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_model_object.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_model_object.cc index c8708e9..a62462c 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_model_object.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_model_object.cc
@@ -34,7 +34,6 @@ #include "third_party/blink/renderer/core/layout/svg/layout_svg_container.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_root.h" #include "third_party/blink/renderer/core/layout/svg/svg_layout_support.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/svg/svg_graphics_element.h" @@ -93,7 +92,6 @@ void LayoutSVGModelObject::WillBeDestroyed() { SVGResourcesCache::ClientDestroyed(*this); - SVGResources::ClearClipPathFilterMask(*GetElement(), Style()); LayoutObject::WillBeDestroyed(); } @@ -136,7 +134,6 @@ } LayoutObject::StyleDidChange(diff, old_style); - SVGResources::UpdateClipPathFilterMask(*GetElement(), old_style, StyleRef()); SVGResourcesCache::ClientStyleChanged(*this, diff, StyleRef()); }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_path.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_path.cc index a3eee4a..2e95d31b6 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_path.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_path.cc
@@ -38,17 +38,6 @@ LayoutSVGPath::~LayoutSVGPath() = default; -void LayoutSVGPath::StyleDidChange(StyleDifference diff, - const ComputedStyle* old_style) { - LayoutSVGShape::StyleDidChange(diff, old_style); - SVGResources::UpdateMarkers(*GetElement(), old_style, StyleRef()); -} - -void LayoutSVGPath::WillBeDestroyed() { - SVGResources::ClearMarkers(*GetElement(), Style()); - LayoutSVGShape::WillBeDestroyed(); -} - void LayoutSVGPath::UpdateShapeFromElement() { LayoutSVGShape::UpdateShapeFromElement(); ProcessMarkerPositions();
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_path.h b/third_party/blink/renderer/core/layout/svg/layout_svg_path.h index b1f6c08..45949839 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_path.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_path.h
@@ -42,9 +42,6 @@ const char* GetName() const override { return "LayoutSVGPath"; } private: - void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; - void WillBeDestroyed() override; - void UpdateShapeFromElement() override; FloatRect HitTestStrokeBoundingBox() const override; FloatRect CalculateUpdatedStrokeBoundingBox() const;
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.cc index 4b134ba..3fee1a3 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.cc
@@ -64,23 +64,40 @@ void LayoutSVGResourceContainer::WillBeDestroyed() { LayoutSVGHiddenContainer::WillBeDestroyed(); - // The resource is being torn down. - // TODO(fs): Remove this when SVGResources is gone. + // The resource is being torn down. If we have any clients, move those to be + // pending on the resource (if one exists.) if (LocalSVGResource* resource = ResourceForContainer(*this)) - resource->NotifyResourceDestroyed(*this); + MakeClientsPending(*resource); } void LayoutSVGResourceContainer::StyleDidChange( StyleDifference diff, const ComputedStyle* old_style) { LayoutSVGHiddenContainer::StyleDidChange(diff, old_style); - // The resource has been attached. Notify any pending clients that - // they can now try to add themselves as clients to the resource. - // TODO(fs): Remove this when SVGResources is gone. - if (old_style) - return; - if (LocalSVGResource* resource = ResourceForContainer(*this)) - resource->NotifyResourceAttached(*this); + // The resource has (read: may have) been attached. Notify any pending + // clients that they can now try to add themselves as clients to the + // resource. + if (LocalSVGResource* resource = ResourceForContainer(*this)) { + if (resource->Target() == GetElement()) + resource->NotifyPendingClients(); + } +} + +void LayoutSVGResourceContainer::MakeClientsPending( + LocalSVGResource& resource) { + RemoveAllClientsFromCache(); + + for (auto* client : clients_) { + // Unlink the resource from the client's SVGResources. + SVGResources* resources = + SVGResourcesCache::CachedResourcesForLayoutObject(*client); + // Or else the client wouldn't be in the list in the first place. + DCHECK(resources); + resources->ResourceDestroyed(this); + + resource.AddWatch(ToSVGElement(*client->GetNode())); + } + clients_.clear(); } void LayoutSVGResourceContainer::MarkAllClientsForInvalidation( @@ -88,7 +105,7 @@ if (is_invalidating_) return; LocalSVGResource* resource = ResourceForContainer(*this); - if (!resource || !resource->HasClients()) + if (clients_.IsEmpty() && (!resource || !resource->HasClients())) return; // Remove modes for which invalidations have already been // performed. If no modes remain we are done. @@ -98,6 +115,25 @@ completed_invalidations_mask_ |= invalidation_mask; is_invalidating_ = true; + bool needs_layout = + invalidation_mask & SVGResourceClient::kLayoutInvalidation; + bool mark_for_invalidation = + invalidation_mask & ~SVGResourceClient::kParentOnlyInvalidation; + + // Invalidate clients registered on the this object (via SVGResources). + for (auto* client : clients_) { + DCHECK(client->IsSVG()); + if (client->IsSVGResourceContainer()) { + ToLayoutSVGResourceContainer(client)->RemoveAllClientsFromCache( + mark_for_invalidation); + continue; + } + + if (mark_for_invalidation) + MarkClientForInvalidation(*client, invalidation_mask); + + MarkForLayoutAndParentResourceInvalidation(*client, needs_layout); + } // Invalidate clients registered via an SVGResource. if (resource) @@ -126,6 +162,17 @@ client.SetNeedsBoundariesUpdate(); } +void LayoutSVGResourceContainer::AddClient(LayoutObject& client) { + clients_.insert(&client); + ClearInvalidationMask(); +} + +bool LayoutSVGResourceContainer::RemoveClient(LayoutObject& client) { + RemoveClientFromCache(client); + clients_.erase(&client); + return clients_.IsEmpty(); +} + void LayoutSVGResourceContainer::InvalidateCacheAndMarkForLayout( LayoutInvalidationReasonForTracing reason, SubtreeLayoutScope* layout_scope) { @@ -148,25 +195,24 @@ static inline void RemoveFromCacheAndInvalidateDependencies( LayoutObject& object, bool needs_layout) { - if (!object.GetNode() || !object.GetNode()->IsSVGElement()) - return; - SVGElement& element = ToSVGElement(*object.GetNode()); - if (SVGResources* resources = SVGResourcesCache::CachedResourcesForLayoutObject(object)) { - SVGResourceClient* client = element.GetSVGResourceClient(); if (InvalidationModeMask invalidation_mask = - resources->RemoveClientFromCacheAffectingObjectBounds(*client)) { + resources->RemoveClientFromCacheAffectingObjectBounds(object)) { LayoutSVGResourceContainer::MarkClientForInvalidation(object, invalidation_mask); } } - element.NotifyIncomingReferences([needs_layout](SVGElement& element) { - DCHECK(element.GetLayoutObject()); - LayoutSVGResourceContainer::MarkForLayoutAndParentResourceInvalidation( - *element.GetLayoutObject(), needs_layout); - }); + if (!object.GetNode() || !object.GetNode()->IsSVGElement()) + return; + + ToSVGElement(object.GetNode()) + ->NotifyIncomingReferences([needs_layout](SVGElement& element) { + DCHECK(element.GetLayoutObject()); + LayoutSVGResourceContainer::MarkForLayoutAndParentResourceInvalidation( + *element.GetLayoutObject(), needs_layout); + }); } void LayoutSVGResourceContainer::MarkForLayoutAndParentResourceInvalidation(
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.h b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.h index 4f9c61ee..815e189 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.h
@@ -25,6 +25,8 @@ namespace blink { +class LocalSVGResource; + enum LayoutSVGResourceType { kMaskerResourceType, kMarkerResourceType, @@ -43,9 +45,10 @@ virtual void RemoveAllClientsFromCache(bool mark_for_invalidation = true) = 0; // Remove any cached data for the |client|, and return true if so. - virtual bool RemoveClientFromCache(SVGResourceClient&) { return false; } + virtual bool RemoveClientFromCache(LayoutObject& client) { return false; } void UpdateLayout() override; + void StyleDidChange(StyleDifference, const ComputedStyle* old_style) final; bool IsOfType(LayoutObjectType type) const override { return type == kLayoutObjectSVGResourceContainer || LayoutSVGHiddenContainer::IsOfType(type); @@ -60,6 +63,11 @@ resource_type == kRadialGradientResourceType; } + // Detach all clients from this resource, and add them as watches to the tree + // scope's resource entry (the argument.) + void MakeClientsPending(LocalSVGResource&); + bool HasClients() const { return !clients_.IsEmpty(); } + void InvalidateCacheAndMarkForLayout(LayoutInvalidationReasonForTracing, SubtreeLayoutScope* = nullptr); void InvalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr); @@ -75,18 +83,23 @@ // Used from RemoveAllClientsFromCache methods. void MarkAllClientsForInvalidation(InvalidationModeMask); - void StyleDidChange(StyleDifference, const ComputedStyle* old_style) final; void WillBeDestroyed() override; bool is_in_layout_; private: + friend class SVGResourcesCache; + void AddClient(LayoutObject&); + bool RemoveClient(LayoutObject&); + // Track global (markAllClientsForInvalidation) invalidations to avoid // redundant crawls. unsigned completed_invalidations_mask_ : 8; unsigned is_invalidating_ : 1; // 23 padding bits available + + HashSet<LayoutObject*> clients_; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGResourceContainer,
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.cc index ce1e776f..31e1ab4c 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.cc
@@ -75,7 +75,7 @@ : SVGResourceClient::kParentOnlyInvalidation); } -bool LayoutSVGResourceFilter::RemoveClientFromCache(SVGResourceClient& client) { +bool LayoutSVGResourceFilter::RemoveClientFromCache(LayoutObject& client) { auto entry = filter_.find(&client); if (entry == filter_.end()) return false; @@ -129,7 +129,8 @@ node_map->InvalidateDependentEffects(effect); // Issue paint invalidations for the image on the screen. - filter.key->Invalidate(SVGResourceClient::kPaintInvalidation); + MarkClientForInvalidation(*filter.key, + SVGResourceClient::kPaintInvalidation); } if (LocalSVGResource* resource = ToSVGFilterElement(GetElement())->AssociatedResource())
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h index 23372b07..a916984 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h
@@ -80,7 +80,7 @@ } void RemoveAllClientsFromCache(bool mark_for_invalidation = true) override; - bool RemoveClientFromCache(SVGResourceClient&) override; + bool RemoveClientFromCache(LayoutObject&) override; FloatRect ResourceBoundingBox(const LayoutObject*); @@ -93,12 +93,12 @@ static const LayoutSVGResourceType kResourceType = kFilterResourceType; LayoutSVGResourceType ResourceType() const override { return kResourceType; } - FilterData* GetFilterDataForClient(const SVGResourceClient* client) { - return filter_.at(const_cast<SVGResourceClient*>(client)); + FilterData* GetFilterDataForLayoutObject(const LayoutObject* object) { + return filter_.at(const_cast<LayoutObject*>(object)); } - void SetFilterDataForClient(const SVGResourceClient* client, - FilterData* filter_data) { - filter_.Set(const_cast<SVGResourceClient*>(client), filter_data); + void SetFilterDataForLayoutObject(LayoutObject* object, + FilterData* filter_data) { + filter_.Set(object, filter_data); } protected: @@ -107,8 +107,7 @@ private: void DisposeFilterMap(); - using FilterMap = - PersistentHeapHashMap<Member<SVGResourceClient>, Member<FilterData>>; + using FilterMap = PersistentHeapHashMap<LayoutObject*, Member<FilterData>>; FilterMap filter_; };
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.cc index db3bf84..ef2795a 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.cc
@@ -40,8 +40,7 @@ : SVGResourceClient::kParentOnlyInvalidation); } -bool LayoutSVGResourceGradient::RemoveClientFromCache( - SVGResourceClient& client) { +bool LayoutSVGResourceGradient::RemoveClientFromCache(LayoutObject& client) { auto entry = gradient_map_.find(&client); if (entry == gradient_map_.end()) return false; @@ -50,7 +49,7 @@ } SVGPaintServer LayoutSVGResourceGradient::PreparePaintServer( - const SVGResourceClient& client, + const LayoutObject& object, const FloatRect& object_bounding_box) { ClearInvalidationMask(); @@ -72,7 +71,7 @@ return SVGPaintServer::Invalid(); std::unique_ptr<GradientData>& gradient_data = - gradient_map_.insert(&client, nullptr).stored_value->value; + gradient_map_.insert(&object, nullptr).stored_value->value; if (!gradient_data) gradient_data = std::make_unique<GradientData>();
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.h b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.h index 896308a..3dfbe11d 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_gradient.h
@@ -44,9 +44,9 @@ explicit LayoutSVGResourceGradient(SVGGradientElement*); void RemoveAllClientsFromCache(bool mark_for_invalidation = true) final; - bool RemoveClientFromCache(SVGResourceClient&) final; + bool RemoveClientFromCache(LayoutObject&) final; - SVGPaintServer PreparePaintServer(const SVGResourceClient&, + SVGPaintServer PreparePaintServer(const LayoutObject&, const FloatRect& object_bounding_box) final; bool IsChildAllowed(LayoutObject* child, const ComputedStyle&) const final; @@ -62,9 +62,7 @@ private: bool should_collect_gradient_attributes_ : 1; - using GradientMap = PersistentHeapHashMap<Member<const SVGResourceClient>, - std::unique_ptr<GradientData>>; - GradientMap gradient_map_; + HashMap<const LayoutObject*, std::unique_ptr<GradientData>> gradient_map_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc index 7dead57..6c6adbd 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.cc
@@ -146,8 +146,7 @@ if (!paint_description.resource) return SVGPaintServer(paint_description.color); SVGPaintServer paint_server = paint_description.resource->PreparePaintServer( - *SVGResources::GetClient(layout_object), - layout_object.ObjectBoundingBox()); + layout_object, layout_object.ObjectBoundingBox()); if (paint_server.IsValid()) return paint_server; if (paint_description.has_fallback)
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.h b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.h index 9f096f3..60010bc3 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.h
@@ -103,7 +103,7 @@ ~LayoutSVGResourcePaintServer() override; virtual SVGPaintServer PreparePaintServer( - const SVGResourceClient&, + const LayoutObject&, const FloatRect& object_bounding_box) = 0; // Helper utilities used in to access the underlying resources for DRT.
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.cc index af180fc..98f6a54 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.cc
@@ -60,8 +60,7 @@ : SVGResourceClient::kParentOnlyInvalidation); } -bool LayoutSVGResourcePattern::RemoveClientFromCache( - SVGResourceClient& client) { +bool LayoutSVGResourcePattern::RemoveClientFromCache(LayoutObject& client) { auto entry = pattern_map_.find(&client); if (entry == pattern_map_.end()) return false; @@ -70,7 +69,7 @@ } PatternData* LayoutSVGResourcePattern::PatternForClient( - const SVGResourceClient& client, + const LayoutObject& object, const FloatRect& object_bounding_box) { DCHECK(!should_collect_pattern_attributes_); @@ -78,10 +77,10 @@ // invalidation (painting animated images may trigger layout invals which // delete our map entry). Hopefully that will be addressed at some point, and // then we can optimize the lookup. - if (PatternData* current_data = pattern_map_.at(&client)) + if (PatternData* current_data = pattern_map_.at(&object)) return current_data; - return pattern_map_.Set(&client, BuildPatternData(object_bounding_box)) + return pattern_map_.Set(&object, BuildPatternData(object_bounding_box)) .stored_value->value.get(); } @@ -134,7 +133,7 @@ } SVGPaintServer LayoutSVGResourcePattern::PreparePaintServer( - const SVGResourceClient& client, + const LayoutObject& object, const FloatRect& object_bounding_box) { ClearInvalidationMask(); @@ -157,7 +156,7 @@ object_bounding_box.IsEmpty()) return SVGPaintServer::Invalid(); - PatternData* pattern_data = PatternForClient(client, object_bounding_box); + PatternData* pattern_data = PatternForClient(object, object_bounding_box); if (!pattern_data || !pattern_data->pattern) return SVGPaintServer::Invalid();
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.h b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.h index 322b3cef..b71cd1d2 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.h
@@ -42,10 +42,10 @@ const char* GetName() const override { return "LayoutSVGResourcePattern"; } void RemoveAllClientsFromCache(bool mark_for_invalidation = true) override; - bool RemoveClientFromCache(SVGResourceClient&) override; + bool RemoveClientFromCache(LayoutObject&) override; SVGPaintServer PreparePaintServer( - const SVGResourceClient&, + const LayoutObject&, const FloatRect& object_bounding_box) override; static const LayoutSVGResourceType kResourceType = kPatternResourceType; @@ -56,7 +56,7 @@ const FloatRect& object_bounding_box); sk_sp<PaintRecord> AsPaintRecord(const FloatSize&, const AffineTransform&) const; - PatternData* PatternForClient(const SVGResourceClient&, + PatternData* PatternForClient(const LayoutObject&, const FloatRect& object_bounding_box); const LayoutSVGResourceContainer* ResolveContentElement() const; @@ -78,9 +78,7 @@ // same => we should be able to cache a single display list per // LayoutSVGResourcePattern + one Pattern(shader) for each client -- this // would avoid re-recording when multiple clients share the same pattern. - using PatternMap = PersistentHeapHashMap<Member<const SVGResourceClient>, - std::unique_ptr<PatternData>>; - PatternMap pattern_map_; + HashMap<const LayoutObject*, std::unique_ptr<PatternData>> pattern_map_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc index 1bd4ae45..057c364d 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc
@@ -251,7 +251,6 @@ void LayoutSVGRoot::WillBeDestroyed() { SVGResourcesCache::ClientDestroyed(*this); - SVGResources::ClearClipPathFilterMask(ToSVGSVGElement(*GetNode()), Style()); LayoutReplaced::WillBeDestroyed(); } @@ -301,8 +300,6 @@ IntrinsicSizingInfoChanged(); LayoutReplaced::StyleDidChange(diff, old_style); - SVGResources::UpdateClipPathFilterMask(ToSVGSVGElement(*GetNode()), old_style, - StyleRef()); SVGResourcesCache::ClientStyleChanged(*this, diff, StyleRef()); }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_shape.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_shape.cc index 70a3fc23..0545143f 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_shape.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_shape.cc
@@ -62,17 +62,6 @@ LayoutSVGShape::~LayoutSVGShape() = default; -void LayoutSVGShape::StyleDidChange(StyleDifference diff, - const ComputedStyle* old_style) { - LayoutSVGModelObject::StyleDidChange(diff, old_style); - SVGResources::UpdatePaints(*GetElement(), old_style, StyleRef()); -} - -void LayoutSVGShape::WillBeDestroyed() { - SVGResources::ClearPaints(*GetElement(), Style()); - LayoutSVGModelObject::WillBeDestroyed(); -} - void LayoutSVGShape::CreatePath() { if (!path_) path_ = std::make_unique<Path>();
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_shape.h b/third_party/blink/renderer/core/layout/svg/layout_svg_shape.h index 53ac9b4..cd1d8279 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_shape.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_shape.h
@@ -107,9 +107,6 @@ const char* GetName() const override { return "LayoutSVGShape"; } protected: - void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; - void WillBeDestroyed() override; - float VisualRectOutsetForRasterEffects() const override; void ClearPath() { path_.reset(); }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc index 5a85c7a..c1b5acc4 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_text.cc
@@ -38,7 +38,6 @@ #include "third_party/blink/renderer/core/layout/svg/layout_svg_root.h" #include "third_party/blink/renderer/core/layout/svg/line/svg_root_inline_box.h" #include "third_party/blink/renderer/core/layout/svg/svg_layout_support.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/layout/svg/svg_text_layout_attributes_builder.h" #include "third_party/blink/renderer/core/paint/svg_text_painter.h" @@ -72,15 +71,9 @@ DCHECK(descendant_text_nodes_.IsEmpty()); } -void LayoutSVGText::StyleDidChange(StyleDifference diff, - const ComputedStyle* old_style) { - LayoutSVGBlock::StyleDidChange(diff, old_style); - SVGResources::UpdatePaints(*GetElement(), old_style, StyleRef()); -} - void LayoutSVGText::WillBeDestroyed() { descendant_text_nodes_.clear(); - SVGResources::ClearPaints(*GetElement(), Style()); + LayoutSVGBlock::WillBeDestroyed(); }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_text.h b/third_party/blink/renderer/core/layout/svg/layout_svg_text.h index 1523d8f..e22ee07 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_text.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_text.h
@@ -85,8 +85,6 @@ void AddChild(LayoutObject* child, LayoutObject* before_child = nullptr) override; void RemoveChild(LayoutObject*) override; - - void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; void WillBeDestroyed() override; RootInlineBox* CreateRootInlineBox() override;
diff --git a/third_party/blink/renderer/core/layout/svg/svg_layout_tree_as_text.cc b/third_party/blink/renderer/core/layout/svg/svg_layout_tree_as_text.cc index 1302e3f..6f046102 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_layout_tree_as_text.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_layout_tree_as_text.cc
@@ -107,17 +107,6 @@ ts << " [" << name << "=" << value << "]"; } -static void WriteSVGResourceIfNotNull(TextStream& ts, - const char* name, - const StyleSVGResource* value, - TreeScope& tree_scope) { - if (!value) - return; - AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( - value->Url(), tree_scope); - WriteNameValuePair(ts, name, id); -} - template <typename ValueType> static void WriteNameAndQuotedValue(TextStream& ts, const char* name, @@ -125,14 +114,11 @@ ts << " [" << name << "=\"" << value << "\"]"; } -static void WriteQuotedSVGResource(TextStream& ts, - const char* name, - const StyleSVGResource* value, - TreeScope& tree_scope) { - DCHECK(value); - AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( - value->Url(), tree_scope); - WriteNameAndQuotedValue(ts, name, id); +static void WriteIfNotEmpty(TextStream& ts, + const char* name, + const String& value) { + if (!value.IsEmpty()) + WriteNameValuePair(ts, name, value); } template <typename ValueType> @@ -340,13 +326,9 @@ WriteIfNotDefault(ts, "clip rule", svg_style.ClipRule(), RULE_NONZERO); } - TreeScope& tree_scope = object.GetDocument(); - WriteSVGResourceIfNotNull(ts, "start marker", svg_style.MarkerStartResource(), - tree_scope); - WriteSVGResourceIfNotNull(ts, "middle marker", svg_style.MarkerMidResource(), - tree_scope); - WriteSVGResourceIfNotNull(ts, "end marker", svg_style.MarkerEndResource(), - tree_scope); + WriteIfNotEmpty(ts, "start marker", svg_style.MarkerStartResource()); + WriteIfNotEmpty(ts, "middle marker", svg_style.MarkerMidResource()); + WriteIfNotEmpty(ts, "end marker", svg_style.MarkerEndResource()); } static TextStream& WritePositionAndStyle(TextStream& ts, @@ -739,8 +721,7 @@ if (LayoutSVGResourceMasker* masker = resources->Masker()) { WriteIndent(ts, indent); ts << " "; - WriteQuotedSVGResource(ts, "masker", style.SvgStyle().MaskerResource(), - tree_scope); + WriteNameAndQuotedValue(ts, "masker", style.SvgStyle().MaskerResource()); ts << " "; WriteStandardPrefix(ts, *masker, 0); ts << " " << masker->ResourceBoundingBox(&object) << "\n";
diff --git a/third_party/blink/renderer/core/layout/svg/svg_resources.cc b/third_party/blink/renderer/core/layout/svg/svg_resources.cc index 466ee396..32789c4 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_resources.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_resources.cc
@@ -27,7 +27,6 @@ #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_marker.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_masker.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_paint_server.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/svg/svg_pattern_element.h" #include "third_party/blink/renderer/core/svg/svg_resource.h" @@ -45,10 +44,6 @@ SVGResources::SVGResources() : linked_resource_(nullptr) {} -SVGResourceClient* SVGResources::GetClient(const LayoutObject& object) { - return ToSVGElement(object.GetNode())->GetSVGResourceClient(); -} - static HashSet<AtomicString>& ClipperFilterMaskerTags() { DEFINE_STATIC_LOCAL( HashSet<AtomicString>, tag_list, @@ -118,24 +113,28 @@ return container->IsSVGPaintServer(); } +template <> +bool IsResourceOfType<LayoutSVGResourceContainer>( + LayoutSVGResourceContainer* container) { + return true; +} + template <typename ContainerType> -ContainerType* CastResource(SVGResource* resource) { +ContainerType* AttachToResource(SVGTreeScopeResources& tree_scope_resources, + const AtomicString& id, + SVGElement& element) { + LocalSVGResource* resource = tree_scope_resources.ResourceForId(id); if (!resource) return nullptr; if (LayoutSVGResourceContainer* container = resource->ResourceContainer()) { if (IsResourceOfType<ContainerType>(container)) return static_cast<ContainerType*>(container); } + resource->AddWatch(element); return nullptr; } - -template <typename ContainerType> -ContainerType* CastResource(StyleSVGResource& style_resource) { - return CastResource<ContainerType>(style_resource.Resource()); } -} // namespace - bool SVGResources::HasResourceData() const { return clipper_filter_masker_data_ || marker_data_ || fill_stroke_data_ || linked_resource_; @@ -161,6 +160,10 @@ const AtomicString& tag_name = element.localName(); DCHECK(!tag_name.IsNull()); + TreeScope& tree_scope = element.TreeScopeForIdResolution(); + SVGTreeScopeResources& tree_scope_resources = + tree_scope.EnsureSVGTreeScopedResources(); + const SVGComputedStyle& style = computed_style.SvgStyle(); std::unique_ptr<SVGResources> resources; @@ -170,9 +173,11 @@ if (clip_path_operation->GetType() == ClipPathOperation::REFERENCE) { const ReferenceClipPathOperation& clip_path_reference = ToReferenceClipPathOperation(*clip_path_operation); + AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( + clip_path_reference.Url(), tree_scope); EnsureResources(resources).SetClipper( - CastResource<LayoutSVGResourceClipper>( - clip_path_reference.Resource())); + AttachToResource<LayoutSVGResourceClipper>(tree_scope_resources, id, + element)); } } @@ -183,60 +188,80 @@ if (filter_operation.GetType() == FilterOperation::REFERENCE) { const auto& reference_filter_operation = ToReferenceFilterOperation(filter_operation); + AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( + reference_filter_operation.Url(), tree_scope); EnsureResources(resources).SetFilter( - CastResource<LayoutSVGResourceFilter>( - reference_filter_operation.Resource())); + AttachToResource<LayoutSVGResourceFilter>(tree_scope_resources, + id, element)); } } } - if (StyleSVGResource* masker_resource = style.MaskerResource()) { + if (style.HasMasker()) { EnsureResources(resources).SetMasker( - CastResource<LayoutSVGResourceMasker>(*masker_resource)); + AttachToResource<LayoutSVGResourceMasker>( + tree_scope_resources, style.MaskerResource(), element)); } } if (style.HasMarkers() && SupportsMarkers(element)) { - if (StyleSVGResource* marker_start_resource = style.MarkerStartResource()) { - EnsureResources(resources).SetMarkerStart( - CastResource<LayoutSVGResourceMarker>(*marker_start_resource)); - } - if (StyleSVGResource* marker_mid_resource = style.MarkerMidResource()) { - EnsureResources(resources).SetMarkerMid( - CastResource<LayoutSVGResourceMarker>(*marker_mid_resource)); - } - if (StyleSVGResource* marker_end_resource = style.MarkerEndResource()) { - EnsureResources(resources).SetMarkerEnd( - CastResource<LayoutSVGResourceMarker>(*marker_end_resource)); - } + EnsureResources(resources).SetMarkerStart( + AttachToResource<LayoutSVGResourceMarker>( + tree_scope_resources, style.MarkerStartResource(), element)); + EnsureResources(resources).SetMarkerMid( + AttachToResource<LayoutSVGResourceMarker>( + tree_scope_resources, style.MarkerMidResource(), element)); + EnsureResources(resources).SetMarkerEnd( + AttachToResource<LayoutSVGResourceMarker>( + tree_scope_resources, style.MarkerEndResource(), element)); } if (FillAndStrokeTags().Contains(tag_name)) { - if (StyleSVGResource* fill_resource = style.FillPaint().Resource()) { + if (style.HasFill() && style.FillPaint().HasUrl()) { + AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( + style.FillPaint().GetUrl(), tree_scope); EnsureResources(resources).SetFill( - CastResource<LayoutSVGResourcePaintServer>(*fill_resource)); + AttachToResource<LayoutSVGResourcePaintServer>(tree_scope_resources, + id, element)); } - if (StyleSVGResource* stroke_resource = style.StrokePaint().Resource()) { + if (style.HasStroke() && style.StrokePaint().HasUrl()) { + AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( + style.StrokePaint().GetUrl(), tree_scope); EnsureResources(resources).SetStroke( - CastResource<LayoutSVGResourcePaintServer>(*stroke_resource)); + AttachToResource<LayoutSVGResourcePaintServer>(tree_scope_resources, + id, element)); } } if (auto* pattern = ToSVGPatternElementOrNull(element)) { - const SVGPatternElement* directly_referenced_pattern = - pattern->ReferencedElement(); - if (directly_referenced_pattern) { - EnsureResources(resources).SetLinkedResource( - ToLayoutSVGResourceContainerOrNull( - directly_referenced_pattern->GetLayoutObject())); - } + AtomicString id = SVGURIReference::FragmentIdentifierFromIRIString( + pattern->HrefString(), tree_scope); + EnsureResources(resources).SetLinkedResource( + AttachToResource<LayoutSVGResourceContainer>(tree_scope_resources, id, + element)); } return (!resources || !resources->HasResourceData()) ? nullptr : std::move(resources); } +void SVGResources::RemoveUnreferencedResources(const LayoutObject& object) { + SVGTreeScopeResources& tree_scope_resources = + ToSVGElement(*object.GetNode()) + .TreeScopeForIdResolution() + .EnsureSVGTreeScopedResources(); + tree_scope_resources.RemoveUnreferencedResources(); +} + +void SVGResources::RemoveWatchesForElement(Element& element) { + SECURITY_DCHECK(element.IsSVGElement()); + SVGElement& svg_element = ToSVGElement(element); + SVGTreeScopeResources& tree_scope_resources = + svg_element.TreeScopeForIdResolution().EnsureSVGTreeScopedResources(); + tree_scope_resources.RemoveWatchesForElement(svg_element); +} + void SVGResources::LayoutIfNeeded() { if (clipper_filter_masker_data_) { if (LayoutSVGResourceClipper* clipper = @@ -269,7 +294,7 @@ } InvalidationModeMask SVGResources::RemoveClientFromCacheAffectingObjectBounds( - SVGResourceClient& client) const { + LayoutObject& client) const { if (!clipper_filter_masker_data_) return 0; InvalidationModeMask invalidation_flags = 0; @@ -285,7 +310,7 @@ } InvalidationModeMask SVGResources::RemoveClientFromCache( - SVGResourceClient& client) const { + LayoutObject& client) const { if (!HasResourceData()) return 0; @@ -623,149 +648,4 @@ } #endif -void SVGResources::UpdateClipPathFilterMask(SVGElement& element, - const ComputedStyle* old_style, - const ComputedStyle& style) { - const bool had_client = element.GetSVGResourceClient(); - if (auto* reference_clip = - ToReferenceClipPathOperationOrNull(style.ClipPath())) - reference_clip->AddClient(element.EnsureSVGResourceClient()); - if (style.HasFilter()) - style.Filter().AddClient(element.EnsureSVGResourceClient()); - if (StyleSVGResource* masker_resource = style.SvgStyle().MaskerResource()) - masker_resource->AddClient(element.EnsureSVGResourceClient()); - if (had_client) - ClearClipPathFilterMask(element, old_style); -} - -void SVGResources::ClearClipPathFilterMask(SVGElement& element, - const ComputedStyle* style) { - if (!style) - return; - SVGResourceClient* client = element.GetSVGResourceClient(); - if (!client) - return; - if (auto* old_reference_clip = - ToReferenceClipPathOperationOrNull(style->ClipPath())) - old_reference_clip->RemoveClient(*client); - if (style->HasFilter()) - style->Filter().RemoveClient(*client); - if (StyleSVGResource* masker_resource = style->SvgStyle().MaskerResource()) - masker_resource->RemoveClient(*client); -} - -void SVGResources::UpdatePaints(SVGElement& element, - const ComputedStyle* old_style, - const ComputedStyle& style) { - const bool had_client = element.GetSVGResourceClient(); - const SVGComputedStyle& svg_style = style.SvgStyle(); - if (StyleSVGResource* paint_resource = svg_style.FillPaint().Resource()) - paint_resource->AddClient(element.EnsureSVGResourceClient()); - if (StyleSVGResource* paint_resource = svg_style.StrokePaint().Resource()) - paint_resource->AddClient(element.EnsureSVGResourceClient()); - if (had_client) - ClearPaints(element, old_style); -} - -void SVGResources::ClearPaints(SVGElement& element, - const ComputedStyle* style) { - if (!style) - return; - SVGResourceClient* client = element.GetSVGResourceClient(); - if (!client) - return; - const SVGComputedStyle& old_svg_style = style->SvgStyle(); - if (StyleSVGResource* paint_resource = old_svg_style.FillPaint().Resource()) - paint_resource->RemoveClient(*client); - if (StyleSVGResource* paint_resource = old_svg_style.StrokePaint().Resource()) - paint_resource->RemoveClient(*client); -} - -void SVGResources::UpdateMarkers(SVGElement& element, - const ComputedStyle* old_style, - const ComputedStyle& style) { - const bool had_client = element.GetSVGResourceClient(); - const SVGComputedStyle& svg_style = style.SvgStyle(); - if (StyleSVGResource* marker_resource = svg_style.MarkerStartResource()) - marker_resource->AddClient(element.EnsureSVGResourceClient()); - if (StyleSVGResource* marker_resource = svg_style.MarkerMidResource()) - marker_resource->AddClient(element.EnsureSVGResourceClient()); - if (StyleSVGResource* marker_resource = svg_style.MarkerEndResource()) - marker_resource->AddClient(element.EnsureSVGResourceClient()); - if (had_client) - ClearMarkers(element, old_style); -} - -void SVGResources::ClearMarkers(SVGElement& element, - const ComputedStyle* style) { - if (!style) - return; - SVGResourceClient* client = element.GetSVGResourceClient(); - if (!client) - return; - const SVGComputedStyle& old_svg_style = style->SvgStyle(); - if (StyleSVGResource* marker_resource = old_svg_style.MarkerStartResource()) - marker_resource->RemoveClient(*client); - if (StyleSVGResource* marker_resource = old_svg_style.MarkerMidResource()) - marker_resource->RemoveClient(*client); - if (StyleSVGResource* marker_resource = old_svg_style.MarkerEndResource()) - marker_resource->RemoveClient(*client); -} - -SVGElementResourceClient::SVGElementResourceClient(SVGElement* element) - : element_(element) {} - -void SVGElementResourceClient::ResourceContentChanged( - InvalidationModeMask invalidation_mask) { - LayoutObject* layout_object = element_->GetLayoutObject(); - if (!layout_object) - return; - bool mark_for_invalidation = - invalidation_mask & ~SVGResourceClient::kParentOnlyInvalidation; - if (layout_object->IsSVGResourceContainer()) { - ToLayoutSVGResourceContainer(layout_object) - ->RemoveAllClientsFromCache(mark_for_invalidation); - return; - } - - if (mark_for_invalidation) { - LayoutSVGResourceContainer::MarkClientForInvalidation(*layout_object, - invalidation_mask); - } - - bool needs_layout = - invalidation_mask & SVGResourceClient::kLayoutInvalidation; - LayoutSVGResourceContainer::MarkForLayoutAndParentResourceInvalidation( - *layout_object, needs_layout); -} - -void SVGElementResourceClient::Invalidate( - InvalidationModeMask invalidation_mask) { - if (LayoutObject* layout_object = element_->GetLayoutObject()) { - LayoutSVGResourceContainer::MarkClientForInvalidation(*layout_object, - invalidation_mask); - } -} - -void SVGElementResourceClient::ResourceElementChanged() { - if (LayoutObject* layout_object = element_->GetLayoutObject()) - SVGResourcesCache::ResourceReferenceChanged(*layout_object); -} - -void SVGElementResourceClient::ResourceDestroyed( - LayoutSVGResourceContainer* resource) { - LayoutObject* layout_object = element_->GetLayoutObject(); - if (!layout_object) - return; - SVGResources* resources = - SVGResourcesCache::CachedResourcesForLayoutObject(*layout_object); - if (resources) - resources->ResourceDestroyed(resource); -} - -void SVGElementResourceClient::Trace(Visitor* visitor) { - visitor->Trace(element_); - SVGResourceClient::Trace(visitor); -} - } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/svg/svg_resources.h b/third_party/blink/renderer/core/layout/svg/svg_resources.h index 7b6b1d9..8d61dd166 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_resources.h +++ b/third_party/blink/renderer/core/layout/svg/svg_resources.h
@@ -25,13 +25,13 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.h" -#include "third_party/blink/renderer/core/svg/svg_resource_client.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" namespace blink { class ComputedStyle; +class Element; class LayoutObject; class LayoutSVGResourceClipper; class LayoutSVGResourceFilter; @@ -47,23 +47,11 @@ public: SVGResources(); - static SVGResourceClient* GetClient(const LayoutObject&); - static std::unique_ptr<SVGResources> BuildResources(const LayoutObject&, const ComputedStyle&); - static void UpdateClipPathFilterMask(SVGElement&, - const ComputedStyle* old_style, - const ComputedStyle&); - static void ClearClipPathFilterMask(SVGElement&, const ComputedStyle*); - static void UpdatePaints(SVGElement&, - const ComputedStyle* old_style, - const ComputedStyle&); - static void ClearPaints(SVGElement&, const ComputedStyle*); - static void UpdateMarkers(SVGElement&, - const ComputedStyle* old_style, - const ComputedStyle&); - static void ClearMarkers(SVGElement&, const ComputedStyle*); + static void RemoveWatchesForElement(Element&); + static void RemoveUnreferencedResources(const LayoutObject&); void LayoutIfNeeded(); @@ -110,9 +98,9 @@ void BuildSetOfResources(HashSet<LayoutSVGResourceContainer*>&); // Methods operating on all cached resources - InvalidationModeMask RemoveClientFromCache(SVGResourceClient&) const; + InvalidationModeMask RemoveClientFromCache(LayoutObject&) const; InvalidationModeMask RemoveClientFromCacheAffectingObjectBounds( - SVGResourceClient&) const; + LayoutObject&) const; void ResourceDestroyed(LayoutSVGResourceContainer*); void ClearReferencesTo(LayoutSVGResourceContainer*); @@ -200,25 +188,6 @@ DISALLOW_COPY_AND_ASSIGN(SVGResources); }; -class SVGElementResourceClient final - : public GarbageCollected<SVGElementResourceClient>, - public SVGResourceClient { - USING_GARBAGE_COLLECTED_MIXIN(SVGElementResourceClient); - - public: - explicit SVGElementResourceClient(SVGElement*); - - void ResourceContentChanged(InvalidationModeMask) override; - void Invalidate(InvalidationModeMask) override; - void ResourceElementChanged() override; - void ResourceDestroyed(LayoutSVGResourceContainer*) override; - - void Trace(Visitor*) override; - - private: - Member<SVGElement> element_; -}; - } // namespace blink #endif
diff --git a/third_party/blink/renderer/core/layout/svg/svg_resources_cache.cc b/third_party/blink/renderer/core/layout/svg/svg_resources_cache.cc index 9cc13bbf..517cc36 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_resources_cache.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_resources_cache.cc
@@ -50,15 +50,24 @@ SVGResources* resources = cache_.Set(&object, std::move(new_resources)).stored_value->value.get(); - // Run cycle-detection _afterwards_, so self-references can be caught as well. HashSet<LayoutSVGResourceContainer*> resource_set; resources->BuildSetOfResources(resource_set); - SVGResourcesCycleSolver solver(object); - for (auto* resource_container : resource_set) { - if (solver.FindCycle(resource_container)) - resources->ClearReferencesTo(resource_container); + // Run cycle-detection _afterwards_, so self-references can be caught as well. + { + SVGResourcesCycleSolver solver(object); + for (auto* resource_container : resource_set) { + if (solver.FindCycle(resource_container)) + resources->ClearReferencesTo(resource_container); + } + resource_set.clear(); } + + // Walk resources and register the layout object as a client of each resource. + resources->BuildSetOfResources(resource_set); + + for (auto* resource_container : resource_set) + resource_container->AddClient(object); } void SVGResourcesCache::RemoveResourcesFromLayoutObject(LayoutObject& object) { @@ -68,6 +77,19 @@ // Removal of the resource may cause removal of paint property nodes. object.SetNeedsPaintPropertyUpdate(); + + // Walk resources and unregister the layout object as a client of each + // resource. + HashSet<LayoutSVGResourceContainer*> resource_set; + resources->BuildSetOfResources(resource_set); + + bool did_empty_client_set = false; + for (auto* resource_container : resource_set) + did_empty_client_set |= resource_container->RemoveClient(object); + + // Remove any registrations that became empty after the above. + if (did_empty_client_set) + SVGResources::RemoveUnreferencedResources(object); } static inline SVGResourcesCache& ResourcesCache(Document& document) { @@ -88,9 +110,8 @@ // or we have filter resources, which could depend on the layout of children. if (!object.SelfNeedsLayout() && !resources->Filter()) return; - SVGResourceClient* client = SVGResources::GetClient(object); if (InvalidationModeMask invalidation_flags = - resources->RemoveClientFromCache(*client)) { + resources->RemoveClientFromCache(object)) { LayoutSVGResourceContainer::MarkClientForInvalidation(object, invalidation_flags); } @@ -206,27 +227,15 @@ const ComputedStyle& temporary_style) : layout_object_(layout_object), original_style_(style), - temporary_style_(temporary_style), styles_are_equal_(style == temporary_style) { - if (styles_are_equal_) - return; - DCHECK(LayoutObjectCanHaveResources(layout_object_)); - SVGElement& element = ToSVGElement(*layout_object_.GetNode()); - SVGResources::UpdatePaints(element, nullptr, temporary_style_); SwitchTo(temporary_style); } -SVGResourcesCache::TemporaryStyleScope::~TemporaryStyleScope() { - if (styles_are_equal_) - return; - SVGElement& element = ToSVGElement(*layout_object_.GetNode()); - SVGResources::ClearPaints(element, &temporary_style_); - SwitchTo(original_style_); -} - void SVGResourcesCache::TemporaryStyleScope::SwitchTo( const ComputedStyle& style) { - DCHECK(!styles_are_equal_); + DCHECK(LayoutObjectCanHaveResources(layout_object_)); + if (styles_are_equal_) + return; SVGResourcesCache& cache = ResourcesCache(layout_object_.GetDocument()); cache.RemoveResourcesFromLayoutObject(layout_object_); cache.AddResourcesFromLayoutObject(layout_object_, style);
diff --git a/third_party/blink/renderer/core/layout/svg/svg_resources_cache.h b/third_party/blink/renderer/core/layout/svg/svg_resources_cache.h index eec4f65..ad9bc3a 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_resources_cache.h +++ b/third_party/blink/renderer/core/layout/svg/svg_resources_cache.h
@@ -71,14 +71,13 @@ TemporaryStyleScope(LayoutObject&, const ComputedStyle& original_style, const ComputedStyle& temporary_style); - ~TemporaryStyleScope(); + ~TemporaryStyleScope() { SwitchTo(original_style_); } private: void SwitchTo(const ComputedStyle&); LayoutObject& layout_object_; const ComputedStyle& original_style_; - const ComputedStyle& temporary_style_; const bool styles_are_equal_; DISALLOW_COPY_AND_ASSIGN(TemporaryStyleScope); };
diff --git a/third_party/blink/renderer/core/page/scrolling/DEPS b/third_party/blink/renderer/core/page/scrolling/DEPS new file mode 100644 index 0000000..463d864 --- /dev/null +++ b/third_party/blink/renderer/core/page/scrolling/DEPS
@@ -0,0 +1,5 @@ +include_rules = [ + "+cc/layers/painted_overlay_scrollbar_layer.h", + "+cc/layers/painted_scrollbar_layer.h", + "+cc/layers/solid_color_scrollbar_layer.h", +]
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc index 41b5da1..3534d56 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc
@@ -25,8 +25,15 @@ #include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h" +#include <memory> +#include <utility> + #include "build/build_config.h" #include "cc/layers/layer_position_constraint.h" +#include "cc/layers/painted_overlay_scrollbar_layer.h" +#include "cc/layers/painted_scrollbar_layer.h" +#include "cc/layers/scrollbar_layer_interface.h" +#include "cc/layers/solid_color_scrollbar_layer.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h" @@ -58,22 +65,20 @@ #if defined(OS_MACOSX) #include "third_party/blink/renderer/platform/mac/scroll_animator_mac.h" #endif -#include <memory> -#include <utility> #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_compositor_support.h" +#include "third_party/blink/public/platform/web_layer.h" #include "third_party/blink/public/platform/web_layer_tree_view.h" -#include "third_party/blink/public/platform/web_scrollbar_layer.h" #include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h" #include "third_party/blink/public/platform/web_scrollbar_theme_painter.h" #include "third_party/blink/renderer/platform/scroll/main_thread_scrolling_reason.h" #include "third_party/blink/renderer/platform/scroll/scroll_animator_base.h" +#include "third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.h" #include "third_party/blink/renderer/platform/scroll/scrollbar_theme.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" using blink::WebLayer; using blink::WebRect; -using blink::WebScrollbarLayer; using blink::WebVector; namespace { @@ -304,64 +309,80 @@ void ScrollingCoordinator::WillDestroyScrollableArea( ScrollableArea* scrollable_area) { - RemoveWebScrollbarLayer(scrollable_area, kHorizontalScrollbar); - RemoveWebScrollbarLayer(scrollable_area, kVerticalScrollbar); + RemoveScrollbarLayerGroup(scrollable_area, kHorizontalScrollbar); + RemoveScrollbarLayerGroup(scrollable_area, kVerticalScrollbar); } -void ScrollingCoordinator::RemoveWebScrollbarLayer( +void ScrollingCoordinator::RemoveScrollbarLayerGroup( ScrollableArea* scrollable_area, ScrollbarOrientation orientation) { ScrollbarMap& scrollbars = orientation == kHorizontalScrollbar ? horizontal_scrollbars_ : vertical_scrollbars_; - if (std::unique_ptr<WebScrollbarLayer> scrollbar_layer = - scrollbars.Take(scrollable_area)) - GraphicsLayer::UnregisterContentsLayer(scrollbar_layer->Layer()); + if (std::unique_ptr<ScrollbarLayerGroup> scrollbar_layer_group = + scrollbars.Take(scrollable_area)) { + GraphicsLayer::UnregisterContentsLayer( + scrollbar_layer_group->web_layer.get()); + } } -static std::unique_ptr<WebScrollbarLayer> CreateScrollbarLayer( - Scrollbar& scrollbar, - float device_scale_factor) { +static std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup> +CreateScrollbarLayer(Scrollbar& scrollbar, float device_scale_factor) { ScrollbarTheme& theme = scrollbar.GetTheme(); - WebScrollbarThemePainter painter(theme, scrollbar, device_scale_factor); - std::unique_ptr<WebScrollbarThemeGeometry> geometry( + auto scrollbar_delegate = std::make_unique<ScrollbarLayerDelegate>( + WebScrollbarImpl::Create(&scrollbar), + WebScrollbarThemePainter(theme, scrollbar, device_scale_factor), WebScrollbarThemeGeometryNative::Create(theme)); - std::unique_ptr<WebScrollbarLayer> scrollbar_layer; + auto layer_group = + std::make_unique<ScrollingCoordinator::ScrollbarLayerGroup>(); if (theme.UsesOverlayScrollbars() && theme.UsesNinePatchThumbResource()) { - scrollbar_layer = - Platform::Current()->CompositorSupport()->CreateOverlayScrollbarLayer( - WebScrollbarImpl::Create(&scrollbar), painter, std::move(geometry)); + auto scrollbar_layer = cc::PaintedOverlayScrollbarLayer::Create( + std::move(scrollbar_delegate), /*scroll_element_id=*/cc::ElementId()); scrollbar_layer->SetElementId( CompositorElementIdFromUniqueObjectId(NewUniqueObjectId())); + layer_group->scrollbar_layer = scrollbar_layer.get(); + layer_group->layer = std::move(scrollbar_layer); } else { - scrollbar_layer = - Platform::Current()->CompositorSupport()->CreateScrollbarLayer( - WebScrollbarImpl::Create(&scrollbar), painter, std::move(geometry)); + auto scrollbar_layer = cc::PaintedScrollbarLayer::Create( + std::move(scrollbar_delegate), /*scroll_element_id=*/cc::ElementId()); scrollbar_layer->SetElementId( CompositorElementIdFromUniqueObjectId(NewUniqueObjectId())); + layer_group->scrollbar_layer = scrollbar_layer.get(); + layer_group->layer = std::move(scrollbar_layer); } - GraphicsLayer::RegisterContentsLayer(scrollbar_layer->Layer()); - return scrollbar_layer; + + layer_group->web_layer = + Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer( + layer_group->layer.get()); + GraphicsLayer::RegisterContentsLayer(layer_group->web_layer.get()); + + return layer_group; } -std::unique_ptr<WebScrollbarLayer> +std::unique_ptr<ScrollingCoordinator::ScrollbarLayerGroup> ScrollingCoordinator::CreateSolidColorScrollbarLayer( ScrollbarOrientation orientation, int thumb_thickness, int track_start, bool is_left_side_vertical_scrollbar) { - WebScrollbar::Orientation web_orientation = - (orientation == kHorizontalScrollbar) ? WebScrollbar::kHorizontal - : WebScrollbar::kVertical; - std::unique_ptr<WebScrollbarLayer> scrollbar_layer = - Platform::Current()->CompositorSupport()->CreateSolidColorScrollbarLayer( - web_orientation, thumb_thickness, track_start, - is_left_side_vertical_scrollbar); + cc::ScrollbarOrientation cc_orientation = + orientation == kHorizontalScrollbar ? cc::HORIZONTAL : cc::VERTICAL; + auto scrollbar_layer = cc::SolidColorScrollbarLayer::Create( + cc_orientation, thumb_thickness, track_start, + is_left_side_vertical_scrollbar, cc::ElementId()); scrollbar_layer->SetElementId( CompositorElementIdFromUniqueObjectId(NewUniqueObjectId())); - GraphicsLayer::RegisterContentsLayer(scrollbar_layer->Layer()); - return scrollbar_layer; + + auto layer_group = std::make_unique<ScrollbarLayerGroup>(); + layer_group->scrollbar_layer = scrollbar_layer.get(); + layer_group->layer = std::move(scrollbar_layer); + layer_group->web_layer = + Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer( + layer_group->layer.get()); + GraphicsLayer::RegisterContentsLayer(layer_group->web_layer.get()); + + return layer_group; } static void DetachScrollbarLayer(GraphicsLayer* scrollbar_graphics_layer) { @@ -371,36 +392,37 @@ scrollbar_graphics_layer->SetDrawsContent(true); } -static void SetupScrollbarLayer(GraphicsLayer* scrollbar_graphics_layer, - WebScrollbarLayer* scrollbar_layer, - WebLayer* scroll_layer) { +static void SetupScrollbarLayer( + GraphicsLayer* scrollbar_graphics_layer, + const ScrollingCoordinator::ScrollbarLayerGroup* scrollbar_layer_group, + WebLayer* scrolling_layer) { DCHECK(scrollbar_graphics_layer); - DCHECK(scrollbar_layer); - if (!scroll_layer) { + if (!scrolling_layer) { DetachScrollbarLayer(scrollbar_graphics_layer); return; } - scrollbar_layer->SetScrollLayer(scroll_layer); + scrollbar_layer_group->scrollbar_layer->SetScrollElementId( + scrolling_layer->GetElementId()); scrollbar_graphics_layer->SetContentsToPlatformLayer( - scrollbar_layer->Layer(), /*prevent_contents_opaque_changes=*/false); + scrollbar_layer_group->web_layer.get(), + /*prevent_contents_opaque_changes=*/false); scrollbar_graphics_layer->SetDrawsContent(false); } -WebScrollbarLayer* ScrollingCoordinator::AddWebScrollbarLayer( +void ScrollingCoordinator::AddScrollbarLayerGroup( ScrollableArea* scrollable_area, ScrollbarOrientation orientation, - std::unique_ptr<WebScrollbarLayer> scrollbar_layer) { + std::unique_ptr<ScrollbarLayerGroup> scrollbar_layer_group) { ScrollbarMap& scrollbars = orientation == kHorizontalScrollbar ? horizontal_scrollbars_ : vertical_scrollbars_; - return scrollbars.insert(scrollable_area, std::move(scrollbar_layer)) - .stored_value->value.get(); + scrollbars.insert(scrollable_area, std::move(scrollbar_layer_group)); } -WebScrollbarLayer* ScrollingCoordinator::GetWebScrollbarLayer( - ScrollableArea* scrollable_area, - ScrollbarOrientation orientation) { +ScrollingCoordinator::ScrollbarLayerGroup* +ScrollingCoordinator::GetScrollbarLayerGroup(ScrollableArea* scrollable_area, + ScrollbarOrientation orientation) { ScrollbarMap& scrollbars = orientation == kHorizontalScrollbar ? horizontal_scrollbars_ : vertical_scrollbars_; @@ -433,28 +455,29 @@ // scrollbar becomes a non-custom one. scrollbar_graphics_layer->PlatformLayer()->ClearMainThreadScrollingReasons( MainThreadScrollingReason::kCustomScrollbarScrolling); - WebScrollbarLayer* scrollbar_layer = - GetWebScrollbarLayer(scrollable_area, orientation); - if (!scrollbar_layer) { + ScrollbarLayerGroup* scrollbar_layer_group = + GetScrollbarLayerGroup(scrollable_area, orientation); + if (!scrollbar_layer_group) { Settings* settings = page_->MainFrame()->GetSettings(); - std::unique_ptr<WebScrollbarLayer> web_scrollbar_layer; + std::unique_ptr<ScrollbarLayerGroup> group; if (settings->GetUseSolidColorScrollbars()) { DCHECK(RuntimeEnabledFeatures::OverlayScrollbarsEnabled()); - web_scrollbar_layer = CreateSolidColorScrollbarLayer( + group = CreateSolidColorScrollbarLayer( orientation, scrollbar.GetTheme().ThumbThickness(scrollbar), scrollbar.GetTheme().TrackPosition(scrollbar), scrollable_area->ShouldPlaceVerticalScrollbarOnLeft()); } else { - web_scrollbar_layer = CreateScrollbarLayer( - scrollbar, page_->DeviceScaleFactorDeprecated()); + group = CreateScrollbarLayer(scrollbar, + page_->DeviceScaleFactorDeprecated()); } - scrollbar_layer = AddWebScrollbarLayer(scrollable_area, orientation, - std::move(web_scrollbar_layer)); + + scrollbar_layer_group = group.get(); + AddScrollbarLayerGroup(scrollable_area, orientation, std::move(group)); } WebLayer* scroll_layer = toWebLayer(scrollable_area->LayerForScrolling()); - SetupScrollbarLayer(scrollbar_graphics_layer, scrollbar_layer, + SetupScrollbarLayer(scrollbar_graphics_layer, scrollbar_layer_group, scroll_layer); // Root layer non-overlay scrollbars should be marked opaque to disable @@ -463,7 +486,7 @@ scrollbar_graphics_layer->SetContentsOpaque( IsForMainFrame(scrollable_area) && is_opaque_scrollbar); } else { - RemoveWebScrollbarLayer(scrollable_area, orientation); + RemoveScrollbarLayerGroup(scrollable_area, orientation); } } @@ -528,21 +551,24 @@ &ScrollingCoordinator::DidScroll, WrapWeakPersistent(this))); } } - if (WebScrollbarLayer* scrollbar_layer = - GetWebScrollbarLayer(scrollable_area, kHorizontalScrollbar)) { + if (ScrollbarLayerGroup* scrollbar_layer_group = + GetScrollbarLayerGroup(scrollable_area, kHorizontalScrollbar)) { GraphicsLayer* horizontal_scrollbar_layer = scrollable_area->LayerForHorizontalScrollbar(); - if (horizontal_scrollbar_layer) - SetupScrollbarLayer(horizontal_scrollbar_layer, scrollbar_layer, + if (horizontal_scrollbar_layer) { + SetupScrollbarLayer(horizontal_scrollbar_layer, scrollbar_layer_group, web_layer); + } } - if (WebScrollbarLayer* scrollbar_layer = - GetWebScrollbarLayer(scrollable_area, kVerticalScrollbar)) { + if (ScrollbarLayerGroup* scrollbar_layer_group = + GetScrollbarLayerGroup(scrollable_area, kVerticalScrollbar)) { GraphicsLayer* vertical_scrollbar_layer = scrollable_area->LayerForVerticalScrollbar(); - if (vertical_scrollbar_layer) - SetupScrollbarLayer(vertical_scrollbar_layer, scrollbar_layer, web_layer); + if (vertical_scrollbar_layer) { + SetupScrollbarLayer(vertical_scrollbar_layer, scrollbar_layer_group, + web_layer); + } } // Update the viewport layer registration if the outer viewport may have @@ -769,9 +795,9 @@ void ScrollingCoordinator::Reset(LocalFrame* frame) { for (const auto& scrollbar : horizontal_scrollbars_) - GraphicsLayer::UnregisterContentsLayer(scrollbar.value->Layer()); + GraphicsLayer::UnregisterContentsLayer(scrollbar.value->web_layer.get()); for (const auto& scrollbar : vertical_scrollbars_) - GraphicsLayer::UnregisterContentsLayer(scrollbar.value->Layer()); + GraphicsLayer::UnregisterContentsLayer(scrollbar.value->web_layer.get()); horizontal_scrollbars_.clear(); vertical_scrollbars_.clear(); @@ -990,9 +1016,9 @@ page_ = nullptr; for (const auto& scrollbar : horizontal_scrollbars_) - GraphicsLayer::UnregisterContentsLayer(scrollbar.value->Layer()); + GraphicsLayer::UnregisterContentsLayer(scrollbar.value->web_layer.get()); for (const auto& scrollbar : vertical_scrollbars_) - GraphicsLayer::UnregisterContentsLayer(scrollbar.value->Layer()); + GraphicsLayer::UnregisterContentsLayer(scrollbar.value->web_layer.get()); } bool ScrollingCoordinator::CoordinatesScrollingForFrameView(
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h index 9ffe064d..2372b355 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h
@@ -38,6 +38,11 @@ #include "third_party/blink/renderer/platform/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +namespace cc { +class Layer; +class ScrollbarLayerInterface; +} // namespace cc + namespace blink { using MainThreadScrollingReasons = uint32_t; @@ -51,14 +56,14 @@ class PaintLayer; class Region; class ScrollableArea; +class WebLayer; class WebLayerTreeView; -class WebScrollbarLayer; using ScrollbarId = uint64_t; // ScrollingCoordinator is a page-level object that mediates interactions -// between Blink and the compositor's scroll-related APIs on WebLayer and -// WebScrollbarLayer. +// between Blink and the compositor's scroll-related APIs on the composited +// layer representing the scrollbar. // // It's responsible for propagating scroll offsets, main-thread scrolling // reasons, touch action regions, and non-fast-scrollable regions into the @@ -67,6 +72,17 @@ class CORE_EXPORT ScrollingCoordinator final : public GarbageCollectedFinalized<ScrollingCoordinator> { public: + struct ScrollbarLayerGroup { + // The compositor layer for the scrollbar. It can be one of a few + // concrete types, so we store the base type. + scoped_refptr<cc::Layer> layer; + // A wrapper for the |layer| for use in blink core. + std::unique_ptr<WebLayer> web_layer; + // An interface shared by all scrollbar layer types since we don't know + // the concrete |layer| type. + cc::ScrollbarLayerInterface* scrollbar_layer = nullptr; + }; + static ScrollingCoordinator* Create(Page*); ~ScrollingCoordinator(); @@ -103,7 +119,7 @@ // Should be called whenever the root layer for the given frame view changes. void FrameViewRootLayerDidChange(LocalFrameView*); - std::unique_ptr<WebScrollbarLayer> CreateSolidColorScrollbarLayer( + std::unique_ptr<ScrollbarLayerGroup> CreateSolidColorScrollbarLayer( ScrollbarOrientation, int thumb_thickness, int track_start, @@ -178,12 +194,12 @@ void SetTouchEventTargetRects(LocalFrame*, LayerHitTestRects&); void ComputeTouchEventTargetRects(LocalFrame*, LayerHitTestRects&); - WebScrollbarLayer* AddWebScrollbarLayer(ScrollableArea*, - ScrollbarOrientation, - std::unique_ptr<WebScrollbarLayer>); - WebScrollbarLayer* GetWebScrollbarLayer(ScrollableArea*, - ScrollbarOrientation); - void RemoveWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); + void AddScrollbarLayerGroup(ScrollableArea*, + ScrollbarOrientation, + std::unique_ptr<ScrollbarLayerGroup>); + ScrollbarLayerGroup* GetScrollbarLayerGroup(ScrollableArea*, + ScrollbarOrientation); + void RemoveScrollbarLayerGroup(ScrollableArea*, ScrollbarOrientation); bool FrameScrollerIsDirty(LocalFrameView*) const; @@ -192,7 +208,7 @@ programmatic_scroll_animator_timeline_; using ScrollbarMap = - HeapHashMap<Member<ScrollableArea>, std::unique_ptr<WebScrollbarLayer>>; + HeapHashMap<Member<ScrollableArea>, std::unique_ptr<ScrollbarLayerGroup>>; ScrollbarMap horizontal_scrollbars_; ScrollbarMap vertical_scrollbars_;
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc index 0917cc6..1aa802b 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc
@@ -885,7 +885,7 @@ } TEST_P(ScrollingCoordinatorTest, - scrollbarsForceMainThreadOrHaveWebScrollbarLayer) { + ScrollbarsForceMainThreadOrHaveCompositorScrollbarLayer) { RegisterMockedHttpURLLoad("trivial-scroller.html"); NavigateTo(base_url_ + "trivial-scroller.html"); ForceFullCompositingUpdate();
diff --git a/third_party/blink/renderer/core/paint/DEPS b/third_party/blink/renderer/core/paint/DEPS new file mode 100644 index 0000000..bd04826 --- /dev/null +++ b/third_party/blink/renderer/core/paint/DEPS
@@ -0,0 +1,5 @@ +include_rules = [ + # This goes away after slimming paint v2. For now it violates strict onion + # soup guidelines. + "+cc/layers/picture_layer.h", +]
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc index 00b7de34..7bd3cd32 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
@@ -28,6 +28,7 @@ #include <memory> #include "cc/input/overscroll_behavior.h" +#include "cc/layers/picture_layer.h" #include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -1776,7 +1777,7 @@ FloatSize background_size = relative_compositing_bounds_size; if (BackgroundLayerPaintsFixedRootBackground()) { LocalFrameView* frame_view = ToLayoutView(GetLayoutObject()).GetFrameView(); - background_size = FloatSize(frame_view->VisibleContentRect().Size()); + background_size = FloatSize(frame_view->VisibleContentSize()); } background_layer_->SetPosition(FloatPoint()); if (background_size != background_layer_->Size()) {
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc index b7ab205..5e052d9c 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc
@@ -4,8 +4,8 @@ #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" +#include "cc/layers/picture_layer.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/platform/web_content_layer.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/layout/layout_box_model_object.h" #include "third_party/blink/renderer/core/layout/layout_image.h" @@ -2357,7 +2357,7 @@ target_layer ? target_layer->GraphicsLayerBacking() : nullptr; ASSERT_TRUE(target_graphics_layer); EXPECT_FALSE(target_graphics_layer->ContentLayer() - ->TransformedRasterizationAllowed()); + ->transformed_rasterization_allowed()); } { LayoutObject* target = GetLayoutObjectByElementId("target2"); @@ -2367,7 +2367,7 @@ target_layer ? target_layer->GraphicsLayerBacking() : nullptr; ASSERT_TRUE(target_graphics_layer); EXPECT_FALSE(target_graphics_layer->ContentLayer() - ->TransformedRasterizationAllowed()); + ->transformed_rasterization_allowed()); } { LayoutObject* target = GetLayoutObjectByElementId("target3"); @@ -2377,7 +2377,7 @@ target_layer ? target_layer->GraphicsLayerBacking() : nullptr; ASSERT_TRUE(target_graphics_layer); EXPECT_FALSE(target_graphics_layer->ContentLayer() - ->TransformedRasterizationAllowed()); + ->transformed_rasterization_allowed()); } } @@ -2399,8 +2399,8 @@ GraphicsLayer* target_graphics_layer = target_layer ? target_layer->GraphicsLayerBacking() : nullptr; ASSERT_TRUE(target_graphics_layer); - EXPECT_TRUE( - target_graphics_layer->ContentLayer()->TransformedRasterizationAllowed()); + EXPECT_TRUE(target_graphics_layer->ContentLayer() + ->transformed_rasterization_allowed()); } // This tests that when the scroller becomes no longer scrollable if a sticky
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc b/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc index 575d145e..d393de8b 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc
@@ -222,10 +222,22 @@ LayoutBoxModelObject& layout_object = layer->GetLayoutObject(); if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { + // The final value for |unclipped_absolute_bounding_box| needs to be + // in absolute, unscrolled space, without any scroll applied. properties.unclipped_absolute_bounding_box = EnclosingIntRect(geometry_map_.AbsoluteRect( FloatRect(layer->BoundingBoxForCompositingOverlapTest()))); + bool affected_by_scroll = root_layer_->GetScrollableArea() && + layer->IsAffectedByScrollOf(root_layer_); + + // At ths point, |unclipped_absolute_bounding_box| is in viewport space. + // To convert to absolute space, add scroll offset for non-fixed layers. + if (affected_by_scroll) { + properties.unclipped_absolute_bounding_box.Move( + RoundedIntSize(root_layer_->GetScrollableArea()->GetScrollOffset())); + } + ClipRect clip_rect; layer->Clipper(PaintLayer::kDoNotUseGeometryMapper) .CalculateBackgroundClipRect( @@ -234,15 +246,15 @@ kIgnorePlatformOverlayScrollbarSize, kIgnoreOverflowClipAndScroll), clip_rect); - // Scroll offset is not included in the clip rect returned above - // (see kIgnoreOverflowClipAndScroll), so we need to add it in - // now. Scroll offset is excluded so that we do not need to invalidate - // the clip rect cache on scroll. - if (root_layer_->GetScrollableArea()) { - clip_rect.Move( - LayoutSize(-root_layer_->GetScrollableArea()->GetScrollOffset())); - } IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); + // |snapped_clip_rect| is in absolute space space, but with scroll applied. + // To convert to absolute, unscrolled space, subtract scroll offsets for + // fixed layers. + if (root_layer_->GetScrollableArea() && !affected_by_scroll) { + snapped_clip_rect.Move( + RoundedIntSize(-root_layer_->GetScrollableArea()->GetScrollOffset())); + } + properties.clipped_absolute_bounding_box = properties.unclipped_absolute_bounding_box; properties.clipped_absolute_bounding_box.Intersect(snapped_clip_rect);
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater_test.cc b/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater_test.cc index 163e0bd..5ad2851e 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater_test.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater_test.cc
@@ -114,17 +114,40 @@ ->Layer() ->SetNeedsCompositingInputsUpdate(); GetDocument().View()->UpdateAllLifecyclePhases(); - if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { - EXPECT_EQ(IntRect(8, -17, 200, 200), - target->Layer()->ClippedAbsoluteBoundingBox()); - EXPECT_EQ(IntRect(8, -17, 200, 200), - target->Layer()->UnclippedAbsoluteBoundingBox()); - } else { - EXPECT_EQ(IntRect(8, 8, 200, 200), - target->Layer()->ClippedAbsoluteBoundingBox()); - EXPECT_EQ(IntRect(8, 8, 200, 200), - target->Layer()->UnclippedAbsoluteBoundingBox()); - } + EXPECT_EQ(IntRect(8, 8, 200, 200), + target->Layer()->ClippedAbsoluteBoundingBox()); + EXPECT_EQ(IntRect(8, 8, 200, 200), + target->Layer()->UnclippedAbsoluteBoundingBox()); +} + +TEST_P(CompositingInputsUpdaterTest, + UnclippedAndClippedRectsUnderScrollFixedPos) { + // Non-RLS is not supported and the code will be delete shortly. + if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) + return; + SetBodyInnerHTML(R"HTML( + <div id=clip style="position: fixed; overflow: hidden;"> + <div id=target style=" transform: translateZ(0); width: 200px; height: 200px; background: lightgray"></div> + </div> + <div style="position: relative; width: 20px; height: 3000px"></div> + )HTML"); + + LayoutBoxModelObject* target = + ToLayoutBoxModelObject(GetLayoutObjectByElementId("target")); + + GetDocument().View()->LayoutViewportScrollableArea()->ScrollBy( + ScrollOffset(0, 25), kUserScroll); + GetDocument() + .View() + ->GetLayoutView() + ->Layer() + ->SetNeedsCompositingInputsUpdate(); + + GetDocument().View()->UpdateAllLifecyclePhases(); + EXPECT_EQ(IntRect(8, 8, 200, 200), + target->Layer()->ClippedAbsoluteBoundingBox()); + EXPECT_EQ(IntRect(8, 8, 200, 200), + target->Layer()->UnclippedAbsoluteBoundingBox()); } TEST_P(CompositingInputsUpdaterTest, ClipPathAncestor) {
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc index 5f990af7..7de149c 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.cc
@@ -379,9 +379,21 @@ } } - const IntRect& abs_bounds = use_clipped_bounding_rect - ? layer->ClippedAbsoluteBoundingBox() - : layer->UnclippedAbsoluteBoundingBox(); + IntRect abs_bounds = use_clipped_bounding_rect + ? layer->ClippedAbsoluteBoundingBox() + : layer->UnclippedAbsoluteBoundingBox(); + PaintLayer* root_layer = layout_view_.Layer(); + // |abs_bounds| does not include root scroller offset. For the purposes + // of overlap, this only matters for fixed-position objects, and their + // relative position to other elements. Therefore, it's still correct to, + // instead of adding scroll to all non-fixed elements, add a reverse scroll + // to ones that are fixed. + if (root_layer->GetScrollableArea() && + !layer->IsAffectedByScrollOf(root_layer)) { + abs_bounds.Move( + RoundedIntSize(root_layer->GetScrollableArea()->GetScrollOffset())); + } + absolute_descendant_bounding_box = abs_bounds; if (current_recursion_data.testing_overlap_ && !RequiresCompositingOrSquashing(direct_reasons)) {
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc new file mode 100644 index 0000000..9fa5a10 --- /dev/null +++ b/third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater_test.cc
@@ -0,0 +1,59 @@ +// 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 "third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/paint/paint_layer.h" +#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" + +namespace blink { + +typedef bool TestParamRootLayerScrolling; +class CompositingRequirementsUpdaterTest + : public testing::WithParamInterface<TestParamRootLayerScrolling>, + private ScopedRootLayerScrollingForTest, + public RenderingTest { + public: + CompositingRequirementsUpdaterTest() + : ScopedRootLayerScrollingForTest(GetParam()), + RenderingTest(SingleChildLocalFrameClient::Create()) {} + + void SetUp() final; +}; + +void CompositingRequirementsUpdaterTest::SetUp() { + RenderingTest::SetUp(); + EnableCompositing(); +} + +INSTANTIATE_TEST_CASE_P(All, + CompositingRequirementsUpdaterTest, + testing::Bool()); + +TEST_P(CompositingRequirementsUpdaterTest, FixedPosOverlap) { + SetBodyInnerHTML(R"HTML( + <div style="position: relative; width: 500px; height: 300px; + will-change: transform"></div> + <div id=fixed style="position: fixed; width: 500px; height: 300px; + top: 300px"></div> + <div style="width: 200px; height: 3000px"></div> + )HTML"); + + LayoutBoxModelObject* fixed = + ToLayoutBoxModelObject(GetLayoutObjectByElementId("fixed")); + + EXPECT_EQ( + CompositingReason::kOverlap | CompositingReason::kSquashingDisallowed, + fixed->Layer()->GetCompositingReasons()); + + GetDocument().View()->LayoutViewportScrollableArea()->ScrollBy( + ScrollOffset(0, 100), kUserScroll); + GetDocument().View()->UpdateAllLifecyclePhases(); + + // No longer overlaps the first div. + EXPECT_EQ(CompositingReason::kNone, fixed->Layer()->GetCompositingReasons()); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/paint/frame_painter.cc b/third_party/blink/renderer/core/paint/frame_painter.cc index 6bf0c566..45c2de470 100644 --- a/third_party/blink/renderer/core/paint/frame_painter.cc +++ b/third_party/blink/renderer/core/paint/frame_painter.cc
@@ -40,8 +40,8 @@ IntRect document_dirty_rect; IntPoint frame_view_location(GetFrameView().Location()); - IntRect visible_area_without_scrollbars( - frame_view_location, GetFrameView().VisibleContentRect().Size()); + IntRect visible_area_without_scrollbars(frame_view_location, + GetFrameView().VisibleContentSize()); IntPoint content_offset = -frame_view_location + GetFrameView().ScrollOffsetInt(); if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && @@ -95,7 +95,7 @@ IntRect scroll_view_dirty_rect = rect.rect_; IntRect visible_area_with_scrollbars( frame_view_location, - GetFrameView().VisibleContentRect(kIncludeScrollbars).Size()); + GetFrameView().VisibleContentSize(kIncludeScrollbars)); scroll_view_dirty_rect.Intersect(visible_area_with_scrollbars); scroll_view_dirty_rect.MoveBy(-frame_view_location);
diff --git a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc index 93ee8d1a..7a4d082 100644 --- a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc
@@ -191,10 +191,10 @@ String first_line_string; if (inline_text_box_.IsFirstLineStyle()) { first_line_string = layout_item_string; - ApplyTextTransform( - inline_text_box_.GetLineLayoutItem().Style( - inline_text_box_.IsFirstLineStyle()), - first_line_string, + const ComputedStyle& style = inline_text_box_.GetLineLayoutItem().StyleRef( + inline_text_box_.IsFirstLineStyle()); + style.ApplyTextTransform( + &first_line_string, inline_text_box_.GetLineLayoutItem().PreviousCharacter()); // TODO(crbug.com/795498): this is a hack. The root issue is that // capitalizing letters can change the length of the backing string.
diff --git a/third_party/blink/renderer/core/paint/link_highlight_impl.cc b/third_party/blink/renderer/core/paint/link_highlight_impl.cc index 948864d..b48741f0 100644 --- a/third_party/blink/renderer/core/paint/link_highlight_impl.cc +++ b/third_party/blink/renderer/core/paint/link_highlight_impl.cc
@@ -29,10 +29,11 @@ #include <utility> #include "base/memory/ptr_util.h" +#include "cc/layers/layer.h" +#include "cc/layers/picture_layer.h" #include "cc/paint/display_item_list.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_compositor_support.h" -#include "third_party/blink/public/platform/web_content_layer.h" #include "third_party/blink/public/platform/web_float_point.h" #include "third_party/blink/public/platform/web_layer.h" #include "third_party/blink/public/platform/web_rect.h" @@ -90,10 +91,15 @@ WebCompositorSupport* compositor_support = Platform::Current()->CompositorSupport(); DCHECK(compositor_support); - content_layer_ = compositor_support->CreateContentLayer(this); - clip_layer_ = compositor_support->CreateLayer(); + content_layer_ = cc::PictureLayer::Create(this); + clip_layer_ = cc::Layer::Create(); clip_layer_->SetTransformOrigin(FloatPoint3D()); - clip_layer_->AddChild(content_layer_->Layer()); + clip_layer_->AddChild(content_layer_); + + web_content_layer_ = + compositor_support->CreateLayerFromCCLayer(content_layer_.get()); + web_clip_layer_ = + compositor_support->CreateLayerFromCCLayer(clip_layer_.get()); compositor_animation_ = CompositorAnimation::Create(); DCHECK(compositor_animation_); @@ -104,9 +110,9 @@ CompositorElementId element_id = CompositorElementIdFromUniqueObjectId(unique_id_); compositor_animation_->AttachElement(element_id); - content_layer_->Layer()->SetDrawsContent(true); - content_layer_->Layer()->SetOpacity(1); - content_layer_->Layer()->SetElementId(element_id); + content_layer_->SetIsDrawable(true); + content_layer_->SetOpacity(1); + content_layer_->SetElementId(element_id); geometry_needs_update_ = true; } @@ -122,12 +128,12 @@ ReleaseResources(); } -WebContentLayer* LinkHighlightImpl::ContentLayer() { +cc::PictureLayer* LinkHighlightImpl::ContentLayer() { return content_layer_.get(); } WebLayer* LinkHighlightImpl::ClipLayer() { - return clip_layer_.get(); + return web_clip_layer_.get(); } void LinkHighlightImpl::ReleaseResources() { @@ -260,17 +266,17 @@ bool path_has_changed = !(new_path == path_); if (path_has_changed) { path_ = new_path; - content_layer_->Layer()->SetBounds( + content_layer_->SetBounds( static_cast<gfx::Size>(EnclosingIntRect(bounding_rect).Size())); } - content_layer_->Layer()->SetPosition(bounding_rect.Location()); + content_layer_->SetPosition(bounding_rect.Location()); return path_has_changed; } gfx::Rect LinkHighlightImpl::PaintableRegion() { - return gfx::Rect(ContentLayer()->Layer()->Bounds()); + return gfx::Rect(content_layer_->bounds()); } scoped_refptr<cc::DisplayItemList> @@ -311,7 +317,7 @@ const float kFadeDuration = 0.1f; const float kMinPreFadeDuration = 0.1f; - content_layer_->Layer()->SetOpacity(kStartOpacity); + content_layer_->SetOpacity(kStartOpacity); std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::Create(); @@ -340,7 +346,7 @@ CompositorKeyframeModel::Create(*curve, CompositorTargetProperty::OPACITY, 0, 0); - content_layer_->Layer()->SetDrawsContent(true); + content_layer_->SetIsDrawable(true); compositor_animation_->AddKeyframeModel(std::move(keyframe_model)); Invalidate(); @@ -385,7 +391,7 @@ // We only need to invalidate the layer if the highlight size has changed, // otherwise we can just re-position the layer without needing to // repaint. - content_layer_->Layer()->Invalidate(); + content_layer_->SetNeedsDisplay(); if (current_graphics_layer_) { gfx::Rect rect = gfx::ToEnclosingRect(
diff --git a/third_party/blink/renderer/core/paint/link_highlight_impl.h b/third_party/blink/renderer/core/paint/link_highlight_impl.h index ac3f09b0..bd448dc 100644 --- a/third_party/blink/renderer/core/paint/link_highlight_impl.h +++ b/third_party/blink/renderer/core/paint/link_highlight_impl.h
@@ -29,7 +29,6 @@ #include <memory> #include "cc/layers/content_layer_client.h" -#include "third_party/blink/public/platform/web_content_layer.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/animation/compositor_animation.h" #include "third_party/blink/renderer/platform/animation/compositor_animation_client.h" @@ -40,12 +39,16 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +namespace cc { +class Layer; +class PictureLayer; +} + namespace blink { class GraphicsLayer; class LayoutBoxModelObject; class Node; -class WebContentLayer; class WebLayer; class WebViewImpl; @@ -57,7 +60,7 @@ static std::unique_ptr<LinkHighlightImpl> Create(Node*, WebViewImpl*); ~LinkHighlightImpl() override; - WebContentLayer* ContentLayer(); + cc::PictureLayer* ContentLayer(); WebLayer* ClipLayer(); void StartHighlightAnimationIfNeeded(); void UpdateGeometry(); @@ -99,8 +102,10 @@ // changed size since the last call to this function. bool ComputeHighlightLayerPathAndPosition(const LayoutBoxModelObject&); - std::unique_ptr<WebContentLayer> content_layer_; - std::unique_ptr<WebLayer> clip_layer_; + scoped_refptr<cc::PictureLayer> content_layer_; + std::unique_ptr<WebLayer> web_content_layer_; // Wraps |content_layer_|. + scoped_refptr<cc::Layer> clip_layer_; + std::unique_ptr<WebLayer> web_clip_layer_; Path path_; Persistent<Node> node_;
diff --git a/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc b/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc index e7e3ce6..4ae95d4c 100644 --- a/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc +++ b/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc
@@ -26,9 +26,9 @@ #include "third_party/blink/renderer/core/paint/link_highlight_impl.h" #include <memory> + #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/public/platform/web_content_layer.h" #include "third_party/blink/public/platform/web_float_point.h" #include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_size.h"
diff --git a/third_party/blink/renderer/core/paint/paint_layer.h b/third_party/blink/renderer/core/paint/paint_layer.h index 4960ea7..24a1578 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.h +++ b/third_party/blink/renderer/core/paint/paint_layer.h
@@ -731,8 +731,11 @@ // clipping logic. const PaintLayer* clip_parent = nullptr; + // These two boxes do not include any applicable scroll offset of the + // root PaintLayer. IntRect clipped_absolute_bounding_box; IntRect unclipped_absolute_bounding_box; + const LayoutBoxModelObject* clipping_container = nullptr; }; @@ -756,6 +759,9 @@ DCHECK(!needs_ancestor_dependent_compositing_inputs_update_); return EnsureAncestorDependentCompositingInputs(); } + + // These two do not include any applicable scroll offset of the + // root PaintLayer. const IntRect& ClippedAbsoluteBoundingBox() const { return GetAncestorDependentCompositingInputs() .clipped_absolute_bounding_box; @@ -764,6 +770,7 @@ return GetAncestorDependentCompositingInputs() .unclipped_absolute_bounding_box; } + const PaintLayer* OpacityAncestor() const { return GetAncestorDependentCompositingInputs().opacity_ancestor; }
diff --git a/third_party/blink/renderer/core/paint/svg_filter_painter.cc b/third_party/blink/renderer/core/paint/svg_filter_painter.cc index f35b674..5c5f329 100644 --- a/third_party/blink/renderer/core/paint/svg_filter_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_filter_painter.cc
@@ -7,7 +7,6 @@ #include <utility> #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/paint/filter_effect_builder.h" #include "third_party/blink/renderer/core/svg/graphics/filters/svg_filter_builder.h" #include "third_party/blink/renderer/core/svg/svg_filter_element.h" @@ -85,8 +84,7 @@ SVGFilterRecordingContext& recording_context) { filter_.ClearInvalidationMask(); - SVGResourceClient* client = SVGResources::GetClient(object); - if (FilterData* filter_data = filter_.GetFilterDataForClient(client)) { + if (FilterData* filter_data = filter_.GetFilterDataForLayoutObject(&object)) { // If the filterData already exists we do not need to record the content // to be filtered. This can occur if the content was previously recorded // or we are in a cycle. @@ -116,7 +114,8 @@ DCHECK_EQ(filter_data->state_, FilterData::kInitial); // TODO(pdr): Can this be moved out of painter? - filter_.SetFilterDataForClient(client, filter_data); + filter_.SetFilterDataForLayoutObject(const_cast<LayoutObject*>(&object), + filter_data); filter_data->state_ = FilterData::kRecordingContent; return recording_context.BeginContent(); } @@ -124,8 +123,7 @@ void SVGFilterPainter::FinishEffect( const LayoutObject& object, SVGFilterRecordingContext& recording_context) { - SVGResourceClient* client = SVGResources::GetClient(object); - FilterData* filter_data = filter_.GetFilterDataForClient(client); + FilterData* filter_data = filter_.GetFilterDataForLayoutObject(&object); if (!filter_data) { // Our state was torn down while we were being painted (selection style for // <text> can have this effect), or it was never created (invalid filter.)
diff --git a/third_party/blink/renderer/core/paint/video_painter_test.cc b/third_party/blink/renderer/core/paint/video_painter_test.cc index cd6e3a2..cbdc116 100644 --- a/third_party/blink/renderer/core/paint/video_painter_test.cc +++ b/third_party/blink/renderer/core/paint/video_painter_test.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/paint/video_painter.h" +#include "cc/layers/layer.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_compositor_support.h" #include "third_party/blink/public/platform/web_layer.h" @@ -32,7 +33,10 @@ client_->NetworkStateChanged(); ready_state_ = kReadyStateHaveEnoughData; client_->ReadyStateChanged(); - web_layer_ = Platform::Current()->CompositorSupport()->CreateLayer(); + layer_ = cc::Layer::Create(); + web_layer_ = + Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer( + layer_.get()); client_->SetWebLayer(web_layer_.get()); } NetworkState GetNetworkState() const override { return network_state_; } @@ -40,6 +44,7 @@ private: WebMediaPlayerClient* client_; + scoped_refptr<cc::Layer> layer_; std::unique_ptr<WebLayer> web_layer_; NetworkState network_state_ = kNetworkStateEmpty; ReadyState ready_state_ = kReadyStateHaveNothing;
diff --git a/third_party/blink/renderer/core/script/script_loader.cc b/third_party/blink/renderer/core/script/script_loader.cc index c3897fa..45fee9aa 100644 --- a/third_party/blink/renderer/core/script/script_loader.cc +++ b/third_party/blink/renderer/core/script/script_loader.cc
@@ -964,10 +964,9 @@ DeprecatedEqualIgnoringCase(event_attribute, "onload()"); } -PendingScript* ScriptLoader::GetPendingScriptIfScriptIsAsync() { - if (pending_script_ && async_exec_type_ == ScriptRunner::kAsync) - return pending_script_; - return nullptr; +PendingScript* ScriptLoader::GetPendingScriptIfScriptOfAsyncScript() { + DCHECK(IsAsync()); + return pending_script_; } } // namespace blink
diff --git a/third_party/blink/renderer/core/script/script_loader.h b/third_party/blink/renderer/core/script/script_loader.h index de6e46e..75c3ffb 100644 --- a/third_party/blink/renderer/core/script/script_loader.h +++ b/third_party/blink/renderer/core/script/script_loader.h
@@ -121,16 +121,24 @@ void HandleSourceAttribute(const String& source_url); void HandleAsyncAttribute(); + // IsReady only makes sense for scripts controlled by ScriptRunner. virtual bool IsReady() const { return pending_script_ && pending_script_->IsReady(); } void SetFetchDocWrittenScriptDeferIdle(); - // To support script streaming, the ScriptRunner may need to access the - // PendingScript. This breaks the intended layering, so please use with - // care. (Method is virtual to support testing.) - virtual PendingScript* GetPendingScriptIfScriptIsAsync(); + // IsAsync only makes sense for scripts controlled by ScriptRunner. + bool IsAsync() const { + DCHECK_NE(async_exec_type_, ScriptRunner::kNone); + return async_exec_type_ == ScriptRunner::kAsync; + } + + // GetPendingScriptIfScriptOfAsyncScript only makes sense for scripts + // controlled by ScriptRunner. To support script streaming, the ScriptRunner + // may need to access the PendingScript. This breaks the intended layering, so + // please use with care. (Method is virtual to support testing.) + virtual PendingScript* GetPendingScriptIfScriptOfAsyncScript(); protected: ScriptLoader(ScriptElementBase*,
diff --git a/third_party/blink/renderer/core/script/script_runner.cc b/third_party/blink/renderer/core/script/script_runner.cc index 8073a0c8..be5a364 100644 --- a/third_party/blink/renderer/core/script/script_runner.cc +++ b/third_party/blink/renderer/core/script/script_runner.cc
@@ -202,8 +202,7 @@ if (in_order_scripts_to_execute_soon_.IsEmpty()) return false; - DCHECK(!in_order_scripts_to_execute_soon_.front() - ->GetPendingScriptIfScriptIsAsync()) + DCHECK(!in_order_scripts_to_execute_soon_.front()->IsAsync()) << "In-order scripts queue should not contain any async script."; in_order_scripts_to_execute_soon_.TakeFirst()->Execute(); @@ -213,18 +212,25 @@ } bool ScriptRunner::ExecuteAsyncTask() { - for (auto iter = async_scripts_to_execute_soon_.begin(); - iter != async_scripts_to_execute_soon_.end(); ++iter) { - PendingScript* pending_script = (*iter)->GetPendingScriptIfScriptIsAsync(); - if (!pending_script || !pending_script->IsCurrentlyStreaming()) { - ScriptLoader* loader = *iter; - async_scripts_to_execute_soon_.erase(iter); - loader->Execute(); - document_->DecrementLoadEventDelayCount(); - return true; - } + // Find an async script loader which is not currently streaming. + auto it = std::find_if(async_scripts_to_execute_soon_.begin(), + async_scripts_to_execute_soon_.end(), + [](ScriptLoader* loader) { + PendingScript* pending_script = + loader->GetPendingScriptIfScriptOfAsyncScript(); + DCHECK(pending_script); + return !pending_script->IsCurrentlyStreaming(); + }); + if (it == async_scripts_to_execute_soon_.end()) { + return false; } - return false; + + // Remove the async script loader from the ready-to-exec set and execute. + ScriptLoader* async_script_to_execute = *it; + async_scripts_to_execute_soon_.erase(it); + async_script_to_execute->Execute(); + document_->DecrementLoadEventDelayCount(); + return true; } void ScriptRunner::ExecuteTask() { @@ -279,7 +285,7 @@ script_loader) != async_scripts_to_execute_soon_.end()); PendingScript* pending_script = - script_loader->GetPendingScriptIfScriptIsAsync(); + script_loader->GetPendingScriptIfScriptOfAsyncScript(); if (!pending_script) return false;
diff --git a/third_party/blink/renderer/core/script/script_runner.h b/third_party/blink/renderer/core/script/script_runner.h index 684087c..e25f61d 100644 --- a/third_party/blink/renderer/core/script/script_runner.h +++ b/third_party/blink/renderer/core/script/script_runner.h
@@ -84,6 +84,7 @@ // Execute the first task in in_order_scripts_to_execute_soon_. // Returns true if task was run, and false otherwise. bool ExecuteInOrderTask(); + // Execute any task in async_scripts_to_execute_soon_. // Returns true if task was run, and false otherwise. bool ExecuteAsyncTask();
diff --git a/third_party/blink/renderer/core/script/script_runner_test.cc b/third_party/blink/renderer/core/script/script_runner_test.cc index bbc2e6e..1c349fd2 100644 --- a/third_party/blink/renderer/core/script/script_runner_test.cc +++ b/third_party/blink/renderer/core/script/script_runner_test.cc
@@ -104,7 +104,7 @@ void Trace(blink::Visitor*) override; - PendingScript* GetPendingScriptIfScriptIsAsync() override { + PendingScript* GetPendingScriptIfScriptOfAsyncScript() override { return mock_pending_script_if_script_is_async_.Get(); } MockPendingScript* GetMockPendingScript() {
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index 58e8e78..911c2ea 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -61,6 +61,7 @@ #include "third_party/blink/renderer/platform/geometry/float_rounded_rect.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/length_functions.h" +#include "third_party/blink/renderer/platform/text/capitalize.h" #include "third_party/blink/renderer/platform/transforms/rotate_transform_operation.h" #include "third_party/blink/renderer/platform/transforms/scale_transform_operation.h" #include "third_party/blink/renderer/platform/transforms/translate_transform_operation.h" @@ -1399,6 +1400,24 @@ : !should_use; } +void ComputedStyle::ApplyTextTransform(String* text, + UChar previous_character) const { + switch (TextTransform()) { + case ETextTransform::kNone: + return; + case ETextTransform::kCapitalize: + *text = Capitalize(*text, previous_character); + return; + case ETextTransform::kUppercase: + *text = text->UpperUnicode(Locale()); + return; + case ETextTransform::kLowercase: + *text = text->LowerUnicode(Locale()); + return; + } + NOTREACHED(); +} + const AtomicString& ComputedStyle::TextEmphasisMarkString() const { switch (GetTextEmphasisMark()) { case TextEmphasisMark::kNone:
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 5bf7f9ee..4acc45f7 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -1322,6 +1322,9 @@ bool ShouldUseTextIndent(bool is_first_line, bool is_after_forced_break) const; + // text-transform utility functions. + void ApplyTextTransform(String*, UChar previous_character = ' ') const; + // Line-height utility functions. const Length& SpecifiedLineHeight() const; int ComputedLineHeight() const;
diff --git a/third_party/blink/renderer/core/style/style_svg_resource.h b/third_party/blink/renderer/core/style/style_svg_resource.h deleted file mode 100644 index f9f968c..0000000 --- a/third_party/blink/renderer/core/style/style_svg_resource.h +++ /dev/null
@@ -1,51 +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 THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_SVG_RESOURCE_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_SVG_RESOURCE_H_ - -#include "base/macros.h" -#include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/core/svg/svg_resource.h" -#include "third_party/blink/renderer/platform/heap/persistent.h" -#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" - -namespace blink { - -class StyleSVGResource : public RefCounted<StyleSVGResource> { - public: - static scoped_refptr<StyleSVGResource> Create(SVGResource* resource, - const AtomicString& url) { - return base::AdoptRef(new StyleSVGResource(resource, url)); - } - - bool operator==(const StyleSVGResource& other) const { - return resource_.Get() == other.resource_.Get(); - } - - void AddClient(SVGResourceClient& client) { - if (resource_) - resource_->AddClient(client); - } - void RemoveClient(SVGResourceClient& client) { - if (resource_) - resource_->RemoveClient(client); - } - - SVGResource* Resource() const { return resource_; } - const AtomicString& Url() const { return url_; } - - private: - StyleSVGResource(SVGResource* resource, const AtomicString& url) - : resource_(resource), url_(url) {} - - Persistent<SVGResource> resource_; - const AtomicString url_; - - DISALLOW_COPY_AND_ASSIGN(StyleSVGResource); -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_SVG_RESOURCE_H_
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 2be43fb..1a32ce35 100644 --- a/third_party/blink/renderer/core/style/svg_computed_style.h +++ b/third_party/blink/renderer/core/style/svg_computed_style.h
@@ -92,10 +92,12 @@ static float InitialFloodOpacity() { return 1; } static Color InitialFloodColor() { return Color(0, 0, 0); } static Color InitialLightingColor() { return Color(255, 255, 255); } - static StyleSVGResource* InitialMaskerResource() { return nullptr; } - static StyleSVGResource* InitialMarkerStartResource() { return nullptr; } - static StyleSVGResource* InitialMarkerMidResource() { return nullptr; } - static StyleSVGResource* InitialMarkerEndResource() { return nullptr; } + static const AtomicString& InitialMaskerResource() { return g_null_atom; } + static const AtomicString& InitialMarkerStartResource() { + return g_null_atom; + } + static const AtomicString& InitialMarkerMidResource() { return g_null_atom; } + static const AtomicString& InitialMarkerEndResource() { return g_null_atom; } static EMaskType InitialMaskType() { return MT_LUMINANCE; } static EPaintOrder InitialPaintOrder() { return kPaintOrderNormal; } static StylePath* InitialD() { return nullptr; } @@ -257,25 +259,25 @@ } // Setters for non-inherited resources - void SetMaskerResource(scoped_refptr<StyleSVGResource> resource) { - if (!(resources->masker == resource)) - resources.Access()->masker = std::move(resource); + void SetMaskerResource(const AtomicString& obj) { + if (!(resources->masker == obj)) + resources.Access()->masker = obj; } // Setters for inherited resources - void SetMarkerStartResource(scoped_refptr<StyleSVGResource> resource) { - if (!(inherited_resources->marker_start == resource)) - inherited_resources.Access()->marker_start = std::move(resource); + void SetMarkerStartResource(const AtomicString& obj) { + if (!(inherited_resources->marker_start == obj)) + inherited_resources.Access()->marker_start = obj; } - void SetMarkerMidResource(scoped_refptr<StyleSVGResource> resource) { - if (!(inherited_resources->marker_mid == resource)) - inherited_resources.Access()->marker_mid = std::move(resource); + void SetMarkerMidResource(const AtomicString& obj) { + if (!(inherited_resources->marker_mid == obj)) + inherited_resources.Access()->marker_mid = obj; } - void SetMarkerEndResource(scoped_refptr<StyleSVGResource> resource) { - if (!(inherited_resources->marker_end == resource)) - inherited_resources.Access()->marker_end = std::move(resource); + void SetMarkerEndResource(const AtomicString& obj) { + if (!(inherited_resources->marker_end == obj)) + inherited_resources.Access()->marker_end = obj; } // Read accessors for all the properties @@ -339,15 +341,15 @@ const Length& R() const { return geometry->r; } const Length& Rx() const { return geometry->rx; } const Length& Ry() const { return geometry->ry; } - StyleSVGResource* MaskerResource() const { return resources->masker.get(); } - StyleSVGResource* MarkerStartResource() const { - return inherited_resources->marker_start.get(); + const AtomicString& MaskerResource() const { return resources->masker; } + const AtomicString& MarkerStartResource() const { + return inherited_resources->marker_start; } - StyleSVGResource* MarkerMidResource() const { - return inherited_resources->marker_mid.get(); + const AtomicString& MarkerMidResource() const { + return inherited_resources->marker_mid; } - StyleSVGResource* MarkerEndResource() const { - return inherited_resources->marker_end.get(); + const AtomicString& MarkerEndResource() const { + return inherited_resources->marker_end; } EMaskType MaskType() const { return (EMaskType)svg_noninherited_flags.f.mask_type; @@ -375,9 +377,10 @@ } // convenience - bool HasMasker() const { return MaskerResource(); } + bool HasMasker() const { return !MaskerResource().IsEmpty(); } bool HasMarkers() const { - return MarkerStartResource() || MarkerMidResource() || MarkerEndResource(); + return !MarkerStartResource().IsEmpty() || !MarkerMidResource().IsEmpty() || + !MarkerEndResource().IsEmpty(); } bool HasStroke() const { return !StrokePaint().IsNone(); } bool HasVisibleStroke() const {
diff --git a/third_party/blink/renderer/core/style/svg_computed_style_defs.cc b/third_party/blink/renderer/core/style/svg_computed_style_defs.cc index 91e1f4e..709c290 100644 --- a/third_party/blink/renderer/core/style/svg_computed_style_defs.cc +++ b/third_party/blink/renderer/core/style/svg_computed_style_defs.cc
@@ -33,8 +33,7 @@ namespace blink { bool SVGPaint::operator==(const SVGPaint& other) const { - return type == other.type && color == other.color && - resource == other.resource; + return type == other.type && color == other.color && url == other.url; } StyleFillData::StyleFillData()
diff --git a/third_party/blink/renderer/core/style/svg_computed_style_defs.h b/third_party/blink/renderer/core/style/svg_computed_style_defs.h index 40b845c..fb57a78b 100644 --- a/third_party/blink/renderer/core/style/svg_computed_style_defs.h +++ b/third_party/blink/renderer/core/style/svg_computed_style_defs.h
@@ -31,7 +31,6 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/style/style_path.h" -#include "third_party/blink/renderer/core/style/style_svg_resource.h" #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/length.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" @@ -122,7 +121,7 @@ struct SVGPaint { SVGPaint() : type(SVG_PAINTTYPE_NONE) {} - SVGPaint(Color color) : color(color), type(SVG_PAINTTYPE_RGBCOLOR) {} + SVGPaint(Color color) : type(SVG_PAINTTYPE_RGBCOLOR), color(color) {} CORE_EXPORT bool operator==(const SVGPaint&) const; bool operator!=(const SVGPaint& other) const { return !(*this == other); } @@ -146,14 +145,13 @@ return type == SVG_PAINTTYPE_CURRENTCOLOR || type == SVG_PAINTTYPE_URI_CURRENTCOLOR; } - StyleSVGResource* Resource() const { return resource.get(); } const Color& GetColor() const { return color; } - const String& GetUrl() const { return Resource()->Url(); } + const String& GetUrl() const { return url; } - scoped_refptr<StyleSVGResource> resource; - Color color; SVGPaintType type; + Color color; + String url; }; // Inherited/Non-Inherited Style Datastructures @@ -294,7 +292,7 @@ return !(*this == other); } - scoped_refptr<StyleSVGResource> masker; + AtomicString masker; private: StyleResourceData(); @@ -317,9 +315,9 @@ return !(*this == other); } - scoped_refptr<StyleSVGResource> marker_start; - scoped_refptr<StyleSVGResource> marker_mid; - scoped_refptr<StyleSVGResource> marker_end; + AtomicString marker_start; + AtomicString marker_mid; + AtomicString marker_end; private: StyleInheritedResourceData();
diff --git a/third_party/blink/renderer/core/svg/svg_element.cc b/third_party/blink/renderer/core/svg/svg_element.cc index 7adf07813..bc70198d7 100644 --- a/third_party/blink/renderer/core/svg/svg_element.cc +++ b/third_party/blink/renderer/core/svg/svg_element.cc
@@ -1310,16 +1310,6 @@ outgoing_references.clear(); } -SVGResourceClient* SVGElement::GetSVGResourceClient() { - if (!HasSVGRareData()) - return nullptr; - return SvgRareData()->GetSVGResourceClient(); -} - -SVGResourceClient& SVGElement::EnsureSVGResourceClient() { - return EnsureSVGRareData()->EnsureSVGResourceClient(this); -} - void SVGElement::Trace(blink::Visitor* visitor) { visitor->Trace(elements_with_relative_lengths_); visitor->Trace(attribute_to_property_map_);
diff --git a/third_party/blink/renderer/core/svg/svg_element.h b/third_party/blink/renderer/core/svg/svg_element.h index 84db978d..370ef1ff 100644 --- a/third_party/blink/renderer/core/svg/svg_element.h +++ b/third_party/blink/renderer/core/svg/svg_element.h
@@ -42,7 +42,6 @@ class SVGElement; class SVGElementRareData; class SVGPropertyBase; -class SVGResourceClient; class SVGSVGElement; class SVGUseElement; @@ -178,9 +177,6 @@ void RemoveAllIncomingReferences(); void RemoveAllOutgoingReferences(); - SVGResourceClient* GetSVGResourceClient(); - SVGResourceClient& EnsureSVGResourceClient(); - class InvalidationGuard { STACK_ALLOCATED();
diff --git a/third_party/blink/renderer/core/svg/svg_element_rare_data.cc b/third_party/blink/renderer/core/svg/svg_element_rare_data.cc index 2ca8dfb..3a865466 100644 --- a/third_party/blink/renderer/core/svg/svg_element_rare_data.cc +++ b/third_party/blink/renderer/core/svg/svg_element_rare_data.cc
@@ -6,7 +6,6 @@ #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/dom/document.h" -#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" namespace blink { @@ -38,20 +37,12 @@ return override_computed_style_.get(); } -SVGResourceClient& SVGElementRareData::EnsureSVGResourceClient( - SVGElement* element) { - if (!resource_client_) - resource_client_ = new SVGElementResourceClient(element); - return *resource_client_; -} - void SVGElementRareData::Trace(blink::Visitor* visitor) { visitor->Trace(outgoing_references_); visitor->Trace(incoming_references_); visitor->Trace(animated_smil_style_properties_); visitor->Trace(element_instances_); visitor->Trace(corresponding_element_); - visitor->Trace(resource_client_); } AffineTransform* SVGElementRareData::AnimateMotionTransform() {
diff --git a/third_party/blink/renderer/core/svg/svg_element_rare_data.h b/third_party/blink/renderer/core/svg/svg_element_rare_data.h index 5f8b83e..19fbe0b5b 100644 --- a/third_party/blink/renderer/core/svg/svg_element_rare_data.h +++ b/third_party/blink/renderer/core/svg/svg_element_rare_data.h
@@ -29,8 +29,6 @@ namespace blink { -class SVGResourceClient; - class SVGElementRareData : public GarbageCollectedFinalized<SVGElementRareData> { public: @@ -95,9 +93,6 @@ needs_override_computed_style_update_ = true; } - SVGResourceClient* GetSVGResourceClient() { return resource_client_; } - SVGResourceClient& EnsureSVGResourceClient(SVGElement*); - AffineTransform* AnimateMotionTransform(); void Trace(blink::Visitor*); @@ -107,7 +102,6 @@ SVGElementSet incoming_references_; HeapHashSet<WeakMember<SVGElement>> element_instances_; Member<SVGElement> corresponding_element_; - Member<SVGResourceClient> resource_client_; bool instances_updates_blocked_ : 1; bool use_override_computed_style_ : 1; bool needs_override_computed_style_update_ : 1;
diff --git a/third_party/blink/renderer/core/svg/svg_pattern_element.cc b/third_party/blink/renderer/core/svg/svg_pattern_element.cc index b4f64e62..d9ada97 100644 --- a/third_party/blink/renderer/core/svg/svg_pattern_element.cc +++ b/third_party/blink/renderer/core/svg/svg_pattern_element.cc
@@ -26,8 +26,6 @@ #include "third_party/blink/renderer/core/dom/element_traversal.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.h" #include "third_party/blink/renderer/core/svg/pattern_attributes.h" -#include "third_party/blink/renderer/core/svg/svg_resource.h" -#include "third_party/blink/renderer/core/svg/svg_tree_scope_resources.h" #include "third_party/blink/renderer/platform/transforms/affine_transform.h" namespace blink { @@ -81,7 +79,6 @@ visitor->Trace(pattern_transform_); visitor->Trace(pattern_units_); visitor->Trace(pattern_content_units_); - visitor->Trace(resource_); SVGElement::Trace(visitor); SVGURIReference::Trace(visitor); SVGTests::Trace(visitor); @@ -90,28 +87,6 @@ DEFINE_NODE_FACTORY(SVGPatternElement) -void SVGPatternElement::BuildPendingResource() { - ClearResourceReferences(); - if (!isConnected()) - return; - TreeScope& tree_scope = GetTreeScope(); - SVGTreeScopeResources& tree_scope_resources = - tree_scope.EnsureSVGTreeScopedResources(); - resource_ = tree_scope_resources.ResourceForId( - FragmentIdentifierFromIRIString(HrefString(), tree_scope)); - if (resource_) - resource_->AddClient(EnsureSVGResourceClient()); - - InvalidatePattern(LayoutInvalidationReason::kSvgResourceInvalidated); -} - -void SVGPatternElement::ClearResourceReferences() { - if (!resource_) - return; - resource_->RemoveClient(*GetSVGResourceClient()); - resource_ = nullptr; -} - void SVGPatternElement::CollectStyleForPresentationAttribute( const QualifiedName& name, const AtomicString& value, @@ -140,52 +115,33 @@ attr_name == SVGNames::patternContentUnitsAttr || attr_name == SVGNames::patternTransformAttr || SVGFitToViewBox::IsKnownAttribute(attr_name) || + SVGURIReference::IsKnownAttribute(attr_name) || SVGTests::IsKnownAttribute(attr_name)) { SVGElement::InvalidationGuard invalidation_guard(this); if (is_length_attr) UpdateRelativeLengthsInformation(); - InvalidatePattern(LayoutInvalidationReason::kAttributeChanged); - return; - } + LayoutSVGResourceContainer* layout_object = + ToLayoutSVGResourceContainer(this->GetLayoutObject()); + if (layout_object) + layout_object->InvalidateCacheAndMarkForLayout(); - if (SVGURIReference::IsKnownAttribute(attr_name)) { - SVGElement::InvalidationGuard invalidation_guard(this); - BuildPendingResource(); return; } SVGElement::SvgAttributeChanged(attr_name); } -Node::InsertionNotificationRequest SVGPatternElement::InsertedInto( - ContainerNode* root_parent) { - SVGElement::InsertedInto(root_parent); - if (root_parent->isConnected()) - BuildPendingResource(); - return kInsertionDone; -} - -void SVGPatternElement::RemovedFrom(ContainerNode* root_parent) { - SVGElement::RemovedFrom(root_parent); - if (root_parent->isConnected()) - ClearResourceReferences(); -} - void SVGPatternElement::ChildrenChanged(const ChildrenChange& change) { SVGElement::ChildrenChanged(change); if (change.by_parser) return; - InvalidatePattern(LayoutInvalidationReason::kChildChanged); -} - -void SVGPatternElement::InvalidatePattern( - LayoutInvalidationReasonForTracing reason) { - if (auto* layout_object = ToLayoutSVGResourceContainer(GetLayoutObject())) - layout_object->InvalidateCacheAndMarkForLayout(reason); + if (LayoutObject* object = GetLayoutObject()) + object->SetNeedsLayoutAndFullPaintInvalidation( + LayoutInvalidationReason::kChildChanged); } LayoutObject* SVGPatternElement::CreateLayoutObject(const ComputedStyle&) {
diff --git a/third_party/blink/renderer/core/svg/svg_pattern_element.h b/third_party/blink/renderer/core/svg/svg_pattern_element.h index e5a6c56f..c54bc19b 100644 --- a/third_party/blink/renderer/core/svg/svg_pattern_element.h +++ b/third_party/blink/renderer/core/svg/svg_pattern_element.h
@@ -21,7 +21,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_PATTERN_ELEMENT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_PATTERN_ELEMENT_H_ -#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/svg/svg_animated_enumeration.h" #include "third_party/blink/renderer/core/svg/svg_animated_length.h" #include "third_party/blink/renderer/core/svg/svg_animated_transform_list.h" @@ -34,7 +33,6 @@ namespace blink { -class SVGResource; class PatternAttributes; class SVGPatternElement final : public SVGElement, @@ -76,10 +74,6 @@ return pattern_content_units_.Get(); } - void InvalidatePattern(LayoutInvalidationReasonForTracing); - - const SVGPatternElement* ReferencedElement() const; - void Trace(blink::Visitor*) override; private: @@ -93,12 +87,9 @@ MutableCSSPropertyValueSet*) override; void SvgAttributeChanged(const QualifiedName&) override; - InsertionNotificationRequest InsertedInto(ContainerNode*) final; - void RemovedFrom(ContainerNode*) final; void ChildrenChanged(const ChildrenChange&) override; - void BuildPendingResource() override; - void ClearResourceReferences(); + const SVGPatternElement* ReferencedElement() const; LayoutObject* CreateLayoutObject(const ComputedStyle&) override; @@ -112,7 +103,6 @@ Member<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>> pattern_units_; Member<SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>> pattern_content_units_; - Member<SVGResource> resource_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/svg/svg_resource.cc b/third_party/blink/renderer/core/svg/svg_resource.cc index a32e85d2..cd35c37 100644 --- a/third_party/blink/renderer/core/svg/svg_resource.cc +++ b/third_party/blink/renderer/core/svg/svg_resource.cc
@@ -9,9 +9,11 @@ #include "third_party/blink/renderer/core/dom/id_target_observer.h" #include "third_party/blink/renderer/core/dom/tree_scope.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_container.h" +#include "third_party/blink/renderer/core/layout/svg/svg_resources.h" +#include "third_party/blink/renderer/core/layout/svg/svg_resources_cache.h" #include "third_party/blink/renderer/core/loader/resource/document_resource.h" +#include "third_party/blink/renderer/core/svg/svg_element.h" #include "third_party/blink/renderer/core/svg/svg_resource_client.h" -#include "third_party/blink/renderer/core/svg/svg_tree_scope_resources.h" #include "third_party/blink/renderer/core/svg/svg_uri_reference.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h" @@ -31,17 +33,10 @@ void SVGResource::AddClient(SVGResourceClient& client) { clients_.insert(&client); - if (LayoutSVGResourceContainer* container = ResourceContainer()) - container->ClearInvalidationMask(); } void SVGResource::RemoveClient(SVGResourceClient& client) { - if (!clients_.erase(&client)) - return; - // The last instance of |client| was removed. Clear its entry in - // resource's cache. - if (LayoutSVGResourceContainer* container = ResourceContainer()) - container->RemoveClientFromCache(client); + clients_.erase(&client); } void SVGResource::NotifyElementChanged() { @@ -70,17 +65,33 @@ WrapWeakPersistent(this), id)); } +void LocalSVGResource::AddWatch(SVGElement& element) { + pending_clients_.insert(&element); + element.SetHasPendingResources(); +} + +void LocalSVGResource::RemoveWatch(SVGElement& element) { + pending_clients_.erase(&element); +} + +bool LocalSVGResource::IsEmpty() const { + LayoutSVGResourceContainer* container = ResourceContainer(); + return !HasClients() && (!container || !container->HasClients()) && + pending_clients_.IsEmpty(); +} + void LocalSVGResource::Unregister() { SVGURIReference::UnobserveTarget(id_observer_); } -void LocalSVGResource::RemoveClient(SVGResourceClient& client) { - SVGResource::RemoveClient(client); - if (HasClients()) - return; - Unregister(); - auto& tree_scope_resources = tree_scope_->EnsureSVGTreeScopedResources(); - tree_scope_resources.UnregisterResource(this); +void LocalSVGResource::NotifyPendingClients() { + HeapHashSet<Member<SVGElement>> pending_clients; + pending_clients.swap(pending_clients_); + + for (SVGElement* client_element : pending_clients) { + if (LayoutObject* layout_object = client_element->GetLayoutObject()) + SVGResourcesCache::ResourceReferenceChanged(*layout_object); + } } void LocalSVGResource::NotifyContentChanged( @@ -92,42 +103,23 @@ client->ResourceContentChanged(invalidation_mask); } -void LocalSVGResource::NotifyResourceAttached( - LayoutSVGResourceContainer& attached_resource) { - // Checking the element here because - if (attached_resource.GetElement() != Target()) - return; - NotifyElementChanged(); -} - -void LocalSVGResource::NotifyResourceDestroyed( - LayoutSVGResourceContainer& destroyed_resource) { - if (destroyed_resource.GetElement() != Target()) - return; - destroyed_resource.RemoveAllClientsFromCache(); - - HeapVector<Member<SVGResourceClient>> clients; - CopyToVector(clients_, clients); - - for (SVGResourceClient* client : clients) - client->ResourceDestroyed(&destroyed_resource); -} - void LocalSVGResource::TargetChanged(const AtomicString& id) { Element* new_target = tree_scope_->getElementById(id); if (new_target == target_) return; - // Clear out caches on the old resource, and then notify clients about the - // change. + // Detach clients from the old resource, moving them to the pending list + // and then notify pending clients. if (LayoutSVGResourceContainer* old_resource = ResourceContainer()) - old_resource->RemoveAllClientsFromCache(); + old_resource->MakeClientsPending(*this); target_ = new_target; NotifyElementChanged(); + NotifyPendingClients(); } void LocalSVGResource::Trace(Visitor* visitor) { visitor->Trace(tree_scope_); visitor->Trace(id_observer_); + visitor->Trace(pending_clients_); SVGResource::Trace(visitor); } @@ -164,9 +156,8 @@ Document* external_document = resource_document_->GetDocument(); if (!external_document) return nullptr; - AtomicString decoded_fragment( - DecodeURLEscapeSequences(url_.FragmentIdentifier())); - return external_document->getElementById(decoded_fragment); + return external_document->getElementById( + AtomicString(url_.FragmentIdentifier())); } void ExternalSVGResource::Trace(Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/svg/svg_resource.h b/third_party/blink/renderer/core/svg/svg_resource.h index 3a50f8b..9291e96 100644 --- a/third_party/blink/renderer/core/svg/svg_resource.h +++ b/third_party/blink/renderer/core/svg/svg_resource.h
@@ -21,6 +21,7 @@ class Element; class IdTargetObserver; class LayoutSVGResourceContainer; +class SVGElement; class TreeScope; // A class tracking a reference to an SVG resource (an element that constitutes @@ -69,7 +70,7 @@ LayoutSVGResourceContainer* ResourceContainer() const; void AddClient(SVGResourceClient&); - virtual void RemoveClient(SVGResourceClient&); + void RemoveClient(SVGResourceClient&); bool HasClients() const { return !clients_.IsEmpty(); } @@ -92,22 +93,24 @@ public: LocalSVGResource(TreeScope&, const AtomicString& id); + void AddWatch(SVGElement&); + void RemoveWatch(SVGElement&); + void Unregister(); - void NotifyContentChanged(InvalidationModeMask); + bool IsEmpty() const; - void NotifyResourceAttached(LayoutSVGResourceContainer&); - void NotifyResourceDestroyed(LayoutSVGResourceContainer&); + void NotifyPendingClients(); + void NotifyContentChanged(InvalidationModeMask); void Trace(Visitor*) override; private: void TargetChanged(const AtomicString& id); - void RemoveClient(SVGResourceClient&) override; - Member<TreeScope> tree_scope_; Member<IdTargetObserver> id_observer_; + HeapHashSet<Member<SVGElement>> pending_clients_; }; // External resource reference (see SVGResource.)
diff --git a/third_party/blink/renderer/core/svg/svg_resource_client.h b/third_party/blink/renderer/core/svg/svg_resource_client.h index 687b14c..b937249 100644 --- a/third_party/blink/renderer/core/svg/svg_resource_client.h +++ b/third_party/blink/renderer/core/svg/svg_resource_client.h
@@ -10,8 +10,6 @@ namespace blink { -class LayoutSVGResourceContainer; - typedef unsigned InvalidationModeMask; class CORE_EXPORT SVGResourceClient : public GarbageCollectedMixin { @@ -27,9 +25,7 @@ kParentOnlyInvalidation = 1 << 3 }; virtual void ResourceContentChanged(InvalidationModeMask) = 0; - virtual void Invalidate(InvalidationModeMask) {} virtual void ResourceElementChanged() = 0; - virtual void ResourceDestroyed(LayoutSVGResourceContainer*) {} protected: SVGResourceClient() = default;
diff --git a/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc b/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc index 7abf996..a5a416343 100644 --- a/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc +++ b/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc
@@ -33,13 +33,39 @@ return resources_.at(id); } -void SVGTreeScopeResources::UnregisterResource(LocalSVGResource* resource) { +void SVGTreeScopeResources::RemoveUnreferencedResources() { + if (resources_.IsEmpty()) + return; + // Remove resources that are no longer referenced. + Vector<AtomicString> to_be_removed; for (const auto& entry : resources_) { - if (resource == entry.value) { - resources_.erase(entry.key); - return; + LocalSVGResource* resource = entry.value.Get(); + DCHECK(resource); + if (resource->IsEmpty()) { + resource->Unregister(); + to_be_removed.push_back(entry.key); } } + resources_.RemoveAll(to_be_removed); +} + +void SVGTreeScopeResources::RemoveWatchesForElement(SVGElement& element) { + if (resources_.IsEmpty() || !element.HasPendingResources()) + return; + // Remove the element from pending resources. + Vector<AtomicString> to_be_removed; + for (const auto& entry : resources_) { + LocalSVGResource* resource = entry.value.Get(); + DCHECK(resource); + resource->RemoveWatch(element); + if (resource->IsEmpty()) { + resource->Unregister(); + to_be_removed.push_back(entry.key); + } + } + resources_.RemoveAll(to_be_removed); + + element.ClearHasPendingResources(); } void SVGTreeScopeResources::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/svg/svg_tree_scope_resources.h b/third_party/blink/renderer/core/svg/svg_tree_scope_resources.h index e4da86e..817ce42 100644 --- a/third_party/blink/renderer/core/svg/svg_tree_scope_resources.h +++ b/third_party/blink/renderer/core/svg/svg_tree_scope_resources.h
@@ -13,6 +13,7 @@ namespace blink { class LocalSVGResource; +class SVGElement; class TreeScope; // This class keeps track of SVG resources and pending references to such for a @@ -27,7 +28,8 @@ LocalSVGResource* ResourceForId(const AtomicString& id); LocalSVGResource* ExistingResourceForId(const AtomicString& id) const; - void UnregisterResource(LocalSVGResource*); + void RemoveUnreferencedResources(); + void RemoveWatchesForElement(SVGElement&); void Trace(blink::Visitor*);
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc index eb7120db..907e0d38 100644 --- a/third_party/blink/renderer/core/testing/internals.cc +++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -2484,15 +2484,6 @@ media_element->DisconnectedFromRemoteDevice(); } -void Internals::setMediaElementNetworkState(HTMLMediaElement* media_element, - int state) { - DCHECK(media_element); - DCHECK(state >= WebMediaPlayer::NetworkState::kNetworkStateEmpty); - DCHECK(state <= WebMediaPlayer::NetworkState::kNetworkStateDecodeError); - media_element->SetNetworkState( - static_cast<WebMediaPlayer::NetworkState>(state)); -} - void Internals::setPersistent(HTMLVideoElement* video_element, bool persistent) { DCHECK(video_element);
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h index 204f5b39..2b23452 100644 --- a/third_party/blink/renderer/core/testing/internals.h +++ b/third_party/blink/renderer/core/testing/internals.h
@@ -390,7 +390,6 @@ String effectivePreload(HTMLMediaElement*); void mediaPlayerRemoteRouteAvailabilityChanged(HTMLMediaElement*, bool); void mediaPlayerPlayingRemotelyChanged(HTMLMediaElement*, bool); - void setMediaElementNetworkState(HTMLMediaElement*, int state); void setPersistent(HTMLVideoElement*, bool); void forceStaleStateForMediaElement(HTMLMediaElement*, int target_state); bool isMediaElementSuspended(HTMLMediaElement*);
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl index ef90d2b0..e30ae7df 100644 --- a/third_party/blink/renderer/core/testing/internals.idl +++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -236,7 +236,6 @@ DOMString effectivePreload(HTMLMediaElement mediaElement); void mediaPlayerRemoteRouteAvailabilityChanged(HTMLMediaElement mediaElement, boolean available); void mediaPlayerPlayingRemotelyChanged(HTMLMediaElement mediaElement, boolean remote); - void setMediaElementNetworkState(HTMLMediaElement element, long state); void setPersistent(HTMLVideoElement video, boolean persistent); void forceStaleStateForMediaElement(HTMLMediaElement mediaElement, long state); boolean isMediaElementSuspended(HTMLMediaElement mediaElement);
diff --git a/third_party/blink/renderer/core/timing/performance_resource_timing.idl b/third_party/blink/renderer/core/timing/performance_resource_timing.idl index a624dc4b..59386eb4 100644 --- a/third_party/blink/renderer/core/timing/performance_resource_timing.idl +++ b/third_party/blink/renderer/core/timing/performance_resource_timing.idl
@@ -32,7 +32,7 @@ [Exposed=(Window,Worker)] interface PerformanceResourceTiming : PerformanceEntry { - readonly attribute DOMString initiatorType; + [MeasureAs=PerformanceResourceTimingInitiatorType] readonly attribute DOMString initiatorType; readonly attribute DOMString nextHopProtocol; readonly attribute DOMHighResTimeStamp workerStart; readonly attribute DOMHighResTimeStamp redirectStart;
diff --git a/third_party/blink/renderer/core/workers/worker_animation_frame_provider.cc b/third_party/blink/renderer/core/workers/worker_animation_frame_provider.cc index 29f90197..ea583f23 100644 --- a/third_party/blink/renderer/core/workers/worker_animation_frame_provider.cc +++ b/third_party/blink/renderer/core/workers/worker_animation_frame_provider.cc
@@ -28,7 +28,10 @@ } void WorkerAnimationFrameProvider::BeginFrame() { - double time = WTF::TimeTicksInSeconds(WTF::CurrentTimeTicks()) * 1000; + double time = WTF::CurrentTimeTicksInMilliseconds(); + // We don't want to expose microseconds residues to users. + time = round(time * 60) / 60; + callback_collection_.ExecuteCallbacks(time, time); for (auto& ctx : rendering_contexts_) {
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 70c10f355..441adb24 100644 --- a/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeElement.js +++ b/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeElement.js
@@ -287,7 +287,6 @@ * @override */ onpopulate() { - this.populated = true; this.treeOutline.populateTreeElement(this); }
diff --git a/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeOutline.js b/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeOutline.js index cc0bd898..cef69395 100644 --- a/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeOutline.js +++ b/third_party/blink/renderer/devtools/front_end/elements/ElementsTreeOutline.js
@@ -1154,7 +1154,10 @@ populateTreeElement(treeElement) { if (treeElement.childCount() || !treeElement.isExpandable()) return; - treeElement.node().getChildNodes(() => this._updateModifiedParentNode(treeElement.node())); + treeElement.node().getChildNodes(() => { + treeElement.populated = true; + this._updateModifiedParentNode(treeElement.node()); + }); } /**
diff --git a/third_party/blink/renderer/devtools/front_end/mobile_throttling/NetworkPanelIndicator.js b/third_party/blink/renderer/devtools/front_end/mobile_throttling/NetworkPanelIndicator.js index a3de20b..34654cc2 100644 --- a/third_party/blink/renderer/devtools/front_end/mobile_throttling/NetworkPanelIndicator.js +++ b/third_party/blink/renderer/devtools/front_end/mobile_throttling/NetworkPanelIndicator.js
@@ -20,7 +20,7 @@ icon.title = Common.UIString('Network throttling is enabled'); } else if (SDK.multitargetNetworkManager.isIntercepting()) { icon = UI.Icon.create('smallicon-warning'); - icon.title = Common.UIString('Requests may be rewritten'); + icon.title = Common.UIString('Requests may be rewritten by local overrides'); } else if (manager.isBlocking()) { icon = UI.Icon.create('smallicon-warning'); icon.title = Common.UIString('Requests may be blocked');
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js b/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js index 0fa61be..7cec14d4 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js
@@ -402,6 +402,41 @@ /** * @override * @param {!Protocol.Network.RequestId} requestId + * @param {!Protocol.Network.SignedExchangeInfo} info + */ + signedExchangeReceived(requestId, info) { + // While loading a signed exchange, a signedExchangeReceived event is sent + // between two requestWillBeSent events. + // 1. The first requestWillBeSent is sent while starting the navigation (or + // prefetching). + // 2. This signedExchangeReceived event is sent when the browser detects the + // signed exchange. + // 3. The second requestWillBeSent is sent with the generated redirect + // response and a new redirected request which URL is the inner request + // URL of the signed exchange. + let networkRequest = this._inflightRequestsById[requestId]; + // |requestId| is available only for navigation requests. If the request was + // sent from a renderer process for prefetching, it is not available. In the + // case, need to fallback to look for the URL. + // TODO(crbug/841076): Sends the request ID of prefetching to the browser + // process and DevTools to find the matching request. + if (!networkRequest) { + networkRequest = this._inflightRequestsByURL[info.outerResponse.url]; + if (!networkRequest) + return; + } + networkRequest.setSignedExchangeInfo(info); + // TODO(crbug/830505): Introduce a new resource type for Signed Exchange. + networkRequest.setResourceType(Common.resourceTypes.Other); + + this._updateNetworkRequestWithResponse(networkRequest, info.outerResponse); + this._updateNetworkRequest(networkRequest); + this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.ResponseReceived, networkRequest); + } + + /** + * @override + * @param {!Protocol.Network.RequestId} requestId * @param {!Protocol.Network.LoaderId} loaderId * @param {string} documentURL * @param {!Protocol.Network.Request} request @@ -419,7 +454,12 @@ // FIXME: move this check to the backend. if (!redirectResponse) return; - this.responseReceived(requestId, loaderId, time, Protocol.Page.ResourceType.Other, redirectResponse, frameId); + // If signedExchangeReceived event has already been sent for the request, + // ignores the internally generated |redirectResponse|. The + // |outerResponse| of SignedExchangeInfo was set to |networkRequest| in + // signedExchangeReceived(). + if (!networkRequest.signedExchangeInfo()) + this.responseReceived(requestId, loaderId, time, Protocol.Page.ResourceType.Other, redirectResponse, frameId); networkRequest = this._appendRedirect(requestId, time, request.url); this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestRedirected, networkRequest); } else {
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js b/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js index 0e07b1e..0f07391c 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js
@@ -72,6 +72,9 @@ /** @type {?Protocol.Network.ResourcePriority} */ this._currentPriority = null; + /** @type {?Protocol.Network.SignedExchangeInfo} */ + this._signedExchangeInfo = null; + /** @type {!Common.ResourceType} */ this._resourceType = Common.resourceTypes.Other; /** @type {?Promise<!SDK.NetworkRequest.ContentData>} */ @@ -1023,6 +1026,20 @@ } /** + * @param {!Protocol.Network.SignedExchangeInfo} info + */ + setSignedExchangeInfo(info) { + this._signedExchangeInfo = info; + } + + /** + * @return {?Protocol.Network.SignedExchangeInfo} + */ + signedExchangeInfo() { + return this._signedExchangeInfo; + } + + /** * @param {!Element} image */ populateImageSource(image) {
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 7b1bfcb..b52c2b5 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
@@ -593,8 +593,8 @@ void CanvasRenderingContext2D::UpdateFilterReferences( const FilterOperations& filters) { - filters.AddClient(*this); ClearFilterReferences(); + filters.AddClient(*this); filter_operations_ = filters; }
diff --git a/third_party/blink/renderer/modules/modules_idl_files.gni b/third_party/blink/renderer/modules/modules_idl_files.gni index cecacde..20b035e 100644 --- a/third_party/blink/renderer/modules/modules_idl_files.gni +++ b/third_party/blink/renderer/modules/modules_idl_files.gni
@@ -754,6 +754,7 @@ "webmidi/navigator_web_midi.idl", "webshare/navigator_share.idl", "webusb/navigator_usb.idl", + "webusb/worker_navigator_usb.idl", ], "abspath")
diff --git a/third_party/blink/renderer/modules/webusb/BUILD.gn b/third_party/blink/renderer/modules/webusb/BUILD.gn index 74d09c7f..5f8e5b1 100644 --- a/third_party/blink/renderer/modules/webusb/BUILD.gn +++ b/third_party/blink/renderer/modules/webusb/BUILD.gn
@@ -28,6 +28,8 @@ "usb_isochronous_out_transfer_packet.h", "usb_isochronous_out_transfer_result.h", "usb_out_transfer_result.h", + "worker_navigator_usb.cc", + "worker_navigator_usb.h", ] deps = [
diff --git a/third_party/blink/renderer/modules/webusb/navigator_usb.cc b/third_party/blink/renderer/modules/webusb/navigator_usb.cc index ee0b624..f6731d7 100644 --- a/third_party/blink/renderer/modules/webusb/navigator_usb.cc +++ b/third_party/blink/renderer/modules/webusb/navigator_usb.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/modules/webusb/navigator_usb.h" +#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/navigator.h" #include "third_party/blink/renderer/modules/webusb/usb.h" @@ -33,8 +34,10 @@ } NavigatorUSB::NavigatorUSB(Navigator& navigator) { - if (navigator.GetFrame()) - usb_ = USB::Create(*navigator.GetFrame()); + if (navigator.GetFrame()) { + DCHECK(navigator.GetFrame()->GetDocument()); + usb_ = USB::Create(*navigator.GetFrame()->GetDocument()); + } } const char NavigatorUSB::kSupplementName[] = "NavigatorUSB";
diff --git a/third_party/blink/renderer/modules/webusb/usb.cc b/third_party/blink/renderer/modules/webusb/usb.cc index 2b2e4c6..5b9d886f 100644 --- a/third_party/blink/renderer/modules/webusb/usb.cc +++ b/third_party/blink/renderer/modules/webusb/usb.cc
@@ -58,8 +58,8 @@ } // namespace -USB::USB(LocalFrame& frame) - : ContextLifecycleObserver(frame.GetDocument()), client_binding_(this) {} +USB::USB(ExecutionContext& context) + : ContextLifecycleObserver(&context), client_binding_(this) {} USB::~USB() { // |m_deviceManager| and |m_chooserService| may still be valid but there
diff --git a/third_party/blink/renderer/modules/webusb/usb.h b/third_party/blink/renderer/modules/webusb/usb.h index 6244076b..bc0c2193 100644 --- a/third_party/blink/renderer/modules/webusb/usb.h +++ b/third_party/blink/renderer/modules/webusb/usb.h
@@ -11,12 +11,12 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/core/dom/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { -class LocalFrame; class ScriptPromiseResolver; class ScriptState; class USBDevice; @@ -30,7 +30,7 @@ USING_PRE_FINALIZER(USB, Dispose); public: - static USB* Create(LocalFrame& frame) { return new USB(frame); } + static USB* Create(ExecutionContext& context) { return new USB(context); } ~USB() override; @@ -75,7 +75,7 @@ RegisteredEventListener&) override; private: - explicit USB(LocalFrame& frame); + explicit USB(ExecutionContext&); void EnsureDeviceManagerConnection();
diff --git a/third_party/blink/renderer/modules/webusb/worker_navigator_usb.cc b/third_party/blink/renderer/modules/webusb/worker_navigator_usb.cc new file mode 100644 index 0000000..fa1fbfd4 --- /dev/null +++ b/third_party/blink/renderer/modules/webusb/worker_navigator_usb.cc
@@ -0,0 +1,53 @@ +// 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 "third_party/blink/renderer/modules/webusb/worker_navigator_usb.h" + +#include "third_party/blink/renderer/core/workers/worker_navigator.h" +#include "third_party/blink/renderer/modules/webusb/usb.h" + +namespace blink { + +WorkerNavigatorUSB& WorkerNavigatorUSB::From( + WorkerNavigator& worker_navigator) { + WorkerNavigatorUSB* supplement = + Supplement<WorkerNavigator>::From<WorkerNavigatorUSB>(worker_navigator); + if (!supplement) { + supplement = new WorkerNavigatorUSB(worker_navigator); + ProvideTo(worker_navigator, supplement); + } + return *supplement; +} + +USB* WorkerNavigatorUSB::usb(ScriptState* script_state, + WorkerNavigator& worker_navigator) { + return WorkerNavigatorUSB::From(worker_navigator).usb(script_state); +} + +USB* WorkerNavigatorUSB::usb(ScriptState* script_state) { + // A bug in the WebIDL compiler causes this attribute to be exposed to the + // WorkerNavigator interface in the ServiceWorkerGlobalScope, therefore we + // will just return the empty usb_ member if the current context is a + // ServiceWorkerGlobalScope. + // TODO(https://crbug.com/839117): Once this attribute stops being exposed to + // the WorkerNavigator for a Service worker, remove this check. + if (!usb_ && + !ExecutionContext::From(script_state)->IsServiceWorkerGlobalScope()) { + DCHECK(ExecutionContext::From(script_state)); + usb_ = USB::Create(*ExecutionContext::From(script_state)); + } + return usb_; +} + +void WorkerNavigatorUSB::Trace(blink::Visitor* visitor) { + visitor->Trace(usb_); + Supplement<WorkerNavigator>::Trace(visitor); +} + +WorkerNavigatorUSB::WorkerNavigatorUSB(WorkerNavigator& worker_navigator) + : Supplement<WorkerNavigator>(worker_navigator) {} + +const char WorkerNavigatorUSB::kSupplementName[] = "WorkerNavigatorUSB"; + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/webusb/worker_navigator_usb.h b/third_party/blink/renderer/modules/webusb/worker_navigator_usb.h new file mode 100644 index 0000000..613829e0 --- /dev/null +++ b/third_party/blink/renderer/modules/webusb/worker_navigator_usb.h
@@ -0,0 +1,42 @@ +// 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 THIRD_PARTY_BLINK_RENDERER_MODULES_WEBUSB_WORKER_NAVIGATOR_USB_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBUSB_WORKER_NAVIGATOR_USB_H_ + +#include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/workers/worker_navigator.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/supplementable.h" + +namespace blink { + +class USB; +class WorkerNavigator; + +class WorkerNavigatorUSB final : public GarbageCollected<WorkerNavigatorUSB>, + public Supplement<WorkerNavigator> { + USING_GARBAGE_COLLECTED_MIXIN(WorkerNavigatorUSB); + + public: + static const char kSupplementName[]; + + // Gets, or creates, WorkerNavigatorUSB supplement on WorkerNavigator. + // See platform/Supplementable.h + static WorkerNavigatorUSB& From(WorkerNavigator&); + + static USB* usb(ScriptState*, WorkerNavigator&); + USB* usb(ScriptState*); + + void Trace(blink::Visitor*) override; + + private: + explicit WorkerNavigatorUSB(WorkerNavigator&); + + Member<USB> usb_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBUSB_WORKER_NAVIGATOR_USB_H_
diff --git a/third_party/blink/renderer/modules/webusb/worker_navigator_usb.idl b/third_party/blink/renderer/modules/webusb/worker_navigator_usb.idl new file mode 100644 index 0000000..f96d649 --- /dev/null +++ b/third_party/blink/renderer/modules/webusb/worker_navigator_usb.idl
@@ -0,0 +1,13 @@ +// 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. + +// https://wicg.github.io/webusb/#enumeration + +[ + Exposed=(DedicatedWorker,SharedWorker), + ImplementedAs=WorkerNavigatorUSB, + SecureContext +] partial interface WorkerNavigator { + [CallWith=ScriptState, SameObject, RuntimeEnabled=WebUSBOnDedicatedAndSharedWorkers] readonly attribute USB usb; +};
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index bf9ad5b..8c6bc64e 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1320,6 +1320,8 @@ "scroll/scrollable_area.h", "scroll/scrollbar.cc", "scroll/scrollbar.h", + "scroll/scrollbar_layer_delegate.cc", + "scroll/scrollbar_layer_delegate.h", "scroll/scrollbar_theme.cc", "scroll/scrollbar_theme.h", "scroll/scrollbar_theme_android.cc",
diff --git a/third_party/blink/renderer/platform/bindings/callback_interface_base.h b/third_party/blink/renderer/platform/bindings/callback_interface_base.h index 69714d7c..b3a5d23 100644 --- a/third_party/blink/renderer/platform/bindings/callback_interface_base.h +++ b/third_party/blink/renderer/platform/bindings/callback_interface_base.h
@@ -49,6 +49,12 @@ return callback_relevant_script_state_.get(); } + // NodeIteratorBase counts the invocation of those which are callable and + // those which are not. + bool IsCallbackObjectCallableForNodeIteratorBase() const { + return IsCallbackObjectCallable(); + } + protected: CallbackInterfaceBase(v8::Local<v8::Object> callback_object, SingleOperationOrNot); @@ -75,6 +81,10 @@ scoped_refptr<ScriptState> incumbent_script_state_; friend class V8PersistentCallbackInterfaceBase; + // ToV8 needs to call |CallbackObject| member function. + friend v8::Local<v8::Value> ToV8(CallbackInterfaceBase* callback, + v8::Local<v8::Object> creation_context, + v8::Isolate*); }; // V8PersistentCallbackInterfaceBase retains the underlying v8::Object of a
diff --git a/third_party/blink/renderer/platform/bindings/to_v8.h b/third_party/blink/renderer/platform/bindings/to_v8.h index b92e6dca..e0a9e26 100644 --- a/third_party/blink/renderer/platform/bindings/to_v8.h +++ b/third_party/blink/renderer/platform/bindings/to_v8.h
@@ -11,6 +11,7 @@ #include <utility> #include "base/optional.h" +#include "third_party/blink/renderer/platform/bindings/callback_interface_base.h" #include "third_party/blink/renderer/platform/bindings/dom_data_store.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" @@ -37,6 +38,20 @@ return wrapper; } +// Callback interface + +inline v8::Local<v8::Value> ToV8(CallbackInterfaceBase* callback, + v8::Local<v8::Object> creation_context, + v8::Isolate* isolate) { + // |creation_context| is intentionally ignored. Callback interface objects + // are not wrappers nor clonable. ToV8 on a callback interface object must + // be used only when it's the same origin-domain in the same world. + DCHECK(!callback || (callback->CallbackRelevantScriptState()->GetContext() == + creation_context->CreationContext())); + return callback ? callback->CallbackObject().As<v8::Value>() + : v8::Null(isolate).As<v8::Value>(); +} + // Primitives inline v8::Local<v8::Value> ToV8(const String& value,
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.cc b/third_party/blink/renderer/platform/graphics/canvas_resource.cc index 4418eacb..e1a5a8d2 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource.cc
@@ -8,6 +8,7 @@ #include "components/viz/common/resources/transferable_resource.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" +#include "gpu/command_buffer/common/gpu_memory_buffer_support.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" @@ -204,7 +205,7 @@ gpu_memory_buffer_->SetColorSpace(color_params.GetStorageGfxColorSpace()); gl->GenTextures(1, &texture_id_); - const GLenum target = GL_TEXTURE_RECTANGLE_ARB; + const GLenum target = TextureTarget(); gl->BindTexture(target, texture_id_); gl->BindTexImage2DCHROMIUM(target, image_id_); } @@ -214,7 +215,7 @@ } GLenum CanvasResourceGpuMemoryBuffer::TextureTarget() const { - return GL_TEXTURE_RECTANGLE_ARB; + return gpu::GetPlatformSpecificTextureTarget(); } IntSize CanvasResourceGpuMemoryBuffer::Size() const {
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc index a082753d..ed78ed60 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_test.cc
@@ -6,6 +6,7 @@ #include "base/run_loop.h" #include "components/viz/test/test_gpu_memory_buffer_manager.h" +#include "gpu/command_buffer/common/gpu_memory_buffer_support.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" @@ -31,6 +32,7 @@ MOCK_METHOD1(GenUnverifiedSyncTokenCHROMIUM, void(GLbyte*)); MOCK_METHOD4(CreateImageCHROMIUM, GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); + MOCK_METHOD2(BindTexture, void(GLenum, GLuint)); }; class FakeCanvasResourcePlatformSupport : public TestingPlatformSupport { @@ -80,6 +82,7 @@ } TEST_F(CanvasResourceTest, SkiaResourceNoMailboxLeak) { + testing::InSequence s; SkImageInfo image_info = SkImageInfo::MakeN32(10, 10, kPremul_SkAlphaType, nullptr); sk_sp<SkSurface> surface = @@ -100,6 +103,9 @@ EXPECT_CALL(gl_, GenMailboxCHROMIUM(_)) .WillOnce(SetArrayArgument<0>( test_mailbox.name, test_mailbox.name + GL_MAILBOX_SIZE_CHROMIUM)); + EXPECT_CALL(gl_, BindTexture(GL_TEXTURE_2D, _)).Times(2); + EXPECT_CALL(gl_, ProduceTextureDirectCHROMIUM(_, _)); + EXPECT_CALL(gl_, GenUnverifiedSyncTokenCHROMIUM(_)); resource->GetOrCreateGpuMailbox(); testing::Mock::VerifyAndClearExpectations(&gl_); @@ -124,10 +130,12 @@ } TEST_F(CanvasResourceTest, GpuMemoryBufferSyncTokenRefresh) { + testing::InSequence s; ScopedTestingPlatformSupport<FakeCanvasResourcePlatformSupport> platform; constexpr GLuint image_id = 1; EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id)); + EXPECT_CALL(gl_, BindTexture(gpu::GetPlatformSpecificTextureTarget(), _)); scoped_refptr<CanvasResource> resource = CanvasResourceGpuMemoryBuffer::Create( IntSize(10, 10), CanvasColorParams(), @@ -144,6 +152,7 @@ EXPECT_CALL(gl_, GenMailboxCHROMIUM(_)) .WillOnce(SetArrayArgument<0>( test_mailbox.name, test_mailbox.name + GL_MAILBOX_SIZE_CHROMIUM)); + EXPECT_CALL(gl_, ProduceTextureDirectCHROMIUM(_, _)); resource->GetOrCreateGpuMailbox(); testing::Mock::VerifyAndClearExpectations(&gl_);
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/third_party/blink/renderer/platform/graphics/graphics_layer.cc index 767575c..40b2ba3 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -33,6 +33,7 @@ #include "base/memory/ptr_util.h" #include "base/trace_event/trace_event_argument.h" #include "cc/layers/layer.h" +#include "cc/layers/picture_layer.h" #include "cc/paint/display_item_list.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_compositor_support.h" @@ -113,15 +114,17 @@ #if DCHECK_IS_ON() client.VerifyNotPainting(); #endif - layer_ = Platform::Current()->CompositorSupport()->CreateContentLayer(this); - layer_->Layer()->SetDrawsContent(draws_content_ && contents_visible_); - layer_->Layer()->SetLayerClient(weak_ptr_factory_.GetWeakPtr()); + layer_ = cc::PictureLayer::Create(this); + web_layer_ = Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer( + layer_.get()); + layer_->SetIsDrawable(draws_content_ && contents_visible_); + layer_->SetLayerClient(weak_ptr_factory_.GetWeakPtr()); UpdateTrackingRasterInvalidations(); } GraphicsLayer::~GraphicsLayer() { - layer_->Layer()->SetLayerClient(nullptr); + layer_->SetLayerClient(nullptr); SetContentsLayer(nullptr); for (size_t i = 0; i < link_highlights_.size(); ++i) link_highlights_[i]->ClearCurrentGraphicsLayer(); @@ -149,17 +152,17 @@ void GraphicsLayer::SetHasWillChangeTransformHint( bool has_will_change_transform) { - layer_->Layer()->SetHasWillChangeTransformHint(has_will_change_transform); + layer_->SetHasWillChangeTransformHint(has_will_change_transform); } void GraphicsLayer::SetOverscrollBehavior( const cc::OverscrollBehavior& behavior) { - layer_->Layer()->SetOverscrollBehavior(behavior); + layer_->SetOverscrollBehavior(behavior); } void GraphicsLayer::SetSnapContainerData( base::Optional<SnapContainerData> data) { - layer_->Layer()->SetSnapContainerData(std::move(data)); + layer_->SetSnapContainerData(std::move(data)); } void GraphicsLayer::SetIsResizedByBrowserControls( @@ -371,7 +374,7 @@ *this, std::move(record), layer_state_ ? &layer_state_->state : nullptr); // Ensure the compositor will raster the under-invalidation overlay. - layer_->Layer()->Invalidate(); + layer_->SetNeedsDisplay(); } } @@ -418,7 +421,7 @@ } void GraphicsLayer::UpdateChildList() { - WebLayer* child_host = layer_->Layer(); + WebLayer* child_host = web_layer_.get(); child_host->RemoveAllChildren(); ClearContentsLayerIfUnregistered(); @@ -445,12 +448,12 @@ // shouldn't receive the drawsContent flag, so it is only given // contentsVisible. - layer_->Layer()->SetDrawsContent(draws_content_ && contents_visible_); + layer_->SetIsDrawable(draws_content_ && contents_visible_); if (WebLayer* contents_layer = ContentsLayerIfRegistered()) contents_layer->SetDrawsContent(contents_visible_); if (draws_content_) { - layer_->Layer()->Invalidate(); + layer_->SetNeedsDisplay(); for (size_t i = 0; i < link_highlights_.size(); ++i) link_highlights_[i]->Invalidate(); } @@ -533,7 +536,7 @@ // Insert the content layer first. Video elements require this, because they // have shadow content that must display in front of the video. - layer_->Layer()->InsertChild(contents_layer_, 0); + layer_->InsertChild(contents_layer_->CcLayer(), 0); WebLayer* border_web_layer = contents_clipping_mask_layer_ ? contents_clipping_mask_layer_->PlatformLayer() @@ -970,7 +973,7 @@ } } - if (layer == CcLayerForWebLayer(layer_->Layer())) + if (layer == layer_.get()) return client_.DebugName(this); NOTREACHED(); @@ -1012,7 +1015,7 @@ // Invalidate the layer as a DisplayItemClient. SetDisplayItemsUncached(); - layer_->Layer()->SetBounds(static_cast<gfx::Size>(FlooredIntSize(size_))); + layer_->SetBounds(static_cast<gfx::Size>(FlooredIntSize(size_))); // Note that we don't resize m_contentsLayer. It's up the caller to do that. } @@ -1033,7 +1036,7 @@ should_flatten_transform_ = should_flatten; - layer_->Layer()->SetShouldFlattenTransform(should_flatten); + layer_->SetShouldFlattenTransform(should_flatten); } void GraphicsLayer::SetRenderingContext(int context) { @@ -1041,18 +1044,18 @@ return; rendering_context3d_ = context; - layer_->Layer()->SetRenderingContext(context); + layer_->Set3dSortingContextId(context); if (contents_layer_) contents_layer_->SetRenderingContext(rendering_context3d_); } bool GraphicsLayer::MasksToBounds() const { - return layer_->Layer()->MasksToBounds(); + return layer_->masks_to_bounds(); } void GraphicsLayer::SetMasksToBounds(bool masks_to_bounds) { - layer_->Layer()->SetMasksToBounds(masks_to_bounds); + layer_->SetMasksToBounds(masks_to_bounds); } void GraphicsLayer::SetDrawsContent(bool draws_content) { @@ -1084,12 +1087,12 @@ void GraphicsLayer::SetClipParent(WebLayer* parent) { has_clip_parent_ = !!parent; - layer_->Layer()->SetClipParent(parent); + layer_->SetClipParent(parent ? parent->CcLayer() : nullptr); } void GraphicsLayer::SetScrollParent(WebLayer* parent) { has_scroll_parent_ = !!parent; - layer_->Layer()->SetScrollParent(parent); + layer_->SetScrollParent(parent ? parent->CcLayer() : nullptr); } void GraphicsLayer::SetBackgroundColor(const Color& color) { @@ -1097,12 +1100,12 @@ return; background_color_ = color; - layer_->Layer()->SetBackgroundColor(background_color_.Rgb()); + layer_->SetBackgroundColor(background_color_.Rgb()); } void GraphicsLayer::SetContentsOpaque(bool opaque) { contents_opaque_ = opaque; - layer_->Layer()->SetOpaque(contents_opaque_); + layer_->SetContentsOpaque(contents_opaque_); ClearContentsLayerIfUnregistered(); if (contents_layer_ && !prevent_contents_opaque_changes_) contents_layer_->SetOpaque(opaque); @@ -1113,9 +1116,8 @@ return; mask_layer_ = mask_layer; - WebLayer* mask_web_layer = - mask_layer_ ? mask_layer_->PlatformLayer() : nullptr; - layer_->Layer()->SetMaskLayer(mask_web_layer); + layer_->SetMaskLayer(mask_layer_ ? mask_layer_->PlatformLayer()->CcLayer() + : nullptr); } void GraphicsLayer::SetContentsClippingMaskLayer( @@ -1181,7 +1183,7 @@ // TODO(chrishtr): Stop invalidating the rects once // FrameView::paintRecursively() does so. - layer_->Layer()->Invalidate(); + layer_->SetNeedsDisplay(); for (size_t i = 0; i < link_highlights_.size(); ++i) link_highlights_[i]->Invalidate(); GetPaintController().InvalidateAll(); @@ -1208,7 +1210,7 @@ void GraphicsLayer::SetNeedsDisplayInRectInternal(const IntRect& rect) { DCHECK(DrawsContent()); - layer_->Layer()->InvalidateRect(rect); + layer_->SetNeedsDisplayRect(rect); for (auto* link_highlight : link_highlights_) link_highlight->Invalidate(); } @@ -1267,7 +1269,7 @@ } WebLayer* GraphicsLayer::PlatformLayer() const { - return layer_->Layer(); + return web_layer_.get(); } void GraphicsLayer::SetFilters(CompositorFilterOperations filters) { @@ -1280,7 +1282,7 @@ void GraphicsLayer::SetStickyPositionConstraint( const cc::LayerStickyPositionConstraint& sticky_constraint) { - layer_->Layer()->SetStickyPositionConstraint(sticky_constraint); + layer_->SetStickyPositionConstraint(sticky_constraint); } void GraphicsLayer::SetFilterQuality(SkFilterQuality filter_quality) {
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.h b/third_party/blink/renderer/platform/graphics/graphics_layer.h index 1b71d1d..0eac142 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.h +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.h
@@ -33,7 +33,6 @@ #include "cc/input/overscroll_behavior.h" #include "cc/layers/content_layer_client.h" #include "cc/layers/layer_client.h" -#include "third_party/blink/public/platform/web_content_layer.h" #include "third_party/blink/public/platform/web_image_layer.h" #include "third_party/blink/renderer/platform/geometry/float_point.h" #include "third_party/blink/renderer/platform/geometry/float_point_3d.h" @@ -56,6 +55,10 @@ #include "third_party/skia/include/core/SkFilterQuality.h" #include "third_party/skia/include/core/SkRefCnt.h" +namespace cc { +class PictureLayer; +} + namespace blink { class CompositorFilterOperations; @@ -259,7 +262,7 @@ void ScrollableAreaDisposed(); - WebContentLayer* ContentLayer() const { return layer_.get(); } + cc::PictureLayer* ContentLayer() const { return layer_.get(); } static void RegisterContentsLayer(WebLayer*); static void UnregisterContentsLayer(WebLayer*); @@ -417,7 +420,8 @@ int paint_count_; - std::unique_ptr<WebContentLayer> layer_; + scoped_refptr<cc::PictureLayer> layer_; + std::unique_ptr<WebLayer> web_layer_; // Wraps |layer_|. std::unique_ptr<WebImageLayer> image_layer_; WebLayer* contents_layer_; // We don't have ownership of contents_layer_, but we do want to know if a
diff --git a/third_party/blink/renderer/platform/heap/trace_traits.h b/third_party/blink/renderer/platform/heap/trace_traits.h index 68cf64a27..4aa1681 100644 --- a/third_party/blink/renderer/platform/heap/trace_traits.h +++ b/third_party/blink/renderer/platform/heap/trace_traits.h
@@ -499,6 +499,41 @@ } }; +// Specialization for vector backings of Member<T> that immediately bails out +// on unused slots avoiding any unnecessary dispatch on visitors for unused +// slots. +template <typename T, typename Traits> +struct TraceInCollectionTrait< + kNoWeakHandling, + blink::HeapVectorBacking<blink::Member<T>, Traits>, + void> { + static bool Trace(blink::Visitor* visitor, void* self) { + static_assert(!std::is_polymorphic<blink::Member<T>>::value, + "blink::Member<T> should not be polymorphic"); + static_assert(Traits::kCanClearUnusedSlotsWithMemset, + "blink::Member<T> should allow clearing with memset"); + DCHECK(IsTraceableInCollectionTrait<Traits>::value); + blink::Member<T>* array = reinterpret_cast<blink::Member<T>*>(self); + blink::HeapObjectHeader* header = + blink::HeapObjectHeader::FromPayload(self); + size_t length = header->PayloadSize() / sizeof(blink::Member<T>); +#ifdef ANNOTATE_CONTIGUOUS_CONTAINER + // As commented above, HeapVectorBacking can trace unused slots + // (which are already zeroed out). + ANNOTATE_CHANGE_SIZE(array, length, 0, length); +#endif + for (size_t i = 0; i < length; ++i) { + if (array[i]) { + blink::TraceIfEnabled< + blink::Member<T>, + IsTraceableInCollectionTrait<Traits>::value>::Trace(visitor, + array[i]); + } + } + return false; + } +}; + // This trace method is used only for on-stack HeapVectors found in // conservative scanning. On-heap HeapVectors are traced by Vector::trace. template <typename T, typename Traits>
diff --git a/third_party/blink/renderer/platform/scheduler/base/DEPS b/third_party/blink/renderer/platform/scheduler/base/DEPS deleted file mode 100644 index 53701134..0000000 --- a/third_party/blink/renderer/platform/scheduler/base/DEPS +++ /dev/null
@@ -1,5 +0,0 @@ -specific_include_rules = { - ".*test\.cc": [ - "+components/viz/test", - ], -}
diff --git a/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc b/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc index 590054b..41968d9d 100644 --- a/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/base/task_queue_manager_impl_unittest.cc
@@ -12,15 +12,17 @@ #include "base/memory/ref_counted_memory.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_current.h" +#include "base/optional.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" #include "base/test/simple_test_tick_clock.h" +#include "base/test/test_mock_time_task_runner.h" +#include "base/test/test_simple_task_runner.h" #include "base/test/trace_event_analyzer.h" #include "base/threading/thread.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/blame_context.h" -#include "components/viz/test/ordered_simple_task_runner.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/blink/renderer/platform/scheduler/base/real_time_domain.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl.h" @@ -46,94 +48,112 @@ namespace blink { namespace scheduler { -class TaskQueueManagerTest : public testing::Test { - public: - TaskQueueManagerTest() = default; - void DeleteTaskQueueManager() { manager_.reset(); } - +class TaskQueueManagerTestBase : public testing::Test { protected: - void TearDown() override { manager_.reset(); } + void TearDown() override { + // TaskQueueManager should be deleted before an underlying task runner. + manager_.reset(); + } - scoped_refptr<TestTaskQueue> CreateTaskQueueWithSpec(TaskQueue::Spec spec) { + scoped_refptr<TestTaskQueue> CreateTaskQueue( + TaskQueue::Spec spec = TaskQueue::Spec("test")) { return manager_->CreateTaskQueue<TestTaskQueue>(spec); } - scoped_refptr<TestTaskQueue> CreateTaskQueue() { - return CreateTaskQueueWithSpec(TaskQueue::Spec("test")); - } - - scoped_refptr<TestTaskQueue> CreateTaskQueueWithMonitoredQuiescence() { - return CreateTaskQueueWithSpec( - TaskQueue::Spec("test").SetShouldMonitorQuiescence(true)); - } - - void Initialize(size_t num_queues) { - now_src_.Advance(base::TimeDelta::FromMicroseconds(1000)); - - test_task_runner_ = - base::WrapRefCounted(new cc::OrderedSimpleTaskRunner(&now_src_, false)); - - manager_ = TaskQueueManagerForTest::Create(nullptr, test_task_runner_.get(), - &now_src_); - + void CreateTaskQueues(size_t num_queues) { for (size_t i = 0; i < num_queues; i++) runners_.push_back(CreateTaskQueue()); } - void InitializeWithRealMessageLoop(size_t num_queues) { - message_loop_.reset(new base::MessageLoop()); - original_message_loop_task_runner_ = message_loop_->task_runner(); + std::unique_ptr<TaskQueueManagerForTest> manager_; + std::vector<scoped_refptr<TestTaskQueue>> runners_; + base::TimeTicks start_time_; + TestTaskTimeObserver test_task_time_observer_; +}; + +// TaskQueueManagerImpl uses TestMockTimeTaskRunner which controls +// both task execution and mock clock. +class TaskQueueManagerTest : public TaskQueueManagerTestBase { + public: + void DeleteTaskQueueManagerTask() { manager_.reset(); } + + protected: + void SetUp() override { + test_task_runner_ = base::WrapRefCounted(new base::TestMockTimeTaskRunner( + base::TestMockTimeTaskRunner::Type::kBoundToThread)); // A null clock triggers some assertions. - now_src_.Advance(base::TimeDelta::FromMicroseconds(1000)); + test_task_runner_->AdvanceMockTickClock( + base::TimeDelta::FromMilliseconds(1)); + start_time_ = GetTickClock()->NowTicks(); + manager_ = TaskQueueManagerForTest::Create( - message_loop_.get(), base::ThreadTaskRunnerHandle::Get(), &now_src_); - - for (size_t i = 0; i < num_queues; i++) - runners_.push_back(CreateTaskQueue()); + nullptr, base::ThreadTaskRunnerHandle::Get(), + test_task_runner_->GetMockTickClock()); } - void WakeUpReadyDelayedQueues(LazyNow lazy_now) { - manager_->WakeUpReadyDelayedQueues(&lazy_now); + const base::TickClock* GetTickClock() { + return test_task_runner_->GetMockTickClock(); } - EnqueueOrder GetNextSequenceNumber() const { - return manager_->GetNextSequenceNumber(); - } - - void MaybeScheduleImmediateWork(const base::Location& from_here) { - manager_->MaybeScheduleImmediateWork(from_here); + void RunPendingTasks() { + // We should only run tasks already posted by that moment. + base::RunLoop run_loop; + test_task_runner_->PostTask(FROM_HERE, run_loop.QuitClosure()); + // TestMockTimeTaskRunner will fast-forward mock clock if necessary. + run_loop.Run(); } // Runs all immediate tasks until there is no more work to do and advances // time if there is a pending delayed task. |per_run_time_callback| is called // when the clock advances. - void RunUntilIdle(base::RepeatingClosure per_run_time_callback) { + // The only difference to FastForwardUntilNoTasksRemain is that time + // advancing isn't driven by the test task runner, but uses time domain's + // next scheduled run time instead. It allows us to double-check consistency + // and allows to count such bursts of doing work, which is a test subject. + void RunUntilManagerIsIdle(base::RepeatingClosure per_run_time_callback) { for (;;) { // Advance time if we've run out of immediate work to do. if (!manager_->HasImmediateWork()) { base::TimeTicks run_time; if (manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)) { - now_src_.SetNowTicks(run_time); + test_task_runner_->AdvanceMockTickClock(run_time - + GetTickClock()->NowTicks()); per_run_time_callback.Run(); } else { break; } } - - test_task_runner_->RunPendingTasks(); + RunPendingTasks(); } } - base::TimeTicks Now() { return now_src_.NowTicks(); } + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner_; +}; + +// TaskQueueManagerImpl is being initialized with real MessageLoop +// at cost of less control over a task runner. +class TaskQueueManagerTestWithMessageLoop : public TaskQueueManagerTestBase { + protected: + void SetUp() override { + message_loop_.reset(new base::MessageLoop()); + // A null clock triggers some assertions. + mock_clock_.Advance(base::TimeDelta::FromMilliseconds(1)); + start_time_ = mock_clock_.NowTicks(); + + manager_ = TaskQueueManagerForTest::Create( + message_loop_.get(), base::ThreadTaskRunnerHandle::Get(), &mock_clock_); + } + + const base::TickClock* GetTickClock() { return &mock_clock_; } std::unique_ptr<base::MessageLoop> message_loop_; - scoped_refptr<base::SingleThreadTaskRunner> - original_message_loop_task_runner_; - base::SimpleTestTickClock now_src_; - scoped_refptr<cc::OrderedSimpleTaskRunner> test_task_runner_; - std::unique_ptr<TaskQueueManagerForTest> manager_; - std::vector<scoped_refptr<TestTaskQueue>> runners_; - TestTaskTimeObserver test_task_time_observer_; + base::SimpleTestTickClock mock_clock_; +}; + +class TaskQueueManagerTestWithCustomInitialization + : public TaskQueueManagerTestWithMessageLoop { + protected: + void SetUp() override {} }; void PostFromNestedRunloop( @@ -151,7 +171,7 @@ void NopTask() {} -TEST_F(TaskQueueManagerTest, +TEST_F(TaskQueueManagerTestWithCustomInitialization, NowCalledMinimumNumberOfTimesToComputeTaskDurations) { message_loop_.reset(new base::MessageLoop()); // This memory is managed by the TaskQueueManager, but we need to hold a @@ -180,7 +200,8 @@ EXPECT_EQ(18, test_count_uses_time_source.now_calls_count()); } -TEST_F(TaskQueueManagerTest, NowNotCalledForNestedTasks) { +TEST_F(TaskQueueManagerTestWithCustomInitialization, + NowNotCalledForNestedTasks) { message_loop_.reset(new base::MessageLoop()); // This memory is managed by the TaskQueueManager, but we need to hold a // pointer to this object to read out how many times Now was called. @@ -227,19 +248,19 @@ } TEST_F(TaskQueueManagerTest, SingleQueuePosting) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2, 3)); } TEST_F(TaskQueueManagerTest, MultiQueuePosting) { - Initialize(3u); + CreateTaskQueues(3u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); @@ -249,12 +270,12 @@ runners_[2]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 5, &run_order)); runners_[2]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 6, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4, 5, 6)); } -TEST_F(TaskQueueManagerTest, NonNestableTaskPosting) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, NonNestableTaskPosting) { + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostNonNestableTask(FROM_HERE, @@ -264,8 +285,9 @@ EXPECT_THAT(run_order, ElementsAre(1)); } -TEST_F(TaskQueueManagerTest, NonNestableTaskExecutesInExpectedOrder) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, + NonNestableTaskExecutesInExpectedOrder) { + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); @@ -279,8 +301,9 @@ EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4, 5)); } -TEST_F(TaskQueueManagerTest, NonNestableTasksDoesntExecuteInNestedLoop) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, + NonNestableTasksDoesntExecuteInNestedLoop) { + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); @@ -323,8 +346,8 @@ } // namespace -TEST_F(TaskQueueManagerTest, TaskQueueDisabledFromNestedLoop) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, TaskQueueDisabledFromNestedLoop) { + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; std::vector<std::pair<base::OnceClosure, bool>> @@ -355,7 +378,7 @@ } TEST_F(TaskQueueManagerTest, HasPendingImmediateWork_ImmediateTask) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); @@ -367,78 +390,74 @@ std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = runners_[0]->CreateQueueEnabledVoter(); voter->SetQueueEnabled(false); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE( runners_[0]->GetTaskQueueImpl()->immediate_work_queue()->Empty()); EXPECT_TRUE(runners_[0]->HasTaskToRunImmediately()); // Run the task, making the queue empty. voter->SetQueueEnabled(true); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); } TEST_F(TaskQueueManagerTest, HasPendingImmediateWork_DelayedTask) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay(base::TimeDelta::FromMilliseconds(10)); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order), delay); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); - now_src_.Advance(delay); + test_task_runner_->AdvanceMockTickClock(delay); EXPECT_TRUE(runners_[0]->HasTaskToRunImmediately()); // Move the task into the |delayed_work_queue|. - WakeUpReadyDelayedQueues(LazyNow(&now_src_)); + LazyNow lazy_now(GetTickClock()); + manager_->WakeUpReadyDelayedQueues(&lazy_now); EXPECT_FALSE(runners_[0]->GetTaskQueueImpl()->delayed_work_queue()->Empty()); EXPECT_TRUE(runners_[0]->HasTaskToRunImmediately()); // Run the task, making the queue empty. - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); } TEST_F(TaskQueueManagerTest, DelayedTaskPosting) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay(base::TimeDelta::FromMilliseconds(10)); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order), delay); - EXPECT_EQ(delay, test_task_runner_->DelayToNextTaskTime()); + EXPECT_EQ(base::TimeDelta::FromMilliseconds(10), + test_task_runner_->NextPendingTaskDelay()); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); EXPECT_TRUE(run_order.empty()); // The task doesn't run before the delay has completed. - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(9)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(9)); EXPECT_TRUE(run_order.empty()); // After the delay has completed, the task runs normally. - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(1)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(1)); EXPECT_THAT(run_order, ElementsAre(1)); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); } -bool MessageLoopTaskCounter(size_t* count) { - *count = *count + 1; - return true; -} - TEST_F(TaskQueueManagerTest, DelayedTaskExecutedInOneMessageLoopTask) { - Initialize(1u); + CreateTaskQueues(1u); - base::TimeDelta delay(base::TimeDelta::FromMilliseconds(10)); - runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), delay); - - size_t task_count = 0; - test_task_runner_->RunTasksWhile( - base::BindRepeating(&MessageLoopTaskCounter, &task_count)); - EXPECT_EQ(1u, task_count); + runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), + base::TimeDelta::FromMilliseconds(10)); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(1u, test_task_runner_->GetPendingTaskCount()); + test_task_runner_->FastForwardUntilNoTasksRemain(); + EXPECT_EQ(0u, test_task_runner_->GetPendingTaskCount()); } TEST_F(TaskQueueManagerTest, DelayedTaskPosting_MultipleTasks_DecendingOrder) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostDelayedTask(FROM_HERE, @@ -454,24 +473,24 @@ base::TimeDelta::FromMilliseconds(5)); EXPECT_EQ(base::TimeDelta::FromMilliseconds(5), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(5)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(5)); EXPECT_THAT(run_order, ElementsAre(3)); EXPECT_EQ(base::TimeDelta::FromMilliseconds(3), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(3)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(3)); EXPECT_THAT(run_order, ElementsAre(3, 2)); EXPECT_EQ(base::TimeDelta::FromMilliseconds(2), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(2)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(2)); EXPECT_THAT(run_order, ElementsAre(3, 2, 1)); } TEST_F(TaskQueueManagerTest, DelayedTaskPosting_MultipleTasks_AscendingOrder) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostDelayedTask(FROM_HERE, @@ -487,24 +506,24 @@ base::TimeDelta::FromMilliseconds(10)); EXPECT_EQ(base::TimeDelta::FromMilliseconds(1), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(1)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(1)); EXPECT_THAT(run_order, ElementsAre(1)); EXPECT_EQ(base::TimeDelta::FromMilliseconds(4), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(4)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(4)); EXPECT_THAT(run_order, ElementsAre(1, 2)); EXPECT_EQ(base::TimeDelta::FromMilliseconds(5), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(5)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(5)); EXPECT_THAT(run_order, ElementsAre(1, 2, 3)); } TEST_F(TaskQueueManagerTest, PostDelayedTask_SharesUnderlyingDelayedTasks) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay(base::TimeDelta::FromMilliseconds(10)); @@ -515,7 +534,7 @@ runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order), delay); - EXPECT_EQ(1u, test_task_runner_->NumPendingTasks()); + EXPECT_EQ(1u, test_task_runner_->GetPendingTaskCount()); } class TestObject { @@ -530,7 +549,7 @@ int TestObject::destructor_count__ = 0; TEST_F(TaskQueueManagerTest, PendingDelayedTasksRemovedOnShutdown) { - Initialize(1u); + CreateTaskQueues(1u); TestObject::destructor_count__ = 0; @@ -548,27 +567,27 @@ } TEST_F(TaskQueueManagerTest, InsertAndRemoveFence) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); std::vector<EnqueueOrder> run_order; // Posting a task when pumping is disabled doesn't result in work getting // posted. runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); - EXPECT_FALSE(test_task_runner_->HasPendingTasks()); + EXPECT_FALSE(test_task_runner_->HasPendingTask()); // However polling still works. EXPECT_TRUE(runners_[0]->HasTaskToRunImmediately()); // After removing the fence the task runs normally. runners_[0]->RemoveFence(); - EXPECT_TRUE(test_task_runner_->HasPendingTasks()); - test_task_runner_->RunUntilIdle(); + EXPECT_TRUE(test_task_runner_->HasPendingTask()); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1)); } TEST_F(TaskQueueManagerTest, RemovingFenceForDisabledQueueDoesNotPostDoWork) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = @@ -578,11 +597,11 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->RemoveFence(); - EXPECT_FALSE(test_task_runner_->HasPendingTasks()); + EXPECT_FALSE(test_task_runner_->HasPendingTask()); } TEST_F(TaskQueueManagerTest, EnablingFencedQueueDoesNotPostDoWork) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = @@ -592,47 +611,47 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); voter->SetQueueEnabled(true); - EXPECT_FALSE(test_task_runner_->HasPendingTasks()); + EXPECT_FALSE(test_task_runner_->HasPendingTask()); } TEST_F(TaskQueueManagerTest, DenyRunning_BeforePosting) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = runners_[0]->CreateQueueEnabledVoter(); voter->SetQueueEnabled(false); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); - EXPECT_FALSE(test_task_runner_->HasPendingTasks()); + EXPECT_FALSE(test_task_runner_->HasPendingTask()); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(run_order.empty()); voter->SetQueueEnabled(true); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1)); } TEST_F(TaskQueueManagerTest, DenyRunning_AfterPosting) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = runners_[0]->CreateQueueEnabledVoter(); - EXPECT_TRUE(test_task_runner_->HasPendingTasks()); + EXPECT_TRUE(test_task_runner_->HasPendingTask()); voter->SetQueueEnabled(false); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(run_order.empty()); voter->SetQueueEnabled(true); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1)); } TEST_F(TaskQueueManagerTest, DenyRunning_AfterRemovingFence) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); @@ -641,17 +660,17 @@ voter->SetQueueEnabled(false); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(run_order.empty()); runners_[0]->RemoveFence(); voter->SetQueueEnabled(true); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1)); } TEST_F(TaskQueueManagerTest, RemovingFenceWithDelayedTask) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); std::vector<EnqueueOrder> run_order; @@ -662,18 +681,18 @@ base::BindOnce(&TestTask, 1, &run_order), delay); // The task does not run even though it's delay is up. - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(10)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(10)); EXPECT_TRUE(run_order.empty()); // Removing the fence causes the task to run. runners_[0]->RemoveFence(); - EXPECT_TRUE(test_task_runner_->HasPendingTasks()); - test_task_runner_->RunPendingTasks(); + EXPECT_TRUE(test_task_runner_->HasPendingTask()); + RunPendingTasks(); EXPECT_THAT(run_order, ElementsAre(1)); } TEST_F(TaskQueueManagerTest, RemovingFenceWithMultipleDelayedTasks) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); std::vector<EnqueueOrder> run_order; @@ -689,18 +708,19 @@ runners_[0]->PostDelayedTask( FROM_HERE, base::BindOnce(&TestTask, 3, &run_order), delay3); - now_src_.Advance(base::TimeDelta::FromMilliseconds(15)); - test_task_runner_->RunUntilIdle(); + test_task_runner_->AdvanceMockTickClock( + base::TimeDelta::FromMilliseconds(15)); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(run_order.empty()); // Removing the fence causes the ready tasks to run. runners_[0]->RemoveFence(); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2)); } TEST_F(TaskQueueManagerTest, InsertFencePreventsDelayedTasksFromRunning) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); std::vector<EnqueueOrder> run_order; @@ -708,12 +728,12 @@ runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order), delay); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(10)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(10)); EXPECT_TRUE(run_order.empty()); } TEST_F(TaskQueueManagerTest, MultipleFences) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); @@ -721,18 +741,18 @@ runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2)); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); // Subsequent tasks should be blocked. runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 4, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2, 3)); } TEST_F(TaskQueueManagerTest, InsertFenceThenImmediatlyRemoveDoesNotBlock) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); runners_[0]->RemoveFence(); @@ -740,12 +760,12 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2)); } TEST_F(TaskQueueManagerTest, InsertFencePostThenRemoveDoesNotBlock) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); std::vector<EnqueueOrder> run_order; @@ -753,24 +773,25 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); runners_[0]->RemoveFence(); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2)); } TEST_F(TaskQueueManagerTest, MultipleFencesWithInitiallyEmptyQueue) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1)); } TEST_F(TaskQueueManagerTest, BlockedByFence) { - Initialize(1u); + CreateTaskQueues(1u); EXPECT_FALSE(runners_[0]->BlockedByFence()); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); @@ -783,7 +804,7 @@ runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); EXPECT_FALSE(runners_[0]->BlockedByFence()); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(runners_[0]->BlockedByFence()); runners_[0]->RemoveFence(); @@ -791,7 +812,7 @@ } TEST_F(TaskQueueManagerTest, BlockedByFence_BothTypesOfFence) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&NopTask)); @@ -805,7 +826,7 @@ namespace { void RecordTimeTask(std::vector<base::TimeTicks>* run_times, - base::SimpleTestTickClock* clock) { + const base::TickClock* clock) { run_times->push_back(clock->NowTicks()); } @@ -813,58 +834,59 @@ std::vector<std::pair<scoped_refptr<TestTaskQueue>, base::TimeTicks>>* run_times, scoped_refptr<TestTaskQueue> task_queue, - base::SimpleTestTickClock* clock) { + const base::TickClock* clock) { run_times->emplace_back(task_queue, clock->NowTicks()); } } // namespace TEST_F(TaskQueueManagerTest, DelayedFence_DelayedTasks) { - Initialize(1u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); + CreateTaskQueues(1u); std::vector<base::TimeTicks> run_times; runners_[0]->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(100)); runners_[0]->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(200)); runners_[0]->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(300)); - runners_[0]->InsertFenceAt(Now() + base::TimeDelta::FromMilliseconds(250)); + runners_[0]->InsertFenceAt(GetTickClock()->NowTicks() + + base::TimeDelta::FromMilliseconds(250)); EXPECT_FALSE(runners_[0]->HasActiveFence()); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); EXPECT_TRUE(runners_[0]->HasActiveFence()); EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201))); + ElementsAre(start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200))); run_times.clear(); runners_[0]->RemoveFence(); - test_task_runner_->RunUntilIdle(); + + test_task_runner_->FastForwardUntilNoTasksRemain(); EXPECT_FALSE(runners_[0]->HasActiveFence()); - EXPECT_THAT(run_times, ElementsAre(base::TimeTicks() + - base::TimeDelta::FromMilliseconds(301))); + EXPECT_THAT(run_times, ElementsAre(start_time_ + + base::TimeDelta::FromMilliseconds(300))); } TEST_F(TaskQueueManagerTest, DelayedFence_ImmediateTasks) { - Initialize(1u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); + CreateTaskQueues(1u); std::vector<base::TimeTicks> run_times; - runners_[0]->InsertFenceAt(Now() + base::TimeDelta::FromMilliseconds(250)); + runners_[0]->InsertFenceAt(GetTickClock()->NowTicks() + + base::TimeDelta::FromMilliseconds(250)); for (int i = 0; i < 5; ++i) { runners_[0]->PostTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_)); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(100)); + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock())); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(100)); if (i < 2) { EXPECT_FALSE(runners_[0]->HasActiveFence()); } else { @@ -874,32 +896,32 @@ EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(1), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201))); + ElementsAre(start_time_, + start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200))); run_times.clear(); runners_[0]->RemoveFence(); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(501), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(501))); + ElementsAre(start_time_ + base::TimeDelta::FromMilliseconds(500), + start_time_ + base::TimeDelta::FromMilliseconds(500))); } TEST_F(TaskQueueManagerTest, DelayedFence_RemovedFenceDoesNotActivate) { - Initialize(1u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); + CreateTaskQueues(1u); std::vector<base::TimeTicks> run_times; - runners_[0]->InsertFenceAt(Now() + base::TimeDelta::FromMilliseconds(250)); + runners_[0]->InsertFenceAt(GetTickClock()->NowTicks() + + base::TimeDelta::FromMilliseconds(250)); for (int i = 0; i < 3; ++i) { runners_[0]->PostTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_)); + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock())); EXPECT_FALSE(runners_[0]->HasActiveFence()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(100)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(100)); } EXPECT_TRUE(runners_[0]->HasActiveFence()); @@ -907,26 +929,25 @@ for (int i = 0; i < 2; ++i) { runners_[0]->PostTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_)); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(100)); + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock())); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(100)); EXPECT_FALSE(runners_[0]->HasActiveFence()); } EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(1), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(301), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(401))); + ElementsAre(start_time_, + start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200), + start_time_ + base::TimeDelta::FromMilliseconds(300), + start_time_ + base::TimeDelta::FromMilliseconds(400))); } TEST_F(TaskQueueManagerTest, DelayedFence_TakeIncomingImmediateQueue) { // This test checks that everything works correctly when a work queue // is swapped with an immediate incoming queue and a delayed fence // is activated, forcing a different queue to become active. - Initialize(2u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); + CreateTaskQueues(2u); scoped_refptr<TestTaskQueue> queue1 = runners_[0]; scoped_refptr<TestTaskQueue> queue2 = runners_[1]; @@ -935,34 +956,39 @@ run_times; // Fence ensures that the task posted after advancing time is blocked. - queue1->InsertFenceAt(Now() + base::TimeDelta::FromMilliseconds(250)); + queue1->InsertFenceAt(GetTickClock()->NowTicks() + + base::TimeDelta::FromMilliseconds(250)); // This task should not be blocked and should run immediately after // advancing time at 301ms. - queue1->PostTask(FROM_HERE, base::BindOnce(&RecordTimeAndQueueTask, - &run_times, queue1, &now_src_)); + queue1->PostTask(FROM_HERE, + base::BindOnce(&RecordTimeAndQueueTask, &run_times, queue1, + GetTickClock())); // Force reload of immediate work queue. In real life the same effect can be // achieved with cross-thread posting. queue1->GetTaskQueueImpl()->ReloadImmediateWorkQueueIfEmpty(); - now_src_.Advance(base::TimeDelta::FromMilliseconds(300)); + test_task_runner_->AdvanceMockTickClock( + base::TimeDelta::FromMilliseconds(300)); // This task should be blocked. - queue1->PostTask(FROM_HERE, base::BindOnce(&RecordTimeAndQueueTask, - &run_times, queue1, &now_src_)); + queue1->PostTask(FROM_HERE, + base::BindOnce(&RecordTimeAndQueueTask, &run_times, queue1, + GetTickClock())); // This task on a different runner should run as expected. - queue2->PostTask(FROM_HERE, base::BindOnce(&RecordTimeAndQueueTask, - &run_times, queue2, &now_src_)); + queue2->PostTask(FROM_HERE, + base::BindOnce(&RecordTimeAndQueueTask, &run_times, queue2, + GetTickClock())); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); EXPECT_THAT( run_times, ElementsAre( - std::make_pair(queue1, base::TimeTicks() + - base::TimeDelta::FromMilliseconds(301)), - std::make_pair(queue2, base::TimeTicks() + - base::TimeDelta::FromMilliseconds(301)))); + std::make_pair(queue1, + start_time_ + base::TimeDelta::FromMilliseconds(300)), + std::make_pair( + queue2, start_time_ + base::TimeDelta::FromMilliseconds(300)))); } namespace { @@ -980,25 +1006,25 @@ } // namespace TEST_F(TaskQueueManagerTest, ReentrantPosting) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask( FROM_HERE, BindOnce(&ReentrantTestTask, runners_[0], 3, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(3, 2, 1)); } TEST_F(TaskQueueManagerTest, NoTasksAfterShutdown) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); manager_.reset(); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(run_order.empty()); } @@ -1007,8 +1033,8 @@ runner->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, run_order)); } -TEST_F(TaskQueueManagerTest, PostFromThread) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, PostFromThread) { + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; base::Thread thread("TestThread"); @@ -1030,21 +1056,19 @@ } TEST_F(TaskQueueManagerTest, DoWorkCantPostItselfMultipleTimes) { - Initialize(1u); + CreateTaskQueues(1u); int run_count = 0; runners_[0]->PostTask( FROM_HERE, base::BindOnce(&RePostingTestTask, runners_[0], &run_count)); - test_task_runner_->RunPendingTasks(); - // NOTE without the executing_task_ check in MaybeScheduleDoWork there - // will be two tasks here. - EXPECT_EQ(1u, test_task_runner_->NumPendingTasks()); + RunPendingTasks(); + EXPECT_EQ(1u, test_task_runner_->GetPendingTaskCount()); EXPECT_EQ(1, run_count); } -TEST_F(TaskQueueManagerTest, PostFromNestedRunloop) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, PostFromNestedRunloop) { + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; std::vector<std::pair<base::OnceClosure, bool>> @@ -1065,7 +1089,7 @@ } TEST_F(TaskQueueManagerTest, WorkBatching) { - Initialize(1u); + CreateTaskQueues(1u); manager_->SetWorkBatchSize(2); @@ -1077,13 +1101,13 @@ // Running one task in the host message loop should cause two posted tasks to // get executed. - EXPECT_EQ(test_task_runner_->NumPendingTasks(), 1u); - test_task_runner_->RunPendingTasks(); + EXPECT_EQ(1u, test_task_runner_->GetPendingTaskCount()); + RunPendingTasks(); EXPECT_THAT(run_order, ElementsAre(1, 2)); // The second task runs the remaining two posted tasks. - EXPECT_EQ(test_task_runner_->NumPendingTasks(), 1u); - test_task_runner_->RunPendingTasks(); + EXPECT_EQ(1u, test_task_runner_->GetPendingTaskCount()); + RunPendingTasks(); EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4)); } @@ -1093,8 +1117,8 @@ MOCK_METHOD1(WillProcessTask, void(const base::PendingTask& task)); }; -TEST_F(TaskQueueManagerTest, TaskObserverAdding) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, TaskObserverAdding) { + CreateTaskQueues(1u); MockTaskObserver observer; manager_->SetWorkBatchSize(2); @@ -1109,8 +1133,8 @@ base::RunLoop().RunUntilIdle(); } -TEST_F(TaskQueueManagerTest, TaskObserverRemoving) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, TaskObserverRemoving) { + CreateTaskQueues(1u); MockTaskObserver observer; manager_->SetWorkBatchSize(2); manager_->AddTaskObserver(&observer); @@ -1121,7 +1145,6 @@ EXPECT_CALL(observer, WillProcessTask(_)).Times(0); EXPECT_CALL(observer, DidProcessTask(_)).Times(0); - base::RunLoop().RunUntilIdle(); } @@ -1130,8 +1153,8 @@ manager->RemoveTaskObserver(observer); } -TEST_F(TaskQueueManagerTest, TaskObserverRemovingInsideTask) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, TaskObserverRemovingInsideTask) { + CreateTaskQueues(1u); MockTaskObserver observer; manager_->SetWorkBatchSize(3); manager_->AddTaskObserver(&observer); @@ -1144,8 +1167,8 @@ base::RunLoop().RunUntilIdle(); } -TEST_F(TaskQueueManagerTest, QueueTaskObserverAdding) { - InitializeWithRealMessageLoop(2u); +TEST_F(TaskQueueManagerTestWithMessageLoop, QueueTaskObserverAdding) { + CreateTaskQueues(2u); MockTaskObserver observer; manager_->SetWorkBatchSize(2); @@ -1160,8 +1183,8 @@ base::RunLoop().RunUntilIdle(); } -TEST_F(TaskQueueManagerTest, QueueTaskObserverRemoving) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, QueueTaskObserverRemoving) { + CreateTaskQueues(1u); MockTaskObserver observer; manager_->SetWorkBatchSize(2); runners_[0]->AddTaskObserver(&observer); @@ -1181,8 +1204,9 @@ queue->RemoveTaskObserver(observer); } -TEST_F(TaskQueueManagerTest, QueueTaskObserverRemovingInsideTask) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, + QueueTaskObserverRemovingInsideTask) { + CreateTaskQueues(1u); MockTaskObserver observer; runners_[0]->AddTaskObserver(&observer); @@ -1195,15 +1219,16 @@ } TEST_F(TaskQueueManagerTest, ThreadCheckAfterTermination) { - Initialize(1u); + CreateTaskQueues(1u); EXPECT_TRUE(runners_[0]->RunsTasksInCurrentSequence()); manager_.reset(); EXPECT_TRUE(runners_[0]->RunsTasksInCurrentSequence()); } TEST_F(TaskQueueManagerTest, TimeDomain_NextScheduledRunTime) { - Initialize(2u); - now_src_.Advance(base::TimeDelta::FromMicroseconds(10000)); + CreateTaskQueues(2u); + test_task_runner_->AdvanceMockTickClock( + base::TimeDelta::FromMicroseconds(10000)); // With no delayed tasks. base::TimeTicks run_time; @@ -1218,36 +1243,36 @@ runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), expected_delay); EXPECT_TRUE(manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)); - EXPECT_EQ(now_src_.NowTicks() + expected_delay, run_time); + EXPECT_EQ(GetTickClock()->NowTicks() + expected_delay, run_time); // With another delayed task in the same queue with a longer delay. runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), base::TimeDelta::FromMilliseconds(100)); EXPECT_TRUE(manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)); - EXPECT_EQ(now_src_.NowTicks() + expected_delay, run_time); + EXPECT_EQ(GetTickClock()->NowTicks() + expected_delay, run_time); // With another delayed task in the same queue with a shorter delay. expected_delay = base::TimeDelta::FromMilliseconds(20); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), expected_delay); EXPECT_TRUE(manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)); - EXPECT_EQ(now_src_.NowTicks() + expected_delay, run_time); + EXPECT_EQ(GetTickClock()->NowTicks() + expected_delay, run_time); // With another delayed task in a different queue with a shorter delay. expected_delay = base::TimeDelta::FromMilliseconds(10); runners_[1]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), expected_delay); EXPECT_TRUE(manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)); - EXPECT_EQ(now_src_.NowTicks() + expected_delay, run_time); + EXPECT_EQ(GetTickClock()->NowTicks() + expected_delay, run_time); // Test it updates as time progresses - now_src_.Advance(expected_delay); + test_task_runner_->AdvanceMockTickClock(expected_delay); EXPECT_TRUE(manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)); - EXPECT_EQ(now_src_.NowTicks(), run_time); + EXPECT_EQ(GetTickClock()->NowTicks(), run_time); } TEST_F(TaskQueueManagerTest, TimeDomain_NextScheduledRunTime_MultipleQueues) { - Initialize(3u); + CreateTaskQueues(3u); base::TimeDelta delay1 = base::TimeDelta::FromMilliseconds(50); base::TimeDelta delay2 = base::TimeDelta::FromMilliseconds(5); @@ -1259,64 +1284,67 @@ base::TimeTicks run_time; EXPECT_TRUE(manager_->GetRealTimeDomain()->NextScheduledRunTime(&run_time)); - EXPECT_EQ(now_src_.NowTicks() + delay2, run_time); + EXPECT_EQ(GetTickClock()->NowTicks() + delay2, run_time); } TEST_F(TaskQueueManagerTest, DeleteTaskQueueManagerInsideATask) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->PostTask( - FROM_HERE, base::BindOnce(&TaskQueueManagerTest::DeleteTaskQueueManager, - base::Unretained(this))); + FROM_HERE, + base::BindOnce(&TaskQueueManagerTest::DeleteTaskQueueManagerTask, + base::Unretained(this))); // This should not crash, assuming DoWork detects the TaskQueueManager has // been deleted. - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); } TEST_F(TaskQueueManagerTest, GetAndClearSystemIsQuiescentBit) { - Initialize(3u); + CreateTaskQueues(3u); - scoped_refptr<TaskQueue> queue0 = CreateTaskQueueWithMonitoredQuiescence(); - scoped_refptr<TaskQueue> queue1 = CreateTaskQueueWithMonitoredQuiescence(); + scoped_refptr<TaskQueue> queue0 = + CreateTaskQueue(TaskQueue::Spec("test").SetShouldMonitorQuiescence(true)); + scoped_refptr<TaskQueue> queue1 = + CreateTaskQueue(TaskQueue::Spec("test").SetShouldMonitorQuiescence(true)); scoped_refptr<TaskQueue> queue2 = CreateTaskQueue(); EXPECT_TRUE(manager_->GetAndClearSystemIsQuiescentBit()); queue0->PostTask(FROM_HERE, base::BindOnce(&NopTask)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(manager_->GetAndClearSystemIsQuiescentBit()); EXPECT_TRUE(manager_->GetAndClearSystemIsQuiescentBit()); queue1->PostTask(FROM_HERE, base::BindOnce(&NopTask)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(manager_->GetAndClearSystemIsQuiescentBit()); EXPECT_TRUE(manager_->GetAndClearSystemIsQuiescentBit()); queue2->PostTask(FROM_HERE, base::BindOnce(&NopTask)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(manager_->GetAndClearSystemIsQuiescentBit()); queue0->PostTask(FROM_HERE, base::BindOnce(&NopTask)); queue1->PostTask(FROM_HERE, base::BindOnce(&NopTask)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(manager_->GetAndClearSystemIsQuiescentBit()); EXPECT_TRUE(manager_->GetAndClearSystemIsQuiescentBit()); } TEST_F(TaskQueueManagerTest, HasPendingImmediateWork) { - Initialize(1u); + CreateTaskQueues(1u); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); runners_[0]->PostTask(FROM_HERE, base::BindOnce(NullTask)); EXPECT_TRUE(runners_[0]->HasTaskToRunImmediately()); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); } TEST_F(TaskQueueManagerTest, HasPendingImmediateWork_DelayedTasks) { - Initialize(1u); + CreateTaskQueues(1u); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(NullTask), @@ -1324,46 +1352,51 @@ EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); // Move time forwards until just before the delayed task should run. - now_src_.Advance(base::TimeDelta::FromMilliseconds(10)); - WakeUpReadyDelayedQueues(LazyNow(&now_src_)); + test_task_runner_->AdvanceMockTickClock( + base::TimeDelta::FromMilliseconds(10)); + LazyNow lazy_now_1(GetTickClock()); + manager_->WakeUpReadyDelayedQueues(&lazy_now_1); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); // Force the delayed task onto the work queue. - now_src_.Advance(base::TimeDelta::FromMilliseconds(2)); - WakeUpReadyDelayedQueues(LazyNow(&now_src_)); + test_task_runner_->AdvanceMockTickClock(base::TimeDelta::FromMilliseconds(2)); + LazyNow lazy_now_2(GetTickClock()); + manager_->WakeUpReadyDelayedQueues(&lazy_now_2); EXPECT_TRUE(runners_[0]->HasTaskToRunImmediately()); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_FALSE(runners_[0]->HasTaskToRunImmediately()); } -void ExpensiveTestTask(int value, - base::SimpleTestTickClock* clock, - std::vector<EnqueueOrder>* out_result) { +void ExpensiveTestTask( + int value, + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner, + std::vector<EnqueueOrder>* out_result) { out_result->push_back(value); - clock->Advance(base::TimeDelta::FromMilliseconds(1)); + test_task_runner->FastForwardBy(base::TimeDelta::FromMilliseconds(1)); } TEST_F(TaskQueueManagerTest, ImmediateAndDelayedTaskInterleaving) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay = base::TimeDelta::FromMilliseconds(10); for (int i = 10; i < 19; i++) { runners_[0]->PostDelayedTask( - FROM_HERE, base::BindOnce(&ExpensiveTestTask, i, &now_src_, &run_order), + FROM_HERE, + base::BindOnce(&ExpensiveTestTask, i, test_task_runner_, &run_order), delay); } - test_task_runner_->RunForPeriod(delay); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(10)); for (int i = 0; i < 9; i++) { - runners_[0]->PostTask(FROM_HERE, base::BindOnce(&ExpensiveTestTask, i, - &now_src_, &run_order)); + runners_[0]->PostTask( + FROM_HERE, + base::BindOnce(&ExpensiveTestTask, i, test_task_runner_, &run_order)); } - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); // Delayed tasks are not allowed to starve out immediate work which is why // some of the immediate tasks run out of order. @@ -1374,7 +1407,7 @@ TEST_F(TaskQueueManagerTest, DelayedTaskDoesNotSkipAHeadOfNonDelayedTask_SameQueue) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay = base::TimeDelta::FromMilliseconds(10); @@ -1383,15 +1416,15 @@ runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order), delay); - now_src_.Advance(delay * 2); - test_task_runner_->RunUntilIdle(); + test_task_runner_->AdvanceMockTickClock(delay * 2); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(2, 3, 1)); } TEST_F(TaskQueueManagerTest, DelayedTaskDoesNotSkipAHeadOfNonDelayedTask_DifferentQueues) { - Initialize(2u); + CreateTaskQueues(2u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay = base::TimeDelta::FromMilliseconds(10); @@ -1400,14 +1433,14 @@ runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order), delay); - now_src_.Advance(delay * 2); - test_task_runner_->RunUntilIdle(); + test_task_runner_->AdvanceMockTickClock(delay * 2); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(2, 3, 1)); } TEST_F(TaskQueueManagerTest, DelayedTaskDoesNotSkipAHeadOfShorterDelayedTask) { - Initialize(2u); + CreateTaskQueues(2u); std::vector<EnqueueOrder> run_order; base::TimeDelta delay1 = base::TimeDelta::FromMilliseconds(10); @@ -1417,8 +1450,8 @@ runners_[1]->PostDelayedTask( FROM_HERE, base::BindOnce(&TestTask, 2, &run_order), delay2); - now_src_.Advance(delay1 * 2); - test_task_runner_->RunUntilIdle(); + test_task_runner_->AdvanceMockTickClock(delay1 * 2); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(2, 1)); } @@ -1435,10 +1468,10 @@ run_loop->Run(); } -TEST_F(TaskQueueManagerTest, QuitWhileNested) { +TEST_F(TaskQueueManagerTestWithMessageLoop, QuitWhileNested) { // This test makes sure we don't continue running a work batch after a nested // run loop has been exited in the middle of the batch. - InitializeWithRealMessageLoop(1u); + CreateTaskQueues(1u); manager_->SetWorkBatchSize(2); bool was_nested = true; @@ -1471,7 +1504,7 @@ }; TEST_F(TaskQueueManagerTest, SequenceNumSetWhenTaskIsPosted) { - Initialize(1u); + CreateTaskQueues(1u); SequenceNumberCapturingTaskObserver observer; manager_->AddTaskObserver(&observer); @@ -1489,7 +1522,7 @@ base::TimeDelta::FromMilliseconds(10)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 4, &run_order)); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(40)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(40)); ASSERT_THAT(run_order, ElementsAre(4, 3, 2, 1)); // The sequence numbers are a one-based monotonically incrememting counter @@ -1501,7 +1534,7 @@ } TEST_F(TaskQueueManagerTest, NewTaskQueues) { - Initialize(1u); + CreateTaskQueues(1u); scoped_refptr<TaskQueue> queue1 = CreateTaskQueue(); scoped_refptr<TaskQueue> queue2 = CreateTaskQueue(); @@ -1515,13 +1548,13 @@ queue1->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); queue2->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); queue3->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2, 3)); } TEST_F(TaskQueueManagerTest, ShutdownTaskQueue) { - Initialize(1u); + CreateTaskQueues(1u); scoped_refptr<TaskQueue> queue1 = CreateTaskQueue(); scoped_refptr<TaskQueue> queue2 = CreateTaskQueue(); @@ -1537,13 +1570,13 @@ queue3->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); queue2->ShutdownTaskQueue(); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 3)); } TEST_F(TaskQueueManagerTest, ShutdownTaskQueue_WithDelayedTasks) { - Initialize(2u); + CreateTaskQueues(2u); // Register three delayed tasks std::vector<EnqueueOrder> run_order; @@ -1558,9 +1591,9 @@ base::TimeDelta::FromMilliseconds(30)); runners_[1]->ShutdownTaskQueue(); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(40)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(40)); ASSERT_THAT(run_order, ElementsAre(1, 3)); } @@ -1571,7 +1604,7 @@ } // namespace TEST_F(TaskQueueManagerTest, ShutdownTaskQueue_InTasks) { - Initialize(3u); + CreateTaskQueues(3u); std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); @@ -1580,7 +1613,7 @@ runners_[1]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); runners_[2]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); ASSERT_THAT(run_order, ElementsAre(1)); } @@ -1595,8 +1628,8 @@ } // namespace -TEST_F(TaskQueueManagerTest, ShutdownTaskQueueInNestedLoop) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, ShutdownTaskQueueInNestedLoop) { + CreateTaskQueues(1u); // We retain a reference to the task queue even when the manager has deleted // its reference. @@ -1628,7 +1661,7 @@ } TEST_F(TaskQueueManagerTest, TimeDomainsAreIndependant) { - Initialize(2u); + CreateTaskQueues(2u); base::TimeTicks start_time_ticks = manager_->NowTicks(); std::unique_ptr<VirtualTimeDomain> domain_a( @@ -1665,14 +1698,14 @@ base::TimeDelta::FromMilliseconds(50)); manager_->MaybeScheduleImmediateWork(FROM_HERE); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(4, 5, 6)); domain_a->AdvanceNowTo(start_time_ticks + base::TimeDelta::FromMilliseconds(50)); manager_->MaybeScheduleImmediateWork(FROM_HERE); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(4, 5, 6, 1, 2, 3)); runners_[0]->ShutdownTaskQueue(); @@ -1683,7 +1716,7 @@ } TEST_F(TaskQueueManagerTest, TimeDomainMigration) { - Initialize(1u); + CreateTaskQueues(1u); base::TimeTicks start_time_ticks = manager_->NowTicks(); std::unique_ptr<VirtualTimeDomain> domain_a( @@ -1708,7 +1741,7 @@ domain_a->AdvanceNowTo(start_time_ticks + base::TimeDelta::FromMilliseconds(20)); manager_->MaybeScheduleImmediateWork(FROM_HERE); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2)); std::unique_ptr<VirtualTimeDomain> domain_b( @@ -1720,7 +1753,7 @@ base::TimeDelta::FromMilliseconds(50)); manager_->MaybeScheduleImmediateWork(FROM_HERE); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4)); runners_[0]->ShutdownTaskQueue(); @@ -1730,7 +1763,7 @@ } TEST_F(TaskQueueManagerTest, TimeDomainMigrationWithIncomingImmediateTasks) { - Initialize(1u); + CreateTaskQueues(1u); base::TimeTicks start_time_ticks = manager_->NowTicks(); std::unique_ptr<VirtualTimeDomain> domain_a( @@ -1745,7 +1778,7 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->SetTimeDomain(domain_b.get()); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1)); runners_[0]->ShutdownTaskQueue(); @@ -1756,7 +1789,7 @@ TEST_F(TaskQueueManagerTest, PostDelayedTasksReverseOrderAlternatingTimeDomains) { - Initialize(1u); + CreateTaskQueues(1u); std::vector<EnqueueOrder> run_order; @@ -1785,7 +1818,7 @@ base::BindOnce(&TestTask, 4, &run_order), base::TimeDelta::FromMilliseconds(10)); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(40)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(40)); EXPECT_THAT(run_order, ElementsAre(4, 3, 2, 1)); runners_[0]->ShutdownTaskQueue(); @@ -1806,7 +1839,7 @@ } // namespace TEST_F(TaskQueueManagerTest, TaskQueueObserver_ImmediateTask) { - Initialize(1u); + CreateTaskQueues(1u); MockTaskQueueObserver observer; runners_[0]->SetObserver(&observer); @@ -1831,7 +1864,7 @@ } TEST_F(TaskQueueManagerTest, TaskQueueObserver_DelayedTask) { - Initialize(1u); + CreateTaskQueues(1u); base::TimeTicks start_time = manager_->NowTicks(); base::TimeDelta delay10s(base::TimeDelta::FromSeconds(10)); @@ -1876,7 +1909,7 @@ } TEST_F(TaskQueueManagerTest, TaskQueueObserver_DelayedTaskMultipleQueues) { - Initialize(2u); + CreateTaskQueues(2u); MockTaskQueueObserver observer; runners_[0]->SetObserver(&observer); @@ -1937,7 +1970,7 @@ // is the same in all conditions and just change a time domain to // trigger notification. - Initialize(1u); + CreateTaskQueues(1u); base::TimeDelta delay1s(base::TimeDelta::FromSeconds(1)); base::TimeDelta delay10s(base::TimeDelta::FromSeconds(10)); @@ -1955,7 +1988,7 @@ std::make_unique<RealTimeDomain>(); manager_->RegisterTimeDomain(mock_time_domain.get()); - now_src_.Advance(delay10s); + test_task_runner_->AdvanceMockTickClock(delay10s); EXPECT_CALL(observer, OnQueueNextWakeUpChanged(_, _)); runners_[0]->SetTimeDomain(mock_time_domain.get()); @@ -1979,7 +2012,7 @@ }; TEST_F(TaskQueueManagerTest, TaskQueueObserver_SweepCanceledDelayedTasks) { - Initialize(1u); + CreateTaskQueues(1u); MockTaskQueueObserver observer; runners_[0]->SetObserver(&observer); @@ -1992,8 +2025,8 @@ OnQueueNextWakeUpChanged(runners_[0].get(), start_time + delay1)) .Times(1); - CancelableTask task1(&now_src_); - CancelableTask task2(&now_src_); + CancelableTask task1(GetTickClock()); + CancelableTask task2(GetTickClock()); std::vector<base::TimeTicks> run_times; runners_[0]->PostDelayedTask( FROM_HERE, @@ -2017,26 +2050,26 @@ namespace { void ChromiumRunloopInspectionTask( - scoped_refptr<cc::OrderedSimpleTaskRunner> test_task_runner) { - EXPECT_EQ(1u, test_task_runner->NumPendingTasks()); + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner) { + // We don't expect more than 1 pending task at any time. + EXPECT_GE(1u, test_task_runner->GetPendingTaskCount()); } } // namespace TEST_F(TaskQueueManagerTest, NumberOfPendingTasksOnChromiumRunLoop) { - Initialize(1u); + CreateTaskQueues(1u); // NOTE because tasks posted to the chromiumrun loop are not cancellable, we // will end up with a lot more tasks posted if the delayed tasks were posted // in the reverse order. // TODO(alexclarke): Consider talking to the message pump directly. - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); for (int i = 1; i < 100; i++) { runners_[0]->PostDelayedTask( FROM_HERE, base::BindOnce(&ChromiumRunloopInspectionTask, test_task_runner_), base::TimeDelta::FromMilliseconds(i)); } - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); } namespace { @@ -2045,8 +2078,11 @@ public: QuadraticTask(scoped_refptr<TaskQueue> task_queue, base::TimeDelta delay, - base::SimpleTestTickClock* now_src) - : count_(0), task_queue_(task_queue), delay_(delay), now_src_(now_src) {} + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner) + : count_(0), + task_queue_(task_queue), + delay_(delay), + test_task_runner_(test_task_runner) {} void SetShouldExit(base::RepeatingCallback<bool()> should_exit) { should_exit_ = should_exit; @@ -2062,7 +2098,7 @@ task_queue_->PostDelayedTask( FROM_HERE, base::BindOnce(&QuadraticTask::Run, base::Unretained(this)), delay_); - now_src_->Advance(base::TimeDelta::FromMilliseconds(5)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(5)); } int Count() const { return count_; } @@ -2072,15 +2108,18 @@ scoped_refptr<TaskQueue> task_queue_; base::TimeDelta delay_; base::RepeatingCallback<bool()> should_exit_; - base::SimpleTestTickClock* now_src_; + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner_; }; class LinearTask { public: LinearTask(scoped_refptr<TaskQueue> task_queue, base::TimeDelta delay, - base::SimpleTestTickClock* now_src) - : count_(0), task_queue_(task_queue), delay_(delay), now_src_(now_src) {} + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner) + : count_(0), + task_queue_(task_queue), + delay_(delay), + test_task_runner_(test_task_runner) {} void SetShouldExit(base::RepeatingCallback<bool()> should_exit) { should_exit_ = should_exit; @@ -2093,7 +2132,7 @@ task_queue_->PostDelayedTask( FROM_HERE, base::BindOnce(&LinearTask::Run, base::Unretained(this)), delay_); - now_src_->Advance(base::TimeDelta::FromMilliseconds(5)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(5)); } int Count() const { return count_; } @@ -2103,7 +2142,7 @@ scoped_refptr<TaskQueue> task_queue_; base::TimeDelta delay_; base::RepeatingCallback<bool()> should_exit_; - base::SimpleTestTickClock* now_src_; + scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner_; }; bool ShouldExit(QuadraticTask* quadratic_task, LinearTask* linear_task) { @@ -2114,11 +2153,12 @@ TEST_F(TaskQueueManagerTest, DelayedTasksDontBadlyStarveNonDelayedWork_SameQueue) { - Initialize(1u); + CreateTaskQueues(1u); QuadraticTask quadratic_delayed_task( - runners_[0], base::TimeDelta::FromMilliseconds(10), &now_src_); - LinearTask linear_immediate_task(runners_[0], base::TimeDelta(), &now_src_); + runners_[0], base::TimeDelta::FromMilliseconds(10), test_task_runner_); + LinearTask linear_immediate_task(runners_[0], base::TimeDelta(), + test_task_runner_); base::RepeatingCallback<bool()> should_exit = base::BindRepeating( ShouldExit, &quadratic_delayed_task, &linear_immediate_task); quadratic_delayed_task.SetShouldExit(should_exit); @@ -2127,8 +2167,7 @@ quadratic_delayed_task.Run(); linear_immediate_task.Run(); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); double ratio = static_cast<double>(linear_immediate_task.Count()) / static_cast<double>(quadratic_delayed_task.Count()); @@ -2138,12 +2177,12 @@ } TEST_F(TaskQueueManagerTest, ImmediateWorkCanStarveDelayedTasks_SameQueue) { - Initialize(1u); + CreateTaskQueues(1u); QuadraticTask quadratic_immediate_task(runners_[0], base::TimeDelta(), - &now_src_); + test_task_runner_); LinearTask linear_delayed_task( - runners_[0], base::TimeDelta::FromMilliseconds(10), &now_src_); + runners_[0], base::TimeDelta::FromMilliseconds(10), test_task_runner_); base::RepeatingCallback<bool()> should_exit = base::BindRepeating( &ShouldExit, &quadratic_immediate_task, &linear_delayed_task); @@ -2153,8 +2192,7 @@ quadratic_immediate_task.Run(); linear_delayed_task.Run(); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); double ratio = static_cast<double>(linear_delayed_task.Count()) / static_cast<double>(quadratic_immediate_task.Count()); @@ -2167,11 +2205,12 @@ TEST_F(TaskQueueManagerTest, DelayedTasksDontBadlyStarveNonDelayedWork_DifferentQueue) { - Initialize(2u); + CreateTaskQueues(2u); QuadraticTask quadratic_delayed_task( - runners_[0], base::TimeDelta::FromMilliseconds(10), &now_src_); - LinearTask linear_immediate_task(runners_[1], base::TimeDelta(), &now_src_); + runners_[0], base::TimeDelta::FromMilliseconds(10), test_task_runner_); + LinearTask linear_immediate_task(runners_[1], base::TimeDelta(), + test_task_runner_); base::RepeatingCallback<bool()> should_exit = base::BindRepeating( ShouldExit, &quadratic_delayed_task, &linear_immediate_task); quadratic_delayed_task.SetShouldExit(should_exit); @@ -2180,8 +2219,7 @@ quadratic_delayed_task.Run(); linear_immediate_task.Run(); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); double ratio = static_cast<double>(linear_immediate_task.Count()) / static_cast<double>(quadratic_delayed_task.Count()); @@ -2192,12 +2230,12 @@ TEST_F(TaskQueueManagerTest, ImmediateWorkCanStarveDelayedTasks_DifferentQueue) { - Initialize(2u); + CreateTaskQueues(2u); QuadraticTask quadratic_immediate_task(runners_[0], base::TimeDelta(), - &now_src_); + test_task_runner_); LinearTask linear_delayed_task( - runners_[1], base::TimeDelta::FromMilliseconds(10), &now_src_); + runners_[1], base::TimeDelta::FromMilliseconds(10), test_task_runner_); base::RepeatingCallback<bool()> should_exit = base::BindRepeating( &ShouldExit, &quadratic_immediate_task, &linear_delayed_task); @@ -2207,8 +2245,7 @@ quadratic_immediate_task.Run(); linear_delayed_task.Run(); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); double ratio = static_cast<double>(linear_delayed_task.Count()) / static_cast<double>(quadratic_immediate_task.Count()); @@ -2220,7 +2257,7 @@ } TEST_F(TaskQueueManagerTest, CurrentlyExecutingTaskQueue_NoTaskRunning) { - Initialize(1u); + CreateTaskQueues(1u); EXPECT_EQ(nullptr, manager_->currently_executing_task_queue()); } @@ -2234,7 +2271,7 @@ } // namespace TEST_F(TaskQueueManagerTest, CurrentlyExecutingTaskQueue_TaskRunning) { - Initialize(2u); + CreateTaskQueues(2u); TestTaskQueue* queue0 = runners_[0].get(); TestTaskQueue* queue1 = runners_[1].get(); @@ -2246,7 +2283,7 @@ queue1->PostTask(FROM_HERE, base::BindOnce(&CurrentlyExecutingTaskQueueTestTask, manager_.get(), &task_sources)); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(task_sources, ElementsAre(queue0->GetTaskQueueImpl(), queue1->GetTaskQueueImpl())); @@ -2269,8 +2306,9 @@ } } // namespace -TEST_F(TaskQueueManagerTest, CurrentlyExecutingTaskQueue_NestedLoop) { - InitializeWithRealMessageLoop(3u); +TEST_F(TaskQueueManagerTestWithMessageLoop, + CurrentlyExecutingTaskQueue_NestedLoop) { + CreateTaskQueues(3u); TestTaskQueue* queue0 = runners_[0].get(); TestTaskQueue* queue1 = runners_[1].get(); @@ -2301,10 +2339,10 @@ EXPECT_EQ(nullptr, manager_->currently_executing_task_queue()); } -TEST_F(TaskQueueManagerTest, BlameContextAttribution) { +TEST_F(TaskQueueManagerTestWithMessageLoop, BlameContextAttribution) { using trace_analyzer::Query; - InitializeWithRealMessageLoop(1u); + CreateTaskQueues(1u); TestTaskQueue* queue = runners_[0].get(); trace_analyzer::Start("*"); @@ -2327,14 +2365,14 @@ } TEST_F(TaskQueueManagerTest, NoWakeUpsForCanceledDelayedTasks) { - Initialize(1u); + CreateTaskQueues(1u); base::TimeTicks start_time = manager_->NowTicks(); - CancelableTask task1(&now_src_); - CancelableTask task2(&now_src_); - CancelableTask task3(&now_src_); - CancelableTask task4(&now_src_); + CancelableTask task1(GetTickClock()); + CancelableTask task2(GetTickClock()); + CancelableTask task3(GetTickClock()); + CancelableTask task4(GetTickClock()); base::TimeDelta delay1(base::TimeDelta::FromSeconds(5)); base::TimeDelta delay2(base::TimeDelta::FromSeconds(10)); base::TimeDelta delay3(base::TimeDelta::FromSeconds(15)); @@ -2366,12 +2404,12 @@ std::set<base::TimeTicks> wake_up_times; - RunUntilIdle(base::BindRepeating( + RunUntilManagerIsIdle(base::BindRepeating( [](std::set<base::TimeTicks>* wake_up_times, - base::SimpleTestTickClock* clock) { + const base::TickClock* clock) { wake_up_times->insert(clock->NowTicks()); }, - &wake_up_times, &now_src_)); + &wake_up_times, GetTickClock())); EXPECT_THAT(wake_up_times, ElementsAre(start_time + delay1, start_time + delay4)); @@ -2379,14 +2417,14 @@ } TEST_F(TaskQueueManagerTest, NoWakeUpsForCanceledDelayedTasksReversePostOrder) { - Initialize(1u); + CreateTaskQueues(1u); base::TimeTicks start_time = manager_->NowTicks(); - CancelableTask task1(&now_src_); - CancelableTask task2(&now_src_); - CancelableTask task3(&now_src_); - CancelableTask task4(&now_src_); + CancelableTask task1(GetTickClock()); + CancelableTask task2(GetTickClock()); + CancelableTask task3(GetTickClock()); + CancelableTask task4(GetTickClock()); base::TimeDelta delay1(base::TimeDelta::FromSeconds(5)); base::TimeDelta delay2(base::TimeDelta::FromSeconds(10)); base::TimeDelta delay3(base::TimeDelta::FromSeconds(15)); @@ -2418,12 +2456,12 @@ std::set<base::TimeTicks> wake_up_times; - RunUntilIdle(base::BindRepeating( + RunUntilManagerIsIdle(base::BindRepeating( [](std::set<base::TimeTicks>* wake_up_times, - base::SimpleTestTickClock* clock) { + const base::TickClock* clock) { wake_up_times->insert(clock->NowTicks()); }, - &wake_up_times, &now_src_)); + &wake_up_times, GetTickClock())); EXPECT_THAT(wake_up_times, ElementsAre(start_time + delay1, start_time + delay4)); @@ -2431,14 +2469,14 @@ } TEST_F(TaskQueueManagerTest, TimeDomainWakeUpOnlyCancelledIfAllUsesCancelled) { - Initialize(1u); + CreateTaskQueues(1u); base::TimeTicks start_time = manager_->NowTicks(); - CancelableTask task1(&now_src_); - CancelableTask task2(&now_src_); - CancelableTask task3(&now_src_); - CancelableTask task4(&now_src_); + CancelableTask task1(GetTickClock()); + CancelableTask task2(GetTickClock()); + CancelableTask task3(GetTickClock()); + CancelableTask task4(GetTickClock()); base::TimeDelta delay1(base::TimeDelta::FromSeconds(5)); base::TimeDelta delay2(base::TimeDelta::FromSeconds(10)); base::TimeDelta delay3(base::TimeDelta::FromSeconds(15)); @@ -2479,12 +2517,12 @@ std::set<base::TimeTicks> wake_up_times; - RunUntilIdle(base::BindRepeating( + RunUntilManagerIsIdle(base::BindRepeating( [](std::set<base::TimeTicks>* wake_up_times, - base::SimpleTestTickClock* clock) { + const base::TickClock* clock) { wake_up_times->insert(clock->NowTicks()); }, - &wake_up_times, &now_src_)); + &wake_up_times, GetTickClock())); EXPECT_THAT(wake_up_times, ElementsAre(start_time + delay1, start_time + delay3, @@ -2494,7 +2532,7 @@ } TEST_F(TaskQueueManagerTest, TaskQueueVoters) { - Initialize(1u); + CreateTaskQueues(1u); // The task queue should be initially enabled. EXPECT_TRUE(runners_[0]->IsQueueEnabled()); @@ -2540,7 +2578,7 @@ } TEST_F(TaskQueueManagerTest, ShutdownQueueBeforeEnabledVoterDeleted) { - Initialize(1u); + CreateTaskQueues(1u); scoped_refptr<TaskQueue> queue = CreateTaskQueue(); @@ -2555,7 +2593,7 @@ } TEST_F(TaskQueueManagerTest, ShutdownQueueBeforeDisabledVoterDeleted) { - Initialize(1u); + CreateTaskQueues(1u); scoped_refptr<TaskQueue> queue = CreateTaskQueue(); @@ -2570,12 +2608,12 @@ } TEST_F(TaskQueueManagerTest, SweepCanceledDelayedTasks) { - Initialize(1u); + CreateTaskQueues(1u); - CancelableTask task1(&now_src_); - CancelableTask task2(&now_src_); - CancelableTask task3(&now_src_); - CancelableTask task4(&now_src_); + CancelableTask task1(GetTickClock()); + CancelableTask task2(GetTickClock()); + CancelableTask task3(GetTickClock()); + CancelableTask task4(GetTickClock()); base::TimeDelta delay1(base::TimeDelta::FromSeconds(5)); base::TimeDelta delay2(base::TimeDelta::FromSeconds(10)); base::TimeDelta delay3(base::TimeDelta::FromSeconds(15)); @@ -2618,9 +2656,9 @@ } TEST_F(TaskQueueManagerTest, DelayTillNextTask) { - Initialize(2u); + CreateTaskQueues(2u); - LazyNow lazy_now(&now_src_); + LazyNow lazy_now(GetTickClock()); EXPECT_EQ(base::TimeDelta::Max(), manager_->DelayTillNextTask(&lazy_now)); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), @@ -2647,47 +2685,47 @@ } TEST_F(TaskQueueManagerTest, DelayTillNextTask_Disabled) { - Initialize(1u); + CreateTaskQueues(1u); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = runners_[0]->CreateQueueEnabledVoter(); voter->SetQueueEnabled(false); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&NopTask)); - LazyNow lazy_now(&now_src_); + LazyNow lazy_now(GetTickClock()); EXPECT_EQ(base::TimeDelta::Max(), manager_->DelayTillNextTask(&lazy_now)); } TEST_F(TaskQueueManagerTest, DelayTillNextTask_Fence) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&NopTask)); - LazyNow lazy_now(&now_src_); + LazyNow lazy_now(GetTickClock()); EXPECT_EQ(base::TimeDelta::Max(), manager_->DelayTillNextTask(&lazy_now)); } TEST_F(TaskQueueManagerTest, DelayTillNextTask_FenceUnblocking) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&NopTask)); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); - LazyNow lazy_now(&now_src_); + LazyNow lazy_now(GetTickClock()); EXPECT_EQ(base::TimeDelta(), manager_->DelayTillNextTask(&lazy_now)); } TEST_F(TaskQueueManagerTest, DelayTillNextTask_DelayedTaskReady) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), base::TimeDelta::FromSeconds(1)); - now_src_.Advance(base::TimeDelta::FromSeconds(10)); + test_task_runner_->AdvanceMockTickClock(base::TimeDelta::FromSeconds(10)); - LazyNow lazy_now(&now_src_); + LazyNow lazy_now(GetTickClock()); EXPECT_EQ(base::TimeDelta(), manager_->DelayTillNextTask(&lazy_now)); } @@ -2702,11 +2740,12 @@ } } // namespace -TEST_F(TaskQueueManagerTest, DelayedTaskRunsInNestedMessageLoop) { - InitializeWithRealMessageLoop(1u); +TEST_F(TaskQueueManagerTestWithMessageLoop, + DelayedTaskRunsInNestedMessageLoop) { + CreateTaskQueues(1u); base::RunLoop run_loop; runners_[0]->PostTask( - FROM_HERE, base::BindOnce(&MessageLoopTaskWithDelayedQuit, &now_src_, + FROM_HERE, base::BindOnce(&MessageLoopTaskWithDelayedQuit, &mock_clock_, base::RetainedRef(runners_[0]))); run_loop.RunUntilIdle(); } @@ -2724,9 +2763,9 @@ } } // namespace -TEST_F(TaskQueueManagerTest, +TEST_F(TaskQueueManagerTestWithMessageLoop, DelayedNestedMessageLoopDoesntPreventTasksRunning) { - InitializeWithRealMessageLoop(1u); + CreateTaskQueues(1u); base::RunLoop run_loop; runners_[0]->PostDelayedTask( FROM_HERE, @@ -2734,14 +2773,14 @@ base::RetainedRef(runners_[0])), base::TimeDelta::FromMilliseconds(100)); - now_src_.Advance(base::TimeDelta::FromMilliseconds(200)); + mock_clock_.Advance(base::TimeDelta::FromMilliseconds(200)); run_loop.Run(); } TEST_F(TaskQueueManagerTest, CouldTaskRun_DisableAndReenable) { - Initialize(1u); + CreateTaskQueues(1u); - EnqueueOrder enqueue_order = GetNextSequenceNumber(); + EnqueueOrder enqueue_order = manager_->GetNextSequenceNumber(); EXPECT_TRUE(runners_[0]->GetTaskQueueImpl()->CouldTaskRun(enqueue_order)); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = @@ -2754,9 +2793,9 @@ } TEST_F(TaskQueueManagerTest, CouldTaskRun_Fence) { - Initialize(1u); + CreateTaskQueues(1u); - EnqueueOrder enqueue_order = GetNextSequenceNumber(); + EnqueueOrder enqueue_order = manager_->GetNextSequenceNumber(); EXPECT_TRUE(runners_[0]->GetTaskQueueImpl()->CouldTaskRun(enqueue_order)); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); @@ -2770,11 +2809,11 @@ } TEST_F(TaskQueueManagerTest, CouldTaskRun_FenceBeforeThenAfter) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); - EnqueueOrder enqueue_order = GetNextSequenceNumber(); + EnqueueOrder enqueue_order = manager_->GetNextSequenceNumber(); EXPECT_FALSE(runners_[0]->GetTaskQueueImpl()->CouldTaskRun(enqueue_order)); runners_[0]->InsertFence(TaskQueue::InsertFencePosition::kNow); @@ -2782,30 +2821,27 @@ } TEST_F(TaskQueueManagerTest, DelayedDoWorkNotPostedForDisabledQueue) { - Initialize(1u); + CreateTaskQueues(1u); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), base::TimeDelta::FromMilliseconds(1)); - ASSERT_TRUE(test_task_runner_->HasPendingTasks()); + ASSERT_TRUE(test_task_runner_->HasPendingTask()); EXPECT_EQ(base::TimeDelta::FromMilliseconds(1), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = runners_[0]->CreateQueueEnabledVoter(); voter->SetQueueEnabled(false); - - EXPECT_TRUE(test_task_runner_->HasPendingTasks()); - test_task_runner_->RemoveCancelledTasks(); - EXPECT_FALSE(test_task_runner_->HasPendingTasks()); + EXPECT_FALSE(test_task_runner_->HasPendingTask()); voter->SetQueueEnabled(true); - ASSERT_TRUE(test_task_runner_->HasPendingTasks()); + ASSERT_TRUE(test_task_runner_->HasPendingTask()); EXPECT_EQ(base::TimeDelta::FromMilliseconds(1), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); } TEST_F(TaskQueueManagerTest, DisablingQueuesChangesDelayTillNextDoWork) { - Initialize(3u); + CreateTaskQueues(3u); runners_[0]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), base::TimeDelta::FromMilliseconds(1)); runners_[1]->PostDelayedTask(FROM_HERE, base::BindOnce(&NopTask), @@ -2820,29 +2856,26 @@ std::unique_ptr<TaskQueue::QueueEnabledVoter> voter2 = runners_[2]->CreateQueueEnabledVoter(); - ASSERT_TRUE(test_task_runner_->HasPendingTasks()); + ASSERT_TRUE(test_task_runner_->HasPendingTask()); EXPECT_EQ(base::TimeDelta::FromMilliseconds(1), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); voter0->SetQueueEnabled(false); - test_task_runner_->RemoveCancelledTasks(); - ASSERT_TRUE(test_task_runner_->HasPendingTasks()); + ASSERT_TRUE(test_task_runner_->HasPendingTask()); EXPECT_EQ(base::TimeDelta::FromMilliseconds(10), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); voter1->SetQueueEnabled(false); - test_task_runner_->RemoveCancelledTasks(); - ASSERT_TRUE(test_task_runner_->HasPendingTasks()); + ASSERT_TRUE(test_task_runner_->HasPendingTask()); EXPECT_EQ(base::TimeDelta::FromMilliseconds(100), - test_task_runner_->DelayToNextTaskTime()); + test_task_runner_->NextPendingTaskDelay()); voter2->SetQueueEnabled(false); - test_task_runner_->RemoveCancelledTasks(); - EXPECT_FALSE(test_task_runner_->HasPendingTasks()); + EXPECT_FALSE(test_task_runner_->HasPendingTask()); } TEST_F(TaskQueueManagerTest, GetNextScheduledWakeUp) { - Initialize(1u); + CreateTaskQueues(1u); EXPECT_EQ(base::nullopt, runners_[0]->GetNextScheduledWakeUp()); @@ -2875,7 +2908,7 @@ } TEST_F(TaskQueueManagerTest, SetTimeDomainForDisabledQueue) { - Initialize(1u); + CreateTaskQueues(1u); MockTaskQueueObserver observer; runners_[0]->SetObserver(&observer); @@ -2927,7 +2960,7 @@ } // namespace TEST_F(TaskQueueManagerTest, ProcessTasksWithoutTaskTimeObservers) { - Initialize(1u); + CreateTaskQueues(1u); int start_counter = 0; int complete_counter = 0; std::vector<EnqueueOrder> run_order; @@ -2936,7 +2969,8 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_EQ(start_counter, 3); EXPECT_EQ(complete_counter, 3); EXPECT_THAT(run_order, ElementsAre(1, 2, 3)); @@ -2946,14 +2980,15 @@ runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 4, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 5, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 6, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_EQ(start_counter, 3); EXPECT_EQ(complete_counter, 3); EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4, 5, 6)); } TEST_F(TaskQueueManagerTest, ProcessTasksWithTaskTimeObservers) { - Initialize(1u); + CreateTaskQueues(1u); int start_counter = 0; int complete_counter = 0; @@ -2963,7 +2998,8 @@ std::vector<EnqueueOrder> run_order; runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 1, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 2, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_EQ(start_counter, 2); EXPECT_EQ(complete_counter, 2); EXPECT_THAT(run_order, ElementsAre(1, 2)); @@ -2972,7 +3008,8 @@ EXPECT_FALSE(runners_[0]->GetTaskQueueImpl()->RequiresTaskTiming()); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 3, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 4, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_EQ(start_counter, 2); EXPECT_EQ(complete_counter, 2); EXPECT_THAT(run_order, ElementsAre(1, 2, 3, 4)); @@ -2980,7 +3017,8 @@ manager_->RemoveTaskTimeObserver(&test_task_time_observer_); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 5, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 6, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_EQ(start_counter, 2); EXPECT_EQ(complete_counter, 2); EXPECT_FALSE(runners_[0]->GetTaskQueueImpl()->RequiresTaskTiming()); @@ -2989,7 +3027,8 @@ SetOnTaskHandlers(runners_[0], &start_counter, &complete_counter); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 7, &run_order)); runners_[0]->PostTask(FROM_HERE, base::BindOnce(&TestTask, 8, &run_order)); - test_task_runner_->RunUntilIdle(); + + base::RunLoop().RunUntilIdle(); EXPECT_EQ(start_counter, 4); EXPECT_EQ(complete_counter, 4); EXPECT_TRUE(runners_[0]->GetTaskQueueImpl()->RequiresTaskTiming()); @@ -2998,9 +3037,6 @@ } TEST_F(TaskQueueManagerTest, GracefulShutdown) { - Initialize(0u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - std::vector<base::TimeTicks> run_times; scoped_refptr<TestTaskQueue> main_tq = CreateTaskQueue(); base::WeakPtr<TestTaskQueue> main_tq_weak_ptr = main_tq->GetWeakPtr(); @@ -3011,31 +3047,31 @@ for (int i = 1; i <= 5; ++i) { main_tq->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(i * 100)); } - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(250)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(250)); main_tq = nullptr; // Ensure that task queue went away. EXPECT_FALSE(main_tq_weak_ptr.get()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(1)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(1)); EXPECT_EQ(1u, manager_->ActiveQueuesCount()); EXPECT_EQ(1u, manager_->QueuesToShutdownCount()); EXPECT_EQ(0u, manager_->QueuesToDeleteCount()); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); // Even with TaskQueue gone, tasks are executed. EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(301), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(401), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(501))); + ElementsAre(start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200), + start_time_ + base::TimeDelta::FromMilliseconds(300), + start_time_ + base::TimeDelta::FromMilliseconds(400), + start_time_ + base::TimeDelta::FromMilliseconds(500))); EXPECT_EQ(0u, manager_->ActiveQueuesCount()); EXPECT_EQ(0u, manager_->QueuesToShutdownCount()); @@ -3043,9 +3079,6 @@ } TEST_F(TaskQueueManagerTest, GracefulShutdown_ManagerDeletedInFlight) { - Initialize(0u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - std::vector<base::TimeTicks> run_times; scoped_refptr<TestTaskQueue> control_tq = CreateTaskQueue(); std::vector<scoped_refptr<TestTaskQueue>> main_tqs; @@ -3066,10 +3099,10 @@ for (int i = 1; i <= 5; ++i) { main_tqs[0]->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(i * 100)); } - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(250)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(250)); main_tqs.clear(); // Ensure that task queues went away. @@ -3082,19 +3115,16 @@ // thread. manager_.reset(); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201))); + ElementsAre(start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200))); } TEST_F(TaskQueueManagerTest, GracefulShutdown_ManagerDeletedWithQueuesToShutdown) { - Initialize(0u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - std::vector<base::TimeTicks> run_times; scoped_refptr<TestTaskQueue> main_tq = CreateTaskQueue(); base::WeakPtr<TestTaskQueue> main_tq_weak_ptr = main_tq->GetWeakPtr(); @@ -3105,16 +3135,16 @@ for (int i = 1; i <= 5; ++i) { main_tq->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(i * 100)); } - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(250)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(250)); main_tq = nullptr; // Ensure that task queue went away. EXPECT_FALSE(main_tq_weak_ptr.get()); - test_task_runner_->RunForPeriod(base::TimeDelta::FromMilliseconds(1)); + test_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(1)); EXPECT_EQ(1u, manager_->ActiveQueuesCount()); EXPECT_EQ(1u, manager_->QueuesToShutdownCount()); @@ -3123,15 +3153,15 @@ // Ensure that all queues-to-gracefully-shutdown are properly unregistered. manager_.reset(); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201))); + ElementsAre(start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200))); } -TEST_F(TaskQueueManagerTest, DefaultTaskRunnerSupport) { +TEST_F(TaskQueueManagerTestWithCustomInitialization, DefaultTaskRunnerSupport) { base::MessageLoop message_loop; scoped_refptr<base::SingleThreadTaskRunner> original_task_runner = message_loop.task_runner(); @@ -3148,10 +3178,10 @@ } TEST_F(TaskQueueManagerTest, CanceledTasksInQueueCantMakeOtherTasksSkipAhead) { - Initialize(2u); + CreateTaskQueues(2u); - CancelableTask task1(&now_src_); - CancelableTask task2(&now_src_); + CancelableTask task1(GetTickClock()); + CancelableTask task2(GetTickClock()); std::vector<base::TimeTicks> run_times; runners_[0]->PostTask( @@ -3168,15 +3198,12 @@ task1.weak_factory_.InvalidateWeakPtrs(); task2.weak_factory_.InvalidateWeakPtrs(); - test_task_runner_->RunUntilIdle(); + base::RunLoop().RunUntilIdle(); EXPECT_THAT(run_order, ElementsAre(1, 2)); } TEST_F(TaskQueueManagerTest, TaskQueueDeletedOnAnotherThread) { - Initialize(0u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - std::vector<base::TimeTicks> run_times; scoped_refptr<TestTaskQueue> main_tq = CreateTaskQueue(); @@ -3190,7 +3217,7 @@ for (int i = 1; i <= 5; ++i) { main_tq->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, &now_src_), + FROM_HERE, base::BindOnce(&RecordTimeTask, &run_times, GetTickClock()), base::TimeDelta::FromMilliseconds(i * 100)); } @@ -3219,16 +3246,16 @@ EXPECT_EQ(1u, manager_->QueuesToShutdownCount()); EXPECT_EQ(0u, manager_->QueuesToDeleteCount()); - test_task_runner_->RunUntilIdle(); + test_task_runner_->FastForwardUntilNoTasksRemain(); // Even with TaskQueue gone, tasks are executed. EXPECT_THAT( run_times, - ElementsAre(base::TimeTicks() + base::TimeDelta::FromMilliseconds(101), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(201), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(301), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(401), - base::TimeTicks() + base::TimeDelta::FromMilliseconds(501))); + ElementsAre(start_time_ + base::TimeDelta::FromMilliseconds(100), + start_time_ + base::TimeDelta::FromMilliseconds(200), + start_time_ + base::TimeDelta::FromMilliseconds(300), + start_time_ + base::TimeDelta::FromMilliseconds(400), + start_time_ + base::TimeDelta::FromMilliseconds(500))); EXPECT_EQ(0u, manager_->ActiveQueuesCount()); EXPECT_EQ(0u, manager_->QueuesToShutdownCount()); @@ -3261,9 +3288,6 @@ TEST_F(TaskQueueManagerTest, TaskQueueUsedInTaskDestructorAfterShutdown) { // This test checks that when a task is posted to a shutdown queue and // destroyed, it can try to post a task to the same queue without deadlocks. - Initialize(0u); - test_task_runner_->SetAutoAdvanceNowToPendingTasks(true); - scoped_refptr<TestTaskQueue> main_tq = CreateTaskQueue(); base::WaitableEvent test_executed(
diff --git a/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc b/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc index 9ab36eba..645979c 100644 --- a/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/base/time_domain_unittest.cc
@@ -8,7 +8,6 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/test/simple_test_tick_clock.h" -#include "components/viz/test/ordered_simple_task_runner.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_manager.h"
diff --git a/third_party/blink/renderer/platform/scheduler/common/throttling/budget_pool_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/throttling/budget_pool_unittest.cc index 5cd5849..d4014828 100644 --- a/third_party/blink/renderer/platform/scheduler/common/throttling/budget_pool_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/throttling/budget_pool_unittest.cc
@@ -130,7 +130,7 @@ task_queue_throttler_->CreateWakeUpBudgetPool("test"); scoped_refptr<TaskQueue> queue = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); pool->SetWakeUpRate(0.1); pool->SetWakeUpDuration(base::TimeDelta::FromMilliseconds(10));
diff --git a/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc index 6bfce5aed..92ba5ee 100644 --- a/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler_unittest.cc
@@ -86,7 +86,7 @@ base::nullopt)); task_queue_throttler_ = scheduler_->task_queue_throttler(); timer_queue_ = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); } void TearDown() override { @@ -742,7 +742,7 @@ std::vector<base::TimeTicks> run_times; scoped_refptr<TaskQueue> second_queue = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); CPUTimeBudgetPool* pool = task_queue_throttler_->CreateCPUTimeBudgetPool("test"); @@ -1068,7 +1068,7 @@ scoped_refptr<MainThreadTaskQueue> second_queue = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); task_queue_throttler_->IncreaseThrottleRefCount(timer_queue_.get()); task_queue_throttler_->IncreaseThrottleRefCount(second_queue.get()); @@ -1104,7 +1104,7 @@ std::vector<base::TimeTicks> run_times; scoped_refptr<TaskQueue> second_queue = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); CPUTimeBudgetPool* pool1 = task_queue_throttler_->CreateCPUTimeBudgetPool("test");
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc index d5643a1..1f5ee45 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc
@@ -137,8 +137,7 @@ this, &tracing_controller_, YesNoStateToString), - weak_factory_(this) { -} + weak_factory_(this) {} namespace { @@ -146,7 +145,7 @@ if (!queue) return; queue->DetachFromMainThreadScheduler(); - queue->SetFrameScheduler(nullptr); + queue->DetachFromFrameScheduler(); queue->SetBlameContext(nullptr); queue->SetQueuePriority(TaskQueue::QueuePriority::kLowPriority); } @@ -324,9 +323,8 @@ if (!loading_task_queue_) { // TODO(panicker): Avoid adding this queue in RS task_runners_. loading_task_queue_ = main_thread_scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoading); + MainThreadTaskQueue::QueueType::kFrameLoading, this); loading_task_queue_->SetBlameContext(blame_context_); - loading_task_queue_->SetFrameScheduler(this); loading_queue_enabled_voter_ = loading_task_queue_->CreateQueueEnabledVoter(); loading_queue_enabled_voter_->SetQueueEnabled(!frame_paused_); @@ -338,9 +336,8 @@ DCHECK(parent_page_scheduler_); if (!loading_control_task_queue_) { loading_control_task_queue_ = main_thread_scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoadingControl); + MainThreadTaskQueue::QueueType::kFrameLoadingControl, this); loading_control_task_queue_->SetBlameContext(blame_context_); - loading_control_task_queue_->SetFrameScheduler(this); loading_control_queue_enabled_voter_ = loading_control_task_queue_->CreateQueueEnabledVoter(); loading_control_queue_enabled_voter_->SetQueueEnabled(!frame_paused_); @@ -359,9 +356,9 @@ .SetCanBeFrozen(true) .SetFreezeWhenKeepActive(true) .SetCanBeDeferred(true) - .SetCanBePaused(true)); + .SetCanBePaused(true) + .SetFrameScheduler(this)); throttleable_task_queue_->SetBlameContext(blame_context_); - throttleable_task_queue_->SetFrameScheduler(this); throttleable_queue_enabled_voter_ = throttleable_task_queue_->CreateQueueEnabledVoter(); throttleable_queue_enabled_voter_->SetQueueEnabled(!frame_paused_); @@ -387,9 +384,9 @@ .SetCanBeDeferred(true) .SetCanBeFrozen( RuntimeEnabledFeatures::StopNonTimersInBackgroundEnabled()) - .SetCanBePaused(true)); + .SetCanBePaused(true) + .SetFrameScheduler(this)); deferrable_task_queue_->SetBlameContext(blame_context_); - deferrable_task_queue_->SetFrameScheduler(this); deferrable_queue_enabled_voter_ = deferrable_task_queue_->CreateQueueEnabledVoter(); deferrable_queue_enabled_voter_->SetQueueEnabled(!frame_paused_); @@ -405,9 +402,9 @@ MainThreadTaskQueue::QueueType::kFramePausable) .SetCanBeFrozen( RuntimeEnabledFeatures::StopNonTimersInBackgroundEnabled()) - .SetCanBePaused(true)); + .SetCanBePaused(true) + .SetFrameScheduler(this)); pausable_task_queue_->SetBlameContext(blame_context_); - pausable_task_queue_->SetFrameScheduler(this); pausable_queue_enabled_voter_ = pausable_task_queue_->CreateQueueEnabledVoter(); pausable_queue_enabled_voter_->SetQueueEnabled(!frame_paused_); @@ -420,9 +417,9 @@ if (!unpausable_task_queue_) { unpausable_task_queue_ = main_thread_scheduler_->NewTaskQueue( MainThreadTaskQueue::QueueCreationParams( - MainThreadTaskQueue::QueueType::kFrameUnpausable)); + MainThreadTaskQueue::QueueType::kFrameUnpausable) + .SetFrameScheduler(this)); unpausable_task_queue_->SetBlameContext(blame_context_); - unpausable_task_queue_->SetFrameScheduler(this); } return unpausable_task_queue_; }
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc index 19083505..78d62b5 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_metrics_helper_unittest.cc
@@ -84,7 +84,7 @@ clock_.SetNowTicks(start + duration); scoped_refptr<MainThreadTaskQueueForTest> queue( new MainThreadTaskQueueForTest(QueueType::kDefault)); - queue->SetFrameScheduler(scheduler); + queue->SetFrameSchedulerForTest(scheduler); // Pass an empty task for recording. TaskQueue::PostedTask posted_task(base::OnceClosure(), FROM_HERE); TaskQueue::Task task(std::move(posted_task), base::TimeTicks());
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc index 2d70578..5efafa0 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc
@@ -719,7 +719,8 @@ } scoped_refptr<MainThreadTaskQueue> MainThreadSchedulerImpl::NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType queue_type) { + MainThreadTaskQueue::QueueType queue_type, + FrameSchedulerImpl* frame_scheduler) { DCHECK_EQ(MainThreadTaskQueue::QueueClassForQueueType(queue_type), MainThreadTaskQueue::QueueClass::kLoading); return NewTaskQueue( @@ -730,18 +731,21 @@ .SetCanBeDeferred(true) .SetUsedForImportantTasks( queue_type == - MainThreadTaskQueue::QueueType::kFrameLoadingControl)); + MainThreadTaskQueue::QueueType::kFrameLoadingControl) + .SetFrameScheduler(frame_scheduler)); } scoped_refptr<MainThreadTaskQueue> MainThreadSchedulerImpl::NewTimerTaskQueue( - MainThreadTaskQueue::QueueType queue_type) { + MainThreadTaskQueue::QueueType queue_type, + FrameSchedulerImpl* frame_scheduler) { DCHECK_EQ(MainThreadTaskQueue::QueueClassForQueueType(queue_type), MainThreadTaskQueue::QueueClass::kTimer); return NewTaskQueue(MainThreadTaskQueue::QueueCreationParams(queue_type) .SetCanBePaused(true) .SetCanBeFrozen(true) .SetCanBeDeferred(true) - .SetCanBeThrottled(true)); + .SetCanBeThrottled(true) + .SetFrameScheduler(frame_scheduler)); } std::unique_ptr<WebRenderWidgetSchedulingState> @@ -1562,8 +1566,7 @@ new_policy.timer_queue_policy().use_virtual_time = true; } - new_policy.should_disable_throttling() = - main_thread_only().use_virtual_time; + new_policy.should_disable_throttling() = main_thread_only().use_virtual_time; // Tracing is done before the early out check, because it's quite possible we // will otherwise miss this information in traces.
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h index 860205e..abb85ee 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/platform/scheduler/main_thread/task_cost_estimator.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/use_case.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/user_model.h" +#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/util/tracing_helper.h" namespace base { @@ -170,11 +171,13 @@ // to resource dispatch, foreground HTML parsing, etc... // Note: Tasks posted to kFrameLoadingControl queues must execute quickly. scoped_refptr<MainThreadTaskQueue> NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType queue_type); + MainThreadTaskQueue::QueueType queue_type, + FrameSchedulerImpl* frame_scheduler); // Returns a new timer task queue. This queue is intended for DOM Timers. scoped_refptr<MainThreadTaskQueue> NewTimerTaskQueue( - MainThreadTaskQueue::QueueType queue_type); + MainThreadTaskQueue::QueueType queue_type, + FrameSchedulerImpl* frame_scheduler); // Returns a task queue where tasks run at the highest possible priority. scoped_refptr<MainThreadTaskQueue> ControlTaskQueue();
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl_unittest.cc index 9b7fefc..9b87ef5 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl_unittest.cc
@@ -310,15 +310,15 @@ compositor_task_runner_ = scheduler_->CompositorTaskQueue(); input_task_runner_ = scheduler_->InputTaskQueue(); loading_task_runner_ = scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoading); + MainThreadTaskQueue::QueueType::kFrameLoading, nullptr); loading_control_task_runner_ = scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoadingControl); + MainThreadTaskQueue::QueueType::kFrameLoadingControl, nullptr); idle_task_runner_ = scheduler_->IdleTaskRunner(); timer_task_runner_ = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); v8_task_runner_ = scheduler_->V8TaskQueue(); fake_queue_ = scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoading); + MainThreadTaskQueue::QueueType::kFrameLoading, nullptr); } void TearDown() override { @@ -3610,7 +3610,7 @@ scheduler_->SetVirtualTimePolicy( PageSchedulerImpl::VirtualTimePolicy::kPause); scoped_refptr<MainThreadTaskQueue> timer_tq = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); EXPECT_FALSE(timer_tq->HasActiveFence()); } @@ -3621,11 +3621,11 @@ EXPECT_TRUE(scheduler_->IsVirtualTimeEnabled()); scoped_refptr<MainThreadTaskQueue> loading_tq = scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoading); + MainThreadTaskQueue::QueueType::kFrameLoading, nullptr); scoped_refptr<TaskQueue> loading_control_tq = scheduler_->NewLoadingTaskQueue( - MainThreadTaskQueue::QueueType::kFrameLoadingControl); + MainThreadTaskQueue::QueueType::kFrameLoadingControl, nullptr); scoped_refptr<MainThreadTaskQueue> timer_tq = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); scoped_refptr<MainThreadTaskQueue> unthrottled_tq = scheduler_->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( MainThreadTaskQueue::QueueType::kUnthrottled)); @@ -3654,14 +3654,14 @@ EXPECT_EQ(unthrottled_tq->GetTimeDomain(), scheduler_->GetVirtualTimeDomain()); - EXPECT_EQ( - scheduler_ - ->NewLoadingTaskQueue(MainThreadTaskQueue::QueueType::kFrameLoading) - ->GetTimeDomain(), - scheduler_->GetVirtualTimeDomain()); + EXPECT_EQ(scheduler_ + ->NewLoadingTaskQueue( + MainThreadTaskQueue::QueueType::kFrameLoading, nullptr) + ->GetTimeDomain(), + scheduler_->GetVirtualTimeDomain()); EXPECT_EQ(scheduler_ ->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable) + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr) ->GetTimeDomain(), scheduler_->GetVirtualTimeDomain()); EXPECT_EQ(scheduler_ @@ -3703,7 +3703,7 @@ MainThreadSchedulerImpl::BaseTimeOverridePolicy::DO_NOT_OVERRIDE); scoped_refptr<MainThreadTaskQueue> timer_tq = scheduler_->NewTimerTaskQueue( - MainThreadTaskQueue::QueueType::kFrameThrottleable); + MainThreadTaskQueue::QueueType::kFrameThrottleable, nullptr); scoped_refptr<MainThreadTaskQueue> unthrottled_tq = scheduler_->NewTaskQueue(MainThreadTaskQueue::QueueCreationParams( MainThreadTaskQueue::QueueType::kUnthrottled));
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.cc b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.cc index 34c19f7..c1c3b8f 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.cc
@@ -104,7 +104,7 @@ freeze_when_keep_active_(params.freeze_when_keep_active), used_for_important_tasks_(params.used_for_important_tasks), main_thread_scheduler_(main_thread_scheduler), - frame_scheduler_(nullptr) { + frame_scheduler_(params.frame_scheduler) { if (GetTaskQueueImpl()) { // TaskQueueImpl may be null for tests. // TODO(scheduler-dev): Consider mapping directly to @@ -170,8 +170,13 @@ return frame_scheduler_; } -void MainThreadTaskQueue::SetFrameScheduler(FrameScheduler* frame) { - frame_scheduler_ = frame; +void MainThreadTaskQueue::DetachFromFrameScheduler() { + frame_scheduler_ = nullptr; +} + +void MainThreadTaskQueue::SetFrameSchedulerForTest( + FrameScheduler* frame_scheduler) { + frame_scheduler_ = frame_scheduler; } } // namespace scheduler
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h index 6662138c1..2f73ebb 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/main_thread_task_queue.h
@@ -7,6 +7,8 @@ #include "third_party/blink/renderer/platform/scheduler/base/task_queue.h" #include "third_party/blink/renderer/platform/scheduler/base/task_queue_impl.h" +#include "third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h" +#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" namespace blink { @@ -77,6 +79,7 @@ explicit QueueCreationParams(QueueType queue_type) : queue_type(queue_type), spec(NameForQueueType(queue_type)), + frame_scheduler(nullptr), can_be_deferred(false), can_be_throttled(false), can_be_paused(false), @@ -122,6 +125,10 @@ // Forwarded calls to |spec|. + QueueCreationParams SetFrameScheduler(FrameSchedulerImpl* scheduler) { + frame_scheduler = scheduler; + return *this; + } QueueCreationParams SetShouldMonitorQuiescence(bool should_monitor) { spec = spec.SetShouldMonitorQuiescence(should_monitor); return *this; @@ -140,7 +147,7 @@ QueueType queue_type; TaskQueue::Spec spec; base::Optional<TaskQueue::QueuePriority> fixed_priority; - FrameScheduler* frame_; + FrameScheduler* frame_scheduler; bool can_be_deferred; bool can_be_throttled; bool can_be_paused; @@ -184,9 +191,11 @@ void ShutdownTaskQueue() override; FrameScheduler* GetFrameScheduler() const; - void SetFrameScheduler(FrameScheduler* frame); + void DetachFromFrameScheduler(); protected: + void SetFrameSchedulerForTest(FrameScheduler* frame); + MainThreadTaskQueue(std::unique_ptr<internal::TaskQueueImpl> impl, const Spec& spec, const QueueCreationParams& params,
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/queueing_time_estimator_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/queueing_time_estimator_unittest.cc index bc489ae9..d842b33 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/queueing_time_estimator_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/queueing_time_estimator_unittest.cc
@@ -857,7 +857,7 @@ FakeFrameScheduler::Builder() .SetFrameType(FrameScheduler::FrameType::kMainFrame) .Build(); - queue1->SetFrameScheduler(frame1.get()); + queue1->SetFrameSchedulerForTest(frame1.get()); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(3000); estimator.OnTopLevelTaskCompleted(time); @@ -871,14 +871,14 @@ .SetIsPageVisible(true) .SetIsFrameVisible(true) .Build(); - queue1->SetFrameScheduler(frame2.get()); + queue1->SetFrameSchedulerForTest(frame2.get()); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(2000); estimator.OnTopLevelTaskCompleted(time); scoped_refptr<MainThreadTaskQueueForTest> queue2( new MainThreadTaskQueueForTest(QueueType::kTest)); - queue2->SetFrameScheduler(frame2.get()); + queue2->SetFrameSchedulerForTest(frame2.get()); time += base::TimeDelta::FromMilliseconds(1000); estimator.OnTopLevelTaskStarted(time, queue2.get()); time += base::TimeDelta::FromMilliseconds(2000); @@ -893,7 +893,7 @@ .SetIsFrameVisible(true) .SetIsExemptFromThrottling(true) .Build(); - queue1->SetFrameScheduler(frame3.get()); + queue1->SetFrameSchedulerForTest(frame3.get()); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(3000); estimator.OnTopLevelTaskCompleted(time); @@ -905,7 +905,7 @@ .SetIsFrameVisible(true) .SetIsExemptFromThrottling(true) .Build(); - queue1->SetFrameScheduler(frame4.get()); + queue1->SetFrameSchedulerForTest(frame4.get()); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(3000); // 1000 ms after beginning of window 4. @@ -936,7 +936,7 @@ FakeFrameScheduler* schedulers_for_thousand[] = {frame5.get(), frame6.get(), frame7.get()}; for (auto* scheduler : schedulers_for_thousand) { - queue1->SetFrameScheduler(scheduler); + queue1->SetFrameSchedulerForTest(scheduler); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(1000); estimator.OnTopLevelTaskCompleted(time); @@ -972,7 +972,7 @@ frame2.get(), frame1.get(), frame8.get(), frame5.get(), frame6.get(), frame9.get(), frame7.get(), frame10.get(), frame11.get()}; for (auto* scheduler : schedulers_for_four_hundred) { - queue1->SetFrameScheduler(scheduler); + queue1->SetFrameSchedulerForTest(scheduler); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(400); estimator.OnTopLevelTaskCompleted(time); @@ -983,7 +983,7 @@ time += base::TimeDelta::FromMilliseconds(300); estimator.OnTopLevelTaskCompleted(time); - queue1->SetFrameScheduler(nullptr); + queue1->DetachFromFrameScheduler(); estimator.OnTopLevelTaskStarted(time, queue1.get()); time += base::TimeDelta::FromMilliseconds(300); estimator.OnTopLevelTaskCompleted(time);
diff --git a/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h b/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h index 0f830e82..2b37af8 100644 --- a/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h +++ b/third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h
@@ -16,6 +16,8 @@ class MainThreadTaskQueueForTest : public MainThreadTaskQueue { public: + using MainThreadTaskQueue::SetFrameSchedulerForTest; + MainThreadTaskQueueForTest(QueueType queue_type) : MainThreadTaskQueue(nullptr, Spec(MainThreadTaskQueue::NameForQueueType(
diff --git a/third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.cc b/third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.cc new file mode 100644 index 0000000..f1a65fc --- /dev/null +++ b/third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.cc
@@ -0,0 +1,140 @@ +// Copyright 2014 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/scroll/scrollbar_layer_delegate.h" + +#include "third_party/blink/public/platform/web_point.h" +#include "third_party/blink/public/platform/web_rect.h" +#include "third_party/blink/public/platform/web_scrollbar.h" +#include "third_party/blink/public/platform/web_scrollbar_theme_geometry.h" + +namespace blink { + +ScrollbarLayerDelegate::ScrollbarLayerDelegate( + std::unique_ptr<WebScrollbar> scrollbar, + WebScrollbarThemePainter painter, + std::unique_ptr<WebScrollbarThemeGeometry> geometry) + : scrollbar_(std::move(scrollbar)), + painter_(painter), + geometry_(std::move(geometry)) {} + +ScrollbarLayerDelegate::~ScrollbarLayerDelegate() = default; + +cc::ScrollbarOrientation ScrollbarLayerDelegate::Orientation() const { + if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) + return cc::HORIZONTAL; + return cc::VERTICAL; +} + +bool ScrollbarLayerDelegate::IsLeftSideVerticalScrollbar() const { + return scrollbar_->IsLeftSideVerticalScrollbar(); +} + +bool ScrollbarLayerDelegate::HasThumb() const { + return geometry_->HasThumb(scrollbar_.get()); +} + +bool ScrollbarLayerDelegate::IsOverlay() const { + return scrollbar_->IsOverlay(); +} + +gfx::Point ScrollbarLayerDelegate::Location() const { + return static_cast<gfx::Point>(scrollbar_->Location()); +} + +int ScrollbarLayerDelegate::ThumbThickness() const { + auto thumb_rect = + static_cast<gfx::Rect>(geometry_->ThumbRect(scrollbar_.get())); + if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) + return thumb_rect.height(); + return thumb_rect.width(); +} + +int ScrollbarLayerDelegate::ThumbLength() const { + auto thumb_rect = + static_cast<gfx::Rect>(geometry_->ThumbRect(scrollbar_.get())); + if (scrollbar_->GetOrientation() == WebScrollbar::kHorizontal) + return thumb_rect.width(); + return thumb_rect.height(); +} + +gfx::Rect ScrollbarLayerDelegate::TrackRect() const { + return static_cast<gfx::Rect>(geometry_->TrackRect(scrollbar_.get())); +} + +float ScrollbarLayerDelegate::ThumbOpacity() const { + return painter_.ThumbOpacity(); +} + +bool ScrollbarLayerDelegate::NeedsPaintPart(cc::ScrollbarPart part) const { + if (part == cc::THUMB) + return painter_.ThumbNeedsRepaint(); + return painter_.TrackNeedsRepaint(); +} + +bool ScrollbarLayerDelegate::UsesNinePatchThumbResource() const { + return painter_.UsesNinePatchThumbResource(); +} + +gfx::Size ScrollbarLayerDelegate::NinePatchThumbCanvasSize() const { + return static_cast<gfx::Size>( + geometry_->NinePatchThumbCanvasSize(scrollbar_.get())); +} + +gfx::Rect ScrollbarLayerDelegate::NinePatchThumbAperture() const { + return static_cast<gfx::Rect>( + geometry_->NinePatchThumbAperture(scrollbar_.get())); +} + +bool ScrollbarLayerDelegate::HasTickmarks() const { + return scrollbar_->HasTickmarks(); +} + +void ScrollbarLayerDelegate::PaintPart(cc::PaintCanvas* canvas, + cc::ScrollbarPart part, + const gfx::Rect& content_rect) { + if (part == cc::THUMB) { + painter_.PaintThumb(canvas, WebRect(content_rect)); + return; + } + + if (part == cc::TICKMARKS) { + painter_.PaintTickmarks(canvas, WebRect(content_rect)); + return; + } + + // The following is a simplification of ScrollbarThemeComposite::paint. + painter_.PaintScrollbarBackground(canvas, WebRect(content_rect)); + + if (geometry_->HasButtons(scrollbar_.get())) { + WebRect back_button_start_paint_rect = + geometry_->BackButtonStartRect(scrollbar_.get()); + painter_.PaintBackButtonStart(canvas, back_button_start_paint_rect); + + WebRect back_button_end_paint_rect = + geometry_->BackButtonEndRect(scrollbar_.get()); + painter_.PaintBackButtonEnd(canvas, back_button_end_paint_rect); + + WebRect forward_button_start_paint_rect = + geometry_->ForwardButtonStartRect(scrollbar_.get()); + painter_.PaintForwardButtonStart(canvas, forward_button_start_paint_rect); + + WebRect forward_button_end_paint_rect = + geometry_->ForwardButtonEndRect(scrollbar_.get()); + painter_.PaintForwardButtonEnd(canvas, forward_button_end_paint_rect); + } + + WebRect track_paint_rect = geometry_->TrackRect(scrollbar_.get()); + painter_.PaintTrackBackground(canvas, track_paint_rect); + + bool thumb_present = geometry_->HasThumb(scrollbar_.get()); + if (thumb_present) { + painter_.PaintForwardTrackPart(canvas, track_paint_rect); + painter_.PaintBackTrackPart(canvas, track_paint_rect); + } + + painter_.PaintTickmarks(canvas, track_paint_rect); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.h b/third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.h new file mode 100644 index 0000000..e3a016b --- /dev/null +++ b/third_party/blink/renderer/platform/scroll/scrollbar_layer_delegate.h
@@ -0,0 +1,59 @@ +// Copyright 2014 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_SCROLL_SCROLLBAR_LAYER_DELEGATE_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_LAYER_DELEGATE_H_ + +#include <memory> + +#include "base/macros.h" +#include "cc/input/scrollbar.h" +#include "cc/paint/paint_canvas.h" +#include "third_party/blink/public/platform/web_scrollbar_theme_painter.h" +#include "third_party/blink/renderer/platform/platform_export.h" + +namespace blink { +class WebScrollbar; +class WebScrollbarThemeGeometry; + +// Implementation of cc::Scrollbar, providing a delegate to query about +// scrollbar state and to paint the image in the scrollbar. +class PLATFORM_EXPORT ScrollbarLayerDelegate : public cc::Scrollbar { + public: + ScrollbarLayerDelegate(std::unique_ptr<WebScrollbar> scrollbar, + WebScrollbarThemePainter painter, + std::unique_ptr<WebScrollbarThemeGeometry> geometry); + ~ScrollbarLayerDelegate() override; + + // cc::Scrollbar implementation. + cc::ScrollbarOrientation Orientation() const override; + bool IsLeftSideVerticalScrollbar() const override; + bool HasThumb() const override; + bool IsOverlay() const override; + gfx::Point Location() const override; + int ThumbThickness() const override; + int ThumbLength() const override; + gfx::Rect TrackRect() const override; + float ThumbOpacity() const override; + bool NeedsPaintPart(cc::ScrollbarPart part) const override; + bool HasTickmarks() const override; + void PaintPart(cc::PaintCanvas* canvas, + cc::ScrollbarPart part, + const gfx::Rect& content_rect) override; + + bool UsesNinePatchThumbResource() const override; + gfx::Size NinePatchThumbCanvasSize() const override; + gfx::Rect NinePatchThumbAperture() const override; + + private: + std::unique_ptr<WebScrollbar> scrollbar_; + WebScrollbarThemePainter painter_; + std::unique_ptr<WebScrollbarThemeGeometry> geometry_; + + DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerDelegate); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCROLL_SCROLLBAR_LAYER_DELEGATE_H_
diff --git a/third_party/blink/renderer/platform/testing/testing_platform_support.cc b/third_party/blink/renderer/platform/testing/testing_platform_support.cc index 63622fa1..dc84d59 100644 --- a/third_party/blink/renderer/platform/testing/testing_platform_support.cc +++ b/third_party/blink/renderer/platform/testing/testing_platform_support.cc
@@ -41,11 +41,9 @@ #include "cc/blink/web_compositor_support_impl.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "third_party/blink/public/platform/interface_provider.h" -#include "third_party/blink/public/platform/web_content_layer.h" #include "third_party/blink/public/platform/web_external_texture_layer.h" #include "third_party/blink/public/platform/web_image_layer.h" #include "third_party/blink/public/platform/web_runtime_features.h" -#include "third_party/blink/public/platform/web_scrollbar_layer.h" #include "third_party/blink/renderer/platform/font_family_names.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/instrumentation/resource_coordinator/blink_resource_coordinator_base.h" @@ -90,49 +88,15 @@ } // namespace -std::unique_ptr<WebLayer> TestingCompositorSupport::CreateLayer() { - return nullptr; -} - std::unique_ptr<WebLayer> TestingCompositorSupport::CreateLayerFromCCLayer( cc::Layer*) { return nullptr; } -std::unique_ptr<WebContentLayer> TestingCompositorSupport::CreateContentLayer( - cc::ContentLayerClient*) { - return nullptr; -} - std::unique_ptr<WebImageLayer> TestingCompositorSupport::CreateImageLayer() { return nullptr; } -std::unique_ptr<WebScrollbarLayer> -TestingCompositorSupport::CreateScrollbarLayer( - std::unique_ptr<WebScrollbar>, - WebScrollbarThemePainter, - std::unique_ptr<WebScrollbarThemeGeometry>) { - return nullptr; -} - -std::unique_ptr<WebScrollbarLayer> -TestingCompositorSupport::CreateOverlayScrollbarLayer( - std::unique_ptr<WebScrollbar>, - WebScrollbarThemePainter, - std::unique_ptr<WebScrollbarThemeGeometry>) { - return nullptr; -} - -std::unique_ptr<WebScrollbarLayer> -TestingCompositorSupport::CreateSolidColorScrollbarLayer( - WebScrollbar::Orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar) { - return nullptr; -} - TestingPlatformSupport::TestingPlatformSupport() : TestingPlatformSupport(TestingPlatformSupport::Config()) {}
diff --git a/third_party/blink/renderer/platform/testing/testing_platform_support.h b/third_party/blink/renderer/platform/testing/testing_platform_support.h index fae881d..cb77853 100644 --- a/third_party/blink/renderer/platform/testing/testing_platform_support.h +++ b/third_party/blink/renderer/platform/testing/testing_platform_support.h
@@ -54,24 +54,8 @@ class WebThread; class TestingCompositorSupport : public WebCompositorSupport { - std::unique_ptr<WebLayer> CreateLayer() override; std::unique_ptr<WebLayer> CreateLayerFromCCLayer(cc::Layer*) override; - std::unique_ptr<WebContentLayer> CreateContentLayer( - cc::ContentLayerClient*) override; std::unique_ptr<WebImageLayer> CreateImageLayer() override; - std::unique_ptr<WebScrollbarLayer> CreateScrollbarLayer( - std::unique_ptr<WebScrollbar>, - WebScrollbarThemePainter, - std::unique_ptr<WebScrollbarThemeGeometry>) override; - std::unique_ptr<WebScrollbarLayer> CreateOverlayScrollbarLayer( - std::unique_ptr<WebScrollbar>, - WebScrollbarThemePainter, - std::unique_ptr<WebScrollbarThemeGeometry>) override; - std::unique_ptr<WebScrollbarLayer> CreateSolidColorScrollbarLayer( - WebScrollbar::Orientation, - int thumb_thickness, - int track_start, - bool is_left_side_vertical_scrollbar) override; }; // A base class to override Platform methods for testing. You can override the
diff --git a/third_party/blink/renderer/platform/timer_test.cc b/third_party/blink/renderer/platform/timer_test.cc index a1ed6d6..5368a83 100644 --- a/third_party/blink/renderer/platform/timer_test.cc +++ b/third_party/blink/renderer/platform/timer_test.cc
@@ -607,7 +607,8 @@ TEST_F(TimerTest, UserSuppliedTaskRunner) { scoped_refptr<scheduler::TaskQueue> task_runner( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl = scheduler::TaskRunnerImpl::Create(task_runner, TaskType::kInternalTest); TimerForTest<TimerTest> timer(task_runner_impl, this, @@ -702,7 +703,8 @@ scoped_refptr<scheduler::TaskQueue> task_runner1( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl1 = scheduler::TaskRunnerImpl::Create(task_runner1, TaskType::kInternalTest); TaskObserver task_observer1(task_runner_impl1, &run_order); @@ -710,7 +712,8 @@ scoped_refptr<scheduler::TaskQueue> task_runner2( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl2 = scheduler::TaskRunnerImpl::Create(task_runner2, TaskType::kInternalTest); TaskObserver task_observer2(task_runner_impl2, &run_order); @@ -742,7 +745,8 @@ scoped_refptr<scheduler::TaskQueue> task_runner1( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl1 = scheduler::TaskRunnerImpl::Create(task_runner1, TaskType::kInternalTest); TaskObserver task_observer1(task_runner_impl1, &run_order); @@ -750,7 +754,8 @@ scoped_refptr<scheduler::TaskQueue> task_runner2( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl2 = scheduler::TaskRunnerImpl::Create(task_runner2, TaskType::kInternalTest); TaskObserver task_observer2(task_runner_impl2, &run_order); @@ -784,13 +789,15 @@ TEST_F(TimerTest, MoveToNewTaskRunnerWithoutTasks) { scoped_refptr<scheduler::TaskQueue> task_runner1( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl1 = scheduler::TaskRunnerImpl::Create(task_runner1, TaskType::kInternalTest); scoped_refptr<scheduler::TaskQueue> task_runner2( platform_->GetMainThreadScheduler()->NewTimerTaskQueue( - scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable)); + scheduler::MainThreadTaskQueue::QueueType::kFrameThrottleable, + nullptr)); scoped_refptr<scheduler::TaskRunnerImpl> task_runner_impl2 = scheduler::TaskRunnerImpl::Create(task_runner2, TaskType::kInternalTest);
diff --git a/third_party/blink/tools/audit_non_blink_usage.py b/third_party/blink/tools/audit_non_blink_usage.py index 5dbcf2a..af2b08bd 100755 --- a/third_party/blink/tools/audit_non_blink_usage.py +++ b/third_party/blink/tools/audit_non_blink_usage.py
@@ -80,6 +80,7 @@ 'base::FEATURE_.+', # Chromium geometry types. + 'gfx::Point', 'gfx::Rect', 'gfx::RectF', 'gfx::Size', @@ -92,10 +93,24 @@ # depends on the geometry types above. 'cc::TouchActionRegion', + # cc::Layers. + 'cc::Layer', + # cc::Layer helper data structs. + 'cc::ElementId', 'cc::LayerPositionConstraint', 'cc::LayerStickyPositionConstraint', 'cc::OverscrollBehavior', + 'cc::Scrollbar', + 'cc::ScrollbarLayerInterface', + 'cc::ScrollbarOrientation', + 'cc::ScrollbarPart', + + # cc::Layer helper enums. + 'cc::HORIZONTAL', + 'cc::VERTICAL', + 'cc::THUMB', + 'cc::TICKMARKS', # Standalone utility libraries that only depend on //base 'skia::.+', @@ -174,15 +189,34 @@ 'cc::ContentLayerClient', 'cc::DisplayItemList', 'cc::DrawRecordOp', + 'cc::PictureLayer', ], }, { - 'paths': ['third_party/blink/renderer/core/inspector/InspectorMemoryAgent.cpp'], + 'paths': ['third_party/blink/renderer/core/page/scrolling'], + 'allowed': [ + # cc painting types. + 'cc::PaintCanvas', + + # cc scrollbar layer types. + 'cc::PaintedOverlayScrollbarLayer', + 'cc::PaintedScrollbarLayer', + 'cc::SolidColorScrollbarLayer', + ], + }, + { + 'paths': ['third_party/blink/renderer/core/inspector/inspector_memory_agent.cc'], 'allowed': [ 'base::SamplingHeapProfiler', ], }, { + 'paths': ['third_party/blink/renderer/core/inspector/inspector_performance_agent.cc'], + 'allowed': [ + 'base::subtle::TimeTicksNowIgnoringOverride', + ], + }, + { 'paths': [ 'third_party/blink/renderer/modules/device_orientation/', 'third_party/blink/renderer/modules/gamepad/',
diff --git a/third_party/boringssl/OWNERS b/third_party/boringssl/OWNERS index 019db92..77896b30 100644 --- a/third_party/boringssl/OWNERS +++ b/third_party/boringssl/OWNERS
@@ -1,5 +1,6 @@ agl@chromium.org davidben@chromium.org rsleevi@chromium.org +svaldez@chromium.org # COMPONENT: Internals>Network>SSL
diff --git a/third_party/fuchsia-sdk/BUILD.gn b/third_party/fuchsia-sdk/BUILD.gn index d6951f1a..e6e83d5 100644 --- a/third_party/fuchsia-sdk/BUILD.gn +++ b/third_party/fuchsia-sdk/BUILD.gn
@@ -166,7 +166,7 @@ ] } -fuchsia_sdk_pkg("fdio") { +fuchsia_sdk_lib_pkg("fdio") { sources = [ "include/fdio/debug.h", "include/fdio/io.fidl.h",
diff --git a/third_party/googletest/BUILD.gn b/third_party/googletest/BUILD.gn index ce735df1..e24ed95 100644 --- a/third_party/googletest/BUILD.gn +++ b/third_party/googletest/BUILD.gn
@@ -92,9 +92,7 @@ defines = [] if (is_nacl || !build_with_chromium) { - defines += [ - "GTEST_DISABLE_PRINT_STACK_TRACE" - ] + defines += [ "GTEST_DISABLE_PRINT_STACK_TRACE" ] sources -= [ "custom/gtest/internal/custom/stack_trace_getter.cc", "custom/gtest/internal/custom/stack_trace_getter.h", @@ -103,6 +101,9 @@ deps = [ "//base", ] + if (is_fuchsia) { + deps += [ "//third_party/fuchsia-sdk:launchpad" ] + } } }
diff --git a/third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v1.xml b/third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v1.xml index 30e0e7b..137fde11 100644 --- a/third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v1.xml +++ b/third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v1.xml
@@ -74,7 +74,7 @@ <enum name="error"> <entry name="role" value="0" summary="given wl_surface has another role"/> <entry name="invalid_notification_key" value="1" - summary="invalid notification key"/> + summary="invalid notification key"/> </enum> <enum name="layout_mode"> @@ -202,7 +202,7 @@ <enum name="systemui_visibility_state"> <description summary="systemui visibility behavior"> - Determine the visibility behavior of the system UI. + Determine the visibility behavior of the system UI. </description> <entry name="visible" value="1" summary="system ui is visible"/> <entry name="autohide_non_sticky" value="2" summary="system ui autohides and is not sticky"/> @@ -211,7 +211,7 @@ <enum name="orientation"> <description summary="window orientation"> - The orientation of the window. + The orientation of the window. </description> <entry name="portrait" value="1" summary="portrait"/> <entry name="landscape" value="2" summary="landscape"/> @@ -219,7 +219,7 @@ <enum name="window_type"> <description summary="window type"> - The type of the window. + The type of the window. </description> <entry name="normal" value="1" summary="normal app window"/> <entry name="system_ui" value="2" summary="window is treated as systemui"/> @@ -291,7 +291,7 @@ <arg name="y" type="int"/> <arg name="width" type="int"/> <arg name="height" type="int"/> - </request> + </request> <request name="set_rectangular_shadow_background_opacity"> <description summary="suggests the window's background opacity"> @@ -629,7 +629,7 @@ <enum name="bounds_change_reason"> <description summary="bounds_change_reason"> - Specifies the cause of the window bounds change event. + Specifies the cause of the window bounds change event. </description> <entry name="drag_move" value="1" summary="the window is being moved by drag operation"/> <entry name="drag_resize" value="2" summary="the window is being resized by drag operation."/> @@ -767,13 +767,13 @@ <request name="set_snapped_to_left" since="11"> <description summary="set the surface to left snapped"> - Request that surface is snapped to left. + Request that surface is snapped to left. </description> </request> <request name="set_snapped_to_right" since="11"> <description summary="set the surface to right snapped"> - Request that surface is snapped to right. + Request that surface is snapped to right. </description> </request> @@ -822,7 +822,7 @@ <enum name="frame_button_type"> <description summary="frame button types"> - The mask that represents buttons on frame. + The mask that represents buttons on frame. </description> <entry name="back" value="1" summary="a button to naviate backwards"/> <entry name="minimize" value="2" summary="a button to minimize the window"/> @@ -888,7 +888,7 @@ <request name="pip" since="15"> <description summary="set pip for a remote surface"> - Request that surface is set to Picture-in-Picture (PIP). + Request that surface is set to Picture-in-Picture (PIP). </description> </request> @@ -910,7 +910,7 @@ <request name="set_app_id" since="2"> <description summary="set application ID"> - Set an application identifier for the notification surface. + Set an application identifier for the notification surface. </description> <arg name="app_id" type="string"/> </request>
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp index ae4bb2eb..7802f4b 100644 --- a/tools/clang/plugins/ChromeClassTester.cpp +++ b/tools/clang/plugins/ChromeClassTester.cpp
@@ -154,11 +154,7 @@ break; } record_location = -#if defined(LLVM_FORCE_HEAD_REVISION) source_manager.getImmediateExpansionRange(record_location).getBegin(); -#else - source_manager.getImmediateExpansionRange(record_location).first; -#endif } return false;
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 52a3af8..588d136 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -27,7 +27,7 @@ # Do NOT CHANGE this if you don't know what you're doing -- see # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. -CLANG_REVISION = '330570' +CLANG_REVISION = '331747' use_head_revision = bool(os.environ.get('LLVM_FORCE_HEAD_REVISION', '0') in ('1', 'YES')) @@ -35,7 +35,7 @@ CLANG_REVISION = 'HEAD' # This is incremented when pushing a new build of Clang at the same revision. -CLANG_SUB_REVISION=2 +CLANG_SUB_REVISION=1 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 3b24fa2..7ffc1651 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -18170,6 +18170,16 @@ </description> </action> +<action name="StatusArea_DictationDisabled"> + <owner>zhelfins@chromium.org</owner> + <description>Ash system menu: Accessibility: Disable Dictation.</description> +</action> + +<action name="StatusArea_DictationEnabled"> + <owner>zhelfins@chromium.org</owner> + <description>Ash system menu: Accessibility: Enable Dictation.</description> +</action> + <action name="StatusArea_Display_Default_Selected"> <owner>bruthig@chromium.org</owner> <owner>tbuckley@chromium.org</owner>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index d483fd79..2a60033 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -13156,7 +13156,7 @@ <int value="429" label="SafeBrowsingExtendedReportingEnabled"/> <int value="430" label="AutoplayAllowed"/> <int value="431" label="AutoplayWhitelist"/> - <int value="432" label="TabUnderProtectionEnabled"/> + <int value="432" label="TabUnderAllowed"/> <int value="433" label="UserNativePrintersAllowed"/> <int value="434" label="DefaultWebUsbGuardSetting"/> <int value="435" label="CertificateTransparencyEnforcementDisabledForCas"/> @@ -18597,6 +18597,7 @@ <int value="2431" label="CSSSelectorPseudoIS"/> <int value="2432" label="KeyboardApiGetLayoutMap"/> <int value="2433" label="WebRtcVaapiHWVP8Encoding"/> + <int value="2434" label="PerformanceResourceTimingInitiatorType"/> </enum> <enum name="FeedbackSource">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index ed6fcae6..d3289dc 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -1570,16 +1570,29 @@ </summary> </histogram> -<histogram name="Android.PhotoPicker.DecoderHostSuccess" units="%"> +<histogram name="Android.PhotoPicker.DecoderHostFailureOutOfMemory" units="%"> <owner>finnur@chromium.org</owner> <owner>twellington@chromium.org</owner> <summary> - The percentage of successful decodes, per batch of photos decoded. Intended - to help identify if there are browsers where decoding fails 100% of the - time. Be wary at looking at other numbers in the histogram, as a value - emitted at, say, 50% may represent one failure in a two-item decoding or 50 - failures in a hundred-item decoding. These are qualitatively different - experiences for a user. + The percentage of out-of-memory decoding failures, per batch of photos + decoded. Intended to help identify if there are browsers where decoding + fails 100% of the time. Be wary at looking at other numbers in the + histogram, as a value emitted at, say, 50% may represent one failure in a + two-item decoding or 50 failures in a hundred-item decoding. These are + qualitatively different experiences for a user. + </summary> +</histogram> + +<histogram name="Android.PhotoPicker.DecoderHostFailureRuntime" units="%"> + <owner>finnur@chromium.org</owner> + <owner>twellington@chromium.org</owner> + <summary> + The percentage of runtime error decoding failures, per batch of photos + decoded. Intended to help identify if there are browsers where decoding + fails 100% of the time. Be wary at looking at other numbers in the + histogram, as a value emitted at, say, 50% may represent one failure in a + two-item decoding or 50 failures in a hundred-item decoding. These are + qualitatively different experiences for a user. </summary> </histogram> @@ -42056,7 +42069,7 @@ </summary> </histogram> -<histogram name="MobileStartup.ToolbarFirstDrawTime" units="ms"> +<histogram base="true" name="MobileStartup.ToolbarFirstDrawTime" units="ms"> <owner>yusufo@chromium.org</owner> <summary> Android: The time it takes from launch to the completion of first draw for @@ -42064,7 +42077,7 @@ </summary> </histogram> -<histogram name="MobileStartup.ToolbarFirstFocusTime" units="ms"> +<histogram base="true" name="MobileStartup.ToolbarFirstFocusTime" units="ms"> <owner>mariakhomenko@chromium.org</owner> <summary> Android: The time it takes from launch to the first time the user focuses @@ -42073,7 +42086,7 @@ </summary> </histogram> -<histogram name="MobileStartup.ToolbarInflationTime" units="ms"> +<histogram base="true" name="MobileStartup.ToolbarInflationTime" units="ms"> <owner>mariakhomenko@chromium.org</owner> <summary> Android: The time spent performing toolbar layout inflation.
diff --git a/tools/perf/contrib/cluster_telemetry/shared_browserless_story.py b/tools/perf/contrib/cluster_telemetry/shared_browserless_story.py index c96bbf4..a4c1a6e4 100644 --- a/tools/perf/contrib/cluster_telemetry/shared_browserless_story.py +++ b/tools/perf/contrib/cluster_telemetry/shared_browserless_story.py
@@ -4,6 +4,7 @@ from telemetry import story as story_module +from telemetry.core import platform as p_module class SharedBrowserlessStory(story_module.SharedState): @@ -18,7 +19,7 @@ @property def platform(self): - return None + p_module.GetHostPlatform() def WillRunStory(self, unused_page): return
diff --git a/tools/perf/core/benchmark_sharding_map.json b/tools/perf/core/benchmark_sharding_map.json index b1b523d..a93c97c7 100644 --- a/tools/perf/core/benchmark_sharding_map.json +++ b/tools/perf/core/benchmark_sharding_map.json
@@ -5,12 +5,12 @@ "tools/perf/core/benchmark_*_bot_map.json" ], "Android Nexus5 Perf": { - "build13-b1--device1": { + "build199-b7--device1": { "benchmarks": [ "system_health.memory_mobile" ] }, - "build13-b1--device2": { + "build199-b7--device2": { "benchmarks": [ "loading.desktop", "smoothness.key_silk_cases", @@ -18,7 +18,7 @@ "system_health.memory_desktop" ] }, - "build13-b1--device3": { + "build199-b7--device3": { "benchmarks": [ "blink_perf.image_decoder", "blink_perf.owp_storage", @@ -26,7 +26,7 @@ "rendering.desktop" ] }, - "build13-b1--device4": { + "build199-b7--device4": { "benchmarks": [ "speedometer-future", "speedometer2-future", @@ -34,13 +34,13 @@ "v8.browsing_mobile-future" ] }, - "build13-b1--device5": { + "build199-b7--device5": { "benchmarks": [ "system_health.common_desktop", "v8.browsing_mobile" ] }, - "build13-b1--device6": { + "build199-b7--device6": { "benchmarks": [ "memory.desktop", "power.typical_10_mobile", @@ -49,14 +49,14 @@ "webrtc" ] }, - "build13-b1--device7": { + "build199-b7--device7": { "benchmarks": [ "blink_perf.shadow_dom", "power.idle_platform", "smoothness.gpu_rasterization_and_decoding.image_decoding_cases" ] }, - "build14-b1--device1": { + "build200-b7--device1": { "benchmarks": [ "battor.trivial_pages", "media.desktop", @@ -67,7 +67,7 @@ "thread_times.key_idle_power_cases" ] }, - "build14-b1--device2": { + "build200-b7--device2": { "benchmarks": [ "dummy_benchmark.histogram_benchmark_1", "dummy_benchmark.noisy_benchmark_1", @@ -77,7 +77,7 @@ "speedometer2" ] }, - "build14-b1--device3": { + "build200-b7--device3": { "benchmarks": [ "memory.top_10_mobile", "smoothness.gpu_rasterization.tough_filters_cases", @@ -86,7 +86,7 @@ "smoothness.tough_pinch_zoom_cases" ] }, - "build14-b1--device4": { + "build200-b7--device4": { "benchmarks": [ "blink_perf.bindings", "blink_perf.canvas", @@ -96,7 +96,7 @@ "system_health.webview_startup" ] }, - "build14-b1--device5": { + "build200-b7--device5": { "benchmarks": [ "blink_perf.layout", "dromaeo", @@ -106,7 +106,7 @@ "thread_times.simple_mobile_sites" ] }, - "build14-b1--device6": { + "build200-b7--device6": { "benchmarks": [ "battor.steady_state", "blink_perf.svg", @@ -116,13 +116,13 @@ "thread_times.key_noop_cases" ] }, - "build14-b1--device7": { + "build200-b7--device7": { "benchmarks": [ "memory.long_running_idle_gmail_tbmv2", "system_health.common_mobile" ] }, - "build48-b1--device1": { + "build201-b7--device1": { "benchmarks": [ "loading.mobile", "media.mobile", @@ -131,7 +131,7 @@ "v8.browsing_desktop" ] }, - "build48-b1--device2": { + "build201-b7--device2": { "benchmarks": [ "blink_perf.events", "dummy_benchmark.stable_benchmark_1", @@ -139,7 +139,7 @@ "smoothness.tough_ad_cases" ] }, - "build48-b1--device3": { + "build201-b7--device3": { "benchmarks": [ "smoothness.key_desktop_move_cases", "smoothness.sync_scroll.key_mobile_sites_smooth", @@ -147,7 +147,7 @@ "thread_times.tough_scrolling_cases" ] }, - "build48-b1--device4": { + "build201-b7--device4": { "benchmarks": [ "blink_perf.dom", "rasterize_and_record_micro.top_25", @@ -155,7 +155,7 @@ "thread_times.key_silk_cases" ] }, - "build48-b1--device5": { + "build201-b7--device5": { "benchmarks": [ "blink_perf.css", "blink_perf.parser", @@ -165,7 +165,7 @@ "start_with_url.warm.startup_pages" ] }, - "build48-b1--device6": { + "build201-b7--device6": { "benchmarks": [ "blink_perf.paint", "kraken", @@ -174,7 +174,7 @@ "tracing.tracing_with_background_memory_infra" ] }, - "build48-b1--device7": { + "build201-b7--device7": { "benchmarks": [ "smoothness.desktop_tough_pinch_zoom_cases", "smoothness.tough_path_rendering_cases",
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index 5ebec94..68474de 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -166,25 +166,28 @@ swarming=[ { 'os': 'Android', - 'pool': 'Chrome-perf', + 'pool': 'chrome.tests.perf', 'device_ids': [ - 'build13-b1--device1', 'build13-b1--device2', 'build13-b1--device3', - 'build13-b1--device4', 'build13-b1--device5', 'build13-b1--device6', - 'build13-b1--device7', - 'build14-b1--device1', 'build14-b1--device2', 'build14-b1--device3', - 'build14-b1--device4', 'build14-b1--device5', 'build14-b1--device6', - 'build14-b1--device7', - 'build48-b1--device1', 'build48-b1--device2', 'build48-b1--device3', - 'build48-b1--device4', 'build48-b1--device5', 'build48-b1--device6', - 'build48-b1--device7', + 'build199-b7--device1', 'build199-b7--device2', + 'build199-b7--device3', 'build199-b7--device4', + 'build199-b7--device5', 'build199-b7--device6', + 'build199-b7--device7', + 'build200-b7--device1', 'build200-b7--device2', + 'build200-b7--device3', 'build200-b7--device4', + 'build200-b7--device5', 'build200-b7--device6', + 'build200-b7--device7', + 'build201-b7--device1', 'build201-b7--device2', + 'build201-b7--device3', 'build201-b7--device4', + 'build201-b7--device5', 'build201-b7--device6', + 'build201-b7--device7', ], 'perf_tests': [ - ('tracing_perftests', 'build13-b1--device2'), - ('gpu_perftests', 'build13-b1--device2'), - ('components_perftests', 'build48-b1--device5'), + ('tracing_perftests', 'build199-b7--device2'), + ('gpu_perftests', 'build199-b7--device2'), + ('components_perftests', 'build201-b7--device5'), ], 'perf_tests_with_args': [ - ('angle_perftests', 'build13-b1--device3', ['--shard-timeout=300'], + ('angle_perftests', 'build199-b7--device3', ['--shard-timeout=300'], 'angle_perftests'), ] } @@ -458,12 +461,7 @@ 'blink_perf.parser', 'blink_perf.shadow_dom', 'blink_perf.svg', - 'memory.top_10_mobile', - 'system_health.common_desktop', - 'system_health.common_mobile', - 'system_health.memory_desktop', - 'system_health.memory_mobile', - 'system_health.webview_startup', + 'memory.top_10_mobile' ]
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 45b3179b..86db15a 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -137,7 +137,7 @@ <item id="metrics_report_uma" hash_code="727528" type="0" content_hash_code="10176197" os_list="linux,windows" file_path="components/metrics/net/net_metrics_log_uploader.cc"/> <item id="missing" hash_code="77012883" type="0" reserved="1" os_list="linux,windows" file_path=""/> <item id="mojo_context_state" hash_code="93232258" type="0" deprecated="2017-10-20" content_hash_code="124821232" file_path=""/> - <item id="navigation_url_loader" hash_code="63171670" type="0" content_hash_code="129352907" os_list="linux,windows" file_path="content/browser/loader/navigation_url_loader_network_service.cc"/> + <item id="navigation_url_loader" hash_code="63171670" type="0" content_hash_code="129352907" os_list="linux,windows" file_path="content/browser/loader/navigation_url_loader_impl.cc"/> <item id="net_error_helper" hash_code="60071001" type="0" content_hash_code="68322861" os_list="linux,windows" file_path="chrome/renderer/net/net_error_helper.cc"/> <item id="network_location_provider" hash_code="23472048" type="1" second_id="96590038" content_hash_code="41087976" os_list="linux,windows" semantics_fields="1" policy_fields="3,4" file_path="device/geolocation/network_location_provider.cc"/> <item id="network_location_request" hash_code="96590038" type="2" content_hash_code="59824433" os_list="linux,windows" semantics_fields="2,3,4,5" policy_fields="-1" file_path="device/geolocation/network_location_request.cc"/>
diff --git a/ui/aura/client/aura_constants.cc b/ui/aura/client/aura_constants.cc index e4217f53..202b5e8 100644 --- a/ui/aura/client/aura_constants.cc +++ b/ui/aura/client/aura_constants.cc
@@ -64,8 +64,8 @@ DEFINE_UI_CLASS_PROPERTY_KEY( ui::WindowShowState, kPreFullscreenShowStateKey, ui::SHOW_STATE_DEFAULT); DEFINE_UI_CLASS_PROPERTY_KEY(int32_t, - kResizeBehaviorKey, - ui::mojom::kResizeBehaviorCanResize); + kResizeBehaviorKey, + ui::mojom::kResizeBehaviorCanResize); DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(gfx::Rect, kRestoreBoundsKey, nullptr); DEFINE_UI_CLASS_PROPERTY_KEY( ui::WindowShowState, kShowStateKey, ui::SHOW_STATE_DEFAULT);
diff --git a/ui/aura/mus/property_converter.cc b/ui/aura/mus/property_converter.cc index ae2ce3a..36233e1 100644 --- a/ui/aura/mus/property_converter.cc +++ b/ui/aura/mus/property_converter.cc
@@ -305,6 +305,8 @@ void PropertyConverter::RegisterImageSkiaProperty( const WindowProperty<gfx::ImageSkia*>* property, const char* transport_name) { + DCHECK(!IsTransportNameRegistered(transport_name)) + << "Property already registered: " << transport_name; image_properties_[property] = transport_name; transport_names_.insert(transport_name); } @@ -312,6 +314,8 @@ void PropertyConverter::RegisterRectProperty( const WindowProperty<gfx::Rect*>* property, const char* transport_name) { + DCHECK(!IsTransportNameRegistered(transport_name)) + << "Property already registered: " << transport_name; rect_properties_[property] = transport_name; transport_names_.insert(transport_name); } @@ -319,6 +323,8 @@ void PropertyConverter::RegisterSizeProperty( const WindowProperty<gfx::Size*>* property, const char* transport_name) { + DCHECK(!IsTransportNameRegistered(transport_name)) + << "Property already registered: " << transport_name; size_properties_[property] = transport_name; transport_names_.insert(transport_name); } @@ -326,6 +332,8 @@ void PropertyConverter::RegisterStringProperty( const WindowProperty<std::string*>* property, const char* transport_name) { + DCHECK(!IsTransportNameRegistered(transport_name)) + << "Property already registered: " << transport_name; string_properties_[property] = transport_name; transport_names_.insert(transport_name); } @@ -333,6 +341,8 @@ void PropertyConverter::RegisterString16Property( const WindowProperty<base::string16*>* property, const char* transport_name) { + DCHECK(!IsTransportNameRegistered(transport_name)) + << "Property already registered: " << transport_name; string16_properties_[property] = transport_name; transport_names_.insert(transport_name); }
diff --git a/ui/aura/mus/property_converter.h b/ui/aura/mus/property_converter.h index 95c1ca2..87244fe3 100644 --- a/ui/aura/mus/property_converter.h +++ b/ui/aura/mus/property_converter.h
@@ -83,6 +83,8 @@ const WindowProperty<T>* property, const char* transport_name, const base::RepeatingCallback<bool(int64_t)>& validator) { + DCHECK(!IsTransportNameRegistered(transport_name)) + << "Property already registered: " << transport_name; PrimitiveProperty primitive_property; primitive_property.property_name = property->name; primitive_property.transport_name = transport_name;
diff --git a/ui/file_manager/externs/chrome_test.js b/ui/file_manager/externs/chrome_test.js index e24fb1f..2f61e9c 100644 --- a/ui/file_manager/externs/chrome_test.js +++ b/ui/file_manager/externs/chrome_test.js
@@ -170,11 +170,6 @@ chrome.test.runWithUserGesture = function(callback) {}; /** - * @param {Function} callback - */ -chrome.test.runWithoutUserGesture = function(callback) {}; - -/** * Sends a string message one round trip from the renderer to the browser * process and back. * @param {string} message
diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc index 843b8ea..263441d 100644 --- a/ui/gl/gl_surface.cc +++ b/ui/gl/gl_surface.cc
@@ -36,6 +36,8 @@ return true; } +void GLSurface::PrepareToDestroy(bool have_context) {} + bool GLSurface::Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space,
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index 2fb0350..452e28a 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h
@@ -58,6 +58,12 @@ // Destroys the surface. virtual void Destroy() = 0; + // Some implementations (macOS), in Destroy, will need to delete GL objects + // that exist in the current GL context. This method is called before the + // context's decoder (and potentially context itself) are destroyed, giving an + // opportunity for this cleanup. + virtual void PrepareToDestroy(bool have_context); + // Color spaces that can be dynamically specified to the surface when resized. enum class ColorSpace { UNSPECIFIED,
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn index f24ff8a6..b33fd22 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn
@@ -633,6 +633,7 @@ "widget/desktop_aura/desktop_focus_rules.cc", "widget/desktop_aura/desktop_native_cursor_manager.cc", "widget/desktop_aura/desktop_native_widget_aura.cc", + "widget/desktop_aura/desktop_screen.cc", "widget/desktop_aura/desktop_screen_position_client.cc", "widget/focus_manager_event_handler.cc", "widget/native_widget_aura.cc", @@ -690,7 +691,8 @@ "widget/desktop_aura/desktop_window_tree_host_win.h", ] } else if (use_ozone) { - sources += [ "widget/desktop_aura/desktop_window_tree_host_ozone.cc" ] + public += [ "widget/desktop_aura/desktop_screen_ozone.h" ] + sources += [ "widget/desktop_aura/desktop_screen_ozone.cc" ] } if (is_linux) { sources += [ @@ -698,15 +700,16 @@ "widget/desktop_aura/window_event_filter.cc", "widget/desktop_aura/window_event_filter.h", ] + if (!use_x11) { + public += + [ "widget/desktop_aura/desktop_window_tree_host_platform.h" ] + sources += + [ "widget/desktop_aura/desktop_window_tree_host_platform.cc" ] + } } } } - if (is_linux) { - sources += [ "widget/desktop_aura/desktop_window_tree_host_platform.cc" ] - public += [ "widget/desktop_aura/desktop_window_tree_host_platform.h" ] - } - if (is_mac) { sources -= [ "controls/views_text_services_context_menu.cc" ] deps += [
diff --git a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc index 50851a87..f375ba90 100644 --- a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc +++ b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
@@ -7,6 +7,7 @@ #include "base/debug/stack_trace.h" #include "base/run_loop.h" +#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/cursor_client.h" #include "ui/aura/client/focus_client.h" #include "ui/aura/client/transient_window_client.h"
diff --git a/ui/views/mus/mus_client.cc b/ui/views/mus/mus_client.cc index 1e049056..2b16e01 100644 --- a/ui/views/mus/mus_client.cc +++ b/ui/views/mus/mus_client.cc
@@ -92,7 +92,6 @@ io_task_runner = io_thread_->task_runner(); } - // TODO(msw): Avoid this... use some default value? Allow clients to extend? property_converter_ = std::make_unique<aura::PropertyConverter>(); property_converter_->RegisterPrimitiveProperty( ::wm::kShadowElevationKey,
diff --git a/ui/views/widget/desktop_aura/desktop_screen.cc b/ui/views/widget/desktop_aura/desktop_screen.cc new file mode 100644 index 0000000..b656c14e --- /dev/null +++ b/ui/views/widget/desktop_aura/desktop_screen.cc
@@ -0,0 +1,23 @@ +// 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 "ui/views/widget/desktop_aura/desktop_screen.h" + +#include "ui/display/screen.h" + +namespace views { + +void InstallDesktopScreenIfNecessary() { +#if defined(OS_CHROMEOS) + // ChromeOS ozone builds use another path instead, where display::Screen is + // properly set. Thus, do early return here. + return; +#endif + + // The screen may have already been set in test initialization. + if (!display::Screen::GetScreen()) + display::Screen::SetScreenInstance(CreateDesktopScreen()); +} + +} // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_screen.h b/ui/views/widget/desktop_aura/desktop_screen.h index 88d2ffe..1f1ff49 100644 --- a/ui/views/widget/desktop_aura/desktop_screen.h +++ b/ui/views/widget/desktop_aura/desktop_screen.h
@@ -17,6 +17,8 @@ // a WindowTreeHost. Caller owns the result. VIEWS_EXPORT display::Screen* CreateDesktopScreen(); +VIEWS_EXPORT void InstallDesktopScreenIfNecessary(); + } // namespace views #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_H_
diff --git a/ui/views/widget/desktop_aura/desktop_screen_ozone.cc b/ui/views/widget/desktop_aura/desktop_screen_ozone.cc new file mode 100644 index 0000000..d458097 --- /dev/null +++ b/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
@@ -0,0 +1,40 @@ +// 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 "ui/views/widget/desktop_aura/desktop_screen_ozone.h" + +#include "ui/gfx/geometry/dip_util.h" +#include "ui/views/widget/desktop_aura/desktop_screen.h" + +namespace views { + +DesktopScreenOzone::DesktopScreenOzone() { + // TODO(msisov): Turn this hack into a real fetching of displays snapshot, + // which will be used to create a real display::Display based on the + // information from snapshots. + float device_scale_factor = 1.f; + if (display::Display::HasForceDeviceScaleFactor()) + device_scale_factor = display::Display::GetForcedDeviceScaleFactor(); + + gfx::Size scaled_size = + gfx::ConvertSizeToDIP(device_scale_factor, gfx::Size(800, 600)); + + const int64_t display_id = 1; + display::Display display(display_id); + display.set_bounds(gfx::Rect(scaled_size)); + display.set_work_area(gfx::Rect(0, 0, 800, 600)); + display.set_device_scale_factor(device_scale_factor); + + ProcessDisplayChanged(display, true /* is_primary */); +} + +DesktopScreenOzone::~DesktopScreenOzone() = default; + +////////////////////////////////////////////////////////////////////////////// + +display::Screen* CreateDesktopScreen() { + return new DesktopScreenOzone; +} + +} // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_screen_ozone.h b/ui/views/widget/desktop_aura/desktop_screen_ozone.h new file mode 100644 index 0000000..c16df17 --- /dev/null +++ b/ui/views/widget/desktop_aura/desktop_screen_ozone.h
@@ -0,0 +1,23 @@ +// 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 UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_OZONE_H_ +#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_OZONE_H_ + +#include "ui/display/screen_base.h" + +namespace views { + +class DesktopScreenOzone : public display::ScreenBase { + public: + DesktopScreenOzone(); + ~DesktopScreenOzone() override; + + private: + DISALLOW_COPY_AND_ASSIGN(DesktopScreenOzone); +}; + +} // namespace views + +#endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_OZONE_H_
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_ozone.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_ozone.cc deleted file mode 100644 index 5834cffc5..0000000 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_ozone.cc +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2013 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 "ui/views/widget/desktop_aura/desktop_window_tree_host.h" - -namespace views { - -DesktopWindowTreeHost* DesktopWindowTreeHost::Create( - internal::NativeWidgetDelegate* native_widget_delegate, - DesktopNativeWidgetAura* desktop_native_widget_aura) { - NOTREACHED() << "Ozone builds should use DesktopWindowTreeHostMus codepath."; - return nullptr; -} - -} // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc index dea26def..14f1e81 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
@@ -17,6 +17,9 @@ namespace views { +//////////////////////////////////////////////////////////////////////////////// +// DesktopWindowTreeHostPlatform: + DesktopWindowTreeHostPlatform::DesktopWindowTreeHostPlatform( internal::NativeWidgetDelegate* native_widget_delegate, DesktopNativeWidgetAura* desktop_native_widget_aura) @@ -424,4 +427,15 @@ return native_widget_delegate_->AsWidget(); } +//////////////////////////////////////////////////////////////////////////////// +// DesktopWindowTreeHost: + +// static +DesktopWindowTreeHost* DesktopWindowTreeHost::Create( + internal::NativeWidgetDelegate* native_widget_delegate, + DesktopNativeWidgetAura* desktop_native_widget_aura) { + return new DesktopWindowTreeHostPlatform(native_widget_delegate, + desktop_native_widget_aura); +} + } // namespace views
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_config.html b/ui/webui/resources/cr_components/chromeos/network/network_config.html index a7f29f7..5b89fa3 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_config.html +++ b/ui/webui/resources/cr_components/chromeos/network/network_config.html
@@ -1,10 +1,10 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys/iron-a11y-keys.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="network_shared_css.html"> <link rel="import" href="network_config_input.html"> <link rel="import" href="network_config_select.html"> @@ -96,9 +96,9 @@ <div id="vpnSaveCredentialsLabel" class="start"> [[i18n('networkConfigSaveCredentials')]] </div> - <paper-toggle-button checked="{{vpnSaveCredentials_}}" + <cr-toggle checked="{{vpnSaveCredentials_}}" aria-labelledby="vpnSaveCredentialsLabel"> - </paper-toggle-button> + </cr-toggle> </div> </template> @@ -140,9 +140,9 @@ <div id="eapSaveCredentialsLabel" class="start"> [[i18n('networkConfigSaveCredentials')]] </div> - <paper-toggle-button checked="{{eapProperties_.SaveCredentials}}" + <cr-toggle checked="{{eapProperties_.SaveCredentials}}" aria-labelledby="eapSaveCredentialsLabel"> - </paper-toggle-button> + </cr-toggle> </div> </template> @@ -151,11 +151,11 @@ if="[[shareIsVisible_(guid, type, networkProperties)]]" restamp> <div class="property-box"> <div id="shareLabel" class="start">[[i18n('networkConfigShare')]]</div> - <paper-toggle-button id="share" checked="{{shareNetwork_}}" + <cr-toggle id="share" checked="{{shareNetwork_}}" disabled="[[!shareIsEnabled_(guid, configProperties_.*, security_, eapProperties_.*, shareAllowEnable)]]" aria-label="[[i18n('networkConfigShare')]]"> - </paper-toggle-button> + </cr-toggle> </div> </template>
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_ip_config.html b/ui/webui/resources/cr_components/chromeos/network/network_ip_config.html index 66dcf2537..cbe21aa 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_ip_config.html +++ b/ui/webui/resources/cr_components/chromeos/network/network_ip_config.html
@@ -1,8 +1,8 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="network_property_list.html"> <link rel="import" href="network_shared_css.html"> @@ -13,10 +13,10 @@ <div id="autoIPConfigLabel" class="start"> [[i18n('networkIPConfigAuto')]] </div> - <paper-toggle-button checked="{{automatic_}}" disabled="[[!editable]]" + <cr-toggle checked="{{automatic_}}" disabled="[[!editable]]" on-change="onAutomaticChange_" aria-labelledby="autoIPConfigLabel"> - </paper-toggle-button> + </cr-toggle> </div> <template is="dom-if" if="[[hasIpConfigFields_(ipConfig_)]]"> <div class="property-box single-column indented stretch">
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_proxy.html b/ui/webui/resources/cr_components/chromeos/network/network_proxy.html index 5640402..d92e6fe 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_proxy.html +++ b/ui/webui/resources/cr_components/chromeos/network/network_proxy.html
@@ -1,6 +1,7 @@ <link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_network_behavior.html"> <link rel="import" href="chrome://resources/html/assert.html"> @@ -11,7 +12,6 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input-container.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="network_proxy_exclusions.html"> <link rel="import" href="network_proxy_input.html"> <link rel="import" href="network_shared_css.html"> @@ -73,11 +73,11 @@ <div id="networkProxyToggleLabel" class="flex"> [[i18n('networkProxyUseSame')]] </div> - <paper-toggle-button checked="{{useSameProxy_}}" + <cr-toggle checked="{{useSameProxy_}}" disabled="[[!isEditable_('Type', networkProperties, editable, useSharedProxies)]]" aria-labelledby="networkProxyToggleLabel"> - </paper-toggle-button> + </cr-toggle> </div> <div id="manualProxy" class="layout vertical start"
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_siminfo.html b/ui/webui/resources/cr_components/chromeos/network/network_siminfo.html index 57cc81e..bbdfe8f 100644 --- a/ui/webui/resources/cr_components/chromeos/network/network_siminfo.html +++ b/ui/webui/resources/cr_components/chromeos/network/network_siminfo.html
@@ -2,8 +2,9 @@ <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html"> <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> -<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> +<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html"> <link rel="import" href="chrome://resources/html/assert.html"> <link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> @@ -11,7 +12,6 @@ <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="network_config_input.html"> <link rel="import" href="network_shared_css.html"> @@ -46,9 +46,8 @@ height: calc(var(--cr-section-min-height) - 9px); } - paper-toggle-button { + cr-toggle { -webkit-margin-start: var(--cr-button-edge-spacing); - @apply --cr-actionable; } </style> @@ -84,10 +83,10 @@ hidden$="[[!networkProperties.Cellular.SIMLockStatus.LockEnabled]]"> [[i18n('networkSimChangePin')]] </paper-button> - <paper-toggle-button id="simLockButton" + <cr-toggle id="simLockButton" on-change="onSimLockEnabledChange_" checked="{{lockEnabled_}}" aria-labelledby="simLockToggleLabel"> - </paper-toggle-button> + </cr-toggle> </div> <!-- Enter PIN dialog -->
diff --git a/ui/webui/resources/cr_elements/paper_toggle_style_css.html b/ui/webui/resources/cr_elements/paper_toggle_style_css.html deleted file mode 100644 index 44260f55..0000000 --- a/ui/webui/resources/cr_elements/paper_toggle_style_css.html +++ /dev/null
@@ -1,42 +0,0 @@ -<link rel="import" href="chrome://resources/html/polymer.html"> - -<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> - -<!-- Common paper-button styling for Material Design WebUI. --> -<dom-module id="paper-toggle-style"> - <template> - <style> - :root { - --cr-toggle-bar-size: { - height: 12px; - left: 4px; - width: 28px; - }; - --cr-toggle-button-size: { - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4); - height: 16px; - top: -2px; - width: 16px; - }; - --cr-toggle-ink-size: { - height: 40px; - top: -12px; - left: -12px; - width: 40px; - }; - - --paper-toggle-button-checked-bar: var(--cr-toggle-bar-size); - --paper-toggle-button-checked-bar-color: var(--cr-toggle-color); - --paper-toggle-button-checked-button: { - @apply --cr-toggle-button-size; - transform: translate(18px, 0); - }; - --paper-toggle-button-checked-button-color: var(--cr-toggle-color); - --paper-toggle-button-label-spacing: 0; - --paper-toggle-button-unchecked-bar: var(--cr-toggle-bar-size); - --paper-toggle-button-unchecked-button: var(--cr-toggle-button-size); - --paper-toggle-button-unchecked-ink: var(--cr-toggle-ink-size); - }; - </style> - </template> -</dom-module>
diff --git a/ui/webui/resources/cr_elements_resources.grdp b/ui/webui/resources/cr_elements_resources.grdp index c03e4894..b3b2d42 100644 --- a/ui/webui/resources/cr_elements_resources.grdp +++ b/ui/webui/resources/cr_elements_resources.grdp
@@ -284,10 +284,6 @@ file="../../webui/resources/cr_elements/paper_input_style_css.html" type="chrome_html" compress="gzip" /> - <structure name="IDR_CR_ELEMENTS_PAPER_TOGGLE_STYLE_CSS_HTML" - file="../../webui/resources/cr_elements/paper_toggle_style_css.html" - type="chrome_html" - compress="gzip" /> <structure name="IDR_CR_ELEMENTS_SEARCH_HIGHLIGHT_STYLE_CSS_HTML" file="../../webui/resources/cr_elements/search_highlight_style_css.html" type="chrome_html"
diff --git a/ui/wm/core/shadow_controller.cc b/ui/wm/core/shadow_controller.cc index acb18da2..3c71359 100644 --- a/ui/wm/core/shadow_controller.cc +++ b/ui/wm/core/shadow_controller.cc
@@ -189,9 +189,8 @@ void ShadowController::Impl::OnWindowPropertyChanged(aura::Window* window, const void* key, intptr_t old) { - bool shadow_will_change = false; - if (key == kShadowElevationKey) - shadow_will_change = window->GetProperty(kShadowElevationKey) != old; + bool shadow_will_change = key == kShadowElevationKey && + window->GetProperty(kShadowElevationKey) != old; if (key == aura::client::kShowStateKey) { shadow_will_change = window->GetProperty(aura::client::kShowStateKey) !=