diff --git a/DEPS b/DEPS index 5055891..01bddd8 100644 --- a/DEPS +++ b/DEPS
@@ -138,11 +138,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'ac79ca16c651f020a4c257d75919b00eca61b494', + 'skia_revision': '9893f8e15152e731c602278e529fde2e43091c9e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '82e7e7a361135770eeec51bdc7b329b414e9ba44', + 'v8_revision': '13da560bef16ab254fe91e85541f8dd4db6c337a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -193,7 +193,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling HarfBuzz # and whatever else without interference from each other. - 'harfbuzz_revision': '97b92685775983a280f335423263a6a8d82c3941', + 'harfbuzz_revision': '659eeddb2df5b97cc01bd39e106381f65c9f41f1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Emoji Segmenter # and whatever else without interference from each other. @@ -201,7 +201,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': 'd944a1a52fef27d25c7220dd36ad93f8e38dd61b', + 'catapult_revision': 'a6e2399787969ec410bd08f0baf56d7f5dc6ba9b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -832,7 +832,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'd2f31cc65deac117d0fc5926768630ee2be27115', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '075cb05bdeb5eb7f42cf259a5a40eebf54dc21dd', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1190,7 +1190,7 @@ Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f80d2d4f0a64cfa3a19b772b83adfdfcda1aaa19', 'src/third_party/perl': { - 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', + 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', 'condition': 'checkout_win', }, @@ -1396,7 +1396,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@fbfc92ef153862c79dd860ef8cbe6b9e0ce4b669', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@bc5e8283ebb09d654705946728d20d6985c0994c', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS index 808603e..628d5bb 100644 --- a/android_webview/browser/DEPS +++ b/android_webview/browser/DEPS
@@ -81,6 +81,7 @@ "+third_party/blink/public/common/mediastream", # QuotaStatusCode required by AwQuotaManagerBridge. "+third_party/blink/public/mojom/quota", + "+third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h", # Interface required for in-process input event handling. "+third_party/blink/public/web/WebCompositorInputHandler.h", # For find-in-page
diff --git a/android_webview/browser/aw_web_contents_delegate.cc b/android_webview/browser/aw_web_contents_delegate.cc index 36fbb09b..54a8e1b 100644 --- a/android_webview/browser/aw_web_contents_delegate.cc +++ b/android_webview/browser/aw_web_contents_delegate.cc
@@ -32,6 +32,7 @@ #include "jni/AwWebContentsDelegate_jni.h" #include "net/base/filename_util.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF16ToJavaString; @@ -274,9 +275,10 @@ content::MediaResponseCallback callback) { AwContents* aw_contents = AwContents::FromWebContents(web_contents); if (!aw_contents) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, - std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, + std::unique_ptr<content::MediaStreamUI>()); return; } aw_contents->GetPermissionRequestHandler()->SendRequest(
diff --git a/android_webview/browser/permission/media_access_permission_request.cc b/android_webview/browser/permission/media_access_permission_request.cc index 2c6bda7..633798b 100644 --- a/android_webview/browser/permission/media_access_permission_request.cc +++ b/android_webview/browser/permission/media_access_permission_request.cc
@@ -8,6 +8,7 @@ #include "android_webview/browser/permission/aw_permission_request.h" #include "content/public/browser/media_capture_devices.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" using blink::MediaStreamDevice; using blink::MediaStreamDevices; @@ -48,8 +49,9 @@ std::unique_ptr<content::MediaStreamUI> ui; MediaStreamDevices devices; if (!allowed) { - std::move(callback_).Run(devices, blink::MEDIA_DEVICE_PERMISSION_DENIED, - std::move(ui)); + std::move(callback_).Run( + devices, blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, + std::move(ui)); return; } @@ -74,10 +76,11 @@ if (device) devices.push_back(*device); } - std::move(callback_).Run(devices, - devices.empty() ? blink::MEDIA_DEVICE_NO_HARDWARE - : blink::MEDIA_DEVICE_OK, - std::move(ui)); + std::move(callback_).Run( + devices, + devices.empty() ? blink::mojom::MediaStreamRequestResult::NO_HARDWARE + : blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); } const GURL& MediaAccessPermissionRequest::GetOrigin() {
diff --git a/android_webview/browser/permission/media_access_permission_request_unittest.cc b/android_webview/browser/permission/media_access_permission_request_unittest.cc index 845b13d..7b0a7d0 100644 --- a/android_webview/browser/permission/media_access_permission_request_unittest.cc +++ b/android_webview/browser/permission/media_access_permission_request_unittest.cc
@@ -5,6 +5,7 @@ #include "android_webview/browser/permission/media_access_permission_request.h" #include "base/bind.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace android_webview { @@ -65,11 +66,11 @@ std::string first_audio_device_id_; std::string first_video_device_id_; blink::MediaStreamDevices devices_; - blink::MediaStreamRequestResult result_; + blink::mojom::MediaStreamRequestResult result_; private: void Callback(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { devices_ = devices; result_ = result; @@ -82,7 +83,7 @@ request->NotifyRequestResult(true); EXPECT_EQ(2u, devices_.size()); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result_); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result_); bool audio_exist = false; bool video_exist = false; @@ -106,7 +107,7 @@ request->NotifyRequestResult(true); EXPECT_EQ(2u, devices_.size()); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result_); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result_); bool audio_exist = false; bool video_exist = false; @@ -129,7 +130,7 @@ CreateRequest(std::string(), std::string()); request->NotifyRequestResult(false); EXPECT_TRUE(devices_.empty()); - EXPECT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, result_); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, result_); } } // namespace android_webview
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index f0eb7fff..45cce9a 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -600,8 +600,8 @@ "shell_init_params.cc", "shell_state.cc", "shell_state.h", - "shutdown_controller.cc", - "shutdown_controller.h", + "shutdown_controller_impl.cc", + "shutdown_controller_impl.h", "shutdown_reason.cc", "shutdown_reason.h", "sticky_keys/sticky_keys_controller.cc",
diff --git a/ash/accelerators/accelerator_controller_impl.cc b/ash/accelerators/accelerator_controller_impl.cc index f1f5749..bbf58bb 100644 --- a/ash/accelerators/accelerator_controller_impl.cc +++ b/ash/accelerators/accelerator_controller_impl.cc
@@ -223,6 +223,11 @@ ImeSwitchType::kAccelerator); } +void RecordImeSwitchByModeChangeKey() { + UMA_HISTOGRAM_ENUMERATION("InputMethod.ImeSwitch", + ImeSwitchType::kModeChangeKey); +} + void HandleCycleBackwardMRU(const ui::Accelerator& accelerator) { if (accelerator.key_code() == ui::VKEY_TAB) base::RecordAction(base::UserMetricsAction("Accel_PrevWindow_Tab")); @@ -346,9 +351,12 @@ return !keyboard::KeyboardController::Get()->IsKeyboardVisible(); } -void HandleSwitchToNextIme() { +void HandleSwitchToNextIme(const ui::Accelerator& accelerator) { base::RecordAction(UserMetricsAction("Accel_Next_Ime")); - RecordImeSwitchByAccelerator(); + if (accelerator.key_code() == ui::VKEY_MODECHANGE) + RecordImeSwitchByModeChangeKey(); + else + RecordImeSwitchByAccelerator(); Shell::Get()->ime_controller()->SwitchToNextIme(); } @@ -612,11 +620,6 @@ } } -void HandleShowOrSwitchIme() { - base::RecordAction(UserMetricsAction("Accel_Show_Or_Switch_Ime")); - Shell::Get()->ime_controller()->ShowOrSwitchIme(); -} - void HandleCrosh() { base::RecordAction(UserMetricsAction("Accel_Open_Crosh")); @@ -1475,7 +1478,6 @@ case RESTORE_TAB: case ROTATE_WINDOW: case SHOW_IME_MENU_BUBBLE: - case SHOW_OR_SWITCH_IME: case SHOW_SHORTCUT_VIEWER: case SHOW_TASK_MANAGER: case SUSPEND: @@ -1711,9 +1713,6 @@ case SHOW_IME_MENU_BUBBLE: HandleShowImeMenuBubble(); break; - case SHOW_OR_SWITCH_IME: - HandleShowOrSwitchIme(); - break; case SHOW_SHORTCUT_VIEWER: HandleShowKeyboardShortcutViewer(); break; @@ -1739,7 +1738,7 @@ HandleSwitchToLastUsedIme(accelerator); break; case SWITCH_TO_NEXT_IME: - HandleSwitchToNextIme(); + HandleSwitchToNextIme(accelerator); break; case SWITCH_TO_NEXT_USER: HandleCycleUser(CycleUserDirection::NEXT);
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 7258a99..cf66b10 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -2304,30 +2304,14 @@ } // Tests the IME mode change key. -TEST_F(AcceleratorControllerTest, - ChangeIMEMode_ModeIndicatorHiddenShowsIndicator) { +TEST_F(AcceleratorControllerTest, ChangeIMEMode_SwitchesInputMethod) { + AddTestImes(); + ImeController* controller = Shell::Get()->ime_controller(); TestImeControllerClient client; controller->SetClient(client.CreateInterfacePtr()); - EXPECT_FALSE(controller->mode_indicator_observer()->active_widget()); - EXPECT_EQ(0, client.show_mode_indicator_count_); - - ProcessInController(ui::Accelerator(ui::VKEY_MODECHANGE, ui::EF_NONE)); - controller->FlushMojoForTesting(); - - EXPECT_EQ(1, client.show_mode_indicator_count_); -} - -TEST_F(AcceleratorControllerTest, - ChangeIMEMode_ModeIndicatorVisibleSwitchesInputMethod) { - ImeController* controller = Shell::Get()->ime_controller(); - - TestImeControllerClient client; - controller->SetClient(client.CreateInterfacePtr()); - - controller->ShowModeIndicator(gfx::Rect(10, 10), base::ASCIIToUTF16("test")); EXPECT_EQ(0, client.next_ime_count_); ProcessInController(ui::Accelerator(ui::VKEY_MODECHANGE, ui::EF_NONE));
diff --git a/ash/accelerators/accelerator_table_unittest.cc b/ash/accelerators/accelerator_table_unittest.cc index 95cf786..6a80805 100644 --- a/ash/accelerators/accelerator_table_unittest.cc +++ b/ash/accelerators/accelerator_table_unittest.cc
@@ -20,7 +20,7 @@ constexpr int kNonSearchAcceleratorsNum = 92; // The hash of non-Search-based accelerators. See HashAcceleratorData(). constexpr char kNonSearchAcceleratorsHash[] = - "2fc4ce8b0d4f3629b7a4c9bdf1fa0deb"; + "aebfcdff71290bb9af4060871b72e4f7"; struct Cmp { bool operator()(const AcceleratorData& lhs,
diff --git a/ash/ime/ime_controller.cc b/ash/ime/ime_controller.cc index 3e531c04..bff6107 100644 --- a/ash/ime/ime_controller.cc +++ b/ash/ime/ime_controller.cc
@@ -238,22 +238,6 @@ client_.FlushForTesting(); } -void ImeController::ShowOrSwitchIme() { - if (mode_indicator_observer_->active_widget()) { - SwitchToNextIme(); - - UMA_HISTOGRAM_ENUMERATION("InputMethod.ModeChangeKeyAction", - ModeChangeKeyAction::kSwitchIme); - UMA_HISTOGRAM_ENUMERATION("InputMethod.ImeSwitch", - ImeSwitchType::kModeChangeKey); - } else { - client_->ShowModeIndicator(); - - UMA_HISTOGRAM_ENUMERATION("InputMethod.ModeChangeKeyAction", - ModeChangeKeyAction::kShowIndicator); - } -} - bool ImeController::IsCapsLockEnabled() const { return is_caps_lock_enabled_; }
diff --git a/ash/ime/ime_controller.h b/ash/ime/ime_controller.h index 25228625..5bbe32b 100644 --- a/ash/ime/ime_controller.h +++ b/ash/ime/ime_controller.h
@@ -130,10 +130,6 @@ return mode_indicator_observer_.get(); } - // Asynchronously show the current IME mode indicator. If it's already shown, - // switch to the next available IME. - void ShowOrSwitchIme(); - private: // Returns the IDs of the subset of input methods which are active and are // associated with |accelerator|. For example, two Japanese IMEs can be
diff --git a/ash/mojo_interface_factory.cc b/ash/mojo_interface_factory.cc index a87422a..2f452553 100644 --- a/ash/mojo_interface_factory.cc +++ b/ash/mojo_interface_factory.cc
@@ -27,7 +27,6 @@ #include "ash/public/cpp/voice_interaction_controller.h" #include "ash/shell.h" #include "ash/shell_delegate.h" -#include "ash/shutdown_controller.h" #include "ash/system/locale/locale_update_controller.h" #include "ash/system/message_center/message_center_controller.h" #include "ash/system/network/vpn_list.h" @@ -135,11 +134,6 @@ ShelfIntegrationTestApi::BindRequest(std::move(request)); } -void BindShutdownControllerRequestOnMainThread( - mojom::ShutdownControllerRequest request) { - Shell::Get()->shutdown_controller()->BindRequest(std::move(request)); -} - void BindTrayActionRequestOnMainThread(mojom::TrayActionRequest request) { Shell::Get()->tray_action()->BindRequest(std::move(request)); } @@ -215,9 +209,6 @@ base::BindRepeating(&BindNightLightControllerRequestOnMainThread), main_thread_task_runner); registry->AddInterface( - base::BindRepeating(&BindShutdownControllerRequestOnMainThread), - main_thread_task_runner); - registry->AddInterface( base::BindRepeating(&BindTrayActionRequestOnMainThread), main_thread_task_runner); registry->AddInterface(
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index 1888d96..2cc82fb 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -143,6 +143,8 @@ "shelf_types.h", "shell_window_ids.cc", "shell_window_ids.h", + "shutdown_controller.cc", + "shutdown_controller.h", "split_view.cc", "split_view.h", "spoken_feedback_event_rewriter_delegate.h", @@ -168,6 +170,8 @@ "wallpaper_types.h", "wallpaper_user_info.h", "window_animation_types.h", + "window_pin_type.cc", + "window_pin_type.h", "window_properties.cc", "window_properties.h", "window_state_type.cc",
diff --git a/ash/public/cpp/accelerators.cc b/ash/public/cpp/accelerators.cc index 828b4915..fedff86 100644 --- a/ash/public/cpp/accelerators.cc +++ b/ash/public/cpp/accelerators.cc
@@ -184,7 +184,7 @@ {true, ui::VKEY_ASSISTANT, ui::EF_NONE, START_VOICE_INTERACTION}, // IME mode change key. - {true, ui::VKEY_MODECHANGE, ui::EF_NONE, SHOW_OR_SWITCH_IME}, + {true, ui::VKEY_MODECHANGE, ui::EF_NONE, SWITCH_TO_NEXT_IME}, // Debugging shortcuts that need to be available to end-users in // release builds.
diff --git a/ash/public/cpp/accelerators.h b/ash/public/cpp/accelerators.h index 0b47828..517af75 100644 --- a/ash/public/cpp/accelerators.h +++ b/ash/public/cpp/accelerators.h
@@ -70,7 +70,6 @@ SCALE_UI_RESET, SCALE_UI_UP, SHOW_IME_MENU_BUBBLE, - SHOW_OR_SWITCH_IME, SHOW_SHORTCUT_VIEWER, SHOW_STYLUS_TOOLS, SHOW_TASK_MANAGER,
diff --git a/ash/public/cpp/manifest.cc b/ash/public/cpp/manifest.cc index 6ad040b..83d8d0f 100644 --- a/ash/public/cpp/manifest.cc +++ b/ash/public/cpp/manifest.cc
@@ -19,7 +19,6 @@ #include "ash/public/interfaces/media.mojom.h" #include "ash/public/interfaces/night_light_controller.mojom.h" #include "ash/public/interfaces/shelf_integration_test_api.mojom.h" -#include "ash/public/interfaces/shutdown.mojom.h" #include "ash/public/interfaces/tray_action.mojom.h" #include "ash/public/interfaces/voice_interaction_controller.mojom.h" #include "ash/public/interfaces/vpn_list.mojom.h" @@ -66,9 +65,8 @@ mojom::CrosDisplayConfigController, mojom::ImeController, mojom::KeyboardController, mojom::LocaleUpdateController, mojom::LoginScreen, mojom::MediaController, - mojom::NightLightController, mojom::ShutdownController, - mojom::TrayAction, mojom::VoiceInteractionController, - mojom::VpnList>()) + mojom::NightLightController, mojom::TrayAction, + mojom::VoiceInteractionController, mojom::VpnList>()) .ExposeCapability("test", service_manager::Manifest::InterfaceList< mojom::ShelfIntegrationTestApi>()) .RequireCapability("*", "accessibility")
diff --git a/ash/public/cpp/shutdown_controller.cc b/ash/public/cpp/shutdown_controller.cc new file mode 100644 index 0000000..3f5d64ef --- /dev/null +++ b/ash/public/cpp/shutdown_controller.cc
@@ -0,0 +1,41 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/public/cpp/shutdown_controller.h" + +#include "base/logging.h" + +namespace ash { + +namespace { + +ShutdownController* g_instance = nullptr; + +} // namespace + +ShutdownController::ScopedResetterForTest::ScopedResetterForTest() + : instance_(g_instance) { + g_instance = nullptr; +} + +ShutdownController::ScopedResetterForTest::~ScopedResetterForTest() { + g_instance = instance_; +} + +// static +ShutdownController* ShutdownController::Get() { + return g_instance; +} + +ShutdownController::ShutdownController() { + DCHECK(!g_instance); + g_instance = this; +} + +ShutdownController::~ShutdownController() { + DCHECK_EQ(this, g_instance); + g_instance = nullptr; +} + +} // namespace ash
diff --git a/ash/public/cpp/shutdown_controller.h b/ash/public/cpp/shutdown_controller.h new file mode 100644 index 0000000..07f0a25 --- /dev/null +++ b/ash/public/cpp/shutdown_controller.h
@@ -0,0 +1,49 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_PUBLIC_CPP_SHUTDOWN_CONTROLLER_H_ +#define ASH_PUBLIC_CPP_SHUTDOWN_CONTROLLER_H_ + +#include "ash/public/cpp/ash_public_export.h" + +namespace ash { + +enum class ShutdownReason; + +// Interface implemented by ash and used by chrome to provide shutdown policy +// information. Exists because device policy is owned by chrome, not ash. +class ASH_PUBLIC_EXPORT ShutdownController { + public: + // Helper class to reset ShutdowController instance in constructor and + // restore it in destructor so that tests could create its own instance. + class ScopedResetterForTest { + public: + ScopedResetterForTest(); + ~ScopedResetterForTest(); + + private: + ShutdownController* const instance_; + }; + + // Gets the singleton ShutdownController instance. + static ShutdownController* Get(); + + // Sets a boolean pref that indicates whether the device automatically reboots + // when the user initiates a shutdown via an UI element. Used in enterprise + // environments for devices that should not be shut down. + virtual void SetRebootOnShutdown(bool reboot_on_shutdown) = 0; + + // Shuts down or reboots based on the current DeviceRebootOnShutdown policy. + // Does not trigger the shutdown fade-out animation. For animated shutdown + // use LockStateController::RequestShutdown(). + virtual void ShutDownOrReboot(ShutdownReason reason) = 0; + + protected: + ShutdownController(); + virtual ~ShutdownController(); +}; + +} // namespace ash + +#endif // ASH_PUBLIC_CPP_SHUTDOWN_CONTROLLER_H_
diff --git a/ash/public/cpp/window_pin_type.cc b/ash/public/cpp/window_pin_type.cc new file mode 100644 index 0000000..82fd0d3 --- /dev/null +++ b/ash/public/cpp/window_pin_type.cc
@@ -0,0 +1,25 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/public/cpp/window_pin_type.h" + +#include "base/logging.h" + +namespace ash { + +std::ostream& operator<<(std::ostream& out, WindowPinType pin_type) { + switch (pin_type) { + case WindowPinType::kNone: + return out << "kNone"; + case WindowPinType::kPinned: + return out << "kPinned"; + case WindowPinType::kTrustedPinned: + return out << "kTrustedPinned"; + } + + NOTREACHED(); + return out; +} + +} // namespace ash
diff --git a/ash/public/cpp/window_pin_type.h b/ash/public/cpp/window_pin_type.h new file mode 100644 index 0000000..3308bb5 --- /dev/null +++ b/ash/public/cpp/window_pin_type.h
@@ -0,0 +1,31 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_PUBLIC_CPP_WINDOW_PIN_TYPE_H_ +#define ASH_PUBLIC_CPP_WINDOW_PIN_TYPE_H_ + +#include <ostream> + +#include "ash/public/cpp/ash_public_export.h" + +namespace ash { + +// The window's pin type enum. +enum class WindowPinType { + kNone, + + // The window is pinned on top of other windows. + kPinned, + + // The window is pinned on top of other windows. It is similar to + // kPinned but does not allow user to exit the mode by shortcut key. + kTrustedPinned, +}; + +ASH_PUBLIC_EXPORT std::ostream& operator<<(std::ostream& stream, + WindowPinType pin_type); + +} // namespace ash + +#endif // ASH_PUBLIC_CPP_WINDOW_PIN_TYPE_H_
diff --git a/ash/public/cpp/window_properties.cc b/ash/public/cpp/window_properties.cc index 5e3a4a7..0aaf27f 100644 --- a/ash/public/cpp/window_properties.cc +++ b/ash/public/cpp/window_properties.cc
@@ -7,14 +7,12 @@ #include "ash/public/cpp/ash_constants.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller.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 "ui/aura/window.h" #include "ui/wm/core/window_properties.h" -DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, - ash::mojom::WindowPinType) +DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, ash::WindowPinType) DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, ash::WindowStateType) DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, ash::BackdropWindowMode) @@ -63,9 +61,9 @@ DEFINE_UI_CLASS_PROPERTY_KEY(SkColor, kFrameInactiveColorKey, kDefaultFrameColor) -DEFINE_UI_CLASS_PROPERTY_KEY(mojom::WindowPinType, +DEFINE_UI_CLASS_PROPERTY_KEY(WindowPinType, kWindowPinTypeKey, - mojom::WindowPinType::NONE) + WindowPinType::kNone) DEFINE_UI_CLASS_PROPERTY_KEY(bool, kWindowPositionManagedTypeKey, false) DEFINE_UI_CLASS_PROPERTY_KEY(WindowStateType, kWindowStateTypeKey,
diff --git a/ash/public/cpp/window_properties.h b/ash/public/cpp/window_properties.h index b4e895b6..c78a737a 100644 --- a/ash/public/cpp/window_properties.h +++ b/ash/public/cpp/window_properties.h
@@ -24,11 +24,8 @@ namespace ash { -enum class WindowStateType; - -namespace mojom { enum class WindowPinType; -} +enum class WindowStateType; enum class BackdropWindowMode { kEnabled, // The window needs a backdrop shown behind it. @@ -165,7 +162,7 @@ // will try to fullscreen the window and pin it on the top of the screen. If the // window manager failed to do it, the property will be restored to NONE. When // setting this property to NONE, the window manager will restore the window. -ASH_PUBLIC_EXPORT extern const aura::WindowProperty<mojom::WindowPinType>* const +ASH_PUBLIC_EXPORT extern const aura::WindowProperty<WindowPinType>* const kWindowPinTypeKey; // A property key to indicate whether ash should perform auto management of
diff --git a/ash/public/interfaces/BUILD.gn b/ash/public/interfaces/BUILD.gn index 248f335..c5c5a4b9 100644 --- a/ash/public/interfaces/BUILD.gn +++ b/ash/public/interfaces/BUILD.gn
@@ -35,13 +35,10 @@ "media.mojom", "night_light_controller.mojom", "shelf_integration_test_api.mojom", - "shutdown.mojom", "tray_action.mojom", "update.mojom", "voice_interaction_controller.mojom", "vpn_list.mojom", - "window_pin_type.mojom", - "window_properties.mojom", ] public_deps = [
diff --git a/ash/public/interfaces/shutdown.mojom b/ash/public/interfaces/shutdown.mojom deleted file mode 100644 index 11437eb..0000000 --- a/ash/public/interfaces/shutdown.mojom +++ /dev/null
@@ -1,18 +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. - -module ash.mojom; - -// Interface implemented by ash and used by chrome to provide shutdown policy -// information. Exists because device policy is owned by chrome, not ash. -interface ShutdownController { - // Sets a boolean pref that indicates whether the device automatically reboots - // when the user initiates a shutdown via an UI element. Used in enterprise - // environments for devices that should not be shut down. - SetRebootOnShutdown(bool reboot_on_shutdown); - - // Triggers an animated shutdown after the login screen shutdown button was - // pressed. - RequestShutdownFromLoginScreen(); -};
diff --git a/ash/public/interfaces/window_pin_type.mojom b/ash/public/interfaces/window_pin_type.mojom deleted file mode 100644 index d5b10bee..0000000 --- a/ash/public/interfaces/window_pin_type.mojom +++ /dev/null
@@ -1,20 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module ash.mojom; - -// The window's pin type enum. -enum WindowPinType { - NONE, - - // The window is pinned on top of other windows. - PINNED, - - // The window is pinned on top of other windows. It is similar to - // PINNED but does not allow user to exit the mode by shortcut key. - TRUSTED_PINNED, -}; - -// The window's pin type. Maps to ash::kWindowPinTypeKey. -const string kWindowPinType_Property = "ash:window-pin-type";
diff --git a/ash/public/interfaces/window_properties.mojom b/ash/public/interfaces/window_properties.mojom deleted file mode 100644 index fa05ba6..0000000 --- a/ash/public/interfaces/window_properties.mojom +++ /dev/null
@@ -1,88 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module ash.mojom; - -// App type of the window, like browser or app. The type is an int but should -// be one of ash::AppType (see ash/public/cpp/app_types.h). -const string kAppType_Property = "ash:app-type"; - -// A bool to indicate whether this window should be replaced by a black -// rectangle in assistant screenshot for privacy purpose. -const string kBlockedForAssistantSnapshot_Property = - "ash:blocked-for-assistant-snapshot"; - -// A bool to indicate whether the window can attach into another window. Used -// by tab-dragging. -const string kCanAttachToAnotherWindow_Property = - "ash:can-attach-to-another-window"; - -// V1 apps can intercept system keys. This will let the app handle F-keys instead -// of the window manager. -const string kCanConsumeSystemKeys_Property = - "ash:can-consume-system-keys"; - -// True if the window should be hidden in ash overview mode. Type: bool. -const string kHideInOverview_Property = "ash:hide_in_overview"; - -// True if the shelf should be hidden when this window is put into fullscreen. -// Exposed because some windows want to explicitly opt-out of this. -const string kHideShelfWhenFullscreen_Property = - "ash:hide-shelf-when-fullscreen"; - -// See ash::kImmersiveImpliedByFullscreen. -const string kImmersiveImpliedByFullscreen_Property = - "ash:immersive-implied-by-fullscreen"; - -// See ash::kImmersiveIsActive. -const string kImmersiveIsActive_Property = "ash:immersive-is-active"; - -// See ash::kImmersiveTopContainerBoundsInScreen. -const string kImmersiveTopContainerBoundsInScreen_Property = - "ash:immersive-top-container-bounds-in-screen"; - -// If true, the window is the target window for the tab-dragged window. The -// key is used by overview to show a highlight indication to indicate which -// overview window the dragged tabs will merge into when the user releases the -// pointer. -const string kIsDeferredTabDraggingTargetWindow_Property = - "ash:is-deferred-tab-dragging-target-window"; - -// If true, the window is a browser window and its tab(s) are currently being -// dragged. -const string kIsDraggingTabs_Property = "ash:is-dragging-tabs"; - -// If true, the window is currently showing in overview mode. -const string kIsShowingInOverview_Property = "ash:is-showing-in-overview"; - -// A property key to store the address of the source window that the drag -// originated from if the window is currently in tab-dragging process. -const string kTabDraggingSourceWindow_Property = - "ash:tab-dragging-source-window"; - -// This is put on windows to indicate that ash should perform auto management of -// window positions; when you open a second browser, ash will move the two to -// minimize overlap. -const string kWindowPositionManaged_Property = - "ash:window-position-managed"; - -// 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. -const string kRestoreBoundsOverride_Property = - "ash:restore-bounds-override"; - -// A property key which stores the window state to restore a window to. These -// take preference over the current state if -// |kRestoreWindowStateTypeOverrideKey| is set. This is used by e.g. the tablet -// mode window manager. -const string kRestoreWindowStateTypeOverride_Property = - "ash:restore-window-state-type-override"; - -// The height of the window header, i.e. the inset between the frame and client -// view. -const string kTopViewInset_Property = "ash:top-view-inset"; - -// A boolean property to indicate a picture-in-picture window. -const string kIsWindowPip_Property = "ash:is-window-pip";
diff --git a/ash/shelf/login_shelf_view.cc b/ash/shelf/login_shelf_view.cc index 6b14e1d..663ef2a 100644 --- a/ash/shelf/login_shelf_view.cc +++ b/ash/shelf/login_shelf_view.cc
@@ -23,7 +23,6 @@ #include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/shutdown_controller.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget_delegate.h"
diff --git a/ash/shelf/login_shelf_view.h b/ash/shelf/login_shelf_view.h index 398426e..83f4fcc7 100644 --- a/ash/shelf/login_shelf_view.h +++ b/ash/shelf/login_shelf_view.h
@@ -15,7 +15,7 @@ #include "ash/public/cpp/kiosk_app_menu.h" #include "ash/public/cpp/login_types.h" #include "ash/public/interfaces/login_screen.mojom.h" -#include "ash/shutdown_controller.h" +#include "ash/shutdown_controller_impl.h" #include "ash/system/locale/locale_update_controller.h" #include "ash/tray_action/tray_action_observer.h" #include "base/scoped_observer.h" @@ -44,7 +44,7 @@ public views::ButtonListener, public TrayActionObserver, public LockScreenActionBackgroundObserver, - public ShutdownController::Observer, + public ShutdownControllerImpl::Observer, public LoginDataDispatcher::Observer, public LocaleChangeObserver { public: @@ -135,7 +135,7 @@ void OnLockScreenActionBackgroundStateChanged( LockScreenActionBackgroundState state) override; - // ShutdownController::Observer: + // ShutdownControllerImpl::Observer: void OnShutdownPolicyChanged(bool reboot_on_shutdown) override; // LoginDataDispatcher::Observer: @@ -175,7 +175,7 @@ LockScreenActionBackgroundObserver> lock_screen_action_background_observer_{this}; - ScopedObserver<ShutdownController, ShutdownController::Observer> + ScopedObserver<ShutdownControllerImpl, ShutdownControllerImpl::Observer> shutdown_controller_observer_{this}; ScopedObserver<LocaleUpdateController, LocaleChangeObserver>
diff --git a/ash/shelf/login_shelf_view_unittest.cc b/ash/shelf/login_shelf_view_unittest.cc index e23ebd26..c4d3f29 100644 --- a/ash/shelf/login_shelf_view_unittest.cc +++ b/ash/shelf/login_shelf_view_unittest.cc
@@ -21,7 +21,7 @@ #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" -#include "ash/shutdown_controller.h" +#include "ash/shutdown_controller_impl.h" #include "ash/system/status_area_widget.h" #include "ash/test/ash_test_base.h" #include "ash/test/ash_test_helper.h" @@ -87,7 +87,7 @@ } void NotifyShutdownPolicyChanged(bool reboot_on_shutdown) { - Shell::Get()->shutdown_controller()->SetRebootOnShutdownForTesting( + Shell::Get()->shutdown_controller()->SetRebootOnShutdown( reboot_on_shutdown); }
diff --git a/ash/shelf/shelf_bezel_event_handler.cc b/ash/shelf/shelf_bezel_event_handler.cc index 75b7445a..1531645 100644 --- a/ash/shelf/shelf_bezel_event_handler.cc +++ b/ash/shelf/shelf_bezel_event_handler.cc
@@ -5,6 +5,8 @@ #include "ash/shelf/shelf_bezel_event_handler.h" #include "ash/shelf/shelf.h" +#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ui/aura/window.h" #include "ui/display/display.h" @@ -52,6 +54,27 @@ } } +void ShelfBezelEventHandler::OnTouchEvent(ui::TouchEvent* event) { + if (shelf_->auto_hide_behavior() != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) + return; + + // The event target should be the shelf widget. + aura::Window* target = static_cast<aura::Window*>(event->target()); + if (target != Shelf::ForWindow(target)->shelf_widget()->GetNativeView()) + return; + + // The touch-pressing event may hide the shelf. Lock the shelf's auto hide + // state to give the shelf a chance to handle the touch event before it being + // hidden. + ShelfLayoutManager* shelf_layout_manager = shelf_->shelf_layout_manager(); + if (event->type() == ui::ET_TOUCH_PRESSED && shelf_->IsVisible()) { + shelf_layout_manager->LockAutoHideState(true); + } else if (event->type() == ui::ET_TOUCH_RELEASED || + event->type() == ui::ET_TOUCH_CANCELLED) { + shelf_layout_manager->LockAutoHideState(false); + } +} + bool ShelfBezelEventHandler::IsShelfOnBezel(const gfx::Rect& screen, const gfx::Point& point) const { switch (shelf_->alignment()) {
diff --git a/ash/shelf/shelf_bezel_event_handler.h b/ash/shelf/shelf_bezel_event_handler.h index ea3b0a8..3f4ffe39 100644 --- a/ash/shelf/shelf_bezel_event_handler.h +++ b/ash/shelf/shelf_bezel_event_handler.h
@@ -24,6 +24,7 @@ // Overridden from ui::EventHandler: void OnGestureEvent(ui::GestureEvent* event) override; + void OnTouchEvent(ui::TouchEvent* event) override; private: bool IsShelfOnBezel(const gfx::Rect& screen, const gfx::Point& point) const;
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 69ce386d..2ffd79c 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc
@@ -1265,6 +1265,9 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( ShelfVisibilityState visibility_state) const { + if (is_auto_hide_state_locked_) + return state_.auto_hide_state; + // Shelf is not available before login. // TODO(crbug.com/701157): Remove this when the login webui fake-shelf is // replaced with views.
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index d8ec560..9f9b64c 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h
@@ -184,6 +184,10 @@ return state_.visibility_state; } + void LockAutoHideState(bool lock_auto_hide_state) { + is_auto_hide_state_locked_ = lock_auto_hide_state; + } + bool is_status_area_visible() const { return state_.is_status_area_visible; } // Returns whether status area is shown without the shelf. @@ -524,6 +528,10 @@ // Location of the most recent mouse drag event in screen coordinate. gfx::Point last_mouse_drag_position_; + // When it is true, |CalculateAutoHideState| returns the current auto hide + // state. + bool is_auto_hide_state_locked_ = false; + DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); };
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 0b2951ea..12739c3 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -24,6 +24,7 @@ #include "ash/keyboard/ui/keyboard_util.h" #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h" +#include "ash/public/cpp/shelf_item.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/test/shell_test_api.h" #include "ash/public/cpp/wallpaper_controller_observer.h" @@ -34,8 +35,10 @@ #include "ash/shelf/app_list_button.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_constants.h" +#include "ash/shelf/shelf_controller.h" #include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_view.h" +#include "ash/shelf/shelf_view_test_api.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/system/status_area_widget.h" @@ -57,6 +60,7 @@ #include "base/optional.h" #include "base/run_loop.h" #include "base/stl_util.h" +#include "base/test/metrics/user_action_tester.h" #include "base/test/scoped_feature_list.h" #include "base/time/time.h" #include "testing/gmock/include/gmock/gmock.h" @@ -2862,6 +2866,49 @@ EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); } +// Verifies that after showing the system tray by shortcut, the shelf item still +// responds to the gesture event. (see https://crbug.com/921182) +TEST_F(ShelfLayoutManagerTest, ShelfItemRespondToGestureEvent) { + // Prepare for the auto-hide shelf test. + views::Widget* widget = CreateTestWidget(); + widget->Maximize(); + Shelf* shelf = GetPrimaryShelf(); + ui::test::EventGenerator* generator = GetEventGenerator(); + generator->MoveMouseTo(0, 0); + + // Add ShelfItem. + ShelfController* controller = Shell::Get()->shelf_controller(); + const std::string app_id("app_id"); + ShelfItem item; + item.type = TYPE_APP; + item.id = ShelfID(app_id); + const int index = controller->model()->Add(item); + + // Turn on the auto-hide mode for shelf. Check the initial states. + shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); + ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); + layout_manager->LayoutShelf(); + EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); + EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); + + // Show the system tray with the shortcut. Expect that the shelf is shown + // after triggering the accelerator. + generator->PressKey(ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); + generator->ReleaseKey(ui::VKEY_S, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); + EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); + + // Tap on the shelf button. Expect that the shelf button responds to gesture + // events. + base::UserActionTester user_action_tester; + user_action_tester.ResetCounts(); + auto shelf_test_api = std::make_unique<ShelfViewTestAPI>( + GetPrimaryShelf()->GetShelfViewForTesting()); + views::View* shelf_view = shelf_test_api->GetViewAt(index); + gfx::Point shelf_btn_center = shelf_view->GetBoundsInScreen().CenterPoint(); + generator->GestureTapAt(shelf_btn_center); + EXPECT_EQ(1, user_action_tester.GetActionCount("Launcher_ClickOnApp")); +} + // Tests the auto-hide shelf status with mouse events. TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnMouseEvents) { views::Widget* widget = CreateTestWidget();
diff --git a/ash/shell.cc b/ash/shell.cc index 843e429..3ef6c288 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -83,7 +83,7 @@ #include "ash/shell_init_params.h" #include "ash/shell_observer.h" #include "ash/shell_state.h" -#include "ash/shutdown_controller.h" +#include "ash/shutdown_controller_impl.h" #include "ash/sticky_keys/sticky_keys_controller.h" #include "ash/system/audio/display_speaker_controller.h" #include "ash/system/bluetooth/bluetooth_notification_controller.h" @@ -557,7 +557,7 @@ session_controller_(std::make_unique<SessionControllerImpl>()), shell_delegate_(std::move(shell_delegate)), shell_state_(std::make_unique<ShellState>()), - shutdown_controller_(std::make_unique<ShutdownController>()), + shutdown_controller_(std::make_unique<ShutdownControllerImpl>()), system_tray_notifier_(std::make_unique<SystemTrayNotifier>()), vpn_list_(std::make_unique<VpnList>()), window_cycle_controller_(std::make_unique<WindowCycleController>()),
diff --git a/ash/shell.h b/ash/shell.h index d8c2019..d5553f1 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -169,7 +169,7 @@ struct ShellInitParams; class ShellObserver; class ShellState; -class ShutdownController; +class ShutdownControllerImpl; class SmsObserver; class SnapController; class SplitViewController; @@ -457,7 +457,7 @@ ShelfController* shelf_controller() { return shelf_controller_.get(); } ShellDelegate* shell_delegate() { return shell_delegate_.get(); } ShellState* shell_state() { return shell_state_.get(); } - ShutdownController* shutdown_controller() { + ShutdownControllerImpl* shutdown_controller() { return shutdown_controller_.get(); } SplitViewController* split_view_controller() { @@ -681,7 +681,7 @@ std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; std::unique_ptr<ShellDelegate> shell_delegate_; std::unique_ptr<ShellState> shell_state_; - std::unique_ptr<ShutdownController> shutdown_controller_; + std::unique_ptr<ShutdownControllerImpl> shutdown_controller_; std::unique_ptr<SystemNotificationController> system_notification_controller_; std::unique_ptr<SystemTrayModel> system_tray_model_; std::unique_ptr<SystemTrayNotifier> system_tray_notifier_;
diff --git a/ash/shutdown_controller.h b/ash/shutdown_controller.h deleted file mode 100644 index 49c7b75..0000000 --- a/ash/shutdown_controller.h +++ /dev/null
@@ -1,67 +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. - -#ifndef ASH_SHUTDOWN_CONTROLLER_H_ -#define ASH_SHUTDOWN_CONTROLLER_H_ - -#include "ash/ash_export.h" -#include "ash/public/interfaces/shutdown.mojom.h" -#include "base/macros.h" -#include "base/observer_list.h" -#include "mojo/public/cpp/bindings/binding_set.h" - -namespace ash { - -enum class ShutdownReason; - -// Handles actual device shutdown by making requests to powerd over D-Bus. -// Caches the DeviceRebootOnShutdown device policy sent from Chrome over mojo. -class ASH_EXPORT ShutdownController : public mojom::ShutdownController { - public: - class Observer { - public: - virtual ~Observer() {} - - // Called when shutdown policy changes. - virtual void OnShutdownPolicyChanged(bool reboot_on_shutdown) = 0; - }; - - ShutdownController(); - ~ShutdownController() override; - - void AddObserver(Observer* observer); - void RemoveObserver(Observer* observer); - - bool reboot_on_shutdown() const { return reboot_on_shutdown_; } - - // Shuts down or reboots based on the current DeviceRebootOnShutdown policy. - // Does not trigger the shutdown fade-out animation. For animated shutdown - // use LockStateController::RequestShutdown(). Virtual for testing. - virtual void ShutDownOrReboot(ShutdownReason reason); - - // Binds the mojom::ShutdownController interface request to this object. - void BindRequest(mojom::ShutdownControllerRequest request); - - // Sets the reboot policy. Used for testing only. - void SetRebootOnShutdownForTesting(bool reboot_on_shutdown); - - private: - // mojom::ShutdownController: - void SetRebootOnShutdown(bool reboot_on_shutdown) override; - void RequestShutdownFromLoginScreen() override; - - // Cached copy of the DeviceRebootOnShutdown policy from chrome. - bool reboot_on_shutdown_ = false; - - base::ObserverList<Observer>::Unchecked observers_; - - // Bindings for the ShutdownController interface. - mojo::BindingSet<mojom::ShutdownController> bindings_; - - DISALLOW_COPY_AND_ASSIGN(ShutdownController); -}; - -} // namespace ash - -#endif // ASH_SHUTDOWN_CONTROLLER_H_
diff --git a/ash/shutdown_controller.cc b/ash/shutdown_controller_impl.cc similarity index 65% rename from ash/shutdown_controller.cc rename to ash/shutdown_controller_impl.cc index 5aec57e9..ac92353 100644 --- a/ash/shutdown_controller.cc +++ b/ash/shutdown_controller_impl.cc
@@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/shutdown_controller.h" +#include "ash/shutdown_controller_impl.h" #include <utility> #include "ash/session/session_controller_impl.h" #include "ash/shell.h" #include "ash/shutdown_reason.h" -#include "ash/wm/lock_state_controller.h" #include "base/metrics/user_metrics.h" #include "base/strings/stringprintf.h" #include "base/system/sys_info.h" @@ -18,19 +17,27 @@ namespace ash { -ShutdownController::ShutdownController() = default; +ShutdownControllerImpl::ShutdownControllerImpl() = default; -ShutdownController::~ShutdownController() = default; +ShutdownControllerImpl::~ShutdownControllerImpl() = default; -void ShutdownController::AddObserver(Observer* observer) { +void ShutdownControllerImpl::AddObserver(Observer* observer) { observers_.AddObserver(observer); } -void ShutdownController::RemoveObserver(Observer* observer) { +void ShutdownControllerImpl::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } -void ShutdownController::ShutDownOrReboot(ShutdownReason reason) { +void ShutdownControllerImpl::SetRebootOnShutdown(bool reboot_on_shutdown) { + if (reboot_on_shutdown_ == reboot_on_shutdown) + return; + reboot_on_shutdown_ = reboot_on_shutdown; + for (auto& observer : observers_) + observer.OnShutdownPolicyChanged(reboot_on_shutdown_); +} + +void ShutdownControllerImpl::ShutDownOrReboot(ShutdownReason reason) { // For developers on Linux desktop just exit the app. if (!base::SysInfo::IsRunningOnChromeOS()) { Shell::Get()->session_controller()->RequestSignOut(); @@ -52,26 +59,4 @@ } } -void ShutdownController::BindRequest(mojom::ShutdownControllerRequest request) { - bindings_.AddBinding(this, std::move(request)); -} - -void ShutdownController::SetRebootOnShutdownForTesting( - bool reboot_on_shutdown) { - SetRebootOnShutdown(reboot_on_shutdown); -} - -void ShutdownController::SetRebootOnShutdown(bool reboot_on_shutdown) { - if (reboot_on_shutdown_ == reboot_on_shutdown) - return; - reboot_on_shutdown_ = reboot_on_shutdown; - for (auto& observer : observers_) - observer.OnShutdownPolicyChanged(reboot_on_shutdown_); -} - -void ShutdownController::RequestShutdownFromLoginScreen() { - Shell::Get()->lock_state_controller()->RequestShutdown( - ShutdownReason::LOGIN_SHUT_DOWN_BUTTON); -} - } // namespace ash
diff --git a/ash/shutdown_controller_impl.h b/ash/shutdown_controller_impl.h new file mode 100644 index 0000000..7d005396 --- /dev/null +++ b/ash/shutdown_controller_impl.h
@@ -0,0 +1,52 @@ +// 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. + +#ifndef ASH_SHUTDOWN_CONTROLLER_IMPL_H_ +#define ASH_SHUTDOWN_CONTROLLER_IMPL_H_ + +#include "ash/ash_export.h" +#include "ash/public/cpp/shutdown_controller.h" +#include "base/macros.h" +#include "base/observer_list.h" + +namespace ash { + +enum class ShutdownReason; + +// Handles actual device shutdown by making requests to powerd over D-Bus. +// Caches the DeviceRebootOnShutdown device policy sent from Chrome. +class ASH_EXPORT ShutdownControllerImpl : public ShutdownController { + public: + class Observer { + public: + virtual ~Observer() {} + + // Called when shutdown policy changes. + virtual void OnShutdownPolicyChanged(bool reboot_on_shutdown) = 0; + }; + + ShutdownControllerImpl(); + ~ShutdownControllerImpl() override; + + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + + bool reboot_on_shutdown() const { return reboot_on_shutdown_; } + + // ShutdownController: + void SetRebootOnShutdown(bool reboot_on_shutdown) override; + void ShutDownOrReboot(ShutdownReason reason) override; + + private: + // Cached copy of the DeviceRebootOnShutdown policy from chrome. + bool reboot_on_shutdown_ = false; + + base::ObserverList<Observer>::Unchecked observers_; + + DISALLOW_COPY_AND_ASSIGN(ShutdownControllerImpl); +}; + +} // namespace ash + +#endif // ASH_SHUTDOWN_CONTROLLER_IMPL_H_
diff --git a/ash/system/unified/top_shortcuts_view.cc b/ash/system/unified/top_shortcuts_view.cc index 917e9c8..0b5ff81 100644 --- a/ash/system/unified/top_shortcuts_view.cc +++ b/ash/system/unified/top_shortcuts_view.cc
@@ -12,7 +12,7 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/session/session_controller_impl.h" #include "ash/shell.h" -#include "ash/shutdown_controller.h" +#include "ash/shutdown_controller_impl.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_popup_utils.h"
diff --git a/ash/wm/fullscreen_window_finder_unittest.cc b/ash/wm/fullscreen_window_finder_unittest.cc index f11b1fa..cc6b897 100644 --- a/ash/wm/fullscreen_window_finder_unittest.cc +++ b/ash/wm/fullscreen_window_finder_unittest.cc
@@ -6,8 +6,8 @@ #include <memory> +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "ash/test/ash_test_base.h" #include "base/macros.h" #include "ui/aura/client/aura_constants.h" @@ -60,15 +60,14 @@ // Test that a pinned fullscreen window is found by GetWindowForFullscreenMode. TEST_F(FullscreenWindowFinderTest, PinnedFullscreen) { - test_window_->SetProperty(kWindowPinTypeKey, mojom::WindowPinType::PINNED); + test_window_->SetProperty(kWindowPinTypeKey, WindowPinType::kPinned); EXPECT_TRUE(FullscreenWindowExists()); } // Test that a trusted pinned fullscreen window is found by // GetWindowForFullscreenMode. TEST_F(FullscreenWindowFinderTest, TrustedPinnedFullscreen) { - test_window_->SetProperty(kWindowPinTypeKey, - mojom::WindowPinType::TRUSTED_PINNED); + test_window_->SetProperty(kWindowPinTypeKey, WindowPinType::kTrustedPinned); EXPECT_TRUE(FullscreenWindowExists()); }
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index aed6ed59..7b8cec5a 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc
@@ -11,11 +11,10 @@ #include "ash/accessibility/accessibility_controller.h" #include "ash/cancel_mode.h" #include "ash/public/cpp/shell_window_ids.h" -#include "ash/public/interfaces/shutdown.mojom.h" +#include "ash/public/cpp/shutdown_controller.h" #include "ash/session/session_controller_impl.h" #include "ash/shell.h" #include "ash/shell_delegate.h" -#include "ash/shutdown_controller.h" #include "ash/shutdown_reason.h" #include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wm/session_state_animator.h"
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc index 41b638f..823a2f2 100644 --- a/ash/wm/lock_state_controller_unittest.cc +++ b/ash/wm/lock_state_controller_unittest.cc
@@ -10,9 +10,9 @@ #include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/test_accessibility_controller_client.h" #include "ash/public/cpp/ash_switches.h" +#include "ash/public/cpp/shutdown_controller.h" #include "ash/session/session_controller_impl.h" #include "ash/shell.h" -#include "ash/shutdown_controller.h" #include "ash/shutdown_reason.h" #include "ash/system/power/power_button_controller.h" #include "ash/system/power/power_button_controller_test_api.h" @@ -58,6 +58,7 @@ private: // ShutdownController: + void SetRebootOnShutdown(bool reboot_on_shutdown) override {} void ShutDownOrReboot(ShutdownReason reason) override { num_shutdown_requests_++; } @@ -74,6 +75,7 @@ LockStateControllerTest() = default; ~LockStateControllerTest() override = default; + // PowerButtonTestBase: void SetUp() override { PowerButtonTestBase::SetUp(); InitPowerButtonControllerMembers( @@ -81,15 +83,25 @@ test_animator_ = new TestSessionStateAnimator; lock_state_controller_->set_animator_for_test(test_animator_); - lock_state_test_api_->set_shutdown_controller(&test_shutdown_controller_); + + shutdown_controller_resetter_ = + std::make_unique<ShutdownController::ScopedResetterForTest>(); + test_shutdown_controller_ = std::make_unique<TestShutdownController>(); + lock_state_test_api_->set_shutdown_controller( + test_shutdown_controller_.get()); a11y_controller_ = Shell::Get()->accessibility_controller(); a11y_controller_->SetClient(a11y_client_.CreateInterfacePtrAndBind()); } + void TearDown() override { + test_shutdown_controller_.reset(); + shutdown_controller_resetter_.reset(); + PowerButtonTestBase::TearDown(); + } protected: int NumShutdownRequests() { - return test_shutdown_controller_.num_shutdown_requests(); + return test_shutdown_controller_->num_shutdown_requests(); } void Advance(SessionStateAnimator::AnimationSpeed speed) { @@ -287,7 +299,9 @@ // Simulate that shutdown sound duration callback is done. void ShutdownSoundPlayed() { a11y_controller_->FlushMojoForTest(); } - TestShutdownController test_shutdown_controller_; + std::unique_ptr<ShutdownController::ScopedResetterForTest> + shutdown_controller_resetter_; + std::unique_ptr<TestShutdownController> test_shutdown_controller_; TestSessionStateAnimator* test_animator_ = nullptr; // not owned AccessibilityController* a11y_controller_ = nullptr; // not owned TestAccessibilityControllerClient a11y_client_;
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc index 480785a..972cd503 100644 --- a/ash/wm/window_state.cc +++ b/ash/wm/window_state.cc
@@ -12,9 +12,9 @@ #include "ash/public/cpp/app_types.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/window_animation_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_pin_type.mojom.h" #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/wm/collision_detection/collision_detection_utils.h" @@ -112,13 +112,13 @@ return WM_EVENT_NORMAL; } -WMEventType WMEventTypeFromWindowPinType(ash::mojom::WindowPinType type) { +WMEventType WMEventTypeFromWindowPinType(ash::WindowPinType type) { switch (type) { - case ash::mojom::WindowPinType::NONE: + case ash::WindowPinType::kNone: return WM_EVENT_NORMAL; - case ash::mojom::WindowPinType::PINNED: + case ash::WindowPinType::kPinned: return WM_EVENT_PIN; - case ash::mojom::WindowPinType::TRUSTED_PINNED: + case ash::WindowPinType::kTrustedPinned: return WM_EVENT_TRUSTED_PIN; } NOTREACHED() << "No WMEvent defined for the window pin type:" << type; @@ -561,7 +561,7 @@ return window_->GetProperty(aura::client::kShowStateKey); } -ash::mojom::WindowPinType WindowState::GetPinType() const { +ash::WindowPinType WindowState::GetPinType() const { return window_->GetProperty(kWindowPinTypeKey); } @@ -608,11 +608,11 @@ } // sync up current window show state with PinType property. - ash::mojom::WindowPinType pin_type = ash::mojom::WindowPinType::NONE; + ash::WindowPinType pin_type = ash::WindowPinType::kNone; if (GetStateType() == WindowStateType::kPinned) - pin_type = ash::mojom::WindowPinType::PINNED; + pin_type = ash::WindowPinType::kPinned; else if (GetStateType() == WindowStateType::kTrustedPinned) - pin_type = ash::mojom::WindowPinType::TRUSTED_PINNED; + pin_type = ash::WindowPinType::kTrustedPinned; if (pin_type != GetPinType()) { base::AutoReset<bool> resetter(&ignore_property_change_, true); window_->SetProperty(kWindowPinTypeKey, pin_type);
diff --git a/ash/wm/window_state.h b/ash/wm/window_state.h index 6d166044..5f80e8b 100644 --- a/ash/wm/window_state.h +++ b/ash/wm/window_state.h
@@ -27,11 +27,8 @@ namespace ash { class LockWindowState; class TabletModeWindowState; -enum class WindowStateType; - -namespace mojom { enum class WindowPinType; -} +enum class WindowStateType; namespace wm { class InitialStateTestState; @@ -386,7 +383,7 @@ ui::WindowShowState GetShowState() const; // Return the window's current pin type. - ash::mojom::WindowPinType GetPinType() const; + ash::WindowPinType GetPinType() const; // Sets the window's bounds in screen coordinates. void SetBoundsInScreen(const gfx::Rect& bounds_in_screen);
diff --git a/base/bind.h b/base/bind.h index 3c3d5d3..c2c2d433 100644 --- a/base/bind.h +++ b/base/bind.h
@@ -7,6 +7,7 @@ #include <functional> #include <memory> +#include <type_traits> #include <utility> #include "base/bind_internal.h" @@ -179,26 +180,39 @@ using MakeUnwrappedTypeList = typename MakeUnwrappedTypeListImpl<is_once, is_method, Args...>::Type; -} // namespace internal +// Used below in BindImpl to determine whether to use Invoker::Run or +// Invoker::RunOnce. +// Note: Simply using `kIsOnce ? &Invoker::RunOnce : &Invoker::Run` does not +// work, since the compiler needs to check whether both expressions are +// well-formed. Using `Invoker::Run` with a OnceCallback triggers a +// static_assert, which is why the ternary expression does not compile. +// TODO(crbug.com/752720): Remove this indirection once we have `if constexpr`. +template <bool is_once, typename Invoker> +struct InvokeFuncImpl; -// Bind as OnceCallback. -template <typename Functor, typename... Args> -inline OnceCallback<MakeUnboundRunType<Functor, Args...>> -BindOnce(Functor&& functor, Args&&... args) { - static_assert(!internal::IsOnceCallback<std::decay_t<Functor>>() || - (std::is_rvalue_reference<Functor&&>() && - !std::is_const<std::remove_reference_t<Functor>>()), - "BindOnce requires non-const rvalue for OnceCallback binding." - " I.e.: base::BindOnce(std::move(callback))."); +template <typename Invoker> +struct InvokeFuncImpl<true, Invoker> { + static constexpr auto Value = &Invoker::RunOnce; +}; +template <typename Invoker> +struct InvokeFuncImpl<false, Invoker> { + static constexpr auto Value = &Invoker::Run; +}; + +template <template <typename> class CallbackT, + typename Functor, + typename... Args> +decltype(auto) BindImpl(Functor&& functor, Args&&... args) { // This block checks if each |args| matches to the corresponding params of the // target function. This check does not affect the behavior of Bind, but its // error message should be more readable. + static constexpr bool kIsOnce = IsOnceCallback<CallbackT<void()>>::value; using Helper = internal::BindTypeHelper<Functor, Args...>; using FunctorTraits = typename Helper::FunctorTraits; using BoundArgsList = typename Helper::BoundArgsList; using UnwrappedArgsList = - internal::MakeUnwrappedTypeList<true, FunctorTraits::is_method, + internal::MakeUnwrappedTypeList<kIsOnce, FunctorTraits::is_method, Args&&...>; using BoundParamsList = typename Helper::BoundParamsList; static_assert(internal::AssertBindArgsValidity< @@ -209,13 +223,13 @@ using BindState = internal::MakeBindStateType<Functor, Args...>; using UnboundRunType = MakeUnboundRunType<Functor, Args...>; using Invoker = internal::Invoker<BindState, UnboundRunType>; - using CallbackType = OnceCallback<UnboundRunType>; + using CallbackType = CallbackT<UnboundRunType>; // Store the invoke func into PolymorphicInvoke before casting it to // InvokeFuncStorage, so that we can ensure its type matches to // PolymorphicInvoke, to which CallbackType will cast back. using PolymorphicInvoke = typename CallbackType::PolymorphicInvoke; - PolymorphicInvoke invoke_func = &Invoker::RunOnce; + PolymorphicInvoke invoke_func = InvokeFuncImpl<kIsOnce, Invoker>::Value; using InvokeFuncStorage = internal::BindStateBase::InvokeFuncStorage; return CallbackType(BindState::Create( @@ -223,6 +237,23 @@ std::forward<Functor>(functor), std::forward<Args>(args)...)); } +} // namespace internal + +// Bind as OnceCallback. +template <typename Functor, typename... Args> +inline OnceCallback<MakeUnboundRunType<Functor, Args...>> BindOnce( + Functor&& functor, + Args&&... args) { + static_assert(!internal::IsOnceCallback<std::decay_t<Functor>>() || + (std::is_rvalue_reference<Functor&&>() && + !std::is_const<std::remove_reference_t<Functor>>()), + "BindOnce requires non-const rvalue for OnceCallback binding." + " I.e.: base::BindOnce(std::move(callback))."); + + return internal::BindImpl<OnceCallback>(std::forward<Functor>(functor), + std::forward<Args>(args)...); +} + // Bind as RepeatingCallback. template <typename Functor, typename... Args> inline RepeatingCallback<MakeUnboundRunType<Functor, Args...>> @@ -231,36 +262,8 @@ !internal::IsOnceCallback<std::decay_t<Functor>>(), "BindRepeating cannot bind OnceCallback. Use BindOnce with std::move()."); - // This block checks if each |args| matches to the corresponding params of the - // target function. This check does not affect the behavior of Bind, but its - // error message should be more readable. - using Helper = internal::BindTypeHelper<Functor, Args...>; - using FunctorTraits = typename Helper::FunctorTraits; - using BoundArgsList = typename Helper::BoundArgsList; - using UnwrappedArgsList = - internal::MakeUnwrappedTypeList<false, FunctorTraits::is_method, - Args&&...>; - using BoundParamsList = typename Helper::BoundParamsList; - static_assert(internal::AssertBindArgsValidity< - std::make_index_sequence<Helper::num_bounds>, BoundArgsList, - UnwrappedArgsList, BoundParamsList>::ok, - "The bound args need to be convertible to the target params."); - - using BindState = internal::MakeBindStateType<Functor, Args...>; - using UnboundRunType = MakeUnboundRunType<Functor, Args...>; - using Invoker = internal::Invoker<BindState, UnboundRunType>; - using CallbackType = RepeatingCallback<UnboundRunType>; - - // Store the invoke func into PolymorphicInvoke before casting it to - // InvokeFuncStorage, so that we can ensure its type matches to - // PolymorphicInvoke, to which CallbackType will cast back. - using PolymorphicInvoke = typename CallbackType::PolymorphicInvoke; - PolymorphicInvoke invoke_func = &Invoker::Run; - - using InvokeFuncStorage = internal::BindStateBase::InvokeFuncStorage; - return CallbackType(BindState::Create( - reinterpret_cast<InvokeFuncStorage>(invoke_func), - std::forward<Functor>(functor), std::forward<Args>(args)...)); + return internal::BindImpl<RepeatingCallback>(std::forward<Functor>(functor), + std::forward<Args>(args)...); } // Unannotated Bind.
diff --git a/base/stl_util.h b/base/stl_util.h index f78eb2f..3a4dd7f 100644 --- a/base/stl_util.h +++ b/base/stl_util.h
@@ -17,8 +17,10 @@ #include <map> #include <set> #include <string> +#include <type_traits> #include <unordered_map> #include <unordered_set> +#include <utility> #include <vector> #include "base/logging.h" @@ -45,6 +47,38 @@ std::is_same<typename std::iterator_traits<Iter>::iterator_category, std::random_access_iterator_tag>::value; +// Utility type traits used for specializing base::Contains() below. +template <typename Container, typename Element, typename = void> +struct HasFindWithNpos : std::false_type {}; + +template <typename Container, typename Element> +struct HasFindWithNpos< + Container, + Element, + void_t<decltype(std::declval<const Container&>().find( + std::declval<const Element&>()) != Container::npos)>> + : std::true_type {}; + +template <typename Container, typename Element, typename = void> +struct HasFindWithEnd : std::false_type {}; + +template <typename Container, typename Element> +struct HasFindWithEnd<Container, + Element, + void_t<decltype(std::declval<const Container&>().find( + std::declval<const Element&>()) != + std::declval<const Container&>().end())>> + : std::true_type {}; + +template <typename Container, typename Element, typename = void> +struct HasContains : std::false_type {}; + +template <typename Container, typename Element> +struct HasContains<Container, + Element, + void_t<decltype(std::declval<const Container&>().contains( + std::declval<const Element&>()))>> : std::true_type {}; + } // namespace internal // C++14 implementation of C++17's std::size(): @@ -140,6 +174,65 @@ return std::count(container.begin(), container.end(), val); } +// General purpose implementation to check if |container| contains |value|. +template <typename Container, + typename Value, + std::enable_if_t< + !internal::HasFindWithNpos<Container, Value>::value && + !internal::HasFindWithEnd<Container, Value>::value && + !internal::HasContains<Container, Value>::value>* = nullptr> +bool Contains(const Container& container, const Value& value) { + using std::begin; + using std::end; + return std::find(begin(container), end(container), value) != end(container); +} + +// Specialized Contains() implementation for when |container| has a find() +// member function and a static npos member, but no contains() member function. +template <typename Container, + typename Value, + std::enable_if_t<internal::HasFindWithNpos<Container, Value>::value && + !internal::HasContains<Container, Value>::value>* = + nullptr> +bool Contains(const Container& container, const Value& value) { + return container.find(value) != Container::npos; +} + +// Specialized Contains() implementation for when |container| has a find() +// and end() member function, but no contains() member function. +template <typename Container, + typename Value, + std::enable_if_t<internal::HasFindWithEnd<Container, Value>::value && + !internal::HasContains<Container, Value>::value>* = + nullptr> +bool Contains(const Container& container, const Value& value) { + return container.find(value) != container.end(); +} + +// Specialized Contains() implementation for when |container| has a contains() +// member function. +template < + typename Container, + typename Value, + std::enable_if_t<internal::HasContains<Container, Value>::value>* = nullptr> +bool Contains(const Container& container, const Value& value) { + return container.contains(value); +} + +// Test to see if a set or map contains a particular key. +// Returns true if the key is in the collection. +template <typename Collection, typename Key> +bool ContainsKey(const Collection& collection, const Key& key) { + return Contains(collection, key); +} + +// Test to see if a collection like a vector contains a particular value. +// Returns true if the value is in the collection. +template <typename Collection, typename Value> +bool ContainsValue(const Collection& collection, const Value& value) { + return Contains(collection, value); +} + // O(1) implementation of const casting an iterator for any sequence, // associative or unordered associative container in the STL. // @@ -171,26 +264,8 @@ return begin(c) + (it - cbegin(c)); } -// Test to see if a set or map contains a particular key. -// Returns true if the key is in the collection. -template <typename Collection, typename Key> -bool ContainsKey(const Collection& collection, const Key& key) { - return collection.find(key) != collection.end(); -} - namespace internal { -template <typename Collection> -class HasKeyType { - template <typename C> - static std::true_type test(typename C::key_type*); - template <typename C> - static std::false_type test(...); - - public: - static constexpr bool value = decltype(test<Collection>(nullptr))::value; -}; - template <typename Map, typename Key, typename Value> std::pair<typename Map::iterator, bool> InsertOrAssignImpl(Map& map, Key&& key, @@ -281,19 +356,6 @@ } // namespace internal -// Test to see if a collection like a vector contains a particular value. -// Returns true if the value is in the collection. -// Don't use this on collections such as sets or maps. This is enforced by -// disabling this method if the collection defines a key_type. -template <typename Collection, - typename Value, - typename std::enable_if<!internal::HasKeyType<Collection>::value, - int>::type = 0> -bool ContainsValue(const Collection& collection, const Value& value) { - return std::find(std::begin(collection), std::end(collection), value) != - std::end(collection); -} - // Implementation of C++17's std::map::insert_or_assign as a free function. template <typename Map, typename Value> std::pair<typename Map::iterator, bool>
diff --git a/base/stl_util_unittest.cc b/base/stl_util_unittest.cc index c0253df..8c96913 100644 --- a/base/stl_util_unittest.cc +++ b/base/stl_util_unittest.cc
@@ -21,6 +21,7 @@ #include <unordered_set> #include <vector> +#include "base/containers/flat_set.h" #include "base/containers/queue.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" @@ -635,14 +636,39 @@ EXPECT_EQ(expected, lhs); } -TEST(ContainsValue, OrdinaryArrays) { +TEST(STLUtilTest, GenericContains) { const char allowed_chars[] = {'a', 'b', 'c', 'd'}; - EXPECT_TRUE(ContainsValue(allowed_chars, 'a')); - EXPECT_FALSE(ContainsValue(allowed_chars, 'z')); - EXPECT_FALSE(ContainsValue(allowed_chars, 0)); + + EXPECT_TRUE(Contains(allowed_chars, 'a')); + EXPECT_FALSE(Contains(allowed_chars, 'z')); + EXPECT_FALSE(Contains(allowed_chars, 0)); const char allowed_chars_including_nul[] = "abcd"; - EXPECT_TRUE(ContainsValue(allowed_chars_including_nul, 0)); + EXPECT_TRUE(Contains(allowed_chars_including_nul, 0)); +} + +TEST(STLUtilTest, ContainsWithFindAndNpos) { + std::string str = "abcd"; + + EXPECT_TRUE(Contains(str, 'a')); + EXPECT_FALSE(Contains(str, 'z')); + EXPECT_FALSE(Contains(str, 0)); +} + +TEST(STLUtilTest, ContainsWithFindAndEnd) { + std::set<int> set = {1, 2, 3, 4}; + + EXPECT_TRUE(Contains(set, 1)); + EXPECT_FALSE(Contains(set, 5)); + EXPECT_FALSE(Contains(set, 0)); +} + +TEST(STLUtilTest, ContainsWithContains) { + flat_set<int> set = {1, 2, 3, 4}; + + EXPECT_TRUE(Contains(set, 1)); + EXPECT_FALSE(Contains(set, 5)); + EXPECT_FALSE(Contains(set, 0)); } TEST(STLUtilTest, InsertOrAssign) {
diff --git a/base/strings/string_number_conversions_fuzzer.cc b/base/strings/string_number_conversions_fuzzer.cc index 2fed7de..005873f 100644 --- a/base/strings/string_number_conversions_fuzzer.cc +++ b/base/strings/string_number_conversions_fuzzer.cc
@@ -10,8 +10,59 @@ #include "base/strings/string_number_conversions.h" +template <class NumberType, class StringPieceType, class StringType> +void CheckRoundtripsT(const uint8_t* data, + const size_t size, + StringType (*num_to_string)(NumberType), + bool (*string_to_num)(StringPieceType, NumberType*)) { + // Ensure we can read a NumberType from |data| + if (size < sizeof(NumberType)) + return; + const NumberType v1 = *reinterpret_cast<const NumberType*>(data); + + // Because we started with an arbitrary NumberType value, not an arbitrary + // string, we expect that the function |string_to_num| (e.g. StringToInt) will + // return true, indicating a perfect conversion. + NumberType v2; + CHECK(string_to_num(num_to_string(v1), &v2)); + + // Given that this was a perfect conversion, we expect the original NumberType + // value to equal the newly parsed one. + CHECK_EQ(v1, v2); +} + +template <class NumberType> +void CheckRoundtrips(const uint8_t* data, + const size_t size, + bool (*string_to_num)(base::StringPiece, NumberType*)) { + return CheckRoundtripsT<NumberType, base::StringPiece, std::string>( + data, size, &base::NumberToString, string_to_num); +} + +template <class NumberType> +void CheckRoundtrips16(const uint8_t* data, + const size_t size, + bool (*string_to_num)(base::StringPiece16, + NumberType*)) { + return CheckRoundtripsT<NumberType, base::StringPiece16, base::string16>( + data, size, &base::NumberToString16, string_to_num); +} + // Entry point for LibFuzzer. extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + // For each instantiation of NumberToString f and its corresponding StringTo* + // function g, check that f(g(x)) = x holds for fuzzer-determined values of x. + CheckRoundtrips<int>(data, size, &base::StringToInt); + CheckRoundtrips16<int>(data, size, &base::StringToInt); + CheckRoundtrips<unsigned int>(data, size, &base::StringToUint); + CheckRoundtrips16<unsigned int>(data, size, &base::StringToUint); + CheckRoundtrips<int64_t>(data, size, &base::StringToInt64); + CheckRoundtrips16<int64_t>(data, size, &base::StringToInt64); + CheckRoundtrips<uint64_t>(data, size, &base::StringToUint64); + CheckRoundtrips16<uint64_t>(data, size, &base::StringToUint64); + CheckRoundtrips<size_t>(data, size, &base::StringToUint64); + CheckRoundtrips16<size_t>(data, size, &base::StringToUint64); + base::StringPiece string_piece_input(reinterpret_cast<const char*>(data), size); std::string string_input(reinterpret_cast<const char*>(data), size);
diff --git a/base/task/post_task.cc b/base/task/post_task.cc index fce9d8fa..8dac86b6 100644 --- a/base/task/post_task.cc +++ b/base/task/post_task.cc
@@ -25,7 +25,7 @@ private: bool PostTask(const Location& from_here, OnceClosure task) override { - PostTaskWithTraits(from_here, traits_, std::move(task)); + ::base::PostTask(from_here, traits_, std::move(task)); return true; } @@ -61,83 +61,129 @@ bool PostDelayedTask(const Location& from_here, OnceClosure task, TimeDelta delay) { - return PostDelayedTaskWithTraits(from_here, TaskTraits(), std::move(task), - delay); + return PostDelayedTask(from_here, TaskTraits(), std::move(task), delay); } bool PostTaskAndReply(const Location& from_here, OnceClosure task, OnceClosure reply) { - return PostTaskWithTraitsAndReply(from_here, TaskTraits(), std::move(task), - std::move(reply)); + return PostTaskAndReply(from_here, TaskTraits(), std::move(task), + std::move(reply)); } -bool PostTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task) { - return PostDelayedTaskWithTraits(from_here, traits, std::move(task), - TimeDelta()); +bool PostTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task) { + return PostDelayedTask(from_here, traits, std::move(task), TimeDelta()); } -bool PostDelayedTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - TimeDelta delay) { +bool PostDelayedTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay) { const TaskTraits adjusted_traits = GetTaskTraitsWithExplicitPriority(traits); return GetTaskExecutorForTraits(adjusted_traits) - ->PostDelayedTaskWithTraits(from_here, adjusted_traits, std::move(task), - delay); + ->PostDelayedTask(from_here, adjusted_traits, std::move(task), delay); } -bool PostTaskWithTraitsAndReply(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - OnceClosure reply) { +bool PostTaskAndReply(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + OnceClosure reply) { return PostTaskAndReplyWithTraitsTaskRunner(traits).PostTaskAndReply( from_here, std::move(task), std::move(reply)); } -scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { - return GetTaskExecutorForTraits(traits)->CreateTaskRunnerWithTraits(traits); +scoped_refptr<TaskRunner> CreateTaskRunner(const TaskTraits& traits) { + return GetTaskExecutorForTraits(traits)->CreateTaskRunner(traits); } -scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( +scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunner( const TaskTraits& traits) { - return GetTaskExecutorForTraits(traits)->CreateSequencedTaskRunnerWithTraits( - traits); + return GetTaskExecutorForTraits(traits)->CreateSequencedTaskRunner(traits); } scoped_refptr<UpdateableSequencedTaskRunner> -CreateUpdateableSequencedTaskRunnerWithTraits(const TaskTraits& traits) { +CreateUpdateableSequencedTaskRunner(const TaskTraits& traits) { DCHECK(ThreadPoolInstance::Get()) << "Ref. Prerequisite section of post_task.h.\n\n" "Hint: if this is in a unit test, you're likely merely missing a " "base::test::ScopedTaskEnvironment member in your fixture.\n"; DCHECK(traits.use_thread_pool()) << "The base::UseThreadPool() trait is mandatory with " - "CreateUpdateableSequencedTaskRunnerWithTraits()."; + "CreateUpdateableSequencedTaskRunner()."; CHECK_EQ(traits.extension_id(), TaskTraitsExtensionStorage::kInvalidExtensionId) << "Extension traits cannot be used with " - "CreateUpdateableSequencedTaskRunnerWithTraits()."; + "CreateUpdateableSequencedTaskRunner()."; const TaskTraits adjusted_traits = GetTaskTraitsWithExplicitPriority(traits); return static_cast<internal::ThreadPoolImpl*>(ThreadPoolInstance::Get()) - ->CreateUpdateableSequencedTaskRunnerWithTraits(adjusted_traits); + ->CreateUpdateableSequencedTaskRunner(adjusted_traits); +} + +scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunner( + const TaskTraits& traits, + SingleThreadTaskRunnerThreadMode thread_mode) { + return GetTaskExecutorForTraits(traits)->CreateSingleThreadTaskRunner( + traits, thread_mode); +} + +#if defined(OS_WIN) +scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunner( + const TaskTraits& traits, + SingleThreadTaskRunnerThreadMode thread_mode) { + return GetTaskExecutorForTraits(traits)->CreateCOMSTATaskRunner(traits, + thread_mode); +} +#endif // defined(OS_WIN) + +// TODO(crbug.com/968047): Update all call sites and remove these forwarding +// wrappers. +bool PostTaskWithTraits(const Location& from_here, + const TaskTraits& traits, + OnceClosure task) { + return PostTask(from_here, traits, std::move(task)); +} + +bool PostDelayedTaskWithTraits(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay) { + return PostDelayedTask(from_here, traits, std::move(task), delay); +} + +bool PostTaskWithTraitsAndReply(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + OnceClosure reply) { + return PostTaskAndReply(from_here, traits, std::move(task), std::move(reply)); +} + +scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(const TaskTraits& traits) { + return CreateTaskRunner(traits); +} + +scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( + const TaskTraits& traits) { + return CreateSequencedTaskRunner(traits); +} + +scoped_refptr<UpdateableSequencedTaskRunner> +CreateUpdateableSequencedTaskRunnerWithTraits(const TaskTraits& traits) { + return CreateUpdateableSequencedTaskRunner(traits); } scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { - return GetTaskExecutorForTraits(traits) - ->CreateSingleThreadTaskRunnerWithTraits(traits, thread_mode); + return CreateSingleThreadTaskRunner(traits, thread_mode); } #if defined(OS_WIN) scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunnerWithTraits( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { - return GetTaskExecutorForTraits(traits)->CreateCOMSTATaskRunnerWithTraits( - traits, thread_mode); + return CreateCOMSTATaskRunner(traits, thread_mode); } #endif // defined(OS_WIN)
diff --git a/base/task/post_task.h b/base/task/post_task.h index 3f6c18a..9183c7e 100644 --- a/base/task/post_task.h +++ b/base/task/post_task.h
@@ -32,21 +32,21 @@ // PostTask(FROM_HERE, BindOnce(...)); // // To post a high priority one-off task to respond to a user interaction: -// PostTaskWithTraits( +// PostTask( // FROM_HERE, // {TaskPriority::USER_BLOCKING}, // BindOnce(...)); // // To post tasks that must run in sequence with default traits: // scoped_refptr<SequencedTaskRunner> task_runner = -// CreateSequencedTaskRunnerWithTraits(TaskTraits()); +// CreateSequencedTaskRunner(TaskTraits()); // task_runner->PostTask(FROM_HERE, BindOnce(...)); // task_runner->PostTask(FROM_HERE, BindOnce(...)); // // To post tasks that may block, must run in sequence and can be skipped on // shutdown: // scoped_refptr<SequencedTaskRunner> task_runner = -// CreateSequencedTaskRunnerWithTraits( +// CreateSequencedTaskRunner( // {MayBlock(), TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); // task_runner->PostTask(FROM_HERE, BindOnce(...)); // task_runner->PostTask(FROM_HERE, BindOnce(...)); @@ -78,24 +78,23 @@ // have to worry about this. You will encounter DCHECKs or nullptr dereferences // if this is violated. For tests, prefer base::test::ScopedTaskEnvironment. -// Equivalent to calling PostTaskWithTraits with default TaskTraits. +// Equivalent to calling PostTask with default TaskTraits. BASE_EXPORT bool PostTask(const Location& from_here, OnceClosure task); -// Equivalent to calling PostDelayedTaskWithTraits with default TaskTraits. +// Equivalent to calling PostDelayedTask with default TaskTraits. // -// Use PostDelayedTaskWithTraits to specify a BEST_EFFORT priority if the task -// doesn't have to run as soon as |delay| expires. +// Use PostDelayedTask to specify a BEST_EFFORT priority if the task doesn't +// have to run as soon as |delay| expires. BASE_EXPORT bool PostDelayedTask(const Location& from_here, OnceClosure task, TimeDelta delay); -// Equivalent to calling PostTaskWithTraitsAndReply with default TaskTraits. +// Equivalent to calling PostTaskAndReply with default TaskTraits. BASE_EXPORT bool PostTaskAndReply(const Location& from_here, OnceClosure task, OnceClosure reply); -// Equivalent to calling PostTaskWithTraitsAndReplyWithResult with default -// TaskTraits. +// Equivalent to calling PostTaskAndReplyWithResult with default TaskTraits. // // Though RepeatingCallback is convertible to OnceCallback, we need a // CallbackType template since we can not use template deduction and object @@ -109,15 +108,15 @@ bool PostTaskAndReplyWithResult(const Location& from_here, CallbackType<TaskReturnType()> task, CallbackType<void(ReplyArgType)> reply) { - return PostTaskWithTraitsAndReplyWithResult( - from_here, TaskTraits(), std::move(task), std::move(reply)); + return PostTaskAndReplyWithResult(from_here, TaskTraits(), std::move(task), + std::move(reply)); } // Posts |task| with specific |traits|. Returns false if the task definitely // won't run because of current shutdown state. -BASE_EXPORT bool PostTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task); +BASE_EXPORT bool PostTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task); // Posts |task| with specific |traits|. |task| will not run before |delay| // expires. Returns false if the task definitely won't run because of current @@ -125,20 +124,20 @@ // // Specify a BEST_EFFORT priority via |traits| if the task doesn't have to run // as soon as |delay| expires. -BASE_EXPORT bool PostDelayedTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - TimeDelta delay); +BASE_EXPORT bool PostDelayedTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay); // Posts |task| with specific |traits| and posts |reply| on the caller's // execution context (i.e. same sequence or thread and same TaskTraits if // applicable) when |task| completes. Returns false if the task definitely won't // run because of current shutdown state. Can only be called when // SequencedTaskRunnerHandle::IsSet(). -BASE_EXPORT bool PostTaskWithTraitsAndReply(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - OnceClosure reply); +BASE_EXPORT bool PostTaskAndReply(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + OnceClosure reply); // Posts |task| with specific |traits| and posts |reply| with the return value // of |task| as argument on the caller's execution context (i.e. same sequence @@ -155,13 +154,12 @@ typename TaskReturnType, typename ReplyArgType, typename = EnableIfIsBaseCallback<CallbackType>> -bool PostTaskWithTraitsAndReplyWithResult( - const Location& from_here, - const TaskTraits& traits, - CallbackType<TaskReturnType()> task, - CallbackType<void(ReplyArgType)> reply) { +bool PostTaskAndReplyWithResult(const Location& from_here, + const TaskTraits& traits, + CallbackType<TaskReturnType()> task, + CallbackType<void(ReplyArgType)> reply) { auto* result = new std::unique_ptr<TaskReturnType>(); - return PostTaskWithTraitsAndReply( + return PostTaskAndReply( from_here, traits, BindOnce(&internal::ReturnAsParamAdapter<TaskReturnType>, std::move(task), result), @@ -169,15 +167,30 @@ std::move(reply), Owned(result))); } +// Temporary wrapper for PostTaskAndReplyWithResult. +// TODO(crbug.com/968047): Update all call sites and remove. +template <template <typename> class CallbackType, + typename TaskReturnType, + typename ReplyArgType, + typename = EnableIfIsBaseCallback<CallbackType>> +bool PostTaskWithTraitsAndReplyWithResult( + const Location& from_here, + const TaskTraits& traits, + CallbackType<TaskReturnType()> task, + CallbackType<void(ReplyArgType)> reply) { + return PostTaskAndReplyWithResult(from_here, traits, std::move(task), + std::move(reply)); +} + // Returns a TaskRunner whose PostTask invocations result in scheduling tasks // using |traits|. Tasks may run in any order and in parallel. -BASE_EXPORT scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( +BASE_EXPORT scoped_refptr<TaskRunner> CreateTaskRunner( const TaskTraits& traits); // Returns a SequencedTaskRunner whose PostTask invocations result in scheduling // tasks using |traits|. Tasks run one at a time in posting order. -BASE_EXPORT scoped_refptr<SequencedTaskRunner> -CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits); +BASE_EXPORT scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunner( + const TaskTraits& traits); // Returns a task runner whose PostTask invocations result in scheduling tasks // using |traits|. The priority in |traits| can be updated at any time via @@ -191,7 +204,7 @@ // - base::ThreadPolicy must be specified if the priority of the task runner // will ever be increased from BEST_EFFORT. BASE_EXPORT scoped_refptr<UpdateableSequencedTaskRunner> -CreateUpdateableSequencedTaskRunnerWithTraits(const TaskTraits& traits); +CreateUpdateableSequencedTaskRunner(const TaskTraits& traits); // Returns a SingleThreadTaskRunner whose PostTask invocations result in // scheduling tasks using |traits| on a thread determined by |thread_mode|. See @@ -202,12 +215,11 @@ // // If all you need is to make sure that tasks don't run concurrently (e.g. // because they access a data structure which is not thread-safe), use -// CreateSequencedTaskRunnerWithTraits(). Only use this if you rely on a thread- -// affine API (it might be safer to assume thread-affinity when dealing with +// CreateSequencedTaskRunner(). Only use this if you rely on a thread-affine API +// (it might be safer to assume thread-affinity when dealing with // under-documented third-party APIs, e.g. other OS') or share data across tasks // using thread-local storage. -BASE_EXPORT scoped_refptr<SingleThreadTaskRunner> -CreateSingleThreadTaskRunnerWithTraits( +BASE_EXPORT scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode = SingleThreadTaskRunnerThreadMode::SHARED); @@ -225,6 +237,38 @@ // implementation is free to share apartments or create new apartments as // necessary. In either case, care should be taken to make sure COM pointers are // not smuggled across apartments. +BASE_EXPORT scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunner( + const TaskTraits& traits, + SingleThreadTaskRunnerThreadMode thread_mode = + SingleThreadTaskRunnerThreadMode::SHARED); +#endif // defined(OS_WIN) + +// Temporary wrappers for the task posting APIs while we remove the "WithTraits" +// suffix. +// TODO(crbug.com/968047): Update all call sites and remove. +BASE_EXPORT bool PostTaskWithTraits(const Location& from_here, + const TaskTraits& traits, + OnceClosure task); +BASE_EXPORT bool PostDelayedTaskWithTraits(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay); +BASE_EXPORT bool PostTaskWithTraitsAndReply(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + OnceClosure reply); +BASE_EXPORT scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( + const TaskTraits& traits); +BASE_EXPORT scoped_refptr<SequencedTaskRunner> +CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits); +BASE_EXPORT scoped_refptr<UpdateableSequencedTaskRunner> +CreateUpdateableSequencedTaskRunnerWithTraits(const TaskTraits& traits); +BASE_EXPORT scoped_refptr<SingleThreadTaskRunner> +CreateSingleThreadTaskRunnerWithTraits( + const TaskTraits& traits, + SingleThreadTaskRunnerThreadMode thread_mode = + SingleThreadTaskRunnerThreadMode::SHARED); +#if defined(OS_WIN) BASE_EXPORT scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunnerWithTraits(const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode =
diff --git a/base/task/post_task_unittest.cc b/base/task/post_task_unittest.cc index ecf0d38..280aa8d 100644 --- a/base/task/post_task_unittest.cc +++ b/base/task/post_task_unittest.cc
@@ -26,47 +26,44 @@ class MockTaskExecutor : public TaskExecutor { public: MockTaskExecutor() { - ON_CALL(*this, PostDelayedTaskWithTraitsMock(_, _, _, _)) + ON_CALL(*this, PostDelayedTaskMock(_, _, _, _)) .WillByDefault(Invoke([this](const Location& from_here, const TaskTraits& traits, OnceClosure& task, TimeDelta delay) { return runner_->PostDelayedTask(from_here, std::move(task), delay); })); - ON_CALL(*this, CreateTaskRunnerWithTraits(_)) - .WillByDefault(Return(runner_)); - ON_CALL(*this, CreateSequencedTaskRunnerWithTraits(_)) - .WillByDefault(Return(runner_)); - ON_CALL(*this, CreateSingleThreadTaskRunnerWithTraits(_, _)) + ON_CALL(*this, CreateTaskRunner(_)).WillByDefault(Return(runner_)); + ON_CALL(*this, CreateSequencedTaskRunner(_)).WillByDefault(Return(runner_)); + ON_CALL(*this, CreateSingleThreadTaskRunner(_, _)) .WillByDefault(Return(runner_)); #if defined(OS_WIN) - ON_CALL(*this, CreateCOMSTATaskRunnerWithTraits(_, _)) - .WillByDefault(Return(runner_)); + ON_CALL(*this, CreateCOMSTATaskRunner(_, _)).WillByDefault(Return(runner_)); #endif // defined(OS_WIN) } // TaskExecutor: // Helper because gmock doesn't support move-only types. - bool PostDelayedTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - TimeDelta delay) override { - return PostDelayedTaskWithTraitsMock(from_here, traits, task, delay); + bool PostDelayedTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay) override { + return PostDelayedTaskMock(from_here, traits, task, delay); } - MOCK_METHOD4(PostDelayedTaskWithTraitsMock, + MOCK_METHOD4(PostDelayedTaskMock, bool(const Location& from_here, const TaskTraits& traits, OnceClosure& task, TimeDelta delay)); - MOCK_METHOD1(CreateTaskRunnerWithTraits, + MOCK_METHOD1(CreateTaskRunner, scoped_refptr<TaskRunner>(const TaskTraits& traits)); - MOCK_METHOD1(CreateSequencedTaskRunnerWithTraits, + MOCK_METHOD1(CreateSequencedTaskRunner, scoped_refptr<SequencedTaskRunner>(const TaskTraits& traits)); - MOCK_METHOD2(CreateSingleThreadTaskRunnerWithTraits, + MOCK_METHOD2(CreateSingleThreadTaskRunner, scoped_refptr<SingleThreadTaskRunner>( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode)); #if defined(OS_WIN) - MOCK_METHOD2(CreateCOMSTATaskRunnerWithTraits, + MOCK_METHOD2(CreateCOMSTATaskRunner, scoped_refptr<SingleThreadTaskRunner>( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode)); @@ -103,34 +100,33 @@ EXPECT_TRUE(PostTask(FROM_HERE, DoNothing())); EXPECT_FALSE(executor_.runner()->HasPendingTask()); - EXPECT_TRUE(PostTaskWithTraits(FROM_HERE, {MayBlock()}, DoNothing())); + EXPECT_TRUE(PostTask(FROM_HERE, {MayBlock()}, DoNothing())); EXPECT_FALSE(executor_.runner()->HasPendingTask()); - EXPECT_TRUE(PostTaskWithTraits(FROM_HERE, {ThreadPool()}, DoNothing())); + EXPECT_TRUE(PostTask(FROM_HERE, {ThreadPool()}, DoNothing())); EXPECT_FALSE(executor_.runner()->HasPendingTask()); // Task runners without extension should not be the executor's. - auto task_runner = CreateTaskRunnerWithTraits({}); + auto task_runner = CreateTaskRunner({}); EXPECT_NE(executor_.runner(), task_runner); - auto sequenced_task_runner = CreateSequencedTaskRunnerWithTraits({}); + auto sequenced_task_runner = CreateSequencedTaskRunner({}); EXPECT_NE(executor_.runner(), sequenced_task_runner); - auto single_thread_task_runner = CreateSingleThreadTaskRunnerWithTraits({}); + auto single_thread_task_runner = CreateSingleThreadTaskRunner({}); EXPECT_NE(executor_.runner(), single_thread_task_runner); #if defined(OS_WIN) - auto comsta_task_runner = CreateCOMSTATaskRunnerWithTraits({}); + auto comsta_task_runner = CreateCOMSTATaskRunner({}); EXPECT_NE(executor_.runner(), comsta_task_runner); #endif // defined(OS_WIN) // Thread pool task runners should not be the executor's. - task_runner = CreateTaskRunnerWithTraits({ThreadPool()}); + task_runner = CreateTaskRunner({ThreadPool()}); EXPECT_NE(executor_.runner(), task_runner); - sequenced_task_runner = CreateSequencedTaskRunnerWithTraits({ThreadPool()}); + sequenced_task_runner = CreateSequencedTaskRunner({ThreadPool()}); EXPECT_NE(executor_.runner(), sequenced_task_runner); - single_thread_task_runner = - CreateSingleThreadTaskRunnerWithTraits({ThreadPool()}); + single_thread_task_runner = CreateSingleThreadTaskRunner({ThreadPool()}); EXPECT_NE(executor_.runner(), single_thread_task_runner); #if defined(OS_WIN) - comsta_task_runner = CreateCOMSTATaskRunnerWithTraits({ThreadPool()}); + comsta_task_runner = CreateCOMSTATaskRunner({ThreadPool()}); EXPECT_NE(executor_.runner(), comsta_task_runner); #endif // defined(OS_WIN) } @@ -139,27 +135,24 @@ // Tasks with extension should go to the executor. { TaskTraits traits = {TestExtensionBoolTrait()}; - EXPECT_CALL(executor_, PostDelayedTaskWithTraitsMock(_, traits, _, _)) - .Times(1); - EXPECT_TRUE(PostTaskWithTraits(FROM_HERE, traits, DoNothing())); + EXPECT_CALL(executor_, PostDelayedTaskMock(_, traits, _, _)).Times(1); + EXPECT_TRUE(PostTask(FROM_HERE, traits, DoNothing())); EXPECT_TRUE(executor_.runner()->HasPendingTask()); executor_.runner()->ClearPendingTasks(); } { TaskTraits traits = {MayBlock(), TestExtensionBoolTrait()}; - EXPECT_CALL(executor_, PostDelayedTaskWithTraitsMock(_, traits, _, _)) - .Times(1); - EXPECT_TRUE(PostTaskWithTraits(FROM_HERE, traits, DoNothing())); + EXPECT_CALL(executor_, PostDelayedTaskMock(_, traits, _, _)).Times(1); + EXPECT_TRUE(PostTask(FROM_HERE, traits, DoNothing())); EXPECT_TRUE(executor_.runner()->HasPendingTask()); executor_.runner()->ClearPendingTasks(); } { TaskTraits traits = {TestExtensionEnumTrait::kB, TestExtensionBoolTrait()}; - EXPECT_CALL(executor_, PostDelayedTaskWithTraitsMock(_, traits, _, _)) - .Times(1); - EXPECT_TRUE(PostTaskWithTraits(FROM_HERE, traits, DoNothing())); + EXPECT_CALL(executor_, PostDelayedTaskMock(_, traits, _, _)).Times(1); + EXPECT_TRUE(PostTask(FROM_HERE, traits, DoNothing())); EXPECT_TRUE(executor_.runner()->HasPendingTask()); executor_.runner()->ClearPendingTasks(); } @@ -167,22 +160,18 @@ // Task runners with extension should be the executor's. { TaskTraits traits = {TestExtensionBoolTrait()}; - EXPECT_CALL(executor_, CreateTaskRunnerWithTraits(traits)).Times(1); - auto task_runner = CreateTaskRunnerWithTraits(traits); + EXPECT_CALL(executor_, CreateTaskRunner(traits)).Times(1); + auto task_runner = CreateTaskRunner(traits); EXPECT_EQ(executor_.runner(), task_runner); - EXPECT_CALL(executor_, CreateSequencedTaskRunnerWithTraits(traits)) - .Times(1); - auto sequenced_task_runner = CreateSequencedTaskRunnerWithTraits(traits); + EXPECT_CALL(executor_, CreateSequencedTaskRunner(traits)).Times(1); + auto sequenced_task_runner = CreateSequencedTaskRunner(traits); EXPECT_EQ(executor_.runner(), sequenced_task_runner); - EXPECT_CALL(executor_, CreateSingleThreadTaskRunnerWithTraits(traits, _)) - .Times(1); - auto single_thread_task_runner = - CreateSingleThreadTaskRunnerWithTraits(traits); + EXPECT_CALL(executor_, CreateSingleThreadTaskRunner(traits, _)).Times(1); + auto single_thread_task_runner = CreateSingleThreadTaskRunner(traits); EXPECT_EQ(executor_.runner(), single_thread_task_runner); #if defined(OS_WIN) - EXPECT_CALL(executor_, CreateCOMSTATaskRunnerWithTraits(traits, _)) - .Times(1); - auto comsta_task_runner = CreateCOMSTATaskRunnerWithTraits(traits); + EXPECT_CALL(executor_, CreateCOMSTATaskRunner(traits, _)).Times(1); + auto comsta_task_runner = CreateCOMSTATaskRunner(traits); EXPECT_EQ(executor_.runner(), comsta_task_runner); #endif // defined(OS_WIN) } @@ -201,10 +190,10 @@ TaskTraits traits_with_inherited_priority = traits; traits_with_inherited_priority.InheritPriority(TaskPriority::BEST_EFFORT); EXPECT_FALSE(traits_with_inherited_priority.priority_set_explicitly()); - EXPECT_CALL(executor_, PostDelayedTaskWithTraitsMock( - _, traits_with_inherited_priority, _, _)) + EXPECT_CALL(executor_, + PostDelayedTaskMock(_, traits_with_inherited_priority, _, _)) .Times(1); - EXPECT_TRUE(PostTaskWithTraits(FROM_HERE, traits, DoNothing())); + EXPECT_TRUE(PostTask(FROM_HERE, traits, DoNothing())); EXPECT_TRUE(executor_.runner()->HasPendingTask()); executor_.runner()->ClearPendingTasks(); }
diff --git a/base/task/task_executor.h b/base/task/task_executor.h index 70d8abca..b4e79e14 100644 --- a/base/task/task_executor.h +++ b/base/task/task_executor.h
@@ -30,27 +30,26 @@ // Posts |task| with a |delay| and specific |traits|. |delay| can be zero. For // one off tasks that don't require a TaskRunner. Returns false if the task // definitely won't run because of current shutdown state. - virtual bool PostDelayedTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - TimeDelta delay) = 0; + virtual bool PostDelayedTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay) = 0; // Returns a TaskRunner whose PostTask invocations result in scheduling tasks // using |traits|. Tasks may run in any order and in parallel. - virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( + virtual scoped_refptr<TaskRunner> CreateTaskRunner( const TaskTraits& traits) = 0; // Returns a SequencedTaskRunner whose PostTask invocations result in // scheduling tasks using |traits|. Tasks run one at a time in posting order. - virtual scoped_refptr<SequencedTaskRunner> - CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) = 0; + virtual scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunner( + const TaskTraits& traits) = 0; // Returns a SingleThreadTaskRunner whose PostTask invocations result in // scheduling tasks using |traits|. Tasks run on a single thread in posting // order. If |traits| identifies an existing thread, // SingleThreadTaskRunnerThreadMode::SHARED must be used. - virtual scoped_refptr<SingleThreadTaskRunner> - CreateSingleThreadTaskRunnerWithTraits( + virtual scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) = 0; @@ -60,8 +59,7 @@ // run in the same Single-Threaded Apartment in posting order for the returned // SingleThreadTaskRunner. If |traits| identifies an existing thread, // SingleThreadTaskRunnerThreadMode::SHARED must be used. - virtual scoped_refptr<SingleThreadTaskRunner> - CreateCOMSTATaskRunnerWithTraits( + virtual scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) = 0; #endif // defined(OS_WIN)
diff --git a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc index 5aebe0bd..000966d 100644 --- a/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc +++ b/base/task/thread_pool/pooled_single_thread_task_runner_manager.cc
@@ -534,20 +534,18 @@ } scoped_refptr<SingleThreadTaskRunner> -PooledSingleThreadTaskRunnerManager::CreateSingleThreadTaskRunnerWithTraits( +PooledSingleThreadTaskRunnerManager::CreateSingleThreadTaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { - return CreateTaskRunnerWithTraitsImpl<WorkerThreadDelegate>(traits, - thread_mode); + return CreateTaskRunnerImpl<WorkerThreadDelegate>(traits, thread_mode); } #if defined(OS_WIN) scoped_refptr<SingleThreadTaskRunner> -PooledSingleThreadTaskRunnerManager::CreateCOMSTATaskRunnerWithTraits( +PooledSingleThreadTaskRunnerManager::CreateCOMSTATaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { - return CreateTaskRunnerWithTraitsImpl<WorkerThreadCOMDelegate>(traits, - thread_mode); + return CreateTaskRunnerImpl<WorkerThreadCOMDelegate>(traits, thread_mode); } #endif // defined(OS_WIN) @@ -562,7 +560,7 @@ template <typename DelegateType> scoped_refptr<PooledSingleThreadTaskRunnerManager::PooledSingleThreadTaskRunner> -PooledSingleThreadTaskRunnerManager::CreateTaskRunnerWithTraitsImpl( +PooledSingleThreadTaskRunnerManager::CreateTaskRunnerImpl( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { DCHECK(thread_mode != SingleThreadTaskRunnerThreadMode::SHARED ||
diff --git a/base/task/thread_pool/pooled_single_thread_task_runner_manager.h b/base/task/thread_pool/pooled_single_thread_task_runner_manager.h index 17c8348..2b69a2900 100644 --- a/base/task/thread_pool/pooled_single_thread_task_runner_manager.h +++ b/base/task/thread_pool/pooled_single_thread_task_runner_manager.h
@@ -70,7 +70,7 @@ // named "ThreadPoolSingleThread[Shared]" + // kEnvironmentParams[GetEnvironmentIndexForTraits(traits)].name_suffix + // index. - scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( + scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode); @@ -79,7 +79,7 @@ // STA thread named "ThreadPoolSingleThreadCOMSTA[Shared]" + // kEnvironmentParams[GetEnvironmentIndexForTraits(traits)].name_suffix + // index. - scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunnerWithTraits( + scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode); #endif // defined(OS_WIN) @@ -99,7 +99,7 @@ const TaskTraits& traits); template <typename DelegateType> - scoped_refptr<PooledSingleThreadTaskRunner> CreateTaskRunnerWithTraitsImpl( + scoped_refptr<PooledSingleThreadTaskRunner> CreateTaskRunnerImpl( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode);
diff --git a/base/task/thread_pool/pooled_single_thread_task_runner_manager_unittest.cc b/base/task/thread_pool/pooled_single_thread_task_runner_manager_unittest.cc index c11dc45d..4adff98d 100644 --- a/base/task/thread_pool/pooled_single_thread_task_runner_manager_unittest.cc +++ b/base/task/thread_pool/pooled_single_thread_task_runner_manager_unittest.cc
@@ -91,15 +91,13 @@ TEST_F(PooledSingleThreadTaskRunnerManagerTest, DifferentThreadsUsed) { scoped_refptr<SingleThreadTaskRunner> task_runner_1 = - single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::DEDICATED); + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::DEDICATED); scoped_refptr<SingleThreadTaskRunner> task_runner_2 = - single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::DEDICATED); + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::DEDICATED); PlatformThreadRef thread_ref_1; task_runner_1->PostTask(FROM_HERE, @@ -117,15 +115,13 @@ TEST_F(PooledSingleThreadTaskRunnerManagerTest, SameThreadUsed) { scoped_refptr<SingleThreadTaskRunner> task_runner_1 = - single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::SHARED); + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::SHARED); scoped_refptr<SingleThreadTaskRunner> task_runner_2 = - single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::SHARED); + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::SHARED); PlatformThreadRef thread_ref_1; task_runner_1->PostTask(FROM_HERE, @@ -143,15 +139,13 @@ TEST_F(PooledSingleThreadTaskRunnerManagerTest, RunsTasksInCurrentSequence) { scoped_refptr<SingleThreadTaskRunner> task_runner_1 = - single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::DEDICATED); + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::DEDICATED); scoped_refptr<SingleThreadTaskRunner> task_runner_2 = - single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::DEDICATED); + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::DEDICATED); EXPECT_FALSE(task_runner_1->RunsTasksInCurrentSequence()); EXPECT_FALSE(task_runner_2->RunsTasksInCurrentSequence()); @@ -183,7 +177,7 @@ SharedWithBaseSyncPrimitivesDCHECKs) { testing::GTEST_FLAG(death_test_style) = "threadsafe"; EXPECT_DCHECK_DEATH({ - single_thread_task_runner_manager_->CreateSingleThreadTaskRunnerWithTraits( + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( {WithBaseSyncPrimitives()}, SingleThreadTaskRunnerThreadMode::SHARED); }); } @@ -197,7 +191,7 @@ // Post a CONTINUE_ON_SHUTDOWN task that waits on // |task_can_continue| to a shared SingleThreadTaskRunner. single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( + ->CreateSingleThreadTaskRunner( {TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, SingleThreadTaskRunnerThreadMode::SHARED) ->PostTask(FROM_HERE, base::BindOnce( @@ -215,9 +209,8 @@ // Post a BLOCK_SHUTDOWN task to a shared SingleThreadTaskRunner. single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {TaskShutdownBehavior::BLOCK_SHUTDOWN}, - SingleThreadTaskRunnerThreadMode::SHARED) + ->CreateSingleThreadTaskRunner({TaskShutdownBehavior::BLOCK_SHUTDOWN}, + SingleThreadTaskRunnerThreadMode::SHARED) ->PostTask(FROM_HERE, DoNothing()); // Shutdown should not hang even though the first task hasn't finished. @@ -241,8 +234,8 @@ scoped_refptr<SingleThreadTaskRunner> CreateTaskRunner( TaskTraits traits = TaskTraits()) { - return single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits(traits, GetParam()); + return single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + traits, GetParam()); } private: @@ -496,10 +489,10 @@ WaitableEvent task_blocking; { - auto task_runner = single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {WithBaseSyncPrimitives()}, - SingleThreadTaskRunnerThreadMode::DEDICATED); + auto task_runner = + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {WithBaseSyncPrimitives()}, + SingleThreadTaskRunnerThreadMode::DEDICATED); EXPECT_TRUE(task_runner->PostTask( FROM_HERE, BindOnce(&WaitableEvent::Signal, Unretained(&task_running)))); @@ -524,10 +517,10 @@ WaitableEvent task_blocking; { - auto task_runner = single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( - {WithBaseSyncPrimitives()}, - SingleThreadTaskRunnerThreadMode::DEDICATED); + auto task_runner = + single_thread_task_runner_manager_->CreateSingleThreadTaskRunner( + {WithBaseSyncPrimitives()}, + SingleThreadTaskRunnerThreadMode::DEDICATED); EXPECT_TRUE(task_runner->PostTask( FROM_HERE, BindOnce(&WaitableEvent::Signal, Unretained(&task_running)))); @@ -549,7 +542,7 @@ TEST_P(PooledSingleThreadTaskRunnerManagerCommonTest, COMSTAInitialized) { scoped_refptr<SingleThreadTaskRunner> com_task_runner = - single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits( + single_thread_task_runner_manager_->CreateCOMSTATaskRunner( {TaskShutdownBehavior::BLOCK_SHUTDOWN}, GetParam()); com_task_runner->PostTask(FROM_HERE, BindOnce(&win::AssertComApartmentType, @@ -560,11 +553,11 @@ TEST_F(PooledSingleThreadTaskRunnerManagerTest, COMSTASameThreadUsed) { scoped_refptr<SingleThreadTaskRunner> task_runner_1 = - single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits( + single_thread_task_runner_manager_->CreateCOMSTATaskRunner( {TaskShutdownBehavior::BLOCK_SHUTDOWN}, SingleThreadTaskRunnerThreadMode::SHARED); scoped_refptr<SingleThreadTaskRunner> task_runner_2 = - single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits( + single_thread_task_runner_manager_->CreateCOMSTATaskRunner( {TaskShutdownBehavior::BLOCK_SHUTDOWN}, SingleThreadTaskRunnerThreadMode::SHARED); @@ -629,7 +622,7 @@ TEST_F(PooledSingleThreadTaskRunnerManagerTestWin, PumpsMessages) { scoped_refptr<SingleThreadTaskRunner> com_task_runner = - single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits( + single_thread_task_runner_manager_->CreateCOMSTATaskRunner( {TaskShutdownBehavior::BLOCK_SHUTDOWN}, SingleThreadTaskRunnerThreadMode::DEDICATED); HWND hwnd = nullptr; @@ -679,7 +672,7 @@ AtomicFlag manager_started; WaitableEvent task_finished; single_thread_task_runner_manager_ - ->CreateSingleThreadTaskRunnerWithTraits( + ->CreateSingleThreadTaskRunner( TaskTraits(), SingleThreadTaskRunnerThreadMode::DEDICATED) ->PostTask( FROM_HERE,
diff --git a/base/task/thread_pool/thread_pool_impl.cc b/base/task/thread_pool/thread_pool_impl.cc index 9c1a45a..8ff8360 100644 --- a/base/task/thread_pool/thread_pool_impl.cc +++ b/base/task/thread_pool/thread_pool_impl.cc
@@ -212,10 +212,10 @@ started_ = true; } -bool ThreadPoolImpl::PostDelayedTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - TimeDelta delay) { +bool ThreadPoolImpl::PostDelayedTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay) { // Post |task| as part of a one-off single-task Sequence. const TaskTraits new_traits = SetUserBlockingPriorityIfNeeded(traits); return PostTaskWithSequence( @@ -224,40 +224,37 @@ TaskSourceExecutionMode::kParallel)); } -scoped_refptr<TaskRunner> ThreadPoolImpl::CreateTaskRunnerWithTraits( +scoped_refptr<TaskRunner> ThreadPoolImpl::CreateTaskRunner( const TaskTraits& traits) { const TaskTraits new_traits = SetUserBlockingPriorityIfNeeded(traits); return MakeRefCounted<PooledParallelTaskRunner>(new_traits, this); } -scoped_refptr<SequencedTaskRunner> -ThreadPoolImpl::CreateSequencedTaskRunnerWithTraits(const TaskTraits& traits) { +scoped_refptr<SequencedTaskRunner> ThreadPoolImpl::CreateSequencedTaskRunner( + const TaskTraits& traits) { const TaskTraits new_traits = SetUserBlockingPriorityIfNeeded(traits); return MakeRefCounted<PooledSequencedTaskRunner>(new_traits, this); } scoped_refptr<SingleThreadTaskRunner> -ThreadPoolImpl::CreateSingleThreadTaskRunnerWithTraits( +ThreadPoolImpl::CreateSingleThreadTaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { - return single_thread_task_runner_manager_ - .CreateSingleThreadTaskRunnerWithTraits( - SetUserBlockingPriorityIfNeeded(traits), thread_mode); + return single_thread_task_runner_manager_.CreateSingleThreadTaskRunner( + SetUserBlockingPriorityIfNeeded(traits), thread_mode); } #if defined(OS_WIN) -scoped_refptr<SingleThreadTaskRunner> -ThreadPoolImpl::CreateCOMSTATaskRunnerWithTraits( +scoped_refptr<SingleThreadTaskRunner> ThreadPoolImpl::CreateCOMSTATaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) { - return single_thread_task_runner_manager_.CreateCOMSTATaskRunnerWithTraits( + return single_thread_task_runner_manager_.CreateCOMSTATaskRunner( SetUserBlockingPriorityIfNeeded(traits), thread_mode); } #endif // defined(OS_WIN) scoped_refptr<UpdateableSequencedTaskRunner> -ThreadPoolImpl::CreateUpdateableSequencedTaskRunnerWithTraits( - const TaskTraits& traits) { +ThreadPoolImpl::CreateUpdateableSequencedTaskRunner(const TaskTraits& traits) { const TaskTraits new_traits = SetUserBlockingPriorityIfNeeded(traits); return MakeRefCounted<PooledSequencedTaskRunner>(new_traits, this); }
diff --git a/base/task/thread_pool/thread_pool_impl.h b/base/task/thread_pool/thread_pool_impl.h index 5d5e7b1b..1e4d3e64 100644 --- a/base/task/thread_pool/thread_pool_impl.h +++ b/base/task/thread_pool/thread_pool_impl.h
@@ -82,24 +82,23 @@ void SetHasBestEffortFence(bool has_best_effort_fence) override; // TaskExecutor: - bool PostDelayedTaskWithTraits(const Location& from_here, - const TaskTraits& traits, - OnceClosure task, - TimeDelta delay) override; - scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( + bool PostDelayedTask(const Location& from_here, + const TaskTraits& traits, + OnceClosure task, + TimeDelta delay) override; + scoped_refptr<TaskRunner> CreateTaskRunner(const TaskTraits& traits) override; + scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunner( const TaskTraits& traits) override; - scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( - const TaskTraits& traits) override; - scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( + scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) override; #if defined(OS_WIN) - scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunnerWithTraits( + scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunner( const TaskTraits& traits, SingleThreadTaskRunnerThreadMode thread_mode) override; #endif // defined(OS_WIN) scoped_refptr<UpdateableSequencedTaskRunner> - CreateUpdateableSequencedTaskRunnerWithTraits(const TaskTraits& traits); + CreateUpdateableSequencedTaskRunner(const TaskTraits& traits); private: // Invoked after |has_fence_| or |has_best_effort_fence_| is updated. Sets the
diff --git a/base/task/thread_pool/thread_pool_impl_unittest.cc b/base/task/thread_pool/thread_pool_impl_unittest.cc index d37b2c66..48f2686 100644 --- a/base/task/thread_pool/thread_pool_impl_unittest.cc +++ b/base/task/thread_pool/thread_pool_impl_unittest.cc
@@ -169,11 +169,11 @@ SingleThreadTaskRunnerThreadMode::SHARED) { switch (execution_mode) { case TaskSourceExecutionMode::kParallel: - return thread_pool->CreateTaskRunnerWithTraits(traits); + return thread_pool->CreateTaskRunner(traits); case TaskSourceExecutionMode::kSequenced: - return thread_pool->CreateSequencedTaskRunnerWithTraits(traits); + return thread_pool->CreateSequencedTaskRunner(traits); case TaskSourceExecutionMode::kSingleThread: { - return thread_pool->CreateSingleThreadTaskRunnerWithTraits( + return thread_pool->CreateSingleThreadTaskRunner( traits, default_single_thread_task_runner_mode); } } @@ -338,14 +338,13 @@ } // namespace -// Verifies that a Task posted via PostDelayedTaskWithTraits with parameterized -// TaskTraits and no delay runs on a thread with the expected priority and I/O +// Verifies that a Task posted via PostDelayedTask with parameterized TaskTraits +// and no delay runs on a thread with the expected priority and I/O // restrictions. The ExecutionMode parameter is ignored by this test. -TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, - PostDelayedTaskWithTraitsNoDelay) { +TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, PostDelayedTaskNoDelay) { StartThreadPool(); WaitableEvent task_ran; - thread_pool_.PostDelayedTaskWithTraits( + thread_pool_.PostDelayedTask( FROM_HERE, GetTraits(), BindOnce(&VerifyTaskEnvironmentAndSignalEvent, GetTraits(), GetPoolType(), Unretained(&task_ran)), @@ -353,15 +352,14 @@ task_ran.Wait(); } -// Verifies that a Task posted via PostDelayedTaskWithTraits with parameterized +// Verifies that a Task posted via PostDelayedTask with parameterized // TaskTraits and a non-zero delay runs on a thread with the expected priority // and I/O restrictions after the delay expires. The ExecutionMode parameter is // ignored by this test. -TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, - PostDelayedTaskWithTraitsWithDelay) { +TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, PostDelayedTaskWithDelay) { StartThreadPool(); WaitableEvent task_ran; - thread_pool_.PostDelayedTaskWithTraits( + thread_pool_.PostDelayedTask( FROM_HERE, GetTraits(), BindOnce(&VerifyTimeAndTaskEnvironmentAndSignalEvent, GetTraits(), GetPoolType(), TimeTicks::Now() + TestTimeouts::tiny_timeout(), @@ -391,12 +389,12 @@ factory.WaitForAllTasksToRun(); } -// Verifies that a task posted via PostDelayedTaskWithTraits without a delay -// doesn't run before Start() is called. +// Verifies that a task posted via PostDelayedTask without a delay doesn't run +// before Start() is called. TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, - PostDelayedTaskWithTraitsNoDelayBeforeStart) { + PostDelayedTaskNoDelayBeforeStart) { WaitableEvent task_running; - thread_pool_.PostDelayedTaskWithTraits( + thread_pool_.PostDelayedTask( FROM_HERE, GetTraits(), BindOnce(&VerifyTaskEnvironmentAndSignalEvent, GetTraits(), GetPoolType(), Unretained(&task_running)), @@ -413,12 +411,12 @@ task_running.Wait(); } -// Verifies that a task posted via PostDelayedTaskWithTraits with a delay -// doesn't run before Start() is called. +// Verifies that a task posted via PostDelayedTask with a delay doesn't run +// before Start() is called. TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, - PostDelayedTaskWithTraitsWithDelayBeforeStart) { + PostDelayedTaskWithDelayBeforeStart) { WaitableEvent task_running; - thread_pool_.PostDelayedTaskWithTraits( + thread_pool_.PostDelayedTask( FROM_HERE, GetTraits(), BindOnce(&VerifyTimeAndTaskEnvironmentAndSignalEvent, GetTraits(), GetPoolType(), TimeTicks::Now() + TestTimeouts::tiny_timeout(), @@ -480,9 +478,9 @@ task_running.Wait(); } -// Verify that all tasks posted via PostDelayedTaskWithTraits() after Start() -// run in a USER_BLOCKING environment when the AllTasksUserBlocking variation -// param of the BrowserScheduler experiment is true. +// Verify that all tasks posted via PostDelayedTask() after Start() run in a +// USER_BLOCKING environment when the AllTasksUserBlocking variation param of +// the BrowserScheduler experiment is true. TEST_P(ThreadPoolImplTestAllTraitsExecutionModes, AllTasksAreUserBlocking) { TaskTraits user_blocking_traits = GetTraits(); user_blocking_traits.UpdatePriority(TaskPriority::USER_BLOCKING); @@ -492,7 +490,7 @@ WaitableEvent task_running; // Ignore |params.execution_mode| in this test. - thread_pool_.PostDelayedTaskWithTraits( + thread_pool_.PostDelayedTask( FROM_HERE, GetTraits(), BindOnce(&VerifyTaskEnvironmentAndSignalEvent, user_blocking_traits, GetPoolType(), Unretained(&task_running)), @@ -646,11 +644,10 @@ // returns false when called from a task that isn't part of the sequence. TEST_P(ThreadPoolImplTest, SequencedRunsTasksInCurrentSequence) { StartThreadPool(); - auto single_thread_task_runner = - thread_pool_.CreateSingleThreadTaskRunnerWithTraits( - TaskTraits(), SingleThreadTaskRunnerThreadMode::SHARED); + auto single_thread_task_runner = thread_pool_.CreateSingleThreadTaskRunner( + TaskTraits(), SingleThreadTaskRunnerThreadMode::SHARED); auto sequenced_task_runner = - thread_pool_.CreateSequencedTaskRunnerWithTraits(TaskTraits()); + thread_pool_.CreateSequencedTaskRunner(TaskTraits()); WaitableEvent task_ran; single_thread_task_runner->PostTask( @@ -671,10 +668,9 @@ TEST_P(ThreadPoolImplTest, SingleThreadRunsTasksInCurrentSequence) { StartThreadPool(); auto sequenced_task_runner = - thread_pool_.CreateSequencedTaskRunnerWithTraits(TaskTraits()); - auto single_thread_task_runner = - thread_pool_.CreateSingleThreadTaskRunnerWithTraits( - TaskTraits(), SingleThreadTaskRunnerThreadMode::SHARED); + thread_pool_.CreateSequencedTaskRunner(TaskTraits()); + auto single_thread_task_runner = thread_pool_.CreateSingleThreadTaskRunner( + TaskTraits(), SingleThreadTaskRunnerThreadMode::SHARED); WaitableEvent task_ran; sequenced_task_runner->PostTask( @@ -693,7 +689,7 @@ #if defined(OS_WIN) TEST_P(ThreadPoolImplTest, COMSTATaskRunnersRunWithCOMSTA) { StartThreadPool(); - auto com_sta_task_runner = thread_pool_.CreateCOMSTATaskRunnerWithTraits( + auto com_sta_task_runner = thread_pool_.CreateCOMSTATaskRunner( TaskTraits(), SingleThreadTaskRunnerThreadMode::SHARED); WaitableEvent task_ran; @@ -722,9 +718,9 @@ // and signalling the WaitableEvent after Shutdown() on a different thread // since Shutdown() will block. However, the cost of managing this extra // thread was deemed to be too great for the unlikely race. - thread_pool_.PostDelayedTaskWithTraits(FROM_HERE, TaskTraits(), - BindOnce([]() { ADD_FAILURE(); }), - TestTimeouts::tiny_timeout()); + thread_pool_.PostDelayedTask(FROM_HERE, TaskTraits(), + BindOnce([]() { ADD_FAILURE(); }), + TestTimeouts::tiny_timeout()); thread_pool_.Shutdown(); PlatformThread::Sleep(TestTimeouts::tiny_timeout() * 2); } @@ -738,7 +734,7 @@ ASSERT_EQ(0, pipe(pipes)); scoped_refptr<TaskRunner> blocking_task_runner = - thread_pool_.CreateSequencedTaskRunnerWithTraits( + thread_pool_.CreateSequencedTaskRunner( {TaskShutdownBehavior::BLOCK_SHUTDOWN}); blocking_task_runner->PostTask( FROM_HERE, @@ -783,9 +779,9 @@ SequenceLocalStorageSlot<int> slot; auto sequenced_task_runner1 = - thread_pool_.CreateSequencedTaskRunnerWithTraits(TaskTraits()); + thread_pool_.CreateSequencedTaskRunner(TaskTraits()); auto sequenced_task_runner2 = - thread_pool_.CreateSequencedTaskRunnerWithTraits(TaskTraits()); + thread_pool_.CreateSequencedTaskRunner(TaskTraits()); sequenced_task_runner1->PostTask( FROM_HERE, @@ -867,35 +863,35 @@ const TaskTraits best_effort_traits = {shutdown_behavior.first, TaskPriority::BEST_EFFORT}; - thread_pool_.CreateSequencedTaskRunnerWithTraits(traits)->PostTask( + thread_pool_.CreateSequencedTaskRunner(traits)->PostTask( FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunPooledWorker", shutdown_behavior.second)); - thread_pool_.CreateSequencedTaskRunnerWithTraits(best_effort_traits) + thread_pool_.CreateSequencedTaskRunner(best_effort_traits) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunBackgroundPooledWorker", shutdown_behavior.second)); thread_pool_ - .CreateSingleThreadTaskRunnerWithTraits( - traits, SingleThreadTaskRunnerThreadMode::SHARED) + .CreateSingleThreadTaskRunner(traits, + SingleThreadTaskRunnerThreadMode::SHARED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunSharedWorker", shutdown_behavior.second)); thread_pool_ - .CreateSingleThreadTaskRunnerWithTraits( - best_effort_traits, SingleThreadTaskRunnerThreadMode::SHARED) + .CreateSingleThreadTaskRunner(best_effort_traits, + SingleThreadTaskRunnerThreadMode::SHARED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunBackgroundSharedWorker", shutdown_behavior.second)); thread_pool_ - .CreateSingleThreadTaskRunnerWithTraits( + .CreateSingleThreadTaskRunner( traits, SingleThreadTaskRunnerThreadMode::DEDICATED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunDedicatedWorker", shutdown_behavior.second)); thread_pool_ - .CreateSingleThreadTaskRunnerWithTraits( + .CreateSingleThreadTaskRunner( best_effort_traits, SingleThreadTaskRunnerThreadMode::DEDICATED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunBackgroundDedicatedWorker", @@ -903,27 +899,27 @@ #if defined(OS_WIN) thread_pool_ - .CreateCOMSTATaskRunnerWithTraits( - traits, SingleThreadTaskRunnerThreadMode::SHARED) + .CreateCOMSTATaskRunner(traits, + SingleThreadTaskRunnerThreadMode::SHARED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunSharedCOMWorker", shutdown_behavior.second)); thread_pool_ - .CreateCOMSTATaskRunnerWithTraits( - best_effort_traits, SingleThreadTaskRunnerThreadMode::SHARED) + .CreateCOMSTATaskRunner(best_effort_traits, + SingleThreadTaskRunnerThreadMode::SHARED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunBackgroundSharedCOMWorker", shutdown_behavior.second)); thread_pool_ - .CreateCOMSTATaskRunnerWithTraits( - traits, SingleThreadTaskRunnerThreadMode::DEDICATED) + .CreateCOMSTATaskRunner(traits, + SingleThreadTaskRunnerThreadMode::DEDICATED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunDedicatedCOMWorker", shutdown_behavior.second)); thread_pool_ - .CreateCOMSTATaskRunnerWithTraits( - best_effort_traits, SingleThreadTaskRunnerThreadMode::DEDICATED) + .CreateCOMSTATaskRunner(best_effort_traits, + SingleThreadTaskRunnerThreadMode::DEDICATED) ->PostTask(FROM_HERE, BindOnce(&VerifyHasStringsOnStack, "RunBackgroundDedicatedCOMWorker", shutdown_behavior.second)); @@ -981,52 +977,52 @@ std::vector<scoped_refptr<SingleThreadTaskRunner>> task_runners; - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::BEST_EFFORT}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::BEST_EFFORT, MayBlock()}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::USER_BLOCKING}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::USER_BLOCKING, MayBlock()}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::BEST_EFFORT}, SingleThreadTaskRunnerThreadMode::DEDICATED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::BEST_EFFORT, MayBlock()}, SingleThreadTaskRunnerThreadMode::DEDICATED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::USER_BLOCKING}, SingleThreadTaskRunnerThreadMode::DEDICATED)); - task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateSingleThreadTaskRunner( {TaskPriority::USER_BLOCKING, MayBlock()}, SingleThreadTaskRunnerThreadMode::DEDICATED)); #if defined(OS_WIN) - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::BEST_EFFORT}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::BEST_EFFORT, MayBlock()}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::USER_BLOCKING}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::USER_BLOCKING, MayBlock()}, SingleThreadTaskRunnerThreadMode::SHARED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::BEST_EFFORT}, SingleThreadTaskRunnerThreadMode::DEDICATED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::BEST_EFFORT, MayBlock()}, SingleThreadTaskRunnerThreadMode::DEDICATED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::USER_BLOCKING}, SingleThreadTaskRunnerThreadMode::DEDICATED)); - task_runners.push_back(thread_pool_.CreateCOMSTATaskRunnerWithTraits( + task_runners.push_back(thread_pool_.CreateCOMSTATaskRunner( {TaskPriority::USER_BLOCKING, MayBlock()}, SingleThreadTaskRunnerThreadMode::DEDICATED)); #endif @@ -1132,7 +1128,7 @@ // Task runner that will start as USER_VISIBLE and update to USER_BLOCKING. // Its task is expected to run first. task_runners_and_events.push_back(std::make_unique<TaskRunnerAndEvents>( - thread_pool->CreateUpdateableSequencedTaskRunnerWithTraits( + thread_pool->CreateUpdateableSequencedTaskRunner( TaskTraits({TaskPriority::USER_VISIBLE, thread_policy})), TaskPriority::USER_BLOCKING, nullptr)); @@ -1140,7 +1136,7 @@ // Task runner that will start as BEST_EFFORT and update to USER_VISIBLE. // Its task is expected to run after the USER_BLOCKING task runner's task. task_runners_and_events.push_back(std::make_unique<TaskRunnerAndEvents>( - thread_pool->CreateUpdateableSequencedTaskRunnerWithTraits( + thread_pool->CreateUpdateableSequencedTaskRunner( TaskTraits({TaskPriority::BEST_EFFORT, thread_policy})), TaskPriority::USER_VISIBLE, &task_runners_and_events.back()->task_ran)); @@ -1159,7 +1155,7 @@ : &task_runners_and_events.back()->task_ran; task_runners_and_events.push_back(std::make_unique<TaskRunnerAndEvents>( - thread_pool->CreateUpdateableSequencedTaskRunnerWithTraits( + thread_pool->CreateUpdateableSequencedTaskRunner( TaskTraits({TaskPriority::USER_BLOCKING, thread_policy})), TaskPriority::BEST_EFFORT, expected_previous_event)); @@ -1293,16 +1289,14 @@ TEST_P(ThreadPoolImplTest, UpdatePriorityFromBestEffortNoThreadPolicy) { StartThreadPool(); { - auto task_runner = - thread_pool_.CreateUpdateableSequencedTaskRunnerWithTraits( - {TaskPriority::BEST_EFFORT}); + auto task_runner = thread_pool_.CreateUpdateableSequencedTaskRunner( + {TaskPriority::BEST_EFFORT}); EXPECT_DCHECK_DEATH( { task_runner->UpdatePriority(TaskPriority::USER_VISIBLE); }); } { - auto task_runner = - thread_pool_.CreateUpdateableSequencedTaskRunnerWithTraits( - {TaskPriority::BEST_EFFORT}); + auto task_runner = thread_pool_.CreateUpdateableSequencedTaskRunner( + {TaskPriority::BEST_EFFORT}); EXPECT_DCHECK_DEATH( { task_runner->UpdatePriority(TaskPriority::USER_BLOCKING); }); }
diff --git a/base/threading/platform_thread_win_unittest.cc b/base/threading/platform_thread_win_unittest.cc index 25f111d..15c9939 100644 --- a/base/threading/platform_thread_win_unittest.cc +++ b/base/threading/platform_thread_win_unittest.cc
@@ -13,8 +13,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using testing::Contains; - namespace base { // It has been observed that calling @@ -71,7 +69,7 @@ // NORMAL_PRIORITY_CLASS process. THREAD_PRIORITY_IDLE, internal::kWin7BackgroundThreadModePriority}); EXPECT_THAT(kExpectedWin7Priorities, - Contains(priority_after_thread_mode_background_begin)); + testing::Contains(priority_after_thread_mode_background_begin)); } else { EXPECT_EQ(priority_after_thread_mode_background_begin, THREAD_PRIORITY_NORMAL);
diff --git a/base/trace_event/memory_allocator_dump_unittest.cc b/base/trace_event/memory_allocator_dump_unittest.cc index 67ea455..1e8bf4c5 100644 --- a/base/trace_event/memory_allocator_dump_unittest.cc +++ b/base/trace_event/memory_allocator_dump_unittest.cc
@@ -21,7 +21,6 @@ using testing::Eq; using testing::ByRef; using testing::IsEmpty; -using testing::Contains; namespace base { namespace trace_event { @@ -62,7 +61,7 @@ const char* expected_units, const std::string& expected_value) { MemoryAllocatorDump::Entry expected(name, expected_units, expected_value); - EXPECT_THAT(dump->entries(), Contains(Eq(ByRef(expected)))); + EXPECT_THAT(dump->entries(), testing::Contains(Eq(ByRef(expected)))); } void CheckScalar(const MemoryAllocatorDump* dump, @@ -70,7 +69,7 @@ const char* expected_units, uint64_t expected_value) { MemoryAllocatorDump::Entry expected(name, expected_units, expected_value); - EXPECT_THAT(dump->entries(), Contains(Eq(ByRef(expected)))); + EXPECT_THAT(dump->entries(), testing::Contains(Eq(ByRef(expected)))); } } // namespace
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 5879c8f4..947f88af 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8911513658805632768 \ No newline at end of file +8911486701208682448 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index aa42851..2a4ef79 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -8911513947770213696 \ No newline at end of file +8911489232856453328 \ No newline at end of file
diff --git a/chrome/android/features/keyboard_accessory/internal/BUILD.gn b/chrome/android/features/keyboard_accessory/internal/BUILD.gn index 7b2aab2..4dafa94 100644 --- a/chrome/android/features/keyboard_accessory/internal/BUILD.gn +++ b/chrome/android/features/keyboard_accessory/internal/BUILD.gn
@@ -54,17 +54,16 @@ "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/AccessorySheetViewBinder.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_component/NoSwipeViewPager.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabCoordinator.java", + "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabMediator.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabMetricsRecorder.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabModel.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabViewBinder.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryInfoView.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetCoordinator.java", - "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetMediator.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetViewBinder.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetCoordinator.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryInfoView.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetCoordinator.java", - "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetMediator.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetViewBinder.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetModernViewBinder.java", "java/src/org/chromium/chrome/browser/keyboard_accessory/tab_layout_component/KeyboardAccessoryTabLayoutCoordinator.java",
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java index 1e0b4cf1..5b383b2 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponentBridge.java
@@ -6,6 +6,7 @@ import android.graphics.Bitmap; import android.support.annotation.Px; +import android.util.SparseArray; import org.chromium.base.Callback; import org.chromium.base.VisibleForTesting; @@ -21,10 +22,8 @@ import org.chromium.ui.base.WindowAndroid; class ManualFillingComponentBridge { - private final PropertyProvider<AccessorySheetData> mPasswordSheetProvider = - new PropertyProvider<>(); - private final PropertyProvider<AccessorySheetData> mAddressSheetProvider = - new PropertyProvider<>(); + private final SparseArray<PropertyProvider<AccessorySheetData>> mProviders = + new SparseArray<>(); private final PropertyProvider<Action[]> mActionProvider = new PropertyProvider<>(AccessoryAction.GENERATE_PASSWORD_AUTOMATIC); private final ManualFillingComponent mManualFillingComponent; @@ -35,12 +34,18 @@ mNativeView = nativeView; mActivity = (ChromeActivity) windowAndroid.getActivity().get(); mManualFillingComponent = mActivity.getManualFillingComponent(); - mManualFillingComponent.registerPasswordProvider(mPasswordSheetProvider); - mManualFillingComponent.registerAddressProvider(mAddressSheetProvider); - mManualFillingComponent.registerCreditCardProvider(); mManualFillingComponent.registerActionProvider(mActionProvider); } + PropertyProvider<AccessorySheetData> getOrCreateProvider(@AccessoryTabType int tabType) { + PropertyProvider<AccessorySheetData> provider = mProviders.get(tabType); + if (provider != null) return provider; + provider = new PropertyProvider<>(); + mProviders.put(tabType, provider); + mManualFillingComponent.registerSheetDataProvider(tabType, provider); + return provider; + } + @CalledByNative private static ManualFillingComponentBridge create( long nativeView, WindowAndroid windowAndroid) { @@ -50,17 +55,7 @@ @CalledByNative private void onItemsAvailable(Object objAccessorySheetData) { AccessorySheetData accessorySheetData = (AccessorySheetData) objAccessorySheetData; - switch (accessorySheetData.getSheetType()) { - case AccessoryTabType.PASSWORDS: - mPasswordSheetProvider.notifyObservers((AccessorySheetData) objAccessorySheetData); - return; - case AccessoryTabType.CREDIT_CARDS: - // TODO(crbug.com/926365): Implement. - return; - case AccessoryTabType.ADDRESSES: - mAddressSheetProvider.notifyObservers((AccessorySheetData) objAccessorySheetData); - return; - } + getOrCreateProvider(accessorySheetData.getSheetType()).notifyObservers(accessorySheetData); } @CalledByNative @@ -117,8 +112,9 @@ @CalledByNative private void destroy() { - mPasswordSheetProvider.notifyObservers(null); - mAddressSheetProvider.notifyObservers(null); + for (int i = 0; i < mProviders.size(); ++i) { + mProviders.valueAt(i).notifyObservers(null); + } mNativeView = 0; }
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingCoordinator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingCoordinator.java index babe071..9ed083a 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingCoordinator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingCoordinator.java
@@ -88,20 +88,9 @@ } @Override - public void registerPasswordProvider( + public void registerSheetDataProvider(@AccessoryTabType int sheetType, PropertyProvider<KeyboardAccessoryData.AccessorySheetData> sheetDataProvider) { - mMediator.registerPasswordProvider(sheetDataProvider); - } - - @Override - public void registerAddressProvider( - PropertyProvider<KeyboardAccessoryData.AccessorySheetData> sheetDataProvider) { - mMediator.registerAddressProvider(sheetDataProvider); - } - - @Override - public void registerCreditCardProvider() { - mMediator.registerCreditCardProvider(); + mMediator.registerSheetDataProvider(sheetType, sheetDataProvider); } @Override
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingMediator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingMediator.java index 5a4f5a5..ebb306c0 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingMediator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingMediator.java
@@ -4,6 +4,9 @@ package org.chromium.chrome.browser.keyboard_accessory; +import static org.chromium.chrome.browser.ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY; +import static org.chromium.chrome.browser.ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID; +import static org.chromium.chrome.browser.ChromeFeatureList.PASSWORDS_KEYBOARD_ACCESSORY; import static org.chromium.chrome.browser.keyboard_accessory.ManualFillingProperties.KEYBOARD_EXTENSION_STATE; import static org.chromium.chrome.browser.keyboard_accessory.ManualFillingProperties.KeyboardExtensionState.EXTENDING_KEYBOARD; import static org.chromium.chrome.browser.keyboard_accessory.ManualFillingProperties.KeyboardExtensionState.FLOATING_BAR; @@ -41,6 +44,7 @@ import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.Action; import org.chromium.chrome.browser.keyboard_accessory.data.PropertyProvider; import org.chromium.chrome.browser.keyboard_accessory.sheet_component.AccessorySheetCoordinator; +import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabCoordinator; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AddressAccessorySheetCoordinator; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.CreditCardAccessorySheetCoordinator; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.PasswordAccessorySheetCoordinator; @@ -191,29 +195,14 @@ || mWindowAndroid.getDisplay().getRotation() == Surface.ROTATION_180; } - void registerPasswordProvider( + void registerSheetDataProvider(@AccessoryTabType int tabType, PropertyProvider<KeyboardAccessoryData.AccessorySheetData> dataProvider) { ManualFillingState state = mStateCache.getStateFor(mActivity.getCurrentWebContents()); - state.wrapPasswordSheetDataProvider(dataProvider); - PasswordAccessorySheetCoordinator accessorySheet = getOrCreatePasswordSheet(); + state.wrapSheetDataProvider(tabType, dataProvider); + AccessorySheetTabCoordinator accessorySheet = getOrCreateSheet(tabType); if (accessorySheet == null) return; // Not available or initialized yet. - accessorySheet.registerDataProvider(state.getPasswordSheetDataProvider()); - } - - void registerAddressProvider( - PropertyProvider<KeyboardAccessoryData.AccessorySheetData> dataProvider) { - ManualFillingState state = mStateCache.getStateFor(mActivity.getCurrentWebContents()); - - state.wrapAddressSheetDataProvider(dataProvider); - AddressAccessorySheetCoordinator accessorySheet = getOrCreateAddressSheet(); - if (accessorySheet == null) return; // Not available or initialized yet. - accessorySheet.registerDataProvider(state.getAddressSheetDataProvider()); - } - - void registerCreditCardProvider() { - CreditCardAccessorySheetCoordinator accessorySheet = getOrCreateCreditCardSheet(); - if (accessorySheet == null) return; + accessorySheet.registerDataProvider(state.getSheetDataProvider(tabType)); } void registerAutofillProvider( @@ -282,12 +271,12 @@ private void onOrientationChange() { if (!isInitialized()) return; - if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY) - || is(REPLACING_KEYBOARD) || is(FLOATING_SHEET)) { + if (ChromeFeatureList.isEnabled(AUTOFILL_KEYBOARD_ACCESSORY) || is(REPLACING_KEYBOARD) + || is(FLOATING_SHEET)) { mModel.set(KEYBOARD_EXTENSION_STATE, HIDDEN); // Autofill suggestions are invalidated on rotation. Dismissing all filling UI forces // the user to interact with the field they want to edit. This refreshes Autofill. - if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY)) { + if (ChromeFeatureList.isEnabled(AUTOFILL_KEYBOARD_ACCESSORY)) { hideSoftKeyboard(); } } @@ -596,80 +585,56 @@ mAccessorySheet.setTabs(tabs); } - /** - * Returns the password sheet for the current WebContents or creates one if it doesn't exist. - * @return A {@link PasswordAccessorySheetCoordinator} or null if unavailable. - */ @VisibleForTesting - @Nullable - PasswordAccessorySheetCoordinator getOrCreatePasswordSheet() { - if (!isInitialized()) return null; - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.PASSWORDS_KEYBOARD_ACCESSORY)) { - return null; - } + AccessorySheetTabCoordinator getOrCreateSheet(@AccessoryTabType int tabType) { + if (!canCreateSheet(tabType)) return null; WebContents webContents = mActivity.getCurrentWebContents(); if (webContents == null) return null; // There is no active tab or it's being destroyed. ManualFillingState state = mStateCache.getStateFor(webContents); - if (state.getPasswordAccessorySheet() != null) return state.getPasswordAccessorySheet(); + if (state.getAccessorySheet(tabType) != null) return state.getAccessorySheet(tabType); - PasswordAccessorySheetCoordinator passwordSheet = new PasswordAccessorySheetCoordinator( - mActivity, mAccessorySheet.getScrollListener()); - state.setPasswordAccessorySheet(passwordSheet); - if (state.getPasswordSheetDataProvider() != null) { - passwordSheet.registerDataProvider(state.getPasswordSheetDataProvider()); + AccessorySheetTabCoordinator sheet = createNewSheet(tabType); + assert sheet != null : "Cannot create sheet for type " + tabType; + + state.setAccessorySheet(tabType, sheet); + if (state.getSheetDataProvider(tabType) != null) { + sheet.registerDataProvider(state.getSheetDataProvider(tabType)); } refreshTabs(); - return passwordSheet; + return sheet; } - /** - * Returns the address sheet for the current WebContents or creates one if it doesn't exist. - * @return A {@link AddressAccessorySheetCoordinator} or null if unavailable. - */ - @VisibleForTesting - @Nullable - AddressAccessorySheetCoordinator getOrCreateAddressSheet() { - if (!isInitialized()) return null; - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY)) { - return null; + private boolean canCreateSheet(@AccessoryTabType int tabType) { + if (!isInitialized()) return false; + switch (tabType) { + case AccessoryTabType.ALL: // Intentional fallthrough. + case AccessoryTabType.COUNT: + return false; + case AccessoryTabType.CREDIT_CARDS: // Intentional fallthrough. + case AccessoryTabType.ADDRESSES: + if (!ChromeFeatureList.isEnabled(AUTOFILL_MANUAL_FALLBACK_ANDROID)) return false; + // Intentional fallthrough. The restrictions for passwords apply to other tabs. + case AccessoryTabType.PASSWORDS: + if (!ChromeFeatureList.isEnabled(PASSWORDS_KEYBOARD_ACCESSORY)) return false; } - WebContents webContents = mActivity.getCurrentWebContents(); - if (webContents == null) return null; // There is no active tab or it's being destroyed. - ManualFillingState state = mStateCache.getStateFor(webContents); - if (state.getAddressAccessorySheet() != null) return state.getAddressAccessorySheet(); - - AddressAccessorySheetCoordinator addressSheet = new AddressAccessorySheetCoordinator( - mActivity, mAccessorySheet.getScrollListener()); - state.setAddressAccessorySheet(addressSheet); - if (state.getAddressSheetDataProvider() != null) { - addressSheet.registerDataProvider(state.getAddressSheetDataProvider()); - } - refreshTabs(); - return addressSheet; + return true; } - /** - * Returns the credit card sheet for the current WebContents or creates one if it doesn't exist. - * @return A {@link CreditCardAccessorySheetCoordinator} or null if unavailable. - */ - @VisibleForTesting - @Nullable - CreditCardAccessorySheetCoordinator getOrCreateCreditCardSheet() { - if (!isInitialized()) return null; - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID)) { - return null; + private AccessorySheetTabCoordinator createNewSheet(@AccessoryTabType int tabType) { + switch (tabType) { + case AccessoryTabType.CREDIT_CARDS: + return new CreditCardAccessorySheetCoordinator( + mActivity, mAccessorySheet.getScrollListener()); + case AccessoryTabType.ADDRESSES: + return new AddressAccessorySheetCoordinator( + mActivity, mAccessorySheet.getScrollListener()); + case AccessoryTabType.PASSWORDS: + return new PasswordAccessorySheetCoordinator( + mActivity, mAccessorySheet.getScrollListener()); + case AccessoryTabType.ALL: // Intentional fallthrough. + case AccessoryTabType.COUNT: // Intentional fallthrough. } - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.PASSWORDS_KEYBOARD_ACCESSORY)) { - return null; - } - WebContents webContents = mActivity.getCurrentWebContents(); - if (webContents == null) return null; // There is no active tab or it's being destroyed. - ManualFillingState state = mStateCache.getStateFor(webContents); - if (state.getCreditCardAccessorySheet() != null) return state.getCreditCardAccessorySheet(); - state.setCreditCardAccessorySheet(new CreditCardAccessorySheetCoordinator( - mActivity, mAccessorySheet.getScrollListener())); - refreshTabs(); - return state.getCreditCardAccessorySheet(); + return null; } private boolean isFloating(@KeyboardExtensionState int state) {
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingState.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingState.java index 6f32bd85..de256de 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingState.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingState.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.keyboard_accessory; import android.support.annotation.Nullable; +import android.util.SparseArray; import org.chromium.base.VisibleForTesting; import org.chromium.chrome.browser.keyboard_accessory.data.CachedProviderAdapter; @@ -12,9 +13,7 @@ import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; import org.chromium.chrome.browser.keyboard_accessory.data.PropertyProvider; import org.chromium.chrome.browser.keyboard_accessory.data.Provider; -import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AddressAccessorySheetCoordinator; -import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.CreditCardAccessorySheetCoordinator; -import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.PasswordAccessorySheetCoordinator; +import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabCoordinator; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; @@ -25,14 +24,23 @@ * and its sheet for the {@link WebContents} it is attached to. */ class ManualFillingState { + private final static int[] TAB_ORDER = { + AccessoryTabType.PASSWORDS, AccessoryTabType.CREDIT_CARDS, AccessoryTabType.ADDRESSES}; private final WebContents mWebContents; - private boolean mWebContentsShowing; + private final SparseArray<SheetState> mSheetStates = new SparseArray<>(); private @Nullable CachedProviderAdapter<KeyboardAccessoryData.Action[]> mActionsProvider; - private @Nullable CachedProviderAdapter<AccessorySheetData> mPasswordSheetDataProvider; - private @Nullable CachedProviderAdapter<AccessorySheetData> mAddressSheetDataProvider; - private @Nullable PasswordAccessorySheetCoordinator mPasswordAccessorySheet; - private @Nullable AddressAccessorySheetCoordinator mAddressAccessorySheet; - private @Nullable CreditCardAccessorySheetCoordinator mCreditCardAccessorySheet; + private boolean mWebContentsShowing; + + private static class SheetState { + @Nullable + CachedProviderAdapter<AccessorySheetData> mDataProvider; + @Nullable + AccessorySheetTabCoordinator mSheet; + + void notifyProviderObservers() { + if (mDataProvider != null) mDataProvider.notifyAboutCachedItems(); + } + } private class Observer extends WebContentsObserver { public Observer(WebContents webContents) { @@ -44,8 +52,9 @@ super.wasShown(); mWebContentsShowing = true; if (mActionsProvider != null) mActionsProvider.notifyAboutCachedItems(); - if (mPasswordSheetDataProvider != null) - mPasswordSheetDataProvider.notifyAboutCachedItems(); + for (int state : TAB_ORDER) { + getStateFor(state).notifyProviderObservers(); + } } @Override @@ -78,27 +87,37 @@ */ void notifyObservers() { if (mActionsProvider != null) mActionsProvider.notifyAboutCachedItems(); - if (mPasswordSheetDataProvider != null) mPasswordSheetDataProvider.notifyAboutCachedItems(); + for (int state : TAB_ORDER) { + // TODO(fhorschig): This needs controller tests for each state in the order! + getStateFor(state).notifyProviderObservers(); + } } KeyboardAccessoryData.Tab[] getTabs() { ArrayList<KeyboardAccessoryData.Tab> tabs = new ArrayList<>(); - if (mPasswordAccessorySheet != null) tabs.add(mPasswordAccessorySheet.getTab()); - if (mCreditCardAccessorySheet != null) tabs.add(mCreditCardAccessorySheet.getTab()); - if (mAddressAccessorySheet != null) tabs.add(mAddressAccessorySheet.getTab()); + for (@AccessoryTabType int type : TAB_ORDER) { + SheetState state = getStateFor(type); + if (state.mSheet != null) tabs.add(state.mSheet.getTab()); + } return tabs.toArray(new KeyboardAccessoryData.Tab[0]); } void destroy() { if (mWebContents != null) mWebContents.removeObserver(mWebContentsObserver); mActionsProvider = null; - mPasswordSheetDataProvider = null; - mPasswordAccessorySheet = null; - mCreditCardAccessorySheet = null; - mAddressAccessorySheet = null; + mSheetStates.clear(); mWebContentsShowing = false; } + private SheetState getStateFor(@AccessoryTabType int tabType) { + SheetState state = mSheetStates.get(tabType); + if (state == null) { + mSheetStates.put(tabType, new SheetState()); + state = mSheetStates.get(tabType); + } + return state; + } + /** * Wraps the given ActionProvider in a {@link CachedProviderAdapter} and stores it. * @param provider A {@link PropertyProvider} providing actions. @@ -119,64 +138,31 @@ } /** - * Wraps the given provider for password data in a {@link CachedProviderAdapter} and stores it. - * @param provider A {@link PropertyProvider} providing password sheet data. + * Wraps the given provider for sheet data in a {@link CachedProviderAdapter} and stores it. + * @param provider A {@link PropertyProvider} providing sheet data. */ - void wrapPasswordSheetDataProvider(PropertyProvider<AccessorySheetData> provider) { - mPasswordSheetDataProvider = + void wrapSheetDataProvider( + @AccessoryTabType int tabType, PropertyProvider<AccessorySheetData> provider) { + getStateFor(tabType).mDataProvider = new CachedProviderAdapter<>(provider, null, this::onAdapterReceivedNewData); } /** - * Returns the wrapped provider set with {@link #wrapPasswordSheetDataProvider}. + * Returns the wrapped provider set with {@link #wrapSheetDataProvider}. * @return A {@link CachedProviderAdapter} wrapping a {@link PropertyProvider}. */ - Provider<AccessorySheetData> getPasswordSheetDataProvider() { - return mPasswordSheetDataProvider; + Provider<AccessorySheetData> getSheetDataProvider(@AccessoryTabType int tabType) { + return getStateFor(tabType).mDataProvider; } - void setPasswordAccessorySheet(@Nullable PasswordAccessorySheetCoordinator sheet) { - mPasswordAccessorySheet = sheet; + void setAccessorySheet( + @AccessoryTabType int tabType, @Nullable AccessorySheetTabCoordinator sheet) { + getStateFor(tabType).mSheet = sheet; } @Nullable - PasswordAccessorySheetCoordinator getPasswordAccessorySheet() { - return mPasswordAccessorySheet; - } - - /** - * Wraps the given provider for address data in a {@link CachedProviderAdapter} and stores it. - * @param provider A {@link PropertyProvider} providing password sheet data. - */ - void wrapAddressSheetDataProvider(PropertyProvider<AccessorySheetData> provider) { - mAddressSheetDataProvider = - new CachedProviderAdapter<>(provider, null, this::onAdapterReceivedNewData); - } - - /** - * Returns the wrapped provider set with {@link #wrapAddressSheetDataProvider}. - * @return A {@link CachedProviderAdapter} wrapping a {@link PropertyProvider}. - */ - Provider<AccessorySheetData> getAddressSheetDataProvider() { - return mAddressSheetDataProvider; - } - - void setAddressAccessorySheet(@Nullable AddressAccessorySheetCoordinator sheet) { - mAddressAccessorySheet = sheet; - } - - @Nullable - AddressAccessorySheetCoordinator getAddressAccessorySheet() { - return mAddressAccessorySheet; - } - - void setCreditCardAccessorySheet(@Nullable CreditCardAccessorySheetCoordinator sheet) { - mCreditCardAccessorySheet = sheet; - } - - @Nullable - CreditCardAccessorySheetCoordinator getCreditCardAccessorySheet() { - return mCreditCardAccessorySheet; + AccessorySheetTabCoordinator getAccessorySheet(@AccessoryTabType int tabType) { + return getStateFor(tabType).mSheet; } private void onAdapterReceivedNewData(CachedProviderAdapter adapter) {
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabCoordinator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabCoordinator.java index ef8cbb5c..ed902ed1 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabCoordinator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabCoordinator.java
@@ -13,6 +13,8 @@ import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData; +import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; +import org.chromium.chrome.browser.keyboard_accessory.data.Provider; /** * This coordinator aims to be the base class for sheets to be added to the ManualFillingCoordinator @@ -32,7 +34,7 @@ * @param tabType The type of this tab as used in histograms. * @param scrollListener An optional listener that will be bound to an inflated recycler view. */ - public AccessorySheetTabCoordinator(String title, Drawable icon, String contentDescription, + AccessorySheetTabCoordinator(String title, Drawable icon, String contentDescription, String openingAnnouncement, @LayoutRes int layout, @AccessoryTabType int tabType, @Nullable RecyclerView.OnScrollListener scrollListener) { mTab = new KeyboardAccessoryData.Tab( @@ -46,6 +48,12 @@ AccessorySheetTabViewBinder.initializeView((RecyclerView) view, mScrollListener); } + @CallSuper + @Override + public void onTabShown() { + getMediator().onTabShown(); + } + /** * Returns the Tab object that describes the appearance of this class in the keyboard accessory * or its accessory sheet. The returned object doesn't change for this instance. @@ -54,4 +62,20 @@ public KeyboardAccessoryData.Tab getTab() { return mTab; } + + /** + * The mediator that is used to process the data pushed from sources added with + * {@link #registerDataProvider(Provider)}. + * @return A {@link Provider.Observer<AccessorySheetData>}. + */ + abstract AccessorySheetTabMediator getMediator(); + + /** + * Registers the provider pushing a complete new instance of {@link AccessorySheetData} that + * should be displayed as sheet for this tab. + * @param sheetDataProvider A {@link Provider <AccessorySheetData>}. + */ + public void registerDataProvider(Provider<AccessorySheetData> sheetDataProvider) { + sheetDataProvider.addObserver(getMediator()); + } }
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetMediator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabMediator.java similarity index 79% rename from chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetMediator.java rename to chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabMediator.java index 042c946..29bbc58 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetMediator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabMediator.java
@@ -4,6 +4,8 @@ package org.chromium.chrome.browser.keyboard_accessory.sheet_tabs; +import android.support.annotation.CallSuper; + import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; @@ -19,24 +21,30 @@ import java.util.List; /** - * This class contains all logic for the address accessory sheet component. Changes to its internal + * This class contains the logic for the simple accessory sheets. Changes to its internal * {@link PropertyModel} are observed by a {@link PropertyModelChangeProcessor} and affect the - * address accessory sheet tab view. + * accessory sheet tab view. */ -class AddressAccessorySheetMediator implements Provider.Observer<AccessorySheetData> { +class AccessorySheetTabMediator implements Provider.Observer<AccessorySheetData> { private final AccessorySheetTabModel mModel; + private final @AccessoryTabType int mTabType; + private final @Type int mUserInfoType; @Override public void onItemAvailable(int typeId, AccessorySheetData accessorySheetData) { mModel.set(splitIntoDataPieces(accessorySheetData)); } - AddressAccessorySheetMediator(AccessorySheetTabModel model) { + AccessorySheetTabMediator( + AccessorySheetTabModel model, @AccessoryTabType int tabType, @Type int userInfoType) { mModel = model; + mTabType = tabType; + mUserInfoType = userInfoType; } + @CallSuper void onTabShown() { - AccessorySheetTabMetricsRecorder.recordSheetSuggestions(AccessoryTabType.ADDRESSES, mModel); + AccessorySheetTabMetricsRecorder.recordSheetSuggestions(mTabType, mModel); } private AccessorySheetDataPiece[] splitIntoDataPieces(AccessorySheetData accessorySheetData) { @@ -47,7 +55,7 @@ items.add(new AccessorySheetDataPiece(accessorySheetData.getTitle(), Type.TITLE)); } for (UserInfo userInfo : accessorySheetData.getUserInfoList()) { - items.add(new AccessorySheetDataPiece(userInfo, Type.ADDRESS_INFO)); + items.add(new AccessorySheetDataPiece(userInfo, mUserInfoType)); } for (FooterCommand command : accessorySheetData.getFooterCommands()) { items.add(new AccessorySheetDataPiece(command, Type.FOOTER_COMMAND));
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabModel.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabModel.java index ba7c39b..ce084b8 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabModel.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AccessorySheetTabModel.java
@@ -40,9 +40,13 @@ */ int ADDRESS_INFO = 3; /** + * A section containing a payment information. + */ + int CREDIT_CARD_INFO = 4; + /** * A command at the end of the accessory sheet tab. */ - int FOOTER_COMMAND = 4; + int FOOTER_COMMAND = 5; } private Object mDataPiece;
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetCoordinator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetCoordinator.java index 0e045508c..9a55659 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetCoordinator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessorySheetCoordinator.java
@@ -11,11 +11,12 @@ import android.view.ViewGroup; import org.chromium.base.VisibleForTesting; +import org.chromium.chrome.browser.keyboard_accessory.AccessoryAction; import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; +import org.chromium.chrome.browser.keyboard_accessory.ManualFillingMetricsRecorder; import org.chromium.chrome.browser.keyboard_accessory.R; -import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; -import org.chromium.chrome.browser.keyboard_accessory.data.Provider; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece; +import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece.Type; import org.chromium.ui.modelutil.RecyclerViewAdapter; import org.chromium.ui.modelutil.SimpleRecyclerViewMcp; @@ -29,6 +30,29 @@ new AddressAccessorySheetMediator(mModel); /** + * This class contains all logic for the address accessory sheet component. Changes to its + * internal + * {@link PropertyModel} are observed by a {@link PropertyModelChangeProcessor} and affect the + * address accessory sheet tab view. + */ + private static class AddressAccessorySheetMediator extends AccessorySheetTabMediator { + AddressAccessorySheetMediator(AccessorySheetTabModel model) { + super(model, AccessoryTabType.ADDRESSES, Type.ADDRESS_INFO); + } + + @Override + void onTabShown() { + super.onTabShown(); + + // This is a compromise: we log an impression, even if the user didn't scroll down far + // enough to see it. If we moved it into the view layer (i.e. when the actual button is + // created and shown), we could record multiple impressions of the user scrolls up and + // down repeatedly. + ManualFillingMetricsRecorder.recordActionImpression(AccessoryAction.MANAGE_ADDRESSES); + } + } + + /** * Creates the address tab. * @param context The {@link Context} containing resources like icons and layouts for this tab. * @param scrollListener An optional listener that will be bound to the inflated recycler view. @@ -49,17 +73,8 @@ } @Override - public void onTabShown() { - mMediator.onTabShown(); - } - - /** - * Registers the provider pushing a complete new instance of {@link AccessorySheetData} that - * should be displayed as sheet for this tab. - * @param accessorySheetDataProvider A {@link Provider <AccessorySheetData>}. - */ - public void registerDataProvider(Provider<AccessorySheetData> accessorySheetDataProvider) { - accessorySheetDataProvider.addObserver(mMediator); + protected AccessorySheetTabMediator getMediator() { + return mMediator; } /**
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetCoordinator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetCoordinator.java index d4a0519..d6f16bde 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetCoordinator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/CreditCardAccessorySheetCoordinator.java
@@ -11,12 +11,18 @@ import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; import org.chromium.chrome.browser.keyboard_accessory.R; +import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece.Type; /** * This component is a tab that can be added to the ManualFillingCoordinator. This tab * allows selecting credit card information from a sheet below the keyboard accessory. */ public class CreditCardAccessorySheetCoordinator extends AccessorySheetTabCoordinator { + private AccessorySheetTabModel mModel = new AccessorySheetTabModel(); + // TODO(crbug.com/926365): Consider creating a mediator for CCs (e.g. to record footer metrics). + private final AccessorySheetTabMediator mMediator = new AccessorySheetTabMediator( + mModel, AccessoryTabType.CREDIT_CARDS, Type.CREDIT_CARD_INFO); + /** * Creates the credit cards tab. * @param context The {@link Context} containing resources like icons and layouts for this tab. @@ -35,5 +41,7 @@ } @Override - public void onTabShown() {} + protected AccessorySheetTabMediator getMediator() { + return mMediator; + } }
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetCoordinator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetCoordinator.java index 0af7662..4e006396 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetCoordinator.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetCoordinator.java
@@ -13,11 +13,12 @@ import org.chromium.base.VisibleForTesting; import org.chromium.chrome.browser.ChromeFeatureList; +import org.chromium.chrome.browser.keyboard_accessory.AccessoryAction; import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; +import org.chromium.chrome.browser.keyboard_accessory.ManualFillingMetricsRecorder; import org.chromium.chrome.browser.keyboard_accessory.R; -import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; -import org.chromium.chrome.browser.keyboard_accessory.data.Provider; import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece; +import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece.Type; import org.chromium.ui.modelutil.ListModel; import org.chromium.ui.modelutil.RecyclerViewAdapter; import org.chromium.ui.modelutil.SimpleRecyclerViewMcp; @@ -31,6 +32,29 @@ private final PasswordAccessorySheetMediator mMediator; /** + * This class contains all logic for the password accessory sheet component. Changes to its + * internal + * {@link PropertyModel} are observed by a {@link PropertyModelChangeProcessor} and affect the + * password accessory sheet tab view. + */ + private static class PasswordAccessorySheetMediator extends AccessorySheetTabMediator { + PasswordAccessorySheetMediator(AccessorySheetTabModel model) { + super(model, AccessoryTabType.PASSWORDS, Type.PASSWORD_INFO); + } + + @Override + void onTabShown() { + super.onTabShown(); + + // This is a compromise: we log an impression, even if the user didn't scroll down far + // enough to see it. If we moved it into the view layer (i.e. when the actual button is + // created and shown), we could record multiple impressions of the user scrolls up and + // down repeatedly. + ManualFillingMetricsRecorder.recordActionImpression(AccessoryAction.MANAGE_PASSWORDS); + } + } + + /** * Provides the icon used in this sheet. Simplifies mocking in controller tests. */ @VisibleForTesting @@ -86,17 +110,8 @@ } @Override - public void onTabShown() { - mMediator.onTabShown(); - } - - /** - * Registers the provider pushing a complete new instance of {@link AccessorySheetData} that - * should be displayed as sheet for this tab. - * @param accessorySheetDataProvider A {@link Provider<AccessorySheetData>}. - */ - public void registerDataProvider(Provider<AccessorySheetData> accessorySheetDataProvider) { - accessorySheetDataProvider.addObserver(mMediator); + protected AccessorySheetTabMediator getMediator() { + return mMediator; } /**
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetMediator.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetMediator.java deleted file mode 100644 index ae17561a..0000000 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessorySheetMediator.java +++ /dev/null
@@ -1,66 +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. - -package org.chromium.chrome.browser.keyboard_accessory.sheet_tabs; - -import org.chromium.chrome.browser.ChromeFeatureList; -import org.chromium.chrome.browser.keyboard_accessory.AccessoryAction; -import org.chromium.chrome.browser.keyboard_accessory.AccessoryTabType; -import org.chromium.chrome.browser.keyboard_accessory.ManualFillingMetricsRecorder; -import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.AccessorySheetData; -import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.FooterCommand; -import org.chromium.chrome.browser.keyboard_accessory.data.KeyboardAccessoryData.UserInfo; -import org.chromium.chrome.browser.keyboard_accessory.data.Provider; -import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece; -import org.chromium.chrome.browser.keyboard_accessory.sheet_tabs.AccessorySheetTabModel.AccessorySheetDataPiece.Type; -import org.chromium.ui.modelutil.PropertyModel; -import org.chromium.ui.modelutil.PropertyModelChangeProcessor; - -import java.util.ArrayList; -import java.util.List; - -/** - * This class contains all logic for the password accessory sheet component. Changes to its internal - * {@link PropertyModel} are observed by a {@link PropertyModelChangeProcessor} and affect the - * password accessory sheet tab view. - */ -class PasswordAccessorySheetMediator implements Provider.Observer<AccessorySheetData> { - private final AccessorySheetTabModel mModel; - - @Override - public void onItemAvailable(int typeId, AccessorySheetData accessorySheetData) { - mModel.set(splitIntoDataPieces(accessorySheetData)); - } - - PasswordAccessorySheetMediator(AccessorySheetTabModel model) { - mModel = model; - } - - void onTabShown() { - ManualFillingMetricsRecorder.recordActionImpression(AccessoryAction.MANAGE_PASSWORDS); - AccessorySheetTabMetricsRecorder.recordSheetSuggestions(AccessoryTabType.PASSWORDS, mModel); - } - - private AccessorySheetDataPiece[] splitIntoDataPieces(AccessorySheetData accessorySheetData) { - if (accessorySheetData == null) return new AccessorySheetDataPiece[0]; - - List<AccessorySheetDataPiece> items = new ArrayList<>(); - if (shouldShowTitle(accessorySheetData.getUserInfoList())) { - items.add(new AccessorySheetDataPiece(accessorySheetData.getTitle(), Type.TITLE)); - } - for (UserInfo userInfo : accessorySheetData.getUserInfoList()) { - items.add(new AccessorySheetDataPiece(userInfo, Type.PASSWORD_INFO)); - } - for (FooterCommand command : accessorySheetData.getFooterCommands()) { - items.add(new AccessorySheetDataPiece(command, Type.FOOTER_COMMAND)); - } - - return items.toArray(new AccessorySheetDataPiece[0]); - } - - private boolean shouldShowTitle(List<UserInfo> userInfoList) { - return !ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY) - || userInfoList.isEmpty(); - } -}
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java index 1ee83f4..0c1ddf2 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingTestHelper.java
@@ -114,7 +114,8 @@ final ImeAdapter imeAdapter = ImeAdapter.fromWebContents(mWebContentsRef.get()); mInputMethodManagerWrapper = TestInputMethodManagerWrapper.create(imeAdapter); imeAdapter.setInputMethodManagerWrapper(mInputMethodManagerWrapper); - getManualFillingCoordinator().registerPasswordProvider(mSheetSuggestionsProvider); + getManualFillingCoordinator().registerSheetDataProvider( + AccessoryTabType.PASSWORDS, mSheetSuggestionsProvider); }); if (waitForNode) DOMUtils.waitForNonZeroNodeBounds(mWebContentsRef.get(), PASSWORD_NODE_ID); cacheCredentials(new String[0], new String[0]); // This caches the empty state. @@ -254,11 +255,15 @@ } public PasswordAccessorySheetCoordinator getOrCreatePasswordAccessorySheet() { - return getManualFillingCoordinator().getMediatorForTesting().getOrCreatePasswordSheet(); + return (PasswordAccessorySheetCoordinator) getManualFillingCoordinator() + .getMediatorForTesting() + .getOrCreateSheet(AccessoryTabType.PASSWORDS); } public AddressAccessorySheetCoordinator getOrCreateAddressAccessorySheet() { - return getManualFillingCoordinator().getMediatorForTesting().getOrCreateAddressSheet(); + return (AddressAccessorySheetCoordinator) getManualFillingCoordinator() + .getMediatorForTesting() + .getOrCreateSheet(AccessoryTabType.ADDRESSES); } // ----------------------------------
diff --git a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java index 2ebb4ef0..dbaf77c 100644 --- a/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java +++ b/chrome/android/features/keyboard_accessory/javatests/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/AddressAccessoryIntegrationTest.java
@@ -58,7 +58,8 @@ */ @RunWith(ChromeJUnit4ClassRunner.class) @RetryOnFailure -@EnableFeatures({ChromeFeatureList.PASSWORDS_KEYBOARD_ACCESSORY}) +@EnableFeatures({ChromeFeatureList.PASSWORDS_KEYBOARD_ACCESSORY, + ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AddressAccessoryIntegrationTest { @Rule @@ -84,7 +85,7 @@ @Test @SmallTest - @EnableFeatures({ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) + @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) public void testAddressSheetIsAvailable() throws InterruptedException { mHelper.loadTestPage(false); @@ -95,7 +96,7 @@ @Test @SmallTest - @DisableFeatures({ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) + @DisableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) public void testAddressSheetUnavailableWithoutFeature() throws InterruptedException { mHelper.loadTestPage(false); @@ -105,7 +106,7 @@ @Test @SmallTest - @EnableFeatures({ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) + @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) public void testDisplaysEmptyStateMessageWithoutSavedPasswords() throws InterruptedException, TimeoutException { mHelper.loadTestPage(false); @@ -125,7 +126,7 @@ @Test @MediumTest - @EnableFeatures({ChromeFeatureList.AUTOFILL_KEYBOARD_ACCESSORY}) + @EnableFeatures({ChromeFeatureList.AUTOFILL_MANUAL_FALLBACK_ANDROID}) public void testFillsSuggestionOnClick() throws ExecutionException, InterruptedException, TimeoutException { loadTestPage(FakeKeyboard::new);
diff --git a/chrome/android/features/keyboard_accessory/junit/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingControllerTest.java b/chrome/android/features/keyboard_accessory/junit/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingControllerTest.java index 6e801c3..e51a39582 100644 --- a/chrome/android/features/keyboard_accessory/junit/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingControllerTest.java +++ b/chrome/android/features/keyboard_accessory/junit/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingControllerTest.java
@@ -319,7 +319,7 @@ addBrowserTab(mMediator, 1111, null); // Registering a provider creates a new passwords tab: - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); // Now check the how many tabs were sent to the sub components: ArgumentCaptor<KeyboardAccessoryData.Tab[]> barTabCaptor = @@ -360,15 +360,21 @@ // Simulate opening a new tab which automatically triggers the registration: Tab firstTab = addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(firstTabHelper.getSheetDataProvider()); - getStateForBrowserTab().getPasswordSheetDataProvider().addObserver(firstTabHelper::record); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, firstTabHelper.getSheetDataProvider()); + getStateForBrowserTab() + .getSheetDataProvider(AccessoryTabType.PASSWORDS) + .addObserver(firstTabHelper::record); firstTabHelper.providePasswordSheet("FirstPassword"); assertThat(firstTabHelper.getFirstRecordedPassword(), is("FirstPassword")); // Simulate creating a second tab: Tab secondTab = addBrowserTab(mMediator, 2222, firstTab); - mController.registerPasswordProvider(secondTabHelper.getSheetDataProvider()); - getStateForBrowserTab().getPasswordSheetDataProvider().addObserver(secondTabHelper::record); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, secondTabHelper.getSheetDataProvider()); + getStateForBrowserTab() + .getSheetDataProvider(AccessoryTabType.PASSWORDS) + .addObserver(secondTabHelper::record); secondTabHelper.providePasswordSheet("SecondPassword"); assertThat(secondTabHelper.getFirstRecordedPassword(), is("SecondPassword")); @@ -419,7 +425,7 @@ Tab firstTab = addBrowserTab(mMediator, 1111, null); // Create a new passwords tab: - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); // Simulate creating a second tab without any tabs: Tab secondTab = addBrowserTab(mMediator, 2222, firstTab); @@ -468,14 +474,15 @@ Tab tab = addBrowserTab(mMediator, 1111, null); // Create a new passwords tab: - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); // Simulate closing the tab (uncommitted): mMediator.getTabModelObserverForTesting().willCloseTab(tab, false); mMediator.getTabObserverForTesting().onHidden(tab, TabHidingType.CHANGED_TABS); getStateForBrowserTab().getWebContentsObserverForTesting().wasHidden(); // The state should be kept if the closure wasn't committed. - assertThat(getStateForBrowserTab().getPasswordAccessorySheet(), is(not(nullValue()))); + assertThat(getStateForBrowserTab().getAccessorySheet(AccessoryTabType.PASSWORDS), + is(not(nullValue()))); mLastMockWebContents = null; // Simulate undo closing the tab and selecting it: @@ -486,7 +493,8 @@ WebContents oldWebContents = mLastMockWebContents; closeBrowserTab(mMediator, tab); // The state should be cleaned up, now that it was committed. - assertThat(mCache.getStateFor(oldWebContents).getPasswordAccessorySheet(), is(nullValue())); + assertThat(mCache.getStateFor(oldWebContents).getAccessorySheet(AccessoryTabType.PASSWORDS), + is(nullValue())); ArgumentCaptor<KeyboardAccessoryData.Tab[]> barTabCaptor = ArgumentCaptor.forClass(KeyboardAccessoryData.Tab[].class); @@ -578,18 +586,24 @@ // Simulate opening a new tab: Tab firstTab = addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(firstTabHelper.getSheetDataProvider()); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, firstTabHelper.getSheetDataProvider()); mController.registerActionProvider(firstTabHelper.getActionListProvider()); - getStateForBrowserTab().getPasswordSheetDataProvider().addObserver(firstTabHelper::record); + getStateForBrowserTab() + .getSheetDataProvider(AccessoryTabType.PASSWORDS) + .addObserver(firstTabHelper::record); getStateForBrowserTab().getActionsProvider().addObserver(firstTabHelper::record); firstTabHelper.providePasswordSheet("FirstPassword"); firstTabHelper.provideAction("2BDestroyed"); // Create and switch to a new tab: (because destruction shouldn't rely on tab to be active) Tab secondTab = addBrowserTab(mMediator, 2222, firstTab); - mController.registerPasswordProvider(secondTabHelper.getSheetDataProvider()); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, secondTabHelper.getSheetDataProvider()); mController.registerActionProvider(secondTabHelper.getActionListProvider()); - getStateForBrowserTab().getPasswordSheetDataProvider().addObserver(secondTabHelper::record); + getStateForBrowserTab() + .getSheetDataProvider(AccessoryTabType.PASSWORDS) + .addObserver(secondTabHelper::record); getStateForBrowserTab().getActionsProvider().addObserver(secondTabHelper::record); secondTabHelper.providePasswordSheet("SecondPassword"); secondTabHelper.provideAction("2BKept"); @@ -607,7 +621,8 @@ assertThat(getStateForBrowserTab(), is(mCache.getStateFor(secondTab))); // ... but the other tab's data should be gone. assertThat(mCache.getStateFor(firstTab).getActionsProvider(), nullValue()); - assertThat(mCache.getStateFor(firstTab).getPasswordAccessorySheet(), nullValue()); + assertThat(mCache.getStateFor(firstTab).getAccessorySheet(AccessoryTabType.PASSWORDS), + nullValue()); } @Test @@ -616,7 +631,8 @@ addBrowserTab(mMediator, 1234, null); SheetProviderHelper tabHelper = new SheetProviderHelper(); - mController.registerPasswordProvider(tabHelper.getSheetDataProvider()); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, tabHelper.getSheetDataProvider()); when(mMockKeyboard.isSoftKeyboardShowing(any(), any())).thenReturn(true); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -636,7 +652,8 @@ setContentAreaDimensions(2.f, 180, 320); addBrowserTab(mMediator, 1234, null); SheetProviderHelper tabHelper = new SheetProviderHelper(); - mController.registerPasswordProvider(tabHelper.getSheetDataProvider()); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, tabHelper.getSheetDataProvider()); when(mMockKeyboard.isSoftKeyboardShowing(any(), any())).thenReturn(true); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -657,7 +674,8 @@ reset(mMockKeyboardAccessory); addBrowserTab(mMediator, 1234, null); SheetProviderHelper tabHelper = new SheetProviderHelper(); - mController.registerPasswordProvider(tabHelper.getSheetDataProvider()); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, tabHelper.getSheetDataProvider()); when(mMockKeyboard.isSoftKeyboardShowing(eq(mMockActivity), any())).thenReturn(true); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -682,7 +700,8 @@ addBrowserTab(mMediator, 1234, null); SheetProviderHelper tabHelper = new SheetProviderHelper(); - mController.registerPasswordProvider(tabHelper.getSheetDataProvider()); + mController.registerSheetDataProvider( + AccessoryTabType.PASSWORDS, tabHelper.getSheetDataProvider()); when(mMockKeyboard.isSoftKeyboardShowing(eq(mMockActivity), any())).thenReturn(true); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -709,7 +728,7 @@ when(mMockAccessorySheet.getHeight()).thenReturn(200); // Return height of a large keyboard. mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, FLOATING_SHEET); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); reset(mMockKeyboardAccessory, mMockAccessorySheet, mMockKeyboard); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -730,14 +749,14 @@ closeBrowserTab(mMediator, mock(Tab.class)); // Without any tab, there should be no state that would allow creating a sheet. - assertThat(mMediator.getOrCreatePasswordSheet(), is(nullValue())); + assertThat(mMediator.getOrCreateSheet(AccessoryTabType.PASSWORDS), is(nullValue())); } @Test public void testIsFillingViewShownReturnsTargetValueAheadOfComponentUpdate() { // After initialization with one tab, the accessory sheet is closed. addBrowserTab(mMediator, 1234, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); when(mMockKeyboardAccessory.hasActiveTab()).thenReturn(false); assertThat(mController.isFillingViewShown(null), is(false)); @@ -857,7 +876,7 @@ public void testTransitionFromHiddenToExtendingByKeyboard() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, HIDDEN); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); @@ -874,7 +893,7 @@ public void testTransitionFromHiddenToExtendingByAvailableData() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(KEYBOARD_EXTENSION_STATE, HIDDEN); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -890,7 +909,7 @@ public void testTransitionFromHiddenToFloatingBarByAvailableData() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(KEYBOARD_EXTENSION_STATE, HIDDEN); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); when(mMockKeyboardAccessory.empty()).thenReturn(false); @@ -905,7 +924,7 @@ public void testTransitionFromFloatingBarToExtendingByKeyboard() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, FLOATING_BAR); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); @@ -923,7 +942,7 @@ public void testTransitionFromFloatingBarToFloatingSheetByActivatingTab() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, FLOATING_BAR); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); @@ -941,7 +960,7 @@ public void testTransitionFromFloatingSheetToFloatingBarByClosingSheet() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, FLOATING_SHEET); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); @@ -961,7 +980,7 @@ public void testTransitionFromExtendingToReplacingKeyboardByActivatingSheet() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, EXTENDING_KEYBOARD); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet); @@ -989,7 +1008,7 @@ public void testTransitionFromReplacingKeyboardToExtendingByClosingSheet() { // Prepare a tab and register a new tab, so there is a reason to display the bar. addBrowserTab(mMediator, 1111, null); - mController.registerPasswordProvider(new PropertyProvider<>()); + mController.registerSheetDataProvider(AccessoryTabType.PASSWORDS, new PropertyProvider<>()); mModel.set(SHOW_WHEN_VISIBLE, true); mModel.set(KEYBOARD_EXTENSION_STATE, REPLACING_KEYBOARD); reset(mMockKeyboard, mMockKeyboardAccessory, mMockAccessorySheet);
diff --git a/chrome/android/features/keyboard_accessory/public/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponent.java b/chrome/android/features/keyboard_accessory/public/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponent.java index 9c6c606..0ba19d1 100644 --- a/chrome/android/features/keyboard_accessory/public/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponent.java +++ b/chrome/android/features/keyboard_accessory/public/java/src/org/chromium/chrome/browser/keyboard_accessory/ManualFillingComponent.java
@@ -53,27 +53,15 @@ void notifyPopupAvailable(DropdownPopupWindow popup); /** - * By registering this provider, an empty tab for passwords is created. Call + * By registering a provider, an empty tab of the given tab type is created. Call * {@link PropertyProvider#notifyObservers(Object)} to fill or update the sheet. + * @param sheetType The type of sheet to instantiate and to provide data for. * @param sheetDataProvider The {@link PropertyProvider} the tab will get it's data from. */ - void registerPasswordProvider( + void registerSheetDataProvider(@AccessoryTabType int sheetType, PropertyProvider<KeyboardAccessoryData.AccessorySheetData> sheetDataProvider); /** - * By registering this provider, an empty tab for addresses is created. Call - * {@link PropertyProvider#notifyObservers(Object)} to fill or update the sheet. - * @param sheetDataProvider The {@link PropertyProvider} the tab will get it's data from. - */ - void registerAddressProvider( - PropertyProvider<KeyboardAccessoryData.AccessorySheetData> sheetDataProvider); - - /** - * By calling this function, an empty tab for credit cards is created. - */ - void registerCreditCardProvider(); - - /** * Registers a provider, to provide actions for the keyboard accessory bar. Call * {@link PropertyProvider#notifyObservers(Object)} to fill or update the actions. * @param actionProvider The {@link PropertyProvider} providing actions.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ServicificationBackgroundServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ServicificationBackgroundServiceTest.java index f811f47e..407fff9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ServicificationBackgroundServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ServicificationBackgroundServiceTest.java
@@ -20,6 +20,7 @@ import org.chromium.base.StrictModeContext; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.RetryOnFailure; import org.chromium.chrome.browser.init.ServiceManagerStartupUtils; @@ -122,6 +123,7 @@ @Feature({"ServicificationStartup"}) @CommandLineFlags.Add({"enable-features=NetworkService,AllowStartingServiceManagerOnly," + "WriteBasicSystemProfileToPersistentHistogramsFile"}) + @DisabledTest(message = "https://crbug.com/970190") public void testHistogramsPersistedWithServiceManagerOnlyStart() { createBrowserMetricsSpareFile();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java index fb509d3..dd82001 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/profiling_host/ProfilingProcessHostAndroidTest.java
@@ -49,6 +49,7 @@ shim.runTestForMode("browser", false, "native-include-thread-names", false, false)); } + @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest public void testModeBrowserDynamicNonStreaming() throws Exception { @@ -56,6 +57,7 @@ Assert.assertTrue(shim.runTestForMode("browser", true, "native", false, false)); } + @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest public void testModeBrowserDynamicPseudoNonStreaming() throws Exception { @@ -78,6 +80,7 @@ Assert.assertTrue(shim.runTestForMode("all-renderers", false, "pseudo", false, false)); } + @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest @CommandLineFlags.Add({"memlog=gpu", "memlog-stack-mode=pseudo", "memlog-sampling-rate=1"}) @@ -86,6 +89,7 @@ Assert.assertTrue(shim.runTestForMode("gpu", false, "native", false, false)); } + @DisabledTest(message = "https://crbug.com/970205") @Test @MediumTest public void testModeBrowserDynamicPseudoSamplePartial() throws Exception {
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 01da6001..513f648 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3261,11 +3261,6 @@ flag_descriptions::kLookalikeUrlNavigationSuggestionsDescription, kOsAll, FEATURE_VALUE_TYPE(features::kLookalikeUrlNavigationSuggestionsUI)}, - {"sync-USS-autofill-profile", - flag_descriptions::kSyncUSSAutofillProfileName, - flag_descriptions::kSyncUSSAutofillProfileDescription, kOsAll, - FEATURE_VALUE_TYPE(switches::kSyncUSSAutofillProfile)}, - {"sync-USS-autofill-wallet-metadata", flag_descriptions::kSyncUSSAutofillWalletMetadataName, flag_descriptions::kSyncUSSAutofillWalletMetadataDescription, kOsAll,
diff --git a/chrome/browser/apps/platform_apps/app_browsertest.cc b/chrome/browser/apps/platform_apps/app_browsertest.cc index 3be6c04..6d9e4b0 100644 --- a/chrome/browser/apps/platform_apps/app_browsertest.cc +++ b/chrome/browser/apps/platform_apps/app_browsertest.cc
@@ -1394,8 +1394,15 @@ ASSERT_TRUE(synthetic_wheel_listener.WaitUntilSatisfied()); } +// TODO(crbug.com/961017): Fix memory leaks in tests and re-enable on LSAN. +#if defined(LEAK_SANITIZER) +#define MAYBE_PictureInPicture DISABLED_PictureInPicture +#else +#define MAYBE_PictureInPicture PictureInPicture +#endif + // Tests that platform apps can enter and exit Picture-in-Picture. -IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, PictureInPicture) { +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_PictureInPicture) { LoadAndLaunchPlatformApp("picture_in_picture", "Launched"); WebContents* web_contents = GetFirstAppWindowWebContents();
diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.cc b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.cc index 9512726..48d9496f 100644 --- a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.cc +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.cc
@@ -7,8 +7,8 @@ #include <memory> #include <string> +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" #include "components/arc/arc_util.h" @@ -84,7 +84,7 @@ // Stop observing as target window is already found. StopObserving(); window->SetProperty(ash::kWindowPinTypeKey, - ash::mojom::WindowPinType::TRUSTED_PINNED); + ash::WindowPinType::kTrustedPinned); if (delegate_) delegate_->OnAppWindowLaunched(); return true;
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc index 9bf7b83..41413d0 100644 --- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc +++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
@@ -186,7 +186,6 @@ ad_join_delegate_(ad_join_delegate), enrollment_config_(enrollment_config), client_id_(client_id), - requisition_(requisition), sub_organization_(sub_organization), completion_callback_(completion_callback), enrollment_step_(STEP_PENDING), @@ -206,6 +205,14 @@ CHECK(enrollment_config_.auth_mechanism != EnrollmentConfig::AUTH_MECHANISM_ATTESTATION || attestation_flow_); + if (enrollment_config.mode != EnrollmentConfig::MODE_OFFLINE_DEMO) { + register_params_ = + std::make_unique<CloudPolicyClient::RegistrationParameters>( + em::DeviceRegisterRequest::DEVICE, + EnrollmentModeToRegistrationFlavor(enrollment_config.mode)); + register_params_->requisition = requisition; + } + store_->AddObserver(this); client_->AddObserver(this); client_->AddPolicyTypeToFetch(dm_protocol::kChromeDevicePolicyType, @@ -257,13 +264,13 @@ CHECK_NE(license_type, ::policy::LicenseType::UNKNOWN); switch (license_type) { case LicenseType::PERPETUAL: - license_type_ = ::em::LicenseType::CDM_PERPETUAL; + register_params_->license_type = ::em::LicenseType::CDM_PERPETUAL; break; case LicenseType::ANNUAL: - license_type_ = ::em::LicenseType::CDM_ANNUAL; + register_params_->license_type = ::em::LicenseType::CDM_ANNUAL; break; case LicenseType::KIOSK: - license_type_ = ::em::LicenseType::KIOSK; + register_params_->license_type = ::em::LicenseType::KIOSK; break; case LicenseType::UNKNOWN: NOTREACHED(); @@ -413,8 +420,9 @@ // Make sure state keys are available if forced re-enrollment is on. if (chromeos::AutoEnrollmentController::IsFREEnabled()) { client_->SetStateKeysToUpload(state_keys); - current_state_key_ = state_keys_broker_->current_state_key(); - if (state_keys.empty() || current_state_key_.empty()) { + register_params_->current_state_key = + state_keys_broker_->current_state_key(); + if (state_keys.empty() || register_params_->current_state_key.empty()) { ReportResult( EnrollmentStatus::ForStatus(EnrollmentStatus::NO_STATE_KEYS)); return; @@ -438,11 +446,7 @@ } else if (enrollment_config_.mode == EnrollmentConfig::MODE_OFFLINE_DEMO) { StartOfflineDemoEnrollmentFlow(); } else { - client_->Register( - em::DeviceRegisterRequest::DEVICE, - EnrollmentModeToRegistrationFlavor(enrollment_config_.mode), - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, license_type_, - dm_auth_->oauth_token(), client_id_, requisition_, current_state_key_); + client_->Register(*register_params_, client_id_, dm_auth_->oauth_token()); } } @@ -461,12 +465,9 @@ chromeos::attestation::AttestationStatus status, const std::string& pem_certificate_chain) { if (status == chromeos::attestation::ATTESTATION_SUCCESS) { - client_->RegisterWithCertificate( - em::DeviceRegisterRequest::DEVICE, - EnrollmentModeToRegistrationFlavor(enrollment_config_.mode), - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, license_type_, - dm_auth_->Clone(), pem_certificate_chain, client_id_, requisition_, - current_state_key_, sub_organization_); + client_->RegisterWithCertificate(*register_params_, client_id_, + dm_auth_->Clone(), pem_certificate_chain, + sub_organization_); } else { ReportResult(EnrollmentStatus::ForStatus( EnrollmentStatus::REGISTRATION_CERT_FETCH_FAILED));
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h index 478fac7..390c27cc 100644 --- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h +++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h
@@ -236,15 +236,10 @@ EnrollmentConfig enrollment_config_; std::unique_ptr<policy::DMAuth> dm_auth_; std::string client_id_; - std::string requisition_; std::string sub_organization_; + std::unique_ptr<CloudPolicyClient::RegistrationParameters> register_params_; EnrollmentCallback completion_callback_; AvailableLicensesCallback available_licenses_callback_; - enterprise_management::LicenseType::LicenseTypeEnum license_type_ = - enterprise_management::LicenseType::UNDEFINED; - - // The current state key provided by |state_keys_broker_|. - std::string current_state_key_; // The device mode as received in the registration request. DeviceMode device_mode_ = DEVICE_MODE_NOT_SET;
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc index e0cbf93..2111cafb 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
@@ -120,6 +120,10 @@ // The location where storage device statistics are read from. const char kStorageInfoPath[] = "/var/log/storage_info.txt"; +// Generic device name when reported from runtime_probe. Used to filter out +// data for components. +const char kGenericDeviceName[] = "generic"; + // How often the child's usage time is stored. static constexpr base::TimeDelta kUpdateChildActiveTimeInterval = base::TimeDelta::FromSeconds(30); @@ -577,6 +581,8 @@ em::PowerStatus* const power_status = response_params_.device_status->mutable_power_status(); for (const auto& battery : probe_result.value().battery()) { + if (battery.name() != kGenericDeviceName) + continue; em::BatteryInfo* const battery_info = power_status->add_batteries(); battery_info->set_serial(battery.values().serial_number()); battery_info->set_manufacturer(battery.values().manufacturer()); @@ -613,6 +619,8 @@ em::StorageStatus* const storage_status = response_params_.device_status->mutable_storage_status(); for (const auto& storage : probe_result.value().storage()) { + if (storage.name() != kGenericDeviceName) + continue; em::DiskInfo* const disk_info = storage_status->add_disks(); disk_info->set_serial(base::NumberToString(storage.values().serial())); disk_info->set_manufacturer( @@ -629,6 +637,8 @@ // while logically it should be optional. Using iteration + value checks // just for future-proofing code. for (const auto& vpd_values : probe_result.value().vpd_cached()) { + if (vpd_values.name() != kGenericDeviceName) + continue; const std::string& sku_number = vpd_values.values().vpd_sku_number(); if (!sku_number.empty()) system_status->set_vpd_sku_number(sku_number); @@ -1163,6 +1173,8 @@ return; for (const auto& battery : result.value().battery()) { + if (battery.name() != kGenericDeviceName) + continue; enterprise_management::BatterySample battery_sample; battery_sample.set_timestamp(sample->timestamp.ToJavaTime()); // Convert uV to mV
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc index 85a2125..347ac05 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
@@ -631,18 +631,16 @@ // Start client registration. Either OnRegistrationStateChanged() or // OnClientError() will be called back. - const auto lifetime = - user_manager::UserManager::Get()->IsCurrentUserCryptohomeDataEphemeral() - ? em::DeviceRegisterRequest::LIFETIME_EPHEMERAL_USER - : em::DeviceRegisterRequest::LIFETIME_INDEFINITE; + CloudPolicyClient::RegistrationParameters parameters( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); + if (user_manager::UserManager::Get() + ->IsCurrentUserCryptohomeDataEphemeral()) + parameters.lifetime = em::DeviceRegisterRequest::LIFETIME_EPHEMERAL_USER; std::string client_id; if (client()->requires_reregistration()) client_id = client()->client_id(); - client()->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - lifetime, em::LicenseType::UNDEFINED, policy_token, - client_id, std::string() /* requisition */, - std::string() /* current_state_key */); + client()->Register(parameters, client_id, policy_token); } else { UMA_HISTOGRAM_ENUMERATION(kUMAInitialFetchOAuth2Error, error.state(), GoogleServiceAuthError::NUM_STATES);
diff --git a/chrome/browser/chromeos/policy/user_policy_test_helper.cc b/chrome/browser/chromeos/policy/user_policy_test_helper.cc index 5d318ed..b72c6cc 100644 --- a/chrome/browser/chromeos/policy/user_policy_test_helper.cc +++ b/chrome/browser/chromeos/policy/user_policy_test_helper.cc
@@ -53,15 +53,12 @@ // Give a bogus OAuth token to the |policy_manager|. This should make its // CloudPolicyClient fetch the DMToken. ASSERT_FALSE(policy_manager->core()->client()->is_registered()); - const enterprise_management::DeviceRegisterRequest::Type registration_type = - enterprise_management::DeviceRegisterRequest::USER; + CloudPolicyClient::RegistrationParameters user_registration( + enterprise_management::DeviceRegisterRequest::USER, + enterprise_management::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); policy_manager->core()->client()->Register( - registration_type, - enterprise_management::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - enterprise_management::DeviceRegisterRequest::LIFETIME_INDEFINITE, - enterprise_management::LicenseType::UNDEFINED, - "oauth_token_unused" /* oauth_token */, std::string() /* client_id */, - std::string() /* requisition */, std::string() /* current_state_key */); + user_registration, std::string() /* client_id */, + "oauth_token_unused" /* oauth_token */); policy::ProfilePolicyConnector* const profile_connector = profile->GetProfilePolicyConnector();
diff --git a/chrome/browser/chromeos/settings/device_identity_provider.cc b/chrome/browser/chromeos/settings/device_identity_provider.cc index 6a2d8e2..0eaf480 100644 --- a/chrome/browser/chromeos/settings/device_identity_provider.cc +++ b/chrome/browser/chromeos/settings/device_identity_provider.cc
@@ -69,12 +69,12 @@ } void DeviceIdentityProvider::OnRefreshTokenAvailable( - const std::string& account_id) { + const CoreAccountId& account_id) { ProcessRefreshTokenUpdateForAccount(account_id); } void DeviceIdentityProvider::OnRefreshTokenRevoked( - const std::string& account_id) { + const CoreAccountId& account_id) { ProcessRefreshTokenRemovalForAccount(account_id); }
diff --git a/chrome/browser/chromeos/settings/device_identity_provider.h b/chrome/browser/chromeos/settings/device_identity_provider.h index ce17944..e9b9bc96 100644 --- a/chrome/browser/chromeos/settings/device_identity_provider.h +++ b/chrome/browser/chromeos/settings/device_identity_provider.h
@@ -33,8 +33,8 @@ void SetActiveAccountId(const std::string& account_id) override; // OAuth2TokenService::Observer: - void OnRefreshTokenAvailable(const std::string& account_id) override; - void OnRefreshTokenRevoked(const std::string& account_id) override; + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override; + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override; private: chromeos::DeviceOAuth2TokenService* token_service_;
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc index c40fdc60..ff1d41e 100644 --- a/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc +++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc
@@ -50,7 +50,7 @@ MockOAuth2TokenServiceObserver(); ~MockOAuth2TokenServiceObserver() override; - MOCK_METHOD1(OnRefreshTokenAvailable, void(const std::string&)); + MOCK_METHOD1(OnRefreshTokenAvailable, void(const CoreAccountId&)); }; MockOAuth2TokenServiceObserver::MockOAuth2TokenServiceObserver() {} @@ -454,7 +454,8 @@ // Also make the robot account ID available. Verify that the token is // announced now. - EXPECT_CALL(observer, OnRefreshTokenAvailable("robot@example.com")); + EXPECT_CALL(observer, + OnRefreshTokenAvailable(CoreAccountId("robot@example.com"))); SetRobotAccountId("robot@example.com"); testing::Mock::VerifyAndClearExpectations(&observer);
diff --git a/chrome/browser/chromeos/settings/shutdown_policy_forwarder.cc b/chrome/browser/chromeos/settings/shutdown_policy_forwarder.cc index 70228895..3bb0e54d 100644 --- a/chrome/browser/chromeos/settings/shutdown_policy_forwarder.cc +++ b/chrome/browser/chromeos/settings/shutdown_policy_forwarder.cc
@@ -4,11 +4,8 @@ #include "chrome/browser/chromeos/settings/shutdown_policy_forwarder.h" -#include "ash/public/interfaces/constants.mojom.h" -#include "ash/public/interfaces/shutdown.mojom.h" +#include "ash/public/cpp/shutdown_controller.h" #include "chrome/browser/chromeos/settings/cros_settings.h" -#include "content/public/common/service_manager_connection.h" -#include "services/service_manager/public/cpp/connector.h" namespace chromeos { @@ -18,17 +15,11 @@ shutdown_policy_handler_.NotifyDelegateWithShutdownPolicy(); } -ShutdownPolicyForwarder::~ShutdownPolicyForwarder() {} +ShutdownPolicyForwarder::~ShutdownPolicyForwarder() = default; void ShutdownPolicyForwarder::OnShutdownPolicyChanged(bool reboot_on_shutdown) { - // Shutdown policy changes rarely so don't bother caching the connection. - ash::mojom::ShutdownControllerPtr shutdown_controller; - content::ServiceManagerConnection::GetForProcess() - ->GetConnector() - ->BindInterface(ash::mojom::kServiceName, &shutdown_controller); - // Forward the setting to ash. - shutdown_controller->SetRebootOnShutdown(reboot_on_shutdown); + ash::ShutdownController::Get()->SetRebootOnShutdown(reboot_on_shutdown); } } // namespace chromeos
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 53b4989..223d9a0 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -2395,8 +2395,9 @@ DevToolsWindowTesting::CloseDevToolsWindowSync(window); } +// See https://crbug.com/971241 IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, - ExtensionWebSocketUserAgentOverride) { + DISABLED_ExtensionWebSocketUserAgentOverride) { net::SpawnedTestServer websocket_server( net::SpawnedTestServer::TYPE_WS, base::FilePath(FILE_PATH_LITERAL("net/data/websocket")));
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc index cba0bb4..4041ed42 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc
@@ -65,7 +65,18 @@ base::FilePath temp_file_; }; -IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, SaveAsMHTML) { +// TODO(crbug.com/961017): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_SaveAsMHTML DISABLED_SaveAsMHTML +#define MAYBE_SaveAsMHTMLWithActiveTabWithFileAccess \ + DISABLED_SaveAsMHTMLWithActiveTabWithFileAccess +#else +#define MAYBE_SaveAsMHTML SaveAsMHTML +#define MAYBE_SaveAsMHTMLWithActiveTabWithFileAccess \ + SaveAsMHTMLWithActiveTabWithFileAccess +#endif + +IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, MAYBE_SaveAsMHTML) { ASSERT_TRUE(StartEmbeddedTestServer()); PageCaptureSaveAsMHTMLDelegate delegate; ASSERT_TRUE(RunExtensionTestWithFlagsAndArg( @@ -83,7 +94,7 @@ } IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, - SaveAsMHTMLWithActiveTabWithFileAccess) { + MAYBE_SaveAsMHTMLWithActiveTabWithFileAccess) { ASSERT_TRUE(StartEmbeddedTestServer()); PageCaptureSaveAsMHTMLDelegate delegate; ASSERT_TRUE(RunExtensionTest("page_capture")) << message_;
diff --git a/chrome/browser/extensions/api/tab_capture/offscreen_tabs_owner.cc b/chrome/browser/extensions/api/tab_capture/offscreen_tabs_owner.cc index 97bf387..a965ebb 100644 --- a/chrome/browser/extensions/api/tab_capture/offscreen_tabs_owner.cc +++ b/chrome/browser/extensions/api/tab_capture/offscreen_tabs_owner.cc
@@ -15,6 +15,7 @@ #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/process_manager.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" using content::WebContents; @@ -94,10 +95,11 @@ DVLOG(2) << "Allowing " << devices.size() << " capture devices for OffscreenTab content."; - std::move(callback).Run(devices, - devices.empty() ? blink::MEDIA_DEVICE_INVALID_STATE - : blink::MEDIA_DEVICE_OK, - nullptr); + std::move(callback).Run( + devices, + devices.empty() ? blink::mojom::MediaStreamRequestResult::INVALID_STATE + : blink::mojom::MediaStreamRequestResult::OK, + nullptr); } void OffscreenTabsOwner::DestroyTab(OffscreenTab* tab) {
diff --git a/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc b/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc index 6539ae0..de1ed094 100644 --- a/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc +++ b/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
@@ -4,8 +4,8 @@ #include "chrome/browser/extensions/api/tabs/tabs_util.h" +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "base/metrics/histogram_macros.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/arc/arc_session_manager.h" @@ -39,9 +39,9 @@ aura::Window* window = browser->window()->GetNativeWindow(); // TRUSTED_PINNED is used here because that one locks the window fullscreen // without allowing the user to exit (as opposed to regular PINNED). - window->SetProperty(ash::kWindowPinTypeKey, - locked ? ash::mojom::WindowPinType::TRUSTED_PINNED - : ash::mojom::WindowPinType::NONE); + window->SetProperty( + ash::kWindowPinTypeKey, + locked ? ash::WindowPinType::kTrustedPinned : ash::WindowPinType::kNone); // Update the set of available browser commands. browser->command_controller()->LockedFullscreenStateChanged();
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index 8b4e1e1..697628d 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -40,8 +40,8 @@ #include "ui/base/base_window.h" #if defined(OS_CHROMEOS) +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/extensions/window_controller.h" #include "chrome/browser/extensions/window_controller_list.h" @@ -406,13 +406,13 @@ return controller->window()->GetNativeWindow(); } -ash::mojom::WindowPinType GetCurrentWindowPinType() { - ash::mojom::WindowPinType type = +ash::WindowPinType GetCurrentWindowPinType() { + ash::WindowPinType type = GetCurrentWindow()->GetProperty(ash::kWindowPinTypeKey); return type; } -void SetCurrentWindowPinType(ash::mojom::WindowPinType type) { +void SetCurrentWindowPinType(ash::WindowPinType type) { GetCurrentWindow()->SetProperty(ash::kWindowPinTypeKey, type); } @@ -425,8 +425,7 @@ // Make sure the newly created window is "trusted pinned" (which means that // it's in locked fullscreen mode). - EXPECT_EQ(ash::mojom::WindowPinType::TRUSTED_PINNED, - GetCurrentWindowPinType()); + EXPECT_EQ(ash::WindowPinType::kTrustedPinned, GetCurrentWindowPinType()); } IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, UpdateWindowToLockedFullscreen) { @@ -435,14 +434,13 @@ << message_; // Make sure the current window is put into the "trusted pinned" state. - EXPECT_EQ(ash::mojom::WindowPinType::TRUSTED_PINNED, - GetCurrentWindowPinType()); + EXPECT_EQ(ash::WindowPinType::kTrustedPinned, GetCurrentWindowPinType()); } IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, RemoveLockedFullscreenFromWindow) { // After locking the window, do a LockedFullscreenStateChanged so the // command_controller state catches up as well. - SetCurrentWindowPinType(ash::mojom::WindowPinType::TRUSTED_PINNED); + SetCurrentWindowPinType(ash::WindowPinType::kTrustedPinned); browser()->command_controller()->LockedFullscreenStateChanged(); ASSERT_TRUE(RunExtensionTestWithArg("locked_fullscreen/with_permission", @@ -450,7 +448,7 @@ << message_; // Make sure the current window is removed from locked-fullscreen state. - EXPECT_EQ(ash::mojom::WindowPinType::NONE, GetCurrentWindowPinType()); + EXPECT_EQ(ash::WindowPinType::kNone, GetCurrentWindowPinType()); } // Make sure that commands disabling code works in locked fullscreen mode. @@ -496,12 +494,12 @@ // chrome.windows.update call fails since this extension doesn't have the // correct permission and hence the current window has NONE as WindowPinType. - EXPECT_EQ(ash::mojom::WindowPinType::NONE, GetCurrentWindowPinType()); + EXPECT_EQ(ash::WindowPinType::kNone, GetCurrentWindowPinType()); } IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, RemoveLockedFullscreenFromWindowWithoutPermission) { - SetCurrentWindowPinType(ash::mojom::WindowPinType::TRUSTED_PINNED); + SetCurrentWindowPinType(ash::WindowPinType::kTrustedPinned); browser()->command_controller()->LockedFullscreenStateChanged(); ASSERT_TRUE(RunExtensionTestWithArg("locked_fullscreen/without_permission", @@ -509,8 +507,7 @@ << message_; // The current window is still locked-fullscreen. - EXPECT_EQ(ash::mojom::WindowPinType::TRUSTED_PINNED, - GetCurrentWindowPinType()); + EXPECT_EQ(ash::WindowPinType::kTrustedPinned, GetCurrentWindowPinType()); } #endif // defined(OS_CHROMEOS)
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 74a3bb68..8929091 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1731,10 +1731,6 @@ "a signed-in account that has not been chosen as Chrome's primary account. " "This only has an effect if sync-standalone-transport is also enabled."; -const char kSyncUSSAutofillProfileName[] = "Enable USS for autofill profile"; -const char kSyncUSSAutofillProfileDescription[] = - "Enables the new implementation of autofill profile sync"; - const char kSyncUSSAutofillWalletMetadataName[] = "Enable USS for autofill wallet metadata"; const char kSyncUSSAutofillWalletMetadataDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 9ae423c..0a3071f 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1029,9 +1029,6 @@ extern const char kSyncSupportSecondaryAccountName[]; extern const char kSyncSupportSecondaryAccountDescription[]; -extern const char kSyncUSSAutofillProfileName[]; -extern const char kSyncUSSAutofillProfileDescription[]; - extern const char kSyncUSSAutofillWalletMetadataName[]; extern const char kSyncUSSAutofillWalletMetadataDescription[];
diff --git a/chrome/browser/media/media_access_handler.cc b/chrome/browser/media/media_access_handler.cc index 3b7bc9a..3fd6509 100644 --- a/chrome/browser/media/media_access_handler.cc +++ b/chrome/browser/media/media_access_handler.cc
@@ -11,6 +11,7 @@ #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/web_contents.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" bool MediaAccessHandler::IsInsecureCapturingInProgress(int render_process_id, int render_frame_id) { @@ -40,9 +41,10 @@ // TODO(grunell): The invalid state result should be changed to a new denied // result + a dcheck to ensure at least one of audio or video types is // capture. - blink::MediaStreamRequestResult result = - (audio_allowed || video_allowed) ? blink::MEDIA_DEVICE_NO_HARDWARE - : blink::MEDIA_DEVICE_INVALID_STATE; + blink::mojom::MediaStreamRequestResult result = + (audio_allowed || video_allowed) + ? blink::mojom::MediaStreamRequestResult::NO_HARDWARE + : blink::mojom::MediaStreamRequestResult::INVALID_STATE; // Get the exact audio or video device if an id is specified. // We only set any error result here and before running the callback change @@ -78,7 +80,7 @@ std::unique_ptr<content::MediaStreamUI> ui; if (!devices.empty()) { - result = blink::MEDIA_DEVICE_OK; + result = blink::mojom::MediaStreamRequestResult::OK; ui = MediaCaptureDevicesDispatcher::GetInstance() ->GetMediaStreamCaptureIndicator() ->RegisterMediaStream(web_contents, devices);
diff --git a/chrome/browser/media/webrtc/desktop_capture_access_handler.cc b/chrome/browser/media/webrtc/desktop_capture_access_handler.cc index 68b1cbd1..6e826a4 100644 --- a/chrome/browser/media/webrtc/desktop_capture_access_handler.cc +++ b/chrome/browser/media/webrtc/desktop_capture_access_handler.cc
@@ -46,6 +46,7 @@ #include "extensions/common/switches.h" #include "net/base/url_util.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h" #include "ui/base/l10n/l10n_util.h" @@ -175,14 +176,15 @@ // it after checking permission. // TODO(grunell): It would be good to change this result for something else, // probably a new one. - blink::MediaStreamRequestResult result = blink::MEDIA_DEVICE_INVALID_STATE; + blink::mojom::MediaStreamRequestResult result = + blink::mojom::MediaStreamRequestResult::INVALID_STATE; #if defined(OS_CHROMEOS) if (features::IsMultiProcessMash()) { // TODO(crbug.com/806366): Screen capture support for mash. NOTIMPLEMENTED() << "Screen capture not yet implemented in --mash"; screen_capture_enabled = false; - result = blink::MEDIA_DEVICE_NOT_SUPPORTED; + result = blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED; } #endif // defined(OS_CHROMEOS) @@ -256,8 +258,9 @@ // The only case when devices can be empty is if the user has denied // permission. - result = devices.empty() ? blink::MEDIA_DEVICE_PERMISSION_DENIED - : blink::MEDIA_DEVICE_OK; + result = devices.empty() + ? blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED + : blink::mojom::MediaStreamRequestResult::OK; } std::move(callback).Run(devices, result, std::move(ui)); @@ -296,8 +299,9 @@ std::unique_ptr<content::MediaStreamUI> ui; if (request.video_type != blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE) { - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, - std::move(ui)); + std::move(callback).Run( + devices, blink::mojom::MediaStreamRequestResult::INVALID_STATE, + std::move(ui)); return; } @@ -337,8 +341,9 @@ // Received invalid device id. if (media_id.type == content::DesktopMediaID::TYPE_NONE) { - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, - std::move(ui)); + std::move(callback).Run( + devices, blink::mojom::MediaStreamRequestResult::INVALID_STATE, + std::move(ui)); return; } @@ -382,7 +387,8 @@ GetApplicationTitle(web_contents, extension), GetApplicationTitle(web_contents, extension)); UpdateExtensionTrusted(request, extension); - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, std::move(ui)); + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); } void DesktopCaptureAccessHandler::ProcessChangeSourceRequest( @@ -399,8 +405,9 @@ request.requested_video_device_id.empty()) { picker = picker_factory_->CreatePicker(); if (!picker) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_INVALID_STATE, nullptr); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::INVALID_STATE, nullptr); return; } } @@ -505,14 +512,14 @@ PendingAccessRequest& pending_request = *queue.front(); blink::MediaStreamDevices devices; - blink::MediaStreamRequestResult request_result = - blink::MEDIA_DEVICE_PERMISSION_DENIED; + blink::mojom::MediaStreamRequestResult request_result = + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; const extensions::Extension* extension = pending_request.extension; std::unique_ptr<content::MediaStreamUI> ui; if (media_id.is_null()) { - request_result = blink::MEDIA_DEVICE_PERMISSION_DENIED; + request_result = blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; } else { - request_result = blink::MEDIA_DEVICE_OK; + request_result = blink::mojom::MediaStreamRequestResult::OK; // Determine if the extension is required to display a notification. const bool display_notification = display_notification_ && ShouldDisplayNotification(extension);
diff --git a/chrome/browser/media/webrtc/desktop_capture_access_handler_unittest.cc b/chrome/browser/media/webrtc/desktop_capture_access_handler_unittest.cc index 7dc427f..12f59419f 100644 --- a/chrome/browser/media/webrtc/desktop_capture_access_handler_unittest.cc +++ b/chrome/browser/media/webrtc/desktop_capture_access_handler_unittest.cc
@@ -20,6 +20,7 @@ #include "content/public/browser/web_contents.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" class DesktopCaptureAccessHandlerTest : public ChromeRenderViewHostTestHarness { public: @@ -36,7 +37,7 @@ void ProcessRequest( const content::DesktopMediaID& fake_desktop_media_id_response, - blink::MediaStreamRequestResult* request_result, + blink::mojom::MediaStreamRequestResult* request_result, blink::MediaStreamDevices* devices_result, blink::MediaStreamRequestType request_type, bool request_audio) { @@ -56,10 +57,10 @@ base::RunLoop wait_loop; content::MediaResponseCallback callback = base::BindOnce( [](base::RunLoop* wait_loop, - blink::MediaStreamRequestResult* request_result, + blink::mojom::MediaStreamRequestResult* request_result, blink::MediaStreamDevices* devices_result, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { *request_result = result; *devices_result = devices; @@ -93,38 +94,38 @@ TEST_F(DesktopCaptureAccessHandlerTest, ChangeSourceWithoutAudioRequestPermissionGiven) { - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; ProcessRequest(content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN, content::DesktopMediaID::kFakeId), &result, &devices, blink::MEDIA_DEVICE_UPDATE, false /*request_audio*/); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, devices[0].type); } TEST_F(DesktopCaptureAccessHandlerTest, ChangeSourceWithAudioRequestPermissionGiven) { - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; ProcessRequest(content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN, content::DesktopMediaID::kFakeId, true /* audio_share */), &result, &devices, blink::MEDIA_DEVICE_UPDATE, true /* request_audio */); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(2u, devices.size()); EXPECT_EQ(blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, devices[0].type); EXPECT_EQ(blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE, devices[1].type); } TEST_F(DesktopCaptureAccessHandlerTest, ChangeSourcePermissionDenied) { - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; ProcessRequest(content::DesktopMediaID(), &result, &devices, blink::MEDIA_DEVICE_UPDATE, false /*request audio*/); - EXPECT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, result); EXPECT_EQ(0u, devices.size()); } @@ -203,7 +204,7 @@ const size_t kTestFlagCount = 2; picker_factory_->SetTestFlags(test_flags, kTestFlagCount); - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; base::RunLoop wait_loop[kTestFlagCount]; for (size_t i = 0; i < kTestFlagCount; ++i) { @@ -213,10 +214,10 @@ blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, false); content::MediaResponseCallback callback = base::BindOnce( [](base::RunLoop* wait_loop, - blink::MediaStreamRequestResult* request_result, + blink::mojom::MediaStreamRequestResult* request_result, blink::MediaStreamDevices* devices_result, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { *request_result = result; *devices_result = devices; @@ -229,7 +230,7 @@ wait_loop[0].Run(); EXPECT_TRUE(test_flags[0].picker_created); EXPECT_TRUE(test_flags[0].picker_deleted); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, devices[0].type); @@ -238,7 +239,7 @@ EXPECT_FALSE(test_flags[1].picker_deleted); wait_loop[1].Run(); EXPECT_TRUE(test_flags[1].picker_deleted); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, devices[0].type); EXPECT_FALSE(devices[0].IsSameDevice(first_device));
diff --git a/chrome/browser/media/webrtc/display_media_access_handler.cc b/chrome/browser/media/webrtc/display_media_access_handler.cc index 1f6b4fe8..16176bc 100644 --- a/chrome/browser/media/webrtc/display_media_access_handler.cc +++ b/chrome/browser/media/webrtc/display_media_access_handler.cc
@@ -23,6 +23,7 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" // Holds pending request information so that we display one picker UI at a time // for each content::WebContents. @@ -90,16 +91,18 @@ // TODO(emircan): Remove this once Mac UI doesn't use a window. if (web_contents->GetVisibility() != content::Visibility::VISIBLE) { LOG(ERROR) << "Do not allow getDisplayMedia() on a backgrounded page."; - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_INVALID_STATE, nullptr); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::INVALID_STATE, nullptr); return; } #endif // defined(OS_MACOSX) std::unique_ptr<DesktopMediaPicker> picker = picker_factory_->CreatePicker(); if (!picker) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_INVALID_STATE, nullptr); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::INVALID_STATE, nullptr); return; } @@ -187,13 +190,13 @@ PendingAccessRequest& pending_request = *queue.front(); blink::MediaStreamDevices devices; - blink::MediaStreamRequestResult request_result = - blink::MEDIA_DEVICE_PERMISSION_DENIED; + blink::mojom::MediaStreamRequestResult request_result = + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; std::unique_ptr<content::MediaStreamUI> ui; if (media_id.is_null()) { - request_result = blink::MEDIA_DEVICE_PERMISSION_DENIED; + request_result = blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; } else { - request_result = blink::MEDIA_DEVICE_OK; + request_result = blink::mojom::MediaStreamRequestResult::OK; const auto& visible_url = url_formatter::FormatUrlForSecurityDisplay( web_contents->GetLastCommittedURL(), url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC);
diff --git a/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc b/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc index 9d3cb2ed..62042a7a 100644 --- a/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc +++ b/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc
@@ -20,6 +20,7 @@ #include "content/public/browser/web_contents.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" class DisplayMediaAccessHandlerTest : public ChromeRenderViewHostTestHarness { public: @@ -36,7 +37,7 @@ void ProcessRequest( const content::DesktopMediaID& fake_desktop_media_id_response, - blink::MediaStreamRequestResult* request_result, + blink::mojom::MediaStreamRequestResult* request_result, blink::MediaStreamDevices* devices_result, bool request_audio) { FakeDesktopMediaPickerFactory::TestFlags test_flags[] = { @@ -54,10 +55,10 @@ base::RunLoop wait_loop; content::MediaResponseCallback callback = base::BindOnce( [](base::RunLoop* wait_loop, - blink::MediaStreamRequestResult* request_result, + blink::mojom::MediaStreamRequestResult* request_result, blink::MediaStreamDevices* devices_result, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { *request_result = result; *devices_result = devices; @@ -90,25 +91,25 @@ }; TEST_F(DisplayMediaAccessHandlerTest, PermissionGiven) { - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; ProcessRequest(content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN, content::DesktopMediaID::kFakeId), &result, &devices, false /* request_audio */); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_DISPLAY_VIDEO_CAPTURE, devices[0].type); EXPECT_TRUE(devices[0].display_media_info.has_value()); } TEST_F(DisplayMediaAccessHandlerTest, PermissionGivenToRequestWithAudio) { - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; content::DesktopMediaID fake_media_id(content::DesktopMediaID::TYPE_SCREEN, content::DesktopMediaID::kFakeId, true /* audio_share */); ProcessRequest(fake_media_id, &result, &devices, true /* request_audio */); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(2u, devices.size()); EXPECT_EQ(blink::MEDIA_DISPLAY_VIDEO_CAPTURE, devices[0].type); EXPECT_TRUE(devices[0].display_media_info.has_value()); @@ -117,11 +118,11 @@ } TEST_F(DisplayMediaAccessHandlerTest, PermissionDenied) { - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; ProcessRequest(content::DesktopMediaID(), &result, &devices, true /* request_audio */); - EXPECT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, result); EXPECT_EQ(0u, devices.size()); } @@ -202,7 +203,7 @@ const size_t kTestFlagCount = 2; picker_factory_->SetTestFlags(test_flags, kTestFlagCount); - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; blink::MediaStreamDevices devices; base::RunLoop wait_loop[kTestFlagCount]; for (size_t i = 0; i < kTestFlagCount; ++i) { @@ -212,10 +213,10 @@ blink::MEDIA_DISPLAY_VIDEO_CAPTURE, false); content::MediaResponseCallback callback = base::BindOnce( [](base::RunLoop* wait_loop, - blink::MediaStreamRequestResult* request_result, + blink::mojom::MediaStreamRequestResult* request_result, blink::MediaStreamDevices* devices_result, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { *request_result = result; *devices_result = devices; @@ -228,7 +229,7 @@ wait_loop[0].Run(); EXPECT_TRUE(test_flags[0].picker_created); EXPECT_TRUE(test_flags[0].picker_deleted); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_DISPLAY_VIDEO_CAPTURE, devices[0].type); @@ -237,7 +238,7 @@ EXPECT_FALSE(test_flags[1].picker_deleted); wait_loop[1].Run(); EXPECT_TRUE(test_flags[1].picker_deleted); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); EXPECT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_DISPLAY_VIDEO_CAPTURE, devices[0].type); EXPECT_FALSE(devices[0].IsSameDevice(first_device));
diff --git a/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc b/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc index f7620cb..98bc28ca 100644 --- a/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc +++ b/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc
@@ -36,6 +36,7 @@ #include "extensions/common/constants.h" #include "media/base/media_switches.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #if !defined(OS_ANDROID) #include "chrome/browser/media/webrtc/display_media_access_handler.h" @@ -184,8 +185,9 @@ // bypassing blink side checks. if (request.video_type == blink::MEDIA_DISPLAY_VIDEO_CAPTURE && !base::FeatureList::IsEnabled(blink::features::kRTCGetDisplayMedia)) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_NOT_SUPPORTED, nullptr); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, nullptr); return; } @@ -200,7 +202,8 @@ } } std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_NOT_SUPPORTED, nullptr); + blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, + nullptr); } bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission(
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller.cc b/chrome/browser/media/webrtc/media_stream_devices_controller.cc index 5ed6e16..4b32fc62 100644 --- a/chrome/browser/media/webrtc/media_stream_devices_controller.cc +++ b/chrome/browser/media/webrtc/media_stream_devices_controller.cc
@@ -110,9 +110,10 @@ request.render_process_id, request.render_frame_id); // The RFH may have been destroyed by the time the request is processed. if (!rfh) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, - std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, + std::unique_ptr<content::MediaStreamUI>()); return; } content::WebContents* web_contents = @@ -135,7 +136,8 @@ CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, rfh, request.security_origin); if (permission_status.content_setting == CONTENT_SETTING_BLOCK) { - controller->denial_reason_ = blink::MEDIA_DEVICE_PERMISSION_DENIED; + controller->denial_reason_ = + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; controller->RunCallback(permission_status.source == PermissionStatusSource::FEATURE_POLICY); return; @@ -151,7 +153,8 @@ CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, rfh, request.security_origin); if (permission_status.content_setting == CONTENT_SETTING_BLOCK) { - controller->denial_reason_ = blink::MEDIA_DEVICE_PERMISSION_DENIED; + controller->denial_reason_ = + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; controller->RunCallback(permission_status.source == PermissionStatusSource::FEATURE_POLICY); return; @@ -262,9 +265,10 @@ MediaStreamDevicesController::~MediaStreamDevicesController() { if (!callback_.is_null()) { - std::move(callback_).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, - std::unique_ptr<content::MediaStreamUI>()); + std::move(callback_).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, + std::unique_ptr<content::MediaStreamUI>()); } } @@ -291,9 +295,11 @@ for (ContentSetting response : responses) { if (response == CONTENT_SETTING_BLOCK) - denial_reason_ = blink::MEDIA_DEVICE_PERMISSION_DENIED; + denial_reason_ = + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; else if (response == CONTENT_SETTING_ASK) - denial_reason_ = blink::MEDIA_DEVICE_PERMISSION_DISMISSED; + denial_reason_ = + blink::mojom::MediaStreamRequestResult::PERMISSION_DISMISSED; } RunCallback(blocked_by_feature_policy); @@ -312,7 +318,7 @@ profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext()); content_settings_ = TabSpecificContentSettings::FromWebContents(web_contents); - denial_reason_ = blink::MEDIA_DEVICE_OK; + denial_reason_ = blink::mojom::MediaStreamRequestResult::OK; audio_setting_ = GetContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, request, &denial_reason_); video_setting_ = GetContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, @@ -425,7 +431,8 @@ // If the kill switch is, or the request was blocked because of feature // policy we don't update the tab context. - if (denial_reason_ != blink::MEDIA_DEVICE_KILL_SWITCH_ON && + if (denial_reason_ != + blink::mojom::MediaStreamRequestResult::KILL_SWITCH_ON && !blocked_by_feature_policy) { UpdateTabSpecificContentSettings(audio_setting_, video_setting_); } @@ -434,7 +441,8 @@ // If all requested permissions are allowed then the callback should report // success, otherwise we report |denial_reason_|. - blink::MediaStreamRequestResult request_result = blink::MEDIA_DEVICE_OK; + blink::mojom::MediaStreamRequestResult request_result = + blink::mojom::MediaStreamRequestResult::OK; if ((audio_setting_ == CONTENT_SETTING_ALLOW || audio_setting_ == CONTENT_SETTING_DEFAULT) && (video_setting_ == CONTENT_SETTING_ALLOW || @@ -443,10 +451,10 @@ if (devices.empty()) { // Even if all requested permissions are allowed, if there are no devices // at this point we still report a failure. - request_result = blink::MEDIA_DEVICE_NO_HARDWARE; + request_result = blink::mojom::MediaStreamRequestResult::NO_HARDWARE; } } else { - DCHECK_NE(blink::MEDIA_DEVICE_OK, denial_reason_); + DCHECK_NE(blink::mojom::MediaStreamRequestResult::OK, denial_reason_); request_result = denial_reason_; } @@ -510,7 +518,7 @@ ContentSetting MediaStreamDevicesController::GetContentSetting( ContentSettingsType content_type, const content::MediaStreamRequest& request, - blink::MediaStreamRequestResult* denial_reason) const { + blink::mojom::MediaStreamRequestResult* denial_reason) const { DCHECK(content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); DCHECK(!request_.security_origin.is_empty()); @@ -527,19 +535,19 @@ else device_id = request.requested_video_device_id; if (!HasAvailableDevices(content_type, device_id)) { - *denial_reason = blink::MEDIA_DEVICE_NO_HARDWARE; + *denial_reason = blink::mojom::MediaStreamRequestResult::NO_HARDWARE; return CONTENT_SETTING_BLOCK; } if (!IsUserAcceptAllowed(content_type)) { - *denial_reason = blink::MEDIA_DEVICE_PERMISSION_DENIED; + *denial_reason = blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; return CONTENT_SETTING_BLOCK; } // Don't request if the kill switch is on. if (PermissionIsBlockedForReason(content_type, PermissionStatusSource::KILL_SWITCH)) { - *denial_reason = blink::MEDIA_DEVICE_KILL_SWITCH_ON; + *denial_reason = blink::mojom::MediaStreamRequestResult::KILL_SWITCH_ON; return CONTENT_SETTING_BLOCK; }
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller.h b/chrome/browser/media/webrtc/media_stream_devices_controller.h index 1b2ba15..4b5920a 100644 --- a/chrome/browser/media/webrtc/media_stream_devices_controller.h +++ b/chrome/browser/media/webrtc/media_stream_devices_controller.h
@@ -14,6 +14,7 @@ #include "components/content_settings/core/common/content_settings.h" #include "content/public/browser/media_stream_request.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" class MediaStreamDevicesController; class Profile; @@ -97,7 +98,7 @@ ContentSetting GetContentSetting( ContentSettingsType content_type, const content::MediaStreamRequest& request, - blink::MediaStreamRequestResult* denial_reason) const; + blink::mojom::MediaStreamRequestResult* denial_reason) const; // Returns true if clicking allow on the dialog should give access to the // requested devices. @@ -110,7 +111,7 @@ // through the lifetime of the request. ContentSetting audio_setting_; ContentSetting video_setting_; - blink::MediaStreamRequestResult denial_reason_; + blink::mojom::MediaStreamRequestResult denial_reason_; content::WebContents* web_contents_;
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc b/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc index 23c8b99e..e38cf2fe 100644 --- a/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc +++ b/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc
@@ -42,11 +42,13 @@ MediaStreamDevicesControllerTest() : example_audio_id_("fake_audio_dev"), example_video_id_("fake_video_dev"), - media_stream_result_(blink::NUM_MEDIA_REQUEST_RESULTS) {} + media_stream_result_( + blink::mojom::MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS) { + } // Dummy callback for when we deny the current request directly. void OnMediaStreamResponse(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { media_stream_devices_ = devices; media_stream_result_ = result; @@ -67,7 +69,7 @@ const std::string& example_audio_id() const { return example_audio_id_; } const std::string& example_video_id() const { return example_video_id_; } - blink::MediaStreamRequestResult media_stream_result() const { + blink::mojom::MediaStreamRequestResult media_stream_result() const { return media_stream_result_; } @@ -181,7 +183,8 @@ // Cleanup. media_stream_devices_.clear(); - media_stream_result_ = blink::NUM_MEDIA_REQUEST_RESULTS; + media_stream_result_ = + blink::mojom::MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS; blink::MediaStreamDevices audio_devices; blink::MediaStreamDevice fake_audio_device( @@ -211,7 +214,7 @@ const std::string example_video_id_; blink::MediaStreamDevices media_stream_devices_; - blink::MediaStreamRequestResult media_stream_result_; + blink::mojom::MediaStreamRequestResult media_stream_result_; base::Closure quit_closure_; @@ -638,10 +641,10 @@ // The expected media stream result after clicking accept/deny for the given // inputs. - blink::MediaStreamRequestResult ExpectedMediaStreamResult() const { + blink::mojom::MediaStreamRequestResult ExpectedMediaStreamResult() const { if (ExpectMicAllowed() && ExpectCamAllowed()) - return blink::MEDIA_DEVICE_OK; - return blink::MEDIA_DEVICE_PERMISSION_DENIED; + return blink::mojom::MediaStreamRequestResult::OK; + return blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; } }; @@ -719,7 +722,7 @@ ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_OK, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::OK, media_stream_result()); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); } @@ -743,7 +746,7 @@ PermissionRequestType::PERMISSION_MEDIASTREAM_MIC)); // Accept the prompt. - ASSERT_EQ(blink::MEDIA_DEVICE_OK, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::OK, media_stream_result()); ASSERT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); @@ -755,7 +758,7 @@ base::Unretained(this))); ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_OK, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::OK, media_stream_result()); ASSERT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); } @@ -774,7 +777,8 @@ base::Unretained(this))); ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, + media_stream_result()); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); } @@ -796,7 +800,8 @@ base::Unretained(this))); ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, + media_stream_result()); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); } @@ -827,7 +832,8 @@ ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::KILL_SWITCH_ON, + media_stream_result()); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); } @@ -859,7 +865,8 @@ ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, + media_stream_result()); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED, @@ -893,7 +900,8 @@ ASSERT_EQ(0, prompt_factory()->TotalRequestCount()); - ASSERT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, media_stream_result()); + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, + media_stream_result()); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); ASSERT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED, @@ -911,7 +919,7 @@ base::BindOnce(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, base::Unretained(this))); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, media_stream_result()); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, media_stream_result()); EXPECT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); EXPECT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); } @@ -927,7 +935,7 @@ base::BindOnce(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, base::Unretained(this))); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, media_stream_result()); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, media_stream_result()); EXPECT_FALSE(CheckDevicesListContains(blink::MEDIA_DEVICE_AUDIO_CAPTURE)); EXPECT_TRUE(CheckDevicesListContains(blink::MEDIA_DEVICE_VIDEO_CAPTURE)); }
diff --git a/chrome/browser/media/webrtc/media_stream_infobar_browsertest.cc b/chrome/browser/media/webrtc/media_stream_infobar_browsertest.cc index 18c0887..651c802 100644 --- a/chrome/browser/media/webrtc/media_stream_infobar_browsertest.cc +++ b/chrome/browser/media/webrtc/media_stream_infobar_browsertest.cc
@@ -28,6 +28,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" // MediaStreamPermissionTest --------------------------------------------------- @@ -75,7 +76,7 @@ // Dummy callback for when we deny the current request directly. static void OnMediaStreamResponse( const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) {} DISALLOW_COPY_AND_ASSIGN(MediaStreamPermissionTest);
diff --git a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc index 1996384..5e50258 100644 --- a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc +++ b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc
@@ -43,7 +43,7 @@ using RepeatingMediaResponseCallback = base::RepeatingCallback<void(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui)>; #if defined(OS_MACOSX) @@ -127,8 +127,9 @@ chrome::android::kUserMediaScreenCapturing)) { // If screen capturing isn't enabled on Android, we'll use "invalid state" // as result, same as on desktop. - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_INVALID_STATE, nullptr); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::INVALID_STATE, nullptr); return; } #endif // defined(OS_ANDROID) @@ -209,7 +210,7 @@ content::WebContents* web_contents, int request_id, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -228,12 +229,12 @@ if (request_it == requests_map.end()) return; - blink::MediaStreamRequestResult final_result = result; + blink::mojom::MediaStreamRequestResult final_result = result; #if defined(OS_MACOSX) // If the request was approved, ask for system permissions if needed, and run // this function again when done. - if (result == blink::MEDIA_DEVICE_OK) { + if (result == blink::mojom::MediaStreamRequestResult::OK) { const content::MediaStreamRequest& request = request_it->second.request; if (request.audio_type == blink::MEDIA_DEVICE_AUDIO_CAPTURE) { const SystemPermission system_audio_permission = @@ -253,7 +254,8 @@ return; } else if (system_audio_permission == SystemPermission::kRestricted || system_audio_permission == SystemPermission::kDenied) { - final_result = blink::MEDIA_DEVICE_SYSTEM_PERMISSION_DENIED; + final_result = + blink::mojom::MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED; system_media_permissions::SystemAudioCapturePermissionBlocked(); } } @@ -275,7 +277,8 @@ return; } else if (system_video_permission == SystemPermission::kRestricted || system_video_permission == SystemPermission::kDenied) { - final_result = blink::MEDIA_DEVICE_SYSTEM_PERMISSION_DENIED; + final_result = + blink::mojom::MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED; system_media_permissions::SystemVideoCapturePermissionBlocked(); } }
diff --git a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.h b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.h index 18a0d3a..96ee52c 100644 --- a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.h +++ b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.h
@@ -11,6 +11,7 @@ #include "chrome/browser/media/media_access_handler.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" // MediaAccessHandler for permission bubble requests. class PermissionBubbleMediaAccessHandler @@ -48,7 +49,7 @@ void OnAccessRequestResponse(content::WebContents* web_contents, int request_id, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui); // content::NotificationObserver implementation.
diff --git a/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc b/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc index 40e2ea55..1e92045 100644 --- a/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc +++ b/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc
@@ -44,9 +44,10 @@ ScreenCaptureInfoBarDelegateAndroid::~ScreenCaptureInfoBarDelegateAndroid() { if (!callback_.is_null()) { - std::move(callback_).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, - nullptr); + std::move(callback_).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, + nullptr); } } @@ -72,26 +73,26 @@ } bool ScreenCaptureInfoBarDelegateAndroid::Accept() { - RunCallback(blink::MEDIA_DEVICE_OK); + RunCallback(blink::mojom::MediaStreamRequestResult::OK); return true; } bool ScreenCaptureInfoBarDelegateAndroid::Cancel() { - RunCallback(blink::MEDIA_DEVICE_PERMISSION_DENIED); + RunCallback(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED); return true; } void ScreenCaptureInfoBarDelegateAndroid::InfoBarDismissed() { - RunCallback(blink::MEDIA_DEVICE_PERMISSION_DISMISSED); + RunCallback(blink::mojom::MediaStreamRequestResult::PERMISSION_DISMISSED); } void ScreenCaptureInfoBarDelegateAndroid::RunCallback( - blink::MediaStreamRequestResult result) { + blink::mojom::MediaStreamRequestResult result) { DCHECK(!callback_.is_null()); blink::MediaStreamDevices devices; std::unique_ptr<content::MediaStreamUI> ui; - if (result == blink::MEDIA_DEVICE_OK) { + if (result == blink::mojom::MediaStreamRequestResult::OK) { content::DesktopMediaID screen_id = content::DesktopMediaID( content::DesktopMediaID::TYPE_SCREEN, webrtc::kFullDesktopScreenId); devices.push_back(
diff --git a/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h b/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h index 98c8a18..829212ce 100644 --- a/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h +++ b/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h
@@ -7,6 +7,7 @@ #include "chrome/browser/media/media_access_handler.h" #include "components/infobars/core/confirm_infobar_delegate.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace content { class WebContents; @@ -39,7 +40,7 @@ // Runs |callback_|, passing it the |result|, and (if permission was granted) // the appropriate stream device and UI object for video capture. - void RunCallback(blink::MediaStreamRequestResult result); + void RunCallback(blink::mojom::MediaStreamRequestResult result); content::WebContents* web_contents_; const content::MediaStreamRequest request_;
diff --git a/chrome/browser/media/webrtc/tab_capture_access_handler.cc b/chrome/browser/media/webrtc/tab_capture_access_handler.cc index 963bc1c3..5e326502 100644 --- a/chrome/browser/media/webrtc/tab_capture_access_handler.cc +++ b/chrome/browser/media/webrtc/tab_capture_access_handler.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "content/public/browser/web_contents.h" #include "extensions/common/permissions/permissions_data.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" TabCaptureAccessHandler::TabCaptureAccessHandler() { } @@ -49,8 +50,9 @@ extensions::TabCaptureRegistry::Get(profile); if (!tab_capture_registry) { NOTREACHED(); - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, - std::move(ui)); + std::move(callback).Run( + devices, blink::mojom::MediaStreamRequestResult::INVALID_STATE, + std::move(ui)); return; } // |extension| may be null if the tabCapture starts with @@ -78,8 +80,9 @@ ->RegisterMediaStream(web_contents, devices); } UpdateExtensionTrusted(request, extension); - std::move(callback).Run(devices, - devices.empty() ? blink::MEDIA_DEVICE_INVALID_STATE - : blink::MEDIA_DEVICE_OK, - std::move(ui)); + std::move(callback).Run( + devices, + devices.empty() ? blink::mojom::MediaStreamRequestResult::INVALID_STATE + : blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); }
diff --git a/chrome/browser/performance_manager/render_process_user_data.cc b/chrome/browser/performance_manager/render_process_user_data.cc index 2e2c199..ef6e1fb 100644 --- a/chrome/browser/performance_manager/render_process_user_data.cc +++ b/chrome/browser/performance_manager/render_process_user_data.cc
@@ -116,4 +116,9 @@ base::Unretained(process_node_.get()), info.exit_code)); } +void RenderProcessUserData::RenderProcessHostDestroyed( + content::RenderProcessHost* host) { + host->RemoveUserData(kRenderProcessUserDataKey); +} + } // namespace performance_manager
diff --git a/chrome/browser/performance_manager/render_process_user_data.h b/chrome/browser/performance_manager/render_process_user_data.h index ac74b1d..f3b4d162 100644 --- a/chrome/browser/performance_manager/render_process_user_data.h +++ b/chrome/browser/performance_manager/render_process_user_data.h
@@ -47,6 +47,7 @@ void RenderProcessExited( content::RenderProcessHost* host, const content::ChildProcessTerminationInfo& info) override; + void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; // All instances are linked together in a doubly linked list to allow orderly // destruction at browser shutdown time.
diff --git a/chrome/browser/platform_util_chromeos.cc b/chrome/browser/platform_util_chromeos.cc index ddf18cb..11391d2 100644 --- a/chrome/browser/platform_util_chromeos.cc +++ b/chrome/browser/platform_util_chromeos.cc
@@ -4,8 +4,8 @@ #include "chrome/browser/platform_util.h" +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "base/bind.h" #include "base/files/file_path.h" #include "chrome/browser/chromeos/file_manager/open_util.h" @@ -132,7 +132,7 @@ if (features::IsUsingWindowService()) window = window->GetRootWindow(); return window->GetProperty(ash::kWindowPinTypeKey) == - ash::mojom::WindowPinType::TRUSTED_PINNED; + ash::WindowPinType::kTrustedPinned; } } // namespace platform_util
diff --git a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc index 9495e77..8fa0daee 100644 --- a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc
@@ -251,18 +251,16 @@ // Give a bogus OAuth token to the |policy_manager|. This should make its // CloudPolicyClient fetch the DMToken. ASSERT_FALSE(policy_manager->core()->client()->is_registered()); - em::DeviceRegisterRequest::Type registration_type = + CloudPolicyClient::RegistrationParameters parameters( #if defined(OS_CHROMEOS) - em::DeviceRegisterRequest::USER; + em::DeviceRegisterRequest::USER, #else - em::DeviceRegisterRequest::BROWSER; + em::DeviceRegisterRequest::BROWSER, #endif + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); policy_manager->core()->client()->Register( - registration_type, em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, "oauth_token_unused" /* oauth_token */, - std::string() /* client_id */, std::string() /* requisition */, - std::string() /* current_state_key */); + parameters, std::string() /* client_id */, + "oauth_token_unused" /* oauth_token */); run_loop.Run(); Mock::VerifyAndClearExpectations(&observer); policy_manager->core()->client()->RemoveObserver(&observer);
diff --git a/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc index a4d6e19a..b16109b 100644 --- a/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc
@@ -219,18 +219,16 @@ // Give a bogus OAuth token to the |policy_manager|. This should make its // CloudPolicyClient fetch the DMToken. - em::DeviceRegisterRequest::Type registration_type = + CloudPolicyClient::RegistrationParameters parameters( #if defined(OS_CHROMEOS) - em::DeviceRegisterRequest::USER; + em::DeviceRegisterRequest::USER, #else - em::DeviceRegisterRequest::BROWSER; + em::DeviceRegisterRequest::BROWSER, #endif + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); policy_manager()->core()->client()->Register( - registration_type, em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, "oauth_token_unused" /* oauth_token */, - std::string() /* client_id */, std::string() /* requisition */, - std::string() /* current_state_key */); + parameters, std::string() /* client_id */, + "oauth_token_unused" /* oauth_token */); run_loop.Run(); Mock::VerifyAndClearExpectations(&observer); policy_manager()->core()->client()->RemoveObserver(&observer);
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index c5c61140..5c62926 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -248,6 +248,7 @@ #include "services/service_manager/public/cpp/connector.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/web_input_event.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/page_transition_types.h" @@ -4555,7 +4556,7 @@ } void Accept(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { if (policy_value_ || request_url_allowed_via_whitelist_) { ASSERT_EQ(1U, devices.size());
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index db59886d..3db50ac 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc
@@ -61,15 +61,15 @@ DCHECK(!document_); worker_ = query->DetachWorker(); worker_->SetPrintJob(this); - settings_ = query->settings(); + const PrintSettings& settings = query->settings(); auto new_doc = - base::MakeRefCounted<PrintedDocument>(settings_, name, query->cookie()); + base::MakeRefCounted<PrintedDocument>(settings, name, query->cookie()); new_doc->set_page_count(page_count); UpdatePrintedDocument(new_doc); #if defined(OS_WIN) - pdf_page_mapping_ = PageRange::GetPages(settings_.ranges()); + pdf_page_mapping_ = PageRange::GetPages(settings.ranges()); if (pdf_page_mapping_.empty()) { for (int i = 0; i < page_count; i++) pdf_page_mapping_.push_back(i); @@ -104,13 +104,14 @@ if (PrintedDocument::HasDebugDumpPath()) document()->DebugDumpData(print_data.get(), FILE_PATH_LITERAL(".pdf")); - if (settings_.printer_is_textonly()) { + const PrintSettings& settings = document()->settings(); + if (settings.printer_is_textonly()) { StartPdfToTextConversion(print_data, page_size); - } else if ((settings_.printer_is_ps2() || settings_.printer_is_ps3()) && + } else if ((settings.printer_is_ps2() || settings.printer_is_ps3()) && !base::FeatureList::IsEnabled( features::kDisablePostScriptPrinting)) { StartPdfToPostScriptConversion(print_data, content_area, physical_offsets, - settings_.printer_is_ps2()); + settings.printer_is_ps2()); } else { StartPdfToEmfConversion(print_data, page_size, content_area); } @@ -234,6 +235,10 @@ return document_.get(); } +const PrintSettings& PrintJob::settings() const { + return document()->settings(); +} + #if defined(OS_WIN) class PrintJob::PdfConversionState { public: @@ -295,12 +300,13 @@ // Update : The missing letters seem to have been caused by the same // problem as https://crbug.com/659604 which was resolved. GDI printing // seems to work with the fix for this bug applied. + const PrintSettings& settings = document()->settings(); bool print_text_with_gdi = - settings_.print_text_with_gdi() && !settings_.printer_is_xps() && + settings.print_text_with_gdi() && !settings.printer_is_xps() && base::FeatureList::IsEnabled(features::kGdiTextPrinting); PdfRenderSettings render_settings( - content_area, gfx::Point(0, 0), settings_.dpi_size(), - /*autorotate=*/true, settings_.color() == COLOR, + content_area, gfx::Point(0, 0), settings.dpi_size(), + /*autorotate=*/true, settings.color() == COLOR, print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT : PdfRenderSettings::Mode::NORMAL); pdf_conversion_state_->Start( @@ -358,8 +364,9 @@ pdf_conversion_state_ = std::make_unique<PdfConversionState>(gfx::Size(), gfx::Rect()); gfx::Rect page_area = gfx::Rect(0, 0, page_size.width(), page_size.height()); + const PrintSettings& settings = document()->settings(); PdfRenderSettings render_settings( - page_area, gfx::Point(0, 0), settings_.dpi_size(), + page_area, gfx::Point(0, 0), settings.dpi_size(), /*autorotate=*/true, /*use_color=*/true, PdfRenderSettings::Mode::TEXTONLY); pdf_conversion_state_->Start( @@ -376,9 +383,10 @@ DCHECK(!pdf_conversion_state_); pdf_conversion_state_ = std::make_unique<PdfConversionState>( gfx::Size(), gfx::Rect()); + const PrintSettings& settings = document()->settings(); PdfRenderSettings render_settings( - content_area, physical_offsets, settings_.dpi_size(), - /*autorotate=*/true, settings_.color() == COLOR, + content_area, physical_offsets, settings.dpi_size(), + /*autorotate=*/true, settings.color() == COLOR, ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2 : PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3); pdf_conversion_state_->Start( @@ -425,7 +433,6 @@ switch (event_details.type()) { case JobEventDetails::FAILED: { - settings_.Clear(); // No need to cancel since the worker already canceled itself. Stop(); break; @@ -533,10 +540,6 @@ void PrintJob::HoldUntilStopIsCalled() { } -void PrintJob::set_settings(const PrintSettings& settings) { - settings_ = settings; -} - void PrintJob::set_job_pending(bool pending) { is_job_pending_ = pending; }
diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index 0be34c3d..b50220d 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h
@@ -104,7 +104,7 @@ PrintedDocument* document() const; // Access stored settings. - const PrintSettings& settings() const { return settings_; } + const PrintSettings& settings() const; // Posts the given task to be run. bool PostTask(const base::Location& from_here, base::OnceClosure task); @@ -117,7 +117,6 @@ // The functions below are used for tests only. void set_job_pending(bool pending); - void set_settings(const PrintSettings& settings); // Updates |document_| to a new instance. Protected so that tests can access // it. @@ -181,9 +180,6 @@ // worker thread per print job. std::unique_ptr<PrintJobWorker> worker_; - // Cache of the print context settings for access in the UI thread. - PrintSettings settings_; - // The printed document. scoped_refptr<PrintedDocument> document_;
diff --git a/chrome/browser/printing/test_print_job.cc b/chrome/browser/printing/test_print_job.cc index 2fa52dbf..29bd1a4a 100644 --- a/chrome/browser/printing/test_print_job.cc +++ b/chrome/browser/printing/test_print_job.cc
@@ -23,8 +23,6 @@ // when this function exits. std::unique_ptr<PrintJobWorker> worker = query->DetachWorker(); - set_settings(query->settings()); - scoped_refptr<PrintedDocument> new_doc = base::MakeRefCounted<PrintedDocument>(query->settings(), name, query->cookie());
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index babeaf6e..d9fafee 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -83,8 +83,8 @@ #include "ui/base/models/menu_model.h" #if defined(OS_CHROMEOS) +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "ui/aura/window.h" #endif @@ -306,7 +306,7 @@ // Set locked fullscreen state. browser()->window()->GetNativeWindow()->SetProperty( - ash::kWindowPinTypeKey, ash::mojom::WindowPinType::TRUSTED_PINNED); + ash::kWindowPinTypeKey, ash::WindowPinType::kTrustedPinned); // All entries are disabled in locked fullscreen (testing only a subset here). for (auto entry : entries_to_test)
diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.css b/chrome/browser/resources/chromeos/login/screen_gaia_signin.css index 9bfcfa9a..107808a5 100644 --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.css +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.css
@@ -2,17 +2,11 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -:host { +:host(.saml-interstitial) { height: 528px; width: 448px; } -:host(.v2) { - height: unset; - padding: unset; - width: unset; -} - .signin-link { color: rgb(37, 79, 155); cursor: pointer; @@ -71,8 +65,8 @@ } #saml-notice-recording-indicator { - padding-left: 10px; - padding-right: 10px; + padding-inline-end: 10px; + padding-inline-start: 10px; } #saml-notice-message { @@ -115,11 +109,11 @@ visibility: visible; } -:host(.v2) #gaia-step-contents { +:host(:not(.saml-interstitial)) #gaia-step-contents { display: none; } -:host(.v2.saml) #signin-frame { +:host(.saml) #signin-frame { height: 516px; padding-top: 44px; }
diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js index 9c00a4be..e6f87cc 100644 --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js
@@ -790,18 +790,15 @@ * @private */ updateSigninFrameContainers_: function() { - let oldState = this.classList.contains('v2'); - this.classList.toggle('v2', false); - if (this.screenMode_ == ScreenMode.DEFAULT || - this.screenMode_ == ScreenMode.OFFLINE || - this.screenMode_ == ScreenMode.AD_AUTH) { - this.classList.toggle('v2', true); - } + const samlClass = 'saml-interstitial'; + const containedSamlClass = this.classList.contains(samlClass); + this.classList.toggle( + samlClass, this.screenMode_ == ScreenMode.SAML_INTERSTITIAL); if (Oobe.getInstance().currentScreen.id != 'gaia-signin') return; // Switching between signin-frame-dialog and gaia-step-contents // updates screen size. - if (oldState != this.classList.contains('v2')) + if (containedSamlClass != this.classList.contains(samlClass)) Oobe.getInstance().updateScreenSize(this); },
diff --git a/chrome/browser/resources/settings/internet_page/network_summary_item.html b/chrome/browser/resources/settings/internet_page/network_summary_item.html index e5326a65..0fcd085 100644 --- a/chrome/browser/resources/settings/internet_page/network_summary_item.html +++ b/chrome/browser/resources/settings/internet_page/network_summary_item.html
@@ -2,6 +2,7 @@ <link rel="import" href="chrome://resources/cr_components/chromeos/network/network_siminfo.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html"> +<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
diff --git a/chrome/browser/resources/settings/internet_page/network_summary_item.js b/chrome/browser/resources/settings/internet_page/network_summary_item.js index 4821799..ef38e76 100644 --- a/chrome/browser/resources/settings/internet_page/network_summary_item.js +++ b/chrome/browser/resources/settings/internet_page/network_summary_item.js
@@ -367,6 +367,7 @@ * @private */ getTitleText_: function() { + assert(CrOncStrings); return this.networkTitleText || CrOncStrings['OncType' + this.activeNetworkState.Type]; },
diff --git a/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc index ce7e918..f0b81cc 100644 --- a/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc +++ b/chrome/browser/sync/test/integration/performance/autofill_sync_perf_test.cc
@@ -51,25 +51,7 @@ GURL(bookmarks_helper::IndexedURL(id))) != nullptr); } -// 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::kSyncUSSAutofillProfile); - } else { - override_features_.InitAndDisableFeature( - switches::kSyncUSSAutofillProfile); - } - } - - private: - base::test::ScopedFeatureList override_features_; -}; - -class AutofillProfileSyncPerfTest : public UssSwitchToggler, public SyncTest { +class AutofillProfileSyncPerfTest : public SyncTest { public: AutofillProfileSyncPerfTest() : SyncTest(TWO_CLIENT), guid_number_(0), name_number_(0) {} @@ -151,7 +133,7 @@ return IntToName(name_number_++); } -IN_PROC_BROWSER_TEST_P(AutofillProfileSyncPerfTest, P0) { +IN_PROC_BROWSER_TEST_F(AutofillProfileSyncPerfTest, P0) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; AddProfiles(0, kNumProfiles); @@ -170,12 +152,6 @@ PrintResult("autofill", "delete_autofill_profiles", dt); } -// Only parametrize the test above that tests autofill_profile, the test below -// addresses autocomplete and thus does not need parametrizing. -INSTANTIATE_TEST_SUITE_P(USS, - AutofillProfileSyncPerfTest, - ::testing::Values(false, true)); - class AutocompleteSyncPerfTest : public SyncTest { public: AutocompleteSyncPerfTest() : SyncTest(TWO_CLIENT), name_number_(0) {}
diff --git a/chrome/browser/sync/test/integration/single_client_autofill_profile_sync_test.cc b/chrome/browser/sync/test/integration/single_client_autofill_profile_sync_test.cc index db06da9..35bc523 100644 --- a/chrome/browser/sync/test/integration/single_client_autofill_profile_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_autofill_profile_sync_test.cc
@@ -38,19 +38,16 @@ } }; -class SingleClientAutofillProfileSyncTest : public FeatureToggler, - public SyncTest { +class SingleClientAutofillProfileSyncTest : public SyncTest { public: - SingleClientAutofillProfileSyncTest() - : FeatureToggler(switches::kSyncUSSAutofillProfile), - SyncTest(SINGLE_CLIENT) {} + SingleClientAutofillProfileSyncTest() : SyncTest(SINGLE_CLIENT) {} ~SingleClientAutofillProfileSyncTest() override {} private: DISALLOW_COPY_AND_ASSIGN(SingleClientAutofillProfileSyncTest); }; -IN_PROC_BROWSER_TEST_P(SingleClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(SingleClientAutofillProfileSyncTest, DisablingAutofillAlsoDisablesSyncing) { ASSERT_TRUE(SetupSync()); ASSERT_TRUE(GetClient(0)->service()->GetActiveDataTypes().Has( @@ -79,8 +76,4 @@ EXPECT_EQ(1uL, pdm->GetProfiles().size()); } -INSTANTIATE_TEST_SUITE_P(USS, - SingleClientAutofillProfileSyncTest, - ::testing::Values(false, true)); - } // namespace
diff --git a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc index d0fe64b..3a491785 100644 --- a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
@@ -51,28 +51,7 @@ MODEL_TYPE_ENTITY_CHANGE_COUNT = 6 }; -// Class that enables or disables USS based on test parameter. Must be the first -// base class of the test fixture. -// TODO(jkrcal): When the new implementation fully launches, remove this class, -// convert all tests from *_P back to *_F and remove the instance at the end. -class UssSwitchToggler : public testing::WithParamInterface<bool> { - public: - UssSwitchToggler() { - if (GetParam()) { - override_features_.InitAndEnableFeature( - switches::kSyncUSSAutofillProfile); - } else { - override_features_.InitAndDisableFeature( - switches::kSyncUSSAutofillProfile); - } - } - - private: - base::test::ScopedFeatureList override_features_; -}; - -class TwoClientAutofillProfileSyncTest : public UssSwitchToggler, - public SyncTest { +class TwoClientAutofillProfileSyncTest : public SyncTest { public: TwoClientAutofillProfileSyncTest() : SyncTest(TWO_CLIENT) {} ~TwoClientAutofillProfileSyncTest() override {} @@ -87,7 +66,7 @@ DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillProfileSyncTest); }; -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, PersonalDataManagerSanity) { ASSERT_TRUE(SetupSync()); @@ -136,7 +115,7 @@ LOCAL_DELETION, 2); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, SyncHistogramsInitialSync) { ASSERT_TRUE(SetupClients()); @@ -172,7 +151,7 @@ 6); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, AddDuplicateProfiles) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddDuplicateProfiles) { ASSERT_TRUE(SetupClients()); // TODO(crbug.com/904390): Once the investigation is over, remove the // histogram checks for zero LOCAL_DELETIONS here and in all further tests. @@ -188,7 +167,7 @@ LOCAL_DELETION, 0); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, SameProfileWithConflict) { ASSERT_TRUE(SetupClients()); base::HistogramTester histograms; @@ -208,7 +187,7 @@ LOCAL_DELETION, 0); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddDuplicateProfiles_OneIsVerified) { ASSERT_TRUE(SetupClients()); base::HistogramTester histograms; @@ -233,7 +212,7 @@ LOCAL_DELETION, 0); } -IN_PROC_BROWSER_TEST_P( +IN_PROC_BROWSER_TEST_F( TwoClientAutofillProfileSyncTest, AddDuplicateProfiles_OneIsVerified_NonverifiedComesLater) { ASSERT_TRUE(SetupClients()); @@ -270,7 +249,7 @@ } // Tests that a null profile does not get synced across clients. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, AddEmptyProfile) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddEmptyProfile) { ASSERT_TRUE(SetupSync()); AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); @@ -280,7 +259,7 @@ // Tests that adding a profile on one client results in it being added on the // other client when sync is running. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, AddProfile) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddProfile) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -299,7 +278,7 @@ // Tests that adding a profile on one client results in it being added on the // other client when sync gets started. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddProfile_BeforeSyncStart) { ASSERT_TRUE(SetupClients()) << "SetupClients() failed"; base::HistogramTester histograms; @@ -321,7 +300,7 @@ // Tests that adding the same profile on the two clients before sync is started // results in each client only having one profile after sync is started -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, ClientsAddSameProfile) { ASSERT_TRUE(SetupClients()) << "SetupClients() failed"; base::HistogramTester histograms; @@ -352,7 +331,7 @@ // Tests that adding multiple profiles to one client results in all of them // being added to the other client. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddMultipleProfilesOnOneClient) { ASSERT_TRUE(SetupClients()); base::HistogramTester histograms; @@ -370,7 +349,7 @@ // Tests that adding multiple profiles to two client results both clients having // all profiles. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, AddMultipleProfilesOnTwoClients) { ASSERT_TRUE(SetupClients()); base::HistogramTester histograms; @@ -388,7 +367,7 @@ // Tests that deleting a profile on one client results in it being deleted on // the other client. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, DeleteProfile) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, DeleteProfile) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -410,7 +389,7 @@ // Tests that modifying a profile while syncing results in the other client // getting the updated profile. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, UpdateFields) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, UpdateFields) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -445,7 +424,7 @@ // Tests that modifying a profile at the same time one two clients while // syncing results in the both client having the same profile (doesn't matter // which one). -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, UpdateConflictingFields) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -474,7 +453,7 @@ // Tests that modifying a profile at the same time one two clients while // syncing results in the both client having the same profile (doesn't matter // which one). -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, UpdateConflictingFieldsDuringInitialMerge) { ASSERT_TRUE(SetupClients()); base::HistogramTester histograms; @@ -503,7 +482,7 @@ // Tests that modifying a profile at the same time on two clients while // syncing results in both client having the same profile (doesn't matter which // one). -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, DeleteAndUpdate) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, DeleteAndUpdate) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -529,17 +508,8 @@ // syncing results in a conflict where the update wins. This only works with // a server that supports a strong consistency model and is hence capable of // detecting conflicts server-side. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, DeleteAndUpdateWithStrongConsistency) { - if (GetParam() == false) { - // TODO(crbug.com/890746): There seems to be a bug in directory code that - // resolves conflicts in a way that local deletion wins over a remote - // update, which makes this test non-deterministic, because the logic is - // asymmetric (so the outcome depends on which client commits first). - // For now, we "disable" the test. - return; - } - ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; GetFakeServer()->EnableStrongConsistencyWithConflictDetectionModel(); @@ -565,7 +535,7 @@ LOCAL_DELETION, 1); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, MaxLength) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, MaxLength) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -593,7 +563,7 @@ LOCAL_DELETION, 0); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, ExceedsMaxLength) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, ExceedsMaxLength) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -628,7 +598,7 @@ } // Test credit cards don't sync. -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, NoCreditCardSync) { +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, NoCreditCardSync) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -654,7 +624,7 @@ LOCAL_DELETION, 0); } -IN_PROC_BROWSER_TEST_P(TwoClientAutofillProfileSyncTest, +IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, E2E_ONLY(TwoClientsAddAutofillProfiles)) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms; @@ -683,10 +653,4 @@ LOCAL_DELETION, 0); } -// Only parametrize the tests above that test autofill_profile, the tests below -// address autocomplete and thus do not need parametrizing. -INSTANTIATE_TEST_SUITE_P(USS, - TwoClientAutofillProfileSyncTest, - ::testing::Values(false, true)); - } // namespace
diff --git a/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc b/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc index 7a25f536..9ef7968 100644 --- a/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc +++ b/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc
@@ -22,7 +22,7 @@ // The total number of Ash accelerators. constexpr int kAshAcceleratorsTotalNum = 104; // The hash of Ash accelerators. -constexpr char kAshAcceleratorsHash[] = "1e3e31c4f37997da2a04d438bf150cd6"; +constexpr char kAshAcceleratorsHash[] = "abc138d68a319b5ba56430ff56c54a6e"; #if defined(GOOGLE_CHROME_BUILD) // Internal builds add an extra accelerator for the Feedback app. // The total number of Chrome accelerators (available on Chrome OS).
diff --git a/chrome/browser/ui/ash/kiosk_next_shell_client_browsertest.cc b/chrome/browser/ui/ash/kiosk_next_shell_client_browsertest.cc index 2bee01e..866beffc 100644 --- a/chrome/browser/ui/ash/kiosk_next_shell_client_browsertest.cc +++ b/chrome/browser/ui/ash/kiosk_next_shell_client_browsertest.cc
@@ -9,6 +9,7 @@ #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" #include "base/test/test_timeouts.h" +#include "build/build_config.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/login/test/fake_gaia_mixin.h" #include "chrome/browser/chromeos/login/test/oobe_base_test.h" @@ -113,7 +114,15 @@ // Checks that the Kiosk Next Home window does not launch in sign-in when // its pref is disabled. -IN_PROC_BROWSER_TEST_F(KioskNextShellClientTest, KioskNextShellNotLaunched) { +// +// See https://crbug.com/971256 +#if defined(OS_LINUX) +#define MAYBE_KioskNextShellNotLaunched DISABLED_KioskNextShellNotLaunched +#else +#define MAYBE_KioskNextShellNotLaunched KioskNextShellNotLaunched +#endif +IN_PROC_BROWSER_TEST_F(KioskNextShellClientTest, + MAYBE_KioskNextShellNotLaunched) { // Enable all component extensions. extensions::ComponentLoader::EnableBackgroundExtensionsForTesting();
diff --git a/chrome/browser/ui/browser_command_controller_browsertest.cc b/chrome/browser/ui/browser_command_controller_browsertest.cc index 798aafbf..49507cc2 100644 --- a/chrome/browser/ui/browser_command_controller_browsertest.cc +++ b/chrome/browser/ui/browser_command_controller_browsertest.cc
@@ -35,8 +35,8 @@ #include "content/public/test/test_utils.h" #if defined(OS_CHROMEOS) +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "chromeos/constants/chromeos_switches.h" #include "ui/aura/window.h" #endif @@ -135,7 +135,7 @@ EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_EXIT)); // Set locked fullscreen mode. browser()->window()->GetNativeWindow()->SetProperty( - ash::kWindowPinTypeKey, ash::mojom::WindowPinType::TRUSTED_PINNED); + ash::kWindowPinTypeKey, ash::WindowPinType::kTrustedPinned); // Update the corresponding command_controller state. browser()->command_controller()->LockedFullscreenStateChanged(); // Update some more states just to make sure the wrong commands don't get @@ -165,7 +165,7 @@ // Exit locked fullscreen mode. browser()->window()->GetNativeWindow()->SetProperty( - ash::kWindowPinTypeKey, ash::mojom::WindowPinType::NONE); + ash::kWindowPinTypeKey, ash::WindowPinType::kNone); // Update the corresponding command_controller state. browser()->command_controller()->LockedFullscreenStateChanged(); // IDC_EXIT is enabled again.
diff --git a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc index fdabafbb..b276528 100644 --- a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc +++ b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "base/command_line.h" #include "chrome/browser/chromeos/login/chrome_restart_request.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" @@ -69,7 +69,7 @@ if (features::IsUsingWindowService()) window = window->GetRootWindow(); window->SetProperty(ash::kWindowPinTypeKey, - ash::mojom::WindowPinType::TRUSTED_PINNED); + ash::WindowPinType::kTrustedPinned); // Navigate to a page. auto url = GURL(chrome::kChromeUIVersionURL); @@ -89,7 +89,7 @@ // As a sanity check unset the locked fullscreen state and make sure that the // navigation happens (the following EXPECTs fail if the next line isn't // executed). - window->SetProperty(ash::kWindowPinTypeKey, ash::mojom::WindowPinType::NONE); + window->SetProperty(ash::kWindowPinTypeKey, ash::WindowPinType::kNone); Navigate(¶ms);
diff --git a/chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm index ab970ca..d81c792 100644 --- a/chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm +++ b/chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm
@@ -21,7 +21,9 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" +#include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" +#include "components/prefs/pref_service.h" #include "components/signin/core/browser/account_consistency_method.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/gfx/image/image.h" @@ -40,6 +42,13 @@ MAX_VALIDATE_MENU_SELECTOR, }; +// Check Add Person pref. +bool IsAddPersonEnabled() { + PrefService* service = g_browser_process->local_state(); + DCHECK(service); + return service->GetBoolean(prefs::kBrowserAddPersonEnabled); +} + } // namespace @interface ProfileMenuController (Private) @@ -181,6 +190,9 @@ [menuItem action] != @selector(editProfile:); } + if (!IsAddPersonEnabled()) + return [menuItem action] != @selector(newProfile:); + size_t index = avatarMenu_->GetActiveProfileIndex(); if (avatarMenu_->GetNumberOfItems() <= index) { ValidateMenuItemSelector currentSelector = UNKNOWN_SELECTOR; @@ -241,11 +253,14 @@ action:@selector(editProfile:)]; [[self menu] addItem:item]; - [[self menu] addItem:[NSMenuItem separatorItem]]; - item = [self createItemWithTitle:l10n_util::GetNSStringWithFixup( - IDS_PROFILES_CREATE_NEW_PROFILE_OPTION) - action:@selector(newProfile:)]; - [[self menu] addItem:item]; + if (IsAddPersonEnabled()) { + [[self menu] addItem:[NSMenuItem separatorItem]]; + + item = [self createItemWithTitle:l10n_util::GetNSStringWithFixup( + IDS_PROFILES_CREATE_NEW_PROFILE_OPTION) + action:@selector(newProfile:)]; + [[self menu] addItem:item]; + } [self rebuildMenu]; }
diff --git a/chrome/browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm index bc95c7d..83863b1 100644 --- a/chrome/browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm
@@ -26,13 +26,7 @@ class ProfileMenuControllerTest : public CocoaProfileTest { public: - ProfileMenuControllerTest() { - item_.reset([[NSMenuItem alloc] initWithTitle:@"Users" - action:nil - keyEquivalent:@""]); - controller_.reset( - [[ProfileMenuController alloc] initWithMainMenuItem:item_]); - } + ProfileMenuControllerTest() { RebuildController(); } void SetUp() override { CocoaProfileTest::SetUp(); @@ -42,6 +36,14 @@ chrome::testing::NSRunLoopRunAllPending(); } + void RebuildController() { + item_.reset([[NSMenuItem alloc] initWithTitle:@"Users" + action:nil + keyEquivalent:@""]); + controller_.reset( + [[ProfileMenuController alloc] initWithMainMenuItem:item_]); + } + void TestBottomItems() { NSMenu* menu = [controller() menu]; NSInteger count = [menu numberOfItems]; @@ -247,3 +249,23 @@ [controller() activeBrowserChangedTo:NULL]; base::ThreadRestrictions::SetIOAllowed(io_was_allowed); } + +TEST_F(ProfileMenuControllerTest, AddProfileDisabled) { + PrefService* local_state = g_browser_process->local_state(); + local_state->SetBoolean(prefs::kBrowserAddPersonEnabled, false); + + RebuildController(); + // Spin the runloop so |-initializeMenu| gets called. + chrome::testing::NSRunLoopRunAllPending(); + + NSMenu* menu = [controller() menu]; + NSInteger count = [menu numberOfItems]; + + ASSERT_GE(count, 2); + + NSMenuItem* item = [menu itemAtIndex:count - 2]; + EXPECT_TRUE([item isSeparatorItem]); + + item = [menu itemAtIndex:count - 1]; + EXPECT_EQ(@selector(editProfile:), [item action]); +}
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc index 62b8ab5..467a359 100644 --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
@@ -17,7 +17,6 @@ #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/window_properties.mojom.h" #include "ash/wm/window_state.h" #include "base/bind.h" #include "base/logging.h"
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc index 9cb51c5..b72c3168 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc
@@ -13,9 +13,9 @@ #include "ash/public/cpp/shelf_test_api.h" #include "ash/public/cpp/test/shell_test_api.h" #include "ash/public/cpp/vector_icons/vector_icons.h" +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" #include "ash/public/interfaces/constants.mojom.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "ash/shell.h" // mash-ok #include "ash/wm/overview/overview_controller.h" // mash-ok #include "ash/wm/splitview/split_view_controller.h" // mash-ok @@ -647,7 +647,7 @@ // Set locked fullscreen state. browser()->window()->GetNativeWindow()->SetProperty( - ash::kWindowPinTypeKey, ash::mojom::WindowPinType::TRUSTED_PINNED); + ash::kWindowPinTypeKey, ash::WindowPinType::kTrustedPinned); // We're fullscreen, immersive is disabled in locked fullscreen, and while // we're at it, also make sure that the shelf is hidden. @@ -673,7 +673,7 @@ // Set locked fullscreen state. browser()->window()->GetNativeWindow()->SetProperty( - ash::kWindowPinTypeKey, ash::mojom::WindowPinType::TRUSTED_PINNED); + ash::kWindowPinTypeKey, ash::WindowPinType::kTrustedPinned); // We're fullscreen, immersive is disabled in locked fullscreen, and while // we're at it, also make sure that the shelf is hidden.
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc index da53f0a..a13169f 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
@@ -5,8 +5,8 @@ #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h" +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc b/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc index 7f801e1..cf35ca5 100644 --- a/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc +++ b/chrome/browser/ui/webui/settings/chromeos/os_settings_ui.cc
@@ -23,15 +23,12 @@ #include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h" #include "chrome/browser/ui/webui/settings/downloads_handler.h" #include "chrome/browser/ui/webui/settings/extension_control_handler.h" -#include "chrome/browser/ui/webui/settings/font_handler.h" #include "chrome/browser/ui/webui/settings/languages_handler.h" #include "chrome/browser/ui/webui/settings/people_handler.h" #include "chrome/browser/ui/webui/settings/profile_info_handler.h" #include "chrome/browser/ui/webui/settings/protocol_handlers_handler.h" #include "chrome/browser/ui/webui/settings/reset_settings_handler.h" -#include "chrome/browser/ui/webui/settings/search_engines_handler.h" #include "chrome/browser/ui/webui/settings/settings_cookies_view_handler.h" -#include "chrome/browser/ui/webui/settings/settings_import_data_handler.h" #include "chrome/browser/ui/webui/settings/settings_localized_strings_provider.h" #include "chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.h" #include "chrome/browser/ui/webui/settings/settings_ui.h" @@ -77,8 +74,6 @@ std::make_unique<::settings::DownloadsHandler>(profile)); AddSettingsPageUIHandler( std::make_unique<::settings::ExtensionControlHandler>()); - AddSettingsPageUIHandler(std::make_unique<::settings::FontHandler>(web_ui)); - AddSettingsPageUIHandler(std::make_unique<::settings::ImportDataHandler>()); AddSettingsPageUIHandler( std::make_unique<::settings::LanguagesHandler>(web_ui)); AddSettingsPageUIHandler( @@ -89,8 +84,6 @@ std::make_unique<::settings::ProfileInfoHandler>(profile)); AddSettingsPageUIHandler( std::make_unique<::settings::ProtocolHandlersHandler>()); - AddSettingsPageUIHandler( - std::make_unique<::settings::SearchEnginesHandler>(profile)); bool password_protection_available = false; #if defined(FULL_SAFE_BROWSING)
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 42650719..fc059a48 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -6265,6 +6265,25 @@ } } +if (is_mac || is_win) { + group("rendering_representative_perf_tests") { + testonly = true + deps = [ + "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", + ] + data = [ + "//build/android/pylib", + "//chrome/test/data/perf", + "//components/variations/service/generate_ui_string_overrider.py", + "//testing/scripts", + "//testing/test_env.py", + "//testing/xvfb.py", + "//third_party/catapult", + "//tools", + ] + } +} + if (is_win) { test("delayloads_unittests") { output_name = "delayloads_unittests"
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js index eb1b9d7..1b42d3e 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js
@@ -70,6 +70,29 @@ mocha.run(); }); +// Test fixture for the main settings page. +// eslint-disable-next-line no-var +var OSSettingsMainTest = class extends OSSettingsBrowserTest { + /** @override */ + get browsePreload() { + return super.browsePreload + + 'chromeos/os_settings_main/os_settings_main.html'; + } + + /** @override */ + get extraLibraries() { + return super.extraLibraries.concat([ + BROWSER_SETTINGS_PATH + 'test_util.js', + BROWSER_SETTINGS_PATH + '../test_browser_proxy.js', + 'os_settings_main_test.js', + ]); + } +}; + +TEST_F('OSSettingsMainTest', 'MAYBE_All', function() { + mocha.run(); +}); + // Tests for the side-nav menu. // eslint-disable-next-line no-var var OSSettingsMenuTest = class extends OSSettingsBrowserTest {
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_main_test.js b/chrome/test/data/webui/settings/chromeos/os_settings_main_test.js new file mode 100644 index 0000000..c0a35946 --- /dev/null +++ b/chrome/test/data/webui/settings/chromeos/os_settings_main_test.js
@@ -0,0 +1,348 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +cr.define('settings_main_page', function() { + /** + * Extending TestBrowserProxy even though SearchManager is not a browser proxy + * itself. Essentially TestBrowserProxy can act as a "proxy" for any external + * dependency, not just "browser proxies" (and maybe should be renamed to + * TestProxy). + * + * @implements {SearchManager} + */ + class TestSearchManager extends TestBrowserProxy { + constructor() { + super([ + 'search', + ]); + + /** @private {boolean} */ + this.matchesFound_ = true; + + /** @private {?settings.SearchRequest} */ + this.searchRequest_ = null; + } + + /** + * @param {boolean} matchesFound + */ + setMatchesFound(matchesFound) { + this.matchesFound_ = matchesFound; + } + + /** @override */ + search(text, page) { + this.methodCalled('search', text); + + if (this.searchRequest_ == null || !this.searchRequest_.isSame(text)) { + this.searchRequest_ = new settings.SearchRequest(text); + this.searchRequest_.finished = true; + this.searchRequest_.updateMatches(this.matchesFound_); + this.searchRequest_.resolver.resolve(this.searchRequest_); + } + return this.searchRequest_.resolver.promise; + } + } + + let settingsPrefs = null; + + suiteSetup(function() { + // Init CrOncStrings because os_settings_ui.js isn't loaded in this test. + CrOncStrings = {}; + + settingsPrefs = document.createElement('settings-prefs'); + return CrSettingsPrefs.initialized; + }); + + suite('MainPageTests', function() { + /** @type {?TestSearchManager} */ + let searchManager = null; + + /** @type {?SettingsMainElement} */ + let settingsMain = null; + + setup(function() { + settings.navigateTo(settings.routes.BASIC); + searchManager = new TestSearchManager(); + settings.setSearchManagerForTesting(searchManager); + PolymerTest.clearBody(); + settingsMain = document.createElement('os-settings-main'); + settingsMain.prefs = settingsPrefs.prefs; + settingsMain.toolbarSpinnerActive = false; + settingsMain.pageVisibility = settings.pageVisibility; + document.body.appendChild(settingsMain); + }); + + teardown(function() { + settingsMain.remove(); + }); + + test('searchContents() triggers SearchManager', function() { + Polymer.dom.flush(); + + const expectedQuery1 = 'foo'; + const expectedQuery2 = 'bar'; + const expectedQuery3 = ''; + + return settingsMain.searchContents(expectedQuery1) + .then(function() { + return searchManager.whenCalled('search'); + }) + .then(function(query) { + assertEquals(expectedQuery1, query); + + searchManager.resetResolver('search'); + return settingsMain.searchContents(expectedQuery2); + }) + .then(function() { + return searchManager.whenCalled('search'); + }) + .then(function(query) { + assertEquals(expectedQuery2, query); + + searchManager.resetResolver('search'); + return settingsMain.searchContents(expectedQuery3); + }) + .then(function() { + return searchManager.whenCalled('search'); + }) + .then(function(query) { + assertEquals(expectedQuery3, query); + }); + }); + + function showManagedHeader() { + return settingsMain.showManagedHeader_( + settingsMain.inSearchMode_, settingsMain.showingSubpage_, + settingsMain.showPages_.about); + } + + test('managed header hides when searching', function() { + Polymer.dom.flush(); + + assertTrue(showManagedHeader()); + + searchManager.setMatchesFound(false); + return settingsMain.searchContents('Query1') + .then(() => { + assertFalse(showManagedHeader()); + + searchManager.setMatchesFound(true); + return settingsMain.searchContents('Query2'); + }) + .then(() => { + assertFalse(showManagedHeader()); + }); + }); + + test('managed header hides when showing subpage', function() { + Polymer.dom.flush(); + + assertTrue(showManagedHeader()); + + const page = settingsMain.$$('os-settings-page'); + page.fire('subpage-expand', {}); + + assertFalse(showManagedHeader()); + }); + + test('managed header hides when showing about page', function() { + Polymer.dom.flush(); + + assertTrue(showManagedHeader()); + settings.navigateTo(settings.routes.ABOUT); + + assertFalse(showManagedHeader()); + }); + + /** @return {!HTMLElement} */ + function getToggleContainer() { + const page = settingsMain.$$('os-settings-page'); + assertTrue(!!page); + const toggleContainer = page.$$('#toggleContainer'); + assertTrue(!!toggleContainer); + return toggleContainer; + } + + /** + * Asserts that the Advanced toggle container exists in the combined + * settings page and asserts whether it should be visible. + * @param {boolean} expectedVisible + */ + function assertToggleContainerVisible(expectedVisible) { + const toggleContainer = getToggleContainer(); + if (expectedVisible) { + assertNotEquals('none', toggleContainer.style.display); + } else { + assertEquals('none', toggleContainer.style.display); + } + } + + test('no results page shows and hides', function() { + Polymer.dom.flush(); + const noSearchResults = settingsMain.$.noSearchResults; + assertTrue(!!noSearchResults); + assertTrue(noSearchResults.hidden); + + assertToggleContainerVisible(true); + + searchManager.setMatchesFound(false); + return settingsMain.searchContents('Query1') + .then(function() { + assertFalse(noSearchResults.hidden); + assertToggleContainerVisible(false); + + searchManager.setMatchesFound(true); + return settingsMain.searchContents('Query2'); + }) + .then(function() { + assertTrue(noSearchResults.hidden); + }); + }); + + // Ensure that when the user clears the search box, the "no results" page + // is hidden and the "advanced page toggle" is visible again. + test('no results page hides on clear', function() { + Polymer.dom.flush(); + const noSearchResults = settingsMain.$.noSearchResults; + assertTrue(!!noSearchResults); + assertTrue(noSearchResults.hidden); + + assertToggleContainerVisible(true); + + searchManager.setMatchesFound(false); + // Clearing the search box is effectively a search for the empty string. + return settingsMain.searchContents('').then(function() { + Polymer.dom.flush(); + assertTrue(noSearchResults.hidden); + assertToggleContainerVisible(true); + }); + }); + + /** + * Asserts the visibility of the basic and advanced pages. + * @param {string} Expected 'display' value for the basic page. + * @param {string} Expected 'display' value for the advanced page. + * @return {!Promise} + */ + function assertPageVisibility(expectedBasic, expectedAdvanced) { + Polymer.dom.flush(); + const page = settingsMain.$$('os-settings-page'); + assertEquals( + expectedBasic, getComputedStyle(page.$$('#basicPage')).display); + + return page.$$('#advancedPageTemplate') + .get() + .then(function(advancedPage) { + assertEquals( + expectedAdvanced, getComputedStyle(advancedPage).display); + }); + } + + /** + * Asserts the visibility of the basic and advanced pages after exiting + * search mode. + * @param {string} Expected 'display' value for the advanced page. + * @return {!Promise} + */ + function assertAdvancedVisibilityAfterSearch(expectedAdvanced) { + searchManager.setMatchesFound(true); + return settingsMain.searchContents('Query1') + .then(function() { + searchManager.setMatchesFound(false); + return settingsMain.searchContents(''); + }) + .then(function() { + // Imitate behavior of clearing search. + settings.navigateTo(settings.routes.BASIC); + Polymer.dom.flush(); + return assertPageVisibility('block', expectedAdvanced); + }); + } + + test('exiting search mode, advanced collapsed', function() { + // Simulating searching while the advanced page is collapsed. + settingsMain.currentRouteChanged(settings.routes.BASIC); + Polymer.dom.flush(); + return assertAdvancedVisibilityAfterSearch('none'); + }); + + // Ensure that clearing the search results restores both "basic" and + // "advanced" page, when the search has been initiated from a subpage + // whose parent is the "advanced" page. + test('exiting search mode, advanced expanded', function() { + // Trigger basic page to be rendered once. + settings.navigateTo(settings.routes.DEVICE); + Polymer.dom.flush(); + + // Navigate to an "advanced" subpage. + settings.navigateTo(settings.routes.DATETIME); + Polymer.dom.flush(); + return assertAdvancedVisibilityAfterSearch('block'); + }); + + // Ensure that searching, then entering a subpage, then going back + // lands the user in a page where both basic and advanced sections are + // visible, because the page is still in search mode. + test('returning from subpage to search results', function() { + settings.navigateTo(settings.routes.BASIC); + Polymer.dom.flush(); + + searchManager.setMatchesFound(true); + return settingsMain.searchContents('Query1').then(function() { + // Simulate navigating into a subpage. + settings.navigateTo(settings.routes.DISPLAY); + settingsMain.$$('os-settings-page').fire('subpage-expand'); + Polymer.dom.flush(); + + // Simulate clicking the left arrow to go back to the search results. + settings.navigateTo(settings.routes.BASIC); + return assertPageVisibility('block', 'block'); + }); + }); + + test('navigating to a basic page does not collapse advanced', function() { + settings.navigateTo(settings.routes.DATETIME); + Polymer.dom.flush(); + + assertToggleContainerVisible(true); + + settings.navigateTo(settings.routes.DEVICE); + Polymer.dom.flush(); + + return assertPageVisibility('block', 'block'); + }); + + test('verify showChangePassword value', function() { + settings.navigateTo(settings.routes.BASIC); + Polymer.dom.flush(); + const basicPage = settingsMain.$$('os-settings-page'); + assertTrue(!!basicPage); + assertFalse(basicPage.showChangePassword); + assertFalse(!!basicPage.$$('settings-change-password-page')); + + cr.webUIListenerCallback('change-password-visibility', true); + Polymer.dom.flush(); + assertTrue(basicPage.showChangePassword); + assertTrue(!!basicPage.$$('settings-change-password-page')); + + cr.webUIListenerCallback('change-password-visibility', false); + Polymer.dom.flush(); + assertFalse(basicPage.showChangePassword); + assertFalse(!!basicPage.$$('settings-change-password-page')); + }); + + test('updates the title based on current route', function() { + settings.navigateTo(settings.routes.BASIC); + assertEquals(document.title, loadTimeData.getString('settings')); + + settings.navigateTo(settings.routes.ABOUT); + assertEquals( + document.title, + loadTimeData.getStringF( + 'settingsAltPageTitle', + loadTimeData.getString('aboutPageTitle'))); + }); + }); +});
diff --git a/chromecast/browser/DEPS b/chromecast/browser/DEPS index 73d6d406..cd5ebfc 100644 --- a/chromecast/browser/DEPS +++ b/chromecast/browser/DEPS
@@ -54,6 +54,7 @@ "+services/service_manager/public", "+services/service_manager/embedder", "+third_party/blink/public/common", + "+third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h", "+ui/accessibility", "+ui/aura", "+ui/base",
diff --git a/chromecast/browser/cast_web_view_default.cc b/chromecast/browser/cast_web_view_default.cc index 2d45095..180b33d 100644 --- a/chromecast/browser/cast_web_view_default.cc +++ b/chromecast/browser/cast_web_view_default.cc
@@ -24,6 +24,7 @@ #include "content/public/browser/render_widget_host_view.h" #include "ipc/ipc_message.h" #include "net/base/net_errors.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "url/gurl.h" @@ -225,9 +226,10 @@ if (!chromecast::IsFeatureEnabled(kAllowUserMediaAccess) && !allow_media_access_) { LOG(WARNING) << __func__ << ": media access is disabled."; - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_NOT_SUPPORTED, - std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, + std::unique_ptr<content::MediaStreamUI>()); return; } @@ -259,7 +261,7 @@ } } - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, std::unique_ptr<content::MediaStreamUI>()); }
diff --git a/components/autofill/content/browser/key_press_handler_manager.cc b/components/autofill/content/browser/key_press_handler_manager.cc index 96b463bc..46beddf 100644 --- a/components/autofill/content/browser/key_press_handler_manager.cc +++ b/components/autofill/content/browser/key_press_handler_manager.cc
@@ -17,7 +17,7 @@ // same function with the same bound arguments. That's not what Equals() does // (they have to have the same BindState), but it's the closest approximation // available. - if (handler.is_null() || handler.Equals(handler_)) + if (handler.is_null() || (handler == handler_)) return; if (!handler_.is_null())
diff --git a/components/autofill_assistant/browser/web_controller_browsertest.cc b/components/autofill_assistant/browser/web_controller_browsertest.cc index 2fc512a..b5087f2 100644 --- a/components/autofill_assistant/browser/web_controller_browsertest.cc +++ b/components/autofill_assistant/browser/web_controller_browsertest.cc
@@ -861,14 +861,16 @@ EXPECT_EQ(true, content::EvalJs(shell(), checkVisibleScript)); } +// Disabled: https://crbug.com/970219 IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, - FocusElementWithScrollIntoViewNeeded) { + DISABLED_FocusElementWithScrollIntoViewNeeded) { TestScrollIntoView(/* initial_window_scroll_y= */ 0, /* initial_container_scroll_y=*/0); } +// Disabled: https://crbug.com/970219 IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, - FocusElementWithScrollIntoViewNotNeeded) { + DISABLED_FocusElementWithScrollIntoViewNotNeeded) { TestScrollIntoView(/* initial_window_scroll_y= */ 0, /* initial_container_scroll_y=*/200); }
diff --git a/components/browser_sync/profile_sync_components_factory_impl.cc b/components/browser_sync/profile_sync_components_factory_impl.cc index 2937ca96..dbc65d4 100644 --- a/components/browser_sync/profile_sync_components_factory_impl.cc +++ b/components/browser_sync/profile_sync_components_factory_impl.cc
@@ -166,23 +166,14 @@ // Autofill sync is enabled by default. Register unless explicitly // disabled. if (!disabled_types.Has(syncer::AUTOFILL_PROFILE)) { - if (FeatureList::IsEnabled(switches::kSyncUSSAutofillProfile)) { - controllers.push_back( - std::make_unique<AutofillProfileModelTypeController>( - std::make_unique<syncer::ProxyModelTypeControllerDelegate>( - db_thread_, - base::BindRepeating( - &AutofillProfileDelegateFromDataService, - base::RetainedRef(web_data_service_on_disk_))), - sync_client_->GetPrefService(), sync_service)); - } else { - controllers.push_back( - std::make_unique<AutofillProfileDataTypeController>( - db_thread_, dump_stack, sync_service, sync_client_, - base::BindRepeating(&BrowserSyncClient::GetPersonalDataManager, - base::Unretained(sync_client_)), - web_data_service_on_disk_)); - } + controllers.push_back( + std::make_unique<AutofillProfileModelTypeController>( + std::make_unique<syncer::ProxyModelTypeControllerDelegate>( + db_thread_, + base::BindRepeating( + &AutofillProfileDelegateFromDataService, + base::RetainedRef(web_data_service_on_disk_))), + sync_client_->GetPrefService(), sync_service)); } // Wallet data sync is enabled by default. Register unless explicitly
diff --git a/components/exo/client_controlled_shell_surface.cc b/components/exo/client_controlled_shell_surface.cc index a62e6af..28a338a 100644 --- a/components/exo/client_controlled_shell_surface.cc +++ b/components/exo/client_controlled_shell_surface.cc
@@ -16,9 +16,9 @@ #include "ash/public/cpp/immersive/immersive_fullscreen_controller.h" #include "ash/public/cpp/rounded_corner_decorator.h" #include "ash/public/cpp/shell_window_ids.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_pin_type.mojom.h" #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/wm/client_controlled_state.h" @@ -370,7 +370,7 @@ pending_window_state_ = ash::WindowStateType::kPip; } -void ClientControlledShellSurface::SetPinned(ash::mojom::WindowPinType type) { +void ClientControlledShellSurface::SetPinned(ash::WindowPinType type) { TRACE_EVENT1("exo", "ClientControlledShellSurface::SetPinned", "type", static_cast<int>(type));
diff --git a/components/exo/client_controlled_shell_surface.h b/components/exo/client_controlled_shell_surface.h index 9e12742d..e60ce6f 100644 --- a/components/exo/client_controlled_shell_surface.h +++ b/components/exo/client_controlled_shell_surface.h
@@ -125,7 +125,7 @@ // Pin/unpin the surface. Pinned surface cannot be switched to // other windows unless its explicitly unpinned. - void SetPinned(ash::mojom::WindowPinType type); + void SetPinned(ash::WindowPinType type); // Sets the surface to be on top of all other windows. void SetAlwaysOnTop(bool always_on_top);
diff --git a/components/exo/client_controlled_shell_surface_unittest.cc b/components/exo/client_controlled_shell_surface_unittest.cc index 09e6928a..5e58050a 100644 --- a/components/exo/client_controlled_shell_surface_unittest.cc +++ b/components/exo/client_controlled_shell_surface_unittest.cc
@@ -11,8 +11,8 @@ #include "ash/public/cpp/caption_buttons/caption_button_model.h" #include "ash/public/cpp/caption_buttons/frame_caption_button_container_view.h" #include "ash/public/cpp/test/shell_test_api.h" +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "ash/shell.h" #include "ash/system/unified/unified_system_tray.h" #include "ash/wm/drag_window_resizer.h" @@ -70,10 +70,10 @@ } bool IsWidgetPinned(views::Widget* widget) { - ash::mojom::WindowPinType type = + ash::WindowPinType type = widget->GetNativeWindow()->GetProperty(ash::kWindowPinTypeKey); - return type == ash::mojom::WindowPinType::PINNED || - type == ash::mojom::WindowPinType::TRUSTED_PINNED; + return type == ash::WindowPinType::kPinned || + type == ash::WindowPinType::kTrustedPinned; } int GetShadowElevation(aura::Window* window) { @@ -120,16 +120,16 @@ auto shell_surface( exo_test_helper()->CreateClientControlledShellSurface(surface.get())); - shell_surface->SetPinned(ash::mojom::WindowPinType::TRUSTED_PINNED); + shell_surface->SetPinned(ash::WindowPinType::kTrustedPinned); EXPECT_TRUE(IsWidgetPinned(shell_surface->GetWidget())); - shell_surface->SetPinned(ash::mojom::WindowPinType::NONE); + shell_surface->SetPinned(ash::WindowPinType::kNone); EXPECT_FALSE(IsWidgetPinned(shell_surface->GetWidget())); - shell_surface->SetPinned(ash::mojom::WindowPinType::PINNED); + shell_surface->SetPinned(ash::WindowPinType::kPinned); EXPECT_TRUE(IsWidgetPinned(shell_surface->GetWidget())); - shell_surface->SetPinned(ash::mojom::WindowPinType::NONE); + shell_surface->SetPinned(ash::WindowPinType::kNone); EXPECT_FALSE(IsWidgetPinned(shell_surface->GetWidget())); }
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index 36417e6..cffbe74f 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -9,9 +9,9 @@ #include "ash/frame/non_client_frame_view_ash.h" #include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/shell_window_ids.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_pin_type.mojom.h" #include "ash/shell.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/drag_window_resizer.h"
diff --git a/components/exo/wayland/zcr_remote_shell.cc b/components/exo/wayland/zcr_remote_shell.cc index aed57c0..b0ef96f 100644 --- a/components/exo/wayland/zcr_remote_shell.cc +++ b/components/exo/wayland/zcr_remote_shell.cc
@@ -9,8 +9,8 @@ #include <wayland-server-protocol-core.h> #include "ash/public/cpp/shell_window_ids.h" +#include "ash/public/cpp/window_pin_type.h" #include "ash/public/cpp/window_properties.h" -#include "ash/public/interfaces/window_pin_type.mojom.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" @@ -313,13 +313,13 @@ wl_resource* resource, int32_t trusted) { GetUserDataAs<ClientControlledShellSurface>(resource)->SetPinned( - trusted ? ash::mojom::WindowPinType::TRUSTED_PINNED - : ash::mojom::WindowPinType::PINNED); + trusted ? ash::WindowPinType::kTrustedPinned + : ash::WindowPinType::kPinned); } void remote_surface_unpin(wl_client* client, wl_resource* resource) { GetUserDataAs<ClientControlledShellSurface>(resource)->SetPinned( - ash::mojom::WindowPinType::NONE); + ash::WindowPinType::kNone); } void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) {
diff --git a/components/gcm_driver/crypto/BUILD.gn b/components/gcm_driver/crypto/BUILD.gn index 30cda55..8b5656e 100644 --- a/components/gcm_driver/crypto/BUILD.gn +++ b/components/gcm_driver/crypto/BUILD.gn
@@ -12,6 +12,7 @@ "gcm_decryption_result.h", "gcm_encryption_provider.cc", "gcm_encryption_provider.h", + "gcm_encryption_result.h", "gcm_key_store.cc", "gcm_key_store.h", "gcm_message_cryptographer.cc",
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.cc b/components/gcm_driver/crypto/gcm_encryption_provider.cc index ad562f8..5f9d8d4 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider.cc +++ b/components/gcm_driver/crypto/gcm_encryption_provider.cc
@@ -7,17 +7,20 @@ #include <vector> #include "base/base64.h" +#include "base/big_endian.h" #include "base/bind.h" #include "base/logging.h" #include "components/gcm_driver/common/gcm_message.h" #include "components/gcm_driver/crypto/encryption_header_parsers.h" #include "components/gcm_driver/crypto/gcm_decryption_result.h" +#include "components/gcm_driver/crypto/gcm_encryption_result.h" #include "components/gcm_driver/crypto/gcm_key_store.h" #include "components/gcm_driver/crypto/gcm_message_cryptographer.h" #include "components/gcm_driver/crypto/message_payload_parser.h" #include "components/gcm_driver/crypto/p256_key_util.h" #include "components/gcm_driver/crypto/proto/gcm_encryption_data.pb.h" #include "crypto/ec_private_key.h" +#include "crypto/random.h" namespace gcm { @@ -127,7 +130,7 @@ void GCMEncryptionProvider::DecryptMessage( const std::string& app_id, const IncomingMessage& message, - const MessageCallback& callback) { + const DecryptMessageCallback& callback) { DCHECK(key_store_); if (!IsEncryptedMessage(message)) { callback.Run(GCMDecryptionResult::UNENCRYPTED, message); @@ -242,6 +245,22 @@ version, callback)); } +void GCMEncryptionProvider::EncryptMessage( + const std::string& app_id, + const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& message, + const EncryptMessageCallback& callback) { + DCHECK(key_store_); + key_store_->GetKeys( + app_id, authorized_entity, + false /* fallback_to_empty_authorized_entity */, + base::BindOnce(&GCMEncryptionProvider::EncryptMessageWithKey, + weak_ptr_factory_.GetWeakPtr(), app_id, authorized_entity, + p256dh, auth_secret, message, std::move(callback))); +} + void GCMEncryptionProvider::DidCreateEncryptionInfo( EncryptionInfoCallback callback, std::unique_ptr<crypto::ECPrivateKey> key, @@ -267,7 +286,7 @@ uint32_t record_size, const std::string& ciphertext, GCMMessageCryptographer::Version version, - const MessageCallback& callback, + const DecryptMessageCallback& callback, std::unique_ptr<crypto::ECPrivateKey> key, const std::string& auth_secret) { if (!key) { @@ -318,4 +337,73 @@ decrypted_message); } +void GCMEncryptionProvider::EncryptMessageWithKey( + const std::string& app_id, + const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& message, + const EncryptMessageCallback& callback, + std::unique_ptr<crypto::ECPrivateKey> key, + const std::string& sender_auth_secret) { + if (!key) { + DLOG(ERROR) << "Unable to retrieve the keys for the outgoing message."; + callback.Run(GCMEncryptionResult::NO_KEYS, std::string()); + return; + } + + // Creates a cryptographically secure salt of |salt_size| octets in size, + // and calculate the shared secret for the message. + std::string salt; + crypto::RandBytes(base::WriteInto(&salt, 16 + 1), 16); + + std::string shared_secret; + if (!ComputeSharedP256Secret(*key, p256dh, &shared_secret)) { + DLOG(ERROR) << "Unable to calculate the shared secret."; + callback.Run(GCMEncryptionResult::INVALID_SHARED_SECRET, std::string()); + return; + } + + size_t record_size; + std::string ciphertext; + + GCMMessageCryptographer cryptographer( + GCMMessageCryptographer::Version::DRAFT_08); + + std::string sender_public_key; + bool success = GetRawPublicKey(*key, &sender_public_key); + DCHECK(success); + if (!cryptographer.Encrypt(p256dh, sender_public_key, shared_secret, + auth_secret, salt, message, &record_size, + &ciphertext)) { + DLOG(ERROR) << "Unable to encrypt the incoming data."; + callback.Run(GCMEncryptionResult::ENCRYPTION_FAILED, std::string()); + return; + } + + // Construct encryption header. + uint32_t rs = record_size; + std::vector<char> rs_buf(sizeof(rs)); + base::WriteBigEndian(rs_buf.data(), rs); + + uint8_t key_length = sender_public_key.size(); + std::vector<char> key_length_buf(sizeof(key_length)); + base::WriteBigEndian(key_length_buf.data(), key_length); + + std::vector<uint8_t> payload; + payload.reserve(salt.size() + rs_buf.size() + key_length_buf.size() + + sender_public_key.size() + ciphertext.size()); + std::move(salt.begin(), salt.end(), std::back_inserter(payload)); + std::move(rs_buf.begin(), rs_buf.end(), std::back_inserter(payload)); + std::move(key_length_buf.begin(), key_length_buf.end(), + std::back_inserter(payload)); + std::move(sender_public_key.begin(), sender_public_key.end(), + std::back_inserter(payload)); + std::move(ciphertext.begin(), ciphertext.end(), std::back_inserter(payload)); + + callback.Run(GCMEncryptionResult::ENCRYPTED_DRAFT_08, + std::string(std::make_move_iterator(payload.begin()), + std::make_move_iterator(payload.end()))); +} + } // namespace gcm
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.h b/components/gcm_driver/crypto/gcm_encryption_provider.h index d72ddcff..dbc4e47 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider.h +++ b/components/gcm_driver/crypto/gcm_encryption_provider.h
@@ -28,6 +28,7 @@ namespace gcm { enum class GCMDecryptionResult; +enum class GCMEncryptionResult; class GCMKeyStore; struct IncomingMessage; @@ -43,8 +44,16 @@ // Callback to be invoked when a message may have been decrypted, as indicated // by the |result|. The |message| contains the dispatchable message in success // cases, or will be initialized to an empty, default state for failure. - using MessageCallback = base::Callback<void(GCMDecryptionResult result, - const IncomingMessage& message)>; + using DecryptMessageCallback = + base::Callback<void(GCMDecryptionResult result, + const IncomingMessage& message)>; + + // Callback to be invoked when a message may have been encrypted, as indicated + // by the |result|. The |message| contains the dispatchable message in success + // cases, or will be initialized to an empty, default state for failure. + using EncryptMessageCallback = + base::Callback<void(GCMEncryptionResult result, + const std::string& message)>; GCMEncryptionProvider(); ~GCMEncryptionProvider(); @@ -81,7 +90,18 @@ // will be used in case of success, an empty message in case of failure. void DecryptMessage(const std::string& app_id, const IncomingMessage& message, - const MessageCallback& callback); + const DecryptMessageCallback& callback); + + // Attempts to encrypt the |message| using draft-ietf-webpush-encryption-08 + // scheme. |callback| will be called asynchronously when |message| has been + // encrypted. A dispatchable message will be used in case of success, an empty + // message in case of failure. + void EncryptMessage(const std::string& app_id, + const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& message, + const EncryptMessageCallback& callback); private: friend class GCMEncryptionProviderTest; @@ -108,10 +128,19 @@ uint32_t record_size, const std::string& ciphertext, GCMMessageCryptographer::Version version, - const MessageCallback& callback, + const DecryptMessageCallback& callback, std::unique_ptr<crypto::ECPrivateKey> key, const std::string& auth_secret); + void EncryptMessageWithKey(const std::string& app_id, + const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& message, + const EncryptMessageCallback& callback, + std::unique_ptr<crypto::ECPrivateKey> key, + const std::string& sender_auth_secret); + std::unique_ptr<GCMKeyStore> key_store_; base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_;
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc index e75ac7f..1a0f07d 100644 --- a/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc +++ b/components/gcm_driver/crypto/gcm_encryption_provider_unittest.cc
@@ -23,6 +23,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "components/gcm_driver/common/gcm_message.h" #include "components/gcm_driver/crypto/gcm_decryption_result.h" +#include "components/gcm_driver/crypto/gcm_encryption_result.h" #include "components/gcm_driver/crypto/gcm_key_store.h" #include "components/gcm_driver/crypto/gcm_message_cryptographer.h" #include "components/gcm_driver/crypto/p256_key_util.h" @@ -106,6 +107,21 @@ base::RunLoop().RunUntilIdle(); } + // Encrypts the |message| and then synchronously waits until either the + // success or failure callbacks has been invoked. + void Encrypt(const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& message) { + encryption_provider_->EncryptMessage( + kExampleAppId, authorized_entity, p256dh, auth_secret, message, + base::Bind(&GCMEncryptionProviderTest::DidEncryptMessage, + base::Unretained(this))); + + // The encryption keys will be read asynchronously. + base::RunLoop().RunUntilIdle(); + } + // Checks that the underlying key store has a key for the |kExampleAppId| + // authorized entity key if and only if |should_have_key| is true. Must wrap // with ASSERT/EXPECT_NO_FATAL_FAILURE. @@ -137,9 +153,15 @@ // Returns the result of the previous decryption operation. GCMDecryptionResult decryption_result() { return decryption_result_; } + // Returns the result of the previous encryption operation. + GCMEncryptionResult encryption_result() { return encryption_result_; } + // Returns the message resulting from the previous decryption operation. const IncomingMessage& decrypted_message() { return decrypted_message_; } + // Returns the message resulting from the previous encryption operation. + const std::string& encrypted_message() { return encrypted_message_; } + GCMEncryptionProvider* encryption_provider() { return encryption_provider_.get(); } @@ -150,6 +172,11 @@ const std::string& authorized_entity, GCMMessageCryptographer::Version version); + // Performs a test encryption feature without creating proper keys. Must wrap + // this in ASSERT_NO_FATAL_FAILURE. + void TestEncryptionNoKeys(const std::string& app_id, + const std::string& authorized_entity); + private: void DidDecryptMessage(GCMDecryptionResult result, const IncomingMessage& message) { @@ -157,6 +184,12 @@ decrypted_message_ = message; } + void DidEncryptMessage(GCMEncryptionResult result, + const std::string& message) { + encryption_result_ = result; + encrypted_message_ = message; + } + base::test::ScopedTaskEnvironment task_environment_; base::ScopedTempDir scoped_temp_dir_; base::HistogramTester histogram_tester_; @@ -164,8 +197,11 @@ std::unique_ptr<GCMEncryptionProvider> encryption_provider_; GCMDecryptionResult decryption_result_ = GCMDecryptionResult::UNENCRYPTED; + GCMEncryptionResult encryption_result_ = + GCMEncryptionResult::ENCRYPTION_FAILED; IncomingMessage decrypted_message_; + std::string encrypted_message_; }; TEST_F(GCMEncryptionProviderTest, IsEncryptedMessage) { @@ -495,31 +531,32 @@ ASSERT_GT(private_key.size(), 0u); ASSERT_GT(server_private_key.size(), 0u); - std::string salt; - - // Creates a cryptographically secure salt of |salt_size| octets in size, and - // calculate the shared secret for the message. - crypto::RandBytes(base::WriteInto(&salt, 16 + 1), 16); - - std::string shared_secret; - ASSERT_TRUE(ComputeSharedP256Secret(*key, server_public_key, &shared_secret)); - IncomingMessage message; - size_t record_size; - - message.sender_id = kExampleAuthorizedEntity; - - // Encrypts the |kExampleMessage| using the generated shared key and the - // random |salt|, storing the result in |record_size| and the message. - GCMMessageCryptographer cryptographer(version); - - std::string ciphertext; - ASSERT_TRUE(cryptographer.Encrypt( - public_key, server_public_key, shared_secret, auth_secret, salt, - kExampleMessage, &record_size, &ciphertext)); + message.sender_id = authorized_entity; switch (version) { case GCMMessageCryptographer::Version::DRAFT_03: { + std::string salt; + + // Creates a cryptographically secure salt of |salt_size| octets in size, + // and calculate the shared secret for the message. + crypto::RandBytes(base::WriteInto(&salt, 16 + 1), 16); + + std::string shared_secret; + ASSERT_TRUE( + ComputeSharedP256Secret(*key, server_public_key, &shared_secret)); + + size_t record_size; + + // Encrypts the |kExampleMessage| using the generated shared key and the + // random |salt|, storing the result in |record_size| and the message. + GCMMessageCryptographer cryptographer(version); + + std::string ciphertext; + ASSERT_TRUE(cryptographer.Encrypt( + public_key, server_public_key, shared_secret, auth_secret, salt, + kExampleMessage, &record_size, &ciphertext)); + std::string encoded_salt, encoded_key; // Compile the incoming GCM message, including the required headers. @@ -539,30 +576,12 @@ break; } case GCMMessageCryptographer::Version::DRAFT_08: { - uint32_t rs = record_size; - uint8_t key_length = server_public_key.size(); - - std::vector<char> payload(salt.size() + sizeof(rs) + sizeof(key_length) + - server_public_key.size() + ciphertext.size()); - - char* current = &payload.front(); - - memcpy(current, salt.data(), salt.size()); - current += salt.size(); - - base::WriteBigEndian(current, rs); - current += sizeof(rs); - - base::WriteBigEndian(current, key_length); - current += sizeof(key_length); - - memcpy(current, server_public_key.data(), server_public_key.size()); - current += server_public_key.size(); - - memcpy(current, ciphertext.data(), ciphertext.size()); + ASSERT_NO_FATAL_FAILURE( + Encrypt(authorized_entity, public_key, auth_secret, kExampleMessage)); + ASSERT_EQ(GCMEncryptionResult::ENCRYPTED_DRAFT_08, encryption_result()); message.data["content-encoding"] = "aes128gcm"; - message.raw_data.assign(payload.begin(), payload.end()); + message.raw_data = std::move(encrypted_message()); break; } } @@ -580,6 +599,29 @@ EXPECT_EQ(kExampleMessage, decrypted_message().raw_data); } +void GCMEncryptionProviderTest::TestEncryptionNoKeys( + const std::string& app_id, + const std::string& authorized_entity) { + // Only create proper keys for receipeint without creating keys for sender. + ECPrivateKeyUniquePtr key; + std::string auth_secret; + encryption_provider()->key_store_->CreateKeys( + "receiver" + app_id, authorized_entity, + base::BindOnce(&GCMEncryptionProviderTest::HandleKeysCallback, + base::Unretained(this), &key, &auth_secret)); + + // Creating the public keys will be done asynchronously. + base::RunLoop().RunUntilIdle(); + + std::string public_key; + ASSERT_TRUE(GetRawPublicKey(*key, &public_key)); + ASSERT_GT(public_key.size(), 0u); + + ASSERT_NO_FATAL_FAILURE( + Encrypt(authorized_entity, public_key, auth_secret, "foo")); + EXPECT_EQ(GCMEncryptionResult::NO_KEYS, encryption_result()); +} + TEST_F(GCMEncryptionProviderTest, EncryptionRoundTripGCMRegistration) { // GCMEncryptionProvider::DecryptMessage should succeed when the message was // sent to a non-InstanceID GCM registration (empty authorized_entity). @@ -604,4 +646,9 @@ GCMMessageCryptographer::Version::DRAFT_08)); } +TEST_F(GCMEncryptionProviderTest, EncryptionNoKeys) { + ASSERT_NO_FATAL_FAILURE( + TestEncryptionNoKeys(kExampleAppId, kExampleAuthorizedEntity)); +} + } // namespace gcm
diff --git a/components/gcm_driver/crypto/gcm_encryption_result.h b/components/gcm_driver/crypto/gcm_encryption_result.h new file mode 100644 index 0000000..b115bab --- /dev/null +++ b/components/gcm_driver/crypto/gcm_encryption_result.h
@@ -0,0 +1,35 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_RESULT_H_ +#define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_RESULT_H_ + +#include <string> + +namespace gcm { + +// Result of encrypting an outgoing message. The values of these reasons must +// not be changed as they are being recorded using UMA. When adding a value, +// please update GCMEncryptionResult in //tools/metrics/histograms/enums.xml. +enum class GCMEncryptionResult { + // The message had been successfully be encrypted. The encryption scheme used + // for the message was draft-ietf-webpush-encryption-08. + ENCRYPTED_DRAFT_08 = 0, + + // No public/private key-pair was associated with the app_id. + NO_KEYS = 1, + + // The shared secret cannot be derived from the keying material. + INVALID_SHARED_SECRET = 2, + + // The payload could not be encrypted as AES-128-GCM. + ENCRYPTION_FAILED = 3, + + // Should be one more than the otherwise highest value in this enumeration. + ENUM_SIZE = ENCRYPTION_FAILED + 1 +}; + +} // namespace gcm + +#endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_RESULT_H_
diff --git a/components/gcm_driver/gcm_driver.cc b/components/gcm_driver/gcm_driver.cc index f3cf956..d8ed9b0 100644 --- a/components/gcm_driver/gcm_driver.cc +++ b/components/gcm_driver/gcm_driver.cc
@@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "components/gcm_driver/crypto/gcm_decryption_result.h" +#include "components/gcm_driver/crypto/gcm_encryption_result.h" #include "components/gcm_driver/gcm_app_handler.h" namespace gcm { @@ -325,4 +326,43 @@ RegisterImpl(app_id, normalized_sender_ids); } +void GCMDriver::SendWebPushMessage(const std::string& app_id, + const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& fcm_token, + crypto::ECPrivateKey* vapid_key, + int time_to_live, + const std::string& message) { + encryption_provider_.EncryptMessage( + app_id, authorized_entity, p256dh, auth_secret, message, + base::Bind(&GCMDriver::OnMessageEncrypted, weak_ptr_factory_.GetWeakPtr(), + fcm_token, vapid_key, time_to_live)); +} + +void GCMDriver::OnMessageEncrypted(const std::string& fcm_token, + crypto::ECPrivateKey* vapid_key, + int time_to_live, + GCMEncryptionResult result, + const std::string& message) { + UMA_HISTOGRAM_ENUMERATION("GCM.Crypto.EncryptMessageResult", result, + GCMEncryptionResult::ENUM_SIZE); + + switch (result) { + case GCMEncryptionResult::ENCRYPTED_DRAFT_08: + // TODO: send the message. + return; + case GCMEncryptionResult::NO_KEYS: + case GCMEncryptionResult::INVALID_SHARED_SECRET: + case GCMEncryptionResult::ENCRYPTION_FAILED: { + LOG(ERROR) << "Webpush message encryption failed"; + return; + } + case GCMEncryptionResult::ENUM_SIZE: + break; // deliberate fall-through + } + + NOTREACHED(); +} + } // namespace gcm
diff --git a/components/gcm_driver/gcm_driver.h b/components/gcm_driver/gcm_driver.h index 365d1344..e728521 100644 --- a/components/gcm_driver/gcm_driver.h +++ b/components/gcm_driver/gcm_driver.h
@@ -23,6 +23,10 @@ class SequencedTaskRunner; } +namespace crypto { +class ECPrivateKey; +} + namespace gcm { class GCMAppHandler; @@ -153,6 +157,20 @@ const OutgoingMessage& message, const SendCallback& callback); + // Sends a message using FCM web-push with end-to-end encryption. + // The |message| is encrypted using private enryption key associated with + // |app_id| and |authorized_entity|, against public encryption key |p256dh| + // with authentcaition secret |auth_secret|. Encrypted message is sent to FCM + // with |fcm_token|, and and authenticate with VAPID using |vapid_key|. + void SendWebPushMessage(const std::string& app_id, + const std::string& authorized_entity, + const std::string& p256dh, + const std::string& auth_secret, + const std::string& fcm_token, + crypto::ECPrivateKey* vapid_key, + int time_to_live, + const std::string& message); + // Get the public encryption key and the authentication secret associated with // |app_id|. If none have been associated with |app_id| yet, they will be // created. The |callback| will be invoked when it is available. Only use with @@ -334,6 +352,13 @@ UnregisterCallback unregister_callback, GCMClient::Result result); + // Called after webpush message is encrypted. + void OnMessageEncrypted(const std::string& fcm_token, + crypto::ECPrivateKey* vapid_key, + int time_to_live, + GCMEncryptionResult result, + const std::string& payload); + // Callback map (from app_id to callback) for Register. std::map<std::string, RegisterCallback> register_callbacks_;
diff --git a/components/gwp_asan/crash_handler/crash_handler_unittest.cc b/components/gwp_asan/crash_handler/crash_handler_unittest.cc index 86eb5c23..9298a1e 100644 --- a/components/gwp_asan/crash_handler/crash_handler_unittest.cc +++ b/components/gwp_asan/crash_handler/crash_handler_unittest.cc
@@ -357,7 +357,12 @@ EXPECT_TRUE(proto_.has_region_size()); } -TEST_P(CrashHandlerTest, MAYBE_DISABLED(UnrelatedException)) { +#if defined(OS_MACOSX) +#define MAYBE_UnrelatedException DISABLED_UnrelatedException +#else +#define MAYBE_UnrelatedException UnrelatedException +#endif +TEST_P(CrashHandlerTest, MAYBE_DISABLED(MAYBE_UnrelatedException)) { ASSERT_FALSE(gwp_asan_found_); }
diff --git a/components/offline_pages/content/background_loader/DEPS b/components/offline_pages/content/background_loader/DEPS index b54fdf66..33226e6 100644 --- a/components/offline_pages/content/background_loader/DEPS +++ b/components/offline_pages/content/background_loader/DEPS
@@ -2,4 +2,5 @@ "+content/public/browser", "+content/public/test", "+content/public/common/window_container_type.mojom-shared.h", + "+third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h", ]
diff --git a/components/offline_pages/content/background_loader/background_loader_contents.cc b/components/offline_pages/content/background_loader/background_loader_contents.cc index fba1d59..eccb73f1c 100644 --- a/components/offline_pages/content/background_loader/background_loader_contents.cc +++ b/components/offline_pages/content/background_loader/background_loader_contents.cc
@@ -7,6 +7,7 @@ #include <utility> #include "content/public/browser/web_contents.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace background_loader { @@ -119,7 +120,7 @@ // No permissions granted, act as if dismissed. std::move(callback).Run( blink::MediaStreamDevices(), - blink::MediaStreamRequestResult::MEDIA_DEVICE_PERMISSION_DISMISSED, + blink::mojom::MediaStreamRequestResult::PERMISSION_DISMISSED, std::unique_ptr<content::MediaStreamUI>()); }
diff --git a/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc b/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc index d758e02..6b28793 100644 --- a/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc +++ b/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc
@@ -11,6 +11,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/window_container_type.mojom-shared.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "url/gurl.h" namespace background_loader { @@ -36,10 +37,12 @@ bool can_download_delegate_called() { return delegate_called_; } void MediaAccessCallback(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui); blink::MediaStreamDevices devices() { return devices_; } - blink::MediaStreamRequestResult request_result() { return request_result_; } + blink::mojom::MediaStreamRequestResult request_result() { + return request_result_; + } content::MediaStreamUI* media_stream_ui() { return media_stream_ui_.get(); } void WaitForSignal() { waiter_.Wait(); } @@ -49,7 +52,7 @@ bool download_; bool delegate_called_; blink::MediaStreamDevices devices_; - blink::MediaStreamRequestResult request_result_; + blink::mojom::MediaStreamRequestResult request_result_; std::unique_ptr<content::MediaStreamUI> media_stream_ui_; base::WaitableEvent waiter_; }; @@ -89,7 +92,7 @@ void BackgroundLoaderContentsTest::MediaAccessCallback( const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui) { devices_ = devices; request_result_ = result; @@ -171,7 +174,7 @@ // No devices allowed. ASSERT_TRUE(devices().empty()); // Permission has been dismissed rather than denied. - ASSERT_EQ(blink::MediaStreamRequestResult::MEDIA_DEVICE_PERMISSION_DISMISSED, + ASSERT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DISMISSED, request_result()); ASSERT_EQ(nullptr, media_stream_ui()); }
diff --git a/components/password_manager/core/browser/credential_manager_impl.cc b/components/password_manager/core/browser/credential_manager_impl.cc index fceebe1..6c91be7 100644 --- a/components/password_manager/core/browser/credential_manager_impl.cc +++ b/components/password_manager/core/browser/credential_manager_impl.cc
@@ -161,7 +161,7 @@ const SendCredentialCallback& send_callback, const CredentialInfo& info) { DCHECK(pending_request_); - DCHECK(send_callback.Equals(pending_request_->send_callback())); + DCHECK(send_callback == pending_request_->send_callback()); if (password_manager_util::IsLoggingActive(client_)) { CredentialManagerLogger(client_->GetLogManager())
diff --git a/components/password_manager/core/browser/new_password_form_manager.cc b/components/password_manager/core/browser/new_password_form_manager.cc index f715c65..be6aec8 100644 --- a/components/password_manager/core/browser/new_password_form_manager.cc +++ b/components/password_manager/core/browser/new_password_form_manager.cc
@@ -1064,12 +1064,8 @@ // generated password is saved. parsed_form->password_value = generated_password; - // Clear the username value if there are already saved credentials with - // the same username in order to prevent overwriting. - if (base::ContainsKey(best_matches_, parsed_form->username_value)) - parsed_form->username_value.clear(); - - generation_state_->PresaveGeneratedPassword(std::move(*parsed_form)); + generation_state_->PresaveGeneratedPassword(std::move(*parsed_form), + GetAllMatches()); } void NewPasswordFormManager::CalculateFillingAssistanceMetric(
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index 4643986..a8b6a17e 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -437,12 +437,12 @@ } if (!base::ContainsKey(best_matches_, form.username_value) || form.username_value.empty()) { - generation_state_->PresaveGeneratedPassword(form); + generation_state_->PresaveGeneratedPassword(form, {}); } else { autofill::PasswordForm form_without_username(form); form_without_username.username_value.clear(); generation_state_->PresaveGeneratedPassword( - std::move(form_without_username)); + std::move(form_without_username), {}); } votes_uploader_.set_has_generated_password(true);
diff --git a/components/password_manager/core/browser/password_generation_state.cc b/components/password_manager/core/browser/password_generation_state.cc index d11af43..aaba322 100644 --- a/components/password_manager/core/browser/password_generation_state.cc +++ b/components/password_manager/core/browser/password_generation_state.cc
@@ -37,8 +37,17 @@ driver->GeneratedPasswordAccepted(generated.password_value); } -void PasswordGenerationState::PresaveGeneratedPassword(PasswordForm generated) { +void PasswordGenerationState::PresaveGeneratedPassword( + PasswordForm generated, + const std::vector<const autofill::PasswordForm*>& matches) { DCHECK(!generated.password_value.empty()); + // Clear the username value if there are already saved credentials with + // the same username in order to prevent overwriting. + if (std::any_of(matches.begin(), matches.end(), + [&generated](const autofill::PasswordForm* form) { + return form->username_value == generated.username_value; + })) + generated.username_value.clear(); generated.date_created = clock_->Now(); if (presaved_) { form_saver_->UpdateReplace(generated, {} /* matches */,
diff --git a/components/password_manager/core/browser/password_generation_state.h b/components/password_manager/core/browser/password_generation_state.h index 4b2c32d..0c1a27c0 100644 --- a/components/password_manager/core/browser/password_generation_state.h +++ b/components/password_manager/core/browser/password_generation_state.h
@@ -44,7 +44,9 @@ base::WeakPtr<PasswordManagerDriver> driver); // Called when generated password is accepted or changed by user. - void PresaveGeneratedPassword(autofill::PasswordForm generated); + void PresaveGeneratedPassword( + autofill::PasswordForm generated, + const std::vector<const autofill::PasswordForm*>& matches); // Signals that the user cancels password generation. void PasswordNoLongerGenerated();
diff --git a/components/password_manager/core/browser/password_generation_state_unittest.cc b/components/password_manager/core/browser/password_generation_state_unittest.cc index faa54416..1e4a5ac 100644 --- a/components/password_manager/core/browser/password_generation_state_unittest.cc +++ b/components/password_manager/core/browser/password_generation_state_unittest.cc
@@ -106,7 +106,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), AddLogin(generated_with_date)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); EXPECT_TRUE(state().HasGeneratedPassword()); } @@ -117,7 +117,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), AddLogin(generated_with_date)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); PasswordForm generated_updated = generated; generated_updated.password_value = ASCIIToUTF16("newgenpwd"); @@ -125,7 +125,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), UpdateLoginWithPrimaryKey(generated_with_date, FormHasUniqueKey(generated))); - state().PresaveGeneratedPassword(generated_updated); + state().PresaveGeneratedPassword(generated_updated, {}); EXPECT_TRUE(state().HasGeneratedPassword()); } @@ -136,7 +136,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), AddLogin(generated_with_date)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); PasswordForm generated_updated = generated; generated_updated.password_value = ASCIIToUTF16("newgenpwd"); @@ -144,7 +144,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), UpdateLoginWithPrimaryKey(generated_with_date, FormHasUniqueKey(generated))); - state().PresaveGeneratedPassword(generated_updated); + state().PresaveGeneratedPassword(generated_updated, {}); generated = generated_updated; generated_updated.password_value = ASCIIToUTF16("newgenpwd2"); @@ -153,7 +153,36 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), UpdateLoginWithPrimaryKey(generated_with_date, FormHasUniqueKey(generated))); - state().PresaveGeneratedPassword(generated_updated); + state().PresaveGeneratedPassword(generated_updated, {}); + EXPECT_TRUE(state().HasGeneratedPassword()); +} + +// Check that presaving a password with a known username results in clearing the +// username. +TEST_F(PasswordGenerationStateTest, PresaveGeneratedPassword_WithConflict) { + const PasswordForm generated = CreateGenerated(); + + PasswordForm saved = CreateSaved(); + saved.username_value = generated.username_value; + + PasswordForm generated_with_date = generated; + generated_with_date.date_created = base::Time::FromTimeT(kTime); + generated_with_date.username_value.clear(); + + EXPECT_CALL(store(), AddLogin(generated_with_date)); + state().PresaveGeneratedPassword(generated, {&saved}); + EXPECT_TRUE(state().HasGeneratedPassword()); +} + +// Check that presaving a password with an unknown username saves it as is. +TEST_F(PasswordGenerationStateTest, PresaveGeneratedPassword_WithoutConflict) { + const PasswordForm generated = CreateGenerated(); + PasswordForm generated_with_date = generated; + generated_with_date.date_created = base::Time::FromTimeT(kTime); + + const PasswordForm saved = CreateSaved(); + EXPECT_CALL(store(), AddLogin(generated_with_date)); + state().PresaveGeneratedPassword(generated, {&saved}); EXPECT_TRUE(state().HasGeneratedPassword()); } @@ -164,7 +193,7 @@ const PasswordForm generated = CreateGenerated(); EXPECT_CALL(store(), AddLogin(_)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); // User edits after submission. PasswordForm pending = generated; @@ -185,9 +214,6 @@ TEST_F(PasswordGenerationStateTest, PresaveGeneratedPassword_ThenUpdate) { PasswordForm generated = CreateGenerated(); - EXPECT_CALL(store(), AddLogin(_)); - state().PresaveGeneratedPassword(generated); - PasswordForm related_password = CreateSaved(); related_password.username_value = ASCIIToUTF16("username"); related_password.username_element = ASCIIToUTF16("username_field"); @@ -207,6 +233,12 @@ unrelated_psl_password.username_value = ASCIIToUTF16("another username"); unrelated_psl_password.password_value = ASCIIToUTF16("some password"); + EXPECT_CALL(store(), AddLogin(_)); + const std::vector<const autofill::PasswordForm*> matches = { + &related_password, &related_psl_password, &unrelated_password, + &unrelated_psl_password}; + state().PresaveGeneratedPassword(generated, matches); + generated.username_value = ASCIIToUTF16("username"); PasswordForm generated_with_date = generated; generated_with_date.date_created = base::Time::FromTimeT(kTime); @@ -227,11 +259,8 @@ unrelated_password_expected.preferred = false; EXPECT_CALL(store(), UpdateLogin(unrelated_password_expected)); - state().CommitGeneratedPassword( - generated, - {&related_password, &related_psl_password, &unrelated_password, - &unrelated_psl_password} /* matches */, - ASCIIToUTF16("old password")); + state().CommitGeneratedPassword(generated, matches, + ASCIIToUTF16("old password")); EXPECT_TRUE(state().HasGeneratedPassword()); } @@ -240,7 +269,7 @@ PasswordForm generated = CreateGenerated(); EXPECT_CALL(store(), AddLogin(_)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); generated.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), RemoveLogin(generated)); @@ -256,7 +285,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), AddLogin(generated_with_date)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); EXPECT_CALL(store(), RemoveLogin(generated_with_date)); state().PasswordNoLongerGenerated(); @@ -266,7 +295,7 @@ generated_with_date = generated; generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), AddLogin(generated_with_date)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); EXPECT_TRUE(state().HasGeneratedPassword()); } @@ -278,7 +307,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kTime); EXPECT_CALL(store(), AddLogin(generated_with_date)); - state().PresaveGeneratedPassword(generated); + state().PresaveGeneratedPassword(generated, {}); std::unique_ptr<FormSaver> cloned_saver = form_saver().Clone(); std::unique_ptr<PasswordGenerationState> cloned_state = @@ -294,7 +323,7 @@ generated_with_date.date_created = base::Time::FromTimeT(kAnotherTime); EXPECT_CALL(store(), UpdateLoginWithPrimaryKey(generated_with_date, FormHasUniqueKey(generated))); - cloned_state->PresaveGeneratedPassword(generated_updated); + cloned_state->PresaveGeneratedPassword(generated_updated, {}); EXPECT_TRUE(cloned_state->HasGeneratedPassword()); } @@ -305,14 +334,14 @@ const PasswordForm generated = CreateGenerated(); EXPECT_CALL(store(), AddLogin(_)); - original->PresaveGeneratedPassword(generated); + original->PresaveGeneratedPassword(generated, {}); std::unique_ptr<FormSaver> cloned_saver = form_saver().Clone(); std::unique_ptr<PasswordGenerationState> cloned_state = original->Clone(cloned_saver.get()); original.reset(); EXPECT_CALL(store(), UpdateLoginWithPrimaryKey(_, _)); - cloned_state->PresaveGeneratedPassword(generated); + cloned_state->PresaveGeneratedPassword(generated, {}); } } // namespace
diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index 5e36772..aea6b04 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc
@@ -151,6 +151,13 @@ } // namespace +CloudPolicyClient::RegistrationParameters::RegistrationParameters( + em::DeviceRegisterRequest::Type registration_type, + em::DeviceRegisterRequest::Flavor flavor) + : registration_type(registration_type), flavor(flavor) {} + +CloudPolicyClient::RegistrationParameters::~RegistrationParameters() = default; + CloudPolicyClient::Observer::~Observer() {} CloudPolicyClient::CloudPolicyClient( @@ -208,14 +215,9 @@ client_id_ = client_id.empty() ? base::GenerateGUID() : client_id; } -void CloudPolicyClient::Register(em::DeviceRegisterRequest::Type type, - em::DeviceRegisterRequest::Flavor flavor, - em::DeviceRegisterRequest::Lifetime lifetime, - em::LicenseType::LicenseTypeEnum license_type, - const std::string& oauth_token, +void CloudPolicyClient::Register(const RegistrationParameters& parameters, const std::string& client_id, - const std::string& requisition, - const std::string& current_state_key) { + const std::string& oauth_token) { DCHECK(service_); DCHECK(!oauth_token.empty()); DCHECK(!is_registered()); @@ -231,8 +233,8 @@ em::DeviceRegisterRequest* request = config->request()->mutable_register_request(); - CreateDeviceRegisterRequest(type, flavor, lifetime, license_type, client_id, - requisition, current_state_key, request); + CreateDeviceRegisterRequest(parameters, client_id, request); + if (requires_reregistration()) request->set_reregistration_dm_token(reregistration_dm_token_); @@ -240,15 +242,10 @@ } void CloudPolicyClient::RegisterWithCertificate( - em::DeviceRegisterRequest::Type type, - em::DeviceRegisterRequest::Flavor flavor, - em::DeviceRegisterRequest::Lifetime lifetime, - em::LicenseType::LicenseTypeEnum license_type, + const RegistrationParameters& parameters, + const std::string& client_id, std::unique_ptr<DMAuth> auth, const std::string& pem_certificate_chain, - const std::string& client_id, - const std::string& requisition, - const std::string& current_state_key, const std::string& sub_organization) { DCHECK(signing_service_); DCHECK(service_); @@ -262,8 +259,7 @@ data.set_device_certificate(pem_certificate_chain); em::DeviceRegisterRequest* request = data.mutable_device_register_request(); - CreateDeviceRegisterRequest(type, flavor, lifetime, license_type, client_id, - requisition, current_state_key, request); + CreateDeviceRegisterRequest(parameters, client_id, request); if (!sub_organization.empty()) { em::DeviceRegisterConfiguration* configuration = data.mutable_device_register_configuration(); @@ -1166,17 +1162,14 @@ } void CloudPolicyClient::CreateDeviceRegisterRequest( - em::DeviceRegisterRequest::Type type, - em::DeviceRegisterRequest::Flavor flavor, - em::DeviceRegisterRequest::Lifetime lifetime, - em::LicenseType::LicenseTypeEnum license_type, + const RegistrationParameters& params, const std::string& client_id, - const std::string& requisition, - const std::string& current_state_key, em::DeviceRegisterRequest* request) { if (!client_id.empty()) request->set_reregister(true); - request->set_type(type); + request->set_type(params.registration_type); + request->set_flavor(params.flavor); + request->set_lifetime(params.lifetime); if (!machine_id_.empty()) request->set_machine_id(machine_id_); if (!machine_model_.empty()) @@ -1189,14 +1182,12 @@ request->set_dock_mac_address(dock_mac_address_); if (!manufacture_date_.empty()) request->set_manufacture_date(manufacture_date_); - if (!requisition.empty()) - request->set_requisition(requisition); - if (!current_state_key.empty()) - request->set_server_backed_state_key(current_state_key); - request->set_flavor(flavor); - if (license_type != em::LicenseType::UNDEFINED) - request->mutable_license_type()->set_license_type(license_type); - request->set_lifetime(lifetime); + if (!params.requisition.empty()) + request->set_requisition(params.requisition); + if (!params.current_state_key.empty()) + request->set_server_backed_state_key(params.current_state_key); + if (params.license_type != em::LicenseType::UNDEFINED) + request->mutable_license_type()->set_license_type(params.license_type); } } // namespace policy
diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h index ba07366b..d63a4d1 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.h +++ b/components/policy/core/common/cloud/cloud_policy_client.h
@@ -98,6 +98,32 @@ virtual void OnClientError(CloudPolicyClient* client) = 0; }; + struct POLICY_EXPORT RegistrationParameters { + public: + RegistrationParameters( + enterprise_management::DeviceRegisterRequest::Type registration_type, + enterprise_management::DeviceRegisterRequest::Flavor flavor); + ~RegistrationParameters(); + + enterprise_management::DeviceRegisterRequest::Type registration_type; + enterprise_management::DeviceRegisterRequest::Flavor flavor; + + // Lifetime of registration. Used for easier clean up of ephemeral session + // registrations. + enterprise_management::DeviceRegisterRequest::Lifetime lifetime = + enterprise_management::DeviceRegisterRequest::LIFETIME_INDEFINITE; + + // Selected license type if user is allowed to select it. + enterprise_management::LicenseType::LicenseTypeEnum license_type = + enterprise_management::LicenseType::UNDEFINED; + + // Device requisition. + std::string requisition; + + // Server-backed state keys (used for forced enrollment check). + std::string current_state_key; + }; + // If non-empty, |machine_id|, |machine_model|, |brand_code|, // |ethernet_mac_address|, |dock_mac_address| and |manufacture_date| are // passed to the server verbatim. As these reveal machine identity, they must @@ -132,33 +158,24 @@ // Attempts to register with the device management service. Results in a // registration change or error notification. - virtual void Register( - enterprise_management::DeviceRegisterRequest::Type registration_type, - enterprise_management::DeviceRegisterRequest::Flavor flavor, - enterprise_management::DeviceRegisterRequest::Lifetime lifetime, - enterprise_management::LicenseType::LicenseTypeEnum license_type, - const std::string& oauth_token, - const std::string& client_id, - const std::string& requisition, - const std::string& current_state_key); + virtual void Register(const RegistrationParameters& parameters, + const std::string& client_id, + const std::string& oauth_token); // Attempts to register with the device management service using a // registration certificate. Results in a registration change or // error notification. - virtual void RegisterWithCertificate( - enterprise_management::DeviceRegisterRequest::Type registration_type, - enterprise_management::DeviceRegisterRequest::Flavor flavor, - enterprise_management::DeviceRegisterRequest::Lifetime lifetime, - enterprise_management::LicenseType::LicenseTypeEnum license_type, - std::unique_ptr<DMAuth> auth, - const std::string& pem_certificate_chain, - const std::string& client_id, - const std::string& requisition, - const std::string& current_state_key, - const std::string& sub_organization); + virtual void RegisterWithCertificate(const RegistrationParameters& parameters, + const std::string& client_id, + std::unique_ptr<DMAuth> auth, + const std::string& pem_certificate_chain, + const std::string& sub_organization); // Attempts to enroll with the device management service using an enrollment // token. Results in a registration change or error notification. + // This method is used to register browser (e.g. for machine-level policies). + // Device registration with enrollment token should be performed using + // RegisterWithCertificate method. virtual void RegisterWithToken(const std::string& token, const std::string& client_id); @@ -584,13 +601,8 @@ // Fills in the common fields of a DeviceRegisterRequest for |Register| and // |RegisterWithCertificate|. void CreateDeviceRegisterRequest( - enterprise_management::DeviceRegisterRequest::Type registration_type, - enterprise_management::DeviceRegisterRequest::Flavor flavor, - enterprise_management::DeviceRegisterRequest::Lifetime lifetime, - enterprise_management::LicenseType::LicenseTypeEnum license_type, + const RegistrationParameters& params, const std::string& client_id, - const std::string& requisition, - const std::string& current_state_key, enterprise_management::DeviceRegisterRequest* request); // Prepare the certificate upload request field for uploading a certificate.
diff --git a/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc b/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc index 94ba57d..fc80557 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_registration_helper.cc
@@ -266,12 +266,10 @@ // Kick off registration of the CloudPolicyClient with our newly minted // oauth_access_token_. client_->Register( - registration_type_, - enterprise_management::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - enterprise_management::DeviceRegisterRequest::LIFETIME_INDEFINITE, - enterprise_management::LicenseType::UNDEFINED, oauth_access_token_, - std::string() /* client_id */, std::string() /* requisition */, - std::string() /* current_state_key */); + CloudPolicyClient::RegistrationParameters( + registration_type_, enterprise_management::DeviceRegisterRequest:: + FLAVOR_USER_REGISTRATION), + std::string() /* client_id */, oauth_access_token_); } void CloudPolicyClientRegistrationHelper::OnPolicyFetched(
diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc index d1859350..3b7fa0b7 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -681,11 +681,11 @@ EXPECT_CALL(observer_, OnRegistrationStateChanged(_)); EXPECT_CALL(device_dmtoken_callback_observer_, OnDeviceDMTokenRequested(_)) .WillOnce(Return(kDeviceDMToken)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, std::string(), - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters register_user( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); + client_->Register(register_user, std::string() /* no client_id*/, + kOAuthToken); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, job_type_); EXPECT_EQ(job_request_.SerializePartialAsString(), @@ -710,11 +710,11 @@ EXPECT_CALL(observer_, OnRegistrationStateChanged(_)); EXPECT_CALL(device_dmtoken_callback_observer_, OnDeviceDMTokenRequested(_)) .WillOnce(Return(kDeviceDMToken)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, std::string(), - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters register_user( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); + client_->Register(register_user, std::string() /* no client_id*/, + kOAuthToken); client_->SetOAuthTokenAsAdditionalAuth(kOAuthToken); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, job_type_); @@ -739,12 +739,12 @@ ExpectCertBasedRegistration(); fake_signing_service_.set_success(true); EXPECT_CALL(observer_, OnRegistrationStateChanged(_)); - client_->RegisterWithCertificate( + CloudPolicyClient::RegistrationParameters device_attestation( em::DeviceRegisterRequest::DEVICE, - em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_ATTESTATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, DMAuth::NoAuth(), kEnrollmentCertificate, - std::string(), std::string(), std::string(), std::string()); + em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_ATTESTATION); + client_->RegisterWithCertificate( + device_attestation, std::string() /* client_id */, DMAuth::NoAuth(), + kEnrollmentCertificate, std::string() /* sub_organization */); EXPECT_EQ( DeviceManagementService::JobConfiguration::TYPE_CERT_BASED_REGISTRATION, job_type_); @@ -768,12 +768,12 @@ TEST_F(CloudPolicyClientTest, RegistrationWithCertificateFailToSignRequest) { fake_signing_service_.set_success(false); EXPECT_CALL(observer_, OnClientError(_)); - client_->RegisterWithCertificate( + CloudPolicyClient::RegistrationParameters device_attestation( em::DeviceRegisterRequest::DEVICE, - em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_ATTESTATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, DMAuth::NoAuth(), kEnrollmentCertificate, - std::string(), std::string(), std::string(), std::string()); + em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_ATTESTATION); + client_->RegisterWithCertificate( + device_attestation, std::string() /* client_id */, DMAuth::NoAuth(), + kEnrollmentCertificate, std::string() /* sub_organization */); EXPECT_FALSE(client_->is_registered()); EXPECT_EQ(DM_STATUS_CANNOT_SIGN_REQUEST, client_->status()); } @@ -790,11 +790,15 @@ EXPECT_CALL(observer_, OnRegistrationStateChanged(_)); EXPECT_CALL(device_dmtoken_callback_observer_, OnDeviceDMTokenRequested(_)) .WillOnce(Return(kDeviceDMToken)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_MANUAL, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, kClientID, - kRequisition, kStateKey); + + CloudPolicyClient::RegistrationParameters register_parameters( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_MANUAL); + register_parameters.requisition = kRequisition; + register_parameters.current_state_key = kStateKey; + + client_->Register(register_parameters, kClientID, kOAuthToken); + EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, job_type_); EXPECT_EQ(job_request_.SerializePartialAsString(), @@ -807,11 +811,11 @@ clear_device_management_token(); ExpectRegistration(kOAuthToken); EXPECT_CALL(observer_, OnClientError(_)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, std::string(), - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters register_user( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); + client_->Register(register_user, std::string() /* no client_id*/, + kOAuthToken); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, job_type_); EXPECT_EQ(job_request_.SerializePartialAsString(), @@ -829,11 +833,11 @@ service_.StartJobSync(net::ERR_FAILED, DeviceManagementService::kInvalidArgument))); EXPECT_CALL(observer_, OnClientError(_)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, std::string(), - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters register_user( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); + client_->Register(register_user, std::string() /* no client_id*/, + kOAuthToken); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, job_type); EXPECT_FALSE(client_->is_registered()); @@ -852,11 +856,11 @@ service_.StartJobAsync(net::ERR_NETWORK_CHANGED, DeviceManagementService::kSuccess, dummy_response))); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, std::string(), - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters register_user( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION); + client_->Register(register_user, std::string() /* no client_id*/, + kOAuthToken); base::RunLoop().RunUntilIdle(); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, job_type); @@ -1774,11 +1778,10 @@ EXPECT_CALL(observer_, OnRegistrationStateChanged(_)); EXPECT_CALL(device_dmtoken_callback_observer_, OnDeviceDMTokenRequested(_)) .WillOnce(Return(kDeviceDMToken)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_RECOVERY, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, client_id_, - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters user_recovery( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_RECOVERY); + client_->Register(user_recovery, client_id_, kOAuthToken); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_POLICY_FETCH, upload_type); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION, @@ -1813,11 +1816,10 @@ // Re-register (server sends wrong DMToken). ExpectFailedReregistration(kOAuthToken); EXPECT_CALL(observer_, OnClientError(_)); - client_->Register(em::DeviceRegisterRequest::USER, - em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_RECOVERY, - em::DeviceRegisterRequest::LIFETIME_INDEFINITE, - em::LicenseType::UNDEFINED, kOAuthToken, client_id_, - std::string(), std::string()); + CloudPolicyClient::RegistrationParameters user_recovery( + em::DeviceRegisterRequest::USER, + em::DeviceRegisterRequest::FLAVOR_ENROLLMENT_RECOVERY); + client_->Register(user_recovery, client_id_, kOAuthToken); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_POLICY_FETCH, upload_type); EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_REGISTRATION,
diff --git a/components/policy/core/common/cloud/mock_cloud_policy_client.h b/components/policy/core/common/cloud/mock_cloud_policy_client.h index fb7e18257..a17a519 100644 --- a/components/policy/core/common/cloud/mock_cloud_policy_client.h +++ b/components/policy/core/common/cloud/mock_cloud_policy_client.h
@@ -36,16 +36,10 @@ void(const std::string&, const std::string&, const std::vector<std::string>&)); - MOCK_METHOD8( - Register, - void(enterprise_management::DeviceRegisterRequest::Type type, - enterprise_management::DeviceRegisterRequest::Flavor flavor, - enterprise_management::DeviceRegisterRequest::Lifetime lifetime, - enterprise_management::LicenseType::LicenseTypeEnum license_type, - const std::string&, - const std::string&, - const std::string&, - const std::string&)); + MOCK_METHOD3(Register, + void(const RegistrationParameters&, + const std::string&, + const std::string&)); MOCK_METHOD0(FetchPolicy, void(void)); MOCK_METHOD0(Unregister, void(void)); MOCK_METHOD2(UploadEnterpriseMachineCertificate,
diff --git a/components/policy/proto/device_management_backend.proto b/components/policy/proto/device_management_backend.proto index d2e2633..ba9176e 100644 --- a/components/policy/proto/device_management_backend.proto +++ b/components/policy/proto/device_management_backend.proto
@@ -1930,7 +1930,7 @@ // (and vice versa). // // The secure_commands.data field contains a serialized - // RemoteCommand. The ecure_commands.signature field is a + // RemoteCommand. The secure_commands.signature field is a // signature of the data field with the policy key for the // domain the device belongs to. repeated SignedData secure_commands = 2;
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index f96fceb..b1581fbe 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -9234,7 +9234,9 @@ If you set this policy, users cannot change or override it. - If this policy is left unset, Accessibility options will not appear in the system tray menu, but the user can cause the Accessibility options to appear via the Settings page.''' + If this policy is left unset, Accessibility options will not appear in the system tray menu, but the user can cause the Accessibility options to appear via the Settings page. + + When accessiblity features are enabled (by other means, e.g by a key combination), Accessibility options will always appear in system tray menu.''' }, { 'name': 'LargeCursorEnabled',
diff --git a/components/signin/core/browser/account_fetcher_service.cc b/components/signin/core/browser/account_fetcher_service.cc index 6ff6a04..5158a250 100644 --- a/components/signin/core/browser/account_fetcher_service.cc +++ b/components/signin/core/browser/account_fetcher_service.cc
@@ -335,10 +335,10 @@ } void AccountFetcherService::OnRefreshTokenAvailable( - const std::string& account_id) { + const CoreAccountId& account_id) { TRACE_EVENT1("AccountFetcherService", "AccountFetcherService::OnRefreshTokenAvailable", "account_id", - account_id); + account_id.id); DVLOG(1) << "AVAILABLE " << account_id; // The SigninClient needs a "final init" in order to perform some actions @@ -355,10 +355,10 @@ } void AccountFetcherService::OnRefreshTokenRevoked( - const std::string& account_id) { + const CoreAccountId& account_id) { TRACE_EVENT1("AccountFetcherService", "AccountFetcherService::OnRefreshTokenRevoked", "account_id", - account_id); + account_id.id); DVLOG(1) << "REVOKED " << account_id; // Short-circuit out if network fetches are not enabled.
diff --git a/components/signin/core/browser/account_fetcher_service.h b/components/signin/core/browser/account_fetcher_service.h index 0d94fba7..82b8cd4 100644 --- a/components/signin/core/browser/account_fetcher_service.h +++ b/components/signin/core/browser/account_fetcher_service.h
@@ -92,8 +92,8 @@ #endif // OAuth2TokenService::Observer implementation. - void OnRefreshTokenAvailable(const std::string& account_id) override; - void OnRefreshTokenRevoked(const std::string& account_id) override; + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override; + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override; void OnRefreshTokensLoaded() override; private:
diff --git a/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc b/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc index 7a42f2e..265b8572 100644 --- a/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc +++ b/components/signin/core/browser/mutable_profile_oauth2_token_service_delegate_unittest.cc
@@ -188,17 +188,17 @@ } // OAuth2TokenService::Observer implementation. - void OnRefreshTokenAvailable(const std::string& account_id) override { + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override { ++token_available_count_; } - void OnRefreshTokenRevoked(const std::string& account_id) override { + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override { ++token_revoked_count_; } void OnRefreshTokensLoaded() override { ++tokens_loaded_count_; } void OnEndBatchChanges() override { ++end_batch_changes_; } - void OnAuthErrorChanged(const std::string& account_id, + void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) override { ++auth_error_changed_count_; } @@ -861,15 +861,15 @@ class TokenServiceErrorObserver : public OAuth2TokenService::Observer { public: MOCK_METHOD2(OnAuthErrorChanged, - void(const std::string&, const GoogleServiceAuthError&)); + void(const CoreAccountId&, const GoogleServiceAuthError&)); }; InitializeOAuth2ServiceDelegate(signin::AccountConsistencyMethod::kDice); TokenServiceErrorObserver observer; oauth2_service_delegate_->AddObserver(&observer); - const std::string account_id1 = "account_id1"; - const std::string account_id2 = "account_id2"; + const CoreAccountId account_id1("account_id1"); + const CoreAccountId account_id2("account_id2"); // This will be fired from UpdateCredentials. EXPECT_CALL( @@ -1310,7 +1310,7 @@ MutableProfileOAuth2TokenServiceDelegate* delegate) : delegate_(delegate) {} - void OnAuthErrorChanged(const std::string& account_id, + void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) override { error_changed_ = true; EXPECT_EQ("account_id", account_id); @@ -1382,7 +1382,7 @@ MutableProfileOAuth2TokenServiceDelegate* delegate) : delegate_(delegate) {} - void OnAuthErrorChanged(const std::string& account_id, + void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) override { error_changed_ = true; EXPECT_FALSE(token_available_) @@ -1391,14 +1391,14 @@ CheckTokenState(account_id); } - void OnRefreshTokenAvailable(const std::string& account_id) override { + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override { token_available_ = true; EXPECT_TRUE(error_changed_) << "OnAuthErrorChanged() should be called first"; CheckTokenState(account_id); } - void CheckTokenState(const std::string& account_id) { + void CheckTokenState(const CoreAccountId& account_id) { EXPECT_EQ("account_id", account_id); EXPECT_TRUE(delegate_->RefreshTokenIsAvailable("account_id")); EXPECT_EQ(GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
diff --git a/components/signin/core/browser/oauth2_token_service_delegate_android_unittest.cc b/components/signin/core/browser/oauth2_token_service_delegate_android_unittest.cc index 6fe207a..ea03519 100644 --- a/components/signin/core/browser/oauth2_token_service_delegate_android_unittest.cc +++ b/components/signin/core/browser/oauth2_token_service_delegate_android_unittest.cc
@@ -29,8 +29,8 @@ class TestObserver : public OAuth2TokenService::Observer { public: - MOCK_METHOD1(OnRefreshTokenAvailable, void(const std::string&)); - MOCK_METHOD1(OnRefreshTokenRevoked, void(const std::string&)); + MOCK_METHOD1(OnRefreshTokenAvailable, void(const CoreAccountId&)); + MOCK_METHOD1(OnRefreshTokenRevoked, void(const CoreAccountId&)); MOCK_METHOD0(OnRefreshTokensLoaded, void()); }; } // namespace @@ -120,7 +120,7 @@ .InSequence(seq) .WillOnce(Return()); // Stored account from |GetAccounts| must fire a revoked event - EXPECT_CALL(observer_, OnRefreshTokenRevoked(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenRevoked(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -137,7 +137,7 @@ SetAccounts(std::vector<CoreAccountId>({account1_.account_id}))) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -154,7 +154,7 @@ SetAccounts(std::vector<CoreAccountId>({account1_.account_id}))) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -172,10 +172,10 @@ .InSequence(seq) .WillOnce(Return()); // Previously stored account is removed, new account is available - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenRevoked(account2_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenRevoked(account2_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -191,7 +191,7 @@ EXPECT_CALL(*delegate_, SetAccounts(kEmptyVector)) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenRevoked(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenRevoked(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -218,7 +218,7 @@ EXPECT_CALL(*delegate_, SetAccounts(kEmptyVector)) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenRevoked(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenRevoked(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -236,10 +236,10 @@ .InSequence(seq) .WillOnce(Return()); // OnRefreshTokenAvailable fired, signed in account should go first. - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account2_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account2_.account_id)) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); @@ -257,10 +257,10 @@ .InSequence(seq) .WillOnce(Return()); // OnRefreshTokenAvailable fired, signed in account should go first. - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account2_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account2_.account_id)) .InSequence(seq) .WillOnce(Return()); delegate_->UpdateAccountList(account1_.account_id, {account2_.account_id}, @@ -277,10 +277,10 @@ .InSequence(seq) .WillOnce(Return()); // OnRefreshTokenAvailable fired, signed in account should go first. - EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenAvailable(account1_.account_id)) .InSequence(seq) .WillOnce(Return()); - EXPECT_CALL(observer_, OnRefreshTokenRevoked(account2_.account_id.id)) + EXPECT_CALL(observer_, OnRefreshTokenRevoked(account2_.account_id)) .InSequence(seq) .WillOnce(Return());
diff --git a/components/signin/core/browser/profile_oauth2_token_service.cc b/components/signin/core/browser/profile_oauth2_token_service.cc index 50fb83dd5..a5c88b3 100644 --- a/components/signin/core/browser/profile_oauth2_token_service.cc +++ b/components/signin/core/browser/profile_oauth2_token_service.cc
@@ -143,7 +143,7 @@ #endif void ProfileOAuth2TokenService::OnRefreshTokenAvailable( - const std::string& account_id) { + const CoreAccountId& account_id) { // Check if the newly-updated token is valid (invalid tokens are inserted when // the user signs out on the web with DICE enabled). bool is_valid = true; @@ -168,7 +168,7 @@ } void ProfileOAuth2TokenService::OnRefreshTokenRevoked( - const std::string& account_id) { + const CoreAccountId& account_id) { // If this was the last token, recreate the device ID. RecreateDeviceIdIfNeeded();
diff --git a/components/signin/core/browser/profile_oauth2_token_service.h b/components/signin/core/browser/profile_oauth2_token_service.h index c985a24..92fb1f81 100644 --- a/components/signin/core/browser/profile_oauth2_token_service.h +++ b/components/signin/core/browser/profile_oauth2_token_service.h
@@ -111,8 +111,8 @@ friend class identity::IdentityManager; // OAuth2TokenService::Observer implementation. - void OnRefreshTokenAvailable(const std::string& account_id) override; - void OnRefreshTokenRevoked(const std::string& account_id) override; + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override; + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override; void OnRefreshTokensLoaded() override; // Creates a new device ID if there are no accounts, or if the current device
diff --git a/components/signin/core/browser/profile_oauth2_token_service_delegate_chromeos_unittest.cc b/components/signin/core/browser/profile_oauth2_token_service_delegate_chromeos_unittest.cc index 088a552..408fee9 100644 --- a/components/signin/core/browser/profile_oauth2_token_service_delegate_chromeos_unittest.cc +++ b/components/signin/core/browser/profile_oauth2_token_service_delegate_chromeos_unittest.cc
@@ -83,7 +83,7 @@ is_inside_batch_ = false; } - void OnRefreshTokenAvailable(const std::string& account_id) override { + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override { if (!is_inside_batch_) StartBatchChanges(); @@ -106,7 +106,7 @@ void OnRefreshTokensLoaded() override { refresh_tokens_loaded_ = true; } - void OnRefreshTokenRevoked(const std::string& account_id) override { + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override { if (!is_inside_batch_) StartBatchChanges(); @@ -115,7 +115,7 @@ batch_change_records_.rbegin()->emplace_back(account_id); } - void OnAuthErrorChanged(const std::string& account_id, + void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) override { last_err_account_id_ = account_id; last_err_ = auth_error;
diff --git a/components/signin/core/browser/signin_manager.cc b/components/signin/core/browser/signin_manager.cc index 3247856a..8a62776 100644 --- a/components/signin/core/browser/signin_manager.cc +++ b/components/signin/core/browser/signin_manager.cc
@@ -35,7 +35,6 @@ weak_pointer_factory_(this) {} SigninManager::~SigninManager() { - token_service()->RemoveObserver(this); local_state_pref_registrar_.RemoveAll(); } @@ -76,10 +75,6 @@ SignOutAndKeepAllAccounts(signin_metrics::SIGNIN_PREF_CHANGED_DURING_SIGNIN, signin_metrics::SignoutDelete::IGNORE_METRIC); } - - // It is important to only load credentials after starting to observe the - // token service. - token_service()->AddObserver(this); } void SigninManager::OnGoogleServicesUsernamePatternChanged() { @@ -113,26 +108,3 @@ local_state->GetString(prefs::kGoogleServicesUsernamePattern); return identity::IsUsernameAllowedByPattern(username, pattern); } - -void SigninManager::OnRefreshTokensLoaded() { - token_service()->RemoveObserver(this); - - if (account_tracker_service()->GetMigrationState() == - AccountTrackerService::MIGRATION_IN_PROGRESS) { - account_tracker_service()->SetMigrationDone(); - } - - // Remove account information from the account tracker service if needed. - if (token_service()->HasLoadCredentialsFinishedWithNoErrors()) { - std::vector<AccountInfo> accounts_in_tracker_service = - account_tracker_service()->GetAccounts(); - for (const auto& account : accounts_in_tracker_service) { - if (GetAuthenticatedAccountId() != account.account_id && - !token_service()->RefreshTokenIsAvailable(account.account_id)) { - DVLOG(0) << "Removed account from account tracker service: " - << account.account_id; - account_tracker_service()->RemoveAccount(account.account_id); - } - } - } -}
diff --git a/components/signin/core/browser/signin_manager.h b/components/signin/core/browser/signin_manager.h index 502a8a6..d86a3d7 100644 --- a/components/signin/core/browser/signin_manager.h +++ b/components/signin/core/browser/signin_manager.h
@@ -32,19 +32,18 @@ #include "components/prefs/pref_member.h" #include "components/signin/core/browser/account_info.h" #include "components/signin/core/browser/account_tracker_service.h" -#include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_manager_base.h" #include "components/signin/core/browser/signin_metrics.h" #include "net/cookies/canonical_cookie.h" class PrefService; +class ProfileOAuth2TokenService; namespace identity { class IdentityManager; } // namespace identity -class SigninManager : public SigninManagerBase, - public OAuth2TokenService::Observer { +class SigninManager : public SigninManagerBase { public: SigninManager(SigninClient* client, ProfileOAuth2TokenService* token_service, @@ -66,9 +65,6 @@ // Returns true if a signin to Chrome is allowed (by policy or pref). bool IsSigninAllowed() const; - // OAuth2TokenService::Observer: - void OnRefreshTokensLoaded() override; - void OnSigninAllowedPrefChanged(); void OnGoogleServicesUsernamePatternChanged();
diff --git a/components/signin/core/browser/signin_manager_base.cc b/components/signin/core/browser/signin_manager_base.cc index a94e958..cad29c2 100644 --- a/components/signin/core/browser/signin_manager_base.cc +++ b/components/signin/core/browser/signin_manager_base.cc
@@ -41,6 +41,8 @@ SigninManagerBase::~SigninManagerBase() { DCHECK(!observer_); + + token_service_->RemoveObserver(this); } // static @@ -86,7 +88,7 @@ client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId); } - std::string account_id = + std::string pref_account_id = client_->GetPrefs()->GetString(prefs::kGoogleServicesAccountId); // Handle backward compatibility: if kGoogleServicesAccountId is empty, but @@ -94,7 +96,7 @@ // be updated. kGoogleServicesUserAccountId should not be empty, and contains // the gaia_id. Use both properties to prime the account tracker before // proceeding. - if (account_id.empty()) { + if (pref_account_id.empty()) { std::string pref_account_username = client_->GetPrefs()->GetString(prefs::kGoogleServicesUsername); if (!pref_account_username.empty()) { @@ -120,13 +122,15 @@ // is correct. After the migration, the returned value will be empty, // which means the user is essentially signed out. // TODO(rogerta): may want to show a toast or something. - account_id = account_tracker_service_->SeedAccountInfo( - pref_gaia_id, pref_account_username); + pref_account_id = + account_tracker_service_ + ->SeedAccountInfo(pref_gaia_id, pref_account_username) + .id; // Set account id before removing obsolete user name in case crash in the // middle. client_->GetPrefs()->SetString(prefs::kGoogleServicesAccountId, - account_id); + pref_account_id); // Now remove obsolete preferences. client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); @@ -137,22 +141,25 @@ // kGoogleServicesAccountId. } - if (!account_id.empty()) { + if (!pref_account_id.empty()) { if (account_tracker_service_->GetMigrationState() == AccountTrackerService::MIGRATION_IN_PROGRESS) { AccountInfo account_info = - account_tracker_service_->FindAccountInfoByEmail(account_id); + account_tracker_service_->FindAccountInfoByEmail(pref_account_id); // |account_info.gaia| could be empty if |account_id| is already gaia id. if (!account_info.gaia.empty()) { - account_id = account_info.gaia; + pref_account_id = account_info.gaia; client_->GetPrefs()->SetString(prefs::kGoogleServicesAccountId, - account_id); + pref_account_id); } } - SetAuthenticatedAccountId(account_id); + SetAuthenticatedAccountId(CoreAccountId(pref_account_id)); } FinalizeInitBeforeLoadingRefreshTokens(local_state); - token_service()->LoadCredentials(GetAuthenticatedAccountId()); + // It is important to only load credentials after starting to observe the + // token service. + token_service_->AddObserver(this); + token_service_->LoadCredentials(GetAuthenticatedAccountId()); } void SigninManagerBase::FinalizeInitBeforeLoadingRefreshTokens( @@ -166,7 +173,7 @@ return account_tracker_service_->GetAccountInfo(GetAuthenticatedAccountId()); } -const std::string& SigninManagerBase::GetAuthenticatedAccountId() const { +const CoreAccountId& SigninManagerBase::GetAuthenticatedAccountId() const { return authenticated_account_id_; } @@ -175,13 +182,13 @@ DCHECK(!gaia_id.empty()); DCHECK(!email.empty()); - std::string account_id = + CoreAccountId account_id = account_tracker_service_->SeedAccountInfo(gaia_id, email); SetAuthenticatedAccountId(account_id); } void SigninManagerBase::SetAuthenticatedAccountId( - const std::string& account_id) { + const CoreAccountId& account_id) { DCHECK(!account_id.empty()); if (!authenticated_account_id_.empty()) { DCHECK_EQ(account_id, authenticated_account_id_) @@ -193,7 +200,7 @@ std::string pref_account_id = client_->GetPrefs()->GetString(prefs::kGoogleServicesAccountId); - DCHECK(pref_account_id.empty() || pref_account_id == account_id) + DCHECK(pref_account_id.empty() || pref_account_id == account_id.id) << "account_id=" << account_id << " pref_account_id=" << pref_account_id; authenticated_account_id_ = account_id; client_->GetPrefs()->SetString(prefs::kGoogleServicesAccountId, account_id); @@ -227,7 +234,7 @@ } void SigninManagerBase::ClearAuthenticatedAccountId() { - authenticated_account_id_.clear(); + authenticated_account_id_ = CoreAccountId(); if (observer_) { observer_->AuthenticatedAccountCleared(); } @@ -249,8 +256,7 @@ #if !defined(OS_CHROMEOS) void SigninManagerBase::SignIn(const std::string& username) { - AccountInfo info = - account_tracker_service()->FindAccountInfoByEmail(username); + AccountInfo info = account_tracker_service_->FindAccountInfoByEmail(username); DCHECK(!info.gaia.empty()); DCHECK(!info.email.empty()); @@ -324,7 +330,7 @@ } AccountInfo account_info = GetAuthenticatedAccountInfo(); - const std::string account_id = GetAuthenticatedAccountId(); + const CoreAccountId account_id = GetAuthenticatedAccountId(); const std::string username = account_info.email; const base::Time signin_time = base::Time::FromDeltaSinceWindowsEpoch(base::TimeDelta::FromMicroseconds( @@ -348,13 +354,13 @@ switch (remove_option) { case RemoveAccountsOption::kRemoveAllAccounts: VLOG(0) << "Revoking all refresh tokens on server. Reason: sign out"; - token_service()->RevokeAllCredentials( + token_service_->RevokeAllCredentials( signin_metrics::SourceForRefreshTokenOperation:: kSigninManager_ClearPrimaryAccount); break; case RemoveAccountsOption::kRemoveAuthenticatedAccountIfInError: - if (token_service()->RefreshTokenHasError(account_id)) - token_service()->RevokeCredentials( + if (token_service_->RefreshTokenHasError(account_id)) + token_service_->RevokeCredentials( account_id, signin_metrics::SourceForRefreshTokenOperation:: kSigninManager_ClearPrimaryAccount); break; @@ -371,4 +377,27 @@ observer_->GoogleSignedOut(account_info); } } + +void SigninManagerBase::OnRefreshTokensLoaded() { + token_service_->RemoveObserver(this); + + if (account_tracker_service_->GetMigrationState() == + AccountTrackerService::MIGRATION_IN_PROGRESS) { + account_tracker_service_->SetMigrationDone(); + } + + // Remove account information from the account tracker service if needed. + if (token_service_->HasLoadCredentialsFinishedWithNoErrors()) { + std::vector<AccountInfo> accounts_in_tracker_service = + account_tracker_service_->GetAccounts(); + for (const auto& account : accounts_in_tracker_service) { + if (GetAuthenticatedAccountId() != account.account_id && + !token_service_->RefreshTokenIsAvailable(account.account_id)) { + DVLOG(0) << "Removed account from account tracker service: " + << account.account_id; + account_tracker_service_->RemoveAccount(account.account_id); + } + } + } +} #endif // !defined(OS_CHROMEOS)
diff --git a/components/signin/core/browser/signin_manager_base.h b/components/signin/core/browser/signin_manager_base.h index 08ca9624..4ee0ea5 100644 --- a/components/signin/core/browser/signin_manager_base.h +++ b/components/signin/core/browser/signin_manager_base.h
@@ -37,6 +37,7 @@ #include "components/signin/core/browser/account_info.h" #include "components/signin/core/browser/signin_client.h" #include "google_apis/gaia/google_service_auth_error.h" +#include "google_apis/gaia/oauth2_token_service.h" class AccountTrackerService; class PrefRegistrySimple; @@ -44,7 +45,7 @@ class ProfileOAuth2TokenService; class SigninClient; -class SigninManagerBase { +class SigninManagerBase : public OAuth2TokenService::Observer { public: class Observer { public: @@ -97,7 +98,7 @@ }; #endif - virtual ~SigninManagerBase(); + ~SigninManagerBase() override; // Registers per-profile prefs. static void RegisterProfilePrefs(PrefRegistrySimple* registry); @@ -123,7 +124,7 @@ // normalized email address of the connected account, use // GetAuthenticatedAccountInfo().email. Example: to show the string "Signed // in as XXX" in the hotdog menu. - const std::string& GetAuthenticatedAccountId() const; + const CoreAccountId& GetAuthenticatedAccountId() const; // Sets the authenticated user's Gaia ID and display email. Internally, // this will seed the account information in AccountTrackerService and pick @@ -181,16 +182,16 @@ protected: SigninClient* signin_client() const { return client_; } - ProfileOAuth2TokenService* token_service() const { return token_service_; } - - AccountTrackerService* account_tracker_service() const { - return account_tracker_service_; - } - // Invoked at the end of |Initialize| before the refresh token for the primary // account is loaded. virtual void FinalizeInitBeforeLoadingRefreshTokens(PrefService* local_state); + private: + // Added only to allow SigninManager to call the SigninManagerBase + // constructor while disallowing any ad-hoc subclassing of + // SigninManagerBase. + friend class SigninManager; + // Sets the authenticated user's account id. // If the user is already authenticated with the same account id, then this // method is a no-op. @@ -198,7 +199,7 @@ // with a different account (this method will DCHECK in that case). // |account_id| must not be empty. To log the user out, use // ClearAuthenticatedAccountId() instead. - void SetAuthenticatedAccountId(const std::string& account_id); + void SetAuthenticatedAccountId(const CoreAccountId& account_id); // Clears the authenticated user's account id. // This method is not public because SigninManagerBase does not allow signing @@ -206,16 +207,6 @@ // call this. void ClearAuthenticatedAccountId(); - // Observer to notify on signin events. - // There is a DCHECK on destruction that this has been cleared. - Observer* observer_ = nullptr; - - private: - // Added only to allow SigninManager to call the SigninManagerBase - // constructor while disallowing any ad-hoc subclassing of - // SigninManagerBase. - friend class SigninManager; - #if !defined(OS_CHROMEOS) // Starts the sign out process. void StartSignOut(signin_metrics::ProfileSignout signout_source_metric, @@ -231,8 +222,15 @@ // Send all observers |GoogleSignedOut| notifications. void FireGoogleSignedOut(const AccountInfo& account_info); + + // OAuth2TokenService::Observer: + void OnRefreshTokensLoaded() override; #endif + // Observer to notify on signin events. + // There is a DCHECK on destruction that this has been cleared. + Observer* observer_ = nullptr; + SigninClient* client_; // The ProfileOAuth2TokenService instance associated with this object. Must @@ -244,7 +242,7 @@ bool initialized_; // Account id after successful authentication. - std::string authenticated_account_id_; + CoreAccountId authenticated_account_id_; // The list of callbacks notified on shutdown. base::CallbackList<void()> on_shutdown_callback_list_;
diff --git a/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm b/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm index 3876719..4d91ebe 100644 --- a/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm +++ b/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm
@@ -76,14 +76,14 @@ } // OAuth2TokenService::Observer implementation. - void OnRefreshTokenAvailable(const std::string& account_id) override { + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override { ++token_available_count_; } - void OnRefreshTokenRevoked(const std::string& account_id) override { + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override { ++token_revoked_count_; } void OnRefreshTokensLoaded() override { ++tokens_loaded_count_; } - void OnAuthErrorChanged(const std::string& account_id, + void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& error) override { ++auth_error_changed_count_; }
diff --git a/components/sync/driver/sync_driver_switches.cc b/components/sync/driver/sync_driver_switches.cc index 91733d1a..6676277c 100644 --- a/components/sync/driver/sync_driver_switches.cc +++ b/components/sync/driver/sync_driver_switches.cc
@@ -71,10 +71,6 @@ const base::Feature kSyncUSSPasswords{"SyncUSSPasswords", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enable USS implementation of autofill profile datatype. -const base::Feature kSyncUSSAutofillProfile{"SyncUSSAutofillProfile", - base::FEATURE_ENABLED_BY_DEFAULT}; - // Enable USS implementation of autofill wallet metadata datatype. const base::Feature kSyncUSSAutofillWalletMetadata{ "SyncUSSAutofillWalletMetadata", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/sync/driver/sync_driver_switches.h b/components/sync/driver/sync_driver_switches.h index 9fd37f7..4ad8437 100644 --- a/components/sync/driver/sync_driver_switches.h +++ b/components/sync/driver/sync_driver_switches.h
@@ -33,7 +33,6 @@ extern const base::Feature kSyncSupportSecondaryAccount; extern const base::Feature kSyncUSSBookmarks; extern const base::Feature kSyncUSSPasswords; -extern const base::Feature kSyncUSSAutofillProfile; extern const base::Feature kSyncUSSAutofillWalletMetadata; extern const base::Feature kSyncWifiConfigurations;
diff --git a/components/webdata_services/web_data_service_wrapper.cc b/components/webdata_services/web_data_service_wrapper.cc index 3529ca7..4b87cd0 100644 --- a/components/webdata_services/web_data_service_wrapper.cc +++ b/components/webdata_services/web_data_service_wrapper.cc
@@ -15,7 +15,6 @@ #include "build/build_config.h" #include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" #include "components/autofill/core/browser/webdata/autofill_profile_sync_bridge.h" -#include "components/autofill/core/browser/webdata/autofill_profile_syncable_service.h" #include "components/autofill/core/browser/webdata/autofill_table.h" #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync_bridge.h" #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.h" @@ -38,38 +37,21 @@ namespace { -// TODO(jkrcal): Rename this function when the last webdata sync type get -// converted to USS, e.g. to InitSyncBridgesOnDBSequence(). Check also other -// related functions. -void InitSyncableProfileServicesOnDBSequence( +void InitProfileSyncBridgesOnDBSequence( scoped_refptr<base::SingleThreadTaskRunner> db_task_runner, - const syncer::SyncableService::StartSyncFlare& sync_flare, const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, - const base::FilePath& context_path, const std::string& app_locale, autofill::AutofillWebDataBackend* autofill_backend) { DCHECK(db_task_runner->RunsTasksInCurrentSequence()); - // Currently only Autocomplete and Autofill profiles use the new Sync API, but - // all the database data should migrate to this API over time. autofill::AutocompleteSyncBridge::CreateForWebDataServiceAndBackend( autofill_web_data.get(), autofill_backend); - - if (base::FeatureList::IsEnabled(switches::kSyncUSSAutofillProfile)) { - autofill::AutofillProfileSyncBridge::CreateForWebDataServiceAndBackend( - app_locale, autofill_backend, autofill_web_data.get()); - } else { - autofill::AutofillProfileSyncableService::CreateForWebDataServiceAndBackend( - autofill_web_data.get(), autofill_backend, app_locale); - autofill::AutofillProfileSyncableService::FromWebDataService( - autofill_web_data.get()) - ->InjectStartSyncFlare(sync_flare); - } + autofill::AutofillProfileSyncBridge::CreateForWebDataServiceAndBackend( + app_locale, autofill_backend, autofill_web_data.get()); } // TODO(jkrcal): Rename this function when the last webdata sync type get -// converted to USS, e.g. to InitSyncBridgesOnDBSequence(). Check also other -// related functions. +// converted to USS, e.g. to InitAccountSyncBridgesOnDBSequence(). void InitSyncableAccountServicesOnDBSequence( scoped_refptr<base::SingleThreadTaskRunner> db_task_runner, const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, @@ -161,9 +143,9 @@ ui_task_runner); #endif - profile_autofill_web_data_->GetAutofillBackend(base::Bind( - &InitSyncableProfileServicesOnDBSequence, db_task_runner, flare, - profile_autofill_web_data_, context_path, application_locale)); + profile_autofill_web_data_->GetAutofillBackend( + base::Bind(&InitProfileSyncBridgesOnDBSequence, db_task_runner, + profile_autofill_web_data_, application_locale)); profile_autofill_web_data_->GetAutofillBackend( base::Bind(&InitSyncableAccountServicesOnDBSequence, db_task_runner, profile_autofill_web_data_, context_path, application_locale));
diff --git a/content/browser/accessibility/accessibility_auralinux_browsertest.cc b/content/browser/accessibility/accessibility_auralinux_browsertest.cc index 649e794..f5389ef 100644 --- a/content/browser/accessibility/accessibility_auralinux_browsertest.cc +++ b/content/browser/accessibility/accessibility_auralinux_browsertest.cc
@@ -17,6 +17,17 @@ #include "content/test/content_browser_test_utils_internal.h" #include "ui/accessibility/platform/ax_platform_node_auralinux.h" +// TODO(crbug.com/961029): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_TestAtkTextListItem DISABLED_TestAtkTextListItem +#define MAYBE_TestSetCaretSetsSequentialFocusNavigationStartingPoint \ + DISABLED_TestSetCaretSetsSequentialFocusNavigationStartingPoint +#else +#define MAYBE_TestAtkTextListItem TestAtkTextListItem +#define MAYBE_TestSetCaretSetsSequentialFocusNavigationStartingPoint \ + TestSetCaretSetsSequentialFocusNavigationStartingPoint +#endif + namespace content { namespace { @@ -719,7 +730,8 @@ g_object_unref(atk_text); } -IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, TestAtkTextListItem) { +IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, + MAYBE_TestAtkTextListItem) { LoadInitialAccessibilityTreeFromHtml( R"HTML(<!DOCTYPE html> <html> @@ -760,8 +772,9 @@ g_object_unref(list_item_1); } -IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, - TestSetCaretSetsSequentialFocusNavigationStartingPoint) { +IN_PROC_BROWSER_TEST_F( + AccessibilityAuraLinuxBrowserTest, + MAYBE_TestSetCaretSetsSequentialFocusNavigationStartingPoint) { LoadInitialAccessibilityTreeFromHtml( R"HTML(<!DOCTYPE html> <html>
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc index 7975e77..ac378ae 100644 --- a/content/browser/accessibility/browser_accessibility.cc +++ b/content/browser/accessibility/browser_accessibility.cc
@@ -1168,6 +1168,10 @@ return offscreen_result == ui::AXOffscreenResult::kOffscreen; } +bool BrowserAccessibility::IsMinimized() const { + return false; +} + bool BrowserAccessibility::IsWebContent() const { return true; }
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h index 574447b..16720e3e 100644 --- a/content/browser/accessibility/browser_accessibility.h +++ b/content/browser/accessibility/browser_accessibility.h
@@ -455,6 +455,7 @@ base::string16 GetStyleNameAttributeAsLocalizedString() const override; bool ShouldIgnoreHoveredStateForTesting() override; bool IsOffscreen() const override; + bool IsMinimized() const override; bool IsWebContent() const override; ui::AXPlatformNode* GetTargetNodeForRelation( ax::mojom::IntAttribute attr) override;
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index 500b4eb..41ccdb2 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc
@@ -163,15 +163,6 @@ } // static -void BrowserThread::PostAfterStartupTask( - const base::Location& from_here, - const scoped_refptr<base::TaskRunner>& task_runner, - base::OnceClosure task) { - GetContentClient()->browser()->PostAfterStartupTask(from_here, task_runner, - std::move(task)); -} - -// static bool BrowserThread::IsThreadInitialized(ID identifier) { DCHECK_GE(identifier, 0); DCHECK_LT(identifier, ID_COUNT);
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 7598458..5a49677 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -839,38 +839,37 @@ CreateNavigationHandle(false); - if (IsURLHandledByNetworkStack(common_params_.url) && !IsSameDocument()) { - // Update PreviewsState if we are going to use the NetworkStack. - common_params_.previews_state = - GetContentClient()->browser()->DetermineAllowedPreviews( - common_params_.previews_state, navigation_handle_.get(), - common_params_.url); + if (!NeedsUrlLoader()) { + // There is no need to make a network request for this navigation, so commit + // it immediately. + TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationRequest", this, + "ResponseStarted"); + state_ = RESPONSE_STARTED; - // It's safe to use base::Unretained because this NavigationRequest owns - // the NavigationHandle where the callback will be stored. - // TODO(clamy): pass the method to the NavigationHandle instead of a - // boolean. - WillStartRequest(base::Bind(&NavigationRequest::OnStartChecksComplete, - base::Unretained(this))); + // Select an appropriate RenderFrameHost. + render_frame_host_ = + frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); + NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( + render_frame_host_, common_params_.url); + + // Inform the NavigationHandle that the navigation will commit. + navigation_handle_->ReadyToCommitNavigation(false /* is_error */); + + CommitNavigation(); return; } - // There is no need to make a network request for this navigation, so commit - // it immediately. - TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationRequest", this, - "ResponseStarted"); - state_ = RESPONSE_STARTED; + common_params_.previews_state = + GetContentClient()->browser()->DetermineAllowedPreviews( + common_params_.previews_state, navigation_handle_.get(), + common_params_.url); - // Select an appropriate RenderFrameHost. - render_frame_host_ = - frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); - NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host_, - common_params_.url); - - // Inform the NavigationHandle that the navigation will commit. - navigation_handle_->ReadyToCommitNavigation(false); - - CommitNavigation(); + // It's safe to use base::Unretained because this NavigationRequest owns + // the NavigationHandle where the callback will be stored. + // TODO(clamy): pass the method to the NavigationHandle instead of a + // boolean. + WillStartRequest(base::Bind(&NavigationRequest::OnStartChecksComplete, + base::Unretained(this))); } void NavigationRequest::SetWaitingForRendererResponse() { @@ -1981,10 +1980,11 @@ void NavigationRequest::CommitNavigation() { UpdateCommitNavigationParamsHistory(); - DCHECK(response_ || !IsURLHandledByNetworkStack(common_params_.url) || - IsSameDocument()); + DCHECK(NeedsUrlLoader() == !!response_ || + (navigation_handle_->WasServerRedirect() && + common_params_.url.IsAboutBlank())); DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme)); - + DCHECK(!IsRendererDebugURL(common_params_.url)); DCHECK(render_frame_host_ == frame_tree_node_->render_manager()->current_frame_host() || render_frame_host_ == @@ -2256,10 +2256,8 @@ "details."; parent->AddMessageToConsole(blink::mojom::ConsoleMessageLevel::kWarning, console_message); - if (!base::FeatureList::IsEnabled(features::kBlockCredentialedSubresources)) return CredentialedSubresourceCheckResult::ALLOW_REQUEST; - return CredentialedSubresourceCheckResult::BLOCK_REQUEST; } @@ -2513,6 +2511,17 @@ return throttle_runner_->GetDeferringThrottle() != nullptr; } +bool NavigationRequest::IsForMhtmlSubframe() const { + return frame_tree_node_->parent() && + frame_tree_node_->frame_tree() + ->root() + ->current_frame_host() + ->is_mhtml_document() && + // Unlike every other MHTML subframe URLs, data-url are loaded via the + // URL, not from the MHTML archive. See https://crbug.com/969696. + !common_params_.url.SchemeIs(url::kDataScheme); +} + void NavigationRequest::CancelDeferredNavigationInternal( NavigationThrottle::ThrottleCheckResult result) { DCHECK(handle_state_ == PROCESSING_WILL_START_REQUEST || @@ -2771,4 +2780,9 @@ associated_site_instance_id_ = associated_site_instance_id; } +bool NavigationRequest::NeedsUrlLoader() const { + return IsURLHandledByNetworkStack(common_params_.url) && !IsSameDocument() && + !IsForMhtmlSubframe(); +} + } // namespace content
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h index 50e22d8..431d7eb 100644 --- a/content/browser/frame_host/navigation_request.h +++ b/content/browser/frame_host/navigation_request.h
@@ -437,6 +437,11 @@ mojom::NavigationClientAssociatedPtrInfo navigation_client, int32_t associated_site_instance_id); + // Whether the new document created by this navigation will be loaded from a + // MHTML document. In this case, the navigation will commit in the main frame + // process without needing any network requests. + bool IsForMhtmlSubframe() const; + private: // TODO(clamy): Transform NavigationHandleImplTest into NavigationRequestTest // once NavigationHandleImpl has become a wrapper around NavigationRequest. @@ -668,6 +673,33 @@ void UpdateStateFollowingRedirect(const GURL& new_referrer_url, ThrottleChecksFinishedCallback callback); + // NeedsUrlLoader() returns true if the navigation needs to use the + // NavigationURLLoader for loading the document. + // + // A few types of navigations don't make any network requests. They can be + // committed immediately in BeginNavigation(). They self-contain the data + // needed for commit: + // - about:blank: The renderer already knows how to load the empty document. + // - about:srcdoc: The data is stored in the iframe srcdoc attribute. + // - same-document: Only the history and URL are updated, no new document. + // - MHTML subframe: The data is in the archive, owned by the main frame. + // + // Note #1: Even though "data:" URLs don't generate actual network requests, + // including within MHTML subframes, they are still handled by the network + // stack. The reason is that a few of them can't always be handled otherwise. + // For instance: + // - the ones resulting in downloads. + // - the "invalid" ones. An error page is generated instead. + // - the ones with an unsupported MIME type. + // - the ones targeting the top-level frame on Android. + // + // Note #2: Even though "javascript:" URL and RendererDebugURL fit very well + // in this category, they don't use the NavigationRequest. + // + // Note #3: Navigations that do not use a URL loader also bypass + // NavigationThrottle. + bool NeedsUrlLoader() const; + FrameTreeNode* frame_tree_node_; // Invariant: At least one of |loader_| or |render_frame_host_| is null.
diff --git a/content/browser/frame_host/render_frame_host_delegate.cc b/content/browser/frame_host/render_frame_host_delegate.cc index b70f80a4..2bfbaaa 100644 --- a/content/browser/frame_host/render_frame_host_delegate.cc +++ b/content/browser/frame_host/render_frame_host_delegate.cc
@@ -10,6 +10,7 @@ #include "content/browser/frame_host/render_frame_host_delegate.h" #include "content/public/browser/file_select_listener.h" #include "ipc/ipc_message.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" #include "url/origin.h" @@ -62,7 +63,7 @@ LOG(ERROR) << "RenderFrameHostDelegate::RequestMediaAccessPermission: " << "Not supported."; std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_NOT_SUPPORTED, + blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, std::unique_ptr<MediaStreamUI>()); }
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index fffd340..5426a98c 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -4666,11 +4666,35 @@ "frame_tree_node", frame_tree_node_->frame_tree_node_id(), "url", common_params.url.possibly_invalid_spec()); DCHECK(!IsRendererDebugURL(common_params.url)); + + bool is_mhtml_iframe = + navigation_request && navigation_request->IsForMhtmlSubframe(); + + // A |response| and a |url_loader_client_endpoints| must always be provided, + // except for edge cases, where another way to load the document exist. DCHECK( (response && url_loader_client_endpoints) || common_params.url.SchemeIs(url::kDataScheme) || FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) || - !IsURLHandledByNetworkStack(common_params.url)); + !IsURLHandledByNetworkStack(common_params.url) || is_mhtml_iframe); + + // All children of MHTML documents must be MHTML documents. + // As a defensive measure, crash the browser if something went wrong. + if (!frame_tree_node()->IsMainFrame()) { + RenderFrameHostImpl* root = + frame_tree_node()->frame_tree()->root()->current_frame_host(); + if (root->is_mhtml_document_ && + !common_params.url.SchemeIs(url::kDataScheme)) { + bool loaded_from_outside_the_archive = + response || url_loader_client_endpoints; + CHECK(!loaded_from_outside_the_archive); + CHECK(is_mhtml_iframe); + CHECK_EQ(GetSiteInstance(), root->GetSiteInstance()); + CHECK_EQ(GetProcess(), root->GetProcess()); + } else { + DCHECK(!is_mhtml_iframe); + } + } // If this is an attempt to commit a URL in an incompatible process, capture a // crash dump to diagnose why it is occurring. @@ -4681,7 +4705,8 @@ if (lock_url != GURL(kUnreachableWebDataURL) && common_params.url.IsStandard() && !policy->CanAccessDataForOrigin(GetProcess()->GetID(), - common_params.url)) { + common_params.url) && + !is_mhtml_iframe) { base::debug::SetCrashKeyString( base::debug::AllocateCrashKeyString("lock_url", base::debug::CrashKeySize::Size64),
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 7413bd6..5d76f8c5 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -1070,6 +1070,10 @@ FRIEND_TEST_ALL_PREFIXES( SitePerProcessBrowserTest, IsDetachedSubframeObservableDuringUnloadHandlerCrossProcess); + FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, + UnloadHandlersArePowerful); + FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, + UnloadHandlersArePowerfulGrandChild); class DroppedInterfaceRequestLogger;
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index 297b6119..49b3729 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -772,7 +772,8 @@ if (lock_url != GURL(kUnreachableWebDataURL) && request.common_params().url.IsStandard() && !policy->CanAccessDataForOrigin(navigation_rfh->GetProcess()->GetID(), - request.common_params().url)) { + request.common_params().url) && + !request.IsForMhtmlSubframe()) { base::debug::SetCrashKeyString( base::debug::AllocateCrashKeyString("lock_url", base::debug::CrashKeySize::Size64), @@ -2127,9 +2128,15 @@ scoped_refptr<SiteInstance> RenderFrameHostManager::GetSiteInstanceForNavigationRequest( const NavigationRequest& request) { + SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); + + // All children of MHTML documents must be MHTML documents. They all live in + // the same process. + if (request.IsForMhtmlSubframe()) + return base::WrapRefCounted(current_site_instance); + // First, check if the navigation can switch SiteInstances. If not, the // navigation should use the current SiteInstance. - SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); bool no_renderer_swap_allowed = false; bool should_swap_for_error_isolation = false; bool was_server_redirect = request.navigation_handle() &&
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index 590db60..e1259dc0 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -621,8 +621,15 @@ gpu_preferences->watchdog_starts_backgrounded = !application_is_visible_; - if (kind == GPU_PROCESS_KIND_UNSANDBOXED_NO_GL) - gpu_preferences->gpu_startup_dialog = false; + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + gpu_preferences->gpu_startup_dialog = +#if defined(OS_WIN) + (kind == GPU_PROCESS_KIND_UNSANDBOXED_NO_GL && + command_line->HasSwitch(switches::kGpu2StartupDialog)) || +#endif + (kind == GPU_PROCESS_KIND_SANDBOXED && + command_line->HasSwitch(switches::kGpuStartupDialog)); } void GpuDataManagerImplPrivate::DisableHardwareAcceleration() {
diff --git a/content/browser/push_messaging/push_messaging_manager.cc b/content/browser/push_messaging/push_messaging_manager.cc index 04f0798..95633a6 100644 --- a/content/browser/push_messaging/push_messaging_manager.cc +++ b/content/browser/push_messaging/push_messaging_manager.cc
@@ -302,7 +302,6 @@ // ----------------------------------------------------------------------------- void PushMessagingManager::Subscribe( - int32_t render_frame_id, int64_t service_worker_registration_id, const blink::WebPushSubscriptionOptions& options, bool user_gesture,
diff --git a/content/browser/push_messaging/push_messaging_manager.h b/content/browser/push_messaging/push_messaging_manager.h index 674ca47..7af5dd8 100644 --- a/content/browser/push_messaging/push_messaging_manager.h +++ b/content/browser/push_messaging/push_messaging_manager.h
@@ -50,8 +50,7 @@ } // blink::mojom::PushMessaging impl, run on IO thread. - void Subscribe(int32_t render_frame_id, - int64_t service_worker_registration_id, + void Subscribe(int64_t service_worker_registration_id, const blink::WebPushSubscriptionOptions& options, bool user_gesture, SubscribeCallback callback) override;
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc index e7b2b92..a430751 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc
@@ -17,6 +17,7 @@ #include "content/public/browser/render_frame_host.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/service_manager/public/cpp/interface_provider.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "url/origin.h" namespace content { @@ -145,9 +146,10 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!MediaStreamManager::IsOriginAllowed(render_process_id_, salt_and_origin.origin)) { - std::move(callback).Run(blink::MEDIA_DEVICE_INVALID_SECURITY_ORIGIN, - std::string(), blink::MediaStreamDevices(), - blink::MediaStreamDevices()); + std::move(callback).Run( + blink::mojom::MediaStreamRequestResult::INVALID_SECURITY_ORIGIN, + std::string(), blink::MediaStreamDevices(), + blink::MediaStreamDevices()); return; }
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index 792716e9..50fd44a 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
@@ -38,6 +38,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "url/gurl.h" #include "url/origin.h" @@ -94,7 +95,8 @@ int audio_array_size, int video_array_size)); MOCK_METHOD2(OnStreamGenerationFailure, - void(int request_id, blink::MediaStreamRequestResult result)); + void(int request_id, + blink::mojom::MediaStreamRequestResult result)); MOCK_METHOD0(OnDeviceStopSuccess, void()); MOCK_METHOD0(OnDeviceOpenSuccess, void()); @@ -153,11 +155,11 @@ private: // These handler methods do minimal things and delegate to the mock methods. void OnStreamGenerated(int request_id, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices) { - if (result != blink::MEDIA_DEVICE_OK) { + if (result != blink::mojom::MediaStreamRequestResult::OK) { OnStreamGenerationFailed(request_id, result); return; } @@ -178,7 +180,7 @@ } void OnStreamGenerationFailed(int request_id, - blink::MediaStreamRequestResult result) { + blink::mojom::MediaStreamRequestResult result) { OnStreamGenerationFailure(request_id, result); if (!quit_closures_.empty()) { base::Closure quit_closure = quit_closures_.front(); @@ -350,7 +352,7 @@ void GenerateStreamAndWaitForFailure( int page_request_id, const blink::StreamControls& controls, - blink::MediaStreamRequestResult expected_result) { + blink::mojom::MediaStreamRequestResult expected_result) { base::RunLoop run_loop; EXPECT_CALL(*host_, OnStreamGenerationFailure(page_request_id, expected_result)); @@ -465,8 +467,9 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithNothing) { blink::StreamControls controls(false, false); - GenerateStreamAndWaitForFailure(kPageRequestId, controls, - blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN); + GenerateStreamAndWaitForFailure( + kPageRequestId, controls, + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN); } TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { @@ -656,8 +659,9 @@ blink::StreamControls controls(true, true); controls.video.device_id = "invalid source id"; - GenerateStreamAndWaitForFailure(kPageRequestId, controls, - blink::MEDIA_DEVICE_NO_HARDWARE); + GenerateStreamAndWaitForFailure( + kPageRequestId, controls, + blink::mojom::MediaStreamRequestResult::NO_HARDWARE); } // Test that generating a stream with an invalid audio source id fail. @@ -665,8 +669,9 @@ blink::StreamControls controls(true, true); controls.audio.device_id = "invalid source id"; - GenerateStreamAndWaitForFailure(kPageRequestId, controls, - blink::MEDIA_DEVICE_NO_HARDWARE); + GenerateStreamAndWaitForFailure( + kPageRequestId, controls, + blink::mojom::MediaStreamRequestResult::NO_HARDWARE); } TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsNoAvailableVideoDevice) { @@ -674,8 +679,9 @@ blink::StreamControls controls(true, true); SetupFakeUI(false); - GenerateStreamAndWaitForFailure(kPageRequestId, controls, - blink::MEDIA_DEVICE_NO_HARDWARE); + GenerateStreamAndWaitForFailure( + kPageRequestId, controls, + blink::mojom::MediaStreamRequestResult::NO_HARDWARE); } // Test that if a OnStopStreamDevice message is received for a device that has
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 9cc75c7..2a1be8b 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -91,11 +91,11 @@ using blink::MediaStreamDevice; using blink::MediaStreamDevices; -using blink::MediaStreamRequestResult; using blink::MediaStreamRequestType; using blink::MediaStreamType; using blink::StreamControls; using blink::TrackControls; +using blink::mojom::MediaStreamRequestResult; namespace { // Creates a random label used to identify requests. @@ -410,7 +410,7 @@ void RunMojoCallbacks() { if (generate_stream_cb) { std::move(generate_stream_cb) - .Run(blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, std::string(), + .Run(MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, std::string(), MediaStreamDevices(), MediaStreamDevices()); } @@ -708,7 +708,8 @@ if (std::move(generate_stream_test_callback_).Run(controls)) { FinalizeGenerateStream(label, request); } else { - FinalizeRequestFailed(label, request, blink::MEDIA_DEVICE_INVALID_STATE); + FinalizeRequestFailed(label, request, + MediaStreamRequestResult::INVALID_STATE); } return; } @@ -1222,7 +1223,7 @@ request->video_type() == blink::MEDIA_DISPLAY_VIDEO_CAPTURE; if (is_display_capture && !SetUpDisplayCaptureRequest(request)) { FinalizeRequestFailed(label, request, - blink::MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE); + MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE); return; } @@ -1232,7 +1233,7 @@ if (is_tab_capture) { if (!SetUpTabCaptureRequest(request, label)) { FinalizeRequestFailed(label, request, - blink::MEDIA_DEVICE_TAB_CAPTURE_FAILURE); + MediaStreamRequestResult::TAB_CAPTURE_FAILURE); } return; } @@ -1241,7 +1242,7 @@ request->video_type() == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE; if (is_screen_capture && !SetUpScreenCaptureRequest(request)) { FinalizeRequestFailed(label, request, - blink::MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE); + MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE); return; } @@ -1254,7 +1255,8 @@ // If no actual device capture is requested, set up the request with an // empty device list. if (!SetUpDeviceCaptureRequest(request, MediaDeviceEnumeration())) { - FinalizeRequestFailed(label, request, blink::MEDIA_DEVICE_NO_HARDWARE); + FinalizeRequestFailed(label, request, + MediaStreamRequestResult::NO_HARDWARE); return; } } @@ -1374,7 +1376,7 @@ // Received invalid device id. if (device_id.type != content::DesktopMediaID::TYPE_WEB_CONTENTS) { FinalizeRequestFailed(label, request, - blink::MEDIA_DEVICE_TAB_CAPTURE_FAILURE); + MediaStreamRequestResult::TAB_CAPTURE_FAILURE); return; } @@ -1508,7 +1510,7 @@ } std::move(request->generate_stream_cb) - .Run(blink::MEDIA_DEVICE_OK, label, audio_devices, video_devices); + .Run(MediaStreamRequestResult::OK, label, audio_devices, video_devices); } void MediaStreamManager::FinalizeRequestFailed( @@ -1757,7 +1759,8 @@ } if (!SetUpDeviceCaptureRequest(request, enumeration)) - FinalizeRequestFailed(label, request, blink::MEDIA_DEVICE_NO_HARDWARE); + FinalizeRequestFailed(label, request, + MediaStreamRequestResult::NO_HARDWARE); else ReadOutputParamsAndPostRequestToUI(label, request, enumeration); } @@ -1838,7 +1841,7 @@ } // Handle the case when the request was denied. - if (result != blink::MEDIA_DEVICE_OK) { + if (result != MediaStreamRequestResult::OK) { FinalizeRequestFailed(label, request, result); return; }
diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h index 592fbd16..b98347b 100644 --- a/content/browser/renderer_host/media/media_stream_manager.h +++ b/content/browser/renderer_host/media/media_stream_manager.h
@@ -54,6 +54,7 @@ #include "third_party/blink/public/common/mediastream/media_devices.h" #include "third_party/blink/public/common/mediastream/media_stream_controls.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace media { class AudioSystem; @@ -86,7 +87,7 @@ std::unique_ptr<MediaStreamUIProxy> ui)>; using GenerateStreamCallback = - base::OnceCallback<void(blink::MediaStreamRequestResult result, + base::OnceCallback<void(blink::mojom::MediaStreamRequestResult result, const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices)>; @@ -363,7 +364,7 @@ const std::string& label, const media::AudioParameters& output_parameters, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result); + blink::mojom::MediaStreamRequestResult result); void HandleChangeSourceRequestResponse( const std::string& label, DeviceRequest* request, @@ -449,7 +450,7 @@ void FinalizeGenerateStream(const std::string& label, DeviceRequest* request); void FinalizeRequestFailed(const std::string& label, DeviceRequest* request, - blink::MediaStreamRequestResult result); + blink::mojom::MediaStreamRequestResult result); void FinalizeOpenDevice(const std::string& label, DeviceRequest* request); void FinalizeChangeDevice(const std::string& label, DeviceRequest* request); void FinalizeMediaAccessRequest(const std::string& label,
diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc index 0f6f3a3..bc76d4f 100644 --- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
@@ -259,7 +259,8 @@ [](base::RunLoop* wait_loop, bool request_audio, blink::MediaStreamDevice* audio_device, blink::MediaStreamDevice* video_device, - blink::MediaStreamRequestResult result, const std::string& label, + blink::mojom::MediaStreamRequestResult result, + const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices) { if (request_audio) { @@ -541,7 +542,7 @@ controls.video.stream_type = blink::MEDIA_DISPLAY_VIDEO_CAPTURE; MediaStreamManager::GenerateStreamCallback generate_stream_callback = - base::BindOnce([](blink::MediaStreamRequestResult result, + base::BindOnce([](blink::mojom::MediaStreamRequestResult result, const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices) {}); @@ -584,7 +585,8 @@ MediaStreamManager::GenerateStreamCallback generate_stream_callback = base::BindOnce( [](base::RunLoop* wait_loop, blink::MediaStreamDevice* video_device, - blink::MediaStreamRequestResult result, const std::string& label, + blink::mojom::MediaStreamRequestResult result, + const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices) { EXPECT_EQ(0u, audio_devices.size()); @@ -641,7 +643,8 @@ MediaStreamManager::GenerateStreamCallback generate_stream_callback = base::BindOnce( [](base::RunLoop* wait_loop, blink::MediaStreamDevice* video_device, - blink::MediaStreamRequestResult result, const std::string& label, + blink::mojom::MediaStreamRequestResult result, + const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices) { EXPECT_EQ(0u, audio_devices.size());
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.cc b/content/browser/renderer_host/media/media_stream_ui_proxy.cc index 95000ea..aa663059 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy.cc
@@ -69,11 +69,12 @@ void RequestAccess(std::unique_ptr<MediaStreamRequest> request); void OnStarted(gfx::NativeViewId* window_id, bool has_source_callback); - void ProcessAccessRequestResponse(int render_process_id, - int render_frame_id, - const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, - std::unique_ptr<MediaStreamUI> stream_ui); + void ProcessAccessRequestResponse( + int render_process_id, + int render_frame_id, + const blink::MediaStreamDevices& devices, + blink::mojom::MediaStreamRequestResult result, + std::unique_ptr<MediaStreamUI> stream_ui); private: friend class FakeMediaStreamUIProxy; @@ -117,7 +118,8 @@ if (!render_delegate) { ProcessAccessRequestResponse( request->render_process_id, request->render_frame_id, - blink::MediaStreamDevices(), blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, std::unique_ptr<MediaStreamUI>()); return; } @@ -151,7 +153,7 @@ int render_process_id, int render_frame_id, const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<MediaStreamUI> stream_ui) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -173,8 +175,9 @@ filtered_devices.push_back(device); } - if (filtered_devices.empty() && result == blink::MEDIA_DEVICE_OK) - result = blink::MEDIA_DEVICE_PERMISSION_DENIED; + if (filtered_devices.empty() && + result == blink::mojom::MediaStreamRequestResult::OK) + result = blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; if (stream_ui) ui_ = std::move(stream_ui); @@ -271,7 +274,7 @@ void MediaStreamUIProxy::ProcessAccessRequestResponse( const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result) { + blink::mojom::MediaStreamRequestResult result) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(!response_callback_.is_null()); @@ -333,12 +336,12 @@ // Immediately deny the request. base::PostTaskWithTraits( FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&MediaStreamUIProxy::Core::ProcessAccessRequestResponse, - base::Unretained(core_.get()), - request->render_process_id, request->render_frame_id, - blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_PERMISSION_DENIED, - std::unique_ptr<MediaStreamUI>())); + base::BindOnce( + &MediaStreamUIProxy::Core::ProcessAccessRequestResponse, + base::Unretained(core_.get()), request->render_process_id, + request->render_frame_id, blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, + std::unique_ptr<MediaStreamUI>())); return; } @@ -377,8 +380,9 @@ base::BindOnce(&MediaStreamUIProxy::Core::ProcessAccessRequestResponse, base::Unretained(core_.get()), request->render_process_id, request->render_frame_id, devices_to_use, - devices_to_use.empty() ? blink::MEDIA_DEVICE_NO_HARDWARE - : blink::MEDIA_DEVICE_OK, + devices_to_use.empty() + ? blink::mojom::MediaStreamRequestResult::NO_HARDWARE + : blink::mojom::MediaStreamRequestResult::OK, std::unique_ptr<MediaStreamUI>())); }
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.h b/content/browser/renderer_host/media/media_stream_ui_proxy.h index fe4bbd92..7e92847 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy.h +++ b/content/browser/renderer_host/media/media_stream_ui_proxy.h
@@ -13,6 +13,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/media_stream_request.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "ui/gfx/native_widget_types.h" namespace content { @@ -27,7 +28,7 @@ public: using ResponseCallback = base::OnceCallback<void(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result)>; + blink::mojom::MediaStreamRequestResult result)>; using WindowIdCallback = base::OnceCallback<void(gfx::NativeViewId window_id)>; @@ -65,8 +66,9 @@ friend class Core; friend class FakeMediaStreamUIProxy; - void ProcessAccessRequestResponse(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result); + void ProcessAccessRequestResponse( + const blink::MediaStreamDevices& devices, + blink::mojom::MediaStreamRequestResult result); void ProcessStopRequestFromUI(); void ProcessChangeSourceRequestFromUI(const DesktopMediaID& media_id); void OnWindowId(WindowIdCallback window_id_callback,
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc index aa91c49..4131bd29 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc
@@ -48,7 +48,7 @@ public: MOCK_METHOD2(OnAccessRequestResponse, void(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result)); + blink::mojom::MediaStreamRequestResult result)); MOCK_METHOD1(OnCheckResponse, void(bool have_access)); }; @@ -130,7 +130,7 @@ ASSERT_FALSE(callback.is_null()); blink::MediaStreamDevices devices; - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, std::unique_ptr<MediaStreamUI>()); blink::MediaStreamDevices response; @@ -165,7 +165,8 @@ "Mic", "Mic")); auto ui = std::make_unique<MockMediaStreamUI>(); EXPECT_CALL(*ui, MockOnStarted(_, _)).WillOnce(Return(0)); - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, std::move(ui)); + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); blink::MediaStreamDevices response; EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)) @@ -203,7 +204,8 @@ blink::MediaStreamDevices devices; std::unique_ptr<MediaStreamUI> ui; - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, std::move(ui)); + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); } TEST_F(MediaStreamUIProxyTest, StopFromUI) { @@ -233,7 +235,8 @@ auto ui = std::make_unique<MockMediaStreamUI>(); EXPECT_CALL(*ui, MockOnStarted(_, _)) .WillOnce(testing::DoAll(SaveArg<0>(&stop_callback), Return(0))); - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, std::move(ui)); + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); blink::MediaStreamDevices response; EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)) @@ -278,7 +281,8 @@ auto ui = std::make_unique<MockMediaStreamUI>(); EXPECT_CALL(*ui, MockOnStarted(_, _)).WillOnce(Return(kWindowId)); - std::move(callback).Run(blink::MediaStreamDevices(), blink::MEDIA_DEVICE_OK, + std::move(callback).Run(blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::OK, std::move(ui)); EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)); @@ -321,7 +325,8 @@ auto ui = std::make_unique<MockMediaStreamUI>(); EXPECT_CALL(*ui, MockOnStarted(_, _)) .WillOnce(testing::DoAll(SaveArg<1>(&source_callback), Return(0))); - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, std::move(ui)); + std::move(callback).Run(devices, blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); blink::MediaStreamDevices response; EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)) @@ -374,7 +379,7 @@ void GetResultForRequest(std::unique_ptr<MediaStreamRequest> request, blink::MediaStreamDevices* devices_out, - blink::MediaStreamRequestResult* result_out) { + blink::mojom::MediaStreamRequestResult* result_out) { DCHECK_CURRENTLY_ON(BrowserThread::UI); base::RunLoop run_loop; quit_closure_ = run_loop.QuitClosure(); @@ -412,7 +417,8 @@ blink::MEDIA_DEVICE_VIDEO_CAPTURE, "Camera", "Camera")); } auto ui = std::make_unique<MockMediaStreamUI>(); - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, std::move(ui)); + std::move(callback).Run( + devices, blink::mojom::MediaStreamRequestResult::OK, std::move(ui)); } }; @@ -427,8 +433,9 @@ base::Unretained(this))); } - void FinishedGetResultOnIOThread(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result) { + void FinishedGetResultOnIOThread( + const blink::MediaStreamDevices& devices, + blink::mojom::MediaStreamRequestResult result) { DCHECK_CURRENTLY_ON(BrowserThread::IO); proxy_.reset(); base::PostTaskWithTraits( @@ -438,7 +445,7 @@ } void FinishedGetResult(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result) { + blink::mojom::MediaStreamRequestResult result) { DCHECK_CURRENTLY_ON(BrowserThread::UI); devices_ = devices; result_ = result; @@ -447,7 +454,7 @@ // These should only be accessed on the UI thread. blink::MediaStreamDevices devices_; - blink::MediaStreamRequestResult result_; + blink::mojom::MediaStreamRequestResult result_; base::Closure quit_closure_; // These should only be accessed on the IO thread. @@ -457,14 +464,14 @@ TEST_F(MediaStreamUIProxyFeaturePolicyTest, FeaturePolicy) { blink::MediaStreamDevices devices; - blink::MediaStreamRequestResult result; + blink::mojom::MediaStreamRequestResult result; // Default FP. GetResultForRequest( CreateRequest(main_rfh(), blink::MEDIA_DEVICE_AUDIO_CAPTURE, blink::MEDIA_DEVICE_VIDEO_CAPTURE), &devices, &result); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); ASSERT_EQ(2u, devices.size()); EXPECT_EQ(blink::MEDIA_DEVICE_AUDIO_CAPTURE, devices[0].type); EXPECT_EQ(blink::MEDIA_DEVICE_VIDEO_CAPTURE, devices[1].type); @@ -477,7 +484,7 @@ CreateRequest(main_rfh(), blink::MEDIA_DEVICE_AUDIO_CAPTURE, blink::MEDIA_DEVICE_VIDEO_CAPTURE), &devices, &result); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); ASSERT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_DEVICE_VIDEO_CAPTURE, devices[0].type); @@ -489,7 +496,7 @@ CreateRequest(main_rfh(), blink::MEDIA_DEVICE_AUDIO_CAPTURE, blink::MEDIA_DEVICE_VIDEO_CAPTURE), &devices, &result); - EXPECT_EQ(blink::MEDIA_DEVICE_OK, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result); ASSERT_EQ(1u, devices.size()); EXPECT_EQ(blink::MEDIA_DEVICE_AUDIO_CAPTURE, devices[0].type); @@ -500,7 +507,7 @@ GetResultForRequest(CreateRequest(main_rfh(), blink::MEDIA_NO_SERVICE, blink::MEDIA_DEVICE_VIDEO_CAPTURE), &devices, &result); - EXPECT_EQ(blink::MEDIA_DEVICE_PERMISSION_DENIED, result); + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, result); ASSERT_EQ(0u, devices.size()); }
diff --git a/content/browser/scheduler/browser_task_executor.cc b/content/browser/scheduler/browser_task_executor.cc index d8739b1..71fa381 100644 --- a/content/browser/scheduler/browser_task_executor.cc +++ b/content/browser/scheduler/browser_task_executor.cc
@@ -172,11 +172,10 @@ run_loop.Run(); } -bool BrowserTaskExecutor::PostDelayedTaskWithTraits( - const base::Location& from_here, - const base::TaskTraits& traits, - base::OnceClosure task, - base::TimeDelta delay) { +bool BrowserTaskExecutor::PostDelayedTask(const base::Location& from_here, + const base::TaskTraits& traits, + base::OnceClosure task, + base::TimeDelta delay) { DCHECK_EQ(BrowserTaskTraitsExtension::kExtensionId, traits.extension_id()); const BrowserTaskTraitsExtension& extension = traits.GetExtension<BrowserTaskTraitsExtension>(); @@ -189,19 +188,18 @@ } } -scoped_refptr<base::TaskRunner> BrowserTaskExecutor::CreateTaskRunnerWithTraits( +scoped_refptr<base::TaskRunner> BrowserTaskExecutor::CreateTaskRunner( const base::TaskTraits& traits) { return GetTaskRunner(traits); } scoped_refptr<base::SequencedTaskRunner> -BrowserTaskExecutor::CreateSequencedTaskRunnerWithTraits( - const base::TaskTraits& traits) { +BrowserTaskExecutor::CreateSequencedTaskRunner(const base::TaskTraits& traits) { return GetTaskRunner(traits); } scoped_refptr<base::SingleThreadTaskRunner> -BrowserTaskExecutor::CreateSingleThreadTaskRunnerWithTraits( +BrowserTaskExecutor::CreateSingleThreadTaskRunner( const base::TaskTraits& traits, base::SingleThreadTaskRunnerThreadMode thread_mode) { return GetTaskRunner(traits); @@ -209,7 +207,7 @@ #if defined(OS_WIN) scoped_refptr<base::SingleThreadTaskRunner> -BrowserTaskExecutor::CreateCOMSTATaskRunnerWithTraits( +BrowserTaskExecutor::CreateCOMSTATaskRunner( const base::TaskTraits& traits, base::SingleThreadTaskRunnerThreadMode thread_mode) { return GetTaskRunner(traits);
diff --git a/content/browser/scheduler/browser_task_executor.h b/content/browser/scheduler/browser_task_executor.h index 8e102006..e72e31af 100644 --- a/content/browser/scheduler/browser_task_executor.h +++ b/content/browser/scheduler/browser_task_executor.h
@@ -109,24 +109,23 @@ const base::TaskTraits& traits); // base::TaskExecutor implementation. - bool PostDelayedTaskWithTraits(const base::Location& from_here, - const base::TaskTraits& traits, - base::OnceClosure task, - base::TimeDelta delay) override; + bool PostDelayedTask(const base::Location& from_here, + const base::TaskTraits& traits, + base::OnceClosure task, + base::TimeDelta delay) override; - scoped_refptr<base::TaskRunner> CreateTaskRunnerWithTraits( + scoped_refptr<base::TaskRunner> CreateTaskRunner( const base::TaskTraits& traits) override; - scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( + scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner( const base::TaskTraits& traits) override; - scoped_refptr<base::SingleThreadTaskRunner> - CreateSingleThreadTaskRunnerWithTraits( + scoped_refptr<base::SingleThreadTaskRunner> CreateSingleThreadTaskRunner( const base::TaskTraits& traits, base::SingleThreadTaskRunnerThreadMode thread_mode) override; #if defined(OS_WIN) - scoped_refptr<base::SingleThreadTaskRunner> CreateCOMSTATaskRunnerWithTraits( + scoped_refptr<base::SingleThreadTaskRunner> CreateCOMSTATaskRunner( const base::TaskTraits& traits, base::SingleThreadTaskRunnerThreadMode thread_mode) override; #endif // defined(OS_WIN)
diff --git a/content/browser/site_per_process_unload_browsertest.cc b/content/browser/site_per_process_unload_browsertest.cc index faa0669..639aa942 100644 --- a/content/browser/site_per_process_unload_browsertest.cc +++ b/content/browser/site_per_process_unload_browsertest.cc
@@ -1364,6 +1364,11 @@ RenderFrameHostImpl* A1 = web_contents()->GetMainFrame(); RenderFrameHostImpl* B2 = A1->child_at(0)->current_frame_host(); + // Increase SwapOut/Unload timeout to prevent the previous document from + // being deleleted before it has finished running B2 unload handler. + A1->DisableSwapOutTimerForTesting(); + B2->SetSubframeUnloadTimeoutForTesting(base::TimeDelta::FromSeconds(30)); + // Add an unload handler to the subframe and try in that handler to preserve // state that we will try to recover later. ASSERT_TRUE(ExecJs(B2, R"( @@ -1450,6 +1455,12 @@ RenderFrameHostImpl* B2 = A1->child_at(0)->current_frame_host(); RenderFrameHostImpl* C3 = B2->child_at(0)->current_frame_host(); + // Increase SwapOut/Unload timeout to prevent the previous document from + // being deleleted before it has finished running C3 unload handler. + A1->DisableSwapOutTimerForTesting(); + B2->SetSubframeUnloadTimeoutForTesting(base::TimeDelta::FromSeconds(30)); + C3->SetSubframeUnloadTimeoutForTesting(base::TimeDelta::FromSeconds(30)); + // Add an unload handler to the subframe and try in that handler to preserve // state that we will try to recover later. ASSERT_TRUE(ExecJs(C3, R"( @@ -1494,21 +1505,21 @@ web_contents()->GetController().GoBack(); EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); - RenderFrameHostImpl* A4 = web_contents()->GetMainFrame(); - RenderFrameHostImpl* B5 = A4->child_at(0)->current_frame_host(); - RenderFrameHostImpl* C6 = B5->child_at(0)->current_frame_host(); + RenderFrameHostImpl* A5 = web_contents()->GetMainFrame(); + RenderFrameHostImpl* B6 = A5->child_at(0)->current_frame_host(); + RenderFrameHostImpl* C7 = B6->child_at(0)->current_frame_host(); // Verify that we can recover the data that should have been persisted by the // unload handler. EXPECT_EQ("localstorage_test_value", - EvalJs(C6, "localStorage.localstorage_test_key")); - EXPECT_EQ("cookie_test_key=cookie_test_value", EvalJs(C6, "document.cookie")); + EvalJs(C7, "localStorage.localstorage_test_key")); + EXPECT_EQ("cookie_test_key=cookie_test_value", EvalJs(C7, "document.cookie")); // TODO(lukasza): https://crbug.com/960976: Make the verification below // unconditional, once the bug is fixed. if (!AreAllSitesIsolatedForTesting()) { EXPECT_EQ("history_test_value", - EvalJs(C6, "history.state.history_test_key")); + EvalJs(C7, "history.state.history_test_key")); } }
diff --git a/content/browser/speech/tts_ssml_browsertest.cc b/content/browser/speech/tts_ssml_browsertest.cc index 48dc375..fcfff94f 100644 --- a/content/browser/speech/tts_ssml_browsertest.cc +++ b/content/browser/speech/tts_ssml_browsertest.cc
@@ -6,6 +6,13 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" +// TODO(crbug.com/961029): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_TestStripSSML DISABLED_TestStripSSML +#else +#define MAYBE_TestStripSSML TestStripSSML +#endif + namespace content { namespace { @@ -50,7 +57,7 @@ } // namespace -IN_PROC_BROWSER_TEST_F(TtsSsmlBrowserTest, TestStripSSML) { +IN_PROC_BROWSER_TEST_F(TtsSsmlBrowserTest, MAYBE_TestStripSSML) { // No SSML should be stripped. RunNoStripSSMLTest(""); RunNoStripSSMLTest("What if I told you that 5 < 4?");
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 50d6f67..eec35654 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -154,6 +154,7 @@ #include "third_party/blink/public/common/frame/sandbox_flags.h" #include "third_party/blink/public/common/mime_util/mime_util.h" #include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/web_security_style.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/accessibility/ax_tree_combiner.h" @@ -3094,9 +3095,10 @@ if (delegate_) { delegate_->RequestMediaAccessPermission(this, request, std::move(callback)); } else { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, - std::unique_ptr<MediaStreamUI>()); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, + std::unique_ptr<MediaStreamUI>()); } }
diff --git a/content/public/browser/browser_thread.h b/content/public/browser/browser_thread.h index 4e16864..8ec1c9af 100644 --- a/content/public/browser/browser_thread.h +++ b/content/public/browser/browser_thread.h
@@ -93,29 +93,6 @@ ->ReleaseSoon(from_here, std::move(object)); } - // For use with scheduling non-critical tasks for execution after startup. - // The order or execution of tasks posted here is unspecified even when - // posting to a SequencedTaskRunner and tasks are not guaranteed to be run - // prior to browser shutdown. - // When called after the browser startup is complete, will post |task| - // to |task_runner| immediately. - // Note: see related ContentBrowserClient::PostAfterStartupTask. - // - // TODO(crbug.com/887407): Replace callsites with PostTaskWithTraits and - // appropriate traits (TBD). - // - // DEPRECATED(carlscab): This method is deprecated and will go away soon, - // consider posting the task with priority BEST_EFFORT. For example: - // base::PostTaskWithTraits( - // FROM_HERE, {content::BrowserThread::UI, base::TaskPriority::BEST_EFFORT}, - // base::BindOnce(...)); - // Or if you need to run in a special TaskRunner by using the - // PostBestEffortTask function below - static void PostAfterStartupTask( - const base::Location& from_here, - const scoped_refptr<base::TaskRunner>& task_runner, - base::OnceClosure task); - // Posts a |task| to run at BEST_EFFORT priority using an arbitrary // |task_runner| for which we do not control the priority //
diff --git a/content/public/browser/media_stream_request.h b/content/public/browser/media_stream_request.h index 64a3829..fc1f6b7 100644 --- a/content/public/browser/media_stream_request.h +++ b/content/public/browser/media_stream_request.h
@@ -11,6 +11,7 @@ #include "content/common/content_export.h" #include "content/public/browser/desktop_media_id.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" @@ -103,7 +104,7 @@ // Callback used return results of media access requests. using MediaResponseCallback = base::OnceCallback<void(const blink::MediaStreamDevices& devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<MediaStreamUI> ui)>; } // namespace content
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc index 848f890..5f832d9e 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc
@@ -19,6 +19,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/url_constants.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "ui/gfx/geometry/rect.h" namespace content { @@ -192,7 +193,7 @@ LOG(ERROR) << "WebContentsDelegate::RequestMediaAccessPermission: " << "Not supported."; std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_NOT_SUPPORTED, + blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED, std::unique_ptr<content::MediaStreamUI>()); }
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 6ec9ea9..14b5876 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc
@@ -1003,6 +1003,10 @@ // processes. const char kPpapiSubpixelRenderingSetting[] = "ppapi-subpixel-rendering-setting"; + +// Causes the second GPU process used for gpu info collection to display a +// dialog on launch. +const char kGpu2StartupDialog[] = "gpu2-startup-dialog"; #endif #if defined(ENABLE_IPC_FUZZER)
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 0fcad45..d98d2fea 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h
@@ -287,6 +287,7 @@ CONTENT_EXPORT extern const char kFontCacheSharedHandle[]; CONTENT_EXPORT extern const char kPpapiAntialiasedTextEnabled[]; CONTENT_EXPORT extern const char kPpapiSubpixelRenderingSetting[]; +CONTENT_EXPORT extern const char kGpu2StartupDialog[]; #endif #if defined(ENABLE_IPC_FUZZER)
diff --git a/content/public/test/test_navigation_throttle.h b/content/public/test/test_navigation_throttle.h index c1c92b5..d5115248 100644 --- a/content/public/test/test_navigation_throttle.h +++ b/content/public/test/test_navigation_throttle.h
@@ -35,17 +35,6 @@ ASYNCHRONOUS, }; - struct Status { - Status(ThrottleMethod method, - ResultSynchrony synchrony, - NavigationThrottle::ThrottleCheckResult result) - : method(method), synchrony(synchrony), result(result) {} - - ThrottleMethod method; - ResultSynchrony synchrony; - NavigationThrottle::ThrottleCheckResult result; - }; - TestNavigationThrottle(NavigationHandle* handle); ~TestNavigationThrottle() override;
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index 8250aee0..d31e8c9 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -389,10 +389,6 @@ "p2p/socket_dispatcher.h", "peripheral_content_heuristic.cc", "peripheral_content_heuristic.h", - "push_messaging/push_messaging_client.cc", - "push_messaging/push_messaging_client.h", - "push_messaging/push_messaging_utils.cc", - "push_messaging/push_messaging_utils.h", "queue_message_swap_promise.cc", "queue_message_swap_promise.h", "render_frame_impl.cc",
diff --git a/content/renderer/media/stream/local_media_stream_audio_source.cc b/content/renderer/media/stream/local_media_stream_audio_source.cc index 9f7325a0..56c1b64 100644 --- a/content/renderer/media/stream/local_media_stream_audio_source.cc +++ b/content/renderer/media/stream/local_media_stream_audio_source.cc
@@ -9,6 +9,7 @@ #include "content/renderer/media/audio/audio_device_factory.h" #include "content/renderer/media/webrtc_logging.h" #include "content/renderer/render_frame_impl.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace content { @@ -105,7 +106,7 @@ } void LocalMediaStreamAudioSource::OnCaptureStarted() { - started_callback_.Run(this, blink::MEDIA_DEVICE_OK, ""); + started_callback_.Run(this, blink::mojom::MediaStreamRequestResult::OK, ""); } void LocalMediaStreamAudioSource::Capture(const media::AudioBus* audio_bus,
diff --git a/content/renderer/media/stream/media_stream_video_source_unittest.cc b/content/renderer/media/stream/media_stream_video_source_unittest.cc index d981d7c..d618bff 100644 --- a/content/renderer/media/stream/media_stream_video_source_unittest.cc +++ b/content/renderer/media/stream/media_stream_video_source_unittest.cc
@@ -19,6 +19,7 @@ #include "media/base/limits.h" #include "media/base/video_frame.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h" #include "third_party/blink/public/web/modules/mediastream/video_track_adapter_settings.h" @@ -38,7 +39,7 @@ child_process_(new ChildProcess()), number_of_successful_constraints_applied_(0), number_of_failed_constraints_applied_(0), - result_(blink::MEDIA_DEVICE_OK), + result_(blink::mojom::MediaStreamRequestResult::OK), result_name_(""), mock_source_(new MockMediaStreamVideoSource( media::VideoCaptureFormat(gfx::Size(1280, 720), @@ -124,7 +125,7 @@ return number_of_failed_constraints_applied_; } - blink::MediaStreamRequestResult error_type() const { return result_; } + blink::mojom::MediaStreamRequestResult error_type() const { return result_; } blink::WebString error_name() const { return result_name_; } MockMediaStreamVideoSource* mock_source() { return mock_source_; } @@ -236,11 +237,11 @@ private: void OnConstraintsApplied(blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name) { ASSERT_EQ(source, web_source().GetPlatformSource()); - if (result == blink::MEDIA_DEVICE_OK) { + if (result == blink::mojom::MediaStreamRequestResult::OK) { ++number_of_successful_constraints_applied_; } else { result_ = result; @@ -259,7 +260,7 @@ blink::WebMediaStreamTrack track_to_release_; int number_of_successful_constraints_applied_; int number_of_failed_constraints_applied_; - blink::MediaStreamRequestResult result_; + blink::mojom::MediaStreamRequestResult result_; blink::WebString result_name_; blink::WebMediaStreamSource web_source_; // |mock_source_| is owned by |web_source_|.
diff --git a/content/renderer/media/stream/mock_media_stream_video_source.cc b/content/renderer/media/stream/mock_media_stream_video_source.cc index 09ab6a2..6032421 100644 --- a/content/renderer/media/stream/mock_media_stream_video_source.cc +++ b/content/renderer/media/stream/mock_media_stream_video_source.cc
@@ -8,6 +8,7 @@ #include "base/callback_helpers.h" #include "base/location.h" #include "base/single_thread_task_runner.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace content { @@ -37,13 +38,14 @@ void MockMediaStreamVideoSource::StartMockedSource() { DCHECK(attempted_to_start_); attempted_to_start_ = false; - OnStartDone(blink::MEDIA_DEVICE_OK); + OnStartDone(blink::mojom::MediaStreamRequestResult::OK); } void MockMediaStreamVideoSource::FailToStartMockedSource() { DCHECK(attempted_to_start_); attempted_to_start_ = false; - OnStartDone(blink::MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO); + OnStartDone( + blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO); } void MockMediaStreamVideoSource::RequestRefreshFrame() {
diff --git a/content/renderer/media/stream/mock_mojo_media_stream_dispatcher_host.cc b/content/renderer/media/stream/mock_mojo_media_stream_dispatcher_host.cc index af68f05..92dea2d7 100644 --- a/content/renderer/media/stream/mock_mojo_media_stream_dispatcher_host.cc +++ b/content/renderer/media/stream/mock_mojo_media_stream_dispatcher_host.cc
@@ -5,6 +5,7 @@ #include "content/renderer/media/stream/mock_mojo_media_stream_dispatcher_host.h" #include "base/strings/string_number_conversions.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" namespace content { @@ -56,7 +57,7 @@ if (do_not_run_cb_) { generate_stream_cb_ = std::move(callback); } else { - std::move(callback).Run(blink::MEDIA_DEVICE_OK, + std::move(callback).Run(blink::mojom::MediaStreamRequestResult::OK, "dummy" + base::NumberToString(request_id_), audio_devices_, video_devices_); }
diff --git a/content/renderer/media/stream/processed_local_audio_source.cc b/content/renderer/media/stream/processed_local_audio_source.cc index d87321d..71bf6dfa 100644 --- a/content/renderer/media/stream/processed_local_audio_source.cc +++ b/content/renderer/media/stream/processed_local_audio_source.cc
@@ -21,6 +21,7 @@ #include "media/base/channel_layout.h" #include "media/base/sample_rates.h" #include "media/webrtc/webrtc_switches.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.h" #include "third_party/webrtc/media/base/media_channel.h" @@ -357,7 +358,8 @@ } void ProcessedLocalAudioSource::OnCaptureStarted() { - std::move(started_callback_).Run(this, blink::MEDIA_DEVICE_OK, ""); + std::move(started_callback_) + .Run(this, blink::mojom::MediaStreamRequestResult::OK, ""); } void ProcessedLocalAudioSource::Capture(const media::AudioBus* audio_bus,
diff --git a/content/renderer/media/stream/user_media_client_impl_unittest.cc b/content/renderer/media/stream/user_media_client_impl_unittest.cc index a76827d..c2a41bb 100644 --- a/content/renderer/media/stream/user_media_client_impl_unittest.cc +++ b/content/renderer/media/stream/user_media_client_impl_unittest.cc
@@ -26,6 +26,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/mediastream/media_devices.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_track.h" @@ -343,7 +344,9 @@ return VideoCaptureSettingsForTesting(); } - blink::MediaStreamRequestResult error_reason() const { return result_; } + blink::mojom::MediaStreamRequestResult error_reason() const { + return result_; + } blink::WebString constraint_name() const { return constraint_name_; } // UserMediaProcessor overrides. @@ -403,7 +406,7 @@ } void GetUserMediaRequestFailed( - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& constraint_name) override { last_generated_stream_.Reset(); *state_ = REQUEST_FAILED; @@ -415,7 +418,8 @@ static void SignalSourceReady( blink::WebPlatformMediaStreamSource::ConstraintsOnceCallback source_ready, blink::WebPlatformMediaStreamSource* source) { - std::move(source_ready).Run(source, blink::MEDIA_DEVICE_OK, ""); + std::move(source_ready) + .Run(source, blink::mojom::MediaStreamRequestResult::OK, ""); } PeerConnectionDependencyFactory* factory_; @@ -424,7 +428,8 @@ MockLocalMediaStreamAudioSource* local_audio_source_ = nullptr; bool create_source_that_fails_ = false; blink::WebMediaStream last_generated_stream_; - blink::MediaStreamRequestResult result_ = blink::NUM_MEDIA_REQUEST_RESULTS; + blink::mojom::MediaStreamRequestResult result_ = + blink::mojom::MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS; blink::WebString constraint_name_; RequestState* state_; }; @@ -804,7 +809,7 @@ FailToStartMockedVideoSource(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(REQUEST_FAILED, request_state()); - EXPECT_EQ(blink::MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO, + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO, user_media_processor_->error_reason()); blink::WebHeap::CollectAllGarbageForTesting(); EXPECT_EQ(1, mock_dispatcher_host_.request_stream_counter()); @@ -819,7 +824,7 @@ StartMockedVideoSource(); base::RunLoop().RunUntilIdle(); EXPECT_EQ(REQUEST_FAILED, request_state()); - EXPECT_EQ(blink::MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO, + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO, user_media_processor_->error_reason()); blink::WebHeap::CollectAllGarbageForTesting(); EXPECT_EQ(1, mock_dispatcher_host_.request_stream_counter());
diff --git a/content/renderer/media/stream/user_media_processor.cc b/content/renderer/media/stream/user_media_processor.cc index fd70cdb2..feea0e1 100644 --- a/content/renderer/media/stream/user_media_processor.cc +++ b/content/renderer/media/stream/user_media_processor.cc
@@ -54,11 +54,11 @@ using blink::MediaStreamDevice; using blink::MediaStreamDevices; -using blink::MediaStreamRequestResult; using blink::MediaStreamType; using blink::StreamControls; using blink::TrackControls; using blink::WebMediaStreamSource; +using blink::mojom::MediaStreamRequestResult; using EchoCancellationType = blink::AudioProcessingProperties::EchoCancellationType; @@ -339,7 +339,7 @@ StreamControls stream_controls_; const url::Origin security_origin_; ResourcesReady ready_callback_; - MediaStreamRequestResult request_result_ = blink::MEDIA_DEVICE_OK; + MediaStreamRequestResult request_result_ = MediaStreamRequestResult::OK; blink::WebString request_result_name_; // Sources used in this request. std::vector<blink::WebMediaStreamSource> sources_; @@ -375,8 +375,9 @@ bool connected = native_source->ConnectToTrack(track); if (!is_pending) { OnTrackStarted(native_source, - connected ? blink::MEDIA_DEVICE_OK - : blink::MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO, + connected + ? MediaStreamRequestResult::OK + : MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO, ""); } } @@ -418,7 +419,7 @@ sources_waiting_for_callback_.erase(it); // All tracks must be started successfully. Otherwise the request is a // failure. - if (result != blink::MEDIA_DEVICE_OK) { + if (result != MediaStreamRequestResult::OK) { request_result_ = result; request_result_name_ = result_name; } @@ -513,7 +514,7 @@ .Basic() .media_stream_source.GetName()); MediaStreamRequestResult result = - blink::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED; + MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } @@ -571,8 +572,8 @@ blink::WebString::FromASCII(settings.failed_constraint_name()); MediaStreamRequestResult result = failed_constraint_name.IsEmpty() - ? blink::MEDIA_DEVICE_NO_HARDWARE - : blink::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED; + ? MediaStreamRequestResult::NO_HARDWARE + : MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } @@ -616,7 +617,7 @@ .Basic() .media_stream_source.GetName()); MediaStreamRequestResult result = - blink::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED; + MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } @@ -655,8 +656,8 @@ blink::WebString::FromASCII(settings.failed_constraint_name()); MediaStreamRequestResult result = failed_constraint_name.IsEmpty() - ? blink::MEDIA_DEVICE_NO_HARDWARE - : blink::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED; + ? MediaStreamRequestResult::NO_HARDWARE + : MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } @@ -679,8 +680,9 @@ blink::WebString failed_constraint_name = blink::WebString::FromASCII(settings.failed_constraint_name()); DCHECK(!failed_constraint_name.IsEmpty()); - GetUserMediaRequestFailed(blink::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED, - failed_constraint_name); + GetUserMediaRequestFailed( + MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED, + failed_constraint_name); return; } if (current_request_info_->stream_controls()->video.stream_type != @@ -723,7 +725,7 @@ const MediaStreamDevices& video_devices) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (result != blink::MEDIA_DEVICE_OK) { + if (result != MediaStreamRequestResult::OK) { OnStreamGenerationFailed(request_id, result); return; } @@ -845,7 +847,7 @@ it->GetPlatformSource(); if (source_extra_data != source) continue; - if (result == blink::MEDIA_DEVICE_OK) + if (result == MediaStreamRequestResult::OK) local_sources_.push_back((*it)); pending_local_sources_.erase(it); @@ -1159,7 +1161,7 @@ MediaStreamRequestResult result, const blink::WebString& constraint_name) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (result == blink::MEDIA_DEVICE_OK) { + if (result == MediaStreamRequestResult::OK) { GetUserMediaRequestSucceeded(*request_info->web_stream(), request_info->web_request()); GetMediaStreamDispatcherHost()->OnStreamStarted(label); @@ -1206,7 +1208,7 @@ const blink::WebMediaStream& stream, blink::WebUserMediaRequest web_request) { DVLOG(1) << "UserMediaProcessor::DelayedGetUserMediaRequestSucceeded"; - LogUserMediaRequestResult(blink::MEDIA_DEVICE_OK); + blink::LogUserMediaRequestResult(MediaStreamRequestResult::OK); DeleteWebRequest(web_request); web_request.RequestSucceeded(stream); } @@ -1235,75 +1237,75 @@ blink::WebUserMediaRequest web_request, MediaStreamRequestResult result, const blink::WebString& constraint_name) { - LogUserMediaRequestResult(result); + blink::LogUserMediaRequestResult(result); DeleteWebRequest(web_request); switch (result) { - case blink::MEDIA_DEVICE_OK: - case blink::NUM_MEDIA_REQUEST_RESULTS: + case MediaStreamRequestResult::OK: + case MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS: NOTREACHED(); return; - case blink::MEDIA_DEVICE_PERMISSION_DENIED: + case MediaStreamRequestResult::PERMISSION_DENIED: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kPermissionDenied, "Permission denied"); return; - case blink::MEDIA_DEVICE_PERMISSION_DISMISSED: + case MediaStreamRequestResult::PERMISSION_DISMISSED: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kPermissionDismissed, "Permission dismissed"); return; - case blink::MEDIA_DEVICE_INVALID_STATE: + case MediaStreamRequestResult::INVALID_STATE: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kInvalidState, "Invalid state"); return; - case blink::MEDIA_DEVICE_NO_HARDWARE: + case MediaStreamRequestResult::NO_HARDWARE: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kDevicesNotFound, "Requested device not found"); return; - case blink::MEDIA_DEVICE_INVALID_SECURITY_ORIGIN: + case MediaStreamRequestResult::INVALID_SECURITY_ORIGIN: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kSecurityError, "Invalid security origin"); return; - case blink::MEDIA_DEVICE_TAB_CAPTURE_FAILURE: + case MediaStreamRequestResult::TAB_CAPTURE_FAILURE: web_request.RequestFailed(blink::WebUserMediaRequest::Error::kTabCapture, "Error starting tab capture"); return; - case blink::MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE: + case MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kScreenCapture, "Error starting screen capture"); return; - case blink::MEDIA_DEVICE_CAPTURE_FAILURE: + case MediaStreamRequestResult::CAPTURE_FAILURE: web_request.RequestFailed(blink::WebUserMediaRequest::Error::kCapture, "Error starting capture"); return; - case blink::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED: + case MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED: web_request.RequestFailedConstraint(constraint_name); return; - case blink::MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO: + case MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO: web_request.RequestFailed(blink::WebUserMediaRequest::Error::kTrackStart, "Could not start audio source"); return; - case blink::MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO: + case MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO: web_request.RequestFailed(blink::WebUserMediaRequest::Error::kTrackStart, "Could not start video source"); return; - case blink::MEDIA_DEVICE_NOT_SUPPORTED: + case MediaStreamRequestResult::NOT_SUPPORTED: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kNotSupported, "Not supported"); return; - case blink::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN: + case MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kFailedDueToShutdown, "Failed due to shutdown"); return; - case blink::MEDIA_DEVICE_KILL_SWITCH_ON: + case MediaStreamRequestResult::KILL_SWITCH_ON: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kKillSwitchOn); return; - case blink::MEDIA_DEVICE_SYSTEM_PERMISSION_DENIED: + case MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED: web_request.RequestFailed( blink::WebUserMediaRequest::Error::kSystemPermissionDenied, "Permission denied by system"); @@ -1376,8 +1378,8 @@ source.GetType() == blink::WebMediaStreamSource::kTypeAudio; NotifyCurrentRequestInfoOfAudioSourceStarted( source_extra_data, - is_audio_source ? blink::MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO - : blink::MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO, + is_audio_source ? MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO + : MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO, blink::WebString::FromUTF8( is_audio_source ? "Failed to access audio capture device" : "Failed to access video capture device"));
diff --git a/content/renderer/media/stream/user_media_processor.h b/content/renderer/media/stream/user_media_processor.h index 9ad4df2..44ba2f4 100644 --- a/content/renderer/media/stream/user_media_processor.h +++ b/content/renderer/media/stream/user_media_processor.h
@@ -18,6 +18,7 @@ #include "content/common/content_export.h" #include "content/renderer/media/stream/media_stream_dispatcher_eventhandler.h" #include "third_party/blink/public/mojom/mediastream/media_devices.mojom.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" #include "third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h" #include "third_party/blink/public/platform/web_vector.h" @@ -126,7 +127,7 @@ const blink::WebMediaStream& stream, blink::WebUserMediaRequest web_request); virtual void GetUserMediaRequestFailed( - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& constraint_name = blink::WebString()); // Creates a MediaStreamAudioSource/MediaStreamVideoSource objects. @@ -149,7 +150,7 @@ using LocalStreamSources = std::vector<blink::WebMediaStreamSource>; void OnStreamGenerated(int request_id, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const std::string& label, const blink::MediaStreamDevices& audio_devices, const blink::MediaStreamDevices& video_devices); @@ -163,7 +164,7 @@ gfx::Size GetScreenSize(); void OnStreamGenerationFailed(int request_id, - blink::MediaStreamRequestResult result); + blink::mojom::MediaStreamRequestResult result); bool IsCurrentRequestInfo(int request_id) const; bool IsCurrentRequestInfo( @@ -173,7 +174,7 @@ blink::WebUserMediaRequest web_request); void DelayedGetUserMediaRequestFailed( blink::WebUserMediaRequest web_request, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& constraint_name); // Called when |source| has been stopped from JavaScript. @@ -200,10 +201,11 @@ // Callback function triggered when all native versions of the // underlying media sources and tracks have been created and started. - void OnCreateNativeTracksCompleted(const std::string& label, - RequestInfo* request, - blink::MediaStreamRequestResult result, - const blink::WebString& result_name); + void OnCreateNativeTracksCompleted( + const std::string& label, + RequestInfo* request, + blink::mojom::MediaStreamRequestResult result, + const blink::WebString& result_name); void OnStreamGeneratedForCancelledRequest( const blink::MediaStreamDevices& audio_devices, @@ -213,16 +215,16 @@ scoped_refptr<base::SingleThreadTaskRunner> task_runner, base::WeakPtr<UserMediaProcessor> weak_ptr, blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name); void OnAudioSourceStarted(blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name); void NotifyCurrentRequestInfoOfAudioSourceStarted( blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name); void DeleteAllUserMediaRequests();
diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source.cc b/content/renderer/media/webrtc/media_stream_remote_video_source.cc index b2ce120..292d5b2 100644 --- a/content/renderer/media/webrtc/media_stream_remote_video_source.cc +++ b/content/renderer/media/webrtc/media_stream_remote_video_source.cc
@@ -18,6 +18,7 @@ #include "media/base/timestamp_constants.h" #include "media/base/video_frame.h" #include "media/base/video_util.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/webrtc/api/video/i420_buffer.h" #include "third_party/webrtc/api/video/video_sink_interface.h" #include "third_party/webrtc/rtc_base/time_utils.h" // for TimeMicros @@ -232,7 +233,7 @@ scoped_refptr<webrtc::VideoTrackInterface> video_track( static_cast<webrtc::VideoTrackInterface*>(observer_->track().get())); video_track->AddOrUpdateSink(delegate_.get(), rtc::VideoSinkWants()); - OnStartDone(blink::MEDIA_DEVICE_OK); + OnStartDone(blink::mojom::MediaStreamRequestResult::OK); } void MediaStreamRemoteVideoSource::StopSourceImpl() {
diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc b/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc index 93aff41..3b9cf19 100644 --- a/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc +++ b/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc
@@ -20,6 +20,7 @@ #include "content/renderer/media/webrtc/track_observer.h" #include "media/base/video_frame.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h" #include "third_party/blink/public/web/web_heap.h" @@ -140,10 +141,10 @@ private: void OnTrackStarted(blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name) { ASSERT_EQ(source, remote_source_); - if (result == blink::MEDIA_DEVICE_OK) + if (result == blink::mojom::MediaStreamRequestResult::OK) ++number_of_successful_track_starts_; else ++number_of_failed_track_starts_;
diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.cc b/content/renderer/pepper/pepper_media_stream_video_track_host.cc index 12f0d7a..a3cc483 100644 --- a/content/renderer/pepper/pepper_media_stream_video_track_host.cc +++ b/content/renderer/pepper/pepper_media_stream_video_track_host.cc
@@ -515,7 +515,7 @@ void PepperMediaStreamVideoTrackHost::OnTrackStarted( blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name) { DVLOG(3) << "OnTrackStarted result: " << result; }
diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.h b/content/renderer/pepper/pepper_media_stream_video_track_host.h index 1a13dfc..1b61aaa8 100644 --- a/content/renderer/pepper/pepper_media_stream_video_track_host.h +++ b/content/renderer/pepper/pepper_media_stream_video_track_host.h
@@ -15,6 +15,7 @@ #include "ppapi/c/ppb_video_frame.h" #include "ppapi/shared_impl/media_stream_video_track_shared.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/web_media_stream_track.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_sink.h" #include "ui/gfx/geometry/size.h" @@ -83,7 +84,7 @@ void InitBlinkTrack(); void OnTrackStarted(blink::WebPlatformMediaStreamSource* source, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, const blink::WebString& result_name); blink::WebMediaStreamTrack track_;
diff --git a/content/renderer/push_messaging/push_messaging_client.cc b/content/renderer/push_messaging/push_messaging_client.cc deleted file mode 100644 index 6961f408..0000000 --- a/content/renderer/push_messaging/push_messaging_client.cc +++ /dev/null
@@ -1,153 +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 "content/renderer/push_messaging/push_messaging_client.h" - -#include <memory> -#include <utility> - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/strings/utf_string_conversions.h" -#include "content/child/child_thread_impl.h" -#include "content/public/common/service_names.mojom.h" -#include "content/renderer/push_messaging/push_messaging_utils.h" -#include "content/renderer/render_frame_impl.h" -#include "services/service_manager/public/cpp/connector.h" -#include "third_party/blink/public/common/push_messaging/web_push_subscription_options.h" -#include "third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom.h" -#include "third_party/blink/public/platform/modules/push_messaging/web_push_error.h" -#include "third_party/blink/public/platform/modules/push_messaging/web_push_subscription.h" -#include "third_party/blink/public/platform/web_string.h" -#include "third_party/blink/public/web/web_console_message.h" -#include "third_party/blink/public/web/web_local_frame.h" -#include "third_party/blink/public/web/web_manifest_manager.h" -#include "url/gurl.h" - -namespace content { - -PushMessagingClient::PushMessagingClient(RenderFrame* render_frame) - : RenderFrameObserver(render_frame) { - if (ChildThreadImpl::current()) { - // See https://bit.ly/2S0zRAS for task types. - ChildThreadImpl::current()->GetConnector()->BindInterface( - mojom::kBrowserServiceName, - mojo::MakeRequest( - &push_messaging_manager_, - render_frame->GetTaskRunner(blink::TaskType::kMiscPlatformAPI))); - } -} - -PushMessagingClient::~PushMessagingClient() {} - -void PushMessagingClient::OnDestruct() { - delete this; -} - -void PushMessagingClient::Subscribe( - int64_t service_worker_registration_id, - const blink::WebPushSubscriptionOptions& options, - bool user_gesture, - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks) { - DCHECK(callbacks); - - // If a developer provided an application server key in |options|, skip - // fetching the manifest. - if (options.application_server_key.empty()) { - blink::WebManifestManager* manifest_manager = - blink::WebManifestManager::FromFrame( - RenderFrameImpl::FromRoutingID(routing_id())->GetWebFrame()); - manifest_manager->RequestManifest( - base::BindOnce(&PushMessagingClient::DidGetManifest, - base::Unretained(this), service_worker_registration_id, - options, user_gesture, std::move(callbacks))); - } else { - blink::WebPushSubscriptionOptions content_options; - content_options.user_visible_only = options.user_visible_only; - // Just treat the server key as a string of bytes and pass it to the push - // service. - content_options.application_server_key = options.application_server_key; - DoSubscribe(service_worker_registration_id, content_options, user_gesture, - std::move(callbacks)); - } -} - -void PushMessagingClient::DidGetManifest( - int64_t service_worker_registration_id, - const blink::WebPushSubscriptionOptions& options, - bool user_gesture, - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks, - const blink::WebURL& manifest_url, - const blink::Manifest& manifest) { - // Get the application_server_key from the manifest since it wasn't provided - // by the caller. - if (manifest.IsEmpty()) { - DidSubscribe( - std::move(callbacks), - blink::mojom::PushRegistrationStatus::MANIFEST_EMPTY_OR_MISSING, - base::nullopt, base::nullopt, base::nullopt, base::nullopt); - return; - } - - blink::WebPushSubscriptionOptions content_options; - content_options.user_visible_only = options.user_visible_only; - if (!manifest.gcm_sender_id.is_null()) { - content_options.application_server_key = - base::UTF16ToUTF8(manifest.gcm_sender_id.string()); - } - - DoSubscribe(service_worker_registration_id, content_options, user_gesture, - std::move(callbacks)); -} - -void PushMessagingClient::DoSubscribe( - int64_t service_worker_registration_id, - const blink::WebPushSubscriptionOptions& options, - bool user_gesture, - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks) { - if (options.application_server_key.empty()) { - DidSubscribe(std::move(callbacks), - blink::mojom::PushRegistrationStatus::NO_SENDER_ID, - base::nullopt, base::nullopt, base::nullopt, base::nullopt); - return; - } - - DCHECK(push_messaging_manager_); - push_messaging_manager_->Subscribe( - routing_id(), service_worker_registration_id, options, user_gesture, - // Safe to use base::Unretained because |push_messaging_manager_ |is - // owned by |this|. - base::BindOnce(&PushMessagingClient::DidSubscribe, base::Unretained(this), - std::move(callbacks))); -} - -void PushMessagingClient::DidSubscribe( - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks, - blink::mojom::PushRegistrationStatus status, - const base::Optional<GURL>& endpoint, - const base::Optional<blink::WebPushSubscriptionOptions>& options, - const base::Optional<std::vector<uint8_t>>& p256dh, - const base::Optional<std::vector<uint8_t>>& auth) { - DCHECK(callbacks); - - if (status == - blink::mojom::PushRegistrationStatus::SUCCESS_FROM_PUSH_SERVICE || - status == blink::mojom::PushRegistrationStatus:: - SUCCESS_NEW_SUBSCRIPTION_FROM_PUSH_SERVICE || - status == blink::mojom::PushRegistrationStatus::SUCCESS_FROM_CACHE) { - DCHECK(endpoint); - DCHECK(options); - DCHECK(p256dh); - DCHECK(auth); - - callbacks->OnSuccess(std::make_unique<blink::WebPushSubscription>( - endpoint.value(), options.value().user_visible_only, - blink::WebString::FromLatin1(options.value().application_server_key), - p256dh.value(), auth.value())); - } else { - callbacks->OnError(PushRegistrationStatusToWebPushError(status)); - } -} - -} // namespace content
diff --git a/content/renderer/push_messaging/push_messaging_client.h b/content/renderer/push_messaging/push_messaging_client.h deleted file mode 100644 index 94f8452..0000000 --- a/content/renderer/push_messaging/push_messaging_client.h +++ /dev/null
@@ -1,81 +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 CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_CLIENT_H_ -#define CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_CLIENT_H_ - -#include <stdint.h> - -#include <memory> -#include <string> -#include <vector> - -#include "base/macros.h" -#include "content/public/renderer/render_frame_observer.h" -#include "third_party/blink/public/mojom/manifest/manifest.mojom.h" -#include "third_party/blink/public/mojom/push_messaging/push_messaging.mojom.h" -#include "third_party/blink/public/platform/modules/push_messaging/web_push_client.h" - -class GURL; - -namespace blink { - -namespace mojom { -enum class PushRegistrationStatus; -} - -struct Manifest; -struct WebPushSubscriptionOptions; -struct WebPushSubscriptionOptions; -} // namespace blink - -namespace content { - -class PushMessagingClient : public RenderFrameObserver, - public blink::WebPushClient { - public: - explicit PushMessagingClient(RenderFrame* render_frame); - ~PushMessagingClient() override; - - private: - // RenderFrameObserver implementation. - void OnDestruct() override; - - // WebPushClient implementation. - void Subscribe( - int64_t service_worker_registration_id, - const blink::WebPushSubscriptionOptions& options, - bool user_gesture, - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks) override; - - void DidGetManifest( - int64_t service_worker_registration_id, - const blink::WebPushSubscriptionOptions& options, - bool user_gesture, - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks, - const blink::WebURL& manifest_url, - const blink::Manifest& manifest); - - void DoSubscribe( - int64_t service_worker_registration_id, - const blink::WebPushSubscriptionOptions& options, - bool user_gesture, - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks); - - void DidSubscribe( - std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks, - blink::mojom::PushRegistrationStatus status, - const base::Optional<GURL>& endpoint, - const base::Optional<blink::WebPushSubscriptionOptions>& options, - const base::Optional<std::vector<uint8_t>>& p256dh, - const base::Optional<std::vector<uint8_t>>& auth); - - blink::mojom::PushMessagingPtr push_messaging_manager_; - - DISALLOW_COPY_AND_ASSIGN(PushMessagingClient); -}; - -} // namespace content - -#endif // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_CLIENT_H_
diff --git a/content/renderer/push_messaging/push_messaging_utils.cc b/content/renderer/push_messaging/push_messaging_utils.cc deleted file mode 100644 index 9b6bc81d..0000000 --- a/content/renderer/push_messaging/push_messaging_utils.cc +++ /dev/null
@@ -1,115 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/renderer/push_messaging/push_messaging_utils.h" - -#include "content/public/common/service_names.mojom.h" -#include "third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom.h" -#include "third_party/blink/public/platform/web_string.h" - -namespace content { - -namespace { - -const char* PushRegistrationStatusToString( - blink::mojom::PushRegistrationStatus status) { - switch (status) { - case blink::mojom::PushRegistrationStatus::SUCCESS_FROM_PUSH_SERVICE: - case blink::mojom::PushRegistrationStatus:: - SUCCESS_NEW_SUBSCRIPTION_FROM_PUSH_SERVICE: - return "Registration successful - from push service"; - - case blink::mojom::PushRegistrationStatus::NO_SERVICE_WORKER: - return "Registration failed - no Service Worker"; - - case blink::mojom::PushRegistrationStatus::SERVICE_NOT_AVAILABLE: - return "Registration failed - push service not available"; - - case blink::mojom::PushRegistrationStatus::LIMIT_REACHED: - return "Registration failed - registration limit has been reached"; - - case blink::mojom::PushRegistrationStatus::PERMISSION_DENIED: - return "Registration failed - permission denied"; - - case blink::mojom::PushRegistrationStatus::SERVICE_ERROR: - return "Registration failed - push service error"; - - case blink::mojom::PushRegistrationStatus::NO_SENDER_ID: - return "Registration failed - missing applicationServerKey, and " - "gcm_sender_id not found in manifest"; - - case blink::mojom::PushRegistrationStatus::STORAGE_ERROR: - return "Registration failed - storage error"; - - case blink::mojom::PushRegistrationStatus::SUCCESS_FROM_CACHE: - return "Registration successful - from cache"; - - case blink::mojom::PushRegistrationStatus::NETWORK_ERROR: - return "Registration failed - could not connect to push server"; - - case blink::mojom::PushRegistrationStatus::INCOGNITO_PERMISSION_DENIED: - // We split this out for UMA, but it must be indistinguishable to JS. - return PushRegistrationStatusToString( - blink::mojom::PushRegistrationStatus::PERMISSION_DENIED); - - case blink::mojom::PushRegistrationStatus::PUBLIC_KEY_UNAVAILABLE: - return "Registration failed - could not retrieve the public key"; - - case blink::mojom::PushRegistrationStatus::MANIFEST_EMPTY_OR_MISSING: - return "Registration failed - missing applicationServerKey, and manifest " - "empty or missing"; - - case blink::mojom::PushRegistrationStatus::SENDER_ID_MISMATCH: - return "Registration failed - A subscription with a different " - "applicationServerKey (or gcm_sender_id) already exists; to " - "change the applicationServerKey, unsubscribe then resubscribe."; - - case blink::mojom::PushRegistrationStatus::STORAGE_CORRUPT: - return "Registration failed - storage corrupt"; - - case blink::mojom::PushRegistrationStatus::RENDERER_SHUTDOWN: - return "Registration failed - renderer shutdown"; - } - NOTREACHED(); - return ""; -} - -} // namespace - -blink::WebPushError PushRegistrationStatusToWebPushError( - blink::mojom::PushRegistrationStatus status) { - blink::WebPushError::ErrorType error_type = - blink::WebPushError::kErrorTypeAbort; - switch (status) { - case blink::mojom::PushRegistrationStatus::PERMISSION_DENIED: - error_type = blink::WebPushError::kErrorTypeNotAllowed; - break; - case blink::mojom::PushRegistrationStatus::SENDER_ID_MISMATCH: - error_type = blink::WebPushError::kErrorTypeInvalidState; - break; - case blink::mojom::PushRegistrationStatus::SUCCESS_FROM_PUSH_SERVICE: - case blink::mojom::PushRegistrationStatus:: - SUCCESS_NEW_SUBSCRIPTION_FROM_PUSH_SERVICE: - case blink::mojom::PushRegistrationStatus::NO_SERVICE_WORKER: - case blink::mojom::PushRegistrationStatus::SERVICE_NOT_AVAILABLE: - case blink::mojom::PushRegistrationStatus::LIMIT_REACHED: - case blink::mojom::PushRegistrationStatus::SERVICE_ERROR: - case blink::mojom::PushRegistrationStatus::NO_SENDER_ID: - case blink::mojom::PushRegistrationStatus::STORAGE_ERROR: - case blink::mojom::PushRegistrationStatus::SUCCESS_FROM_CACHE: - case blink::mojom::PushRegistrationStatus::NETWORK_ERROR: - case blink::mojom::PushRegistrationStatus::INCOGNITO_PERMISSION_DENIED: - case blink::mojom::PushRegistrationStatus::PUBLIC_KEY_UNAVAILABLE: - case blink::mojom::PushRegistrationStatus::MANIFEST_EMPTY_OR_MISSING: - case blink::mojom::PushRegistrationStatus::STORAGE_CORRUPT: - case blink::mojom::PushRegistrationStatus::RENDERER_SHUTDOWN: - error_type = blink::WebPushError::kErrorTypeAbort; - break; - } - return blink::WebPushError( - error_type, - blink::WebString::FromUTF8(PushRegistrationStatusToString(status))); -} - -} // namespace content
diff --git a/content/renderer/push_messaging/push_messaging_utils.h b/content/renderer/push_messaging/push_messaging_utils.h deleted file mode 100644 index 40b0cee..0000000 --- a/content/renderer/push_messaging/push_messaging_utils.h +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_UTILS_H_ -#define CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_UTILS_H_ - -#include "third_party/blink/public/platform/modules/push_messaging/web_push_error.h" - -namespace blink { - -namespace mojom { -enum class PushRegistrationStatus; -} // namespace mojom - -} // namespace blink - -namespace content { - -blink::WebPushError PushRegistrationStatusToWebPushError( - blink::mojom::PushRegistrationStatus status); - -} // namespace content - -#endif // CONTENT_RENDERER_PUSH_MESSAGING_PUSH_MESSAGING_UTILS_H_
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index a5cdbd9..7b982df 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -132,7 +132,6 @@ #include "content/renderer/navigation_state.h" #include "content/renderer/pepper/pepper_audio_controller.h" #include "content/renderer/pepper/plugin_instance_throttler_impl.h" -#include "content/renderer/push_messaging/push_messaging_client.h" #include "content/renderer/render_frame_proxy.h" #include "content/renderer/render_process.h" #include "content/renderer/render_thread_impl.h" @@ -1805,7 +1804,6 @@ selection_range_(gfx::Range::InvalidRange()), handling_select_range_(false), web_user_media_client_(nullptr), - push_messaging_client_(nullptr), render_accessibility_(nullptr), previews_state_(PREVIEWS_UNSPECIFIED), effective_connection_type_( @@ -5562,12 +5560,6 @@ observer.DidChangeScrollOffset(); } -blink::WebPushClient* RenderFrameImpl::PushClient() { - if (!push_messaging_client_) - push_messaging_client_ = new PushMessagingClient(this); - return push_messaging_client_; -} - void RenderFrameImpl::WillStartUsingPeerConnectionHandler( blink::WebRTCPeerConnectionHandler* handler) { static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame_); @@ -6501,14 +6493,14 @@ return; } - // Navigation to about:blank, about:srcdoc or to an MHTML archive don't need - // to consult the browser. The document content is already available in the - // renderer process. + // Navigation to about:blank or to about:srcdoc don't need to consult the + // browser. The document content is already available in the renderer + // process. // TODO(arthursonzogni): Remove this. Everything should use the default code // path and be driven by the browser process. - if (use_archive || (((url == content::kAboutSrcDocURL) || - WebDocumentLoader::WillLoadUrlAsEmpty(url)) && - !is_history_navigation_in_new_child_frame)) { + if (((url == content::kAboutSrcDocURL) || + WebDocumentLoader::WillLoadUrlAsEmpty(url)) && + !is_history_navigation_in_new_child_frame) { if (!frame_->WillStartNavigation( *info, false /* is_history_navigation_in_new_child_frame */)) return;
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 97c4024..c3c439b 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -119,7 +119,6 @@ class WebElement; class WebLayerTreeView; class WebLocalFrame; -class WebPushClient; class WebSecurityOrigin; class WebString; class WebURL; @@ -163,7 +162,6 @@ class MediaStreamDeviceObserver; class NavigationClient; class PepperPluginInstanceImpl; -class PushMessagingClient; class RenderAccessibilityImpl; class RendererPpapiHost; class RenderFrameObserver; @@ -824,7 +822,6 @@ void WillReleaseScriptContext(v8::Local<v8::Context> context, int world_id) override; void DidChangeScrollOffset() override; - blink::WebPushClient* PushClient() override; void WillStartUsingPeerConnectionHandler( blink::WebRTCPeerConnectionHandler* handler) override; blink::WebUserMediaClient* UserMediaClient() override; @@ -1585,9 +1582,6 @@ // The media permission dispatcher attached to this frame. std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_; - // The PushMessagingClient attached to this frame, lazily initialized. - PushMessagingClient* push_messaging_client_; - service_manager::BinderRegistry registry_; service_manager::InterfaceProvider remote_interfaces_; std::unique_ptr<BlinkInterfaceRegistryImpl> blink_interface_registry_; @@ -1756,7 +1750,6 @@ // Used by renderer initiated navigations not driven by the browser process: // - navigation to about:blank. // - navigation to about:srcdoc. - // - navigation using an MHTML archive. // TODO(arthursonzogni): Remove this. Everything should use the default code // path and be driven by the browser process. base::CancelableOnceCallback<void()> sync_navigation_callback_;
diff --git a/device/bluetooth/bluetooth_adapter_unittest.cc b/device/bluetooth/bluetooth_adapter_unittest.cc index 78c66a00..3b27496 100644 --- a/device/bluetooth/bluetooth_adapter_unittest.cc +++ b/device/bluetooth/bluetooth_adapter_unittest.cc
@@ -43,6 +43,24 @@ #include "device/bluetooth/test/bluetooth_test_fuchsia.h" #endif +// TODO(crbug.com/969160): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_GetMergedDiscoveryFilterTransport \ + DISABLED_GetMergedDiscoveryFilterTransport +#define MAYBE_GetMergedDiscoveryFilterRegular \ + DISABLED_GetMergedDiscoveryFilterRegular +#define MAYBE_GetMergedDiscoveryFilterRssi DISABLED_GetMergedDiscoveryFilterRssi +#define MAYBE_GetMergedDiscoveryFilterAllFields \ + DISABLED_GetMergedDiscoveryFilterAllFields +#else +#define MAYBE_GetMergedDiscoveryFilterTransport \ + GetMergedDiscoveryFilterTransport +#define MAYBE_GetMergedDiscoveryFilterRegular GetMergedDiscoveryFilterRegular +#define MAYBE_GetMergedDiscoveryFilterRssi GetMergedDiscoveryFilterRssi +#define MAYBE_GetMergedDiscoveryFilterAllFields \ + GetMergedDiscoveryFilterAllFields +#endif + using device::BluetoothDevice; namespace device { @@ -262,7 +280,7 @@ EXPECT_TRUE(discovery_filter.get() == nullptr); } -TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRegular) { +TEST(BluetoothAdapterTest, MAYBE_GetMergedDiscoveryFilterRegular) { scoped_refptr<TestBluetoothAdapter> adapter = new TestBluetoothAdapter(); std::unique_ptr<BluetoothDiscoveryFilter> discovery_filter; @@ -281,7 +299,7 @@ adapter->CleanupSessions(); } -TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) { +TEST(BluetoothAdapterTest, MAYBE_GetMergedDiscoveryFilterRssi) { scoped_refptr<TestBluetoothAdapter> adapter = new TestBluetoothAdapter(); int16_t resulting_rssi; uint16_t resulting_pathloss; @@ -342,7 +360,7 @@ adapter->CleanupSessions(); } -TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterTransport) { +TEST(BluetoothAdapterTest, MAYBE_GetMergedDiscoveryFilterTransport) { scoped_refptr<TestBluetoothAdapter> adapter = new TestBluetoothAdapter(); std::unique_ptr<BluetoothDiscoveryFilter> resulting_filter; @@ -387,7 +405,7 @@ adapter->CleanupSessions(); } -TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterAllFields) { +TEST(BluetoothAdapterTest, MAYBE_GetMergedDiscoveryFilterAllFields) { scoped_refptr<TestBluetoothAdapter> adapter = new TestBluetoothAdapter(); int16_t resulting_rssi; std::set<device::BluetoothUUID> resulting_uuids;
diff --git a/device/fido/bio/enrollment.cc b/device/fido/bio/enrollment.cc index 1ee6cc23..1dfe414 100644 --- a/device/fido/bio/enrollment.cc +++ b/device/fido/bio/enrollment.cc
@@ -47,6 +47,9 @@ auto it = response_map.find( cbor::Value(static_cast<int>(BioEnrollmentResponseKey::kModality))); if (it != response_map.end()) { + if (!it->second.is_unsigned()) { + return base::nullopt; + } response.modality = static_cast<BioEnrollmentModality>(it->second.GetUnsigned()); } @@ -55,6 +58,9 @@ it = response_map.find(cbor::Value( static_cast<int>(BioEnrollmentResponseKey::kFingerprintKind))); if (it != response_map.end()) { + if (!it->second.is_unsigned()) { + return base::nullopt; + } response.fingerprint_kind = static_cast<BioEnrollmentFingerprintKind>(it->second.GetUnsigned()); } @@ -63,6 +69,9 @@ it = response_map.find(cbor::Value(static_cast<int>( BioEnrollmentResponseKey::kMaxCaptureSamplesRequiredForEnroll))); if (it != response_map.end()) { + if (!it->second.is_unsigned()) { + return base::nullopt; + } response.max_samples_for_enroll = it->second.GetUnsigned(); }
diff --git a/device/fido/virtual_ctap2_device.cc b/device/fido/virtual_ctap2_device.cc index 5a63afe..ef37d80 100644 --- a/device/fido/virtual_ctap2_device.cc +++ b/device/fido/virtual_ctap2_device.cc
@@ -1334,7 +1334,14 @@ // Check for the get-modality command. auto it = request_map.find( cbor::Value(static_cast<int>(BioEnrollmentRequestKey::kGetModality))); - if (it != request_map.end() && it->second.GetBool()) { + if (it != request_map.end()) { + if (!it->second.is_bool()) { + return CtapDeviceResponseCode::kCtap2ErrCBORUnexpectedType; + } + if (!it->second.GetBool()) { + // This value is optional so sending |false| is prohibited by the spec. + return CtapDeviceResponseCode::kCtap2ErrInvalidOption; + } response_map.emplace(static_cast<int>(BioEnrollmentResponseKey::kModality), static_cast<int>(BioEnrollmentModality::kFingerprint)); *response = @@ -1345,35 +1352,39 @@ // Check for the get-sensor-info command. it = request_map.find( cbor::Value(static_cast<int>(BioEnrollmentRequestKey::kSubCommand))); - if (it != request_map.end() && - it->second.GetUnsigned() == + if (it == request_map.end()) { + // Could not find a valid command, so return an error. + NOTREACHED(); + return CtapDeviceResponseCode::kCtap2ErrInvalidOption; + } + + if (!it->second.is_unsigned()) { + return CtapDeviceResponseCode::kCtap2ErrCBORUnexpectedType; + } + + switch (static_cast<BioEnrollmentSubCommand>(it->second.GetUnsigned())) { + case BioEnrollmentSubCommand::kGetFingerprintSensorInfo: + response_map.emplace( + static_cast<int>(BioEnrollmentResponseKey::kModality), + static_cast<int>(BioEnrollmentModality::kFingerprint)); + + response_map.emplace( + static_cast<int>(BioEnrollmentResponseKey::kFingerprintKind), + static_cast<int>(BioEnrollmentFingerprintKind::kTouch)); + response_map.emplace( static_cast<int>( - BioEnrollmentSubCommand::kGetFingerprintSensorInfo)) { - response_map.emplace(static_cast<int>(BioEnrollmentResponseKey::kModality), - static_cast<int>(BioEnrollmentModality::kFingerprint)); + BioEnrollmentResponseKey::kMaxCaptureSamplesRequiredForEnroll), + 7); - response_map.emplace( - static_cast<int>(BioEnrollmentResponseKey::kFingerprintKind), - static_cast<int>(BioEnrollmentFingerprintKind::kTouch)); - response_map.emplace( - static_cast<int>( - BioEnrollmentResponseKey::kMaxCaptureSamplesRequiredForEnroll), - 7); + *response = + cbor::Writer::Write(cbor::Value(std::move(response_map))).value(); + return CtapDeviceResponseCode::kSuccess; - *response = - cbor::Writer::Write(cbor::Value(std::move(response_map))).value(); - return CtapDeviceResponseCode::kSuccess; + default: + // Handle all other commands as if they were unsupported (will change + // when support is added). + return CtapDeviceResponseCode::kCtap2ErrUnsupportedOption; } - - // Handle all other commands as if they were unsupported (will change when - // support is added). - if (it != request_map.end()) { - return CtapDeviceResponseCode::kCtap2ErrUnsupportedOption; - } - - // Could not find a valid command, so return an error. - NOTREACHED(); - return CtapDeviceResponseCode::kCtap2ErrInvalidOption; } void VirtualCtap2Device::InitPendingRPs() {
diff --git a/device/gamepad/nintendo_data_fetcher_unittest.cc b/device/gamepad/nintendo_data_fetcher_unittest.cc index b818a8fa..32d390c 100644 --- a/device/gamepad/nintendo_data_fetcher_unittest.cc +++ b/device/gamepad/nintendo_data_fetcher_unittest.cc
@@ -19,6 +19,15 @@ #include "services/service_manager/public/cpp/connector.h" #include "testing/gtest/include/gtest/gtest.h" +// TODO(crbug.com/961039): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_AddAndRemoveSwitchPro DISABLED_AddAndRemoveSwitchPro +#define MAYBE_UnsupportedDeviceIsIgnored DISABLED_UnsupportedDeviceIsIgnored +#else +#define MAYBE_AddAndRemoveSwitchPro AddAndRemoveSwitchPro +#define MAYBE_UnsupportedDeviceIsIgnored UnsupportedDeviceIsIgnored +#endif + namespace device { namespace { @@ -80,7 +89,7 @@ DISALLOW_COPY_AND_ASSIGN(NintendoDataFetcherTest); }; -TEST_F(NintendoDataFetcherTest, UnsupportedDeviceIsIgnored) { +TEST_F(NintendoDataFetcherTest, MAYBE_UnsupportedDeviceIsIgnored) { // Simulate an unsupported, non-Nintendo HID device. auto collection = mojom::HidCollectionInfo::New(); collection->usage = mojom::HidUsageAndPage::New(0, 0); @@ -101,7 +110,7 @@ RunUntilIdle(); } -TEST_F(NintendoDataFetcherTest, AddAndRemoveSwitchPro) { +TEST_F(NintendoDataFetcherTest, MAYBE_AddAndRemoveSwitchPro) { // Simulate a Switch Pro over USB. auto collection = mojom::HidCollectionInfo::New(); collection->usage = mojom::HidUsageAndPage::New(0, 0);
diff --git a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc index dad88f7c..663a36f 100644 --- a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc +++ b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
@@ -20,6 +20,7 @@ #include "extensions/browser/guest_view/web_view/web_view_permission_helper_delegate.h" #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" #include "ppapi/buildflags/buildflags.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" using base::UserMetricsAction; using content::BrowserPluginGuestDelegate; @@ -224,16 +225,18 @@ bool allow, const std::string& user_input) { if (!allow) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_PERMISSION_DENIED, - std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED, + std::unique_ptr<content::MediaStreamUI>()); return; } if (!web_view_guest()->attached() || !web_view_guest()->embedder_web_contents()->GetDelegate()) { - std::move(callback).Run(blink::MediaStreamDevices(), - blink::MEDIA_DEVICE_INVALID_STATE, - std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run( + blink::MediaStreamDevices(), + blink::mojom::MediaStreamRequestResult::INVALID_STATE, + std::unique_ptr<content::MediaStreamUI>()); return; }
diff --git a/extensions/browser/media_capture_util.cc b/extensions/browser/media_capture_util.cc index ef0fa85..4b3ad0d 100644 --- a/extensions/browser/media_capture_util.cc +++ b/extensions/browser/media_capture_util.cc
@@ -13,6 +13,7 @@ #include "content/public/browser/media_capture_devices.h" #include "extensions/common/extension.h" #include "extensions/common/permissions/permissions_data.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" using blink::MediaStreamDevice; using blink::MediaStreamDevices; @@ -76,10 +77,11 @@ // TODO(jamescook): Should we show a recording icon somewhere? If so, where? std::unique_ptr<MediaStreamUI> ui; - std::move(callback).Run(devices, - devices.empty() ? blink::MEDIA_DEVICE_INVALID_STATE - : blink::MEDIA_DEVICE_OK, - std::move(ui)); + std::move(callback).Run( + devices, + devices.empty() ? blink::mojom::MediaStreamRequestResult::INVALID_STATE + : blink::mojom::MediaStreamRequestResult::OK, + std::move(ui)); } void VerifyMediaAccessPermission(blink::MediaStreamType type,
diff --git a/extensions/common/api/automation.idl b/extensions/common/api/automation.idl index 0ebb5e0..7ecec927 100644 --- a/extensions/common/api/automation.idl +++ b/extensions/common/api/automation.idl
@@ -27,14 +27,14 @@ expandedChanged, focus, focusContext, - imageFrameUpdated, hide, hitTestResult, hover, + imageFrameUpdated, invalidStatusChanged, layoutComplete, - liveRegionCreated, liveRegionChanged, + liveRegionCreated, loadComplete, loadStart, locationChanged, @@ -67,6 +67,7 @@ textSelectionChanged, windowActivated, windowDeactivated, + windowVisibilityChanged, treeChanged, valueChanged };
diff --git a/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc b/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc index 34cb6ff1..8f1c1a6a 100644 --- a/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc +++ b/extensions/renderer/api/automation/automation_ax_tree_wrapper.cc
@@ -124,6 +124,8 @@ return api::automation::EVENT_TYPE_WINDOWACTIVATED; case ax::mojom::Event::kWindowDeactivated: return api::automation::EVENT_TYPE_WINDOWDEACTIVATED; + case ax::mojom::Event::kWindowVisibilityChanged: + return api::automation::EVENT_TYPE_WINDOWVISIBILITYCHANGED; case ax::mojom::Event::kTreeChanged: return api::automation::EVENT_TYPE_TREECHANGED; case ax::mojom::Event::kValueChanged: @@ -525,6 +527,7 @@ case api::automation::EVENT_TYPE_SCROLLEDTOANCHOR: case api::automation::EVENT_TYPE_WINDOWACTIVATED: case api::automation::EVENT_TYPE_WINDOWDEACTIVATED: + case api::automation::EVENT_TYPE_WINDOWVISIBILITYCHANGED: return false; // These events might need to be migrated to AXEventGenerator.
diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index ea56a3e9..5c668f63 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn
@@ -65,7 +65,6 @@ "//extensions/shell/browser/system_logs", "//extensions/shell/common/api", "//extensions/shell/common/api:extensions_features", - "//google_apis", "//third_party/blink/public:blink", "//ui/base", "//ui/base/ime/init", @@ -149,10 +148,6 @@ "browser/shell_network_controller_chromeos.h", "browser/shell_network_delegate.cc", "browser/shell_network_delegate.h", - "browser/shell_oauth2_token_service.cc", - "browser/shell_oauth2_token_service.h", - "browser/shell_oauth2_token_service_delegate.cc", - "browser/shell_oauth2_token_service_delegate.h", "browser/shell_prefs.cc", "browser/shell_prefs.h", "browser/shell_special_storage_policy.cc", @@ -289,7 +284,6 @@ "browser/shell_content_browser_client_unittest.cc", "browser/shell_extension_loader_unittest.cc", "browser/shell_keep_alive_requester_unittest.cc", - "browser/shell_oauth2_token_service_unittest.cc", "browser/shell_prefs_unittest.cc", "browser/system_logs/shell_system_logs_fetcher_unittest.cc", "test/shell_test_extensions_browser_client.cc", @@ -320,7 +314,6 @@ "//extensions/common", "//extensions/common/api", "//extensions/shell/browser/system_logs", - "//google_apis", "//testing/gtest", "//ui/gl:test_support", "//ui/platform_window",
diff --git a/extensions/shell/browser/DEPS b/extensions/shell/browser/DEPS index 2629f0c..3ed8497 100644 --- a/extensions/shell/browser/DEPS +++ b/extensions/shell/browser/DEPS
@@ -24,8 +24,6 @@ "+gin", - "+google_apis/gaia", - "+net", "+ppapi",
diff --git a/extensions/shell/browser/api/identity/DEPS b/extensions/shell/browser/api/identity/DEPS deleted file mode 100644 index ea8149d..0000000 --- a/extensions/shell/browser/api/identity/DEPS +++ /dev/null
@@ -1,3 +0,0 @@ -include_rules = [ - "+services/network/public/cpp", -]
diff --git a/extensions/shell/browser/api/identity/identity_api.cc b/extensions/shell/browser/api/identity/identity_api.cc index ab5b747..cbc98e3b 100644 --- a/extensions/shell/browser/api/identity/identity_api.cc +++ b/extensions/shell/browser/api/identity/identity_api.cc
@@ -4,152 +4,16 @@ #include "extensions/shell/browser/api/identity/identity_api.h" -#include <set> -#include <string> - -#include "base/guid.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/storage_partition.h" -#include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" -#include "extensions/shell/browser/shell_oauth2_token_service.h" #include "extensions/shell/common/api/identity.h" -#include "google_apis/gaia/gaia_auth_util.h" namespace extensions { namespace shell { -namespace { -const char kIdentityApiId[] = "identity_api"; -const char kErrorNoUserAccount[] = "No user account."; -const char kErrorNoRefreshToken[] = "No refresh token."; -const char kErrorNoScopesInManifest[] = "No scopes in manifest."; -const char kErrorUserPermissionRequired[] = - "User permission required but not available in app_shell"; -} // namespace - -IdentityAPI::IdentityAPI(content::BrowserContext* context) - : device_id_(base::GenerateGUID()) { -} - -IdentityAPI::~IdentityAPI() { -} - -// static -IdentityAPI* IdentityAPI::Get(content::BrowserContext* context) { - return BrowserContextKeyedAPIFactory<IdentityAPI>::Get(context); -} - -// static -BrowserContextKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { - static base::LazyInstance< - BrowserContextKeyedAPIFactory<IdentityAPI>>::DestructorAtExit factory = - LAZY_INSTANCE_INITIALIZER; - return factory.Pointer(); -} - -/////////////////////////////////////////////////////////////////////////////// - -IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction() - : OAuth2TokenService::Consumer(kIdentityApiId) { -} - -IdentityGetAuthTokenFunction::~IdentityGetAuthTokenFunction() { -} - -void IdentityGetAuthTokenFunction::SetMintTokenFlowForTesting( - OAuth2MintTokenFlow* flow) { - mint_token_flow_.reset(flow); -} - -ExtensionFunction::ResponseAction IdentityGetAuthTokenFunction::Run() { - std::unique_ptr<api::identity::GetAuthToken::Params> params( - api::identity::GetAuthToken::Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params.get()); - - ShellOAuth2TokenService* service = ShellOAuth2TokenService::GetInstance(); - std::string account_id = service->AccountId(); - if (account_id.empty()) - return RespondNow(Error(kErrorNoUserAccount)); - - if (!service->RefreshTokenIsAvailable(account_id)) - return RespondNow(Error(kErrorNoRefreshToken)); - - // Verify that we have scopes. - const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension()); - if (oauth2_info.scopes.empty()) - return RespondNow(Error(kErrorNoScopesInManifest)); - - // Balanced in OnGetTokenFailure() and in the OAuth2MintTokenFlow callbacks. - AddRef(); - - // First, fetch a logged-in-user access token for the Chrome project client ID - // and client secret. This token is used later to get a second access token - // that will be returned to the app. - std::set<std::string> no_scopes; - access_token_request_ = - service->StartRequest(service->AccountId(), no_scopes, this); - return RespondLater(); -} - -void IdentityGetAuthTokenFunction::OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const OAuth2AccessTokenConsumer::TokenResponse& token_response) { - // Tests may override the mint token flow. - if (!mint_token_flow_) { - const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(extension()); - DCHECK(!oauth2_info.scopes.empty()); - - mint_token_flow_.reset(new OAuth2MintTokenFlow( - this, - OAuth2MintTokenFlow::Parameters( - extension()->id(), - oauth2_info.client_id, - oauth2_info.scopes, - IdentityAPI::Get(browser_context())->device_id(), - OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE))); - } - - // Use the logging-in-user access token to mint an access token for this app. - mint_token_flow_->Start( - content::BrowserContext::GetDefaultStoragePartition(browser_context()) - ->GetURLLoaderFactoryForBrowserProcess(), - token_response.access_token); -} - -void IdentityGetAuthTokenFunction::OnGetTokenFailure( - const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) { - Respond(Error(error.ToString())); - Release(); // Balanced in Run(). -} - -void IdentityGetAuthTokenFunction::OnMintTokenSuccess( - const std::string& access_token, - int time_to_live) { - Respond(OneArgument(std::make_unique<base::Value>(access_token))); - Release(); // Balanced in Run(). -} - -void IdentityGetAuthTokenFunction::OnIssueAdviceSuccess( - const IssueAdviceInfo& issue_advice) { - Respond(Error(kErrorUserPermissionRequired)); - Release(); // Balanced in Run(). -} - -void IdentityGetAuthTokenFunction::OnMintTokenFailure( - const GoogleServiceAuthError& error) { - Respond(Error(error.ToString())); - Release(); // Balanced in Run(). -} - -/////////////////////////////////////////////////////////////////////////////// - -IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() { -} +IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() = + default; IdentityRemoveCachedAuthTokenFunction:: - ~IdentityRemoveCachedAuthTokenFunction() { -} + ~IdentityRemoveCachedAuthTokenFunction() = default; ExtensionFunction::ResponseAction IdentityRemoveCachedAuthTokenFunction::Run() { std::unique_ptr<api::identity::RemoveCachedAuthToken::Params> params(
diff --git a/extensions/shell/browser/api/identity/identity_api.h b/extensions/shell/browser/api/identity/identity_api.h index d535a4e1..049908b8 100644 --- a/extensions/shell/browser/api/identity/identity_api.h +++ b/extensions/shell/browser/api/identity/identity_api.h
@@ -5,83 +5,12 @@ #ifndef EXTENSIONS_SHELL_BROWSER_API_IDENTITY_IDENTITY_API_H_ #define EXTENSIONS_SHELL_BROWSER_API_IDENTITY_IDENTITY_API_H_ -#include <string> - #include "base/macros.h" -#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_function.h" -#include "google_apis/gaia/oauth2_mint_token_flow.h" -#include "google_apis/gaia/oauth2_token_service.h" namespace extensions { namespace shell { -// Storage for data used across identity function invocations. -class IdentityAPI : public BrowserContextKeyedAPI { - public: - explicit IdentityAPI(content::BrowserContext* context); - ~IdentityAPI() override; - - static IdentityAPI* Get(content::BrowserContext* context); - - const std::string& device_id() const { return device_id_; } - - // BrowserContextKeyedAPI: - static BrowserContextKeyedAPIFactory<IdentityAPI>* GetFactoryInstance(); - static const char* service_name() { return "IdentityAPI"; } - - private: - friend class BrowserContextKeyedAPIFactory<IdentityAPI>; - - // A GUID identifying this device. - // TODO(jamescook): Make this GUID stable across runs of the app, perhaps by - // storing it in a pref. - const std::string device_id_; -}; - -// Returns an OAuth2 access token for a user. See the IDL file for -// documentation. -class IdentityGetAuthTokenFunction : public UIThreadExtensionFunction, - public OAuth2TokenService::Consumer, - public OAuth2MintTokenFlow::Delegate { - public: - DECLARE_EXTENSION_FUNCTION("identity.getAuthToken", UNKNOWN) - - IdentityGetAuthTokenFunction(); - - // Takes ownership. - void SetMintTokenFlowForTesting(OAuth2MintTokenFlow* flow); - - protected: - ~IdentityGetAuthTokenFunction() override; - - // ExtensionFunction: - ResponseAction Run() override; - - // OAuth2TokenService::Consumer: - void OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const OAuth2AccessTokenConsumer::TokenResponse& token_response) override; - void OnGetTokenFailure(const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) override; - - // OAuth2MintTokenFlow::Delegate: - void OnMintTokenSuccess(const std::string& access_token, - int time_to_live) override; - void OnIssueAdviceSuccess(const IssueAdviceInfo& issue_advice) override; - void OnMintTokenFailure(const GoogleServiceAuthError& error) override; - - private: - // A pending token fetch request to get a login-scoped access token for the - // current user for the Chrome project id. - std::unique_ptr<OAuth2TokenService::Request> access_token_request_; - - // A request for an access token for the current app and its scopes. - std::unique_ptr<OAuth2MintTokenFlow> mint_token_flow_; - - DISALLOW_COPY_AND_ASSIGN(IdentityGetAuthTokenFunction); -}; - // Stub. See the IDL file for documentation. class IdentityRemoveCachedAuthTokenFunction : public UIThreadExtensionFunction { public:
diff --git a/extensions/shell/browser/api/identity/identity_api_unittest.cc b/extensions/shell/browser/api/identity/identity_api_unittest.cc index 8ec30efe..5b23246 100644 --- a/extensions/shell/browser/api/identity/identity_api_unittest.cc +++ b/extensions/shell/browser/api/identity/identity_api_unittest.cc
@@ -4,59 +4,14 @@ #include "extensions/shell/browser/api/identity/identity_api.h" -#include <memory> -#include <string> -#include <utility> - #include "base/values.h" #include "extensions/browser/api_unittest.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h" -#include "extensions/shell/browser/shell_oauth2_token_service.h" -#include "google_apis/gaia/oauth2_mint_token_flow.h" -#include "services/network/public/cpp/shared_url_loader_factory.h" namespace extensions { namespace shell { -// A ShellOAuth2TokenService that does not make network requests. -class MockShellOAuth2TokenService : public ShellOAuth2TokenService { - public: - // The service starts with no account id or refresh token. - MockShellOAuth2TokenService() : ShellOAuth2TokenService("", "") {} - ~MockShellOAuth2TokenService() override {} - - // OAuth2TokenService: - std::unique_ptr<Request> StartRequest(const std::string& account_id, - const ScopeSet& scopes, - Consumer* consumer) override { - // Immediately return success. - consumer->OnGetTokenSuccess( - nullptr, OAuth2AccessTokenConsumer::TokenResponse( - "logged-in-user-token", base::Time(), std::string())); - return nullptr; - } -}; - -// A mint token flow that immediately returns a known access token when started. -class MockOAuth2MintTokenFlow : public OAuth2MintTokenFlow { - public: - explicit MockOAuth2MintTokenFlow(Delegate* delegate) - : OAuth2MintTokenFlow(delegate, Parameters()), delegate_(delegate) {} - ~MockOAuth2MintTokenFlow() override {} - - // OAuth2ApiCallFlow: - void Start(scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - const std::string& access_token) override { - EXPECT_EQ("logged-in-user-token", access_token); - delegate_->OnMintTokenSuccess("app-access-token", 12345); - } - - private: - // Cached here so OAuth2MintTokenFlow does not have to expose its delegate. - Delegate* delegate_; -}; - class IdentityApiTest : public ApiUnitTest { public: IdentityApiTest() {} @@ -77,43 +32,9 @@ } }; -// Verifies that the getAuthToken function exists and can be called without -// crashing. -TEST_F(IdentityApiTest, GetAuthTokenNoRefreshToken) { - MockShellOAuth2TokenService token_service; - - // Calling getAuthToken() before a refresh token is available causes an error. - std::string error = - RunFunctionAndReturnError(new IdentityGetAuthTokenFunction, "[{}]"); - EXPECT_FALSE(error.empty()); -} - -// Verifies that getAuthToken() returns an app access token. -TEST_F(IdentityApiTest, GetAuthToken) { - MockShellOAuth2TokenService token_service; - - // Simulate a refresh token being set. - token_service.SetRefreshToken("larry@google.com", "refresh-token"); - - // RunFunctionAndReturnValue takes ownership. - IdentityGetAuthTokenFunction* function = new IdentityGetAuthTokenFunction; - function->SetMintTokenFlowForTesting(new MockOAuth2MintTokenFlow(function)); - - // Function succeeds and returns a token (for its callback). - std::unique_ptr<base::Value> result = - RunFunctionAndReturnValue(function, "[{}]"); - ASSERT_TRUE(result.get()); - std::string value; - result->GetAsString(&value); - EXPECT_NE("logged-in-user-token", value); - EXPECT_EQ("app-access-token", value); -} - // Verifies that the removeCachedAuthToken function exists and can be called // without crashing. TEST_F(IdentityApiTest, RemoveCachedAuthToken) { - MockShellOAuth2TokenService token_service; - // Function succeeds and returns nothing (for its callback). std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( new IdentityRemoveCachedAuthTokenFunction, "[{}]");
diff --git a/extensions/shell/browser/shell_browser_context_keyed_service_factories.cc b/extensions/shell/browser/shell_browser_context_keyed_service_factories.cc index b3e3501..bc18e31 100644 --- a/extensions/shell/browser/shell_browser_context_keyed_service_factories.cc +++ b/extensions/shell/browser/shell_browser_context_keyed_service_factories.cc
@@ -12,8 +12,6 @@ namespace shell { void EnsureBrowserContextKeyedServiceFactoriesBuilt() { - IdentityAPI::GetFactoryInstance(); - // TODO(rockot): Remove this once UpdateService is supported across all // extensions embedders (and namely chrome.) UpdateServiceFactory::GetInstance();
diff --git a/extensions/shell/browser/shell_browser_main_parts.cc b/extensions/shell/browser/shell_browser_main_parts.cc index b3a181fc7..3b06e3b5 100644 --- a/extensions/shell/browser/shell_browser_main_parts.cc +++ b/extensions/shell/browser/shell_browser_main_parts.cc
@@ -36,7 +36,6 @@ #include "extensions/shell/browser/shell_extension_system.h" #include "extensions/shell/browser/shell_extension_system_factory.h" #include "extensions/shell/browser/shell_extensions_browser_client.h" -#include "extensions/shell/browser/shell_oauth2_token_service.h" #include "extensions/shell/browser/shell_prefs.h" #include "extensions/shell/browser/shell_update_query_params_delegate.h" #include "extensions/shell/common/shell_extensions_client.h" @@ -230,12 +229,6 @@ InitExtensionSystem(); - // Initialize OAuth2 support from command line. - base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); - oauth2_token_service_.reset(new ShellOAuth2TokenService( - cmd->GetSwitchValueASCII(switches::kAppShellUser), - cmd->GetSwitchValueASCII(switches::kAppShellRefreshToken))); - #if BUILDFLAG(ENABLE_NACL) nacl::NaClBrowser::SetDelegate( std::make_unique<ShellNaClBrowserDelegate>(browser_context_.get())); @@ -249,7 +242,8 @@ content::ShellDevToolsManagerDelegate::StartHttpHandler( browser_context_.get()); - if (cmd->HasSwitch(::switches::kBrowserCrashTest)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kBrowserCrashTest)) CrashForTest(); if (parameters_.ui_task) { @@ -282,7 +276,6 @@ task_tracker_.TryCancelAll(); #endif - oauth2_token_service_.reset(); BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( browser_context_.get()); extension_system_ = NULL;
diff --git a/extensions/shell/browser/shell_browser_main_parts.h b/extensions/shell/browser/shell_browser_main_parts.h index 2c2c5cd..9a3fec3 100644 --- a/extensions/shell/browser/shell_browser_main_parts.h +++ b/extensions/shell/browser/shell_browser_main_parts.h
@@ -29,7 +29,6 @@ class ShellExtensionsClient; class ShellExtensionsBrowserClient; class ShellExtensionSystem; -class ShellOAuth2TokenService; class ShellUpdateQueryParamsDelegate; #if defined(OS_CHROMEOS) @@ -80,7 +79,6 @@ std::unique_ptr<ShellExtensionsClient> extensions_client_; std::unique_ptr<ShellExtensionsBrowserClient> extensions_browser_client_; std::unique_ptr<ShellUpdateQueryParamsDelegate> update_query_params_delegate_; - std::unique_ptr<ShellOAuth2TokenService> oauth2_token_service_; // Owned by the KeyedService system. ShellExtensionSystem* extension_system_;
diff --git a/extensions/shell/browser/shell_oauth2_token_service.cc b/extensions/shell/browser/shell_oauth2_token_service.cc deleted file mode 100644 index 0e7b8f08..0000000 --- a/extensions/shell/browser/shell_oauth2_token_service.cc +++ /dev/null
@@ -1,50 +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 "extensions/shell/browser/shell_oauth2_token_service.h" - -#include "base/logging.h" -#include "content/public/browser/browser_thread.h" -#include "extensions/shell/browser/shell_oauth2_token_service_delegate.h" - -namespace extensions { -namespace { - -ShellOAuth2TokenService* g_instance = nullptr; - -} // namespace - -ShellOAuth2TokenService::ShellOAuth2TokenService(std::string account_id, - std::string refresh_token) - : OAuth2TokenService( - std::make_unique<ShellOAuth2TokenServiceDelegate>(account_id, - refresh_token)) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(!g_instance); - g_instance = this; -} - -ShellOAuth2TokenService::~ShellOAuth2TokenService() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(g_instance); - g_instance = nullptr; -} - -// static -ShellOAuth2TokenService* ShellOAuth2TokenService::GetInstance() { - DCHECK(g_instance); - return g_instance; -} - -void ShellOAuth2TokenService::SetRefreshToken( - const std::string& account_id, - const std::string& refresh_token) { - GetDelegate()->UpdateCredentials(account_id, refresh_token); -} - -std::string ShellOAuth2TokenService::AccountId() const { - return GetAccounts()[0]; -} - -} // namespace extensions
diff --git a/extensions/shell/browser/shell_oauth2_token_service.h b/extensions/shell/browser/shell_oauth2_token_service.h deleted file mode 100644 index a7d649b1..0000000 --- a/extensions/shell/browser/shell_oauth2_token_service.h +++ /dev/null
@@ -1,37 +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 EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_ -#define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_ - -#include <string> - -#include "base/macros.h" -#include "google_apis/gaia/oauth2_token_service.h" - -namespace extensions { - -// Requests OAuth2 access tokens for app_shell. Requires the OAuth2 refresh -// token to be set explicitly. Only stores a single refresh token for a single -// user account. Created and accessed on the UI thread. Only one instance is -// allowed. -class ShellOAuth2TokenService : public OAuth2TokenService { - public: - ShellOAuth2TokenService(std::string account_id, std::string refresh_token); - ~ShellOAuth2TokenService() override; - - // Returns the single instance for app_shell. - static ShellOAuth2TokenService* GetInstance(); - - void SetRefreshToken(const std::string& account_id, - const std::string& refresh_token); - - std::string AccountId() const; - - DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenService); -}; - -} // namespace extensions - -#endif // EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_
diff --git a/extensions/shell/browser/shell_oauth2_token_service_delegate.cc b/extensions/shell/browser/shell_oauth2_token_service_delegate.cc deleted file mode 100644 index d6e60ad..0000000 --- a/extensions/shell/browser/shell_oauth2_token_service_delegate.cc +++ /dev/null
@@ -1,53 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "extensions/shell/browser/shell_oauth2_token_service_delegate.h" - -#include <vector> - -#include "content/public/browser/storage_partition.h" - -namespace extensions { - -ShellOAuth2TokenServiceDelegate::ShellOAuth2TokenServiceDelegate( - std::string account_id, - std::string refresh_token) - : account_id_(account_id), refresh_token_(refresh_token) {} - -ShellOAuth2TokenServiceDelegate::~ShellOAuth2TokenServiceDelegate() { -} - -bool ShellOAuth2TokenServiceDelegate::RefreshTokenIsAvailable( - const std::string& account_id) const { - if (account_id != account_id_) - return false; - - return !refresh_token_.empty(); -} - -OAuth2AccessTokenFetcher* -ShellOAuth2TokenServiceDelegate::CreateAccessTokenFetcher( - const std::string& account_id, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - OAuth2AccessTokenConsumer* consumer) { - DCHECK_EQ(account_id, account_id_); - DCHECK(!refresh_token_.empty()); - return new OAuth2AccessTokenFetcherImpl(consumer, url_loader_factory, - refresh_token_); -} - -std::vector<std::string> ShellOAuth2TokenServiceDelegate::GetAccounts() { - std::vector<std::string> accounts; - accounts.push_back(account_id_); - return accounts; -} - -void ShellOAuth2TokenServiceDelegate::UpdateCredentials( - const std::string& account_id, - const std::string& refresh_token) { - account_id_ = account_id; - refresh_token_ = refresh_token; -} - -} // namespace extensions
diff --git a/extensions/shell/browser/shell_oauth2_token_service_delegate.h b/extensions/shell/browser/shell_oauth2_token_service_delegate.h deleted file mode 100644 index 3fb64e39..0000000 --- a/extensions/shell/browser/shell_oauth2_token_service_delegate.h +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ -#define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ - -#include <string> - -#include "base/macros.h" -#include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" -#include "google_apis/gaia/oauth2_token_service_delegate.h" - -namespace extensions { - -class ShellOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate { - public: - ShellOAuth2TokenServiceDelegate(std::string account_id, - std::string refresh_token); - ~ShellOAuth2TokenServiceDelegate() override; - - bool RefreshTokenIsAvailable(const std::string& account_id) const override; - - OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( - const std::string& account_id, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - OAuth2AccessTokenConsumer* consumer) override; - - std::vector<std::string> GetAccounts() override; - - void UpdateCredentials(const std::string& account_id, - const std::string& refresh_token) override; - - private: - // User account id, such as "foo@gmail.com". - std::string account_id_; - - // Cached copy of an OAuth2 refresh token. Not stored on disk. - std::string refresh_token_; - - DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenServiceDelegate); -}; - -} // namespace extensions -#endif // EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
diff --git a/extensions/shell/browser/shell_oauth2_token_service_unittest.cc b/extensions/shell/browser/shell_oauth2_token_service_unittest.cc deleted file mode 100644 index 43bf44d..0000000 --- a/extensions/shell/browser/shell_oauth2_token_service_unittest.cc +++ /dev/null
@@ -1,34 +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 "extensions/shell/browser/shell_oauth2_token_service.h" - -#include "extensions/browser/extensions_test.h" - -namespace extensions { - -class ShellOAuth2TokenServiceTest : public ExtensionsTest { - public: - ShellOAuth2TokenServiceTest() {} - ~ShellOAuth2TokenServiceTest() override {} -}; - -// Verifies setting the refresh token makes it available. -TEST_F(ShellOAuth2TokenServiceTest, SetRefreshToken) { - ShellOAuth2TokenService service("larry@google.com", "token123"); - - // Only has a token for the account in the constructor. - EXPECT_EQ("larry@google.com", service.AccountId()); - EXPECT_TRUE(service.RefreshTokenIsAvailable("larry@google.com")); - EXPECT_FALSE(service.RefreshTokenIsAvailable("sergey@google.com")); - - service.SetRefreshToken("sergey@google.com", "token456"); - - // The account and refresh token have updated. - EXPECT_EQ("sergey@google.com", service.AccountId()); - EXPECT_FALSE(service.RefreshTokenIsAvailable("larry@google.com")); - EXPECT_TRUE(service.RefreshTokenIsAvailable("sergey@google.com")); -} - -} // namespace extensions
diff --git a/extensions/shell/common/api/identity.idl b/extensions/shell/common/api/identity.idl index f5e681e..e8ac69a8 100644 --- a/extensions/shell/common/api/identity.idl +++ b/extensions/shell/common/api/identity.idl
@@ -5,28 +5,15 @@ // Simplified implementation of the <code>chrome.identity</code> for app_shell. namespace identity { - dictionary GetAuthTokenDetails { - // Ignored parameter. Exists only for compatibility. - boolean? interactive; - }; - dictionary InvalidTokenDetails { // Ignored parameter. Exists only for compatibility. DOMString? token; }; - // Called with the OAuth2 access token on success or undefined on error. - callback GetAuthTokenCallback = void (optional DOMString token); - // Called by removeCachedAuthToken(). callback InvalidateAuthTokenCallback = void (); interface Functions { - // Returns an OAuth2 access token for the current app_shell user for scopes - // from the manifest. Does not prompt the user. - static void getAuthToken(GetAuthTokenDetails options, - GetAuthTokenCallback callback); - // Stub. Calls callback immediately because app_shell does not cache access // tokens the way Chrome does. static void removeCachedAuthToken(InvalidTokenDetails details,
diff --git a/extensions/shell/common/switches.cc b/extensions/shell/common/switches.cc index 8cae846..fde3eaa 100644 --- a/extensions/shell/common/switches.cc +++ b/extensions/shell/common/switches.cc
@@ -18,12 +18,6 @@ const char kAppShellPreferredNetwork[] = "app-shell-preferred-network"; #endif -// Refresh token for identity API calls for the current user. Used for testing. -const char kAppShellRefreshToken[] = "app-shell-refresh-token"; - -// User email address of the current user. -const char kAppShellUser[] = "app-shell-user"; - #if defined(OS_LINUX) && !defined(OS_CHROMEOS) // The directory breakpad should store minidumps in. const char kCrashDumpsDir[] = "crash-dumps-dir";
diff --git a/extensions/shell/common/switches.h b/extensions/shell/common/switches.h index f99cc76e..c357fde3 100644 --- a/extensions/shell/common/switches.h +++ b/extensions/shell/common/switches.h
@@ -17,8 +17,6 @@ extern const char kAppShellHostWindowSize[]; extern const char kAppShellPreferredNetwork[]; #endif -extern const char kAppShellRefreshToken[]; -extern const char kAppShellUser[]; #if defined(OS_LINUX) && !defined(OS_CHROMEOS) extern const char kCrashDumpsDir[]; extern const char kEnableReporting[];
diff --git a/gin/gin_features.cc b/gin/gin_features.cc index 3e6f1cc..f062ed9 100644 --- a/gin/gin_features.cc +++ b/gin/gin_features.cc
@@ -14,6 +14,10 @@ const base::Feature kV8FlushBytecode{"V8FlushBytecode", base::FEATURE_ENABLED_BY_DEFAULT}; +// Enables lazy feedback allocation in V8. +const base::Feature kV8LazyFeedbackAllocation{"V8LazyFeedbackAllocation", + base::FEATURE_ENABLED_BY_DEFAULT}; + // Enables memory reducer for small heaps in V8. const base::Feature kV8MemoryReducerForSmallHeaps{ "V8MemoryReducerForSmallHeaps", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/gin/gin_features.h b/gin/gin_features.h index f5f18b3..1ed04a4 100644 --- a/gin/gin_features.h +++ b/gin/gin_features.h
@@ -12,6 +12,7 @@ GIN_EXPORT extern const base::Feature kV8OptimizeJavascript; GIN_EXPORT extern const base::Feature kV8FlushBytecode; +GIN_EXPORT extern const base::Feature kV8LazyFeedbackAllocation; GIN_EXPORT extern const base::Feature kV8MemoryReducerForSmallHeaps; GIN_EXPORT extern const base::Feature kV8HugeMaxOldGenerationSize;
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index 770f3cb..8148f75 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc
@@ -225,6 +225,13 @@ sizeof(no_flush_bytecode) - 1); } + if (!base::FeatureList::IsEnabled(features::kV8LazyFeedbackAllocation)) { + static const char no_lazy_feedback_allocation[] = + "--no-lazy-feedback-allocation"; + v8::V8::SetFlagsFromString(no_lazy_feedback_allocation, + sizeof(no_lazy_feedback_allocation) - 1); + } + if (!base::FeatureList::IsEnabled(features::kV8MemoryReducerForSmallHeaps)) { static const char no_memory_reducer[] = "--no-memory-reducer-for-small-heaps";
diff --git a/google_apis/gaia/oauth2_token_service.h b/google_apis/gaia/oauth2_token_service.h index 44ac84e..90157f73 100644 --- a/google_apis/gaia/oauth2_token_service.h +++ b/google_apis/gaia/oauth2_token_service.h
@@ -106,10 +106,10 @@ // pending request can easily occur on Android, where refresh tokens are // held by the OS and are thus often available on startup even before // OnRefreshTokenAvailable() is called. - virtual void OnRefreshTokenAvailable(const std::string& account_id) {} + virtual void OnRefreshTokenAvailable(const CoreAccountId& account_id) {} // Called whenever the login-scoped refresh token becomes unavailable for // account |account_id|. - virtual void OnRefreshTokenRevoked(const std::string& account_id) {} + virtual void OnRefreshTokenRevoked(const CoreAccountId& account_id) {} // Called after all refresh tokens are loaded during OAuth2TokenService // startup. virtual void OnRefreshTokensLoaded() {} @@ -118,7 +118,7 @@ // Called when the authentication error state for |account_id| has changed. // Note: It is always called after |OnRefreshTokenAvailable| when refresh // token is updated. It is not called when the refresh token is revoked. - virtual void OnAuthErrorChanged(const std::string& account_id, + virtual void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) {} protected:
diff --git a/google_apis/gaia/oauth2_token_service_delegate_unittest.cc b/google_apis/gaia/oauth2_token_service_delegate_unittest.cc index 01555eea..fdb969f 100644 --- a/google_apis/gaia/oauth2_token_service_delegate_unittest.cc +++ b/google_apis/gaia/oauth2_token_service_delegate_unittest.cc
@@ -24,7 +24,7 @@ class TokenServiceObserver : public OAuth2TokenService::Observer { public: MOCK_METHOD2(OnAuthErrorChanged, - void(const std::string&, const GoogleServiceAuthError&)); + void(const CoreAccountId&, const GoogleServiceAuthError&)); }; FakeOAuth2TokenServiceDelegate delegate;
diff --git a/google_apis/gaia/oauth2_token_service_unittest.cc b/google_apis/gaia/oauth2_token_service_unittest.cc index 9e0648b..3545a2b2 100644 --- a/google_apis/gaia/oauth2_token_service_unittest.cc +++ b/google_apis/gaia/oauth2_token_service_unittest.cc
@@ -56,7 +56,7 @@ class FakeOAuth2TokenServiceObserver : public OAuth2TokenService::Observer { public: MOCK_METHOD2(OnAuthErrorChanged, - void(const std::string&, const GoogleServiceAuthError&)); + void(const CoreAccountId&, const GoogleServiceAuthError&)); }; class TestOAuth2TokenService : public OAuth2TokenService { @@ -135,7 +135,7 @@ network::TestURLLoaderFactory* test_url_loader_factory_ = nullptr; FakeOAuth2TokenServiceDelegate* delegate_ptr_ = nullptr; // Not owned. std::unique_ptr<TestOAuth2TokenService> oauth2_service_; - std::string account_id_; + CoreAccountId account_id_; TestingOAuth2TokenServiceConsumer consumer_; };
diff --git a/infra/config/cr-buildbucket.cfg b/infra/config/cr-buildbucket.cfg index 0148747e..c032e84 100644 --- a/infra/config/cr-buildbucket.cfg +++ b/infra/config/cr-buildbucket.cfg
@@ -1093,6 +1093,7 @@ mixins: "code-coverage" mixins: "linux" dimensions: "os:Ubuntu-14.04" + dimensions: "cores:32" } builders {
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index e16029e..d6b79aa 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -2424,7 +2424,21 @@ // Make new content visible, resizing it first as the orientation may // have changed from the last time it was displayed. - [self viewForWebState:webState].frame = self.contentArea.bounds; + CGRect webStateViewFrame = self.contentArea.bounds; + if (!ios::GetChromeBrowserProvider() + ->GetFullscreenProvider() + ->IsInitialized()) { + // If the FullscreenProvider is initialized, the WebState view is not + // resized, and should always match the bounds of the content area. When + // the provider is not initialized, viewport insets resize the webview, so + // they should be accounted for here to prevent animation jitter. + UIEdgeInsets viewportInsets = + FullscreenControllerFactory::GetForBrowserState(self.browserState) + ->GetCurrentViewportInsets(); + webStateViewFrame = + UIEdgeInsetsInsetRect(webStateViewFrame, viewportInsets); + } + [self viewForWebState:webState].frame = webStateViewFrame; [_toolbarUIUpdater updateState]; NewTabPageTabHelper* NTPHelper =
diff --git a/ios/chrome/browser/ui/main/browser_view_wrangler.mm b/ios/chrome/browser/ui/main/browser_view_wrangler.mm index 622fc6f..e810200 100644 --- a/ios/chrome/browser/ui/main/browser_view_wrangler.mm +++ b/ios/chrome/browser/ui/main/browser_view_wrangler.mm
@@ -296,7 +296,9 @@ oldWebState:(web::WebState*)oldWebState atIndex:(int)atIndex reason:(int)reason { - [self updateDeviceSharingManager]; + if (newWebState) { + [self updateDeviceSharingManager]; + } } #pragma mark - CRWWebStateObserver
diff --git a/ios/chrome/browser/ui/toolbar/BUILD.gn b/ios/chrome/browser/ui/toolbar/BUILD.gn index b75aa7e1..4ebd214 100644 --- a/ios/chrome/browser/ui/toolbar/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/BUILD.gn
@@ -145,8 +145,25 @@ configs += [ "//build/config/compiler:enable_arc" ] } +source_set("eg2_tests") { + defines = [ "CHROME_EARL_GREY_2" ] + configs += [ + "//build/config/compiler:enable_arc", + "//build/config/ios:xctest_config", + ] + testonly = true + sources = [] + deps = [ + "//ios/chrome/test/earl_grey:eg_test_support+eg2", + "//ios/testing/earl_grey:eg_test_support+eg2", + "//ios/third_party/earl_grey2:test_lib", + ] + libs = [ "UIKit.framework" ] +} + source_set("eg_tests") { configs += [ "//build/config/compiler:enable_arc" ] + defines = [ "CHROME_EARL_GREY_1" ] testonly = true sources = [ "adaptive_toolbar_egtest.mm",
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm b/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm index 8a46c10..1c181d1 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm +++ b/ios/chrome/browser/ui/toolbar/toolbar_egtest.mm
@@ -2,14 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import <EarlGrey/EarlGrey.h> #import <XCTest/XCTest.h> #include "base/ios/ios_util.h" #include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" -#import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h" #include "ios/chrome/browser/ui/util/ui_util.h" @@ -20,6 +18,7 @@ #import "ios/chrome/test/earl_grey/chrome_error_util.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h" +#import "ios/testing/earl_grey/earl_grey_test.h" #import "ios/web/public/test/http_server/http_server.h" #include "ios/web/public/test/http_server/http_server_util.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -348,16 +347,16 @@ [[EarlGrey selectElementWithMatcher:chrome_test_util::NewTabPageOmnibox()] performAction:grey_typeText(@"a")]; [[EarlGrey selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"a"), - grey_kindOfClass( - [OmniboxPopupRow class]), + grey_kindOfClassName( + @"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] performAction:grey_typeText(@"b")]; [[EarlGrey selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"ab"), - grey_kindOfClass( - [OmniboxPopupRow class]), + grey_kindOfClassName( + @"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -366,7 +365,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"abC"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -375,7 +374,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"abC1"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -384,7 +383,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"abC12"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -393,7 +392,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"abC12@"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -402,7 +401,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"abC12@{"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -411,7 +410,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"abC12@{#"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; @@ -455,7 +454,7 @@ [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityLabel(@"/.com"), - grey_kindOfClass([OmniboxPopupRow class]), + grey_kindOfClassName(@"OmniboxPopupRow"), nil)] assertWithMatcher:grey_sufficientlyVisible()]; }
diff --git a/ios/chrome/test/earl_grey2/BUILD.gn b/ios/chrome/test/earl_grey2/BUILD.gn index e249ed8..d59c1ef 100644 --- a/ios/chrome/test/earl_grey2/BUILD.gn +++ b/ios/chrome/test/earl_grey2/BUILD.gn
@@ -41,6 +41,7 @@ deps = [ "//ios/chrome/browser/ui/activity_services:eg2_tests", "//ios/chrome/browser/ui/download:eg2_tests", + "//ios/chrome/browser/ui/toolbar:eg2_tests", ] }
diff --git a/ios/web/web_thread_impl.cc b/ios/web/web_thread_impl.cc index 54c7348..a72971f 100644 --- a/ios/web/web_thread_impl.cc +++ b/ios/web/web_thread_impl.cc
@@ -152,27 +152,26 @@ ~WebThreadTaskExecutor() override {} // base::TaskExecutor implementation. - bool PostDelayedTaskWithTraits(const base::Location& from_here, - const base::TaskTraits& traits, - base::OnceClosure task, - base::TimeDelta delay) override { + bool PostDelayedTask(const base::Location& from_here, + const base::TaskTraits& traits, + base::OnceClosure task, + base::TimeDelta delay) override { return PostTaskHelper( GetWebThreadIdentifier(traits), from_here, std::move(task), delay, traits.GetExtension<WebTaskTraitsExtension>().nestable()); } - scoped_refptr<base::TaskRunner> CreateTaskRunnerWithTraits( + scoped_refptr<base::TaskRunner> CreateTaskRunner( const base::TaskTraits& traits) override { return GetTaskRunnerForThread(GetWebThreadIdentifier(traits)); } - scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( + scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner( const base::TaskTraits& traits) override { return GetTaskRunnerForThread(GetWebThreadIdentifier(traits)); } - scoped_refptr<base::SingleThreadTaskRunner> - CreateSingleThreadTaskRunnerWithTraits( + scoped_refptr<base::SingleThreadTaskRunner> CreateSingleThreadTaskRunner( const base::TaskTraits& traits, base::SingleThreadTaskRunnerThreadMode thread_mode) override { // It's not possible to request DEDICATED access to a WebThread.
diff --git a/net/cookies/parse_cookie_line_fuzzer.cc b/net/cookies/parse_cookie_line_fuzzer.cc index 99783984..984a081 100644 --- a/net/cookies/parse_cookie_line_fuzzer.cc +++ b/net/cookies/parse_cookie_line_fuzzer.cc
@@ -5,11 +5,67 @@ #include <stddef.h> #include <stdint.h> +#include "base/logging.h" +#include "base/test/fuzzed_data_provider.h" #include "net/cookies/parsed_cookie.h" +const std::string GetArbitraryString(base::FuzzedDataProvider* data_provider) { + // Adding a fudge factor to kMaxCookieSize so that both branches of the bounds + // detection code will be tested. + return data_provider->ConsumeRandomLengthString( + net::ParsedCookie::kMaxCookieSize + 10); +} + // Entry point for LibFuzzer. extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - std::string input(data, data + size); - net::ParsedCookie parsed_cookie(input); + base::FuzzedDataProvider data_provider(data, size); + const std::string cookie_line = GetArbitraryString(&data_provider); + net::ParsedCookie parsed_cookie(cookie_line); + + // Call zero or one of ParsedCookie's mutator methods. + switch (data_provider.ConsumeIntegralInRange(0, 10)) { + case 0: + break; + case 1: + parsed_cookie.SetName(GetArbitraryString(&data_provider)); + break; + case 2: + parsed_cookie.SetValue(GetArbitraryString(&data_provider)); + break; + case 3: + parsed_cookie.SetPath(GetArbitraryString(&data_provider)); + break; + case 4: + parsed_cookie.SetDomain(GetArbitraryString(&data_provider)); + break; + case 5: + parsed_cookie.SetExpires(GetArbitraryString(&data_provider)); + break; + case 6: + parsed_cookie.SetMaxAge(GetArbitraryString(&data_provider)); + break; + case 7: + parsed_cookie.SetIsSecure(data_provider.ConsumeBool()); + break; + case 8: + parsed_cookie.SetIsHttpOnly(data_provider.ConsumeBool()); + break; + case 9: + parsed_cookie.SetSameSite(GetArbitraryString(&data_provider)); + break; + case 10: + parsed_cookie.SetPriority(GetArbitraryString(&data_provider)); + break; + } + + // Check that serialize/deserialize inverse property holds for valid cookies. + if (parsed_cookie.IsValid()) { + const std::string serialized = parsed_cookie.ToCookieLine(); + net::ParsedCookie reparsed_cookie(serialized); + const std::string reserialized = reparsed_cookie.ToCookieLine(); + CHECK(reparsed_cookie.IsValid()); + CHECK_EQ(serialized, reserialized); + } + return 0; }
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index 469a7d7..c813625 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc
@@ -39,6 +39,25 @@ #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" #include "ui/events/event.h" +// TODO(crbug.com/961064): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_LocalInputTest DISABLED_LocalInputTest +#define MAYBE_ClampMouseEvents DISABLED_ClampMouseEvents +#define MAYBE_DisableInputs DISABLED_DisableInputs +#define MAYBE_MultiMonMouseMove_SameSize DISABLED_MultiMonMouseMove_SameSize +#define MAYBE_RestoreEventState DISABLED_RestoreEventState +#define MAYBE_MultiMonMouseMove DISABLED_MultiMonMouseMove +#define MAYBE_DisconnectOnLocalInputTest DISABLED_DisconnectOnLocalInputTest +#else +#define MAYBE_LocalInputTest LocalInputTest +#define MAYBE_ClampMouseEvents ClampMouseEvents +#define MAYBE_DisableInputs DisableInputs +#define MAYBE_MultiMonMouseMove_SameSize MultiMonMouseMove_SameSize +#define MAYBE_RestoreEventState RestoreEventState +#define MAYBE_MultiMonMouseMove MultiMonMouseMove +#define MAYBE_DisconnectOnLocalInputTest DisconnectOnLocalInputTest +#endif + namespace remoting { using protocol::FakeSession; @@ -413,7 +432,7 @@ NotifyVideoSizeAll(); } -TEST_F(ClientSessionTest, MultiMonMouseMove) { +TEST_F(ClientSessionTest, MAYBE_MultiMonMouseMove) { CreateClientSession(); ConnectClientSession(); SetupMultiDisplay(); @@ -470,7 +489,7 @@ kDisplay2Height + kDisplay2YOffset - 1)); } -TEST_F(ClientSessionTest, MultiMonMouseMove_SameSize) { +TEST_F(ClientSessionTest, MAYBE_MultiMonMouseMove_SameSize) { CreateClientSession(); ConnectClientSession(); SetupMultiDisplay_SameSize(); @@ -526,7 +545,7 @@ kDisplay1Height + kDisplay2YOffset - 1)); } -TEST_F(ClientSessionTest, DisableInputs) { +TEST_F(ClientSessionTest, MAYBE_DisableInputs) { CreateClientSession(); ConnectClientSession(); SetupSingleDisplay(); @@ -582,7 +601,7 @@ EqualsClipboardEvent(kMimeTypeTextUtf8, "c")); } -TEST_F(ClientSessionTest, LocalInputTest) { +TEST_F(ClientSessionTest, MAYBE_LocalInputTest) { CreateClientSession(); ConnectClientSession(); SetupSingleDisplay(); @@ -622,7 +641,7 @@ // eventually (via dependency injection, not sleep!) } -TEST_F(ClientSessionTest, DisconnectOnLocalInputTest) { +TEST_F(ClientSessionTest, MAYBE_DisconnectOnLocalInputTest) { desktop_environment_options_.set_terminate_upon_input(true); CreateClientSession(); ConnectClientSession(); @@ -633,7 +652,7 @@ EXPECT_FALSE(connection_->is_connected()); } -TEST_F(ClientSessionTest, RestoreEventState) { +TEST_F(ClientSessionTest, MAYBE_RestoreEventState) { CreateClientSession(); ConnectClientSession(); SetupSingleDisplay(); @@ -671,7 +690,7 @@ EXPECT_THAT(key_events[3], EqualsKeyEvent(2, false)); } -TEST_F(ClientSessionTest, ClampMouseEvents) { +TEST_F(ClientSessionTest, MAYBE_ClampMouseEvents) { CreateClientSession(); ConnectClientSession(); SetupSingleDisplay();
diff --git a/remoting/host/desktop_display_info_unittest.cc b/remoting/host/desktop_display_info_unittest.cc index 6de8b249..62cf794 100644 --- a/remoting/host/desktop_display_info_unittest.cc +++ b/remoting/host/desktop_display_info_unittest.cc
@@ -7,6 +7,28 @@ #include "base/location.h" #include "testing/gtest/include/gtest/gtest.h" +// TODO(crbug.com/961064): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_SingleDisplay DISABLED_SingleDisplay +#define MAYBE_DualDisplayRight_ReverseOrder \ + DISABLED_DualDisplayRight_ReverseOrder +#define MAYBE_DualDisplayLeft_ReverseOrder DISABLED_DualDisplayLeft_ReverseOrder +#define MAYBE_DualDisplayRight DISABLED_DualDisplayRight +#define MAYBE_DualDisplayLeft DISABLED_DualDisplayLeft +#define MAYBE_Multimon3 DISABLED_Multimon3 +#define MAYBE_TripleDisplayMiddle DISABLED_TripleDisplayMiddle +#define MAYBE_Multimon7 DISABLED_Multimon7 +#else +#define MAYBE_SingleDisplay SingleDisplay +#define MAYBE_DualDisplayRight_ReverseOrder DualDisplayRight_ReverseOrder +#define MAYBE_DualDisplayLeft_ReverseOrder DualDisplayLeft_ReverseOrder +#define MAYBE_DualDisplayRight DualDisplayRight +#define MAYBE_DualDisplayLeft DualDisplayLeft +#define MAYBE_Multimon3 Multimon3 +#define MAYBE_TripleDisplayMiddle TripleDisplayMiddle +#define MAYBE_Multimon7 Multimon7 +#endif + namespace remoting { class DesktopDisplayInfoTest : public testing::Test { @@ -41,7 +63,7 @@ // | 300x200 | // +---------+ // o = desktop origin -TEST_F(DesktopDisplayInfoTest, SingleDisplay) { +TEST_F(DesktopDisplayInfoTest, MAYBE_SingleDisplay) { AddDisplay(0, 0, 300, 200); VerifyDisplayOffset(FROM_HERE, 0, 0, 0); @@ -52,7 +74,7 @@ // | 300x200 | 500x400 | // +---------+ | // +------------+ -TEST_F(DesktopDisplayInfoTest, DualDisplayRight) { +TEST_F(DesktopDisplayInfoTest, MAYBE_DualDisplayRight) { AddDisplay(0, 0, 300, 200); AddDisplay(300, 0, 500, 400); @@ -65,7 +87,7 @@ // | 300x200 | 500x400 | // +---------+ | // +------------+ -TEST_F(DesktopDisplayInfoTest, DualDisplayRight_ReverseOrder) { +TEST_F(DesktopDisplayInfoTest, MAYBE_DualDisplayRight_ReverseOrder) { AddDisplay(300, 0, 500, 400); AddDisplay(0, 0, 300, 200); @@ -78,7 +100,7 @@ // | 300x200 | 500x400 | // +---------+ | // +------------+ -TEST_F(DesktopDisplayInfoTest, DualDisplayLeft) { +TEST_F(DesktopDisplayInfoTest, MAYBE_DualDisplayLeft) { AddDisplay(0, 0, 500, 400); AddDisplay(-300, 0, 300, 200); @@ -91,7 +113,7 @@ // | 300x200 | 500x400 | // +---------+ | // +------------+ -TEST_F(DesktopDisplayInfoTest, DualDisplayLeft_ReverseOrder) { +TEST_F(DesktopDisplayInfoTest, MAYBE_DualDisplayLeft_ReverseOrder) { AddDisplay(-300, 0, 300, 200); AddDisplay(0, 0, 500, 400); @@ -104,7 +126,7 @@ // | 300x200 | 500x400 | 2 | // +---------+ | 400x350 | // +------------+---------+ -TEST_F(DesktopDisplayInfoTest, TripleDisplayMiddle) { +TEST_F(DesktopDisplayInfoTest, MAYBE_TripleDisplayMiddle) { AddDisplay(-300, 0, 300, 200); AddDisplay(0, 0, 500, 400); // Default display. AddDisplay(500, 50, 400, 350); @@ -123,7 +145,7 @@ // +-----------+ - 950 // | | | | | // -300 0 300 500 900 -TEST_F(DesktopDisplayInfoTest, Multimon3) { +TEST_F(DesktopDisplayInfoTest, MAYBE_Multimon3) { AddDisplay(0, 0, 500, 400); // Default display. AddDisplay(300, 400, 600, 450); AddDisplay(-300, 350, 300, 200); @@ -150,7 +172,7 @@ // - - 0 6 7 8 1 1 1 1 // 7 4 0 0 0 2 3 5 9 // 0 0 0 5 0 0 -TEST_F(DesktopDisplayInfoTest, Multimon7) { +TEST_F(DesktopDisplayInfoTest, MAYBE_Multimon7) { AddDisplay(80, -10, 70, 60); AddDisplay(60, -50, 60, 40); AddDisplay(-70, 40, 30, 60);
diff --git a/remoting/host/security_key/security_key_ipc_server_unittest.cc b/remoting/host/security_key/security_key_ipc_server_unittest.cc index 0c26aa79..185416a 100644 --- a/remoting/host/security_key/security_key_ipc_server_unittest.cc +++ b/remoting/host/security_key/security_key_ipc_server_unittest.cc
@@ -27,7 +27,7 @@ namespace { const int kTestConnectionId = 42; const int kInitialConnectTimeoutMs = 250; -const int kConnectionTimeoutErrorDeltaMs = 100; +const int kConnectionTimeoutErrorDeltaMs = 250; const int kLargeResponseTimeoutMs = 500; const int kLargeMessageSizeBytes = 256 * 1024; } // namespace
diff --git a/remoting/signaling/BUILD.gn b/remoting/signaling/BUILD.gn index 8b683bfc..9227f139 100644 --- a/remoting/signaling/BUILD.gn +++ b/remoting/signaling/BUILD.gn
@@ -134,6 +134,7 @@ sources = [ "ftl_message_reception_channel_unittest.cc", "ftl_messaging_client_unittest.cc", + "ftl_registration_manager_unittest.cc", "ftl_signal_strategy_unittest.cc", "iq_sender_unittest.cc", "jid_util_unittest.cc",
diff --git a/remoting/signaling/ftl_registration_manager.cc b/remoting/signaling/ftl_registration_manager.cc index 344e4d8..7e25896 100644 --- a/remoting/signaling/ftl_registration_manager.cc +++ b/remoting/signaling/ftl_registration_manager.cc
@@ -13,6 +13,7 @@ #include "remoting/base/grpc_support/grpc_async_unary_request.h" #include "remoting/base/grpc_support/grpc_authenticated_executor.h" #include "remoting/base/grpc_support/grpc_executor.h" +#include "remoting/proto/ftl/v1/ftl_services.grpc.pb.h" #include "remoting/signaling/ftl_device_id_provider.h" #include "remoting/signaling/ftl_grpc_context.h" @@ -37,14 +38,61 @@ } // namespace +class FtlRegistrationManager::RegistrationClientImpl final + : public FtlRegistrationManager::RegistrationClient { + public: + explicit RegistrationClientImpl(OAuthTokenGetter* token_getter); + ~RegistrationClientImpl() override; + + // RegistrationClient implementations. + void SignInGaia(const ftl::SignInGaiaRequest& request, + SignInGaiaResponseCallback on_done) override; + void CancelPendingRequests() override; + + private: + using Registration = + google::internal::communications::instantmessaging::v1::Registration; + + GrpcAuthenticatedExecutor executor_; + std::unique_ptr<Registration::Stub> registration_stub_; + + DISALLOW_COPY_AND_ASSIGN(RegistrationClientImpl); +}; + +FtlRegistrationManager::RegistrationClientImpl::RegistrationClientImpl( + OAuthTokenGetter* token_getter) + : executor_(token_getter), + registration_stub_( + Registration::NewStub(FtlGrpcContext::CreateChannel())) {} + +FtlRegistrationManager::RegistrationClientImpl::~RegistrationClientImpl() = + default; + +void FtlRegistrationManager::RegistrationClientImpl::SignInGaia( + const ftl::SignInGaiaRequest& request, + SignInGaiaResponseCallback on_done) { + auto grpc_request = CreateGrpcAsyncUnaryRequest( + base::BindOnce(&Registration::Stub::AsyncSignInGaia, + base::Unretained(registration_stub_.get())), + request, std::move(on_done)); + FtlGrpcContext::FillClientContext(grpc_request->context()); + executor_.ExecuteRpc(std::move(grpc_request)); +} + +void FtlRegistrationManager::RegistrationClientImpl::CancelPendingRequests() { + executor_.CancelPendingRequests(); +} + +// End of RegistrationClientImplImpl + FtlRegistrationManager::FtlRegistrationManager( OAuthTokenGetter* token_getter, std::unique_ptr<FtlDeviceIdProvider> device_id_provider) - : executor_(std::make_unique<GrpcAuthenticatedExecutor>(token_getter)), + : registration_client_( + std::make_unique<RegistrationClientImpl>(token_getter)), device_id_provider_(std::move(device_id_provider)), sign_in_backoff_(&FtlGrpcContext::GetBackoffPolicy()) { DCHECK(device_id_provider_); - registration_stub_ = Registration::NewStub(FtlGrpcContext::CreateChannel()); } FtlRegistrationManager::~FtlRegistrationManager() = default; @@ -62,7 +110,7 @@ if (!IsSignedIn()) { return; } - executor_->CancelPendingRequests(); + registration_client_->CancelPendingRequests(); sign_in_refresh_timer_.Stop(); registration_id_.clear(); ftl_auth_token_.clear(); @@ -96,14 +144,9 @@ request.mutable_register_data()->add_caps(kFtlCapabilities[i]); } - auto grpc_request = CreateGrpcAsyncUnaryRequest( - base::BindOnce(&Registration::Stub::AsyncSignInGaia, - base::Unretained(registration_stub_.get())), - request, - base::BindOnce(&FtlRegistrationManager::OnSignInGaiaResponse, - base::Unretained(this), std::move(on_done))); - FtlGrpcContext::FillClientContext(grpc_request->context()); - executor_->ExecuteRpc(std::move(grpc_request)); + registration_client_->SignInGaia( + request, base::BindOnce(&FtlRegistrationManager::OnSignInGaiaResponse, + base::Unretained(this), std::move(on_done))); } void FtlRegistrationManager::OnSignInGaiaResponse(
diff --git a/remoting/signaling/ftl_registration_manager.h b/remoting/signaling/ftl_registration_manager.h index 2c429d2b..0ee3b58b 100644 --- a/remoting/signaling/ftl_registration_manager.h +++ b/remoting/signaling/ftl_registration_manager.h
@@ -12,13 +12,22 @@ #include "base/macros.h" #include "base/timer/timer.h" #include "net/base/backoff_entry.h" -#include "remoting/proto/ftl/v1/ftl_services.grpc.pb.h" #include "remoting/signaling/registration_manager.h" +namespace grpc { +class Status; +} // namespace grpc + namespace remoting { +namespace ftl { + +class SignInGaiaRequest; +class SignInGaiaResponse; + +} // namespace ftl + class FtlDeviceIdProvider; -class GrpcExecutor; class OAuthTokenGetter; // Class for registering the user with FTL service. @@ -39,17 +48,28 @@ std::string GetFtlAuthToken() const override; private: - using Registration = - google::internal::communications::instantmessaging::v1::Registration; + using SignInGaiaResponseCallback = + base::OnceCallback<void(const grpc::Status&, + const ftl::SignInGaiaResponse&)>; + + friend class FtlRegistrationManagerTest; + + class RegistrationClient { + public: + virtual ~RegistrationClient() = default; + virtual void SignInGaia(const ftl::SignInGaiaRequest& request, + SignInGaiaResponseCallback on_done) = 0; + virtual void CancelPendingRequests() = 0; + }; + class RegistrationClientImpl; void DoSignInGaia(DoneCallback on_done); void OnSignInGaiaResponse(DoneCallback on_done, const grpc::Status& status, const ftl::SignInGaiaResponse& response); - std::unique_ptr<GrpcExecutor> executor_; + std::unique_ptr<RegistrationClient> registration_client_; std::unique_ptr<FtlDeviceIdProvider> device_id_provider_; - std::unique_ptr<Registration::Stub> registration_stub_; base::OneShotTimer sign_in_backoff_timer_; base::OneShotTimer sign_in_refresh_timer_; std::string registration_id_;
diff --git a/remoting/signaling/ftl_registration_manager_unittest.cc b/remoting/signaling/ftl_registration_manager_unittest.cc new file mode 100644 index 0000000..52040fa7 --- /dev/null +++ b/remoting/signaling/ftl_registration_manager_unittest.cc
@@ -0,0 +1,191 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "remoting/signaling/ftl_registration_manager.h" + +#include "base/guid.h" +#include "base/test/mock_callback.h" +#include "base/test/scoped_task_environment.h" +#include "base/time/time.h" +#include "remoting/base/fake_oauth_token_getter.h" +#include "remoting/proto/ftl/v1/ftl_messages.pb.h" +#include "remoting/signaling/ftl_client_uuid_device_id_provider.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace remoting { + +namespace { + +using testing::_; + +using SignInGaiaResponseCallback = + base::OnceCallback<void(const grpc::Status&, + const ftl::SignInGaiaResponse&)>; + +constexpr char kAuthToken[] = "auth_token"; +constexpr int64_t kAuthTokenExpiresInMicroseconds = 86400000000; // = 1 day +constexpr base::TimeDelta kAuthTokenExpiration = + base::TimeDelta::FromMicroseconds(kAuthTokenExpiresInMicroseconds); + +MATCHER_P(HasErrorCode, error_code, "") { + return arg.error_code() == error_code; +} + +MATCHER(IsStatusOk, "") { + return arg.ok(); +} + +void VerifySignInGaiaRequest(const ftl::SignInGaiaRequest& request) { + ASSERT_EQ(ftl::SignInGaiaMode_Value_DEFAULT_CREATE_ACCOUNT, request.mode()); + ASSERT_TRUE(base::IsValidGUID(request.register_data().device_id().id())); + ASSERT_LT(0, request.register_data().caps_size()); +} + +decltype(auto) RespondOkToSignInGaia(const std::string& registration_id) { + return [registration_id](const ftl::SignInGaiaRequest& request, + SignInGaiaResponseCallback on_done) { + VerifySignInGaiaRequest(request); + ftl::SignInGaiaResponse response; + response.set_registration_id(registration_id); + response.mutable_auth_token()->set_payload(kAuthToken); + response.mutable_auth_token()->set_expires_in( + kAuthTokenExpiresInMicroseconds); + std::move(on_done).Run(grpc::Status::OK, response); + }; +} + +} // namespace + +class FtlRegistrationManagerTest : public testing::Test { + public: + FtlRegistrationManagerTest() { + auto registration_client = std::make_unique<MockRegistrationClient>(); + registration_client_ = registration_client.get(); + registration_manager_.registration_client_ = std::move(registration_client); + } + + ~FtlRegistrationManagerTest() override = default; + + protected: + class MockRegistrationClient + : public FtlRegistrationManager::RegistrationClient { + public: + MOCK_METHOD2(SignInGaia, + void(const ftl::SignInGaiaRequest&, + SignInGaiaResponseCallback)); + MOCK_METHOD0(CancelPendingRequests, void()); + }; + + const net::BackoffEntry& GetBackoff() const { + return registration_manager_.sign_in_backoff_; + } + + base::test::ScopedTaskEnvironment scoped_task_environment_{ + base::test::ScopedTaskEnvironment::MainThreadType::MOCK_TIME, + base::test::ScopedTaskEnvironment::NowSource::MAIN_THREAD_MOCK_TIME}; + FakeOAuthTokenGetter token_getter{OAuthTokenGetter::SUCCESS, "fake_email", + "access_token"}; + FtlRegistrationManager registration_manager_{ + &token_getter, std::make_unique<FtlClientUuidDeviceIdProvider>()}; + MockRegistrationClient* registration_client_ = nullptr; + base::MockCallback<base::RepeatingCallback<void(const grpc::Status& status)>> + done_callback_; +}; + +TEST_F(FtlRegistrationManagerTest, SignInGaiaAndAutorefresh) { + ASSERT_FALSE(registration_manager_.IsSignedIn()); + ASSERT_TRUE(registration_manager_.GetRegistrationId().empty()); + ASSERT_TRUE(registration_manager_.GetFtlAuthToken().empty()); + + EXPECT_CALL(*registration_client_, SignInGaia(_, _)) + .WillOnce(RespondOkToSignInGaia("registration_id_1")) + .WillOnce(RespondOkToSignInGaia("registration_id_2")); + + EXPECT_CALL(done_callback_, Run(IsStatusOk())).Times(1); + registration_manager_.SignInGaia(done_callback_.Get()); + scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + + ASSERT_TRUE(registration_manager_.IsSignedIn()); + ASSERT_EQ("registration_id_1", registration_manager_.GetRegistrationId()); + ASSERT_EQ(kAuthToken, registration_manager_.GetFtlAuthToken()); + + scoped_task_environment_.FastForwardBy(kAuthTokenExpiration); + scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + ASSERT_EQ("registration_id_2", registration_manager_.GetRegistrationId()); +} + +TEST_F(FtlRegistrationManagerTest, FailedToSignIn_Backoff) { + ASSERT_FALSE(registration_manager_.IsSignedIn()); + ASSERT_TRUE(registration_manager_.GetRegistrationId().empty()); + ASSERT_TRUE(registration_manager_.GetFtlAuthToken().empty()); + ASSERT_EQ(0, GetBackoff().failure_count()); + + EXPECT_CALL(*registration_client_, SignInGaia(_, _)) + .WillOnce([](const ftl::SignInGaiaRequest& request, + SignInGaiaResponseCallback on_done) { + VerifySignInGaiaRequest(request); + std::move(on_done).Run( + grpc::Status(grpc::StatusCode::UNAVAILABLE, "unavailable"), {}); + }) + .WillOnce([](const ftl::SignInGaiaRequest& request, + SignInGaiaResponseCallback on_done) { + VerifySignInGaiaRequest(request); + std::move(on_done).Run( + grpc::Status(grpc::StatusCode::UNAUTHENTICATED, "unauthenticated"), + {}); + }) + .WillOnce(RespondOkToSignInGaia("registration_id")); + + EXPECT_CALL(done_callback_, Run(HasErrorCode(grpc::StatusCode::UNAVAILABLE))) + .Times(1); + registration_manager_.SignInGaia(done_callback_.Get()); + scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + ASSERT_FALSE(registration_manager_.IsSignedIn()); + ASSERT_EQ(1, GetBackoff().failure_count()); + + EXPECT_CALL(done_callback_, + Run(HasErrorCode(grpc::StatusCode::UNAUTHENTICATED))) + .Times(1); + registration_manager_.SignInGaia(done_callback_.Get()); + scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + ASSERT_FALSE(registration_manager_.IsSignedIn()); + ASSERT_EQ(2, GetBackoff().failure_count()); + + EXPECT_CALL(done_callback_, Run(IsStatusOk())).Times(1); + registration_manager_.SignInGaia(done_callback_.Get()); + scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + ASSERT_TRUE(registration_manager_.IsSignedIn()); + ASSERT_EQ("registration_id", registration_manager_.GetRegistrationId()); + ASSERT_EQ(0, GetBackoff().failure_count()); +} + +TEST_F(FtlRegistrationManagerTest, SignOut) { + ASSERT_FALSE(registration_manager_.IsSignedIn()); + ASSERT_TRUE(registration_manager_.GetRegistrationId().empty()); + ASSERT_TRUE(registration_manager_.GetFtlAuthToken().empty()); + + EXPECT_CALL(*registration_client_, SignInGaia(_, _)) + .WillOnce(RespondOkToSignInGaia("registration_id")); + + EXPECT_CALL(done_callback_, Run(IsStatusOk())).Times(1); + registration_manager_.SignInGaia(done_callback_.Get()); + scoped_task_environment_.FastForwardBy(GetBackoff().GetTimeUntilRelease()); + + ASSERT_TRUE(registration_manager_.IsSignedIn()); + ASSERT_EQ("registration_id", registration_manager_.GetRegistrationId()); + ASSERT_EQ(kAuthToken, registration_manager_.GetFtlAuthToken()); + + EXPECT_CALL(*registration_client_, CancelPendingRequests()).Times(1); + + registration_manager_.SignOut(); + ASSERT_FALSE(registration_manager_.IsSignedIn()); + ASSERT_TRUE(registration_manager_.GetRegistrationId().empty()); + ASSERT_TRUE(registration_manager_.GetFtlAuthToken().empty()); + + scoped_task_environment_.FastForwardUntilNoTasksRemain(); + ASSERT_FALSE(registration_manager_.IsSignedIn()); +} + +} // namespace remoting
diff --git a/services/identity/public/cpp/access_token_fetcher.cc b/services/identity/public/cpp/access_token_fetcher.cc index 2afe09e..89e2802 100644 --- a/services/identity/public/cpp/access_token_fetcher.cc +++ b/services/identity/public/cpp/access_token_fetcher.cc
@@ -137,7 +137,7 @@ } void AccessTokenFetcher::OnRefreshTokenAvailable( - const std::string& account_id) { + const CoreAccountId& account_id) { DCHECK_EQ(Mode::kWaitUntilRefreshTokenAvailable, mode_); if (!IsRefreshTokenAvailable())
diff --git a/services/identity/public/cpp/access_token_fetcher.h b/services/identity/public/cpp/access_token_fetcher.h index c09c56af..41bfa34 100644 --- a/services/identity/public/cpp/access_token_fetcher.h +++ b/services/identity/public/cpp/access_token_fetcher.h
@@ -104,7 +104,7 @@ void StartAccessTokenRequest(); // OAuth2TokenService::Observer implementation. - void OnRefreshTokenAvailable(const std::string& account_id) override; + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override; // OAuth2TokenService::Consumer implementation. void OnGetTokenSuccess(
diff --git a/services/identity/public/cpp/identity_manager.cc b/services/identity/public/cpp/identity_manager.cc index 12bd2ad..1015ccc 100644 --- a/services/identity/public/cpp/identity_manager.cc +++ b/services/identity/public/cpp/identity_manager.cc
@@ -516,16 +516,16 @@ primary_account_.reset(); } -void IdentityManager::OnRefreshTokenAvailable(const std::string& account_id) { +void IdentityManager::OnRefreshTokenAvailable(const CoreAccountId& account_id) { CoreAccountInfo account_info = - GetAccountInfoForAccountWithRefreshToken(CoreAccountId(account_id)); + GetAccountInfoForAccountWithRefreshToken(account_id); for (auto& observer : observer_list_) { observer.OnRefreshTokenUpdatedForAccount(account_info); } } -void IdentityManager::OnRefreshTokenRevoked(const std::string& account_id) { +void IdentityManager::OnRefreshTokenRevoked(const CoreAccountId& account_id) { for (auto& observer : observer_list_) { observer.OnRefreshTokenRemovedForAccount(account_id); } @@ -542,10 +542,10 @@ } void IdentityManager::OnAuthErrorChanged( - const std::string& account_id, + const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) { CoreAccountInfo account_info = - GetAccountInfoForAccountWithRefreshToken(CoreAccountId(account_id)); + GetAccountInfoForAccountWithRefreshToken(account_id); for (auto& observer : observer_list_) observer.OnErrorStateOfRefreshTokenUpdatedForAccount(account_info,
diff --git a/services/identity/public/cpp/identity_manager.h b/services/identity/public/cpp/identity_manager.h index 1fe4c55..97c05973 100644 --- a/services/identity/public/cpp/identity_manager.h +++ b/services/identity/public/cpp/identity_manager.h
@@ -589,11 +589,11 @@ void AuthenticatedAccountCleared() override; // OAuth2TokenService::Observer: - void OnRefreshTokenAvailable(const std::string& account_id) override; - void OnRefreshTokenRevoked(const std::string& account_id) override; + void OnRefreshTokenAvailable(const CoreAccountId& account_id) override; + void OnRefreshTokenRevoked(const CoreAccountId& account_id) override; void OnRefreshTokensLoaded() override; void OnEndBatchChanges() override; - void OnAuthErrorChanged(const std::string& account_id, + void OnAuthErrorChanged(const CoreAccountId& account_id, const GoogleServiceAuthError& auth_error) override; // GaiaCookieManagerService callbacks:
diff --git a/services/viz/public/cpp/compositing/copy_output_result_struct_traits.cc b/services/viz/public/cpp/compositing/copy_output_result_struct_traits.cc index 5c318996..da6b5143 100644 --- a/services/viz/public/cpp/compositing/copy_output_result_struct_traits.cc +++ b/services/viz/public/cpp/compositing/copy_output_result_struct_traits.cc
@@ -157,20 +157,33 @@ viz::CopyOutputResult::Format format; gfx::Rect rect; - if (!data.ReadFormat(&format) || !data.ReadRect(&rect)) + // TODO(crbug.com/967856): Removed detailed logging for deserialization + // failures after bug is fixed. + + if (!data.ReadFormat(&format)) { + LOG(ERROR) << "CopyOutputResult: Failed to read |format|"; return false; + } + if (!data.ReadRect(&rect)) { + LOG(ERROR) << "CopyOutputResult: Failed to read |rect|."; + return false; + } switch (format) { case viz::CopyOutputResult::Format::RGBA_BITMAP: { SkBitmap bitmap; - if (!data.ReadBitmap(&bitmap)) + if (!data.ReadBitmap(&bitmap)) { + LOG(ERROR) << "CopyOutputResult: Failed to read |bitmap|"; return false; + } bool has_bitmap = bitmap.readyToDraw(); // The rect should be empty iff there is no bitmap. - if (!(has_bitmap == !rect.IsEmpty())) + if (has_bitmap == rect.IsEmpty()) { + LOG(ERROR) << "CopyOutputResult: has_bitmap == rect.IsEmpty()"; return false; + } *out_p = std::make_unique<viz::CopyOutputSkBitmapResult>( rect, std::move(bitmap)); @@ -179,20 +192,28 @@ case viz::CopyOutputResult::Format::RGBA_TEXTURE: { base::Optional<gpu::Mailbox> mailbox; - if (!data.ReadMailbox(&mailbox) || !mailbox) + if (!data.ReadMailbox(&mailbox) || !mailbox) { + LOG(ERROR) << "CopyOutputResult: Failed to read |mailbox|"; return false; + } base::Optional<gpu::SyncToken> sync_token; - if (!data.ReadSyncToken(&sync_token) || !sync_token) + if (!data.ReadSyncToken(&sync_token) || !sync_token) { + LOG(ERROR) << "CopyOutputResult: Failed to read |sync_token|"; return false; + } base::Optional<gfx::ColorSpace> color_space; - if (!data.ReadColorSpace(&color_space) || !color_space) + if (!data.ReadColorSpace(&color_space) || !color_space) { + LOG(ERROR) << "CopyOutputResult: Failed to read |color_space|"; return false; + } bool has_mailbox = !mailbox->IsZero(); // The rect should be empty iff there is no texture. - if (!(has_mailbox == !rect.IsEmpty())) + if (has_mailbox == rect.IsEmpty()) { + LOG(ERROR) << "CopyOutputResult: has_mailbox == rect.IsEmpty()"; return false; + } if (!has_mailbox) { // Returns an empty result. @@ -203,8 +224,10 @@ viz::mojom::TextureReleaserPtr releaser = data.TakeReleaser<viz::mojom::TextureReleaserPtr>(); - if (!releaser) + if (!releaser) { + LOG(ERROR) << "CopyOutputResult: Failed to take |releaser|"; return false; // Illegal to provide texture without Releaser. + } // Returns a result with a SingleReleaseCallback that will return // here and proxy the callback over mojo to the CopyOutputResult's
diff --git a/storage/browser/fileapi/obfuscated_file_util_unittest.cc b/storage/browser/fileapi/obfuscated_file_util_unittest.cc index c2bd85b..c56919b90 100644 --- a/storage/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/storage/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -49,6 +49,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/leveldatabase/leveldb_chrome.h" +// TODO(crbug.com/961068): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_TestQuotaOnTruncation DISABLED_TestQuotaOnTruncation +#else +#define MAYBE_TestQuotaOnTruncation TestQuotaOnTruncation +#endif + using content::AsyncFileTestHelper; using storage::FileSystemContext; using storage::FileSystemOperation; @@ -978,7 +985,7 @@ EXPECT_TRUE(change_observer()->HasNoChange()); } -TEST_P(ObfuscatedFileUtilTest, TestQuotaOnTruncation) { +TEST_P(ObfuscatedFileUtilTest, MAYBE_TestQuotaOnTruncation) { bool created = false; FileSystemURL url = CreateURLFromUTF8("file");
diff --git a/testing/BUILD.gn b/testing/BUILD.gn index 7ed5f3d6..a5ccdd3 100644 --- a/testing/BUILD.gn +++ b/testing/BUILD.gn
@@ -27,25 +27,6 @@ ] } -if (is_mac || is_win) { - group("rendering_representative_perf_tests") { - testonly = true - deps = [ - "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", - ] - data = [ - "//build/android/pylib", - "//chrome/test/data/perf", - "//components/variations/service/generate_ui_string_overrider.py", - "//testing/scripts", - "//testing/test_env.py", - "//testing/xvfb.py", - "//third_party/catapult", - "//tools", - ] - } -} - group("run_perf_test") { data = [ "//testing/scripts/common.py",
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index dbe4cb5..5692bf0 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -2243,7 +2243,7 @@ "--output-format=csv", "--browser=release", ], - "label": "//testing:rendering_representative_perf_tests", + "label": "//chrome/test:rendering_representative_perf_tests", "script": "//testing/scripts/run_rendering_benchmark_with_gated_performance.py", "type": "script", },
diff --git a/third_party/blink/common/mediastream/media_stream_mojom_traits.cc b/third_party/blink/common/mediastream/media_stream_mojom_traits.cc index 8dec0ad2..3ef4409 100644 --- a/third_party/blink/common/mediastream/media_stream_mojom_traits.cc +++ b/third_party/blink/common/mediastream/media_stream_mojom_traits.cc
@@ -82,119 +82,6 @@ } // static -blink::mojom::MediaStreamRequestResult EnumTraits< - blink::mojom::MediaStreamRequestResult, - blink::MediaStreamRequestResult>::ToMojom(blink::MediaStreamRequestResult - result) { - switch (result) { - case blink::MediaStreamRequestResult::MEDIA_DEVICE_OK: - return blink::mojom::MediaStreamRequestResult::OK; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_PERMISSION_DENIED: - return blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_PERMISSION_DISMISSED: - return blink::mojom::MediaStreamRequestResult::PERMISSION_DISMISSED; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_INVALID_STATE: - return blink::mojom::MediaStreamRequestResult::INVALID_STATE; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_NO_HARDWARE: - return blink::mojom::MediaStreamRequestResult::NO_HARDWARE; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_INVALID_SECURITY_ORIGIN: - return blink::mojom::MediaStreamRequestResult::INVALID_SECURITY_ORIGIN; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_TAB_CAPTURE_FAILURE: - return blink::mojom::MediaStreamRequestResult::TAB_CAPTURE_FAILURE; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE: - return blink::mojom::MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_CAPTURE_FAILURE: - return blink::mojom::MediaStreamRequestResult::CAPTURE_FAILURE; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED: - return blink::mojom::MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; - case blink::MediaStreamRequestResult:: - MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO: - return blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO; - case blink::MediaStreamRequestResult:: - MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO: - return blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_NOT_SUPPORTED: - return blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN: - return blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_KILL_SWITCH_ON: - return blink::mojom::MediaStreamRequestResult::KILL_SWITCH_ON; - case blink::MediaStreamRequestResult::MEDIA_DEVICE_SYSTEM_PERMISSION_DENIED: - return blink::mojom::MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED; - default: - break; - } - NOTREACHED(); - return blink::mojom::MediaStreamRequestResult::OK; -} - -// static -bool EnumTraits<blink::mojom::MediaStreamRequestResult, - blink::MediaStreamRequestResult>:: - FromMojom(blink::mojom::MediaStreamRequestResult input, - blink::MediaStreamRequestResult* out) { - switch (input) { - case blink::mojom::MediaStreamRequestResult::OK: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_OK; - return true; - case blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_PERMISSION_DENIED; - return true; - case blink::mojom::MediaStreamRequestResult::PERMISSION_DISMISSED: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_PERMISSION_DISMISSED; - return true; - case blink::mojom::MediaStreamRequestResult::INVALID_STATE: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_INVALID_STATE; - return true; - case blink::mojom::MediaStreamRequestResult::NO_HARDWARE: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_NO_HARDWARE; - return true; - case blink::mojom::MediaStreamRequestResult::INVALID_SECURITY_ORIGIN: - *out = - blink::MediaStreamRequestResult::MEDIA_DEVICE_INVALID_SECURITY_ORIGIN; - return true; - case blink::mojom::MediaStreamRequestResult::TAB_CAPTURE_FAILURE: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_TAB_CAPTURE_FAILURE; - return true; - case blink::mojom::MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE: - *out = - blink::MediaStreamRequestResult::MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE; - return true; - case blink::mojom::MediaStreamRequestResult::CAPTURE_FAILURE: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_CAPTURE_FAILURE; - return true; - case blink::mojom::MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED: - *out = blink::MediaStreamRequestResult:: - MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED; - return true; - case blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO: - *out = blink::MediaStreamRequestResult:: - MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO; - return true; - case blink::mojom::MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO: - *out = blink::MediaStreamRequestResult:: - MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO; - return true; - case blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_NOT_SUPPORTED; - return true; - case blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN: - *out = - blink::MediaStreamRequestResult::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN; - return true; - case blink::mojom::MediaStreamRequestResult::KILL_SWITCH_ON: - *out = blink::MediaStreamRequestResult::MEDIA_DEVICE_KILL_SWITCH_ON; - return true; - case blink::mojom::MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED: - *out = blink::MediaStreamRequestResult:: - MEDIA_DEVICE_SYSTEM_PERMISSION_DENIED; - return true; - } - NOTREACHED(); - return false; -} - -// static bool StructTraits<blink::mojom::MediaStreamDeviceDataView, blink::MediaStreamDevice>:: Read(blink::mojom::MediaStreamDeviceDataView input,
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 6e104e69..bacd5d5 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -149,7 +149,6 @@ "platform/modules/mediastream/web_platform_media_stream_source.h", "platform/modules/mediastream/web_platform_media_stream_track.h", "platform/modules/mediastream/webrtc_uma_histograms.h", - "platform/modules/push_messaging/web_push_client.h", "platform/modules/push_messaging/web_push_error.h", "platform/modules/push_messaging/web_push_subscription.h", "platform/modules/remoteplayback/web_remote_playback_client.h", @@ -530,6 +529,7 @@ "//services/device/public/mojom:mojom_shared_cpp_sources", "//services/network/public/cpp:cpp", "//services/network/public/mojom", + "//third_party/blink/renderer/platform/wtf:wtf", "//third_party/webrtc/api:libjingle_peerconnection_api", "//third_party/webrtc/api:rtc_stats_api", "//third_party/webrtc/media:rtc_media_base",
diff --git a/third_party/blink/public/common/mediastream/media_stream.typemap b/third_party/blink/public/common/mediastream/media_stream.typemap index f18a24d..2fded1c0 100644 --- a/third_party/blink/public/common/mediastream/media_stream.typemap +++ b/third_party/blink/public/common/mediastream/media_stream.typemap
@@ -16,7 +16,6 @@ type_mappings = [ "blink.mojom.MediaStreamDevice=blink::MediaStreamDevice", - "blink.mojom.MediaStreamRequestResult=blink::MediaStreamRequestResult", "blink.mojom.MediaStreamType=blink::MediaStreamType", "blink.mojom.StreamControls=blink::StreamControls", "blink.mojom.TrackControls=blink::TrackControls",
diff --git a/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h b/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h index a3c3fca..6815314 100644 --- a/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h +++ b/third_party/blink/public/common/mediastream/media_stream_mojom_traits.h
@@ -22,16 +22,6 @@ }; template <> -struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::MediaStreamRequestResult, - blink::MediaStreamRequestResult> { - static blink::mojom::MediaStreamRequestResult ToMojom( - blink::MediaStreamRequestResult result); - - static bool FromMojom(blink::mojom::MediaStreamRequestResult input, - blink::MediaStreamRequestResult* out); -}; - -template <> struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::MediaStreamDeviceDataView, blink::MediaStreamDevice> { static const blink::MediaStreamType& type(
diff --git a/third_party/blink/public/common/mediastream/media_stream_request.h b/third_party/blink/public/common/mediastream/media_stream_request.h index c062c41..117db7b 100644 --- a/third_party/blink/public/common/mediastream/media_stream_request.h +++ b/third_party/blink/public/common/mediastream/media_stream_request.h
@@ -57,28 +57,6 @@ MEDIA_OPEN_DEVICE_PEPPER_ONLY // Only used in requests made by Pepper. }; -// Elements in this enum should not be deleted or rearranged; the only -// permitted operation is to add new elements before NUM_MEDIA_REQUEST_RESULTS. -enum MediaStreamRequestResult { - MEDIA_DEVICE_OK = 0, - MEDIA_DEVICE_PERMISSION_DENIED = 1, - MEDIA_DEVICE_PERMISSION_DISMISSED = 2, - MEDIA_DEVICE_INVALID_STATE = 3, - MEDIA_DEVICE_NO_HARDWARE = 4, - MEDIA_DEVICE_INVALID_SECURITY_ORIGIN = 5, - MEDIA_DEVICE_TAB_CAPTURE_FAILURE = 6, - MEDIA_DEVICE_SCREEN_CAPTURE_FAILURE = 7, - MEDIA_DEVICE_CAPTURE_FAILURE = 8, - MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED = 9, - MEDIA_DEVICE_TRACK_START_FAILURE_AUDIO = 10, - MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO = 11, - MEDIA_DEVICE_NOT_SUPPORTED = 12, - MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN = 13, - MEDIA_DEVICE_KILL_SWITCH_ON = 14, - MEDIA_DEVICE_SYSTEM_PERMISSION_DENIED = 15, - NUM_MEDIA_REQUEST_RESULTS -}; - // Convenience predicates to determine whether the given type represents some // audio or some video device. BLINK_COMMON_EXPORT bool IsAudioInputMediaType(MediaStreamType type);
diff --git a/third_party/blink/public/mojom/mediastream/media_stream.mojom b/third_party/blink/public/mojom/mediastream/media_stream.mojom index c4356b1..a3b25fd 100644 --- a/third_party/blink/public/mojom/mediastream/media_stream.mojom +++ b/third_party/blink/public/mojom/mediastream/media_stream.mojom
@@ -22,7 +22,8 @@ NUM_MEDIA_TYPES }; -// See public/common/media_stream_request.h. +// Elements in this enum should not be deleted or rearranged; the only +// permitted operation is to add new elements before NUM_MEDIA_REQUEST_RESULTS. enum MediaStreamRequestResult { OK, PERMISSION_DENIED, @@ -39,7 +40,8 @@ NOT_SUPPORTED, FAILED_DUE_TO_SHUTDOWN, KILL_SWITCH_ON, - SYSTEM_PERMISSION_DENIED + SYSTEM_PERMISSION_DENIED, + NUM_MEDIA_REQUEST_RESULTS }; // See public/common/media_stream_request.h.
diff --git a/third_party/blink/public/mojom/push_messaging/push_messaging.mojom b/third_party/blink/public/mojom/push_messaging/push_messaging.mojom index 08bd8d8..d3a4ae1 100644 --- a/third_party/blink/public/mojom/push_messaging/push_messaging.mojom +++ b/third_party/blink/public/mojom/push_messaging/push_messaging.mojom
@@ -26,8 +26,7 @@ }; interface PushMessaging { - Subscribe(int32 render_frame_id, - int64 service_worker_registration_id, + Subscribe(int64 service_worker_registration_id, PushSubscriptionOptions options, bool user_gesture) => (PushRegistrationStatus status,
diff --git a/third_party/blink/public/mojom/web_feature/PRESUBMIT.py b/third_party/blink/public/mojom/web_feature/PRESUBMIT.py index a249aac5..2cf03a4a 100644 --- a/third_party/blink/public/mojom/web_feature/PRESUBMIT.py +++ b/third_party/blink/public/mojom/web_feature/PRESUBMIT.py
@@ -21,14 +21,13 @@ finally: sys.path = original_sys_path - source_path = '' for f in input_api.AffectedFiles(): if f.LocalPath().endswith('web_feature.mojom'): - source_path = f.LocalPath() break else: return [] + source_path = 'third_party/blink/public/mojom/web_feature/web_feature.mojom' start_marker = '^enum WebFeature {' end_marker = '^kNumberOfFeatures' presubmit_error = update_histogram_enum.CheckPresubmitErrors(
diff --git a/third_party/blink/public/platform/interface_registry.h b/third_party/blink/public/platform/interface_registry.h index 7bb6909..3e89221b 100644 --- a/third_party/blink/public/platform/interface_registry.h +++ b/third_party/blink/public/platform/interface_registry.h
@@ -14,7 +14,7 @@ #if INSIDE_BLINK #include "mojo/public/cpp/bindings/associated_interface_request.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" // nogncheck +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" // nogncheck #include "third_party/blink/renderer/platform/wtf/functional.h" // nogncheck #endif @@ -59,7 +59,7 @@ scoped_refptr<base::SingleThreadTaskRunner> task_runner) { AddInterface( Interface::Name_, - ConvertToBaseCallback(blink::CrossThreadBind( + ConvertToBaseCallback(CrossThreadBind( &InterfaceRegistry::ForwardToCrossThreadInterfaceFactory<Interface>, std::move(factory))), std::move(task_runner));
diff --git a/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h b/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h index 53ef3e5..8953e863 100644 --- a/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h +++ b/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h
@@ -7,6 +7,7 @@ #include "base/callback.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_media_stream_source.h" #include "third_party/blink/public/platform/web_private_ptr.h" @@ -32,15 +33,15 @@ using ConstraintsCallback = base::Callback<void(WebPlatformMediaStreamSource* source, - MediaStreamRequestResult result, + mojom::MediaStreamRequestResult result, const WebString& result_name)>; using ConstraintsRepeatingCallback = base::RepeatingCallback<void(WebPlatformMediaStreamSource* source, - MediaStreamRequestResult result, + mojom::MediaStreamRequestResult result, const WebString& result_name)>; using ConstraintsOnceCallback = base::OnceCallback<void(WebPlatformMediaStreamSource* source, - MediaStreamRequestResult result, + mojom::MediaStreamRequestResult result, const WebString& result_name)>; // Source constraints key for
diff --git a/third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h b/third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h index 7658c4c..dd6dcbb3 100644 --- a/third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h +++ b/third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h
@@ -9,6 +9,7 @@ #include "base/memory/singleton.h" #include "base/sequence_checker.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_rtc_api_name.h" @@ -31,7 +32,7 @@ BLINK_PLATFORM_EXPORT void LogUserMediaRequestWithNoResult( MediaStreamRequestState state); BLINK_PLATFORM_EXPORT void LogUserMediaRequestResult( - MediaStreamRequestResult result); + mojom::MediaStreamRequestResult result); // Helper method used to collect information about the number of times // different WebRTC APIs are called from JavaScript.
diff --git a/third_party/blink/public/platform/modules/push_messaging/web_push_client.h b/third_party/blink/public/platform/modules/push_messaging/web_push_client.h deleted file mode 100644 index 3d1df9ea..0000000 --- a/third_party/blink/public/platform/modules/push_messaging/web_push_client.h +++ /dev/null
@@ -1,30 +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 THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PUSH_MESSAGING_WEB_PUSH_CLIENT_H_ -#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PUSH_MESSAGING_WEB_PUSH_CLIENT_H_ - -#include <memory> -#include "third_party/blink/public/platform/modules/push_messaging/web_push_error.h" -#include "third_party/blink/public/platform/modules/push_messaging/web_push_subscription.h" -#include "third_party/blink/public/platform/web_callbacks.h" - -namespace blink { - -struct WebPushSubscriptionOptions; - -class WebPushClient { - public: - virtual ~WebPushClient() = default; - - // Ownership of the callbacks is transferred to the client. - virtual void Subscribe(int64_t service_worker_registration_id, - const WebPushSubscriptionOptions&, - bool user_gesture, - std::unique_ptr<WebPushSubscriptionCallbacks>) = 0; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PUSH_MESSAGING_WEB_PUSH_CLIENT_H_
diff --git a/third_party/blink/public/platform/web_resource_timing_info.h b/third_party/blink/public/platform/web_resource_timing_info.h index 7f43cefd..4edbd2f 100644 --- a/third_party/blink/public/platform/web_resource_timing_info.h +++ b/third_party/blink/public/platform/web_resource_timing_info.h
@@ -12,10 +12,7 @@ #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_url_load_timing.h" #include "third_party/blink/public/platform/web_vector.h" - -#if INSIDE_BLINK -#include "third_party/blink/renderer/platform/cross_thread_copier.h" // nogncheck -#endif +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink { @@ -92,15 +89,17 @@ WebVector<WebServerTimingInfo> server_timing; }; +} // namespace blink + +namespace WTF { #if INSIDE_BLINK template <> -struct CrossThreadCopier<WebResourceTimingInfo> { +struct CrossThreadCopier<blink::WebResourceTimingInfo> { STATIC_ONLY(CrossThreadCopier); - typedef WebResourceTimingInfo Type; - PLATFORM_EXPORT static Type Copy(const WebResourceTimingInfo&); + typedef blink::WebResourceTimingInfo Type; + PLATFORM_EXPORT static Type Copy(const blink::WebResourceTimingInfo&); }; #endif - -} // namespace blink +} // namespace WTF #endif
diff --git a/third_party/blink/public/platform/web_url_load_timing.h b/third_party/blink/public/platform/web_url_load_timing.h index a5ab4972..91ab5df 100644 --- a/third_party/blink/public/platform/web_url_load_timing.h +++ b/third_party/blink/public/platform/web_url_load_timing.h
@@ -37,7 +37,7 @@ #if INSIDE_BLINK #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" // nogncheck +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" // nogncheck #endif namespace blink { @@ -128,15 +128,17 @@ WebPrivatePtr<ResourceLoadTiming> private_; }; +} // namespace blink + +namespace WTF { #if INSIDE_BLINK template <> -struct CrossThreadCopier<WebURLLoadTiming> { +struct CrossThreadCopier<blink::WebURLLoadTiming> { STATIC_ONLY(CrossThreadCopier); - typedef WebURLLoadTiming Type; - PLATFORM_EXPORT static Type Copy(const WebURLLoadTiming&); + typedef blink::WebURLLoadTiming Type; + PLATFORM_EXPORT static Type Copy(const blink::WebURLLoadTiming&); }; #endif - -} // namespace blink +} // namespace WTF #endif
diff --git a/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h b/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h index b7c6b339..ec6612a 100644 --- a/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h +++ b/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h
@@ -17,6 +17,7 @@ #include "media/base/video_frame.h" #include "media/capture/video_capture_types.h" #include "third_party/blink/public/common/media/video_capture.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_types.h" #include "third_party/blink/public/platform/modules/mediastream/secure_display_link_tracker.h" #include "third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h" @@ -178,7 +179,7 @@ // captured frames. virtual void StartSourceImpl( const VideoCaptureDeliverFrameCB& frame_callback) = 0; - void OnStartDone(MediaStreamRequestResult result); + void OnStartDone(mojom::MediaStreamRequestResult result); // A subclass that supports restart must override this method such that it // immediately stop producing video frames after this method is called.
diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h index 632a9448..2d7e71c 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h
@@ -109,7 +109,6 @@ class WebNavigationControl; class WebServiceWorkerProvider; class WebPlugin; -class WebPushClient; class WebRTCPeerConnectionHandler; class WebRelatedAppsFetcher; class WebSocketHandshakeThrottle; @@ -535,11 +534,6 @@ // Called to abort a navigation that is being handled by the browser process. virtual void AbortClientNavigation() {} - // Push API --------------------------------------------------- - - // Used to access the embedder for the Push API. - virtual WebPushClient* PushClient() { return nullptr; } - // InstalledApp API ---------------------------------------------------- // Used to access the embedder for the InstalledApp API.
diff --git a/third_party/blink/renderer/bindings/core/v8/dom_wrapper_world_test.cc b/third_party/blink/renderer/bindings/core/v8/dom_wrapper_world_test.cc index 6c056df..bba5b3b 100644 --- a/third_party/blink/renderer/bindings/core/v8/dom_wrapper_world_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/dom_wrapper_world_test.cc
@@ -12,10 +12,10 @@ #include "third_party/blink/renderer/core/workers/worker_backing_thread.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { namespace {
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer.cc b/third_party/blink/renderer/bindings/core/v8/script_streamer.cc index b436793f..ab83755e 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/loader/resource/script_resource.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/loader/fetch/cached_metadata.h" #include "third_party/blink/renderer/platform/loader/fetch/resource.h" @@ -29,6 +28,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" #include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding_registry.h"
diff --git a/third_party/blink/renderer/core/css/css_syntax_descriptor.h b/third_party/blink/renderer/core/css/css_syntax_descriptor.h index 6a819763..d9ebe19 100644 --- a/third_party/blink/renderer/core/css/css_syntax_descriptor.h +++ b/third_party/blink/renderer/core/css/css_syntax_descriptor.h
@@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/css/css_syntax_component.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink { @@ -49,10 +49,14 @@ Vector<CSSSyntaxComponent> syntax_components_; }; +} // namespace blink + +namespace WTF { + template <wtf_size_t inlineCapacity, typename Allocator> struct CrossThreadCopier< - Vector<CSSSyntaxDescriptor, inlineCapacity, Allocator>> { - using Type = Vector<CSSSyntaxDescriptor, inlineCapacity, Allocator>; + Vector<blink::CSSSyntaxDescriptor, inlineCapacity, Allocator>> { + using Type = Vector<blink::CSSSyntaxDescriptor, inlineCapacity, Allocator>; static Type Copy(const Type& value) { Type result; result.ReserveInitialCapacity(value.size()); @@ -62,6 +66,6 @@ } }; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_SYNTAX_DESCRIPTOR_H_
diff --git a/third_party/blink/renderer/core/css/cssom/cross_thread_style_value_test.cc b/third_party/blink/renderer/core/css/cssom/cross_thread_style_value_test.cc index 5e82245..2d4c81d 100644 --- a/third_party/blink/renderer/core/css/cssom/cross_thread_style_value_test.cc +++ b/third_party/blink/renderer/core/css/cssom/cross_thread_style_value_test.cc
@@ -14,9 +14,9 @@ #include "third_party/blink/renderer/core/css/cssom/css_keyword_value.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" #include "third_party/blink/renderer/core/css/cssom/css_unit_value.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc b/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc index 882287be..80cc92d 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc
@@ -16,10 +16,10 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/media_values_cached.h b/third_party/blink/renderer/core/css/media_values_cached.h index a9dfbd9e..1dc843b 100644 --- a/third_party/blink/renderer/core/css/media_values_cached.h +++ b/third_party/blink/renderer/core/css/media_values_cached.h
@@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/media_values.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink { @@ -110,12 +110,16 @@ MediaValuesCachedData data_; }; +} // namespace blink + +namespace WTF { + template <> -struct CrossThreadCopier<MediaValuesCached::MediaValuesCachedData> { - typedef MediaValuesCached::MediaValuesCachedData Type; +struct CrossThreadCopier<blink::MediaValuesCached::MediaValuesCachedData> { + typedef blink::MediaValuesCached::MediaValuesCachedData Type; static Type Copy(const Type& data) { return data.DeepCopy(); } }; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_MEDIA_VALUES_CACHED_H_
diff --git a/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h b/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h index 9f78845..2533bdf 100644 --- a/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h +++ b/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h
@@ -12,11 +12,11 @@ #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index b29cd84..845bbc3 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -277,7 +277,6 @@ #include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h" #include "third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/date_components.h" #include "third_party/blink/renderer/platform/geometry/length_functions.h" #include "third_party/blink/renderer/platform/heap/heap.h" @@ -301,6 +300,7 @@ #include "third_party/blink/renderer/platform/weborigin/origin_access_entry.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/date_math.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h"
diff --git a/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc b/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc index 070d44b4..8bc09e89 100644 --- a/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc +++ b/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc
@@ -81,10 +81,10 @@ #include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/probe/core_probes.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc index 069b623..33cbdd94 100644 --- a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc +++ b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc
@@ -65,7 +65,6 @@ #include "third_party/blink/renderer/core/workers/worker_classic_script_loader.h" #include "third_party/blink/renderer/core/workers/worker_content_settings_client.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" @@ -76,6 +75,7 @@ #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc index 08baf790..ddb496c6 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc
@@ -15,7 +15,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/fileapi/blob.h" #include "third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/image_data_buffer.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" #include "third_party/blink/renderer/platform/heap/heap.h" @@ -25,6 +24,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/skia/include/core/SkSurface.h"
diff --git a/third_party/blink/renderer/core/html/parser/background_html_parser.cc b/third_party/blink/renderer/core/html/parser/background_html_parser.cc index 1eaf3d4..e96292a62 100644 --- a/third_party/blink/renderer/core/html/parser/background_html_parser.cc +++ b/third_party/blink/renderer/core/html/parser/background_html_parser.cc
@@ -34,9 +34,9 @@ #include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h" #include "third_party/blink/renderer/core/html/parser/xss_auditor.h" #include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" #include "third_party/blink/renderer/platform/wtf/time.h"
diff --git a/third_party/blink/renderer/core/html/parser/html_document_parser.cc b/third_party/blink/renderer/core/html/parser/html_document_parser.cc index 3f23970..9d8e2c5 100644 --- a/third_party/blink/renderer/core/html/parser/html_document_parser.cc +++ b/third_party/blink/renderer/core/html/parser/html_document_parser.cc
@@ -54,7 +54,6 @@ #include "third_party/blink/renderer/core/script/html_parser_script_runner.h" #include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/histogram.h" @@ -64,6 +63,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc b/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc index 620fd34..64dedf2 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc
@@ -16,13 +16,13 @@ #include "third_party/blink/renderer/core/html/canvas/image_data.h" #include "third_party/blink/renderer/core/html/media/html_video_element.h" #include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/canvas_color_params.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImageInfo.h" #include "third_party/skia/include/core/SkSurface.h"
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc b/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc index b64d6ac..b0091c4 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc
@@ -49,7 +49,6 @@ #include "third_party/blink/renderer/core/svg/svg_image_element.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" @@ -57,6 +56,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" #include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "v8/include/v8.h" namespace blink {
diff --git a/third_party/blink/renderer/core/inspector/devtools_session.cc b/third_party/blink/renderer/core/inspector/devtools_session.cc index 4fc50e7d..4c3cc8e5 100644 --- a/third_party/blink/renderer/core/inspector/devtools_session.cc +++ b/third_party/blink/renderer/core/inspector/devtools_session.cc
@@ -15,11 +15,11 @@ #include "third_party/blink/renderer/core/inspector/protocol/Protocol.h" #include "third_party/blink/renderer/core/inspector/v8_inspector_string.h" #include "third_party/blink/renderer/core/probe/core_probes.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/web_test_support.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h" #include "third_party/inspector_protocol/encoding/encoding.h"
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc index 35eb165..eeda7bd 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc
@@ -999,7 +999,7 @@ attribute_query = attribute_query.Left(attribute_query.length() - 1); HeapVector<Member<Document>> docs = Documents(); - HeapListHashSet<Member<Node>> result_collector; + HeapLinkedHashSet<Member<Node>> result_collector; for (Document* document : docs) { Node* document_element = document->documentElement();
diff --git a/third_party/blink/renderer/core/inspector/inspector_task_runner.cc b/third_party/blink/renderer/core/inspector/inspector_task_runner.cc index 99dfd37..467c718 100644 --- a/third_party/blink/renderer/core/inspector/inspector_task_runner.cc +++ b/third_party/blink/renderer/core/inspector/inspector_task_runner.cc
@@ -5,8 +5,8 @@ #include "third_party/blink/renderer/core/inspector/inspector_task_runner.h" #include "third_party/blink/renderer/core/inspector/thread_debugger.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/inspector/thread_debugger.h b/third_party/blink/renderer/core/inspector/thread_debugger.h index 8d0345d..38e3407 100644 --- a/third_party/blink/renderer/core/inspector/thread_debugger.h +++ b/third_party/blink/renderer/core/inspector/thread_debugger.h
@@ -11,8 +11,8 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/user_gesture_indicator.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/timer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8-inspector.h" @@ -118,12 +118,16 @@ DISALLOW_COPY_AND_ASSIGN(ThreadDebugger); }; +} // namespace blink + +namespace WTF { + template <> struct CrossThreadCopier<v8_inspector::V8StackTraceId> { typedef v8_inspector::V8StackTraceId Type; static Type Copy(const Type& id) { return id; } }; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_THREAD_DEBUGGER_H_
diff --git a/third_party/blink/renderer/core/inspector/worker_thread_debugger.cc b/third_party/blink/renderer/core/inspector/worker_thread_debugger.cc index 1af4bdb..a493c370 100644 --- a/third_party/blink/renderer/core/inspector/worker_thread_debugger.cc +++ b/third_party/blink/renderer/core/inspector/worker_thread_debugger.cc
@@ -45,6 +45,7 @@ #include "third_party/blink/renderer/core/workers/worker_thread.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "v8/include/v8.h" namespace blink {
diff --git a/third_party/blink/renderer/core/inspector/worker_thread_debugger.h b/third_party/blink/renderer/core/inspector/worker_thread_debugger.h index 8b94feb..0730ec71 100644 --- a/third_party/blink/renderer/core/inspector/worker_thread_debugger.h +++ b/third_party/blink/renderer/core/inspector/worker_thread_debugger.h
@@ -38,6 +38,7 @@ namespace blink { class ErrorEvent; +class KURL; class SourceLocation; class WorkerThread;
diff --git a/third_party/blink/renderer/core/loader/interactive_detector_test.cc b/third_party/blink/renderer/core/loader/interactive_detector_test.cc index b8c7417..a56285be 100644 --- a/third_party/blink/renderer/core/loader/interactive_detector_test.cc +++ b/third_party/blink/renderer/core/loader/interactive_detector_test.cc
@@ -9,10 +9,10 @@ #include "third_party/blink/renderer/core/paint/first_meaningful_paint_detector.h" #include "third_party/blink/renderer/core/testing/dummy_page_holder.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/long_task_detector_test.cc b/third_party/blink/renderer/core/loader/long_task_detector_test.cc index 82fdf0d..8e793b8 100644 --- a/third_party/blink/renderer/core/loader/long_task_detector_test.cc +++ b/third_party/blink/renderer/core/loader/long_task_detector_test.cc
@@ -5,9 +5,9 @@ #include "third_party/blink/renderer/core/loader/long_task_detector.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/time.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h b/third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h index 2920c71..ac3727a 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h +++ b/third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h
@@ -8,10 +8,10 @@ #include "base/optional.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/platform/bindings/parkable_string.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -88,16 +88,20 @@ const network::mojom::FetchCredentialsMode fetch_credentials_mode_; }; +} // namespace blink + +namespace WTF { + // Creates a deep copy because |response_url_| and |source_text_| are not // cross-thread-transfer-safe. template <> -struct CrossThreadCopier<ModuleScriptCreationParams> { - static ModuleScriptCreationParams Copy( - const ModuleScriptCreationParams& params) { +struct CrossThreadCopier<blink::ModuleScriptCreationParams> { + static blink::ModuleScriptCreationParams Copy( + const blink::ModuleScriptCreationParams& params) { return params.IsolatedCopy(); } }; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_MODULESCRIPT_MODULE_SCRIPT_CREATION_PARAMS_H_
diff --git a/third_party/blink/renderer/core/loader/threadable_loader.h b/third_party/blink/renderer/core/loader/threadable_loader.h index 64154b4..44f36d58 100644 --- a/third_party/blink/renderer/core/loader/threadable_loader.h +++ b/third_party/blink/renderer/core/loader/threadable_loader.h
@@ -37,7 +37,6 @@ #include "base/macros.h" #include "services/network/public/mojom/fetch_api.mojom-blink.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/raw_resource.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_error.h" @@ -46,6 +45,7 @@ #include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/weborigin/referrer.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/time.h"
diff --git a/third_party/blink/renderer/core/loader/worker_resource_timing_notifier_impl.cc b/third_party/blink/renderer/core/loader/worker_resource_timing_notifier_impl.cc index aaa662c..af0ea8b 100644 --- a/third_party/blink/renderer/core/loader/worker_resource_timing_notifier_impl.cc +++ b/third_party/blink/renderer/core/loader/worker_resource_timing_notifier_impl.cc
@@ -9,10 +9,10 @@ #include "third_party/blink/renderer/core/timing/dom_window_performance.h" #include "third_party/blink/renderer/core/timing/performance.h" #include "third_party/blink/renderer/core/timing/worker_global_scope_performance.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_timing_info.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message.h b/third_party/blink/renderer/core/messaging/blink_transferable_message.h index b1ca9705..d00868a 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message.h +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message.h
@@ -12,7 +12,7 @@ #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/messaging/blink_cloneable_message.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink { @@ -53,15 +53,19 @@ // longer. CORE_EXPORT TransferableMessage ToTransferableMessage(BlinkTransferableMessage); +} // namespace blink + +namespace WTF { + template <> -struct CrossThreadCopier<BlinkTransferableMessage> { +struct CrossThreadCopier<blink::BlinkTransferableMessage> { STATIC_ONLY(CrossThreadCopier); - using Type = BlinkTransferableMessage; + using Type = blink::BlinkTransferableMessage; static Type Copy(Type pointer) { return pointer; // This is in fact a move. } }; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_MESSAGING_BLINK_TRANSFERABLE_MESSAGE_H_
diff --git a/third_party/blink/renderer/core/messaging/message_port.cc b/third_party/blink/renderer/core/messaging/message_port.cc index 1734a33..fd635f6 100644 --- a/third_party/blink/renderer/core/messaging/message_port.cc +++ b/third_party/blink/renderer/core/messaging/message_port.cc
@@ -42,8 +42,8 @@ #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink {
diff --git a/third_party/blink/renderer/core/mojo/mojo_watcher.cc b/third_party/blink/renderer/core/mojo/mojo_watcher.cc index a5ab3f8..3fcfebc 100644 --- a/third_party/blink/renderer/core/mojo/mojo_watcher.cc +++ b/third_party/blink/renderer/core/mojo/mojo_watcher.cc
@@ -9,8 +9,8 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/mojo/mojo_handle_signals.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/paint/first_meaningful_paint_detector.cc b/third_party/blink/renderer/core/paint/first_meaningful_paint_detector.cc index ba42f4d7..6bef0e9 100644 --- a/third_party/blink/renderer/core/paint/first_meaningful_paint_detector.cc +++ b/third_party/blink/renderer/core/paint/first_meaningful_paint_detector.cc
@@ -8,10 +8,10 @@ #include "third_party/blink/renderer/core/css/font_face_set_document.h" #include "third_party/blink/renderer/core/paint/paint_timing.h" #include "third_party/blink/renderer/core/probe/core_probes.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/paint/image_element_timing.cc b/third_party/blink/renderer/core/paint/image_element_timing.cc index 36658c66..adc60ca 100644 --- a/third_party/blink/renderer/core/paint/image_element_timing.cc +++ b/third_party/blink/renderer/core/paint/image_element_timing.cc
@@ -13,11 +13,11 @@ #include "third_party/blink/renderer/core/style/style_image.h" #include "third_party/blink/renderer/core/timing/dom_window_performance.h" #include "third_party/blink/renderer/core/timing/window_performance.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h" #include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink {
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc b/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc index bc11a91..de4ac0d 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc
@@ -47,6 +47,7 @@ // |visual_size| * min(|displayed_image_size|, |intrinsic_image_size|) / // |displayed_image_size| if (intrinsic_image_size < displayed_image_size) { + DCHECK_GT(displayed_image_size, 0u); return static_cast<double>(visual_size) * intrinsic_image_size / displayed_image_size; } @@ -259,8 +260,7 @@ .Size() .Area(); rect_size = DownScaleIfIntrinsicSizeIsSmaller( - rect_size, intrinsic_size.Area(), - (visual_rect.Width() * visual_rect.Height())); + rect_size, intrinsic_size.Area(), visual_rect.Size().Area()); if (rect_size == 0) { // Each invisible background image is tracked by its node id. In other @@ -321,8 +321,7 @@ .Size() .Area(); rect_size = DownScaleIfIntrinsicSizeIsSmaller( - rect_size, intrinsic_size.Area(), - visual_rect.Width() * visual_rect.Height()); + rect_size, intrinsic_size.Area(), visual_rect.Size().Area()); DVLOG(2) << "Node id (" << node_id << "): size=" << rect_size << ", type=" << object.DebugName(); if (rect_size == 0) {
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector.h b/third_party/blink/renderer/core/paint/image_paint_timing_detector.h index ae21edd0..019c923 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector.h
@@ -11,7 +11,7 @@ #include "third_party/blink/public/web/web_widget_client.h" #include "third_party/blink/renderer/core/dom/dom_node_ids.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/time.h"
diff --git a/third_party/blink/renderer/core/paint/paint_timing.cc b/third_party/blink/renderer/core/paint/paint_timing.cc index 1b5e445..c235c7b 100644 --- a/third_party/blink/renderer/core/paint/paint_timing.cc +++ b/third_party/blink/renderer/core/paint/paint_timing.cc
@@ -20,10 +20,10 @@ #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/timing/dom_window_performance.h" #include "third_party/blink/renderer/core/timing/window_performance.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/wtf.h" namespace blink {
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector.h b/third_party/blink/renderer/core/paint/text_paint_timing_detector.h index 196e179..1052a83 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector.h
@@ -12,9 +12,9 @@ #include "third_party/blink/public/web/web_widget_client.h" #include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/paint/text_element_timing.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/timer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/script/fetch_client_settings_object_impl.h b/third_party/blink/renderer/core/script/fetch_client_settings_object_impl.h index 1be2d76..c4df60f1 100644 --- a/third_party/blink/renderer/core/script/fetch_client_settings_object_impl.h +++ b/third_party/blink/renderer/core/script/fetch_client_settings_object_impl.h
@@ -7,12 +7,12 @@ #include "services/network/public/mojom/referrer_policy.mojom-shared.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h" #include "third_party/blink/renderer/platform/loader/fetch/https_state.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink {
diff --git a/third_party/blink/renderer/core/timing/window_performance.cc b/third_party/blink/renderer/core/timing/window_performance.cc index 7e232b6..9c8b675 100644 --- a/third_party/blink/renderer/core/timing/window_performance.cc +++ b/third_party/blink/renderer/core/timing/window_performance.cc
@@ -46,11 +46,11 @@ #include "third_party/blink/renderer/core/timing/performance_element_timing.h" #include "third_party/blink/renderer/core/timing/performance_event_timing.h" #include "third_party/blink/renderer/core/timing/performance_timing.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_timing_info.h" #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/wtf/cross_thread_functional.h" static constexpr base::TimeDelta kLongTaskObserverThreshold = base::TimeDelta::FromMilliseconds(50);
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc index 151458a..cbd6de6 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc
@@ -21,8 +21,8 @@ #include "third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.h" #include "third_party/blink/renderer/core/workers/dedicated_worker_thread.h" #include "third_party/blink/renderer/core/workers/worker_options.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/wtf.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.cc b/third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.cc index ae7793c..7f30a47 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.cc
@@ -47,8 +47,8 @@ #include "third_party/blink/renderer/core/workers/parent_execution_context_task_runners.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_thread.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_test.cc b/third_party/blink/renderer/core/workers/dedicated_worker_test.cc index 53a84e3..9b4ced8 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_test.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_test.cc
@@ -23,9 +23,9 @@ #include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h" #include "third_party/blink/renderer/core/workers/worker_thread.h" #include "third_party/blink/renderer/core/workers/worker_thread_test_helper.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc b/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc index 38a3ba54..96e754d 100644 --- a/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc +++ b/third_party/blink/renderer/core/workers/shared_worker_reporting_proxy.cc
@@ -7,7 +7,7 @@ #include "base/location.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/core/exported/web_shared_worker_impl.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/wtf.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/threaded_object_proxy_base.cc b/third_party/blink/renderer/core/workers/threaded_object_proxy_base.cc index 512cf5a4..d122709 100644 --- a/third_party/blink/renderer/core/workers/threaded_object_proxy_base.cc +++ b/third_party/blink/renderer/core/workers/threaded_object_proxy_base.cc
@@ -9,8 +9,8 @@ #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/workers/parent_execution_context_task_runners.h" #include "third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc index 42a3190..2ee386c6 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc
@@ -23,10 +23,10 @@ #include "third_party/blink/renderer/core/workers/worklet_global_scope.h" #include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h" #include "third_party/blink/renderer/core/workers/worklet_pending_tasks.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" #include "third_party/blink/renderer/platform/loader/fetch/worker_resource_timing_notifier.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_test.cc b/third_party/blink/renderer/core/workers/threaded_worklet_test.cc index 96582d2..9a2128a 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_test.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_test.cc
@@ -20,9 +20,9 @@ #include "third_party/blink/renderer/core/workers/worklet_global_scope.h" #include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h" #include "third_party/blink/renderer/core/workers/worklet_thread_holder.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
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 c905828..f24465f 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
@@ -6,7 +6,7 @@ #include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h" #include "third_party/blink/renderer/core/timing/worker_global_scope_performance.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/time.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/worker_backing_thread.cc b/third_party/blink/renderer/core/workers/worker_backing_thread.cc index e7366e7..ca644ac9 100644 --- a/third_party/blink/renderer/core/workers/worker_backing_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_backing_thread.cc
@@ -17,9 +17,9 @@ #include "third_party/blink/renderer/core/inspector/worker_thread_debugger.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h b/third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h index 09c9c49..a203e6a3 100644 --- a/third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h +++ b/third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h
@@ -6,7 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_WORKERS_WORKER_BACKING_THREAD_STARTUP_DATA_H_ #include "base/optional.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink { @@ -31,13 +31,17 @@ AtomicsWaitMode atomics_wait_mode; }; +} // namespace blink + +namespace WTF { + // This allows to pass base::Optional<WorkerBackingThreadStartupData> across // threads by PostTask(). template <> -struct CrossThreadCopier<base::Optional<WorkerBackingThreadStartupData>> +struct CrossThreadCopier<base::Optional<blink::WorkerBackingThreadStartupData>> : public CrossThreadCopierPassThrough< - base::Optional<WorkerBackingThreadStartupData>> {}; + base::Optional<blink::WorkerBackingThreadStartupData>> {}; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_CORE_WORKERS_WORKER_BACKING_THREAD_STARTUP_DATA_H_
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.cc b/third_party/blink/renderer/core/workers/worker_global_scope.cc index 54691c26..513a453 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -63,7 +63,6 @@ #include "third_party/blink/renderer/core/workers/worker_thread.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/microtask.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instance_counters.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" #include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h" @@ -76,6 +75,7 @@ #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { namespace {
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc index eec440c..11d0f134 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc
@@ -23,12 +23,12 @@ #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h" #include "third_party/blink/renderer/core/workers/worker_thread.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/detachable_use_counter.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" #include "third_party/blink/renderer/platform/loader/fetch/null_resource_fetcher_properties.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_load_observer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc index 6c71516..c80a2d5 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc
@@ -47,7 +47,6 @@ #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h" #include "third_party/blink/renderer/platform/bindings/microtask.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/thread_state.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" @@ -59,6 +58,7 @@ #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/threading.h"
diff --git a/third_party/blink/renderer/core/workers/worker_thread.h b/third_party/blink/renderer/core/workers/worker_thread.h index f093762c..1d41cd4 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.h +++ b/third_party/blink/renderer/core/workers/worker_thread.h
@@ -41,13 +41,13 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/workers/parent_execution_context_task_runners.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_scheduler.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "v8/include/v8-inspector.h"
diff --git a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h index 30046b3..cfd6ab5f 100644 --- a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h +++ b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h
@@ -29,13 +29,13 @@ #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h" #include "third_party/blink/renderer/core/workers/worker_thread.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/network/content_security_policy_parsers.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/workers/worklet_module_responses_map.cc b/third_party/blink/renderer/core/workers/worklet_module_responses_map.cc index d2db5f21..85d81f3e 100644 --- a/third_party/blink/renderer/core/workers/worklet_module_responses_map.cc +++ b/third_party/blink/renderer/core/workers/worklet_module_responses_map.cc
@@ -5,8 +5,8 @@ #include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h" #include "base/optional.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc b/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc index 94f824f..7cda3b9 100644 --- a/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc +++ b/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc
@@ -8,8 +8,8 @@ #include "third_party/blink/renderer/core/script/module_script.h" #include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h" #include "third_party/blink/renderer/core/workers/worklet_global_scope.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/devtools/.eslintrc.js b/third_party/blink/renderer/devtools/.eslintrc.js index cca6724..10cc7cb 100644 --- a/third_party/blink/renderer/devtools/.eslintrc.js +++ b/third_party/blink/renderer/devtools/.eslintrc.js
@@ -7,7 +7,7 @@ }, "parserOptions": { - "ecmaVersion": 8 + "ecmaVersion": 9 }, /**
diff --git a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc index a991fc2e..ad4f6ef 100644 --- a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc +++ b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc
@@ -24,8 +24,8 @@ #include "third_party/blink/renderer/modules/animationworklet/animator_definition.h" #include "third_party/blink/renderer/modules/worklet/worklet_thread_test_common.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" #include <memory>
diff --git a/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.cc b/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.cc index e49ed909..5587526 100644 --- a/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.cc +++ b/third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.cc
@@ -13,8 +13,8 @@ #include "third_party/blink/renderer/core/frame/web_frame_widget_base.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/workers/worker_thread.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_icon_loader.cc b/third_party/blink/renderer/modules/background_fetch/background_fetch_icon_loader.cc index 35da714..fbcdcfb 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_icon_loader.cc +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_icon_loader.cc
@@ -13,7 +13,6 @@ #include "third_party/blink/renderer/modules/background_fetch/background_fetch_bridge.h" #include "third_party/blink/renderer/modules/manifest/image_resource.h" #include "third_party/blink/renderer/modules/manifest/image_resource_type_converters.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/color_behavior.h" #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" @@ -24,6 +23,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_impl.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/threading.h"
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc b/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc index 23f44c3..f03f455 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc +++ b/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc
@@ -11,10 +11,10 @@ #include "third_party/blink/renderer/core/fileapi/file_reader_loader.h" #include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h" #include "third_party/blink/renderer/modules/clipboard/clipboard_promise.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/wtf.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc index 4967e99..3bbc5bcb 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client.cc
@@ -15,9 +15,9 @@ #include "third_party/blink/renderer/modules/csspaint/css_paint_definition.h" #include "third_party/blink/renderer/modules/csspaint/main_thread_document_paint_definition.h" #include "third_party/blink/renderer/modules/csspaint/paint_worklet.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/image.h" #include "third_party/blink/renderer/platform/graphics/paint_worklet_paint_dispatcher.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/imagecapture/image_capture_frame_grabber.cc b/third_party/blink/renderer/modules/imagecapture/image_capture_frame_grabber.cc index 2653e58..a90709b 100644 --- a/third_party/blink/renderer/modules/imagecapture/image_capture_frame_grabber.cc +++ b/third_party/blink/renderer/modules/imagecapture/image_capture_frame_grabber.cc
@@ -12,13 +12,31 @@ #include "third_party/blink/public/platform/web_media_stream_source.h" #include "third_party/blink/public/platform/web_media_stream_track.h" #include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" #include "third_party/libyuv/include/libyuv.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" +namespace WTF { +// Template specialization of [1], needed to be able to pass callbacks +// that have ScopedWebCallbacks paramaters across threads. +// +// [1] third_party/blink/renderer/platform/wtf/cross_thread_copier.h. +template <typename T> +struct CrossThreadCopier<blink::ScopedWebCallbacks<T>> + : public CrossThreadCopierPassThrough<blink::ScopedWebCallbacks<T>> { + STATIC_ONLY(CrossThreadCopier); + using Type = blink::ScopedWebCallbacks<T>; + static blink::ScopedWebCallbacks<T> Copy( + blink::ScopedWebCallbacks<T> pointer) { + return pointer; + } +}; + +} // namespace WTF + namespace blink { namespace { @@ -29,20 +47,6 @@ } // anonymous namespace -// Template specialization of [1], needed to be able to pass callbacks -// that have ScopedWebCallbacks paramaters across threads. -// -// [1] third_party/blink/renderer/platform/cross_thread_copier.h. -template <typename T> -struct CrossThreadCopier<ScopedWebCallbacks<T>> - : public CrossThreadCopierPassThrough<ScopedWebCallbacks<T>> { - STATIC_ONLY(CrossThreadCopier); - using Type = ScopedWebCallbacks<T>; - static ScopedWebCallbacks<T> Copy(ScopedWebCallbacks<T> pointer) { - return pointer; - } -}; - // Ref-counted class to receive a single VideoFrame on IO thread, convert it and // send it to |main_task_runner_|, where this class is created and destroyed. class ImageCaptureFrameGrabber::SingleShotFrameHandler
diff --git a/third_party/blink/renderer/modules/mediacapturefromelement/html_audio_element_capturer_source.cc b/third_party/blink/renderer/modules/mediacapturefromelement/html_audio_element_capturer_source.cc index db276b6..fb3d0331b 100644 --- a/third_party/blink/renderer/modules/mediacapturefromelement/html_audio_element_capturer_source.cc +++ b/third_party/blink/renderer/modules/mediacapturefromelement/html_audio_element_capturer_source.cc
@@ -10,8 +10,8 @@ #include "media/base/audio_renderer_sink.h" #include "third_party/blink/public/platform/web_media_player.h" #include "third_party/blink/public/platform/webaudiosourceprovider_impl.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/mediacapturefromelement/html_video_element_capturer_source.cc b/third_party/blink/renderer/modules/mediacapturefromelement/html_video_element_capturer_source.cc index ddfe0f5..099b5a09 100644 --- a/third_party/blink/renderer/modules/mediacapturefromelement/html_video_element_capturer_source.cc +++ b/third_party/blink/renderer/modules/mediacapturefromelement/html_video_element_capturer_source.cc
@@ -17,9 +17,9 @@ #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/libyuv/include/libyuv.h" namespace {
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.cc index 48323992..831fe0c 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.cc
@@ -199,10 +199,11 @@ if (is_running) { state_ = STARTED; DCHECK(capture_params_ == new_capture_params); - OnStartDone(MEDIA_DEVICE_OK); + OnStartDone(mojom::blink::MediaStreamRequestResult::OK); } else { state_ = STOPPED; - OnStartDone(MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO); + OnStartDone( + mojom::blink::MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO); } break; case STARTED:
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source_test.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source_test.cc index f054ad08..8955620 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source_test.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source_test.cc
@@ -11,6 +11,7 @@ #include "media/base/bind_to_current_loop.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_sink.h" @@ -18,9 +19,9 @@ #include "third_party/blink/public/web/modules/mediastream/video_track_adapter_settings.h" #include "third_party/blink/public/web/web_heap.h" #include "third_party/blink/renderer/modules/mediastream/mock_mojo_media_stream_dispatcher_host.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" using ::testing::_; @@ -174,7 +175,7 @@ protected: void OnConstraintsApplied(WebPlatformMediaStreamSource* source, - MediaStreamRequestResult result, + mojom::blink::MediaStreamRequestResult result, const WebString& result_name) {} ScopedTestingPlatformSupport<IOTaskRunnerTestingPlatformSupport> platform_;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc index 520ac9f..5424274 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_source.cc
@@ -16,13 +16,14 @@ #include "base/macros.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_video_device.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h" #include "third_party/blink/renderer/modules/mediastream/video_track_adapter.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { @@ -337,7 +338,8 @@ SetReadyState(WebMediaStreamSource::kReadyStateEnded); } -void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { +void MediaStreamVideoSource::OnStartDone( + mojom::blink::MediaStreamRequestResult result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(3) << "OnStartDone({result =" << result << "})"; if (state_ == ENDED) { @@ -347,7 +349,7 @@ return; } - if (result == MEDIA_DEVICE_OK) { + if (result == mojom::blink::MediaStreamRequestResult::OK) { DCHECK_EQ(STARTING, state_); OnLog("MediaStreamVideoSource changing state to STARTED"); state_ = STARTED; @@ -367,11 +369,13 @@ std::vector<PendingTrackInfo> pending_track_descriptors; pending_track_descriptors.swap(pending_tracks_); for (const auto& track_info : pending_track_descriptors) { - MediaStreamRequestResult result = MEDIA_DEVICE_OK; - if (state_ != STARTED) - result = MEDIA_DEVICE_TRACK_START_FAILURE_VIDEO; + auto result = mojom::blink::MediaStreamRequestResult::OK; + if (state_ != STARTED) { + result = + mojom::blink::MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO; + } - if (result == MEDIA_DEVICE_OK) { + if (result == mojom::blink::MediaStreamRequestResult::OK) { track_adapter_->AddTrack(track_info.track, track_info.frame_callback, track_info.settings_callback, track_info.format_callback,
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc index 67d56cb..9c10a16c 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc
@@ -18,9 +18,9 @@ #include "media/capture/video_capture_types.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util_video_device.h" #include "third_party/blink/public/web/web_local_frame.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { @@ -138,7 +138,7 @@ PostCrossThreadTask( *io_task_runner_, FROM_HERE, CrossThreadBindOnce(&FrameDeliverer::AddCallbackOnIO, - WrapRefCounted(this), CrossThreadUnretained(id), + WrapRefCounted(this), WTF::CrossThreadUnretained(id), WTF::Passed(CrossThreadBind(std::move(callback))))); } @@ -154,7 +154,7 @@ PostCrossThreadTask( *io_task_runner_, FROM_HERE, CrossThreadBindOnce(&FrameDeliverer::RemoveCallbackOnIO, - WrapRefCounted(this), CrossThreadUnretained(id), + WrapRefCounted(this), WTF::CrossThreadUnretained(id), Thread::Current()->GetTaskRunner())); }
diff --git a/third_party/blink/renderer/modules/mediastream/mock_mojo_media_stream_dispatcher_host.cc b/third_party/blink/renderer/modules/mediastream/mock_mojo_media_stream_dispatcher_host.cc index 5f15cc5..9328634 100644 --- a/third_party/blink/renderer/modules/mediastream/mock_mojo_media_stream_dispatcher_host.cc +++ b/third_party/blink/renderer/modules/mediastream/mock_mojo_media_stream_dispatcher_host.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/strings/string_number_conversions.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/mediastream/video_track_adapter.cc b/third_party/blink/renderer/modules/mediastream/video_track_adapter.cc index 6d8091e..34b40e2 100644 --- a/third_party/blink/renderer/modules/mediastream/video_track_adapter.cc +++ b/third_party/blink/renderer/modules/mediastream/video_track_adapter.cc
@@ -28,6 +28,26 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" +namespace WTF { + +// Template specializations of [1], needed to be able to pass WTF callbacks +// that have VideoTrackAdapterSettings or gfx::Size parameters across threads. +// +// [1] third_party/blink/renderer/platform/wtf/cross_thread_copier.h. +template <> +struct CrossThreadCopier<blink::VideoTrackAdapterSettings> + : public CrossThreadCopierPassThrough<blink::VideoTrackAdapterSettings> { + STATIC_ONLY(CrossThreadCopier); +}; + +template <> +struct CrossThreadCopier<gfx::Size> + : public CrossThreadCopierPassThrough<gfx::Size> { + STATIC_ONLY(CrossThreadCopier); +}; + +} // namespace WTF + namespace blink { namespace { @@ -117,22 +137,6 @@ } // anonymous namespace -// Template specializations of [1], needed to be able to pass WTF callbacks -// that have VideoTrackAdapterSettings or gfx::Size parameters across threads. -// -// [1] third_party/blink/renderer/platform/cross_thread_copier.h. -template <> -struct CrossThreadCopier<VideoTrackAdapterSettings> - : public CrossThreadCopierPassThrough<VideoTrackAdapterSettings> { - STATIC_ONLY(CrossThreadCopier); -}; - -template <> -struct CrossThreadCopier<gfx::Size> - : public CrossThreadCopierPassThrough<gfx::Size> { - STATIC_ONLY(CrossThreadCopier); -}; - // VideoFrameResolutionAdapter is created on and lives on the IO-thread. It does // the resolution adaptation and delivers frames to all registered tracks on the // IO-thread. All method calls must be on the IO-thread. @@ -518,8 +522,8 @@ PostCrossThreadTask( *io_task_runner_, FROM_HERE, CrossThreadBindOnce( - &VideoTrackAdapter::AddTrackOnIO, CrossThreadUnretained(this), - CrossThreadUnretained(track), + &VideoTrackAdapter::AddTrackOnIO, WTF::CrossThreadUnretained(this), + WTF::CrossThreadUnretained(track), WTF::Passed(CrossThreadBind(std::move(frame_callback))), WTF::Passed(CrossThreadBind(std::move(settings_callback))), WTF::Passed(CrossThreadBind(std::move(format_callback))), settings));
diff --git a/third_party/blink/renderer/modules/mediastream/video_track_adapter.h b/third_party/blink/renderer/modules/mediastream/video_track_adapter.h index 051b5a8..21d5847 100644 --- a/third_party/blink/renderer/modules/mediastream/video_track_adapter.h +++ b/third_party/blink/renderer/modules/mediastream/video_track_adapter.h
@@ -17,7 +17,7 @@ #include "third_party/blink/public/platform/modules/mediastream/media_stream_types.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_track.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/modules/modules_initializer.cc b/third_party/blink/renderer/modules/modules_initializer.cc index 95418fd..8a00da0 100644 --- a/third_party/blink/renderer/modules/modules_initializer.cc +++ b/third_party/blink/renderer/modules/modules_initializer.cc
@@ -92,9 +92,9 @@ #include "third_party/blink/renderer/modules/webgl/webgl2_rendering_context.h" #include "third_party/blink/renderer/modules/webgl/webgl_rendering_context.h" #include "third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/mojo/mojo_helper.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -328,7 +328,7 @@ service_manager::BinderRegistry& registry) { DCHECK(Platform::Current()); registry.AddInterface( - ConvertToBaseCallback(blink::CrossThreadBind(&WebDatabaseImpl::Create)), + ConvertToBaseCallback(CrossThreadBind(&WebDatabaseImpl::Create)), Platform::Current()->GetIOTaskRunner()); }
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/dtls_transport_proxy.cc b/third_party/blink/renderer/modules/peerconnection/adapters/dtls_transport_proxy.cc index 1aea0228..775a7bab 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/dtls_transport_proxy.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/dtls_transport_proxy.cc
@@ -7,8 +7,8 @@ #include "base/location.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_host.cc b/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_host.cc index f79c623..a793b39b 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_host.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_host.cc
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_adapter_impl.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc b/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc index 6a0555b..176a3c26 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_host.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_host.cc b/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_host.cc index e6cb798..d701abd 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_host.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_host.cc
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_host.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.cc b/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.cc index bef186c2b..fa1f566 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.cc
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_host.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_proxy.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_host.cc b/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_host.cc index 521a0233..ef4d7fa 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_host.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_host.cc
@@ -13,8 +13,8 @@ #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_proxy.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_proxy.cc b/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_proxy.cc index a1e97fd..6f2d4d38 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_proxy.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_proxy.cc
@@ -12,8 +12,8 @@ #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_stream_proxy.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/quic_transport_host.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/sctp_transport_proxy.cc b/third_party/blink/renderer/modules/peerconnection/adapters/sctp_transport_proxy.cc index 287fe40..f602a2d 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/sctp_transport_proxy.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/sctp_transport_proxy.cc
@@ -10,8 +10,8 @@ #include "base/location.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h b/third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h index 635b04ed..5d984c14a 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h +++ b/third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h
@@ -13,7 +13,7 @@ #include <vector> #include "third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_transport.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/webrtc/api/scoped_refptr.h" namespace cricket { @@ -36,6 +36,10 @@ struct P2PQuicTransportConfig; +} + +namespace WTF { + template <> struct CrossThreadCopier<std::string> : public CrossThreadCopierPassThrough<std::string> { @@ -95,8 +99,8 @@ }; template <> -struct CrossThreadCopier<P2PQuicTransportConfig> - : public CrossThreadCopierPassThrough<P2PQuicTransportConfig> { +struct CrossThreadCopier<blink::P2PQuicTransportConfig> + : public CrossThreadCopierPassThrough<blink::P2PQuicTransportConfig> { STATIC_ONLY(CrossThreadCopier); }; @@ -113,29 +117,30 @@ }; template <> -struct CrossThreadCopier<P2PQuicTransport::StartConfig> - : public CrossThreadCopierPassThrough<P2PQuicTransport::StartConfig> { +struct CrossThreadCopier<blink::P2PQuicTransport::StartConfig> + : public CrossThreadCopierPassThrough< + blink::P2PQuicTransport::StartConfig> { STATIC_ONLY(CrossThreadCopier); - using Type = P2PQuicTransport::StartConfig; - static P2PQuicTransport::StartConfig Copy( - P2PQuicTransport::StartConfig config) { + using Type = blink::P2PQuicTransport::StartConfig; + static blink::P2PQuicTransport::StartConfig Copy( + blink::P2PQuicTransport::StartConfig config) { // This is in fact a move. return config; } }; template <> -struct CrossThreadCopier<P2PQuicTransportStats> - : public CrossThreadCopierPassThrough<P2PQuicTransportStats> { +struct CrossThreadCopier<blink::P2PQuicTransportStats> + : public CrossThreadCopierPassThrough<blink::P2PQuicTransportStats> { STATIC_ONLY(CrossThreadCopier); }; template <> -struct CrossThreadCopier<P2PQuicNegotiatedParams> - : public CrossThreadCopierPassThrough<P2PQuicNegotiatedParams> { +struct CrossThreadCopier<blink::P2PQuicNegotiatedParams> + : public CrossThreadCopierPassThrough<blink::P2PQuicNegotiatedParams> { STATIC_ONLY(CrossThreadCopier); }; -} // namespace blink +} // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_ADAPTERS_WEB_RTC_CROSS_THREAD_COPIER_H_
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc index a704ef0..0744e26 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc
@@ -39,8 +39,8 @@ #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel_test.cc index c621aff..c377f06 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel_test.cc
@@ -14,9 +14,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/testing/null_execution_context.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_web_rtc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/push_messaging/BUILD.gn b/third_party/blink/renderer/modules/push_messaging/BUILD.gn index 92fe5f15..7005dd4 100644 --- a/third_party/blink/renderer/modules/push_messaging/BUILD.gn +++ b/third_party/blink/renderer/modules/push_messaging/BUILD.gn
@@ -6,8 +6,6 @@ blink_modules_sources("push_messaging") { sources = [ - "push_controller.cc", - "push_controller.h", "push_error.cc", "push_error.h", "push_event.cc",
diff --git a/third_party/blink/renderer/modules/push_messaging/push_controller.cc b/third_party/blink/renderer/modules/push_messaging/push_controller.cc deleted file mode 100644 index 7af810a..0000000 --- a/third_party/blink/renderer/modules/push_messaging/push_controller.cc +++ /dev/null
@@ -1,30 +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 "third_party/blink/renderer/modules/push_messaging/push_controller.h" - -#include "third_party/blink/public/platform/modules/push_messaging/web_push_client.h" -#include "third_party/blink/renderer/platform/wtf/assertions.h" - -namespace blink { - -PushController::PushController(LocalFrame& frame, WebPushClient* client) - : Supplement<LocalFrame>(frame), client_(client) {} - -WebPushClient& PushController::ClientFrom(LocalFrame* frame) { - PushController* controller = PushController::From(frame); - DCHECK(controller); - WebPushClient* client = controller->Client(); - DCHECK(client); - return *client; -} - -const char PushController::kSupplementName[] = "PushController"; - -void ProvidePushControllerTo(LocalFrame& frame, WebPushClient* client) { - PushController::ProvideTo( - frame, MakeGarbageCollected<PushController>(frame, client)); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/modules/push_messaging/push_controller.h b/third_party/blink/renderer/modules/push_messaging/push_controller.h deleted file mode 100644 index 791913c5..0000000 --- a/third_party/blink/renderer/modules/push_messaging/push_controller.h +++ /dev/null
@@ -1,49 +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 THIRD_PARTY_BLINK_RENDERER_MODULES_PUSH_MESSAGING_PUSH_CONTROLLER_H_ -#define THIRD_PARTY_BLINK_RENDERER_MODULES_PUSH_MESSAGING_PUSH_CONTROLLER_H_ - -#include "base/macros.h" -#include "third_party/blink/renderer/core/frame/local_frame.h" -#include "third_party/blink/renderer/modules/modules_export.h" -#include "third_party/blink/renderer/platform/supplementable.h" -#include "third_party/blink/renderer/platform/wtf/forward.h" - -namespace blink { - -class WebPushClient; - -class PushController final : public GarbageCollected<PushController>, - public Supplement<LocalFrame> { - USING_GARBAGE_COLLECTED_MIXIN(PushController); - - public: - static const char kSupplementName[]; - - PushController(LocalFrame& frame, WebPushClient* client); - - static PushController* From(LocalFrame* frame) { - return Supplement<LocalFrame>::From<PushController>(frame); - } - static WebPushClient& ClientFrom(LocalFrame*); - - void Trace(blink::Visitor* visitor) override { - Supplement<LocalFrame>::Trace(visitor); - } - - private: - WebPushClient* Client() const { return client_; } - - WebPushClient* client_; - - DISALLOW_COPY_AND_ASSIGN(PushController); -}; - -MODULES_EXPORT void ProvidePushControllerTo(LocalFrame& frame, - WebPushClient* client); - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PUSH_MESSAGING_PUSH_CONTROLLER_H_
diff --git a/third_party/blink/renderer/modules/push_messaging/push_messaging_client.cc b/third_party/blink/renderer/modules/push_messaging/push_messaging_client.cc index 4077fdcc..901acbc6 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_messaging_client.cc +++ b/third_party/blink/renderer/modules/push_messaging/push_messaging_client.cc
@@ -121,12 +121,8 @@ return; } - // We use DocumentInterfaceBroker to communicate with the RenderFrame in the - // browser process now, so we don't need to pass a valid ID from here anymore. - // TODO: Remove the extra parameter |render_frame_id| from the mojo interface. GetService()->Subscribe( - -1 /* Invalid ID */, service_worker_registration_id, std::move(options), - user_gesture, + service_worker_registration_id, std::move(options), user_gesture, WTF::Bind(&PushMessagingClient::DidSubscribe, WrapPersistent(this), std::move(callbacks))); }
diff --git a/third_party/blink/renderer/modules/push_messaging/push_provider.cc b/third_party/blink/renderer/modules/push_messaging/push_provider.cc index 1788c64..874cd36e 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_provider.cc +++ b/third_party/blink/renderer/modules/push_messaging/push_provider.cc
@@ -91,8 +91,8 @@ mojom::blink::PushSubscriptionOptions::From(&options); push_messaging_manager_->Subscribe( - -1 /* Invalid ID */, GetSupplementable()->RegistrationId(), - std::move(content_options_ptr), user_gesture, + GetSupplementable()->RegistrationId(), std::move(content_options_ptr), + user_gesture, WTF::Bind(&PushProvider::DidSubscribe, WrapPersistent(this), WTF::Passed(std::move(callbacks)))); }
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc index b539796..e67b2695 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -103,7 +103,6 @@ #include "third_party/blink/renderer/modules/service_worker/wait_until_observer.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" #include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h" @@ -112,6 +111,7 @@ #include "third_party/blink/renderer/platform/network/content_security_policy_response_headers.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/time.h" namespace blink { @@ -1256,8 +1256,8 @@ // RequestedTermination() returns true if ServiceWorkerTimeoutTimer agrees // we should request the host to terminate this worker now. DCHECK(RequestedTermination()); - // We use CrossThreadBindOnce() here because the callback may be destroyed on - // the main thread if the worker thread has already terminated. + // We use CrossThreadBindOnce() here because the callback may be + // destroyed on the main thread if the worker thread has already terminated. ServiceWorkerGlobalScopeClient::From(GetExecutionContext()) ->RequestTermination(ConvertToBaseOnceCallback( CrossThreadBindOnce(&ServiceWorkerGlobalScope::OnRequestedTermination,
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc index 863f8a8..a236ef96 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc
@@ -53,9 +53,9 @@ #include "third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h" #include "third_party/blink/renderer/modules/service_worker/wait_until_observer.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.cc b/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.cc index 345e45d..66e5238 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.cc
@@ -12,10 +12,10 @@ #include "mojo/public/cpp/bindings/strong_binding.h" #include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_thread.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager_test.cc b/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager_test.cc index e0d048a3..adf4c22 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager_test.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager_test.cc
@@ -10,9 +10,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_thread.cc b/third_party/blink/renderer/modules/service_worker/service_worker_thread.cc index 76ce15b8..9c735f6 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_thread.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_thread.cc
@@ -38,9 +38,9 @@ #include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "v8/include/v8-inspector.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/service_worker/thread_safe_script_container_test.cc b/third_party/blink/renderer/modules/service_worker/thread_safe_script_container_test.cc index bca611d..cc7a6c3 100644 --- a/third_party/blink/renderer/modules/service_worker/thread_safe_script_container_test.cc +++ b/third_party/blink/renderer/modules/service_worker/thread_safe_script_container_test.cc
@@ -9,9 +9,9 @@ #include "base/synchronization/waitable_event.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/storage/storage_controller_test.cc b/third_party/blink/renderer/modules/storage/storage_controller_test.cc index 8555f4b..4b80a98 100644 --- a/third_party/blink/renderer/modules/storage/storage_controller_test.cc +++ b/third_party/blink/renderer/modules/storage/storage_controller_test.cc
@@ -14,9 +14,9 @@ #include "third_party/blink/renderer/modules/storage/storage_namespace.h" #include "third_party/blink/renderer/modules/storage/testing/fake_area_source.h" #include "third_party/blink/renderer/modules/storage/testing/mock_storage_area.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/uuid.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { namespace {
diff --git a/third_party/blink/renderer/modules/storage/storage_namespace_test.cc b/third_party/blink/renderer/modules/storage/storage_namespace_test.cc index 55c3b591..2b674db8 100644 --- a/third_party/blink/renderer/modules/storage/storage_namespace_test.cc +++ b/third_party/blink/renderer/modules/storage/storage_namespace_test.cc
@@ -11,9 +11,9 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/renderer/modules/storage/testing/fake_area_source.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/uuid.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { namespace {
diff --git a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc index 3af64ee..d55bf08 100644 --- a/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc +++ b/third_party/blink/renderer/modules/webaudio/async_audio_decoder.cc
@@ -32,10 +32,10 @@ #include "third_party/blink/renderer/modules/webaudio/base_audio_context.h" #include "third_party/blink/renderer/platform/audio/audio_bus.h" #include "third_party/blink/renderer/platform/audio/audio_file_reader.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/audio_context.cc b/third_party/blink/renderer/modules/webaudio/audio_context.cc index a6ebfa0..9ee11ac8 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_context.cc
@@ -30,11 +30,11 @@ #include "third_party/blink/renderer/platform/audio/vector_math.h" #include "third_party/blink/renderer/platform/bindings/exception_messages.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #if DEBUG_AUDIONODE_REFERENCES #include <stdio.h>
diff --git a/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc b/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc index d158bac..590ffe3 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc
@@ -33,8 +33,8 @@ #include "third_party/blink/renderer/platform/audio/audio_utilities.h" #include "third_party/blink/renderer/platform/bindings/exception_messages.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_node.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_node.cc index 862afac..bf303bb 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_node.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_node.cc
@@ -20,9 +20,9 @@ #include "third_party/blink/renderer/platform/audio/audio_bus.h" #include "third_party/blink/renderer/platform/audio/audio_utilities.h" #include "third_party/blink/renderer/platform/bindings/exception_messages.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_object_proxy.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_object_proxy.cc index ea87fa3a..3f9e313 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_object_proxy.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_object_proxy.cc
@@ -9,7 +9,7 @@ #include "third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h" #include "third_party/blink/renderer/modules/webaudio/audio_worklet_messaging_proxy.h" #include "third_party/blink/renderer/modules/webaudio/cross_thread_audio_worklet_processor_info.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.cc index e112ab8..4edf3055 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.cc
@@ -12,11 +12,11 @@ #include "third_party/blink/renderer/core/workers/worker_backing_thread.h" #include "third_party/blink/renderer/modules/webaudio/audio_worklet.h" #include "third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc index 24e41ab..63181d1 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc
@@ -25,12 +25,12 @@ #include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h" #include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc index c232899..b3938eb8 100644 --- a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc
@@ -72,10 +72,10 @@ #include "third_party/blink/renderer/platform/audio/vector_math.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/uuid.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include <algorithm>
diff --git a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc index e8fe36a..9fd38f0d 100644 --- a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc +++ b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc
@@ -29,10 +29,10 @@ #include "third_party/blink/renderer/modules/webaudio/audio_node.h" #include "third_party/blink/renderer/modules/webaudio/audio_node_output.h" #include "third_party/blink/renderer/modules/webaudio/offline_audio_context.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.cc b/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.cc index 3952278..7b7fba6f 100644 --- a/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.cc +++ b/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.cc
@@ -34,8 +34,8 @@ #include "third_party/blink/renderer/modules/webaudio/media_element_audio_source_options.h" #include "third_party/blink/renderer/platform/audio/audio_utilities.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc b/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc index 3830b5d..70eda602 100644 --- a/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc
@@ -38,9 +38,9 @@ #include "third_party/blink/renderer/platform/bindings/exception_messages.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/histogram.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/offline_audio_destination_node.cc b/third_party/blink/renderer/modules/webaudio/offline_audio_destination_node.cc index dc49288a..225e4d0 100644 --- a/third_party/blink/renderer/modules/webaudio/offline_audio_destination_node.cc +++ b/third_party/blink/renderer/modules/webaudio/offline_audio_destination_node.cc
@@ -37,7 +37,7 @@ #include "third_party/blink/renderer/platform/audio/audio_utilities.h" #include "third_party/blink/renderer/platform/audio/denormal_disabler.h" #include "third_party/blink/renderer/platform/audio/hrtf_database_loader.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webaudio/script_processor_node.cc b/third_party/blink/renderer/modules/webaudio/script_processor_node.cc index 24294946..6c78ef43 100644 --- a/third_party/blink/renderer/modules/webaudio/script_processor_node.cc +++ b/third_party/blink/renderer/modules/webaudio/script_processor_node.cc
@@ -37,8 +37,8 @@ #include "third_party/blink/renderer/modules/webaudio/base_audio_context.h" #include "third_party/blink/renderer/modules/webaudio/realtime_audio_destination_node.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webdatabase/database.cc b/third_party/blink/renderer/modules/webdatabase/database.cc index 022b977..60777c6 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.cc +++ b/third_party/blink/renderer/modules/webdatabase/database.cc
@@ -51,9 +51,9 @@ #include "third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_statement.h" #include "third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_transaction.h" #include "third_party/blink/renderer/modules/webdatabase/storage_log.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" // Registering "opened" databases with the DatabaseTracker // =======================================================
diff --git a/third_party/blink/renderer/modules/webdatabase/database_thread.cc b/third_party/blink/renderer/modules/webdatabase/database_thread.cc index bf088b2..1c9222f 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_thread.cc +++ b/third_party/blink/renderer/modules/webdatabase/database_thread.cc
@@ -36,8 +36,8 @@ #include "third_party/blink/renderer/modules/webdatabase/sql_transaction_client.h" #include "third_party/blink/renderer/modules/webdatabase/sql_transaction_coordinator.h" #include "third_party/blink/renderer/modules/webdatabase/storage_log.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webdatabase/database_tracker.cc b/third_party/blink/renderer/modules/webdatabase/database_tracker.cc index 0a1da34..331f223 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_tracker.cc +++ b/third_party/blink/renderer/modules/webdatabase/database_tracker.cc
@@ -43,10 +43,10 @@ #include "third_party/blink/renderer/modules/webdatabase/database_client.h" #include "third_party/blink/renderer/modules/webdatabase/database_context.h" #include "third_party/blink/renderer/modules/webdatabase/quota_tracker.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction_client.cc b/third_party/blink/renderer/modules/webdatabase/sql_transaction_client.cc index 69e321f..7a62050 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction_client.cc +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction_client.cc
@@ -38,8 +38,8 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/webdatabase/database.h" #include "third_party/blink/renderer/modules/webdatabase/database_context.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index d1de7b2..22a73d9 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -98,7 +98,6 @@ #include "third_party/blink/renderer/modules/webgl/webgl_video_texture_enum.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/v8_binding_macros.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h" #include "third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h" @@ -107,6 +106,7 @@ #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
diff --git a/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread.cc b/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread.cc index 70af466..2e459bc 100644 --- a/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread.cc +++ b/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread.cc
@@ -11,10 +11,10 @@ #include "third_party/blink/renderer/core/workers/worklet_thread_holder.h" #include "third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h" #include "third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc b/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc index ebb8e6e..dfa053ad 100644 --- a/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc +++ b/third_party/blink/renderer/modules/worklet/animation_and_paint_worklet_thread_test.cc
@@ -24,10 +24,10 @@ #include "third_party/blink/renderer/core/workers/worklet_thread_holder.h" #include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h" #include "third_party/blink/renderer/modules/worklet/worklet_thread_test_common.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 64ae02a..8143a422 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -466,9 +466,6 @@ "bindings/wrapper_type_info.h", "content_decryption_module_result.h", "cpu/mips/common_macros_msa.h", - "cross_thread_copier.cc", - "cross_thread_copier.h", - "cross_thread_functional.h", "crypto.cc", "crypto.h", "crypto_result.h",
diff --git a/third_party/blink/renderer/platform/audio/DEPS b/third_party/blink/renderer/platform/audio/DEPS index d245efd9..dbb2d999 100644 --- a/third_party/blink/renderer/platform/audio/DEPS +++ b/third_party/blink/renderer/platform/audio/DEPS
@@ -9,7 +9,7 @@ "+media/base/audio_bus.h", "+media/base/multi_channel_resampler.h", "+third_party/blink/renderer/platform/cpu/mips/common_macros_msa.h", - "+third_party/blink/renderer/platform/cross_thread_functional.h", + "+third_party/blink/renderer/platform/wtf/cross_thread_functional.h", "+third_party/blink/renderer/platform/geometry/float_point_3d.h", "+third_party/blink/renderer/platform/heap", "+third_party/blink/renderer/platform/histogram.h",
diff --git a/third_party/blink/renderer/platform/audio/audio_destination.cc b/third_party/blink/renderer/platform/audio/audio_destination.cc index 9b5cc1e..25c5024 100644 --- a/third_party/blink/renderer/platform/audio/audio_destination.cc +++ b/third_party/blink/renderer/platform/audio/audio_destination.cc
@@ -38,10 +38,10 @@ #include "third_party/blink/renderer/platform/audio/audio_utilities.h" #include "third_party/blink/renderer/platform/audio/push_pull_fifo.h" #include "third_party/blink/renderer/platform/audio/vector_math.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc b/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc index 22718706..158ac45 100644 --- a/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc +++ b/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc
@@ -31,8 +31,8 @@ #include "base/location.h" #include "base/synchronization/waitable_event.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/audio/push_pull_fifo_multithread_test.cc b/third_party/blink/renderer/platform/audio/push_pull_fifo_multithread_test.cc index e3b6c594..811e9c80 100644 --- a/third_party/blink/renderer/platform/audio/push_pull_fifo_multithread_test.cc +++ b/third_party/blink/renderer/platform/audio/push_pull_fifo_multithread_test.cc
@@ -9,13 +9,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/audio/audio_utilities.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/audio/push_pull_fifo_test.cc b/third_party/blink/renderer/platform/audio/push_pull_fifo_test.cc index 70fc961..094f5a8 100644 --- a/third_party/blink/renderer/platform/audio/push_pull_fifo_test.cc +++ b/third_party/blink/renderer/platform/audio/push_pull_fifo_test.cc
@@ -9,9 +9,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/audio/audio_utilities.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/audio/reverb_convolver.cc b/third_party/blink/renderer/platform/audio/reverb_convolver.cc index 922ccd3..997c246 100644 --- a/third_party/blink/renderer/platform/audio/reverb_convolver.cc +++ b/third_party/blink/renderer/platform/audio/reverb_convolver.cc
@@ -35,9 +35,9 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/audio/audio_bus.h" #include "third_party/blink/renderer/platform/audio/vector_math.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/bindings/DEPS b/third_party/blink/renderer/platform/bindings/DEPS index 65ed8d0..54bd3b9f 100644 --- a/third_party/blink/renderer/platform/bindings/DEPS +++ b/third_party/blink/renderer/platform/bindings/DEPS
@@ -7,7 +7,7 @@ # Dependencies. "+gin/public", - "+third_party/blink/renderer/platform/cross_thread_functional.h", + "+third_party/blink/renderer/platform/wtf/cross_thread_functional.h", "+third_party/blink/renderer/platform/heap", "+third_party/blink/renderer/platform/instance_counters.h", "+third_party/blink/renderer/platform/instrumentation",
diff --git a/third_party/blink/renderer/platform/bindings/callback_function_base.cc b/third_party/blink/renderer/platform/bindings/callback_function_base.cc index d2d7aece..2ece7d5 100644 --- a/third_party/blink/renderer/platform/bindings/callback_function_base.cc +++ b/third_party/blink/renderer/platform/bindings/callback_function_base.cc
@@ -86,15 +86,6 @@ std::move(closure).Run(); } -V8PersistentCallbackFunctionBase::V8PersistentCallbackFunctionBase( - CallbackFunctionBase* callback_function) - : callback_function_(callback_function) { - v8::Isolate* isolate = callback_function_->GetIsolate(); - v8::HandleScope scope(isolate); - auto local = callback_function_->callback_function_.NewLocal(isolate); - v8_function_.Reset(isolate, local); -} - void V8PersistentCallbackFunctionBase::Trace(blink::Visitor* visitor) { visitor->Trace(callback_function_); }
diff --git a/third_party/blink/renderer/platform/bindings/callback_function_base.h b/third_party/blink/renderer/platform/bindings/callback_function_base.h index f0d08f8..935e74c 100644 --- a/third_party/blink/renderer/platform/bindings/callback_function_base.h +++ b/third_party/blink/renderer/platform/bindings/callback_function_base.h
@@ -112,6 +112,8 @@ friend class V8PersistentCallbackFunctionBase; }; +// CAUTION: THIS CLASS IS OBSOLETE AFTER THE UNIFIED HEAP AND WILL BE REMOVED. +// // V8PersistentCallbackFunctionBase retains the underlying v8::Function of a // CallbackFunctionBase without wrapper-tracing. This class is necessary and // useful where wrapper-tracing is not suitable. Remember that, as a nature of @@ -122,12 +124,14 @@ class PLATFORM_EXPORT V8PersistentCallbackFunctionBase : public GarbageCollectedFinalized<V8PersistentCallbackFunctionBase> { public: - virtual ~V8PersistentCallbackFunctionBase() { v8_function_.Reset(); } + virtual ~V8PersistentCallbackFunctionBase() = default; virtual void Trace(blink::Visitor*); protected: - explicit V8PersistentCallbackFunctionBase(CallbackFunctionBase*); + explicit V8PersistentCallbackFunctionBase( + CallbackFunctionBase* callback_function) + : callback_function_(callback_function) {} template <typename V8CallbackFunction> V8CallbackFunction* As() { @@ -139,9 +143,6 @@ private: Member<CallbackFunctionBase> callback_function_; - // Use v8::Object instead of v8::Function in order to handle - // [TreatNonObjectAsNull]. - v8::Persistent<v8::Object> v8_function_; }; // V8PersistentCallbackFunction<V8CallbackFunction> is a counter-part of
diff --git a/third_party/blink/renderer/platform/bindings/callback_interface_base.cc b/third_party/blink/renderer/platform/bindings/callback_interface_base.cc index 9b3b3c6..07f5bd50 100644 --- a/third_party/blink/renderer/platform/bindings/callback_interface_base.cc +++ b/third_party/blink/renderer/platform/bindings/callback_interface_base.cc
@@ -72,15 +72,6 @@ return nullptr; } -V8PersistentCallbackInterfaceBase::V8PersistentCallbackInterfaceBase( - CallbackInterfaceBase* callback_interface) - : callback_interface_(callback_interface) { - v8::Isolate* isolate = callback_interface_->GetIsolate(); - v8::HandleScope scope(isolate); - auto local = callback_interface_->callback_object_.NewLocal(isolate); - v8_object_.Reset(isolate, local); -} - void V8PersistentCallbackInterfaceBase::Trace(blink::Visitor* visitor) { visitor->Trace(callback_interface_); }
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 5448946..ed76654 100644 --- a/third_party/blink/renderer/platform/bindings/callback_interface_base.h +++ b/third_party/blink/renderer/platform/bindings/callback_interface_base.h
@@ -109,6 +109,8 @@ friend class V8PersistentCallbackInterfaceBase; }; +// CAUTION: THIS CLASS IS OBSOLETE AFTER THE UNIFIED HEAP AND WILL BE REMOVED. +// // V8PersistentCallbackInterfaceBase retains the underlying v8::Object of a // CallbackInterfaceBase without wrapper-tracing. This class is necessary and // useful where wrapper-tracing is not suitable. Remember that, as a nature of @@ -119,14 +121,16 @@ class PLATFORM_EXPORT V8PersistentCallbackInterfaceBase : public GarbageCollectedFinalized<V8PersistentCallbackInterfaceBase> { public: - virtual ~V8PersistentCallbackInterfaceBase() { v8_object_.Reset(); } + virtual ~V8PersistentCallbackInterfaceBase() = default; virtual void Trace(blink::Visitor*); v8::Isolate* GetIsolate() { return callback_interface_->GetIsolate(); } protected: - explicit V8PersistentCallbackInterfaceBase(CallbackInterfaceBase*); + explicit V8PersistentCallbackInterfaceBase( + CallbackInterfaceBase* callback_interface) + : callback_interface_(callback_interface) {} template <typename V8CallbackInterface> V8CallbackInterface* As() { @@ -138,7 +142,6 @@ private: Member<CallbackInterfaceBase> callback_interface_; - v8::Persistent<v8::Object> v8_object_; }; // V8PersistentCallbackInterface<V8CallbackInterface> is a counter-part of
diff --git a/third_party/blink/renderer/platform/bindings/parkable_string.cc b/third_party/blink/renderer/platform/bindings/parkable_string.cc index 7bc8a2c..a307d5a 100644 --- a/third_party/blink/renderer/platform/bindings/parkable_string.cc +++ b/third_party/blink/renderer/platform/bindings/parkable_string.cc
@@ -14,13 +14,13 @@ #include "base/trace_event/trace_event.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/bindings/parkable_string_manager.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/web_process_memory_dump.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/sanitizers.h" #include "third_party/blink/renderer/platform/wtf/thread_specific.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/platform/blob/DEPS b/third_party/blink/renderer/platform/blob/DEPS index 8ace279..d6479c8 100644 --- a/third_party/blink/renderer/platform/blob/DEPS +++ b/third_party/blink/renderer/platform/blob/DEPS
@@ -6,7 +6,6 @@ "+third_party/blink/renderer/platform/blob", # Dependencies. - "+third_party/blink/renderer/platform/cross_thread_functional.h", "+third_party/blink/renderer/platform/histogram.h", "+third_party/blink/renderer/platform/instrumentation", "+third_party/blink/renderer/platform/platform_export.h",
diff --git a/third_party/blink/renderer/platform/blob/blob_bytes_provider.cc b/third_party/blink/renderer/platform/blob/blob_bytes_provider.cc index 1137c76..eab93dd 100644 --- a/third_party/blink/renderer/platform/blob/blob_bytes_provider.cc +++ b/third_party/blink/renderer/platform/blob/blob_bytes_provider.cc
@@ -8,11 +8,11 @@ #include "base/task/post_task.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/blob/blob_data.cc b/third_party/blink/renderer/platform/blob/blob_data.cc index 2462b79..cf420a5 100644 --- a/third_party/blink/renderer/platform/blob/blob_data.cc +++ b/third_party/blink/renderer/platform/blob/blob_data.cc
@@ -46,10 +46,10 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/blob/blob_bytes_provider.h" #include "third_party/blink/renderer/platform/blob/blob_registry.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/uuid.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/cstring.h" #include "third_party/blink/renderer/platform/wtf/text/line_ending.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding.h"
diff --git a/third_party/blink/renderer/platform/blob/blob_registry.cc b/third_party/blink/renderer/platform/blob/blob_registry.cc index c63445d0..d217119 100644 --- a/third_party/blink/renderer/platform/blob/blob_registry.cc +++ b/third_party/blink/renderer/platform/blob/blob_registry.cc
@@ -38,9 +38,9 @@ #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/platform/blob/blob_data.h" #include "third_party/blink/renderer/platform/blob/blob_url.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/threading.h"
diff --git a/third_party/blink/renderer/platform/exported/mediastream/webrtc_uma_histograms.cc b/third_party/blink/renderer/platform/exported/mediastream/webrtc_uma_histograms.cc index 32820de4..2c0817e1 100644 --- a/third_party/blink/renderer/platform/exported/mediastream/webrtc_uma_histograms.cc +++ b/third_party/blink/renderer/platform/exported/mediastream/webrtc_uma_histograms.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h" #include "base/metrics/histogram_macros.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h" namespace blink { @@ -13,9 +14,10 @@ NUM_MEDIA_STREAM_REQUEST_WITH_NO_RESULT); } -void LogUserMediaRequestResult(MediaStreamRequestResult result) { - UMA_HISTOGRAM_ENUMERATION("WebRTC.UserMediaRequest.Result2", result, - NUM_MEDIA_REQUEST_RESULTS); +void LogUserMediaRequestResult(mojom::blink::MediaStreamRequestResult result) { + UMA_HISTOGRAM_ENUMERATION( + "WebRTC.UserMediaRequest.Result2", result, + mojom::blink::MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS); } void UpdateWebRTCMethodCount(WebRTCAPIName api_name) {
diff --git a/third_party/blink/renderer/platform/exported/platform.cc b/third_party/blink/renderer/platform/exported/platform.cc index 63f3cc0..1861861 100644 --- a/third_party/blink/renderer/platform/exported/platform.cc +++ b/third_party/blink/renderer/platform/exported/platform.cc
@@ -48,7 +48,6 @@ #include "third_party/blink/public/platform/web_rtc_peer_connection_handler.h" #include "third_party/blink/public/platform/websocket_handshake_throttle.h" #include "third_party/blink/renderer/platform/bindings/parkable_string_manager.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/font_family_names.h" #include "third_party/blink/renderer/platform/fonts/font_cache_memory_dump_provider.h" #include "third_party/blink/renderer/platform/heap/blink_gc_memory_dump_provider.h" @@ -64,6 +63,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/webrtc/api/async_resolver_factory.h" #include "third_party/webrtc/api/rtp_parameters.h"
diff --git a/third_party/blink/renderer/platform/exported/web_resource_timing_info.cc b/third_party/blink/renderer/platform/exported/web_resource_timing_info.cc index fc4a988..55b725c7 100644 --- a/third_party/blink/renderer/platform/exported/web_resource_timing_info.cc +++ b/third_party/blink/renderer/platform/exported/web_resource_timing_info.cc
@@ -51,9 +51,14 @@ IsSameServerTimingInfo(server_timing, other.server_timing); } -CrossThreadCopier<WebResourceTimingInfo>::Type CrossThreadCopier< - WebResourceTimingInfo>::Copy(const WebResourceTimingInfo& info) { - WebResourceTimingInfo copy; +} // namespace blink + +namespace WTF { +#if INSIDE_BLINK +CrossThreadCopier<blink::WebResourceTimingInfo>::Type +CrossThreadCopier<blink::WebResourceTimingInfo>::Copy( + const blink::WebResourceTimingInfo& info) { + blink::WebResourceTimingInfo copy; copy.name = String(info.name).IsolatedCopy(); copy.start_time = info.start_time; @@ -63,7 +68,7 @@ copy.connection_info = String(info.connection_info).IsolatedCopy(); if (!info.timing.IsNull()) - copy.timing = CrossThreadCopier<WebURLLoadTiming>::Copy(info.timing); + copy.timing = CrossThreadCopier<blink::WebURLLoadTiming>::Copy(info.timing); copy.last_redirect_end_time = info.last_redirect_end_time; copy.response_end = info.response_end; @@ -80,13 +85,13 @@ copy.allow_negative_values = info.allow_negative_values; for (auto& entry : info.server_timing) { - WebServerTimingInfo entry_copy(String(entry.name).IsolatedCopy(), - entry.duration, - String(entry.description).IsolatedCopy()); + blink::WebServerTimingInfo entry_copy( + String(entry.name).IsolatedCopy(), entry.duration, + String(entry.description).IsolatedCopy()); copy.server_timing.emplace_back(std::move(entry_copy)); } return copy; } - -} // namespace blink +#endif +} // namespace WTF
diff --git a/third_party/blink/renderer/platform/exported/web_resource_timing_info_test.cc b/third_party/blink/renderer/platform/exported/web_resource_timing_info_test.cc index 04b20342..9acf361 100644 --- a/third_party/blink/renderer/platform/exported/web_resource_timing_info_test.cc +++ b/third_party/blink/renderer/platform/exported/web_resource_timing_info_test.cc
@@ -5,11 +5,11 @@ #include "third_party/blink/public/platform/web_resource_timing_info.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_load_timing.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/exported/web_url_load_timing.cc b/third_party/blink/renderer/platform/exported/web_url_load_timing.cc index 421bf0e..861cbdc 100644 --- a/third_party/blink/renderer/platform/exported/web_url_load_timing.cc +++ b/third_party/blink/renderer/platform/exported/web_url_load_timing.cc
@@ -200,13 +200,17 @@ return private_->DeepCopy(); } -CrossThreadCopier<WebURLLoadTiming>::Type -CrossThreadCopier<WebURLLoadTiming>::Copy(const WebURLLoadTiming& timing) { - return timing.DeepCopy(); -} - bool WebURLLoadTiming::operator==(const WebURLLoadTiming& other) const { return *private_ == *other.private_; } } // namespace blink + +namespace WTF { + +CrossThreadCopier<blink::WebURLLoadTiming>::Type CrossThreadCopier< + blink::WebURLLoadTiming>::Copy(const blink::WebURLLoadTiming& timing) { + return timing.DeepCopy(); +} + +} // namespace WTF
diff --git a/third_party/blink/renderer/platform/geometry/int_rect.h b/third_party/blink/renderer/platform/geometry/int_rect.h index 81add3d..c5aa069 100644 --- a/third_party/blink/renderer/platform/geometry/int_rect.h +++ b/third_party/blink/renderer/platform/geometry/int_rect.h
@@ -240,6 +240,14 @@ } // namespace blink +namespace WTF { +template <> +struct CrossThreadCopier<blink::IntRect> + : public CrossThreadCopierPassThrough<blink::IntRect> { + STATIC_ONLY(CrossThreadCopier); +}; +} + WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect) #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_INT_RECT_H_
diff --git a/third_party/blink/renderer/platform/geometry/int_size.h b/third_party/blink/renderer/platform/geometry/int_size.h index ef417d1..f96015d3 100644 --- a/third_party/blink/renderer/platform/geometry/int_size.h +++ b/third_party/blink/renderer/platform/geometry/int_size.h
@@ -32,6 +32,7 @@ #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/vector2d.h" @@ -167,4 +168,14 @@ } // namespace blink +namespace WTF { + +template <> +struct CrossThreadCopier<blink::IntSize> + : public CrossThreadCopierPassThrough<blink::IntSize> { + STATIC_ONLY(CrossThreadCopier); +}; + +} + #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_INT_SIZE_H_
diff --git a/third_party/blink/renderer/platform/graphics/DEPS b/third_party/blink/renderer/platform/graphics/DEPS index 46c6bdc..d82a5d9a 100644 --- a/third_party/blink/renderer/platform/graphics/DEPS +++ b/third_party/blink/renderer/platform/graphics/DEPS
@@ -30,7 +30,6 @@ "+services/viz/public/interfaces", "+services/ws/public/cpp/gpu/context_provider_command_buffer.h", "+third_party/blink/renderer/platform/cpu/mips/common_macros_msa.h", - "+third_party/blink/renderer/platform/cross_thread_functional.h", "+third_party/blink/renderer/platform/fonts", "+third_party/blink/renderer/platform/geometry", "+third_party/blink/renderer/platform/heap",
diff --git a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc index d867981..f5fc85e 100644 --- a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc +++ b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc
@@ -10,12 +10,12 @@ #include "gpu/command_buffer/common/sync_token.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" #include "third_party/blink/renderer/platform/graphics/mailbox_texture_holder.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" #include "third_party/blink/renderer/platform/graphics/skia_texture_holder.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/gpu/GrTexture.h"
diff --git a/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.cc b/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.cc index ffa5b3b..826b398 100644 --- a/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.cc +++ b/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.cc
@@ -11,13 +11,13 @@ #include "base/time/default_tick_clock.h" #include "base/timer/elapsed_timer.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator.h" #include "third_party/blink/renderer/platform/graphics/compositor_mutator_client.h" #include "third_party/blink/renderer/platform/graphics/main_thread_mutator_client.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl_test.cc b/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl_test.cc index ce21d92..4b6940f 100644 --- a/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl_test.cc +++ b/third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl_test.cc
@@ -11,7 +11,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_thread_type.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator.h" #include "third_party/blink/renderer/platform/graphics/compositor_mutator_client.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -19,6 +18,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include <memory>
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc index 6cd65a6..80b40f8 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc
@@ -44,7 +44,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_host.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" @@ -58,6 +57,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.cc b/third_party/blink/renderer/platform/graphics/canvas_resource.cc index 788a249..c5ff1924 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource.cc
@@ -18,13 +18,13 @@ #include "gpu/command_buffer/common/shared_image_usage.h" #include "gpu/command_buffer/common/sync_token.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" #include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/skia/include/gpu/GrContext.h" #include "ui/gfx/buffer_format_util.h"
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc index 4cbec1c..feb9021 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc
@@ -16,13 +16,13 @@ #include "third_party/blink/public/platform/interface_provider.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" #include "third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "ui/gfx/mojo/presentation_feedback.mojom-blink.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/compositor_mutator_client.cc b/third_party/blink/renderer/platform/graphics/compositor_mutator_client.cc index bf41d71..0b77394 100644 --- a/third_party/blink/renderer/platform/graphics/compositor_mutator_client.cc +++ b/third_party/blink/renderer/platform/graphics/compositor_mutator_client.cc
@@ -6,8 +6,8 @@ #include <memory> #include "base/trace_event/trace_event.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc index 4320a3e..b821938d 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc
@@ -31,7 +31,6 @@ #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/image_decoding_store.h" #include "third_party/blink/renderer/platform/graphics/image_frame_generator.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" @@ -42,6 +41,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPixmap.h" #include "third_party/skia/include/core/SkSurface.h"
diff --git a/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc b/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc index 5ce7e31..7de8d472 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc
@@ -10,9 +10,9 @@ #include "gpu/config/gpu_feature_info.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc b/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc index 2c09473..d1d3c3d 100644 --- a/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc +++ b/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc
@@ -30,7 +30,6 @@ #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/image_decoding_store.h" #include "third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h" #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" @@ -38,6 +37,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/mailbox_texture_holder.cc b/third_party/blink/renderer/platform/graphics/mailbox_texture_holder.cc index b23235b..73a43d8f 100644 --- a/third_party/blink/renderer/platform/graphics/mailbox_texture_holder.cc +++ b/third_party/blink/renderer/platform/graphics/mailbox_texture_holder.cc
@@ -6,10 +6,10 @@ #include "gpu/command_buffer/client/gles2_interface.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" #include "third_party/blink/renderer/platform/graphics/skia_texture_holder.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/skia/include/gpu/GrContext.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.cc b/third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.cc index d17de32..b344e13 100644 --- a/third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.cc +++ b/third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.cc
@@ -5,10 +5,10 @@ #include "third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.h" #include "base/single_thread_task_runner.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/wtf.h"
diff --git a/third_party/blink/renderer/platform/graphics/paint_worklet_paint_dispatcher.cc b/third_party/blink/renderer/platform/graphics/paint_worklet_paint_dispatcher.cc index a630d27..9a5895b 100644 --- a/third_party/blink/renderer/platform/graphics/paint_worklet_paint_dispatcher.cc +++ b/third_party/blink/renderer/platform/graphics/paint_worklet_paint_dispatcher.cc
@@ -8,11 +8,11 @@ #include "base/synchronization/waitable_event.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { @@ -102,8 +102,8 @@ sk_sp<cc::PaintRecord>* output) { *output = painter->Paint(input); }, - WrapCrossThreadPersistent(painter), CrossThreadUnretained(input), - WTF::Passed(std::move(done)), CrossThreadUnretained(&output))); + WrapCrossThreadPersistent(painter), WTF::CrossThreadUnretained(input), + WTF::Passed(std::move(done)), WTF::CrossThreadUnretained(&output))); done_event.Wait();
diff --git a/third_party/blink/renderer/platform/graphics/skia_texture_holder.cc b/third_party/blink/renderer/platform/graphics/skia_texture_holder.cc index daeebbc3..988b001 100644 --- a/third_party/blink/renderer/platform/graphics/skia_texture_holder.cc +++ b/third_party/blink/renderer/platform/graphics/skia_texture_holder.cc
@@ -6,10 +6,10 @@ #include "gpu/command_buffer/client/gles2_interface.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/canvas_color_params.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" #include "third_party/blink/renderer/platform/graphics/mailbox_texture_holder.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/skia/include/gpu/GrBackendSurface.h" #include "third_party/skia/include/gpu/GrContext.h"
diff --git a/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc index 39b0fd86..56e3949 100644 --- a/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc +++ b/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc
@@ -7,11 +7,11 @@ #include "components/viz/common/gpu/context_provider.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h" #include "third_party/blink/renderer/platform/graphics/web_graphics_context_3d_provider_wrapper.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/skia/include/core/SkImage.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/heap/DEPS b/third_party/blink/renderer/platform/heap/DEPS index 9822448..5ed63eb 100644 --- a/third_party/blink/renderer/platform/heap/DEPS +++ b/third_party/blink/renderer/platform/heap/DEPS
@@ -12,7 +12,6 @@ "+base/synchronization/lock.h", "+third_party/blink/renderer/platform/bindings", - "+third_party/blink/renderer/platform/cross_thread_functional.h", "+third_party/blink/renderer/platform/histogram.h", "+third_party/blink/renderer/platform/instrumentation", "+third_party/blink/renderer/platform/memory_pressure_listener.h",
diff --git a/third_party/blink/renderer/platform/heap/gc_task_runner.h b/third_party/blink/renderer/platform/heap/gc_task_runner.h index b088bd8..9bbc302 100644 --- a/third_party/blink/renderer/platform/heap/gc_task_runner.h +++ b/third_party/blink/renderer/platform/heap/gc_task_runner.h
@@ -33,9 +33,9 @@ #include <memory> #include "base/location.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/thread_state.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/heap/heap_test.cc b/third_party/blink/renderer/platform/heap/heap_test.cc index 3b4ba8b..36db804 100644 --- a/third_party/blink/renderer/platform/heap/heap_test.cc +++ b/third_party/blink/renderer/platform/heap/heap_test.cc
@@ -41,7 +41,6 @@ #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/address_cache.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/heap.h" @@ -56,6 +55,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/hash_traits.h" #include "third_party/blink/renderer/platform/wtf/linked_hash_set.h"
diff --git a/third_party/blink/renderer/platform/heap/heap_thread_test.cc b/third_party/blink/renderer/platform/heap/heap_thread_test.cc index e30204d..3f7e3ed 100644 --- a/third_party/blink/renderer/platform/heap/heap_thread_test.cc +++ b/third_party/blink/renderer/platform/heap/heap_thread_test.cc
@@ -5,7 +5,6 @@ #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap_test_utilities.h" @@ -13,6 +12,7 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink { namespace heap_thread_test {
diff --git a/third_party/blink/renderer/platform/heap/persistent.h b/third_party/blink/renderer/platform/heap/persistent.h index 31c80b5..ad3d4e5 100644 --- a/third_party/blink/renderer/platform/heap/persistent.h +++ b/third_party/blink/renderer/platform/heap/persistent.h
@@ -13,6 +13,7 @@ #include "third_party/blink/renderer/platform/heap/persistent_node.h" #include "third_party/blink/renderer/platform/heap/visitor.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink { @@ -661,6 +662,18 @@ using Hash = MemberHash<T>; }; +template <typename T> +struct CrossThreadCopier<blink::CrossThreadPersistent<T>> + : public CrossThreadCopierPassThrough<blink::CrossThreadPersistent<T>> { + STATIC_ONLY(CrossThreadCopier); +}; + +template <typename T> +struct CrossThreadCopier<blink::CrossThreadWeakPersistent<T>> + : public CrossThreadCopierPassThrough<blink::CrossThreadWeakPersistent<T>> { + STATIC_ONLY(CrossThreadCopier); +}; + } // namespace WTF namespace base {
diff --git a/third_party/blink/renderer/platform/heap/persistent_test.cc b/third_party/blink/renderer/platform/heap/persistent_test.cc index 8ecc2744..524eab1 100644 --- a/third_party/blink/renderer/platform/heap/persistent_test.cc +++ b/third_party/blink/renderer/platform/heap/persistent_test.cc
@@ -6,9 +6,9 @@ #include <memory> #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/heap_test_utilities.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/DEPS b/third_party/blink/renderer/platform/loader/DEPS index db14b64..7f89112 100644 --- a/third_party/blink/renderer/platform/loader/DEPS +++ b/third_party/blink/renderer/platform/loader/DEPS
@@ -15,8 +15,8 @@ "+third_party/blink/renderer/platform/bindings/script_forbidden_scope.h", "+third_party/blink/renderer/platform/bindings/trace_wrapper_member.h", "+third_party/blink/renderer/platform/blob/blob_data.h", - "+third_party/blink/renderer/platform/cross_thread_copier.h", - "+third_party/blink/renderer/platform/cross_thread_functional.h", + "+third_party/blink/renderer/platform/wtf/cross_thread_copier.h", + "+third_party/blink/renderer/platform/wtf/cross_thread_functional.h", "+third_party/blink/renderer/platform/crypto.h", "+third_party/blink/renderer/platform/exported", "+third_party/blink/renderer/platform/heap",
diff --git a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h index 7a41f2e4e..2a5ab53 100644 --- a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h +++ b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h
@@ -9,7 +9,6 @@ #include "services/network/public/mojom/referrer_policy.mojom-shared.h" #include "third_party/blink/public/mojom/net/ip_address_space.mojom-blink.h" #include "third_party/blink/public/platform/web_insecure_request_policy.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/loader/allowed_by_nosniff.h" @@ -17,6 +16,7 @@ #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h index d970b29..8c9075c2 100644 --- a/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h +++ b/third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h
@@ -6,11 +6,11 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_FETCH_CLIENT_SETTINGS_OBJECT_SNAPSHOT_H_ #include "services/network/public/mojom/referrer_policy.mojom-shared.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_response_test.cc b/third_party/blink/renderer/platform/loader/fetch/resource_response_test.cc index e330709..526077e 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_response_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_response_test.cc
@@ -6,10 +6,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/memory_pressure_listener.cc b/third_party/blink/renderer/platform/memory_pressure_listener.cc index 8020223..87f1461 100644 --- a/third_party/blink/renderer/platform/memory_pressure_listener.cc +++ b/third_party/blink/renderer/platform/memory_pressure_listener.cc
@@ -10,13 +10,13 @@ #include "third_party/blink/public/common/device_memory/approximated_device_memory.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/web/blink.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/fonts/font_global_context.h" #include "third_party/blink/renderer/platform/graphics/image_decoding_store.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #if defined(OS_ANDROID) #include "base/android/sys_utils.h"
diff --git a/third_party/blink/renderer/platform/network/DEPS b/third_party/blink/renderer/platform/network/DEPS index b2afd512..d714606 100644 --- a/third_party/blink/renderer/platform/network/DEPS +++ b/third_party/blink/renderer/platform/network/DEPS
@@ -18,8 +18,6 @@ "+services/network/public/cpp/features.h", "+third_party/blink/renderer/platform/blob/blob_data.h", - "+third_party/blink/renderer/platform/cross_thread_copier.h", - "+third_party/blink/renderer/platform/cross_thread_functional.h", "+third_party/blink/renderer/platform/crypto.h", "+third_party/blink/renderer/platform/file_metadata.h", "+third_party/blink/renderer/platform/heap",
diff --git a/third_party/blink/renderer/platform/network/content_security_policy_response_headers.h b/third_party/blink/renderer/platform/network/content_security_policy_response_headers.h index ff1c629..4df0f88 100644 --- a/third_party/blink/renderer/platform/network/content_security_policy_response_headers.h +++ b/third_party/blink/renderer/platform/network/content_security_policy_response_headers.h
@@ -26,9 +26,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_NETWORK_CONTENT_SECURITY_POLICY_RESPONSE_HEADERS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_NETWORK_CONTENT_SECURITY_POLICY_RESPONSE_HEADERS_H_ -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -64,16 +64,20 @@ const bool should_parse_wasm_eval_ = false; }; +} // namespace blink + +namespace WTF { + template <> -struct CrossThreadCopier<ContentSecurityPolicyResponseHeaders> { +struct CrossThreadCopier<blink::ContentSecurityPolicyResponseHeaders> { STATIC_ONLY(CrossThreadCopier); - using Type = ContentSecurityPolicyResponseHeaders; + using Type = blink::ContentSecurityPolicyResponseHeaders; PLATFORM_EXPORT static Type Copy( - const ContentSecurityPolicyResponseHeaders& headers) { + const blink::ContentSecurityPolicyResponseHeaders& headers) { return headers.IsolatedCopy(); } }; -} // namespace blink +} // namespace WTF #endif
diff --git a/third_party/blink/renderer/platform/network/network_state_notifier.cc b/third_party/blink/renderer/platform/network/network_state_notifier.cc index b3db869..93d3f02 100644 --- a/third_party/blink/renderer/platform/network/network_state_notifier.cc +++ b/third_party/blink/renderer/platform/network/network_state_notifier.cc
@@ -29,9 +29,9 @@ #include "net/nqe/effective_connection_type.h" #include "net/nqe/network_quality_estimator_params.h" #include "third_party/blink/public/common/client_hints/client_hints.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" @@ -63,12 +63,6 @@ } // namespace -template <> -struct CrossThreadCopier<NetworkStateNotifier::NetworkState> - : public CrossThreadCopierPassThrough<NetworkStateNotifier::NetworkState> { - STATIC_ONLY(CrossThreadCopier); -}; - NetworkStateNotifier& GetNetworkStateNotifier() { DEFINE_THREAD_SAFE_STATIC_LOCAL(NetworkStateNotifier, network_state_notifier, ());
diff --git a/third_party/blink/renderer/platform/network/network_state_notifier.h b/third_party/blink/renderer/platform/network/network_state_notifier.h index 92634c3b5..81da4a5 100644 --- a/third_party/blink/renderer/platform/network/network_state_notifier.h +++ b/third_party/blink/renderer/platform/network/network_state_notifier.h
@@ -34,9 +34,9 @@ #include "base/single_thread_task_runner.h" #include "third_party/blink/public/platform/web_connection_type.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" @@ -378,4 +378,15 @@ } // namespace blink +namespace WTF { + +template <> +struct CrossThreadCopier<blink::NetworkStateNotifier::NetworkState> + : public CrossThreadCopierPassThrough< + blink::NetworkStateNotifier::NetworkState> { + STATIC_ONLY(CrossThreadCopier); +}; + +} // namespace WTF + #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_NETWORK_NETWORK_STATE_NOTIFIER_H_
diff --git a/third_party/blink/renderer/platform/scheduler/DEPS b/third_party/blink/renderer/platform/scheduler/DEPS index 64a7a16..c7bae01 100644 --- a/third_party/blink/renderer/platform/scheduler/DEPS +++ b/third_party/blink/renderer/platform/scheduler/DEPS
@@ -50,7 +50,6 @@ "+services/metrics", "+third_party/blink/renderer/platform/bindings/parkable_string_manager.h", - "+third_party/blink/renderer/platform/cross_thread_functional.h", "+third_party/blink/renderer/platform/histogram.h", "+third_party/blink/renderer/platform/instrumentation", "+third_party/blink/renderer/platform/platform_export.h",
diff --git a/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md b/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md index 3003f5a2..e65265e 100644 --- a/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md +++ b/third_party/blink/renderer/platform/scheduler/TaskSchedulingInBlink.md
@@ -22,7 +22,7 @@ TaskRunner::PostTask or TaskRunner::PostDelayedTask interface. The regular method of creating closures (base::BindOnce/Repeating) [is banned](#binding-tasks). Blink should use WTF::Bind (for tasks which are posted to the same thread) and -WTF::CrossThreadBind +CrossThreadBind ([for tasks which are posted to a different thread](#off-main-thread-scheduling)). At the moment Blink Scheduler treats tasks as an atomic unit — if a task has started, @@ -35,7 +35,7 @@ thread tasks should be associated with a frame to allow the scheduler to freeze or prioritise individual frames. This is a hard requirement backed by a DCHECK that a task running javascript should have this association -(which is being introduced). +(which is being introduced). FrameScheduler::GetTaskRunner (or its aliases LocalFrame::GetTaskRunner, WebLocalFrame::GetTaskRunner, RenderFrame::GetTaskRunner or @@ -169,12 +169,12 @@ Many data structures in Blink are bound to a particular thread (e.g. Strings, garbage-collected classes, etc), so it’s not safe to pass a pointer to them to another thread. To enforce this, base::Bind is banned in Blink and WTF::Bind -and WTF::CrossThreadBind are provided as alternatives. WTF::Bind should be used +and CrossThreadBind are provided as alternatives. WTF::Bind should be used to post tasks to the same thread and closures returned by it DCHECK that -they run on the same thread. WTF::CrossThreadBind applies CrossThreadCopier +they run on the same thread. CrossThreadBind applies CrossThreadCopier to its arguments and creates a deep copy, so the resulting closure can run on a different thread. -## TODO(altimin): Document idle tasks +## TODO(altimin): Document idle tasks
diff --git a/third_party/blink/renderer/platform/scheduler/common/thread.cc b/third_party/blink/renderer/platform/scheduler/common/thread.cc index a6ff1ca..c95408a 100644 --- a/third_party/blink/renderer/platform/scheduler/common/thread.cc +++ b/third_party/blink/renderer/platform/scheduler/common/thread.cc
@@ -10,12 +10,12 @@ #include "build/build_config.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/worker/compositor_thread.h" #include "third_party/blink/renderer/platform/scheduler/worker/compositor_thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/thread_specific.h"
diff --git a/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc index e34644a6..7474aa3 100644 --- a/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/worker_pool_unittest.cc
@@ -8,7 +8,7 @@ #include "base/location.h" #include "base/test/scoped_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/scheduler/public/worker_pool.h b/third_party/blink/renderer/platform/scheduler/public/worker_pool.h index 8998bfc..7400971 100644 --- a/third_party/blink/renderer/platform/scheduler/public/worker_pool.h +++ b/third_party/blink/renderer/platform/scheduler/public/worker_pool.h
@@ -16,7 +16,7 @@ namespace worker_pool { // These are a thin wrapper around base::ThreadPoolInstance to ensure that all -// callers use WTF::CrossThreadBindOnce instead of base::Bind to ensure that +// callers use CrossThreadBindOnce instead of base::Bind to ensure that // all non-thread-safe objects are copied properly. // // All tasks that do not care about which thread they are running on
diff --git a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_unittest.cc b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_unittest.cc index d39bdf2..b6ee288 100644 --- a/third_party/blink/renderer/platform/scheduler/worker/worker_thread_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/worker/worker_thread_unittest.cc
@@ -10,9 +10,9 @@ #include "base/synchronization/waitable_event.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/worker/worker_thread_scheduler.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" using testing::_; using testing::AnyOf;
diff --git a/third_party/blink/renderer/platform/weborigin/kurl.h b/third_party/blink/renderer/platform/weborigin/kurl.h index 44914496..818ded54 100644 --- a/third_party/blink/renderer/platform/weborigin/kurl.h +++ b/third_party/blink/renderer/platform/weborigin/kurl.h
@@ -31,6 +31,7 @@ #include <memory> #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "url/third_party/mozilla/url_parse.h" @@ -324,6 +325,13 @@ typedef blink::KURLHash Hash; }; +template <> +struct CrossThreadCopier<blink::KURL> { + STATIC_ONLY(CrossThreadCopier); + typedef blink::KURL Type; + static Type Copy(const blink::KURL& url) { return url.Copy(); } +}; + } // namespace WTF #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WEBORIGIN_KURL_H_
diff --git a/third_party/blink/renderer/platform/wtf/BUILD.gn b/third_party/blink/renderer/platform/wtf/BUILD.gn index e0b0ca0..ade34d0 100644 --- a/third_party/blink/renderer/platform/wtf/BUILD.gn +++ b/third_party/blink/renderer/platform/wtf/BUILD.gn
@@ -46,6 +46,9 @@ "casting.h", "conditional_destructor.h", "container_annotations.h", + "cross_thread_copier.cc", + "cross_thread_copier.h", + "cross_thread_functional.h", "date_math.cc", "date_math.h", "decimal.cc",
diff --git a/third_party/blink/renderer/platform/cross_thread_copier.cc b/third_party/blink/renderer/platform/wtf/cross_thread_copier.cc similarity index 91% rename from third_party/blink/renderer/platform/cross_thread_copier.cc rename to third_party/blink/renderer/platform/wtf/cross_thread_copier.cc index 1154c8d..6018292 100644 --- a/third_party/blink/renderer/platform/cross_thread_copier.cc +++ b/third_party/blink/renderer/platform/wtf/cross_thread_copier.cc
@@ -28,17 +28,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include <memory> -#include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" -namespace blink { - -CrossThreadCopier<KURL>::Type CrossThreadCopier<KURL>::Copy(const KURL& url) { - return url.Copy(); -} +namespace WTF { CrossThreadCopier<String>::Type CrossThreadCopier<String>::Copy( const String& str) { @@ -82,4 +77,4 @@ CrossThreadCopier<std::unique_ptr<float>>::Type>::value), "std::unique_ptr test"); -} // namespace blink +} // namespace WTF
diff --git a/third_party/blink/renderer/platform/cross_thread_copier.h b/third_party/blink/renderer/platform/wtf/cross_thread_copier.h similarity index 76% rename from third_party/blink/renderer/platform/cross_thread_copier.h rename to third_party/blink/renderer/platform/wtf/cross_thread_copier.h index f66f7cb..b80cc66 100644 --- a/third_party/blink/renderer/platform/cross_thread_copier.h +++ b/third_party/blink/renderer/platform/wtf/cross_thread_copier.h
@@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_CROSS_THREAD_COPIER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_CROSS_THREAD_COPIER_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CROSS_THREAD_COPIER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CROSS_THREAD_COPIER_H_ #include <memory> #include <vector> @@ -39,7 +39,6 @@ #include "mojo/public/cpp/bindings/interface_ptr_info.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" -#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/functional.h" // FunctionThreadAffinity @@ -52,7 +51,7 @@ class TimeDelta; class TimeTicks; class Time; -} +} // namespace base class SkRefCnt; template <typename T> @@ -61,20 +60,6 @@ namespace WTF { template <typename T> -class PassedWrapper; -} - -namespace blink { - -class IntRect; -class IntSize; -class KURL; -template <typename T> -class CrossThreadPersistent; -template <typename T> -class CrossThreadWeakPersistent; - -template <typename T> struct CrossThreadCopierPassThrough { STATIC_ONLY(CrossThreadCopierPassThrough); typedef T Type; @@ -100,20 +85,20 @@ // CrossThreadCopier specializations follow. template <typename T> -struct CrossThreadCopier<WTF::RetainedRefWrapper<T>> { +struct CrossThreadCopier<RetainedRefWrapper<T>> { STATIC_ONLY(CrossThreadCopier); - static_assert(WTF::IsSubclassOfTemplate<T, base::RefCountedThreadSafe>::value, + static_assert(IsSubclassOfTemplate<T, base::RefCountedThreadSafe>::value, "scoped_refptr<T> can be passed across threads only if T is " - "WTF::ThreadSafeRefCounted or base::RefCountedThreadSafe."); - using Type = WTF::RetainedRefWrapper<T>; + "ThreadSafeRefCounted or base::RefCountedThreadSafe."); + using Type = RetainedRefWrapper<T>; static Type Copy(Type pointer) { return pointer; } }; template <typename T> struct CrossThreadCopier<scoped_refptr<T>> { STATIC_ONLY(CrossThreadCopier); - static_assert(WTF::IsSubclassOfTemplate<T, base::RefCountedThreadSafe>::value, + static_assert(IsSubclassOfTemplate<T, base::RefCountedThreadSafe>::value, "scoped_refptr<T> can be passed across threads only if T is " - "WTF::ThreadSafeRefCounted or base::RefCountedThreadSafe."); + "ThreadSafeRefCounted or base::RefCountedThreadSafe."); using Type = scoped_refptr<T>; static scoped_refptr<T> Copy(scoped_refptr<T> pointer) { return pointer; } }; @@ -158,18 +143,7 @@ // To allow a type to be passed across threads using its copy constructor, add a // forward declaration of the type and provide a specialization of -// CrossThreadCopier<T> in this file, like IntRect below. -template <> -struct CrossThreadCopier<IntRect> - : public CrossThreadCopierPassThrough<IntRect> { - STATIC_ONLY(CrossThreadCopier); -}; - -template <> -struct CrossThreadCopier<IntSize> - : public CrossThreadCopierPassThrough<IntSize> { - STATIC_ONLY(CrossThreadCopier); -}; +// CrossThreadCopier<T> in this file. template <typename T, typename Deleter> struct CrossThreadCopier<std::unique_ptr<T, Deleter>> { @@ -221,21 +195,8 @@ }; template <typename T> -struct CrossThreadCopier<CrossThreadPersistent<T>> - : public CrossThreadCopierPassThrough<CrossThreadPersistent<T>> { - STATIC_ONLY(CrossThreadCopier); -}; - -template <typename T> -struct CrossThreadCopier<CrossThreadWeakPersistent<T>> - : public CrossThreadCopierPassThrough<CrossThreadWeakPersistent<T>> { - STATIC_ONLY(CrossThreadCopier); -}; - -template <typename T> -struct CrossThreadCopier<WTF::CrossThreadUnretainedWrapper<T>> - : public CrossThreadCopierPassThrough< - WTF::CrossThreadUnretainedWrapper<T>> { +struct CrossThreadCopier<CrossThreadUnretainedWrapper<T>> + : public CrossThreadCopierPassThrough<CrossThreadUnretainedWrapper<T>> { STATIC_ONLY(CrossThreadCopier); }; @@ -246,40 +207,33 @@ }; template <typename T> -struct CrossThreadCopier<WTF::PassedWrapper<T>> { +struct CrossThreadCopier<PassedWrapper<T>> { STATIC_ONLY(CrossThreadCopier); - using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>; - static Type Copy(WTF::PassedWrapper<T>&& value) { + using Type = PassedWrapper<typename CrossThreadCopier<T>::Type>; + static Type Copy(PassedWrapper<T>&& value) { return WTF::Passed(CrossThreadCopier<T>::Copy(value.MoveOut())); } }; template <typename Signature> -struct CrossThreadCopier<WTF::CrossThreadFunction<Signature>> { +struct CrossThreadCopier<CrossThreadFunction<Signature>> { STATIC_ONLY(CrossThreadCopier); - using Type = WTF::CrossThreadFunction<Signature>; + using Type = CrossThreadFunction<Signature>; static Type Copy(Type&& value) { return std::move(value); } }; template <typename Signature> -struct CrossThreadCopier<WTF::CrossThreadOnceFunction<Signature>> { +struct CrossThreadCopier<CrossThreadOnceFunction<Signature>> { STATIC_ONLY(CrossThreadCopier); - using Type = WTF::CrossThreadOnceFunction<Signature>; + using Type = CrossThreadOnceFunction<Signature>; static Type Copy(Type&& value) { return std::move(value); } }; template <> -struct CrossThreadCopier<KURL> { - STATIC_ONLY(CrossThreadCopier); - typedef KURL Type; - PLATFORM_EXPORT static Type Copy(const KURL&); -}; - -template <> struct CrossThreadCopier<String> { STATIC_ONLY(CrossThreadCopier); typedef String Type; - PLATFORM_EXPORT static Type Copy(const String&); + WTF_EXPORT static Type Copy(const String&); }; // mojo::InterfacePtrInfo is a cross-thread safe mojo::InterfacePtr. @@ -302,9 +256,9 @@ }; template <> -struct CrossThreadCopier<MessagePortChannel> { +struct CrossThreadCopier<blink::MessagePortChannel> { STATIC_ONLY(CrossThreadCopier); - using Type = MessagePortChannel; + using Type = blink::MessagePortChannel; static Type Copy(Type pointer) { return pointer; // This is in fact a move. } @@ -312,14 +266,14 @@ template <wtf_size_t inlineCapacity, typename Allocator> struct CrossThreadCopier< - Vector<MessagePortChannel, inlineCapacity, Allocator>> { + Vector<blink::MessagePortChannel, inlineCapacity, Allocator>> { STATIC_ONLY(CrossThreadCopier); - using Type = Vector<MessagePortChannel, inlineCapacity, Allocator>; + using Type = Vector<blink::MessagePortChannel, inlineCapacity, Allocator>; static Type Copy(Type pointer) { return pointer; // This is in fact a move. } }; -} // namespace blink +} // namespace WTF -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_CROSS_THREAD_COPIER_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CROSS_THREAD_COPIER_H_
diff --git a/third_party/blink/renderer/platform/cross_thread_functional.h b/third_party/blink/renderer/platform/wtf/cross_thread_functional.h similarity index 66% rename from third_party/blink/renderer/platform/cross_thread_functional.h rename to third_party/blink/renderer/platform/wtf/cross_thread_functional.h index e39e3db..d40905a 100644 --- a/third_party/blink/renderer/platform/cross_thread_functional.h +++ b/third_party/blink/renderer/platform/wtf/cross_thread_functional.h
@@ -2,15 +2,15 @@ // 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_CROSS_THREAD_FUNCTIONAL_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_CROSS_THREAD_FUNCTIONAL_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CROSS_THREAD_FUNCTIONAL_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CROSS_THREAD_FUNCTIONAL_H_ #include <type_traits> #include "base/bind.h" -#include "third_party/blink/renderer/platform/cross_thread_copier.h" +#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/functional.h" -namespace blink { +namespace WTF { // CrossThreadBind() is Bind() for cross-thread task posting. // CrossThreadBind() applies CrossThreadCopier to the arguments. @@ -31,31 +31,34 @@ // Bind(&Func1, 42, str.IsolatedCopy()); template <typename FunctionType, typename... Ps> -WTF::CrossThreadFunction<base::MakeUnboundRunType<FunctionType, Ps...>> +CrossThreadFunction<base::MakeUnboundRunType<FunctionType, Ps...>> CrossThreadBind(FunctionType&& function, Ps&&... parameters) { static_assert( - WTF::internal::CheckGCedTypeRestrictions<std::index_sequence_for<Ps...>, - std::decay_t<Ps>...>::ok, + internal::CheckGCedTypeRestrictions<std::index_sequence_for<Ps...>, + std::decay_t<Ps>...>::ok, "A bound argument uses a bad pattern."); using UnboundRunType = base::MakeUnboundRunType<FunctionType, Ps...>; - return WTF::CrossThreadFunction<UnboundRunType>( + return CrossThreadFunction<UnboundRunType>( base::Bind(function, CrossThreadCopier<std::decay_t<Ps>>::Copy( std::forward<Ps>(parameters))...)); } template <typename FunctionType, typename... Ps> -WTF::CrossThreadOnceFunction<base::MakeUnboundRunType<FunctionType, Ps...>> +CrossThreadOnceFunction<base::MakeUnboundRunType<FunctionType, Ps...>> CrossThreadBindOnce(FunctionType&& function, Ps&&... parameters) { static_assert( - WTF::internal::CheckGCedTypeRestrictions<std::index_sequence_for<Ps...>, - std::decay_t<Ps>...>::ok, + internal::CheckGCedTypeRestrictions<std::index_sequence_for<Ps...>, + std::decay_t<Ps>...>::ok, "A bound argument uses a bad pattern."); using UnboundRunType = base::MakeUnboundRunType<FunctionType, Ps...>; - return WTF::CrossThreadOnceFunction<UnboundRunType>(base::BindOnce( + return CrossThreadOnceFunction<UnboundRunType>(base::BindOnce( std::move(function), CrossThreadCopier<std::decay_t<Ps>>::Copy( std::forward<Ps>(parameters))...)); } -} // namespace blink +} // namespace WTF -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_CROSS_THREAD_FUNCTIONAL_H_ +using WTF::CrossThreadBind; +using WTF::CrossThreadBindOnce; + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_CROSS_THREAD_FUNCTIONAL_H_
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index f0462a0..de407b5 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -610,11 +610,15 @@ 'paths': [ 'third_party/blink/renderer/platform/', ], - # Suppress almost all checks on platform since code in this directory - # is meant to be a bridge between Blink and non-Blink code. However, + # Suppress almost all checks on platform since code in this directory is + # meant to be a bridge between Blink and non-Blink code. However, # base::RefCounted should still be explicitly blocked, since - # WTF::RefCounted should be used instead. - 'allowed': ['(?!base::RefCounted).+'], + # WTF::RefCounted should be used instead. base::RefCountedThreadSafe is + # still needed for cross_thread_copier.h though. + 'allowed': [ + 'base::RefCountedThreadSafe', + '(?!base::RefCounted).+' + ], }, { 'paths': [
diff --git a/third_party/blink/tools/blinkpy/web_tests/merge_results.py b/third_party/blink/tools/blinkpy/web_tests/merge_results.py index a5c6e3f..67a28b83 100644 --- a/third_party/blink/tools/blinkpy/web_tests/merge_results.py +++ b/third_party/blink/tools/blinkpy/web_tests/merge_results.py
@@ -619,10 +619,13 @@ FilenameRegexMatch(r'error_log\.txt$'), MergeFilesLinesSorted(self.filesystem)) - # pywebsocket files aren't particularly useful, so just save them. + # wptserve and pywebsocket files don't need to be merged, so just save them. self.add_helper( FilenameRegexMatch(r'pywebsocket\.ws\.log-.*-err\.txt$'), MergeFilesKeepFiles(self.filesystem)) + self.add_helper( + FilenameRegexMatch(r'wptserve_stderr\.txt$'), + MergeFilesKeepFiles(self.filesystem)) # These JSON files have "result style" JSON in them. results_json_file_merger = MergeFilesJSONP(
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/base.py b/third_party/blink/tools/blinkpy/web_tests/port/base.py index 027e41f..a7d16e7 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/base.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/base.py
@@ -134,19 +134,13 @@ ('trusty', 'x86_64'), ('fuchsia', 'x86_64'), - - # FIXME: Technically this should be 'arm', but adding a third - # architecture type breaks TestConfigurationConverter. - # If we need this to be 'arm' in the future, then we first have to - # fix TestConfigurationConverter. - ('kitkat', 'x86'), ) CONFIGURATION_SPECIFIER_MACROS = { 'mac': ['retina', 'mac10.10', 'mac10.11', 'mac10.12', 'mac10.13'], 'win': ['win7', 'win10'], 'linux': ['trusty'], - 'android': ['kitkat'], + 'fuschia': ['fuchsia'], } # List of ports open on the host that the tests will connect to. When tests
diff --git a/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py b/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py index c70afdb6..dee823b8 100644 --- a/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py +++ b/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py
@@ -51,9 +51,8 @@ self._platform = port_obj.host.platform self._output_dir = output_dir - # On Mac and Linux tmpdir is set to '/tmp' for (i) consistency - # and (ii) because it is hardcoded in the Apache - # ScoreBoardFile directive. + # On Mac and Linux tmpdir is set to '/tmp' for (i) consistency and + # (ii) because it is hardcoded in the Apache ScoreBoardFile directive. tmpdir = tempfile.gettempdir() if self._platform.is_mac() or self._platform.is_linux(): tmpdir = '/tmp' @@ -71,6 +70,10 @@ # Subclasses may override these fields. self._env = None self._cwd = None + # TODO(robertma): There is a risk of deadlocks since we don't read from + # the pipes until the subprocess exits. For now, subclasses need to + # either make sure server processes don't spam on stdout/stderr, or + # redirect them to files. self._stdout = self._executive.PIPE self._stderr = self._executive.PIPE self._process = None
diff --git a/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py b/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py index a94e337..0ddde8d1 100644 --- a/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py +++ b/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py
@@ -23,7 +23,7 @@ http_port, http_alt_port, https_port = (8001, 8081, 8444) ws_port, wss_port = (9001, 9444) self._name = 'wptserve' - self._log_prefixes = ('access_log', 'error_log') + self._log_prefixes = ('wptserve_stderr', ) self._mappings = [{'port': http_port, 'scheme': 'http'}, {'port': http_alt_port, 'scheme': 'http'}, {'port': https_port, 'scheme': 'https', 'sslcert': True}, @@ -45,11 +45,8 @@ start_cmd = [self._port_obj.host.executable, '-u', wpt_script, 'serve', '--config', self._config_file, - '--doc_root', path_to_wpt_tests] - - # TODO(burnik): Merge with default start_cmd once we roll in websockets. - if self._port_obj.host.filesystem.exists(path_to_ws_handlers): - start_cmd += ['--ws_doc_root', path_to_ws_handlers] + '--doc_root', path_to_wpt_tests, + '--ws_doc_root', path_to_ws_handlers] # TODO(burnik): We should stop setting the CWD once WPT can be run without it. self._cwd = path_to_wpt_root @@ -57,6 +54,8 @@ self._env.update({'PYTHONPATH': path_to_pywebsocket}) self._start_cmd = start_cmd + self._error_log_path = self._filesystem.join(output_dir, 'wptserve_stderr.txt') + expiration_date = datetime.date(2025, 1, 4) if datetime.date.today() > expiration_date - datetime.timedelta(30): _log.error( @@ -78,6 +77,13 @@ f.close() return temp_file + def _prepare_config(self): + # wptserve is spammy on stderr even at the INFO log level and will block + # the pipe, so we need to redirect it. + # The file is opened here instead in __init__ because _remove_stale_logs + # will try to delete the log file, which causes deadlocks on Windows. + self._stderr = self._filesystem.open_text_file_for_writing(self._error_log_path) + def _stop_running_server(self): if not self._wait_for_action(self._check_and_kill): # This is mostly for POSIX systems. We send SIGINT in
diff --git a/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py b/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py index 3342f85..4078cba 100644 --- a/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py
@@ -37,7 +37,9 @@ '--config', server._config_file, '--doc_root', - '/test.checkout/wtests/external/wpt' + '/test.checkout/wtests/external/wpt', + '--ws_doc_root', + '/test.checkout/wtests/external/wpt/websockets/handlers' ]) def test_init_gen_config(self):
diff --git a/third_party/blink/web_tests/MSANExpectations b/third_party/blink/web_tests/MSANExpectations index 36271445..35cc111 100644 --- a/third_party/blink/web_tests/MSANExpectations +++ b/third_party/blink/web_tests/MSANExpectations
@@ -245,3 +245,7 @@ crbug.com/856601 [ Linux ] external/wpt/notifications/idlharness.https.window.html [ Pass Timeout ] crbug.com/856601 [ Linux ] external/wpt/fetch/cors-rfc1918/idlharness.tentative.any.serviceworker.html [ Pass Timeout ] crbug.com/856601 [ Linux ] external/wpt/notifications/idlharness.https.any.sharedworker.html [ Pass Timeout ] + +# Sheriff 2019-06-05 +crbug.com/856601 [ Linux ] external/wpt/orientation-event/idlharness.https.window.html [ Pass Timeout ] +crbug.com/856601 [ Linux ] virtual/scalefactor200/external/wpt/css/filter-effects/interfaces.any.html [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index 10c83ef..f4bf81d7 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -24,7 +24,6 @@ # Platform specific virtual test suites. [ Win ] virtual/linux-subpixel/ [ WontFix ] [ Mac ] virtual/linux-subpixel/ [ WontFix ] - [ Android ] virtual/linux-subpixel/ [ WontFix ] # Chrome Win/Linux doesn't support emacs key-bindings. [ Win ] editing/pasteboard/emacs-cntl-y-001.html [ WontFix ] @@ -60,7 +59,6 @@ # Only maintain this for the latest macOS (and Retina is currently 10.12). [ Win ] fast/text/mac-system-ui-trak.html [ WontFix ] [ Linux ] fast/text/mac-system-ui-trak.html [ WontFix ] - [ Android ] fast/text/mac-system-ui-trak.html [ WontFix ] [ Mac10.10 ] fast/text/mac-system-ui-trak.html [ WontFix ] [ Mac10.11 ] fast/text/mac-system-ui-trak.html [ WontFix ] [ Mac10.12 ] fast/text/mac-system-ui-trak.html [ WontFix ] @@ -71,9 +69,6 @@ [ Mac ] fast/forms/select/popup-with-display-none-optgroup.html [ WontFix ] [ Mac ] fast/forms/select-popup [ WontFix ] -# Android has a different popup menu implementation. -[ Android ] fast/forms/select-popup [ WontFix ] - # These tests are specific to Windows and Linux. [ Mac ] fast/forms/calendar-picker/date-open-picker-with-f4-key.html [ WontFix ] [ Mac ] fast/forms/calendar-picker/datetimelocal-open-picker-with-f4-key.html [ WontFix ] @@ -121,12 +116,10 @@ # AAT/mortx shaping not supported on platforms other than Mac [ Linux ] fast/text/aat-morx.html [ WontFix ] [ Win ] fast/text/aat-morx.html [ WontFix ] - [ Android ] fast/text/aat-morx.html [ WontFix ] # AAT Small Caps test not supported on platforms other than Mac 10.13. [ Linux ] fast/text/small-caps-aat.html [ WontFix ] [ Win ] fast/text/small-caps-aat.html [ WontFix ] - [ Android ] fast/text/small-caps-aat.html [ WontFix ] [ Mac10.10 ] fast/text/small-caps-aat.html [ WontFix ] [ Mac10.11 ] fast/text/small-caps-aat.html [ WontFix ] [ Mac10.12 ] fast/text/small-caps-aat.html [ WontFix ] @@ -141,14 +134,6 @@ # Tests in media/stable are only supposed to be run as virtual test (see virtual/stable/media). media/stable [ WontFix ] -# These tests are only supposed be run as virtual test. See /virtual/media-gpu-accelerated/http/tests/media/media-source/. -[ Android ] external/wpt/media-source/mediasource-config-change-mp4-av-audio-bitrate.html [ WontFix ] -[ Android ] external/wpt/media-source/mediasource-config-change-mp4-av-framesize.html [ WontFix ] -[ Android ] external/wpt/media-source/mediasource-config-change-mp4-av-video-bitrate.html [ WontFix ] -[ Android ] external/wpt/media-source/mediasource-config-change-mp4-v-bitrate.html [ WontFix ] -[ Android ] external/wpt/media-source/mediasource-config-change-mp4-v-framerate.html [ WontFix ] -[ Android ] external/wpt/media-source/mediasource-config-change-mp4-v-framesize.html [ WontFix ] - # This test requires a compositor, so only the virtual/threaded/ version is run. external/wpt/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html [ WontFix ] virtual/unified-autoplay/external/wpt/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html [ WontFix ] @@ -299,7 +284,6 @@ # Variable system font only supported on Mac atm. crbug.com/670246 [ Linux ] fast/text/variable-fonts/variable-mac-system-font.html [ WontFix ] -crbug.com/670246 [ Android ] fast/text/variable-fonts/variable-mac-system-font.html [ WontFix ] crbug.com/670246 [ Win ] fast/text/variable-fonts/variable-mac-system-font.html [ WontFix ] crbug.com/670246 [ Mac10.10 ] fast/text/variable-fonts/variable-mac-system-font.html [ WontFix ] @@ -320,13 +304,7 @@ crbug.com/702176 [ Win7 Debug ] fast/table/border-collapsing/001-vertical.html [ WontFix ] crbug.com/702176 [ Win7 Debug ] fast/table/border-collapsing/001.html [ WontFix ] -# Rendering issue only seen in Layout Tests on Android. -# R and B color channels switched on decoded images. -crbug.com/517449 [ Android ] images/optimize-contrast-image.html [ WontFix ] -crbug.com/676561 [ Android ] images/paletted-png-with-color-profile.html [ WontFix ] - # Only Windows supports Symbol CMAP encoded fonts. -crbug.com/627953 [ Android ] fast/text/symbol-cmap.html [ WontFix ] crbug.com/627953 [ Linux ] fast/text/symbol-cmap.html [ WontFix ] crbug.com/627953 [ Mac ] fast/text/symbol-cmap.html [ WontFix ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 35b7b8d..a40fc5e 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -37,8 +37,6 @@ crbug.com/928838 external/wpt/html/user-activation/activation-transfer-cross-origin-with-click.sub.tentative.html [ Failure ] crbug.com/928838 external/wpt/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html [ Failure ] -crbug.com/898987 [ Android ] synthetic_gestures/smooth-scroll-tiny-delta.html [ Failure Pass Timeout ] - # These two are left over from crbug.com/881040, I rebaselined them twice and # they continue to fail. crbug.com/881040 media/controls/lazy-loaded-style.html [ Failure Pass ] @@ -279,7 +277,6 @@ Bug(none) inspector-protocol/layers/get-layers.js [ Skip ] # Before we fully launch BlinkGenPropertyTrees, run visual/disable-blink-gen-property-trees/ on Linux. -crbug.com/836884 [ Android ] virtual/disable-blink-gen-property-trees/ [ Skip ] crbug.com/836884 [ Win ] virtual/disable-blink-gen-property-trees/ [ Skip ] crbug.com/836884 [ Mac ] virtual/disable-blink-gen-property-trees/ [ Skip ] crbug.com/836884 [ Fuchsia ] virtual/disable-blink-gen-property-trees/ [ Skip ] @@ -1632,9 +1629,6 @@ crbug.com/891427 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-scroll-listbox.html [ Pass Failure Timeout Crash ] crbug.com/891427 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-scroll-input-field.html [ Pass Failure Timeout Crash ] -# The following fail only on Android. -crbug.com/891427 [ Android ] virtual/threaded/synthetic_gestures/smooth-scroll-tiny-delta.html [ Pass Failure Timeout Crash ] - # These 6 are special. They are tied to both of these CLs: # - https://chromium-review.googlesource.com/c/chromium/src/+/1213864 # - https://chromium-review.googlesource.com/c/chromium/src/+/1308038 @@ -1707,10 +1701,6 @@ crbug.com/953725 [ Win ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchpad-zoom-in-slow.html [ Failure Pass ] crbug.com/922508 [ Win ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchpad.html [ Failure Pass ] -crbug.com/871139 [ Android ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen-zoom-in-slow.html [ Failure Timeout ] -crbug.com/871139 [ Android ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen-zoom-out-slow.html [ Failure Timeout ] -crbug.com/871139 [ Android ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen.html [ Failure Timeout ] - # gpuBenchmarking.pinchBy is not implemented on Mac for touchscreen pinch crbug.com/613672 [ Mac ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen-zoom-in-slow.html [ Skip ] crbug.com/613672 [ Mac ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen-zoom-out-slow.html [ Skip ] @@ -1768,7 +1758,6 @@ # TODO(oshima): Mac Android are currently not supported. crbug.com/567837 [ Mac ] virtual/scalefactor200withzoom/fast/hidpi/static/ [ Skip ] -crbug.com/567837 [ Android ] virtual/scalefactor200withzoom/fast/hidpi/static/ [ Skip ] # Mac does not support fractional scale factor. crbug.com/567837 [ Mac ] virtual/scalefactor150/fast/hidpi/static [ Skip ] @@ -2846,9 +2835,6 @@ crbug.com/626703 [ Linux ] external/wpt/infrastructure/testdriver/actions/actionsWithKeyPressed.html [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/infrastructure/testdriver/actions/actionsWithKeyPressed.html [ Timeout ] crbug.com/626703 [ Win ] external/wpt/infrastructure/testdriver/actions/actionsWithKeyPressed.html [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius.html [ Failure ] -crbug.com/626703 [ Mac ] external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius.html [ Failure ] -crbug.com/626703 [ Win ] external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius.html [ Failure ] crbug.com/626703 [ Retina ] external/wpt/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-screenx-screeny.html [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/media-source/mediasource-config-change-webm-av-framesize.html [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-negative-duration.html [ Timeout ] @@ -3133,7 +3119,6 @@ crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/block-size-with-min-or-max-content-1b.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/text-indent/text-indent-percentage-004.html [ Failure ] crbug.com/626703 external/wpt/css/filter-effects/filter-subregion-01.html [ Failure ] -crbug.com/626703 [ Android ] external/wpt/css/css-layout-api/auto-block-size-absolute.https.html [ Failure ] crbug.com/626703 [ Mac10.10 ] external/wpt/css/css-layout-api/auto-block-size-absolute.https.html [ Failure ] crbug.com/626703 external/wpt/infrastructure/testdriver/file_upload.sub.html [ Skip ] crbug.com/626703 external/wpt/css/css-text/white-space/text-space-collapse-preserve-breaks-001.xht [ Failure ] @@ -3740,10 +3725,8 @@ crbug.com/626703 external/wpt/css/css-ui/cursor-auto-007.html [ Skip ] crbug.com/626703 external/wpt/requestidlecallback/callback-timeout-when-busy.html [ Timeout ] crbug.com/810669 external/wpt/requestidlecallback/callback-removed-frame.html [ Skip ] -crbug.com/626703 [ Android ] external/wpt/html/semantics/embedded-content/the-object-element/object-events.html [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/html/semantics/embedded-content/the-object-element/object-events.html [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/html/semantics/embedded-content/the-object-element/object-events.html [ Timeout ] -crbug.com/626703 [ Android ] external/wpt/css/css-fonts/font-kerning-02.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-fonts/font-kerning-02.html [ Failure ] crbug.com/626703 external/wpt/2dcontext/building-paths/canvas_complexshapes_arcto_001.htm [ Failure ] crbug.com/626703 external/wpt/2dcontext/building-paths/canvas_complexshapes_beziercurveto_001.htm [ Failure ] @@ -4123,10 +4106,6 @@ crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-quirks-mode.html [ Pass Crash ] crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-standards-mode.html [ Pass Crash Failure ] -# Android doesn't support SharedWorker. -crbug.com/154571 [ Android ] external/wpt/workers/semantics/reporting-errors/002.html [ Skip ] -crbug.com/154571 [ Android ] virtual/omt-worker-fetch/external/wpt/workers/semantics/reporting-errors/002.html [ Skip ] - # Other untriaged test failures, timeouts and crashes from newly-imported WPT tests. crbug.com/626703 external/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html [ Failure Pass ] @@ -4346,6 +4325,7 @@ crbug.com/678493 http/tests/permissions/chromium/test-request-window.html [ Timeout Pass ] crbug.com/678499 http/tests/security/contentSecurityPolicy/require-sri-for/require-sri-for-script-preload-allowed.php [ Failure Pass ] +crbug.com/678499 virtual/blink-cors/http/tests/security/contentSecurityPolicy/require-sri-for/require-sri-for-script-preload-allowed.php [ Failure Pass ] crbug.com/747751 [ Win ] http/tests/devtools/application-panel/resources-panel-resource-preview.js [ Failure Pass ] @@ -4376,24 +4356,6 @@ crbug.com/716320 external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success-and-failure.html [ Failure Timeout ] crbug.com/716320 external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success.html [ Failure Timeout ] -crbug.com/716320 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-messagechannel-success.html [ Failure Timeout ] - -# SharedArrayBuffer is disabled on Android -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-history.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.worker.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.worker.html [ Failure ] -crbug.com/798864 [ Android ] virtual/not-site-per-process/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-domain-success.sub.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-serviceworker-failure.https.html [ Failure ] -crbug.com/798864 [ Android ] virtual/not-site-per-process/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-similar-but-cross-origin-success.sub.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html [ Failure ] -crbug.com/798864 [ Android ] external/wpt/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html [ Failure ] crbug.com/874302 virtual/sharedarraybuffer/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success-and-failure.html [ Timeout ] crbug.com/874302 virtual/sharedarraybuffer/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/broadcastchannel-success.html [ Timeout ] @@ -4683,7 +4645,7 @@ # Suspended WebRTC tests # Timeout due to events not firing crbug.com/781935 fast/mediastream/MediaStreamTrack-observer-iterate-no-crash.html [ Timeout ] -crbug.com/781935 fast/mediastream/MediaStreamTrack.html [ Timeout ] +crbug.com/781935 fast/mediastream/MediaStreamTrack.html [ Pass Failure Timeout ] crbug.com/807191 fast/media/mq-color-gamut-picture.html [ Pass Failure Timeout ] @@ -5077,119 +5039,6 @@ # Sheriff 2018-07-27 crbug.com/868317 [ Mac ] external/wpt/dom/ranges/Range-compareBoundaryPoints.html [ Timeout Pass ] -# Android test failures that have crept in over 2018. -crbug.com/824539 [ Android ] compositing/sibling-positioning.html [ Failure Timeout ] -crbug.com/824539 [ Android ] compositing/geometry/limit-layer-bounds-positioned-transition.html [ Failure ] -crbug.com/824539 [ Android ] compositing/layer-creation/fixed-position-out-of-view.html [ Failure ] -crbug.com/824539 [ Android ] css3/selectors3/html/css3-modsel-18.html [ Failure Timeout ] -crbug.com/824539 [ Android ] css3/selectors3/html/css3-modsel-61.html [ Failure Timeout ] -crbug.com/824539 [ Android ] css3/selectors3/xhtml/css3-modsel-17.xml [ Failure Timeout ] -crbug.com/824539 [ Android ] css3/selectors3/xhtml/css3-modsel-18.xml [ Failure Timeout ] -crbug.com/824539 [ Android ] css3/selectors3/xml/css3-modsel-17.xml [ Failure Timeout ] -crbug.com/824539 [ Android ] css3/selectors3/xml/css3-modsel-18.xml [ Failure Timeout ] -crbug.com/824539 [ Android ] css3/selectors3/xml/css3-modsel-61.xml [ Failure Timeout ] -crbug.com/824539 [ Android ] device_orientation/motion/add-listener-from-callback.html [ Failure ] -crbug.com/824539 [ Android ] editing/execCommand/5190926.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/inserting/5156401-2.html [ Failure ] -### See crbug.com/891427 comment near the top of this file: -crbug.com/824539 [ Android ] editing/pasteboard/paste-line-endings-001.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/pasteboard/paste-line-endings-002.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/pasteboard/paste-line-endings-003.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/pasteboard/paste-line-endings-004.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/pasteboard/paste-line-endings-005.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/pasteboard/paste-text-016.html [ Failure ] -crbug.com/824539 [ Android ] editing/selection/4402375.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/selection/6476.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/selection/leave-requested-block.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/selection/previous-line-position.html [ Failure Timeout ] -crbug.com/824539 [ Android ] editing/style/block-styles-007.html [ Failure Timeout ] -crbug.com/824539 [ Android ] external/wpt/bluetooth/requestDevice/canonicalizeFilter/no-arguments.https.html [ Crash Failure Timeout ] -crbug.com/824539 [ Android ] external/wpt/gamepad/idlharness.html [ Failure ] -crbug.com/824539 [ Android ] external/wpt/web-animations/timing-model/animations/finishing-an-animation.html [ Failure ] -crbug.com/824539 [ Android ] fast/backgrounds/background-clip-text.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/basic/018.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/float/002.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/float/centered-float-avoidance-complexity.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/float/float-in-float-hit-testing.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/float/float-in-float-painting.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/margin-collapse/019.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/margin-collapse/020.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/margin-collapse/block-inside-inline/019.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/block/margin-collapse/block-inside-inline/020.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/child-style-can-override-visited-style.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/clip-zooming.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/compare-content-style.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/first-letter-hover.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/first-letter-visibility.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/focus-ring-multiline.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/font-face-default-font.html [ Timeout ] -crbug.com/824539 [ Android ] fast/css/invalid-percentage-property.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/line-height-font-order.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/line-thickness-underline-strikethrough-overline.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/nth-child-dynamic.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/text-overflow-ellipsis-strict.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/text-overflow-ellipsis.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css/getComputedStyle/getComputedStyle-margin-percentage.html [ Failure ] -crbug.com/824539 [ Android ] fast/css3-text/css3-text-decoration/text-decoration-style-inherit-links.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css3-text/css3-text-decoration/text-decoration-style-inherit-not-propagated-by-out-of-flow.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css3-text/css3-text-decoration/text-decoration-style-inherit-simple-underlines.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css3-text/css3-text-decoration/text-decoration-style-inherit.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/css3-text/css3-text-decoration/text-decoration-style.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/events/reveal-link-when-focused.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/events/wheel/wheelevent-in-text-node.html [ Crash Failure ] -crbug.com/824539 [ Android ] fast/forms/date/date-chooseronly-defaultValue.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/forms/date-multiple-fields/date-multiple-fields-ax-value-changed-notification.html [ Failure ] -crbug.com/824539 [ Android ] fast/harness/perftests/perf-runner-compute-statistics.html [ Failure ] -crbug.com/824539 [ Android ] fast/hidpi/clip-text-in-hidpi.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/inline/inline-box-background-repeat-x.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/inline/inline-box-background-repeat-y.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/inline/inline-box-background.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/inline/inline-focus-ring.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/inline-block/14498-positionForCoordinates.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/inline-block/overflow-clip.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/invalid/009.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/layers/normal-flow-hit-test.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/layers/opacity-transforms.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/lists/003.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/lists/scrolled-marker-paint.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/overflow/position-fixed-transform-clipping.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/replaced/selection-rect-transform.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/selectors/018.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/selectors/061.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/shapes/crash-caused-by-dirtying-a-shape-while-computing-it-requires-a-long-filename-to-crash.html [ Crash Failure ] -crbug.com/824539 [ Android ] fast/speech/scripted/speechrecognition-re-restart.html [ Failure ] -crbug.com/824539 [ Android ] fast/table/border-collapsing/004.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/text/stroking-decorations.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/text/international/001.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/text/international/003.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/text/international/bidi-LDB-2-HTML.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/text/international/bidi-LDB-2-formatting-characters.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/text/international/bidi-neutral-directionality-paragraph-start.html [ Failure Timeout ] -crbug.com/824539 [ Android ] fast/writing-mode/english-lr-text.html [ Failure Timeout ] -crbug.com/824539 [ Android ] http/tests/plugins/navigator-plugins-in-cross-origin-frame.html [ Failure ] -crbug.com/824539 [ Android ] http/tests/security/local-JavaScript-from-remote.html [ Crash Failure ] -crbug.com/824539 [ Android ] images/imagemap-focus-ring-outline-color-not-inherited-from-map.html [ Failure Timeout ] -crbug.com/824539 [ Android ] images/size-failure.html [ Failure ] -crbug.com/824539 [ Android ] paint/invalidation/shadow-multiple.html [ Failure Timeout ] -crbug.com/824539 [ Android ] paint/invalidation/outline/focus-layers.html [ Failure Timeout ] -crbug.com/824539 [ Android ] paint/invalidation/selection/selected-replaced.html [ Failure Timeout ] -crbug.com/824539 [ Android ] paint/invalidation/selection/selection-in-composited-scrolling-container.html [ Failure Timeout ] -crbug.com/824539 [ Android ] presentation/presentationconnectionavailableevent-ctor-mock.html [ Failure ] -crbug.com/824539 [ Android ] svg/as-background-image/svg-width-100p-as-background.html [ Failure Timeout ] -crbug.com/824539 [ Android ] svg/batik/text/textAnchor3.svg [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/bugs/bug1188.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/bugs/bug2479-3.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/bugs/bug2479-4.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/bugs/bug59354.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/bugs/bug7342.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/bugs/bug8950.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/collapsing_borders/bug41262-3.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla/core/bloomberg.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla_expected_failures/bugs/bug1010.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla_expected_failures/bugs/bug1055-2.html [ Failure Timeout ] -crbug.com/824539 [ Android ] tables/mozilla_expected_failures/bugs/bug2479-5.html [ Failure Timeout ] -crbug.com/824539 [ Android ] transforms/transformed-caret.html [ Failure Timeout ] - # Sheriff 2018-07-30 crbug.com/866166 virtual/gpu-rasterization/images/color-profile-image-filter-all.html [ Pass Timeout ] crbug.com/868706 external/wpt/css/css-layout-api/auto-block-size-inflow.https.html [ Pass Failure ] @@ -5210,11 +5059,6 @@ crbug.com/875884 [ Win ] lifecycle/background-change-lifecycle-count.html [ Pass Failure ] crbug.com/875884 [ Win ] virtual/threaded/lifecycle/background-change-lifecycle-count.html [ Pass Failure ] -# Sheriff 2018-08-16 -crbug.com/874733 [ Android ] accessibility/aria-labelledby-on-input.html [ Crash ] -crbug.com/874733 [ Android ] accessibility/aria-link-supports-press.html [ Crash ] -crbug.com/874733 [ Android ] accessibility/insert-adjacent-html-causes-crash.xhtml [ Crash ] - # Test frequently times out on Mac CQ bots. crbug.com/874703 [ Mac ] http/tests/devtools/extensions/extensions-panel.js [ Timeout Pass ] @@ -5258,9 +5102,6 @@ # Flaky crbug.com/894077 virtual/android/fullscreen/video-fixed-background.html [ Pass Failure ] -# Failures on 32-bit Android when using GPU instead of software rendering -crbug.com/875172 [ Android ] http/tests/worklet/webexposed/global-interface-listing-paint-worklet.html [ Pass Failure ] - # Does not set correct realm as scope in current implementation crbug.com/872138 external/wpt/client-hints/accept_ch.tentative.https.html [ Timeout Pass ] @@ -5293,7 +5134,6 @@ crbug.com/662010 [ Win7 ] http/tests/csspaint/invalidation-background-image.html [ Skip ] crbug.com/886566 [ Win10 ] http/tests/csspaint/invalidation-background-image.html [ Pass Timeout ] crbug.com/886566 [ Mac ] http/tests/csspaint/invalidation-background-image.html [ Pass Timeout ] -crbug.com/886566 [ Android ] http/tests/csspaint/invalidation-background-image.html [ Pass Timeout ] crbug.com/886566 http/tests/csspaint/invalidation-border-image.html [ Pass Timeout ] crbug.com/886566 http/tests/csspaint/invalidation-content-image.html [ Pass Timeout ] @@ -5402,9 +5242,6 @@ crbug.com/914782 [ Linux ] virtual/scroll_customization/fast/scrolling/no-hover-during-scroll.html [ Pass Failure ] crbug.com/913931 [ Mac10.11 ] external/wpt/css/css-layout-api/auto-block-size-absolute.https.html [ Pass Failure ] -# Sheriff 2018-12-19 -crbug.com/915862 [ Android ] webmidi/permission.html [ Pass Failure ] - crbug.com/919272 external/wpt/resource-timing/resource-timing.html [ Skip ] ### virtual/streams-native/http/tests/streams/transferable/ @@ -5482,6 +5319,8 @@ crbug.com/922951 http/tests/history/back-to-post.html [ Skip ] crbug.com/922951 http/tests/images/feature-policy-unoptimized-images-cached-image.html [ Skip ] crbug.com/922951 http/tests/security/offscreencanvas-placeholder-read-blocked-no-crossorigin.html [ Skip ] +crbug.com/922951 virtual/blink-cors/http/tests/security/offscreencanvas-placeholder-read-blocked-no-crossorigin.html [ Skip ] +crbug.com/922951 virtual/blink-cors/http/tests/security/cookies/basic.html [ Skip ] crbug.com/922951 http/tests/webaudio/autoplay-crossorigin.html [ Skip ] crbug.com/922951 images/feature-policy-oversized-images-resize.html [ Skip ] crbug.com/922951 media/controls/overflow-menu-hide-on-click-outside-stoppropagation.html [ Skip ] @@ -5569,13 +5408,6 @@ # Sheriff 2019-02-12 crbug.com/931349 [ Mac ] media/video-played-ranges-1.html [ Failure Timeout Pass ] -# Viz on Android causes issues due to synchronization of view / renderer sizes. -crbug.com/930934 [ Android ] compositing/rendering-contexts.html [ Failure ] -crbug.com/930934 [ Android ] paint/invalidation/compositing/should-not-repaint-composited-opacity.html [ Failure ] -crbug.com/930934 [ Android ] paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html [ Failure ] -crbug.com/930934 [ Android ] paint/selection/selection-drag-image-in-iframe.html [ Failure ] -crbug.com/930934 [ Android ] virtual/gpu-rasterization/images/drag-image-descendant-painting-sibling.html [ Failure ] - # Sheriff 2019-02-13 crbug.com/931646 [ Win7 ] http/tests/preload/meta-viewport-link-headers-imagesrcset.html [ Failure Pass ] @@ -5885,4 +5717,6 @@ # Sheriff 2019-06-05 crbug.com/971031 [ Mac ] fast/dom/timer-throttling-hidden-page.html [ Pass Failure ] - +crbug.com/971252 [ Mac ] external/wpt/media-source/mediasource-play.html [ Pass Timeout ] +crbug.com/971259 media/controls/volumechange-stopimmediatepropagation.html [ Pass Failure ] +crbug.com/971262 http/tests/devtools/profiler/live-line-level-heap-profile.js [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json index dbd83c62..b110737 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -39949,6 +39949,18 @@ {} ] ], + "css/css-contain/contain-size-select-001.html": [ + [ + "css/css-contain/contain-size-select-001.html", + [ + [ + "/css/css-contain/reference/contain-size-select-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-strict-001.html": [ [ "css/css-contain/contain-strict-001.html", @@ -135678,6 +135690,11 @@ {} ] ], + "css/css-contain/reference/contain-size-select-001-ref.html": [ + [ + {} + ] + ], "css/css-contain/reference/contain-strict-011-ref.html": [ [ {} @@ -343390,31 +343407,31 @@ "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.actualBoundingBox.html": [ - "484af7c239935c073f29df8fe517000af183cc71", + "3d565e9280fb41ce424ecba8c8c697355727f3ee", "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.advances.html": [ - "ed8c04d0ab791b2aba4b58fdc42935fb936f0bc5", + "af33dfccb357d155b0977e56d558a02bcd42f780", "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.baselines.html": [ - "2472889a607f5a39e10d18f9a53d9addb6ddb9c2", + "d1ab5856b40908b6d6b3f4bf4aaeb4b06776ae47", "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.emHeights.html": [ - "36087e7b035020c51504f9efddb130fda66f4ebd", + "a12f719dfe353e2f14b27c8a7339177960f2c212", "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.fontBoundingBox.html": [ - "1c9bfc492c1d1e57e857cf92ff3cf0172b8b464a", + "f951040f6d9e82ffbd6e36821ec57bb839cff071", "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.width.basic.html": [ - "1cfe16438f4910db4b03e40a00ca8a31e0d9fe85", + "1808cfee6196d253bc26634d997a421bdffbd49c", "testharness" ], "2dcontext/drawing-text-to-the-canvas/2d.text.measure.width.empty.html": [ - "add8ce5ba5f1fcdee619c59f523ae5688166ec93", + "b1dcad60e5c81d7764e9858a606675e87a066473", "testharness" ], "2dcontext/fill-and-stroke-styles/2d.fillStyle.default.html": [ @@ -378577,6 +378594,10 @@ "4684440bdbfd9886fd34a6ba1144ae1724b6a157", "reftest" ], + "css/css-contain/contain-size-select-001.html": [ + "071db67831fd7951b8568ca1b7e4dcc5dbc119a1", + "reftest" + ], "css/css-contain/contain-strict-001.html": [ "142730c5cd3a0048027e5bf41cca397e3facad60", "reftest" @@ -378873,6 +378894,10 @@ "402ff6c95e14c7c6dbe6e91cd779937bf6c4caa8", "support" ], + "css/css-contain/reference/contain-size-select-001-ref.html": [ + "960abc1e158756fca26ed3e42afcc9d97a0d07b1", + "support" + ], "css/css-contain/reference/contain-strict-011-ref.html": [ "3e69ee5ab8da7dadde757b1cdb811d49bd048a0b", "support" @@ -469582,7 +469607,7 @@ "support" ], "interfaces/selection-api.idl": [ - "049759b799ef5e648af670398840e461ccf2c9c0", + "63c96169b08c5a6b4fb4cab3470c71ed08e567d0", "support" ], "interfaces/server-timing.idl": [ @@ -474818,11 +474843,11 @@ "testharness" ], "native-file-system/FileSystemBaseHandle-copyTo.tentative.window.js": [ - "6ce364800b666860b9549c008506927675c873c2", + "972d1dadf1967a122673c29d05e81e7cf8f70889", "testharness" ], "native-file-system/FileSystemBaseHandle-moveTo.tentative.window.js": [ - "13df42c30b9825c0f079349e82d9edf91f1169b9", + "872891870c36d3d7141c39564ecb652fd4dbb2c9", "testharness" ], "native-file-system/FileSystemBaseHandle-remove.tentative.window.js": [ @@ -474830,11 +474855,11 @@ "testharness" ], "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.window.js": [ - "105879dbd1e0cc34cd10d6872d6299ba3fe00431", + "0f8c1b13fa01d6fb5c88455eac86c969b4d04c0a", "testharness" ], "native-file-system/FileSystemDirectoryHandle-getFile.tentative.window.js": [ - "0d9bacd87ee266b9b1637f66808244786c22ebde", + "0b27027f4eddb752b465ccfa5b3843689eb280ea", "testharness" ], "native-file-system/FileSystemWriter.tentative.window.js": [ @@ -474850,7 +474875,7 @@ "support" ], "native-file-system/resources/test-helpers.js": [ - "dc5f376233bd2de148d77a17cf2bcdbc4cc0c687", + "e29927b85247d55d6dfd6d04838d3587158aadf2", "support" ], "navigation-timing/META.yml": [ @@ -483662,7 +483687,7 @@ "testharness" ], "preload/dynamic-adding-preload-imagesrcset.html": [ - "e1b8431d7bcaca618014496342055d533ba7399c", + "6188355e26eb1bd8909184eb76230ffff69c6afd", "testharness" ], "preload/dynamic-adding-preload-nonce.html": [
diff --git a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius-ref.html b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius-ref.html index 72ada884..e0ab6ce 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/css-backgrounds/border-radius-dynamic-from-no-radius-ref.html
@@ -11,7 +11,7 @@ width: 100%; height: 100%; background: green; - border-radius: 50px; + border-radius: 99px; } </style> <p>Should be a green circle below</p>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/selection-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/selection-api.idl index 049759b..63c96169 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/selection-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/selection-api.idl
@@ -3,6 +3,7 @@ // (https://github.com/tidoust/reffy-reports) // Source: Selection API (https://w3c.github.io/selection-api/) +[Exposed=Window] interface Selection { readonly attribute Node? anchorNode; readonly attribute unsigned long anchorOffset;
diff --git a/third_party/blink/web_tests/external/wpt/preload/dynamic-adding-preload-imagesrcset.html b/third_party/blink/web_tests/external/wpt/preload/dynamic-adding-preload-imagesrcset.html index e1b8431..6188355 100644 --- a/third_party/blink/web_tests/external/wpt/preload/dynamic-adding-preload-imagesrcset.html +++ b/third_party/blink/web_tests/external/wpt/preload/dynamic-adding-preload-imagesrcset.html
@@ -9,6 +9,12 @@ <script> t.step(function() { verifyPreloadAndRTSupport(); + var expectation = new Array(4).fill(0); + if (window.devicePixelRatio < 1.5) { + expectation[2] = 1; + } else if (window.devicePixelRatio >= 1.5) { + expectation[3] = 1; + } var link = document.createElement("link"); link.as = "image"; link.rel = "preload"; @@ -17,10 +23,10 @@ link.imageSizes = "400px"; link.onload = t.step_func(function() { t.step_timeout(function() { - verifyNumberOfResourceTimingEntries("resources/square.png?default", 0); - verifyNumberOfResourceTimingEntries("resources/square.png?200", 0); - verifyNumberOfResourceTimingEntries("resources/square.png?400", 1); - verifyNumberOfResourceTimingEntries("resources/square.png?800", 0); + verifyNumberOfResourceTimingEntries("resources/square.png?default", expectation[0]); + verifyNumberOfResourceTimingEntries("resources/square.png?200", expectation[1]); + verifyNumberOfResourceTimingEntries("resources/square.png?400", expectation[2]); + verifyNumberOfResourceTimingEntries("resources/square.png?800", expectation[3]); t.done(); }, 0); });
diff --git a/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-subregion-hw-expected.txt b/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-subregion-hw-expected.txt deleted file mode 100644 index 5a6ac0b..0000000 --- a/third_party/blink/web_tests/platform/mac/virtual/scalefactor200/css3/filters/effect-reference-subregion-hw-expected.txt +++ /dev/null
@@ -1,2 +0,0 @@ -Content-Type: text/plain -#EOF
diff --git a/third_party/closure_compiler/externs/automation.js b/third_party/closure_compiler/externs/automation.js index 2836a0f..d4259b5 100644 --- a/third_party/closure_compiler/externs/automation.js +++ b/third_party/closure_compiler/externs/automation.js
@@ -36,14 +36,14 @@ EXPANDED_CHANGED: 'expandedChanged', FOCUS: 'focus', FOCUS_CONTEXT: 'focusContext', - IMAGE_FRAME_UPDATED: 'imageFrameUpdated', HIDE: 'hide', HIT_TEST_RESULT: 'hitTestResult', HOVER: 'hover', + IMAGE_FRAME_UPDATED: 'imageFrameUpdated', INVALID_STATUS_CHANGED: 'invalidStatusChanged', LAYOUT_COMPLETE: 'layoutComplete', - LIVE_REGION_CREATED: 'liveRegionCreated', LIVE_REGION_CHANGED: 'liveRegionChanged', + LIVE_REGION_CREATED: 'liveRegionCreated', LOAD_COMPLETE: 'loadComplete', LOAD_START: 'loadStart', LOCATION_CHANGED: 'locationChanged', @@ -76,6 +76,7 @@ TEXT_SELECTION_CHANGED: 'textSelectionChanged', WINDOW_ACTIVATED: 'windowActivated', WINDOW_DEACTIVATED: 'windowDeactivated', + WINDOW_VISIBILITY_CHANGED: 'windowVisibilityChanged', TREE_CHANGED: 'treeChanged', VALUE_CHANGED: 'valueChanged', };
diff --git a/third_party/harfbuzz-ng/README.chromium b/third_party/harfbuzz-ng/README.chromium index 9115a95..f1e45a4 100644 --- a/third_party/harfbuzz-ng/README.chromium +++ b/third_party/harfbuzz-ng/README.chromium
@@ -1,9 +1,9 @@ Name: harfbuzz-ng Short Name: harfbuzz-ng URL: http://harfbuzz.org -Version: 2.5.1-3 -Date: 20190603 -Revision: 97b92685775983a280f335423263a6a8d82c3941 +Version: 2.5.1-15 +Date: 20190605 +Revision: 659eeddb2df5b97cc01bd39e106381f65c9f41f1 Security Critical: yes License: MIT License File: src/COPYING
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index f39d7d9..13b5a93 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -964,11 +964,6 @@ <description>Please enter the description of this user action.</description> </action> -<action name="Accel_Show_Or_Switch_Ime"> - <owner>essential-inputs-team@google.com</owner> - <description>Emitted when the user presses the MODECHANGE key.</description> -</action> - <action name="Accel_Show_Stylus_Tools"> <owner>jdufault@chromium.org</owner> <description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 9afcea7f..47baa36 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -12748,6 +12748,7 @@ <int value="93" label="Crostini App Uninstaller"/> <int value="94" label="Crostini Container Upgrade"/> <int value="95" label="Incognito Menu"/> + <int value="96" label="Phone Chooser"/> </enum> <enum name="DialogOriginRelationship"> @@ -23564,6 +23565,7 @@ <int value="5" label="Profile Error Dialog"/> <int value="6" label="SadTab Page"/> <int value="7" label="Supervised User Interstitial"/> + <int value="8" label="Assistant"/> </enum> <enum name="FeedHostMismatch"> @@ -26863,6 +26865,13 @@ <int value="12" label="Failure (invalid public key format)"/> </enum> +<enum name="GCMEncryptionResult"> + <int value="0" label="Success (message decrypted per draft 08)"/> + <int value="1" label="Failure (no keying material available)"/> + <int value="2" label="Failure (unable to compute the shared secret)"/> + <int value="3" label="Failure (unable to encrypt using AES-GCM)"/> +</enum> + <enum name="GCMEndpoints"> <int value="0" label="mtalk.google.com:5228"/> <int value="1" label="mtalk.google.com:443"/> @@ -41777,6 +41786,12 @@ <int value="6" label="Invalid Argument error"/> </enum> +<enum name="NotificationHeaderClickAction"> + <int value="0" label="No action performed"/> + <int value="1" label="Notification expanded"/> + <int value="2" label="Notification collapsed"/> +</enum> + <enum name="NotificationHelperComServerModuleStatus"> <int value="0" label="SUCCESS"/> <int value="1" label="FACTORY_CREATION_FAILED"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 6745c96..a70a777 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -42913,6 +42913,14 @@ </summary> </histogram> +<histogram name="GCM.Crypto.EncryptMessageResult" enum="GCMEncryptionResult"> + <owner>peter@chromium.org</owner> + <summary> + Result of encryption of outgoing GCM message, which includes successfully + encrypted messages and encryption failures. + </summary> +</histogram> + <histogram name="GCM.Crypto.GCMDatabaseUpgradeResult" enum="Boolean" expires_after="M77"> <owner>nator@chromium.org</owner> @@ -74585,7 +74593,7 @@ <summary>All HTTP status codes seen during WebSocket handshakes.</summary> </histogram> -<histogram name="Net.Wifi.InterfaceCount" expires_after="M77"> +<histogram name="Net.Wifi.InterfaceCount" expires_after="2019-10-01"> <owner>mvanouwerkerk@chromium.org</owner> <summary> The number of Wi-fi adapters on the computer. Because the histogram is @@ -74594,12 +74602,12 @@ </summary> </histogram> -<histogram name="Net.Wifi.LbsLatency" units="ms" expires_after="M77"> +<histogram name="Net.Wifi.LbsLatency" units="ms" expires_after="2019-10-01"> <owner>mvanouwerkerk@chromium.org</owner> <summary>The time that a request to Location Based Services takes.</summary> </histogram> -<histogram name="Net.Wifi.ScanLatency" units="ms" expires_after="M77"> +<histogram name="Net.Wifi.ScanLatency" units="ms" expires_after="2019-10-01"> <owner>mvanouwerkerk@chromium.org</owner> <summary>The time that a Wi-fi scan takes.</summary> </histogram> @@ -80404,6 +80412,16 @@ </summary> </histogram> +<histogram name="Notifications.HeaderClick" + enum="NotificationHeaderClickAction" expires_after="M80"> + <owner>knollr@chromium.org</owner> + <owner>peter@chromium.org</owner> + <summary> + Whether a click on a notification header caused it to collapse, expand or + had no effect at all. Logged when clicking on the notification header. + </summary> +</histogram> + <histogram name="Notifications.Icon.FileSize" units="bytes" expires_after="2016-12-01"> <obsolete> @@ -97915,7 +97933,7 @@ </histogram> <histogram name="Power.PowerButtonMenuAction" enum="PowerButtonMenuActionType" - expires_after="M77"> + expires_after="2020-12-23"> <owner>minch@chromium.org</owner> <summary>Actions performed while the power button menu is open.</summary> </histogram>
diff --git a/ui/accessibility/ax_enum_util.cc b/ui/accessibility/ax_enum_util.cc index ec0940e..97591d4 100644 --- a/ui/accessibility/ax_enum_util.cc +++ b/ui/accessibility/ax_enum_util.cc
@@ -118,6 +118,8 @@ return "windowActivated"; case ax::mojom::Event::kWindowDeactivated: return "windowDeactivated"; + case ax::mojom::Event::kWindowVisibilityChanged: + return "windowVisibilityChanged"; case ax::mojom::Event::kTreeChanged: return "treeChanged"; case ax::mojom::Event::kValueChanged: @@ -238,6 +240,8 @@ return ax::mojom::Event::kWindowActivated; if (0 == strcmp(event, "windowDeactivated")) return ax::mojom::Event::kWindowDeactivated; + if (0 == strcmp(event, "windowVisibilityChanged")) + return ax::mojom::Event::kWindowVisibilityChanged; if (0 == strcmp(event, "treeChanged")) return ax::mojom::Event::kTreeChanged; if (0 == strcmp(event, "valueChanged"))
diff --git a/ui/accessibility/ax_enums.mojom b/ui/accessibility/ax_enums.mojom index 1c53469..b55eeef 100644 --- a/ui/accessibility/ax_enums.mojom +++ b/ui/accessibility/ax_enums.mojom
@@ -78,8 +78,9 @@ kShow, // Remove: http://crbug.com/392502 kStateChanged, // Native / Automation kTextChanged, - kWindowActivated, // Native - kWindowDeactivated, // Native + kWindowActivated, // Native + kWindowDeactivated, // Native + kWindowVisibilityChanged, // Native kTextSelectionChanged, kTreeChanged, // Accessibility tree changed. Don't // explicitly fire an accessibility event,
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc index 3f5eed5f..7d0d303d 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux.cc +++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -2589,6 +2589,10 @@ FindAtkObjectParentFrame(GetActiveMenus().back()) == atk_object_) atk_state_set_add_state(atk_state_set, ATK_STATE_ACTIVE); + bool is_minimized = delegate_->IsMinimized(); + if (is_minimized && data.role == ax::mojom::Role::kWindow) + atk_state_set_add_state(atk_state_set, ATK_STATE_ICONIFIED); + if (data.HasState(ax::mojom::State::kCollapsed)) atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDABLE); if (data.HasState(ax::mojom::State::kDefault)) @@ -2608,7 +2612,7 @@ atk_state_set_add_state(atk_state_set, ATK_STATE_HORIZONTAL); if (!data.HasState(ax::mojom::State::kInvisible)) { atk_state_set_add_state(atk_state_set, ATK_STATE_VISIBLE); - if (!delegate_->IsOffscreen()) + if (!delegate_->IsOffscreen() && !is_minimized) atk_state_set_add_state(atk_state_set, ATK_STATE_SHOWING); } if (data.HasState(ax::mojom::State::kMultiselectable)) @@ -3195,6 +3199,24 @@ atk_object_notify_state_change(parent_frame, ATK_STATE_ACTIVE, FALSE); } +void AXPlatformNodeAuraLinux::OnWindowVisibilityChanged() { + DCHECK(atk_object_); + + if (atk_object_get_role(atk_object_) != ATK_ROLE_FRAME) + return; + + bool minimized = delegate_->IsMinimized(); + if (minimized == was_minimized_) + return; + + was_minimized_ = minimized; + if (minimized) + g_signal_emit_by_name(atk_object_, "minimize"); + else + g_signal_emit_by_name(atk_object_, "restore"); + atk_object_notify_state_change(atk_object_, ATK_STATE_ICONIFIED, minimized); +} + void AXPlatformNodeAuraLinux::OnFocused() { DCHECK(atk_object_); @@ -3424,6 +3446,9 @@ case ax::mojom::Event::kWindowDeactivated: OnWindowDeactivated(); break; + case ax::mojom::Event::kWindowVisibilityChanged: + OnWindowVisibilityChanged(); + break; case ax::mojom::Event::kLoadComplete: case ax::mojom::Event::kDocumentTitleChanged: // Sometimes, e.g. upon navigating away from the page, the tree is
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.h b/ui/accessibility/platform/ax_platform_node_auralinux.h index 141013f..8f24a35 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux.h +++ b/ui/accessibility/platform/ax_platform_node_auralinux.h
@@ -105,6 +105,7 @@ void OnDocumentTitleChanged(); void OnSubtreeCreated(); void OnSubtreeWillBeDeleted(); + void OnWindowVisibilityChanged(); bool SupportsSelectionWithAtkSelection(); bool SelectionAndFocusAreTheSame(); @@ -193,6 +194,10 @@ AtkObject* embedded_document_ = nullptr; AtkObject* embedding_window_ = nullptr; + // Whether or not this node (if it is a frame or a window) was + // minimized the last time it's visibility changed. + bool was_minimized_ = false; + DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeAuraLinux); };
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc b/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc index 346358b..01a4359 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc +++ b/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc
@@ -1492,6 +1492,61 @@ g_object_unref(root_atk_object); } +// +// AtkWindow interface and iconified state +// +TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkWindowMinimized) { + AXNodeData root; + root.id = 1; + root.role = ax::mojom::Role::kWindow; + Init(root); + + AtkObject* root_atk_object(GetRootAtkObject()); + EXPECT_TRUE(ATK_IS_OBJECT(root_atk_object)); + g_object_ref(root_atk_object); + + EXPECT_TRUE(ATK_IS_WINDOW(root_atk_object)); + + AtkStateSet* state_set = atk_object_ref_state_set(root_atk_object); + EXPECT_TRUE(ATK_IS_STATE_SET(state_set)); + EXPECT_FALSE(atk_state_set_contains_state(state_set, ATK_STATE_ICONIFIED)); + g_object_unref(state_set); + + GetRootWrapper()->set_minimized(true); + + state_set = atk_object_ref_state_set(root_atk_object); + EXPECT_TRUE(ATK_IS_STATE_SET(state_set)); + EXPECT_TRUE(atk_state_set_contains_state(state_set, ATK_STATE_ICONIFIED)); + g_object_unref(state_set); + + bool saw_state_change = false; + g_signal_connect(root_atk_object, "state-change", + G_CALLBACK(+[](AtkObject* atkobject, gchar* state_changed, + gboolean new_value, bool* flag) { + if (!g_strcmp0(state_changed, "iconified")) + *flag = true; + }), + &saw_state_change); + + AXPlatformNodeAuraLinux* root_node = GetRootPlatformNode(); + static_cast<AXPlatformNodeAuraLinux*>(root_node)->NotifyAccessibilityEvent( + ax::mojom::Event::kWindowVisibilityChanged); + + EXPECT_TRUE(saw_state_change); + + saw_state_change = false; + static_cast<AXPlatformNodeAuraLinux*>(root_node)->NotifyAccessibilityEvent( + ax::mojom::Event::kWindowVisibilityChanged); + EXPECT_FALSE(saw_state_change); + + GetRootWrapper()->set_minimized(false); + static_cast<AXPlatformNodeAuraLinux*>(root_node)->NotifyAccessibilityEvent( + ax::mojom::Event::kWindowVisibilityChanged); + EXPECT_TRUE(saw_state_change); + + g_object_unref(root_atk_object); +} + TEST_F(AXPlatformNodeAuraLinuxTest, TestFocusTriggersAtkWindowActive) { AXNodeData root; root.id = 1;
diff --git a/ui/accessibility/platform/ax_platform_node_delegate.h b/ui/accessibility/platform/ax_platform_node_delegate.h index 158eea2..df4bc673 100644 --- a/ui/accessibility/platform/ax_platform_node_delegate.h +++ b/ui/accessibility/platform/ax_platform_node_delegate.h
@@ -148,6 +148,9 @@ // Get whether this node is offscreen. virtual bool IsOffscreen() const = 0; + // Get whether this node is a minimized window. + virtual bool IsMinimized() const = 0; + // Get whether this node is in web content. virtual bool IsWebContent() const = 0;
diff --git a/ui/accessibility/platform/ax_platform_node_delegate_base.cc b/ui/accessibility/platform/ax_platform_node_delegate_base.cc index 323bbc25..a65c2b15 100644 --- a/ui/accessibility/platform/ax_platform_node_delegate_base.cc +++ b/ui/accessibility/platform/ax_platform_node_delegate_base.cc
@@ -282,6 +282,10 @@ return false; } +bool AXPlatformNodeDelegateBase::IsMinimized() const { + return false; +} + bool AXPlatformNodeDelegateBase::IsWebContent() const { return false; }
diff --git a/ui/accessibility/platform/ax_platform_node_delegate_base.h b/ui/accessibility/platform/ax_platform_node_delegate_base.h index 4301cda..1cf86c94 100644 --- a/ui/accessibility/platform/ax_platform_node_delegate_base.h +++ b/ui/accessibility/platform/ax_platform_node_delegate_base.h
@@ -101,6 +101,9 @@ // Get whether this node is offscreen. bool IsOffscreen() const override; + // Get whether this node is a minimized window. + bool IsMinimized() const override; + // Get whether this node is in web content. bool IsWebContent() const override;
diff --git a/ui/accessibility/platform/test_ax_node_wrapper.cc b/ui/accessibility/platform/test_ax_node_wrapper.cc index 015a8fd..8b59b36 100644 --- a/ui/accessibility/platform/test_ax_node_wrapper.cc +++ b/ui/accessibility/platform/test_ax_node_wrapper.cc
@@ -238,6 +238,10 @@ return nullptr; } +bool TestAXNodeWrapper::IsMinimized() const { + return minimized_; +} + // Walk the AXTree and ensure that all wrappers are created void TestAXNodeWrapper::BuildAllWrappers(AXTree* tree, AXNode* node) { for (auto* child : node->children()) {
diff --git a/ui/accessibility/platform/test_ax_node_wrapper.h b/ui/accessibility/platform/test_ax_node_wrapper.h index 9936d53..b935d6b 100644 --- a/ui/accessibility/platform/test_ax_node_wrapper.h +++ b/ui/accessibility/platform/test_ax_node_wrapper.h
@@ -43,6 +43,7 @@ ~TestAXNodeWrapper() override; AXPlatformNode* ax_platform_node() const { return platform_node_; } + void set_minimized(bool minimized) { minimized_ = minimized; } // Test helpers. void BuildAllWrappers(AXTree* tree, AXNode* node); @@ -75,6 +76,7 @@ AXOffscreenResult* offscreen_result) const override; gfx::NativeViewAccessible HitTestSync(int x, int y) override; gfx::NativeViewAccessible GetFocus() override; + bool IsMinimized() const override; AXPlatformNode* GetFromNodeID(int32_t id) override; int GetIndexInParent() const override; bool IsTable() const override; @@ -145,6 +147,7 @@ ui::AXUniqueId unique_id_; AXPlatformNode* platform_node_; gfx::AcceleratedWidget native_event_target_; + bool minimized_ = false; }; } // namespace ui
diff --git a/ui/display/manager/display_manager.cc b/ui/display/manager/display_manager.cc index 4cf951234..b719974 100644 --- a/ui/display/manager/display_manager.cc +++ b/ui/display/manager/display_manager.cc
@@ -2098,6 +2098,7 @@ new_display.set_touch_support(display_info.touch_support()); new_display.set_maximum_cursor_size(display_info.maximum_cursor_size()); new_display.SetColorSpaceAndDepth(display_info.color_space()); + new_display.set_display_frequency(display_info.refresh_rate()); if (internal_display_has_accelerometer_ && Display::IsInternalDisplayId(id)) { new_display.set_accelerometer_support(
diff --git a/ui/gfx/color_analysis.cc b/ui/gfx/color_analysis.cc index a3079d82..d2f5b56 100644 --- a/ui/gfx/color_analysis.cc +++ b/ui/gfx/color_analysis.cc
@@ -30,7 +30,7 @@ namespace { // RGBA KMean Constants -const uint32_t kNumberOfClusters = 4; +const int kNumberOfClusters = 4; const int kNumberOfIterations = 50; const HSL kDefaultLowerHSLBound = {-1, -1, 0.15}; @@ -413,12 +413,13 @@ // .......... // .3.7...... // .......... - const int kPadX = 1; - const int kPadY = 1; - int x = kPadX + - (calls_ / kNumberOfClusters) * ((width - 2 * kPadX) / kNumberOfClusters); - int y = kPadY + - (calls_ % kNumberOfClusters) * ((height - 2 * kPadY) / kNumberOfClusters); + // But don't inset if the image is too narrow or too short. + const int kInsetX = (width > 2 ? 1 : 0); + const int kInsetY = (height > 2 ? 1 : 0); + int x = kInsetX + (calls_ / kNumberOfClusters) * + ((width - 2 * kInsetX) / kNumberOfClusters); + int y = kInsetY + (calls_ % kNumberOfClusters) * + ((height - 2 * kInsetY) / kNumberOfClusters); int index = x + (y * width); ++calls_; return index % (width * height); @@ -468,7 +469,7 @@ SkColor color = kDefaultBgColor; if (img_width > 0 && img_height > 0) { std::vector<KMeanCluster> clusters; - clusters.resize(kNumberOfClusters, KMeanCluster()); + clusters.resize(static_cast<size_t>(kNumberOfClusters), KMeanCluster()); // Pick a starting point for each cluster auto new_cluster = clusters.begin();
diff --git a/ui/gfx/color_analysis_unittest.cc b/ui/gfx/color_analysis_unittest.cc index 301d07f..4af6c5e6 100644 --- a/ui/gfx/color_analysis_unittest.cc +++ b/ui/gfx/color_analysis_unittest.cc
@@ -323,6 +323,40 @@ EXPECT_TRUE(ChannelApproximatelyEqual(200, SkColorGetB(color))); } +// Regression test for heap-buffer-underlow. https://crbug.com/970343 +TEST_F(ColorAnalysisTest, CalculateKMeanColorOfSmallImage) { + SkBitmap bitmap; + + // Create a 1x41 bitmap, so it is not wide enough to have 1 pixel of padding + // on both sides. + bitmap.allocN32Pixels(1, 41); + bitmap.eraseARGB(255, 100, 150, 200); + + SkColor color = CalculateKMeanColorOfBitmap(bitmap); + EXPECT_EQ(255u, SkColorGetA(color)); + EXPECT_TRUE(ChannelApproximatelyEqual(100, SkColorGetR(color))); + EXPECT_TRUE(ChannelApproximatelyEqual(150, SkColorGetG(color))); + EXPECT_TRUE(ChannelApproximatelyEqual(200, SkColorGetB(color))); + + // Test a wide but narrow bitmap. + bitmap.allocN32Pixels(41, 1); + bitmap.eraseARGB(255, 100, 150, 200); + color = CalculateKMeanColorOfBitmap(bitmap); + EXPECT_EQ(255u, SkColorGetA(color)); + EXPECT_TRUE(ChannelApproximatelyEqual(100, SkColorGetR(color))); + EXPECT_TRUE(ChannelApproximatelyEqual(150, SkColorGetG(color))); + EXPECT_TRUE(ChannelApproximatelyEqual(200, SkColorGetB(color))); + + // Test a tiny bitmap. + bitmap.allocN32Pixels(1, 1); + bitmap.eraseARGB(255, 100, 150, 200); + color = CalculateKMeanColorOfBitmap(bitmap); + EXPECT_EQ(255u, SkColorGetA(color)); + EXPECT_TRUE(ChannelApproximatelyEqual(100, SkColorGetR(color))); + EXPECT_TRUE(ChannelApproximatelyEqual(150, SkColorGetG(color))); + EXPECT_TRUE(ChannelApproximatelyEqual(200, SkColorGetB(color))); +} + TEST_F(ColorAnalysisTest, ComputeColorCovarianceTrivial) { SkBitmap bitmap; bitmap.setInfo(SkImageInfo::MakeN32Premul(100, 200));
diff --git a/ui/gfx/platform_font.h b/ui/gfx/platform_font.h index 50c371d6..2f2a01a 100644 --- a/ui/gfx/platform_font.h +++ b/ui/gfx/platform_font.h
@@ -8,7 +8,6 @@ #include <string> #include "base/memory/ref_counted.h" -#include "base/strings/string16.h" #include "build/build_config.h" #include "ui/gfx/font.h" #include "ui/gfx/gfx_export.h" @@ -16,9 +15,6 @@ namespace gfx { -class Font; -struct FontRenderParams; - class GFX_EXPORT PlatformFont : public base::RefCounted<PlatformFont> { public: // The size of the font returned by CreateDefault() on a "default" platform
diff --git a/ui/gfx/platform_font_skia.cc b/ui/gfx/platform_font_skia.cc index 46e6167..e14df46 100644 --- a/ui/gfx/platform_font_skia.cc +++ b/ui/gfx/platform_font_skia.cc
@@ -112,7 +112,7 @@ bool success = false; std::string family = kFallbackFontFamilyName; - int size_pixels = 12; + int size_pixels = PlatformFont::kDefaultBaseFontSize; int style = Font::NORMAL; Font::Weight weight = Font::Weight::NORMAL; FontRenderParams params;
diff --git a/ui/message_center/views/notification_view_md.cc b/ui/message_center/views/notification_view_md.cc index baedaa98..c6e5f35 100644 --- a/ui/message_center/views/notification_view_md.cc +++ b/ui/message_center/views/notification_view_md.cc
@@ -8,6 +8,7 @@ #include <memory> #include "base/i18n/case_conversion.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "components/url_formatter/elide_url.h" #include "ui/base/class_property.h" @@ -198,6 +199,21 @@ return view; } +// Enum used to record click actions on the notification header. +// Do not re-order or delete these entries; they are used in a UMA histogram. +// Please edit NotificationHeaderClickAction in enums.xml if a value is added. +enum class HeaderClickAction { + kNone = 0, + kExpanded = 1, + kCollapsed = 2, + kMaxValue = kCollapsed, +}; + +// static +void RecordHeaderClickAction(HeaderClickAction action) { + UMA_HISTOGRAM_ENUMERATION("Notifications.HeaderClick", action); +} + } // anonymous namespace // CompactTitleMessageView ///////////////////////////////////////////////////// @@ -720,6 +736,8 @@ // |expand_button| can be focused by TAB. if (sender == header_row_) { if (IsExpandable() && content_row_->GetVisible()) { + RecordHeaderClickAction(IsExpanded() ? HeaderClickAction::kCollapsed + : HeaderClickAction::kExpanded); SetManuallyExpandedOrCollapsed(true); auto weak_ptr = weak_ptr_factory_.GetWeakPtr(); ToggleExpanded(); @@ -729,6 +747,8 @@ return; Layout(); SchedulePaint(); + } else { + RecordHeaderClickAction(HeaderClickAction::kNone); } return; }
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate.cc b/ui/views/accessibility/view_ax_platform_node_delegate.cc index 49769ae..8ec950b0 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate.cc
@@ -399,6 +399,11 @@ return base::string16(); } +bool ViewAXPlatformNodeDelegate::IsMinimized() const { + Widget* widget = view()->GetWidget(); + return widget && widget->IsMinimized(); +} + const ui::AXUniqueId& ViewAXPlatformNodeDelegate::GetUniqueId() const { return ViewAccessibility::GetUniqueId(); }
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate.h b/ui/views/accessibility/view_ax_platform_node_delegate.h index bc16cfef..5c7e638 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate.h +++ b/ui/views/accessibility/view_ax_platform_node_delegate.h
@@ -62,6 +62,7 @@ bool ShouldIgnoreHoveredStateForTesting() override; bool IsOffscreen() const override; base::string16 GetAuthorUniqueId() const override; + bool IsMinimized() const override; // Also in |ViewAccessibility|. const ui::AXUniqueId& GetUniqueId() const override;
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate_auralinux.cc b/ui/views/accessibility/view_ax_platform_node_delegate_auralinux.cc index aa9c6ef..226ce123 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate_auralinux.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate_auralinux.cc
@@ -16,6 +16,7 @@ #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/platform/ax_platform_node_auralinux.h" #include "ui/accessibility/platform/ax_platform_node_delegate_base.h" +#include "ui/aura/window.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/view.h" #include "ui/views/views_delegate.h" @@ -33,7 +34,8 @@ // top-level widget to a vector so we can return the list of all top-level // windows as children of this application object. class AuraLinuxApplication : public ui::AXPlatformNodeDelegateBase, - public WidgetObserver { + public WidgetObserver, + public aura::WindowObserver { public: // Get the single instance of this class. static AuraLinuxApplication* GetInstance() { @@ -53,6 +55,11 @@ widgets_.push_back(widget); widget->AddObserver(this); + + aura::Window* window = widget->GetNativeWindow(); + if (!window) + return; + window->AddObserver(this); } gfx::NativeViewAccessible GetNativeViewAccessible() { @@ -69,6 +76,20 @@ widgets_.erase(iter); } + void OnWindowVisibilityChanged(aura::Window* window, bool visible) override { + for (Widget* widget : widgets_) { + if (widget->GetNativeWindow() != window) + continue; + + View* root_view = widget->GetRootView(); + if (!root_view) + continue; + + root_view->NotifyAccessibilityEvent( + ax::mojom::Event::kWindowVisibilityChanged, true); + } + } + // ui::AXPlatformNodeDelegate: const ui::AXNodeData& GetData() const override { return data_; }
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index 57031c8..270d7bc 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -59,6 +59,15 @@ #include "ui/base/ui_base_features.h" #endif +// TODO(crbug.com/961075): Fix memory leaks in tests and re-enable on LSAN. +#ifdef LEAK_SANITIZER +#define MAYBE_SetSelectionIndices_NestedButtons \ + DISABLED_SetSelectionIndices_NestedButtons +#else +#define MAYBE_SetSelectionIndices_NestedButtons \ + SetSelectionIndices_NestedButtons +#endif + namespace views { namespace test { @@ -2256,7 +2265,7 @@ EXPECT_EQ(5, data.GetIntAttribute(ax::mojom::IntAttribute::kSetSize)); } -TEST_F(MenuControllerTest, SetSelectionIndices_NestedButtons) { +TEST_F(MenuControllerTest, MAYBE_SetSelectionIndices_NestedButtons) { class DummyButtonListener : public ButtonListener { public: ~DummyButtonListener() override = default;
diff --git a/ui/views/examples/button_sticker_sheet.cc b/ui/views/examples/button_sticker_sheet.cc index 8e19bd6a..fb603a1 100644 --- a/ui/views/examples/button_sticker_sheet.cc +++ b/ui/views/examples/button_sticker_sheet.cc
@@ -56,7 +56,7 @@ const float kRowDoesNotResizeVertically = 0.0; const int kPaddingRowHeight = 8; layout->StartRow(kRowDoesNotResizeVertically, kStretchyGridColumnSetId); - layout->AddView(MakePlainLabel(label_text).get()); + layout->AddView(MakePlainLabel(label_text).release()); for (auto& view : views) layout->AddView(view.release()); // This gets added extraneously after the last row, but it doesn't hurt and
diff --git a/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js b/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js index 356107a..ac52512 100644 --- a/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js +++ b/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js
@@ -475,6 +475,7 @@ const name = CrOnc.getStateOrActiveString(properties.Name); const type = CrOnc.getStateOrActiveString(properties.Type); if (!name) { + assert(CrOncStrings); return CrOncStrings['OncType' + type]; } if (type == 'VPN' && properties.VPN) {